[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.7

1.7     ! iwane       1: /* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.6 2008/09/19 10:55:40 iwane 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.7     ! iwane      12: #include <string.h>
        !            13:
1.1       iwane      14: #include "ox_toolkit.h"
                     15: #include "oxserv.h"
1.2       iwane      16: #include "oxstack.h"
1.1       iwane      17: #include "ntl.h"
                     18:
1.7     ! iwane      19:
1.1       iwane      20: #define VERSION 0x00000001
1.7     ! iwane      21: #define ID_STRING "$Revision: 1.6 $"
1.3       iwane      22:
1.6       iwane      23:
1.2       iwane      24: static void
1.6       iwane      25: ntl_executeFunction(const char *func, oxstack_node **arg, int argc)
1.1       iwane      26: {
1.6       iwane      27:        oxstack_node *ans;
1.3       iwane      28:        int i;
1.7     ! iwane      29:        char unknown_mes[50] = "Unknown Function";
1.3       iwane      30:
1.6       iwane      31:        enum {
                     32:                RET_CMO,
                     33:                RET_USR,
                     34:        };
                     35:
1.3       iwane      36:        struct {
                     37:                const char *name;
1.6       iwane      38:                oxstack_node *(*func)(oxstack_node **, int);
                     39:                int return_type;
1.3       iwane      40:        } funcs[] = {
1.6       iwane      41:                {"fctr", ntl_fctr, RET_USR},
                     42:                {"lll", ntl_lll, RET_USR},
                     43:                {NULL, NULL, 0}
1.3       iwane      44:        };
                     45:
                     46:        for (i = 0; funcs[i].name != NULL; i++) {
                     47:                if (strcmp(func, funcs[i].name) == 0) {
                     48:                        ans = funcs[i].func(arg, argc);
                     49:                        oxstack_push(ans);
                     50:                        return ;
                     51:                }
1.1       iwane      52:        }
                     53:
1.7     ! iwane      54:        oxstack_push_cmo((cmo *)new_cmo_error2((cmo *)new_cmo_string(unknown_mes)));
1.1       iwane      55: }
                     56:
                     57:
                     58:
                     59: int
                     60: main(int argc, char *argv[])
                     61: {
1.6       iwane      62:        const int fd = 3;
1.7     ! iwane      63:        char oxntl[10] = "ox_ntl";
        !            64:        char id[30] = ID_STRING;
1.1       iwane      65:
                     66:        OXFILE *oxfp;
                     67:
                     68:        oxfp = oxf_open(fd);
                     69:
                     70:        ox_stderr_init(stderr);
                     71:
1.6       iwane      72:        oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, (void *)(void (*)())ntl_executeFunction, NULL);
                     73:        oxserv_set(OXSERV_SET_DELETE_CMO, (void *)(void (*)())delete_cmon, NULL);
                     74:        oxserv_set(OXSERV_SET_GET_CMOTAG, (void *)(void (*)())get_cmon_tag, NULL);
                     75:        oxserv_set(OXSERV_SET_CONVERT_CMO, (void *)(void (*)())convert_cmon, NULL);
1.7     ! iwane      76:        oxserv_init(oxfp, VERSION, id, oxntl, NULL, NULL);
1.1       iwane      77:
1.6       iwane      78: printf("\n\n");
1.7     ! iwane      79: printf("$MAPLE=%s\n", getenv("MAPLE"));
        !            80: printf("$PATH=%s\n", getenv("PATH"));
        !            81: printf("$LD_LIBRARY_PATH=%s\n", getenv("LD_LIBRARY_PATH"));
        !            82:
        !            83:
1.1       iwane      84:
1.7     ! iwane      85:        oxserv_receive(oxfp);
1.1       iwane      86:        oxserv_dest();
                     87:        oxf_close(oxfp);
                     88:
                     89:        return (0);
                     90: }
                     91:
                     92:

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