=================================================================== RCS file: /home/cvs/OpenXM/src/ox_math/Attic/testclient.c,v retrieving revision 1.3 retrieving revision 1.6 diff -u -p -r1.3 -r1.6 --- OpenXM/src/ox_math/Attic/testclient.c 1999/11/06 21:39:37 1.3 +++ OpenXM/src/ox_math/Attic/testclient.c 1999/12/15 02:49:55 1.6 @@ -1,5 +1,5 @@ /* -*- mode: C; coding: euc-japan -*- */ -/* $OpenXM: OpenXM/src/ox_math/testclient.c,v 1.2 1999/11/02 06:11:58 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_math/testclient.c,v 1.5 1999/12/14 09:31:56 ohara Exp $ */ #include #include @@ -28,39 +28,29 @@ int dumpx(int fd, int n) return len; } -/* 平成11年7月10日 */ -#define VERSION 0x11071000 -#define ID_STRING "testclient version 0.11071000" +/* 平成11年11月7日 */ +#define VERSION 0x11110700 +#define ID_STRING "testclient version 0.11110700" int prompt() { printf("> "); } -int main(int argc, char* argv[]) +int test_0() { - ox* m = NULL; cmo* c = NULL; - int code; - char *server = "ox_sm1"; +#ifdef DEBUG + fprintf(stderr, "testclient:: calling ox_mathcap().\n"); + c = ox_mathcap(sv); + fprintf(stderr, "testclient:: cmo received.(%p)\n", c); +#else + c = ox_mathcap(sv); +#endif + print_cmo(c); + fflush(stderr); + send_ox_cmo(sv->stream, make_mathcap_object(VERSION, ID_STRING)); - setbuf(stderr, NULL); - - if (argc>1) { - server = argv[1]; - } - fprintf(stderr, "testclient:: I use %s as an OX server.\n", server); - sv = ox_start("localhost", "ox", server); - if (sv == NULL) { - fprintf(stderr, "testclient:: I cannot connect to servers.\n"); - exit(1); - } - - if (argc>1) { - ox_mathcap(sv); - send_ox_cmo(sv->stream, make_mathcap_object(VERSION, ID_STRING)); - } - ox_reset(sv); send_ox_cmo(sv->stream, new_cmo_string("N[ArcTan[1]]")); send_ox_command(sv->stream, SM_executeStringByLocalParser); @@ -69,9 +59,47 @@ int main(int argc, char* argv[]) c = receive_cmo(sv->stream); fprintf(stderr, "testclient:: cmo received.\n"); print_cmo(c); +} +int test_1() +{ + cmo *c = NULL; + cmo *m = make_mathcap_object(1000, "test!"); + fprintf(stderr, "testclient:: test cmo_mathcap.\n"); + send_ox_cmo(sv->stream, m); + send_ox_command(sv->stream, SM_popCMO); + receive_ox_tag(sv->stream); + c = receive_cmo(sv->stream); + fprintf(stderr, "testclient:: cmo received.(%p)\n", c); + print_cmo(c); + fputc('\n', stderr); +} + +int main(int argc, char* argv[]) +{ + ox* m = NULL; + cmo* c = NULL; + int code; + char *server = "ox_sm1"; + + setbuf(stderr, NULL); + + if (argc>1) { + server = argv[1]; + } + fprintf(stderr, "testclient:: I use %s as an OX server.\n", server); + sv = ox_start("localhost", "ox", server); + if (sv == NULL) { + fprintf(stderr, "testclient:: I cannot connect to servers.\n"); + exit(1); + } + + if (strcmp(server, "ox_math")==0) { + test_1(); + } + while(prompt(), (m = parse()) != NULL) { - send_ox(sv, m); + send_ox(sv->stream, m); if (m->tag == OX_COMMAND) { code = ((ox_command *)m)->command; if (code >= 1024) {