Kannel: Open Source WAP and SMS gateway  $Revision: 5037 $
wsstdlib.c File Reference
#include "wsint.h"

Go to the source code of this file.

Data Structures

struct  WsStdLibFuncRegRec
 
struct  WsStdLibRegRec
 

Macros

#define NF(f)   (sizeof(f) / sizeof(f[0]))
 

Typedefs

typedef struct WsStdLibFuncRegRec WsStdLibFuncReg
 
typedef struct WsStdLibRegRec WsStdLibReg
 

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)
 

Variables

static WsStdLibFuncReg lib_lang_functions []
 
static WsStdLibFuncReg lib_float_functions []
 
static WsStdLibFuncReg lib_string_functions []
 
static WsStdLibFuncReg lib_url_functions []
 
static WsStdLibFuncReg lib_wmlbrowser_functions []
 
static WsStdLibFuncReg lib_dialogs_functions []
 
static WsStdLibFuncReg lib_crypto_functions []
 
static WsStdLibFuncReg lib_efi_functions []
 
static WsStdLibFuncReg lib_wtapublic_functions []
 
static WsStdLibFuncReg lib_wtavoicecall_functions []
 
static WsStdLibFuncReg lib_wtanettext_functions []
 
static WsStdLibFuncReg lib_wtaphonebook_functions []
 
static WsStdLibFuncReg lib_wtamisc_functions []
 
static WsStdLibFuncReg lib_wtaansi136_functions []
 
static WsStdLibFuncReg lib_wtagsm_functions []
 
static WsStdLibFuncReg lib_wtacalllog_functions []
 
static WsStdLibFuncReg lib_wtapdc_functions []
 
static WsStdLibFuncReg lib_wtais95_functions []
 
static WsStdLibReg libraries []
 

Macro Definition Documentation

#define NF (   f)    (sizeof(f) / sizeof(f[0]))

Definition at line 85 of file wsstdlib.c.

Typedef Documentation

Definition at line 99 of file wsstdlib.c.

typedef struct WsStdLibRegRec WsStdLibReg

Definition at line 115 of file wsstdlib.c.

Function Documentation

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, 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
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, 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

Variable Documentation

WsStdLibFuncReg lib_crypto_functions[]
static
Initial value:
=
{
{"signText", 4, 16},
}

Definition at line 206 of file wsstdlib.c.

WsStdLibFuncReg lib_dialogs_functions[]
static
Initial value:
=
{
{"prompt", 2, 0},
{"confirm", 3, 1},
{"alert", 1, 2},
}

Definition at line 199 of file wsstdlib.c.

WsStdLibFuncReg lib_efi_functions[]
static
Initial value:
=
{
{"set", 3, 0},
{"get", 2, 1},
{"getFirstName", 1, 2},
{"getNextName", 2, 3},
{"getAllAttributes", 1, 4},
{"getAttribute", 2, 5},
{"getClassProperty", 2, 6},
{"getUnits", 1, 7},
{"query", 1, 8},
{"invoke", 3, 9},
{"call", 3, 10},
{"status", 1, 11},
{"control", 3, 12},
}

Definition at line 211 of file wsstdlib.c.

WsStdLibFuncReg lib_float_functions[]
static
Initial value:
=
{
{"int", 1, 0},
{"floor", 1, 1},
{"ceil", 1, 2},
{"pow", 2, 3},
{"round", 1, 4},
{"sqrt", 1, 5},
{"maxFloat", 0, 6},
{"minFloat", 0, 7},
}

Definition at line 138 of file wsstdlib.c.

WsStdLibFuncReg lib_lang_functions[]
static
Initial value:
=
{
{"abs", 1, 0},
{"min", 2, 1},
{"max", 2, 2},
{"parseInt", 1, 3},
{"parseFloat", 1, 4},
{"isInt", 1, 5},
{"isFloat", 1, 6},
{"maxInt", 0, 7},
{"minInt", 0, 8},
{"float", 0, 9},
{"exit", 1, 10},
{"abort", 1, 11},
{"random", 1, 12},
{"seed", 1, 13},
{"characterSet", 0, 14},
}

Definition at line 119 of file wsstdlib.c.

WsStdLibFuncReg lib_string_functions[]
static
Initial value:
=
{
{"length", 1, 0},
{"isEmpty", 1, 1},
{"charAt", 2, 2},
{"subString", 3, 3},
{"find", 2, 4},
{"replace", 3, 5},
{"elements", 2, 6},
{"elementAt", 3, 7},
{"removeAt", 3, 8},
{"replaceAt", 4, 9},
{"insertAt", 4, 10},
{"squeeze", 1, 11},
{"trim", 1, 12},
{"compare", 2, 13},
{"toString", 1, 14},
{"format", 2, 15},
}

Definition at line 150 of file wsstdlib.c.

WsStdLibFuncReg lib_url_functions[]
static
Initial value:
=
{
{"isValid", 1, 0},
{"getScheme", 1, 1},
{"getHost", 1, 2},
{"getPort", 1, 3},
{"getPath", 1, 4},
{"getParameters", 1, 5},
{"getQuery", 1, 6},
{"getFragment", 1, 7},
{"getBase", 0, 8},
{"getReferer", 0, 9},
{"resolve", 2, 10},
{"escapeString", 1, 11},
{"unescapeString", 1, 12},
{"loadString", 2, 13},
}

Definition at line 170 of file wsstdlib.c.

WsStdLibFuncReg lib_wmlbrowser_functions[]
static
Initial value:
=
{
{"getVar", 1, 0},
{"setVar", 2, 1},
{"go", 1, 2},
{"prev", 0, 3},
{"newContext", 0, 4},
{"getCurrentCard", 0, 5},
{"refresh", 0, 6},
}

Definition at line 188 of file wsstdlib.c.

WsStdLibFuncReg lib_wtaansi136_functions[]
static
Initial value:
=
{
{"sendFlash", 2, 0},
{"sendAlert", 2, 1},
}

Definition at line 271 of file wsstdlib.c.

WsStdLibFuncReg lib_wtacalllog_functions[]
static
Initial value:
=
{
{"dialled", 1, 0},
{"missed", 1, 1},
{"received", 1, 2},
{"getFieldValue", 2, 3},
}

Definition at line 291 of file wsstdlib.c.

WsStdLibFuncReg lib_wtagsm_functions[]
static
Initial value:
=
{
{"hold", 1, 0},
{"retrieve", 1, 1},
{"transfer", 2, 2},
{"deflect", 2, 3},
{"multiparty", 0, 4},
{"seperate", 1, 5},
{"sendUSSD", 4, 6},
{"netinfo", 1, 7},
{"callWaiting", 1, 8},
{"sendBusy", 1, 9},
}

Definition at line 277 of file wsstdlib.c.

WsStdLibFuncReg lib_wtais95_functions[]
static
Initial value:
=
{
{"sendText", 6, 0},
{"cancelText", 1, 1},
{"sendAck", 1, 2},
}

Definition at line 309 of file wsstdlib.c.

WsStdLibFuncReg lib_wtamisc_functions[]
static
Initial value:
=
{
{"setIndicator", 2, 0},
{"endContext", 0, 1},
{"getProtection", 0, 2},
{"setProtection", 1, 3},
}

Definition at line 263 of file wsstdlib.c.

WsStdLibFuncReg lib_wtanettext_functions[]
static
Initial value:
=
{
{"send", 2, 0},
{"list", 2, 1},
{"remove", 1, 2},
{"getFieldValue", 2, 3},
{"markAsRead", 1, 4},
}

Definition at line 245 of file wsstdlib.c.

WsStdLibFuncReg lib_wtapdc_functions[]
static
Initial value:
=
{
{"hold", 1, 0},
{"retrieve", 1, 1},
{"transfer", 2, 2},
{"deflect", 2, 3},
{"multiparty", 0, 4},
{"seperate", 1, 5},
}

Definition at line 299 of file wsstdlib.c.

WsStdLibFuncReg lib_wtaphonebook_functions[]
static
Initial value:
=
{
{"write", 3, 0},
{"search", 2, 1},
{"remove", 1, 2},
{"getFieldValue", 2, 3},
{"change", 3, 4},
}

Definition at line 254 of file wsstdlib.c.

WsStdLibFuncReg lib_wtapublic_functions[]
static
Initial value:
=
{
{"makeCall", 1, 0},
{"sendDTMF", 1, 1},
{"addPBEntry", 2, 2},
}

Definition at line 228 of file wsstdlib.c.

WsStdLibFuncReg lib_wtavoicecall_functions[]
static
Initial value:
=
{
{"setup", 2, 0},
{"accept", 2, 1},
{"release", 1, 2},
{"sendDTMF", 2, 3},
{"callStatus", 2, 4},
{"list", 1, 5},
}

Definition at line 235 of file wsstdlib.c.

WsStdLibReg libraries[]
static
Initial value:
=
{
{NULL, 0, 0, NULL}
}
static WsStdLibFuncReg lib_float_functions[]
Definition: wsstdlib.c:138
static WsStdLibFuncReg lib_string_functions[]
Definition: wsstdlib.c:150
static WsStdLibFuncReg lib_wmlbrowser_functions[]
Definition: wsstdlib.c:188
static WsStdLibFuncReg lib_wtapdc_functions[]
Definition: wsstdlib.c:299
static WsStdLibFuncReg lib_wtapublic_functions[]
Definition: wsstdlib.c:228
static WsStdLibFuncReg lib_wtais95_functions[]
Definition: wsstdlib.c:309
static WsStdLibFuncReg lib_wtacalllog_functions[]
Definition: wsstdlib.c:291
static WsStdLibFuncReg lib_efi_functions[]
Definition: wsstdlib.c:211
static WsStdLibFuncReg lib_crypto_functions[]
Definition: wsstdlib.c:206
static WsStdLibFuncReg lib_wtamisc_functions[]
Definition: wsstdlib.c:263
static WsStdLibFuncReg lib_wtagsm_functions[]
Definition: wsstdlib.c:277
static WsStdLibFuncReg lib_dialogs_functions[]
Definition: wsstdlib.c:199
static WsStdLibFuncReg lib_lang_functions[]
Definition: wsstdlib.c:119
static WsStdLibFuncReg lib_url_functions[]
Definition: wsstdlib.c:170
static WsStdLibFuncReg lib_wtanettext_functions[]
Definition: wsstdlib.c:245
static WsStdLibFuncReg lib_wtavoicecall_functions[]
Definition: wsstdlib.c:235
#define NF(f)
Definition: wsstdlib.c:85
static WsStdLibFuncReg lib_wtaansi136_functions[]
Definition: wsstdlib.c:271
static WsStdLibFuncReg lib_wtaphonebook_functions[]
Definition: wsstdlib.c:254

Definition at line 316 of file wsstdlib.c.

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.