=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/glob.c,v retrieving revision 1.79 retrieving revision 1.89 diff -u -p -r1.79 -r1.89 --- OpenXM_contrib2/asir2000/parse/glob.c 2010/08/03 04:34:44 1.79 +++ OpenXM_contrib2/asir2000/parse/glob.c 2015/08/08 14:19:42 1.89 @@ -45,20 +45,17 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.78 2010/08/01 08:44:15 ohara Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.88 2015/08/06 10:01:53 fujimoto Exp $ */ #include "ca.h" #include "al.h" #include "parse.h" #include "ox.h" -#if defined(PARI) -#include "genpari.h" -#endif -#if !defined(VISUAL) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) && !defined(__FreeBSD__) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) && !defined(__FreeBSD__) #include #endif -#if defined(VISUAL) +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) #include #include #else @@ -71,7 +68,7 @@ #include #endif -#if defined(VISUAL) +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) #define HISTORY asir_history #endif @@ -84,6 +81,7 @@ JMP_BUF main_env,debug_env,timer_env,exec_env; int little_endian,debug_mode,no_debug_on_error; char *asir_libdir; char *asir_contrib_dir; +char *asir_private_dir; char *asir_pager; NODE usrf,sysf,noargsysf,ubinf,parif; @@ -145,7 +143,7 @@ struct oF oF_TRUE,oF_FALSE; F F_TRUE = &oF_TRUE; F F_FALSE = &oF_FALSE; -#if defined(VISUAL) +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) char cppname[BUFSIZ] = "c:\\asir\\stdlib\\cpp "; #else char cppname[BUFSIZ] = "/lib/cpp "; @@ -167,7 +165,7 @@ void glob_init() { reallocarray((char **)&APVS->va,(int *)&APVS->asize,(int *)&APVS->n,(int)sizeof(struct oPV)); reallocarray((char **)&PPVS->va,(int *)&PPVS->asize,(int *)&PPVS->n,(int)sizeof(struct oPV)); CPVS = GPVS; - MKNODE(ONENODE,mkfnode(1,I_FORMULA,ONE),0); + MKNODE(ONENODE,mkfnode(1,I_FORMULA,ONE),NULLP); OID(F_TRUE)=O_F; FOP(F_TRUE)=AL_TRUE; F_TRUE->arg.dummy = 0; OID(F_FALSE)=O_F; FOP(F_FALSE)=AL_FALSE; F_FALSE->arg.dummy = 0; OID(Symbol_grlex) = O_SYMBOL; Symbol_grlex->name = "@grlex"; @@ -233,6 +231,9 @@ void asir_terminate(int status) bevalf((FUNC)BDY(n),0); if ( !do_terse ) fprintf(stderr, "done.\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } tty_reset(); #if defined(MPI) @@ -284,7 +285,7 @@ void sprompt(char *ptr) sprintf(ptr,"[%d] ",APVS->n); } -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) static int which(char *prog, char *path, char *buf, size_t size) { char *tok; @@ -317,7 +318,7 @@ static int which(char *prog, char *path, char *buf, si void cppname_init() { -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) char *oxhome; char oxcpp[BUFSIZ]; #define OXCPP "/bin/ox_cpp" @@ -372,6 +373,9 @@ void process_args(int ac,char **av) in_fp = fopen(*(av+1),"r"); if ( !in_fp ) { fprintf(stderr,"%s does not exist!\n",*(av+1)); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif asir_terminate(1); } do_file = 1; @@ -391,7 +395,7 @@ void process_args(int ac,char **av) void GC_set_max_heap_size(int); GC_set_max_heap_size(atoi(*(av+1))); av += 2; ac -= 2; -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) } else if ( !strcmp(*av,"-display") && (ac >= 2) ) { strcpy(displayname,*(av+1)); av += 2; ac -= 2; #endif @@ -399,14 +403,11 @@ void process_args(int ac,char **av) } else if ( !strcmp(*av,"-fep") ) { do_fep = 1; av++; ac--; #endif -#if defined(PARI) - } else if ( !strcmp(*av,"-paristack") ) { - extern int paristack; - - paristack = atoi(*(av+1)); av += 2; ac -= 2; -#endif } else { fprintf(stderr,"%s : unknown option.\n",*av); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif asir_terminate(1); } } @@ -426,7 +427,7 @@ void process_args(int ac,char **av) #include void sig_init() { -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) signal(SIGINT,int_handler); #else void register_ctrlc_handler(); @@ -447,7 +448,7 @@ void sig_init() { signal(SIGILL,ill_handler); #endif -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) signal(SIGBUS,bus_handler); #endif } @@ -474,10 +475,13 @@ void resetenv(char *s) extern FILE *outfile; fprintf(stderr,"%s\n",s); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif while ( NEXT(asir_infile) ) closecurrentinput(); resetpvs(); -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) if ( do_server_in_X11 ) #endif show_debug_window(0); @@ -485,13 +489,10 @@ void resetenv(char *s) w_noflush_stderr(0); #endif asir_out = stdout; -#if defined(PARI) - pari_outfile = stdout; -#endif /* restore states */ reset_engine(); reset_io(); -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) reset_timer(); #endif LONGJMP(main_env,1); @@ -503,6 +504,7 @@ void fatal(int n) } extern int ox_int_received, critical_when_signal; +extern int in_gc, caught_intr; void int_handler(int sig) { @@ -517,11 +519,15 @@ void int_handler(int sig) ox_int_received = 1; return; } -#if defined(VISUAL) + if ( in_gc ) { + caught_intr = 1; + return; + } +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) suspend_timer(); #endif signal(SIGINT,SIG_IGN); -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) if ( do_server_in_X11 ) { debug(PVSS?((VS)BDY(PVSS))->usrf->f.usrf->body:0); restore_handler(); @@ -588,6 +594,9 @@ void int_handler(int sig) bevalf((FUNC)BDY(t),0); if ( !do_terse ) fprintf(stderr, "done.\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif } } resetenv("return to toplevel"); @@ -607,6 +616,9 @@ void int_handler(int sig) break; case '?': fprintf(stderr, "q:quit t:toplevel c:continue d:debug u:call registered handler w:where\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif break; default: break; @@ -615,7 +627,7 @@ void int_handler(int sig) } void restore_handler() { -#if defined(VISUAL) +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) resume_timer(); #endif #if defined(SIGINT) @@ -650,6 +662,9 @@ void ill_handler(int sig) void alrm_handler(int sig) { fprintf(stderr,"interval timer expired (VTALRM)\n"); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif LONGJMP(timer_env,1); } @@ -703,11 +718,14 @@ void error(char *s) { SNODE *snp=0; -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) if ( !error_in_timer && timer_is_set ) alrm_handler(SIGNAL_FOR_TIMER); #endif fprintf(stderr,"%s\n",s); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif set_lasterror(s); if ( CPVS != GPVS ) { if ( CPVS && CPVS->usrf && CPVS->usrf->f.usrf ) @@ -736,15 +754,18 @@ void error(char *s) resetenv("return to toplevel"); } -void toplevel(char *s) +void goto_toplevel(char *s) { SNODE *snp=0; -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) if ( timer_is_set ) alrm_handler(SIGNAL_FOR_TIMER); #endif fprintf(stderr,"%s\n",s); +#if defined(__MINGW32__) || defined(__MINGW64__) + fflush(stderr); +#endif if ( do_file ) { char errbuf[BUFSIZ*5]; /* sufficient to store stack information ? */ @@ -755,7 +776,7 @@ void toplevel(char *s) resetenv("return to toplevel"); } -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) #include void set_timer(int interval) @@ -790,22 +811,11 @@ char *get_asir_distribution(); char *get_gcversion() { -#if defined(GC7) - return "GC 7.1 copyright 1988-2008, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n"; -#else - return "GC 6.8 copyright 1988-2006, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n"; -#endif + return "GC 7.2 copyright 1988-2012, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n"; } char *get_pariversion() { -#if PARI -#if 0 - return PARIVERSION", Copyright (C) 2000-2005 The PARI Group.\n"; -#else - return "PARI 2.0.17, copyright 1989-1999, C. Batut, K. Belabas, D. Bernardi,\n H. Cohen and M. Olivier.\n"; -#endif -#endif return ""; } @@ -842,3 +852,19 @@ char *scopyright() } return notice; } + +#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +void check_intr() +{ + extern int recv_intr; + if ( recv_intr ) { + if ( recv_intr == 1 ) { + recv_intr = 0; + int_handler(0); + } else { + recv_intr = 0; + ox_usr1_handler(0); + } + } +} +#endif