version 1.11, 2003/02/04 20:43:55 |
version 1.15, 2005/07/26 12:52:05 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.10 2003/01/13 12:03:12 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.14 2005/07/20 17:48:03 ohara Exp $ */ |
|
|
/* A sample implementation of an OpenXM client with OpenXM C library */ |
/* A sample implementation of an OpenXM client with OpenXM C library */ |
|
|
Line 37 int dumpx(OXFILE *oxfp, int n) |
|
Line 37 int dumpx(OXFILE *oxfp, int n) |
|
static int size = SIZE_CMDLINE; |
static int size = SIZE_CMDLINE; |
static char cmdline[SIZE_CMDLINE]; |
static char cmdline[SIZE_CMDLINE]; |
|
|
static int prompt() |
static void prompt() |
{ |
{ |
fprintf(stdout, "> "); |
fprintf(stdout, "> "); |
fgets(cmdline, size, stdin); |
fgets(cmdline, size, stdin); |
init_parser(cmdline); |
|
} |
} |
|
|
#define VERSION 0x11121500 |
#define VERSION 0x11121500 |
#define ID_STRING "v0.11121500" |
#define ID_STRING "v0.11121500" |
|
|
int test_0() |
void test_0() |
{ |
{ |
cmo* c = NULL; |
cmo* c = NULL; |
#ifdef DEBUG |
|
ox_printf("testclient:: calling ox_mathcap().\n"); |
ox_printf("testclient:: calling ox_mathcap().\n"); |
c = ox_mathcap(sv); |
|
ox_printf("testclient:: cmo received.(%p)\n", c); |
|
#else |
|
c = (cmo *)ox_mathcap(sv); |
c = (cmo *)ox_mathcap(sv); |
#endif |
ox_printf("testclient:: cmo received.(%p)\n", c); |
print_cmo(c); |
print_cmo(c); |
|
|
mathcap_init(VERSION, ID_STRING, "testclient", NULL, NULL); |
mathcap_init(ID_STRING, "testclient"); |
send_ox_cmo(sv, oxf_cmo_mathcap(sv)); |
send_ox_cmo(sv, (cmo *)oxf_cmo_mathcap(sv)); |
|
|
ox_reset(sv); |
ox_reset(sv); |
send_ox_cmo(sv, (cmo *)new_cmo_string("N[ArcTan[1]]")); |
send_ox_cmo(sv, (cmo *)new_cmo_string("N[ArcTan[1]]")); |
|
|
print_cmo(c); |
print_cmo(c); |
} |
} |
|
|
int test_1() |
void test_1() |
{ |
{ |
cmo *c, *m; |
cmo *c, *m; |
|
|
mathcap_init(1000, "test!", "testclient", NULL, NULL); |
mathcap_init("test!", "testclient"); |
m = oxf_cmo_mathcap(sv); |
m = (cmo *)oxf_cmo_mathcap(sv); |
ox_printf("testclient:: test cmo_mathcap.\n"); |
ox_printf("testclient:: test cmo_mathcap.\n"); |
send_ox_cmo(sv, m); |
send_ox_cmo(sv, m); |
send_ox_command(sv, SM_popCMO); |
send_ox_command(sv, SM_popCMO); |
Line 117 int main(int argc, char* argv[]) |
|
Line 112 int main(int argc, char* argv[]) |
|
test_1(); |
test_1(); |
} |
} |
|
|
setflag_parse(PFLAG_ADDREV); |
while(prompt(), (m = ox_parse_lisp(cmdline)) != NULL) { |
|
|
while(prompt(), (m = parse()) != NULL) { |
|
send_ox(sv, m); |
send_ox(sv, m); |
if (m->tag == OX_COMMAND) { |
if (m->tag == OX_COMMAND) { |
code = ((ox_command *)m)->command; |
code = ((ox_command *)m)->command; |