be careful about error mode
This commit is contained in:
parent
e8ed525e3b
commit
d1c4db3c4b
11
C/errors.c
11
C/errors.c
@ -375,8 +375,9 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
LOCAL_PrologMode |= InErrorMode;
|
LOCAL_PrologMode |= InErrorMode;
|
||||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||||
Yap_ClearExs();
|
Yap_ClearExs();
|
||||||
if (where == 0L)
|
if (where == 0L) {
|
||||||
where = TermNil;
|
where = TermNil;
|
||||||
|
}
|
||||||
// first, obtain current location
|
// first, obtain current location
|
||||||
sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno, function);
|
sprintf(LOCAL_FileNameBuf, "%s:%d in C-function %s ", file, lineno, function);
|
||||||
tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
tf = MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf));
|
||||||
@ -391,12 +392,14 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
if (type == INTERRUPT_EVENT) {
|
if (type == INTERRUPT_EVENT) {
|
||||||
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
fprintf(stderr, "%% YAP exiting: cannot handle signal %d\n",
|
||||||
(int)IntOfTerm(where));
|
(int)IntOfTerm(where));
|
||||||
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
Yap_exit(1);
|
Yap_exit(1);
|
||||||
}
|
}
|
||||||
if (LOCAL_within_print_message) {
|
if (LOCAL_within_print_message) {
|
||||||
/* error within error */
|
/* error within error */
|
||||||
fprintf(stderr, "%% ERROR WITHIN WARNING %d: %s\n", LOCAL_CurrentError,
|
fprintf(stderr, "%% ERROR WITHIN WARNING %d: %s\n", LOCAL_CurrentError,
|
||||||
tmpbuf);
|
tmpbuf);
|
||||||
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
Yap_exit(1);
|
Yap_exit(1);
|
||||||
}
|
}
|
||||||
if (LOCAL_PrologMode == BootMode) {
|
if (LOCAL_PrologMode == BootMode) {
|
||||||
@ -421,8 +424,10 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
else
|
else
|
||||||
comment = TermNil;
|
comment = TermNil;
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (P == (yamop *)(FAILCODE))
|
if (P == (yamop *)(FAILCODE)) {
|
||||||
return P;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
|
return P;
|
||||||
|
}
|
||||||
/* PURE_ABORT may not have set where correctly, BootMode may not have the data
|
/* PURE_ABORT may not have set where correctly, BootMode may not have the data
|
||||||
* terms ready */
|
* terms ready */
|
||||||
if (type == ABORT_EVENT || LOCAL_PrologMode & BootMode) {
|
if (type == ABORT_EVENT || LOCAL_PrologMode & BootMode) {
|
||||||
|
Reference in New Issue
Block a user