version 1.3, 2001/05/04 01:06:24 |
version 1.7, 2004/09/17 02:42:57 |
|
|
/* $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.6 2004/05/13 10:37:30 takayama Exp $ */ |
/* |
/* |
parser.c parser for poly.c |
parser.c parser for poly.c |
*/ |
*/ |
Line 22 union valObject { |
|
Line 22 union valObject { |
|
POLY p; |
POLY p; |
}; |
}; |
|
|
|
#if defined(__CYGWIN__) |
|
static sigjmp_buf EnvOfParser; |
|
#else |
static jmp_buf EnvOfParser; |
static jmp_buf EnvOfParser; |
|
#endif |
|
|
static char *String; |
static char *String; |
static int StrPtr = 0; /* String and StrPtr are used in getcharFromStr() */ |
static int StrPtr = 0; /* String and StrPtr are used in getcharFromStr() */ |
Line 119 POLY stringToPOLY(s,ringp) |
|
Line 122 POLY stringToPOLY(s,ringp) |
|
Ring0 = *ringp; |
Ring0 = *ringp; |
Ring0.p = 0; |
Ring0.p = 0; |
Ring0.next = (struct ring *)NULL; |
Ring0.next = (struct ring *)NULL; |
|
#if defined(__CYGWIN__) |
|
if (sigsetjmp(EnvOfParser,1)) { |
|
#else |
if (setjmp(EnvOfParser)) { |
if (setjmp(EnvOfParser)) { |
|
#endif |
fprintf(stderr,"\nERROR: You have syntax errors in the expression: %s\n",s); |
fprintf(stderr,"\nERROR: You have syntax errors in the expression: %s\n",s); |
errorKan1("%s\n"," parser.c : Syntax error in the input polynomial."); |
errorKan1("%s\n"," parser.c : Syntax error in the input polynomial."); |
return( POLYNULL ); /* error */ |
return( POLYNULL ); /* error */ |
Line 404 static void term() { |
|
Line 410 static void term() { |
|
|
|
}else { |
}else { |
if (ftype == NUM && gtype == NUM) { |
if (ftype == NUM && gtype == NUM) { |
|
errorParser("num/num is not supported yet.\n"); |
mpz_div(f,f,g); |
mpz_div(f,f,g); |
utmp.ival = f; |
utmp.ival = f; |
push(NUM,utmp); |
push(NUM,utmp); |
Line 560 static void errorParser(s) char s[]; { |
|
Line 567 static void errorParser(s) char s[]; { |
|
extern char *GotoLabel; |
extern char *GotoLabel; |
extern int GotoP; |
extern int GotoP; |
extern int ErrorMessageMode; |
extern int ErrorMessageMode; |
|
extern int RestrictedMode, RestrictedMode_saved; |
int j; |
int j; |
char tmpc[1024]; |
char tmpc[1024]; |
|
RestrictedMode = RestrictedMode_saved; |
|
cancelAlarm(); |
if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { |
if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { |
sprintf(tmpc,"\nError(parser.c): "); |
sprintf(tmpc,"\nError(parser.c): "); |
if (strlen(s) < 1000-strlen(tmpc)) { |
if (strlen(s) < 1000-strlen(tmpc)) { |
Line 589 static void errorParser(s) char s[]; { |
|
Line 599 static void errorParser(s) char s[]; { |
|
fprintf(Fstack,"The interpreter was looking for the label <<%s>>. It is also aborted.\n",GotoLabel); |
fprintf(Fstack,"The interpreter was looking for the label <<%s>>. It is also aborted.\n",GotoLabel); |
GotoP = 0; |
GotoP = 0; |
} |
} |
|
#if defined(__CYGWIN__) |
|
siglongjmp(EnvOfParser,1); |
|
#else |
longjmp(EnvOfParser,1); |
longjmp(EnvOfParser,1); |
|
#endif |
} |
} |
|
|