=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/cpp.c,v retrieving revision 1.2 retrieving revision 1.6 diff -u -p -r1.2 -r1.6 --- OpenXM_contrib2/asir2000/parse/cpp.c 2000/08/21 08:31:46 1.2 +++ OpenXM_contrib2/asir2000/parse/cpp.c 2015/08/08 14:19:42 1.6 @@ -23,7 +23,7 @@ * shall be made on your publication or presentation in any form of the * results obtained by use of the SOFTWARE. * (4) In the event that you modify the SOFTWARE, you shall notify FLL by - * e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification + * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification * for such modification or the source code of the modified part of the * SOFTWARE. * @@ -45,12 +45,8 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/cpp.c,v 1.1.1.1 1999/12/03 07:39:12 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/cpp.c,v 1.5 2015/08/06 10:01:53 fujimoto Exp $ */ -#if defined(__MWERKS__) -#define THINK_C -#endif - #include #include #include @@ -68,14 +64,7 @@ jmp_buf cpp_env; #include "unctrl.h" #endif -#if defined(THINK_C) -#include -int define(char *,int,unsigned char *,int); -void Bcopy(char *,char *,int); -#endif - - #include "cpp.h" char *init_accum(void) @@ -218,6 +207,9 @@ void do_at(void) { if (! in_false_if()) { err_head(); fprintf(stderr,"unknown control `%s'\n",w); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } free(w); @@ -367,6 +359,9 @@ void read_formals(void) } } } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } @@ -412,6 +407,9 @@ void do_define(int sharp, int redef) if (! mac) { err_head(); fprintf(stderr,"missing/illegal macro name\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif flush_sharp_line(); return; } @@ -422,6 +420,9 @@ void do_define(int sharp, int redef) if (nargs > 128) { err_head(); fprintf(stderr,"too many macro formals, more than 128 ignored\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif nargs = 128; } } @@ -615,6 +616,9 @@ void do_dump(void) { fprintf(stderr,"\t\t%s\n",incldir[i]); } fprintf(stderr,"\t\t%s\n",cur_incldir); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } void dump_single(DEF *d) @@ -641,17 +645,26 @@ void dump_single(DEF *d) { putc(*cp,stderr); } } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } void err_head(void) { fprintf(stderr,"\"%s\", line %d: ",curfile(),curline()); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } void Check_malloc(char *ptr) { if (ptr == 0) { fprintf(stderr,"out of memory!\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif abort(); } } @@ -674,6 +687,9 @@ void do_eval(void) for (i=strlen(temp)-1;i>=0;i--) { Push(temp[i]); } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } @@ -808,6 +824,9 @@ void read_actuals(DEF *d) actlens[i] = 0; } } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } void expand_def(DEF *d) @@ -1101,6 +1120,9 @@ int get_quote_char(void) if (c == '\n') { err_head(); fprintf(stderr,"newline in character constant\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif return(-1); } if (c != '\\') @@ -1177,6 +1199,9 @@ NODE *read_expr_11(void) if (c != ')') { err_head(); fprintf(stderr,"expression syntax error -- missing ) supplied\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif Push(c); } #ifdef DEBUG_EXPR @@ -1224,6 +1249,9 @@ NODE *read_expr_11(void) { err_head(); fprintf(stderr,"warning: illegal %sdigit `%c'\n", (base==16)?"hex ":(base==8)?"octal ":"",c); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } v = (v * base) + values[d-digits]; c = Get(); @@ -1246,6 +1274,9 @@ NODE *read_expr_11(void) if (n > 4) { err_head(); fprintf(stderr,"warning: too many characters in character constant\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } return(newleaf(i)); } @@ -1257,6 +1288,9 @@ NODE *read_expr_11(void) if (complain) { err_head(); fprintf(stderr,"expression syntax error -- number expected\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } if (isbsymchar(c)) { Push(c); @@ -1839,6 +1873,9 @@ NODE *read_expr_(void) default: err_head(); fprintf(stderr,"expression syntax error -- bad operator `%c'\n",c); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif return(l); break; } @@ -1862,6 +1899,9 @@ NODE *read_expr_p(void) if (c != ')') { err_head(); fprintf(stderr,"junk after expression\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } return(rv); } @@ -1887,6 +1927,9 @@ int eval_expr(int Sharp, int Complain) { if (complain) { err_head(); fprintf(stderr,"expression syntax error -- junk after expression\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } while (Get() != d) ; } @@ -1992,6 +2035,9 @@ void do_if(int expr_sharp) if (c != '(') { err_head(); fprintf(stderr,"@if must have ()s\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif Push(c); iffalse(); #ifdef DEBUG_IF @@ -2188,6 +2234,9 @@ void do_else(int expr_sharp) #endif err_head(); fprintf(stderr,"if-less else\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } else @@ -2243,6 +2292,9 @@ void do_elif(int expr_sharp) if (ifstack == 0) { err_head(); fprintf(stderr,"if-less elif converted to normal if\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif iffalse(); } if (n_skipped_ifs > 0) @@ -2267,6 +2319,9 @@ void do_elif(int expr_sharp) if (c != '(') { err_head(); fprintf(stderr,"@elif must have ()s\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif Push(c); ifstack->condstate = IFSTATE_STAYFALSE; #ifdef DEBUG_IF @@ -2349,6 +2404,9 @@ void do_endif(int expr_sharp) else { err_head(); fprintf(stderr,"if-less endif\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif #ifdef DEBUG_IF if (debugging) { outputc('>'); @@ -2481,6 +2539,9 @@ void do_include(int expr_sharp) err_head(); fprintf(stderr,"warning: unterminated %cinclude filename\n", sharp?'#':'@'); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } if (c == '"') { break; @@ -2501,6 +2562,9 @@ void do_include(int expr_sharp) err_head(); fprintf(stderr,"warning: unterminated %cinclude filename\n", sharp?'#':'@'); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } if (c == '>') { break; @@ -2516,16 +2580,12 @@ void do_include(int expr_sharp) { free(accum_result(acc)); err_head(); fprintf(stderr,"illegal %cinclude filename delimiter\n",sharp?'#':'@'); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } -#if defined(THINK_C) -#if defined(DELIM) -#undef DELIM -#endif -#define DELIM ':' -#endif - #if defined(SYSV) #else #if defined(DELIM) @@ -2534,7 +2594,7 @@ void do_include(int expr_sharp) #define DELIM '/' #endif -#if defined(VISUAL) +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) #if defined(DELIM) #undef DELIM #endif @@ -2581,6 +2641,9 @@ void read_include_file(char *name, int dohere, int exp if (f == NULL) { err_head(); fprintf(stderr,"can't find include file %s\n",name); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif free(name); return; } @@ -2797,6 +2860,9 @@ void Push(char c) { if (cur_npushed > MAX_PUSHBACK) { fprintf(stderr,"too much pushback\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif cur_npushed = 0; } PUSH() = c; @@ -3175,6 +3241,9 @@ void mark_file_ending(void) } else if (m->nincs <= 0) { fprintf(stderr,"INTERNAL BUG: nincs<0 in mark_file_ending\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif abort(); } else @@ -3637,6 +3706,9 @@ void cpp_main(int ac, char **av) } } } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } void do_pragma(void) @@ -3696,6 +3768,9 @@ void do_set(void) check_malloc(cp); define(mac,-1,(unsigned char *)cp,DEF_DEFINE); } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif free(mac); } @@ -3759,6 +3834,9 @@ void do_sharp(void) flush_sharp_line(); } } +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif maybe_print('\n'); free(w); } @@ -3927,6 +4005,9 @@ void define(char *name, int nargs, unsigned char *repl { if ( (nargs != d->nargs) || strcmp((char *)repl,(char *)d->repl) ) { err_head(); fprintf(stderr,"%s redefined\n",n); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } free((char *)d->repl); free(d->name); @@ -4557,6 +4638,9 @@ void do_undef(int expr_sharp) if (! mac) { err_head(); fprintf(stderr,"missing/illegal macro name\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } else { if (undef(mac))