version 1.2, 2003/11/08 12:34:00 |
version 1.7, 2013/10/18 01:28:52 |
|
|
/* $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.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; |
if (strcmp(func, "fctr") == 0) { |
int i; |
ans = ntl_fctr(arg, argc); |
char unknown_mes[50] = "Unknown Function"; |
oxstack_push(ans); |
|
return ; |
enum { |
|
RET_CMO, |
|
RET_USR, |
|
}; |
|
|
|
struct { |
|
const char *name; |
|
oxstack_node *(*func)(oxstack_node **, int); |
|
int return_type; |
|
} funcs[] = { |
|
{"fctr", ntl_fctr, RET_USR}, |
|
{"lll", ntl_lll, RET_USR}, |
|
{NULL, NULL, 0} |
|
}; |
|
|
|
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"))); |
oxstack_push_cmo((cmo *)new_cmo_error2((cmo *)new_cmo_string(unknown_mes))); |
} |
} |
|
|
|
|
Line 32 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 i; |
char oxntl[10] = "ox_ntl"; |
int ret; |
char id[30] = ID_STRING; |
|
|
OXFILE *oxfp; |
OXFILE *oxfp; |
|
|
Line 42 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_init(oxfp, VERSION, ID_STRING, "ox_ntl", NULL, NULL); |
oxserv_set(OXSERV_SET_DELETE_CMO, (void *)(void (*)())delete_cmon, NULL); |
|
oxserv_set(OXSERV_SET_GET_CMOTAG, (void *)(void (*)())get_cmon_tag, NULL); |
|
oxserv_set(OXSERV_SET_CONVERT_CMO, (void *)(void (*)())convert_cmon, NULL); |
|
oxserv_init(oxfp, VERSION, id, oxntl, NULL, NULL); |
|
|
for (i = 0;; i++) { |
printf("\n\n"); |
ret = oxserv_receive(oxfp); |
printf("$MAPLE=%s\n", getenv("MAPLE")); |
if (ret != OXSERV_SUCCESS) |
printf("$PATH=%s\n", getenv("PATH")); |
break; |
printf("$LD_LIBRARY_PATH=%s\n", getenv("LD_LIBRARY_PATH")); |
} |
|
|
|
|
|
|
|
|
oxserv_receive(oxfp); |
oxserv_dest(); |
oxserv_dest(); |
oxf_close(oxfp); |
oxf_close(oxfp); |
|
|