we had args already (no need for argv0)
improve error handling in YAP_ReadBuffer
This commit is contained in:
parent
96da71b514
commit
4c8eb33e06
@ -1417,8 +1417,39 @@ YAP_ReadBuffer(char *s, Term *tp)
|
|||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
|
|
||||||
while ((t = Yap_StringToTerm(s,tp)) == 0L) {
|
while ((t = Yap_StringToTerm(s,tp)) == 0L) {
|
||||||
if (!dogc())
|
if (Yap_ErrorMessage) {
|
||||||
return FALSE;
|
if (!strcmp(Yap_ErrorMessage,"Stack Overflow")) {
|
||||||
|
if (!dogc()) {
|
||||||
|
*tp = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
||||||
|
Yap_ErrorMessage = NULL;
|
||||||
|
RECOVER_H();
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
} else if (!strcmp(Yap_ErrorMessage,"Heap Overflow")) {
|
||||||
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
||||||
|
*tp = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
||||||
|
Yap_ErrorMessage = NULL;
|
||||||
|
RECOVER_H();
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
} else if (!strcmp(Yap_ErrorMessage,"Trail Overflow")) {
|
||||||
|
if (!Yap_growtrail (0, FALSE)) {
|
||||||
|
*tp = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
||||||
|
Yap_ErrorMessage = NULL;
|
||||||
|
RECOVER_H();
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*tp = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
||||||
|
Yap_ErrorMessage = NULL;
|
||||||
|
RECOVER_H();
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
Yap_ErrorMessage = NULL;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
return t;
|
return t;
|
||||||
|
@ -6130,7 +6130,7 @@ Yap_StringToTerm(char *s,Term *tp)
|
|||||||
}
|
}
|
||||||
t = Yap_Parse();
|
t = Yap_Parse();
|
||||||
TR = TR_before_parse;
|
TR = TR_before_parse;
|
||||||
if (Yap_ErrorMessage) {
|
if (!t && !Yap_ErrorMessage) {
|
||||||
if (tp) {
|
if (tp) {
|
||||||
*tp = syntax_error(tokstart, sno);
|
*tp = syntax_error(tokstart, sno);
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,6 @@ init_standard_system(int argc, char *argv[], YAP_init_args *iap)
|
|||||||
iap->ErrorNo = 0;
|
iap->ErrorNo = 0;
|
||||||
iap->ErrorCause = NULL;
|
iap->ErrorCause = NULL;
|
||||||
iap->QuietMode = FALSE;
|
iap->QuietMode = FALSE;
|
||||||
iap->Argv0 = argv[0];
|
|
||||||
|
|
||||||
BootMode = parse_yap_arguments(argc,argv,iap);
|
BootMode = parse_yap_arguments(argc,argv,iap);
|
||||||
|
|
||||||
|
@ -142,8 +142,6 @@ typedef struct {
|
|||||||
int ErrorNo;
|
int ErrorNo;
|
||||||
/* errorstring */
|
/* errorstring */
|
||||||
char *ErrorCause;
|
char *ErrorCause;
|
||||||
/* argv[0] */
|
|
||||||
char *Argv0;
|
|
||||||
} YAP_init_args;
|
} YAP_init_args;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user