=================================================================== RCS file: /home/cvs/OpenXM/src/ox_ntl/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/ox_ntl/main.cpp 2003/11/08 12:34:00 1.2 +++ OpenXM/src/ox_ntl/main.cpp 2003/11/15 09:06:20 1.3 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.1 2003/11/03 03:11:21 iwane Exp $ */ +/* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.2 2003/11/08 12:34:00 iwane Exp $ */ #include "ox_toolkit.h" #include "oxserv.h" @@ -6,7 +6,7 @@ #include "ntl.h" #define VERSION 0x00000001 -#define ID_STRING "$Revision: 1.2 $" +#define ID_STRING "$Revision: 1.3 $" #if 0 extern "C" { @@ -14,14 +14,28 @@ void dprintf(const char *, ...); } #endif + static void ntl_executeFunction(const char *func, cmo **arg, int argc) { cmo *ans; - if (strcmp(func, "fctr") == 0) { - ans = ntl_fctr(arg, argc); - oxstack_push(ans); - return ; + int i; + + struct { + const char *name; + cmo *(*func)(cmo **, int); + } funcs[] = { + {"fctr", ntl_fctr}, + {"lll", ntl_lll}, + {NULL, NULL}, + }; + + for (i = 0; funcs[i].name != NULL; i++) { + if (strcmp(func, funcs[i].name) == 0) { + ans = funcs[i].func(arg, argc); + oxstack_push(ans); + return ; + } } oxstack_push((cmo *)new_cmo_error2((cmo *)new_cmo_string("Unknown Function"))); @@ -33,7 +47,6 @@ int main(int argc, char *argv[]) { int fd = 3; - int i; int ret; OXFILE *oxfp; @@ -43,13 +56,12 @@ main(int argc, char *argv[]) ox_stderr_init(stderr); oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, ntl_executeFunction, NULL); + oxserv_set(OXSERV_SET_DELETE_CMO, delete_cmon, NULL); + oxserv_set(OXSERV_SET_GET_CMOTAG, get_cmon_tag, NULL); + oxserv_set(OXSERV_SET_CONVERT_CMO, convert_cmon, NULL); oxserv_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL); - for (i = 0;; i++) { - ret = oxserv_receive(oxfp); - if (ret != OXSERV_SUCCESS) - break; - } + ret = oxserv_receive(oxfp); oxserv_dest(); oxf_close(oxfp);