fix EX: it cannot be a term and it should be a placeholder for BallTerm,

so the twp can never be alive at the same time.
This commit is contained in:
Vítor Santos Costa
2010-07-21 12:49:06 +01:00
parent 92a8e37769
commit 3dd68aa8bd
5 changed files with 36 additions and 11 deletions

View File

@@ -2040,7 +2040,24 @@ YAP_GoalHasException(Term *t)
int out = FALSE;
BACKUP_MACHINE_REGS();
if (EX) {
*t = EX;
do {
*t = Yap_FetchTermFromDB(EX);
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
} else {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(EX->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
}
} while (*t == (CELL)0);
out = TRUE;
}
RECOVER_MACHINE_REGS();
@@ -2051,7 +2068,11 @@ X_API void
YAP_ClearExceptions(void)
{
Yap_ResetExceptionTerm();
EX = 0L;
if (EX) {
BallTerm = EX;
}
EX = NULL;
Yap_ResetExceptionTerm();
UncaughtThrow = FALSE;
}