=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/testclient.c,v retrieving revision 1.12 retrieving revision 1.17 diff -u -p -r1.12 -r1.17 --- OpenXM/src/ox_toolkit/testclient.c 2003/03/23 20:17:35 1.12 +++ OpenXM/src/ox_toolkit/testclient.c 2016/08/23 06:13:10 1.17 @@ -1,8 +1,11 @@ /* -*- mode: C -*- */ -/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.11 2003/02/04 20:43:55 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.16 2005/10/12 04:03:37 takayama Exp $ */ /* A sample implementation of an OpenXM client with OpenXM C library */ - +/* Sample input + (OX_DATA, (CMO_STRING,"printf(\"%a\");")) + (OX_COMMAND,(SM_executeStringByLocalParser)) + */ #include #include #include @@ -37,26 +40,25 @@ int dumpx(OXFILE *oxfp, int n) static int size = SIZE_CMDLINE; static char cmdline[SIZE_CMDLINE]; -static int prompt() +static void prompt() { fprintf(stdout, "> "); fgets(cmdline, size, stdin); - init_parser(cmdline); } #define VERSION 0x11121500 #define ID_STRING "v0.11121500" -int test_0() +void test_0() { cmo* c = NULL; ox_printf("testclient:: calling ox_mathcap().\n"); - c = ox_mathcap(sv); + c = (cmo *)ox_mathcap(sv); ox_printf("testclient:: cmo received.(%p)\n", c); print_cmo(c); mathcap_init(VERSION, ID_STRING, "testclient", NULL, NULL); - send_ox_cmo(sv, oxf_cmo_mathcap(sv)); + send_ox_cmo(sv, (cmo *)oxf_cmo_mathcap(sv)); ox_reset(sv); send_ox_cmo(sv, (cmo *)new_cmo_string("N[ArcTan[1]]")); @@ -68,12 +70,12 @@ int test_0() print_cmo(c); } -int test_1() +void test_1() { cmo *c, *m; mathcap_init(1000, "test!", "testclient", NULL, NULL); - m = oxf_cmo_mathcap(sv); + m = (cmo *)oxf_cmo_mathcap(sv); ox_printf("testclient:: test cmo_mathcap.\n"); send_ox_cmo(sv, m); send_ox_command(sv, SM_popCMO); @@ -95,7 +97,7 @@ int main(int argc, char* argv[]) ox* m = NULL; cmo* c = NULL; int code; - char *server = "ox_sm1"; + char *server = "ox_asir"; ox_stderr_init(stderr); @@ -103,7 +105,7 @@ int main(int argc, char* argv[]) server = argv[1]; } ox_printf("testclient:: I use %s as an OX server.\n", server); -/* sv = ox_start("localhost", "ox", server); */ + sv = ox_start("localhost", "ox", server); if (sv == NULL) { ox_printf("testclient:: I cannot connect to servers.\n"); exit(1); @@ -113,9 +115,7 @@ int main(int argc, char* argv[]) test_1(); } - setflag_parse(PFLAG_ADDREV); - - while(prompt(), (m = parse()) != NULL) { + while(prompt(), (m = ox_parse_lisp(cmdline)) != NULL) { send_ox(sv, m); if (m->tag == OX_COMMAND) { code = ((ox_command *)m)->command;