version 1.3, 1999/11/06 21:39:37 |
version 1.5, 1999/12/14 09:31:56 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- 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.4 1999/11/07 12:12:56 ohara Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 28 int dumpx(int fd, int n) |
|
Line 28 int dumpx(int fd, int n) |
|
return len; |
return len; |
} |
} |
|
|
/* 平成11年7月10日 */ |
/* 平成11年11月7日 */ |
#define VERSION 0x11071000 |
#define VERSION 0x11110700 |
#define ID_STRING "testclient version 0.11071000" |
#define ID_STRING "testclient version 0.11110700" |
|
|
int prompt() |
int prompt() |
{ |
{ |
printf("> "); |
printf("> "); |
} |
} |
|
|
int main(int argc, char* argv[]) |
int test_0() |
{ |
{ |
ox* m = NULL; |
|
cmo* c = NULL; |
cmo* c = NULL; |
int code; |
#ifdef DEBUG |
char *server = "ox_sm1"; |
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); |
ox_reset(sv); |
send_ox_cmo(sv->stream, new_cmo_string("N[ArcTan[1]]")); |
send_ox_cmo(sv->stream, new_cmo_string("N[ArcTan[1]]")); |
send_ox_command(sv->stream, SM_executeStringByLocalParser); |
send_ox_command(sv->stream, SM_executeStringByLocalParser); |
Line 69 int main(int argc, char* argv[]) |
|
Line 59 int main(int argc, char* argv[]) |
|
c = receive_cmo(sv->stream); |
c = receive_cmo(sv->stream); |
fprintf(stderr, "testclient:: cmo received.\n"); |
fprintf(stderr, "testclient:: cmo received.\n"); |
print_cmo(c); |
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(argv[1], "ox_math")==0) { |
|
test_1(); |
|
} |
|
|
while(prompt(), (m = parse()) != NULL) { |
while(prompt(), (m = parse()) != NULL) { |
send_ox(sv, m); |
send_ox(sv->stream, m); |
if (m->tag == OX_COMMAND) { |
if (m->tag == OX_COMMAND) { |
code = ((ox_command *)m)->command; |
code = ((ox_command *)m)->command; |
if (code >= 1024) { |
if (code >= 1024) { |