=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/glob.c,v retrieving revision 1.75 retrieving revision 1.88 diff -u -p -r1.75 -r1.88 --- OpenXM_contrib2/asir2000/parse/glob.c 2009/02/05 08:37:02 1.75 +++ OpenXM_contrib2/asir2000/parse/glob.c 2015/08/06 10:01:53 1.88 @@ -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.74 2008/03/19 07:05:56 ohara Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.87 2015/08/04 06:20:45 noro 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"; @@ -284,7 +282,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 +315,20 @@ 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" + + if ( oxhome = getenv("OpenXM_HOME") ) { + if ( strlen(oxhome)+strlen(OXCPP)= 2) ) { strcpy(displayname,*(av+1)); av += 2; ac -= 2; #endif @@ -386,12 +397,6 @@ 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); asir_terminate(1); @@ -413,7 +418,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(); @@ -434,7 +439,7 @@ void sig_init() { signal(SIGILL,ill_handler); #endif -#if !defined(VISUAL) +#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) signal(SIGBUS,bus_handler); #endif } @@ -464,7 +469,7 @@ void resetenv(char *s) 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); @@ -472,13 +477,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); @@ -490,6 +492,7 @@ void fatal(int n) } extern int ox_int_received, critical_when_signal; +extern int in_gc, caught_intr; void int_handler(int sig) { @@ -504,11 +507,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(); @@ -529,8 +536,12 @@ void int_handler(int sig) fprintf(stderr,"interrupt ?(q/t/c/d/u/w/?) "); fflush(stderr); buf[0] = '\n'; - while ( buf[0] == '\n' ) + while ( !feof(stdin) && buf[0] == '\n' ) fgets(buf,BUFSIZ,stdin); + if ( feof(stdin) ) { + clearerr(stdin); + continue; + } switch ( c = buf[0] ) { case 'q': while ( 1 ) { @@ -598,7 +609,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) @@ -686,7 +697,7 @@ 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 @@ -719,11 +730,11 @@ 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 @@ -738,7 +749,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) @@ -773,22 +784,11 @@ char *get_asir_distribution(); char *get_gcversion() { -#if defined(GC7) - return "GC 7.0 copyright 1988-2007, 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 ""; } @@ -825,3 +825,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