Kannel: Open Source WAP and SMS gateway  svn-r5335
wsstdlib.h File Reference

Go to the source code of this file.

Functions

WsBool ws_stdlib_function (const char *library, const char *function, WsUInt16 *lindex_return, WsUInt8 *findex_return, WsUInt8 *num_args_return, WsBool *lindex_found_return, WsBool *findex_found_return)
 
WsBool ws_stdlib_function_name (WsUInt16 lindex, WsUInt8 findex, const char **library_return, const char **function_return)
 

Function Documentation

◆ ws_stdlib_function()

WsBool ws_stdlib_function ( const char *  library,
const char *  function,
WsUInt16 lindex_return,
WsUInt8 findex_return,
WsUInt8 num_args_return,
WsBool lindex_found_return,
WsBool findex_found_return 
)

Definition at line 341 of file wsstdlib.c.

References WsStdLibFuncRegRec::function_id, WsStdLibRegRec::functions, libraries, WsStdLibRegRec::library_id, WsStdLibRegRec::name, name, WsStdLibFuncRegRec::num_args, WsStdLibRegRec::num_functions, WS_FALSE, and WS_TRUE.

Referenced by ws_expr_linearize().

345 {
346  WsUInt16 l;
347 
348  *lindex_found_return = WS_FALSE;
349  *findex_found_return = WS_FALSE;
350 
351  for (l = 0; libraries[l].name != NULL; l++) {
352  if (strcmp(libraries[l].name, library) == 0) {
353  WsUInt8 f;
354 
355  *lindex_return = libraries[l].library_id;
356  *lindex_found_return = WS_TRUE;
357 
358  for (f = 0; f < libraries[l].num_functions; f++) {
359  if (strcmp(libraries[l].functions[f].name, function) == 0) {
360  *findex_return = libraries[l].functions[f].function_id;
361  *findex_found_return = WS_TRUE;
362 
363  *num_args_return = libraries[l].functions[f].num_args;
364 
365  return WS_TRUE;
366  }
367  }
368  }
369  }
370 
371  return WS_FALSE;
372 }
Definition: wsint.h:131
WsUInt8 num_functions
Definition: wsstdlib.c:109
static WsStdLibReg libraries[]
Definition: wsstdlib.c:316
char * name
Definition: wsstdlib.c:104
WsUInt8 function_id
Definition: wsstdlib.c:96
unsigned char WsUInt8
Definition: wsint.h:116
unsigned short WsUInt16
Definition: wsint.h:119
char * name
Definition: smsc_cimd2.c:212
WsUInt16 library_id
Definition: wsstdlib.c:106
WsStdLibFuncReg * functions
Definition: wsstdlib.c:112

◆ ws_stdlib_function_name()

WsBool ws_stdlib_function_name ( WsUInt16  lindex,
WsUInt8  findex,
const char **  library_return,
const char **  function_return 
)

Definition at line 375 of file wsstdlib.c.

References WsStdLibRegRec::functions, libraries, WsStdLibRegRec::library_id, WsStdLibFuncRegRec::name, WsStdLibRegRec::name, WsStdLibRegRec::num_functions, WS_FALSE, and WS_TRUE.

Referenced by ws_asm_dasm(), and ws_asm_print().

378 {
379  WsUInt16 l;
380  WsUInt8 f;
381 
382  *library_return = NULL;
383  *function_return = NULL;
384 
385  for (l = 0; libraries[l].name != NULL; l++)
386  if (libraries[l].library_id == lindex)
387  for (f = 0; f < libraries[l].num_functions; f++) {
388  if (libraries[l].functions[f].function_id == findex) {
389  *library_return = libraries[l].name;
390  *function_return = libraries[l].functions[f].name;
391  return WS_TRUE;
392  }
393  }
394 
395  return WS_FALSE;
396 }
Definition: wsint.h:131
WsUInt8 num_functions
Definition: wsstdlib.c:109
static WsStdLibReg libraries[]
Definition: wsstdlib.c:316
char * name
Definition: wsstdlib.c:104
unsigned char WsUInt8
Definition: wsint.h:116
unsigned short WsUInt16
Definition: wsint.h:119
WsStdLibFuncReg * functions
Definition: wsstdlib.c:112
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.