=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/parser.c,v retrieving revision 1.5 retrieving revision 1.10 diff -u -p -r1.5 -r1.10 --- OpenXM_contrib2/asir2000/parse/parser.c 2002/12/09 00:42:15 1.5 +++ OpenXM_contrib2/asir2000/parse/parser.c 2015/08/09 11:46:43 1.10 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/parser.c,v 1.4 2001/09/04 03:12:20 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/parser.c,v 1.9 2008/09/04 01:42:26 noro Exp $ */ #include #include "ca.h" @@ -55,9 +55,9 @@ extern int main_parser, allow_create_var; extern char *parse_strp; extern SNODE parse_snode; extern FUNC parse_targetf; +extern int outputstyle; -int mainparse(snodep) -SNODE *snodep; +int mainparse(SNODE *snodep) { int ret; @@ -67,10 +67,7 @@ SNODE *snodep; return ret; } -int exprparse(f,str,exprp) -FUNC f; -char *str; -FNODE *exprp; +int exprparse(FUNC f,char *str,FNODE *exprp) { char buf0[BUFSIZ]; char *buf; @@ -102,11 +99,9 @@ FNODE *exprp; } /* allows to create a new variable */ +/* returns SNODE */ -int exprparse_create_var(f,str,exprp) -FUNC f; -char *str; -FNODE *exprp; +int exprparse_create_var(FUNC f,char *str,SNODE *statp) { char buf0[BUFSIZ]; char *buf; @@ -130,11 +125,19 @@ FNODE *exprp; parse_targetf = f; main_parser = 0; allow_create_var = 1; +#if 0 if ( yyparse() || !parse_snode || parse_snode->id != S_SINGLE ) { *exprp = 0; return 0; } else { *exprp = (FNODE)FA0(parse_snode); return 1; } +#else + if ( yyparse() || !parse_snode ) { + *statp = 0; return 0; + } else { + *statp = parse_snode; return 1; + } +#endif } extern FUNC user_print_function; @@ -159,16 +162,28 @@ void read_eval_loop() { r1 = get_rtime(); if ( !ox_do_copy ) { if ( prresult ) { - if ( user_print_function ) + if ( user_print_function ) { bevalf(user_print_function,mknode(1,LastVal)); - else +#if !defined(__MINGW32__) && !defined(__MINGW64__) + fflush(asir_out); +#endif + } else printexpr(CO,LastVal); + if ( outputstyle == 1 ) { + putc(';',asir_out); + } putc('\n',asir_out); +#if !defined(__MINGW32__) && !defined(__MINGW64__) fflush(asir_out); +#endif } if ( prtime ) { printtime(&egt0,&egt1,r1-r0); } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(asir_out); + fflush(stderr); +#endif prompt(); } }