[BACK]Return to main.cpp CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_ntl

Annotation of OpenXM/src/ox_ntl/main.cpp, Revision 1.6

1.6     ! iwane       1: /* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.5 2004/07/05 10:08:35 ohara Exp $ */
1.1       iwane       2:
1.6     ! iwane       3: /*
        !             4: [1208] ox_launch(0, "/home/openxm/OpenXM/src/ox_ntl/ox_ntl");
        !             5: 0
        !             6: [1210] load("ntl.rr");
        !             7: [1229] ntl.factor(0, x^2-1);
        !             8: [[1,1],[x+1,1],[x-1,1]]
        !             9: [1231] ox_shutdown(0);
        !            10: 0
        !            11:  */
1.1       iwane      12: #include "ox_toolkit.h"
                     13: #include "oxserv.h"
1.2       iwane      14: #include "oxstack.h"
1.1       iwane      15: #include "ntl.h"
                     16:
                     17: #define VERSION 0x00000001
                     18: #define ID_STRING "$Revision: 1.1 $"
1.3       iwane      19:
1.6     ! iwane      20:
1.2       iwane      21: static void
1.6     ! iwane      22: ntl_executeFunction(const char *func, oxstack_node **arg, int argc)
1.1       iwane      23: {
1.6     ! iwane      24:        oxstack_node *ans;
1.3       iwane      25:        int i;
                     26:
1.6     ! iwane      27:        enum {
        !            28:                RET_CMO,
        !            29:                RET_USR,
        !            30:        };
        !            31:
1.3       iwane      32:        struct {
                     33:                const char *name;
1.6     ! iwane      34:                oxstack_node *(*func)(oxstack_node **, int);
        !            35:                int return_type;
1.3       iwane      36:        } funcs[] = {
1.6     ! iwane      37:                {"fctr", ntl_fctr, RET_USR},
        !            38:                {"lll", ntl_lll, RET_USR},
        !            39:                {NULL, NULL, 0}
1.3       iwane      40:        };
                     41:
                     42:        for (i = 0; funcs[i].name != NULL; i++) {
                     43:                if (strcmp(func, funcs[i].name) == 0) {
                     44:                        ans = funcs[i].func(arg, argc);
                     45:                        oxstack_push(ans);
                     46:                        return ;
                     47:                }
1.1       iwane      48:        }
                     49:
1.6     ! iwane      50:        oxstack_push_cmo((cmo *)new_cmo_error2((cmo *)new_cmo_string("Unknown Function")));
1.1       iwane      51: }
                     52:
                     53:
                     54:
                     55: int
                     56: main(int argc, char *argv[])
                     57: {
1.6     ! iwane      58:        const int fd = 3;
1.1       iwane      59:        int ret;
                     60:
                     61:        OXFILE *oxfp;
                     62:
                     63:        oxfp = oxf_open(fd);
                     64:
                     65:        ox_stderr_init(stderr);
                     66:
1.6     ! iwane      67:        oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, (void *)(void (*)())ntl_executeFunction, NULL);
        !            68:        oxserv_set(OXSERV_SET_DELETE_CMO, (void *)(void (*)())delete_cmon, NULL);
        !            69:        oxserv_set(OXSERV_SET_GET_CMOTAG, (void *)(void (*)())get_cmon_tag, NULL);
        !            70:        oxserv_set(OXSERV_SET_CONVERT_CMO, (void *)(void (*)())convert_cmon, NULL);
1.1       iwane      71:        oxserv_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL);
                     72:
1.6     ! iwane      73: printf("\n\n");
        !            74: printf("MAPLE=%s\n", getenv("MAPLE"));
        !            75: printf("PATH=%s\n", getenv("PATH"));
        !            76: printf("LD_LIBRARY_PATH=%s\n", getenv("LD_LIBRARY_PATH"));
        !            77: sleep(10000);
1.3       iwane      78:        ret = oxserv_receive(oxfp);
1.1       iwane      79:
                     80:        oxserv_dest();
                     81:        oxf_close(oxfp);
                     82:
                     83:        return (0);
                     84: }
                     85:
                     86:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>