Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

wsstdlib.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

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

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, name, WsStdLibRegRec::name, WsStdLibFuncRegRec::num_args, WsStdLibRegRec::num_functions, WsBool, WsUInt16, and WsUInt8.

Referenced by ws_expr_linearize().

00345 {
00346     WsUInt16 l;
00347 
00348     *lindex_found_return = WS_FALSE;
00349     *findex_found_return = WS_FALSE;
00350 
00351     for (l = 0; libraries[l].name != NULL; l++) {
00352         if (strcmp(libraries[l].name, library) == 0) {
00353             WsUInt8 f;
00354 
00355             *lindex_return = libraries[l].library_id;
00356             *lindex_found_return = WS_TRUE;
00357 
00358             for (f = 0; f < libraries[l].num_functions; f++) {
00359                 if (strcmp(libraries[l].functions[f].name, function) == 0) {
00360                     *findex_return = libraries[l].functions[f].function_id;
00361                     *findex_found_return = WS_TRUE;
00362 
00363                     *num_args_return = libraries[l].functions[f].num_args;
00364 
00365                     return WS_TRUE;
00366                 }
00367         }
00368         }
00369     }
00370 
00371     return WS_FALSE;
00372 }

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 WsStdLibFuncRegRec::function_id, WsStdLibRegRec::functions, libraries, WsStdLibRegRec::library_id, WsStdLibFuncRegRec::name, WsStdLibRegRec::name, WsStdLibRegRec::num_functions, WsBool, WsUInt16, and WsUInt8.

00378 {
00379     WsUInt16 l;
00380     WsUInt8 f;
00381 
00382     *library_return = NULL;
00383     *function_return = NULL;
00384 
00385     for (l = 0; libraries[l].name != NULL; l++)
00386         if (libraries[l].library_id == lindex)
00387             for (f = 0; f < libraries[l].num_functions; f++) {
00388                 if (libraries[l].functions[f].function_id == findex) {
00389                     *library_return = libraries[l].name;
00390                     *function_return = libraries[l].functions[f].name;
00391                     return WS_TRUE;
00392                 }
00393             }
00394 
00395     return WS_FALSE;
00396 }

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