version 1.3, 2003/11/15 09:06:20 |
version 1.7, 2013/10/18 01:28:52 |
|
|
/* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.2 2003/11/08 12:34:00 iwane Exp $ */ |
/* $OpenXM: OpenXM/src/ox_ntl/main.cpp,v 1.6 2008/09/19 10:55:40 iwane Exp $ */ |
|
|
|
/* |
|
[1208] ox_launch(0, "/home/openxm/OpenXM/src/ox_ntl/ox_ntl"); |
|
0 |
|
[1210] load("ntl.rr"); |
|
[1229] ntl.factor(0, x^2-1); |
|
[[1,1],[x+1,1],[x-1,1]] |
|
[1231] ox_shutdown(0); |
|
0 |
|
*/ |
|
#include <string.h> |
|
|
#include "ox_toolkit.h" |
#include "ox_toolkit.h" |
#include "oxserv.h" |
#include "oxserv.h" |
#include "oxstack.h" |
#include "oxstack.h" |
#include "ntl.h" |
#include "ntl.h" |
|
|
|
|
#define VERSION 0x00000001 |
#define VERSION 0x00000001 |
#define ID_STRING "$Revision$" |
#define ID_STRING "$Revision$" |
|
|
#if 0 |
|
extern "C" { |
|
void dprintf(const char *, ...); |
|
} |
|
#endif |
|
|
|
|
|
static void |
static void |
ntl_executeFunction(const char *func, cmo **arg, int argc) |
ntl_executeFunction(const char *func, oxstack_node **arg, int argc) |
{ |
{ |
cmo *ans; |
oxstack_node *ans; |
int i; |
int i; |
|
char unknown_mes[50] = "Unknown Function"; |
|
|
|
enum { |
|
RET_CMO, |
|
RET_USR, |
|
}; |
|
|
struct { |
struct { |
const char *name; |
const char *name; |
cmo *(*func)(cmo **, int); |
oxstack_node *(*func)(oxstack_node **, int); |
|
int return_type; |
} funcs[] = { |
} funcs[] = { |
{"fctr", ntl_fctr}, |
{"fctr", ntl_fctr, RET_USR}, |
{"lll", ntl_lll}, |
{"lll", ntl_lll, RET_USR}, |
{NULL, NULL}, |
{NULL, NULL, 0} |
}; |
}; |
|
|
for (i = 0; funcs[i].name != NULL; i++) { |
for (i = 0; funcs[i].name != NULL; i++) { |
Line 38 ntl_executeFunction(const char *func, cmo **arg, int a |
|
Line 51 ntl_executeFunction(const char *func, cmo **arg, int a |
|
} |
} |
} |
} |
|
|
oxstack_push((cmo *)new_cmo_error2((cmo *)new_cmo_string("Unknown Function"))); |
oxstack_push_cmo((cmo *)new_cmo_error2((cmo *)new_cmo_string(unknown_mes))); |
} |
} |
|
|
|
|
Line 46 ntl_executeFunction(const char *func, cmo **arg, int a |
|
Line 59 ntl_executeFunction(const char *func, cmo **arg, int a |
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
int fd = 3; |
const int fd = 3; |
int ret; |
char oxntl[10] = "ox_ntl"; |
|
char id[30] = ID_STRING; |
|
|
OXFILE *oxfp; |
OXFILE *oxfp; |
|
|
Line 55 main(int argc, char *argv[]) |
|
Line 69 main(int argc, char *argv[]) |
|
|
|
ox_stderr_init(stderr); |
ox_stderr_init(stderr); |
|
|
oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, ntl_executeFunction, NULL); |
oxserv_set(OXSERV_SET_EXECUTE_FUNCTION, (void *)(void (*)())ntl_executeFunction, NULL); |
oxserv_set(OXSERV_SET_DELETE_CMO, delete_cmon, NULL); |
oxserv_set(OXSERV_SET_DELETE_CMO, (void *)(void (*)())delete_cmon, NULL); |
oxserv_set(OXSERV_SET_GET_CMOTAG, get_cmon_tag, NULL); |
oxserv_set(OXSERV_SET_GET_CMOTAG, (void *)(void (*)())get_cmon_tag, NULL); |
oxserv_set(OXSERV_SET_CONVERT_CMO, convert_cmon, NULL); |
oxserv_set(OXSERV_SET_CONVERT_CMO, (void *)(void (*)())convert_cmon, NULL); |
oxserv_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL); |
oxserv_init(oxfp, VERSION, id, oxntl, NULL, NULL); |
|
|
ret = oxserv_receive(oxfp); |
printf("\n\n"); |
|
printf("$MAPLE=%s\n", getenv("MAPLE")); |
|
printf("$PATH=%s\n", getenv("PATH")); |
|
printf("$LD_LIBRARY_PATH=%s\n", getenv("LD_LIBRARY_PATH")); |
|
|
|
|
|
|
|
oxserv_receive(oxfp); |
oxserv_dest(); |
oxserv_dest(); |
oxf_close(oxfp); |
oxf_close(oxfp); |
|
|