=================================================================== RCS file: /home/cvs/OpenXM/src/ox_math/Attic/bconv.c,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -p -r1.1.1.1 -r1.4 --- OpenXM/src/ox_math/Attic/bconv.c 1999/10/29 08:06:41 1.1.1.1 +++ OpenXM/src/ox_math/Attic/bconv.c 1999/11/07 12:12:55 1.4 @@ -1,6 +1,6 @@ /* -*- mode: C; coding: euc-japan -*- */ -/* $OpenXM$ */ -/* $Id: bconv.c,v 1.1.1.1 1999/10/29 08:06:41 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_math/bconv.c,v 1.3 1999/11/02 21:15:02 ohara Exp $ */ + /* OX expression -> バイト列 CMO expression -> バイト列 @@ -12,50 +12,54 @@ CMO expression -> バイト列 #include "ox.h" #include "parse.h" -char* dump_ox_data(char* array, ox_data* m); -char* dump_ox_command(char* array, ox_command* m); - -int display(ox *m) +static int display(ox *m) { int i; int len = 0; - unsigned char* array; - + unsigned char* d_buff; + switch(m->tag) { case OX_DATA: len = sizeof(int) + sizeof(int) + cmolen_cmo(((ox_data *)m)->cmo); - array = malloc(len); - dump_ox_data(array, (ox_data *)m); + d_buff = malloc(len); + init_dump_buffer(d_buff); + dump_ox_data((ox_data *)m); break; case OX_COMMAND: len = sizeof(int) + sizeof(int) + sizeof(int); - array = malloc(len); - dump_ox_command(array, (ox_command *)m); + d_buff = malloc(len); + init_dump_buffer(d_buff); + dump_ox_command((ox_command *)m); break; default: - len = cmolen_cmo(m); - array = malloc(len); - dump_cmo(array, m); + len = cmolen_cmo((cmo *)m); + d_buff = malloc(len); + init_dump_buffer(d_buff); + dump_cmo((cmo *)m); } for(i=0; i "); - fgets(s, size, stdin); - setmode_mygetc(s, size); + fgets(cmdline, size, stdin); + setmode_mygetc(cmdline, size); } int main() @@ -64,14 +68,10 @@ int main() setbuf(stderr, NULL); setbuf(stdout, NULL); - cmo_addrev = 1; + setflag_parse(PFLAG_ADDREV); setgetc(mygetc); - while(1) { - prompt(cmdline, SIZE_CMDLINE); - if ((m = parse()) == NULL) { - break; - } + for(prompt(); (m = parse()) != NULL; prompt()) { display(m); } return 0;