=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/ox_asir.c,v retrieving revision 1.51 retrieving revision 1.56 diff -u -p -r1.51 -r1.56 --- OpenXM_contrib2/asir2000/io/ox_asir.c 2004/02/13 05:48:36 1.51 +++ OpenXM_contrib2/asir2000/io/ox_asir.c 2004/03/11 07:40:42 1.56 @@ -44,7 +44,7 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.50 2003/12/13 08:03:56 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.55 2004/03/09 07:18:26 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -155,6 +155,9 @@ void ox_main(int argc,char **argv) { if ( SETJMP(ox_env) ) { while ( NEXT(asir_infile) ) closecurrentinput(); + resetpvs(); + reset_engine(); + reset_io(); ox_send_sync(0); } while ( 1 ) { @@ -185,6 +188,8 @@ void ox_main(int argc,char **argv) { if ( ret == 1 ) { create_error(&err,serial,LastError); asir_push_one((Obj)err); + while ( NEXT(asir_infile) ) + closecurrentinput(); } break; } @@ -593,23 +598,20 @@ void asir_pushCMOtag(unsigned int serial) void asir_popString() { Obj val; - char *buf,*obuf; + char *buf; int l; STRING str; val = asir_pop_one(); if ( !val ) - obuf = "0"; + buf = "0"; else { l = estimate_length(CO,val); buf = (char *)ALLOCA(l+1); soutput_init(buf); sprintexpr(CO,val); - l = strlen(buf); - obuf = (char *)MALLOC(l+1); - strcpy(obuf,buf); } - MKSTR(str,obuf); + MKSTR(str,buf); ox_send_data(0,str); } @@ -664,6 +666,20 @@ void asir_evalName(unsigned int serial) asir_push_one(val); } +char *augment_backslash(char *s) +{ + char *p,*r; + int i; + + for ( i = 0, p = s; *p; p++, i++ ) if ( *p == '\\' ) i++; + r = (char *)MALLOC_ATOMIC((i+1)*sizeof(char)); + for ( i = 0, p = s; *p; p++, i++ ) { + if ( *p == '\\' ) r[i++] = '\\'; + r[i] = *p; + } + return r; +} + int asir_executeString() { SNODE snode; @@ -680,7 +696,7 @@ int asir_executeString() # endif #endif cmd = ((STRING)asir_pop_one())->body; - parse_strp = cmd; + parse_strp = augment_backslash(cmd); if ( mainparse(&snode) ) { return -1; }