=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/parser.c,v retrieving revision 1.3 retrieving revision 1.12 diff -u -p -r1.3 -r1.12 --- OpenXM/src/kan96xx/Kan/parser.c 2001/05/04 01:06:24 1.3 +++ OpenXM/src/kan96xx/Kan/parser.c 2015/10/08 11:49:37 1.12 @@ -1,15 +1,17 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/parser.c,v 1.2 2000/01/16 07:55:40 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/parser.c,v 1.11 2015/09/29 01:52:14 takayama Exp $ */ /* parser.c parser for poly.c */ #include +#include #include "datatype.h" #include "setjmp.h" #include "stackm.h" #include "extern.h" #include "extern2.h" + #define NUM 1 /* NUM means struct Bignum */ #define POL 0 @@ -22,8 +24,11 @@ union valObject { POLY p; }; - +#if defined(__CYGWIN__) +static sigjmp_buf EnvOfParser; +#else static jmp_buf EnvOfParser; +#endif static char *String; static int StrPtr = 0; /* String and StrPtr are used in getcharFromStr() */ @@ -119,8 +124,11 @@ POLY stringToPOLY(s,ringp) Ring0 = *ringp; Ring0.p = 0; Ring0.next = (struct ring *)NULL; - - if (setjmp(EnvOfParser)) { +#if defined(__CYGWIN__) + if (MYSIGSETJMP(EnvOfParser,1)) { +#else + if (MYSETJMP(EnvOfParser)) { +#endif fprintf(stderr,"\nERROR: You have syntax errors in the expression: %s\n",s); errorKan1("%s\n"," parser.c : Syntax error in the input polynomial."); return( POLYNULL ); /* error */ @@ -404,6 +412,7 @@ static void term() { }else { if (ftype == NUM && gtype == NUM) { + errorParser("num/num is not supported yet.\n"); mpz_div(f,f,g); utmp.ival = f; push(NUM,utmp); @@ -479,7 +488,7 @@ static void factor() { static void monom() { union valObject utmp; - struct object obj; + struct object obj = OINIT; POLY f; extern struct context *CurrentContextp; if (Symbol == 'x' || Symbol == 'd') { @@ -560,8 +569,11 @@ static void errorParser(s) char s[]; { extern char *GotoLabel; extern int GotoP; extern int ErrorMessageMode; + extern int RestrictedMode, RestrictedMode_saved; int j; char tmpc[1024]; + RestrictedMode = RestrictedMode_saved; + cancelAlarm(); if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { sprintf(tmpc,"\nError(parser.c): "); if (strlen(s) < 1000-strlen(tmpc)) { @@ -589,6 +601,10 @@ static void errorParser(s) char s[]; { fprintf(Fstack,"The interpreter was looking for the label <<%s>>. It is also aborted.\n",GotoLabel); GotoP = 0; } - longjmp(EnvOfParser,1); +#if defined(__CYGWIN__) + MYSIGLONGJMP(EnvOfParser,1); +#else + MYLONGJMP(EnvOfParser,1); +#endif }