Annotation of OpenXM/src/ox_ntl/main.cpp, Revision 1.3
1.3 ! iwane 1: /* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.2 2003/11/08 12:34:00 iwane Exp $ */
1.1 iwane 2:
3: #include "ox_toolkit.h"
4: #include "oxserv.h"
1.2 iwane 5: #include "oxstack.h"
1.1 iwane 6: #include "ntl.h"
7:
8: #define VERSION 0x00000001
9: #define ID_STRING "$Revision: 1.1 $"
10:
1.2 iwane 11: #if 0
1.1 iwane 12: extern "C" {
13: void dprintf(const char *, ...);
14: }
15: #endif
16:
1.3 ! iwane 17:
1.2 iwane 18: static void
1.1 iwane 19: ntl_executeFunction(const char *func, cmo **arg, int argc)
20: {
1.2 iwane 21: cmo *ans;
1.3 ! iwane 22: int i;
! 23:
! 24: struct {
! 25: const char *name;
! 26: cmo *(*func)(cmo **, int);
! 27: } funcs[] = {
! 28: {"fctr", ntl_fctr},
! 29: {"lll", ntl_lll},
! 30: {NULL, NULL},
! 31: };
! 32:
! 33: for (i = 0; funcs[i].name != NULL; i++) {
! 34: if (strcmp(func, funcs[i].name) == 0) {
! 35: ans = funcs[i].func(arg, argc);
! 36: oxstack_push(ans);
! 37: return ;
! 38: }
1.1 iwane 39: }
40:
1.2 iwane 41: oxstack_push((cmo *)new_cmo_error2((cmo *)new_cmo_string("Unknown Function")));
1.1 iwane 42: }
43:
44:
45:
46: int
47: main(int argc, char *argv[])
48: {
49: int fd = 3;
50: int ret;
51:
52: OXFILE *oxfp;
53:
54: oxfp = oxf_open(fd);
55:
56: ox_stderr_init(stderr);
57:
58: oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, ntl_executeFunction, NULL);
1.3 ! iwane 59: oxserv_set(OXSERV_SET_DELETE_CMO, delete_cmon, NULL);
! 60: oxserv_set(OXSERV_SET_GET_CMOTAG, get_cmon_tag, NULL);
! 61: oxserv_set(OXSERV_SET_CONVERT_CMO, convert_cmon, NULL);
1.1 iwane 62: oxserv_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL);
63:
1.3 ! iwane 64: ret = oxserv_receive(oxfp);
1.1 iwane 65:
66: oxserv_dest();
67: oxf_close(oxfp);
68:
69: return (0);
70: }
71:
72:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>