fix error handling from within recursive invocations of emulator

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@427 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-04-03 19:33:38 +00:00
parent b62af46858
commit ff0b60d7a7
4 changed files with 28 additions and 12 deletions

View File

@ -7816,13 +7816,11 @@ absmi(int inp)
DelayedB = pt0; DelayedB = pt0;
} }
/* find where to cut to */ /* find where to cut to */
#ifdef YAPOR
if (SHOULD_CUT_UP_TO(B,pt0)) { if (SHOULD_CUT_UP_TO(B,pt0)) {
/* Wow, we're gonna cut!!! */ /* Wow, we're gonna cut!!! */
#ifdef YAPOR
CUT_prune_to(pt0); CUT_prune_to(pt0);
#else #else
if (SHOULD_CUT_UP_TO(B,pt0)) {
/* Wow, we're gonna cut!!! */
B = pt0; B = pt0;
#endif /* YAPOR */ #endif /* YAPOR */
HBREG = PROTECT_FROZEN_H(B); HBREG = PROTECT_FROZEN_H(B);

View File

@ -922,15 +922,15 @@ p_in_this_f_before(void)
Prop p0; Prop p0;
SMALLUNSGN mod; SMALLUNSGN mod;
if (IsVarTerm(t = Deref(ARG1)) && !IsAtomTerm(t)) if (IsVarTerm(t = Deref(ARG1)) || !IsAtomTerm(t))
return (FALSE); return (FALSE);
else else
at = AtomOfTerm(t); at = AtomOfTerm(t);
if (IsVarTerm(t = Deref(ARG2)) && !IsIntTerm(t)) if (IsVarTerm(t = Deref(ARG2)) || !IsIntTerm(t))
return (FALSE); return (FALSE);
else else
arity = IntOfTerm(t); arity = IntOfTerm(t);
if (IsVarTerm(t = Deref(ARG3)) && !IsAtomTerm(t)) if (IsVarTerm(t = Deref(ARG3)) || !IsAtomTerm(t))
return (FALSE); return (FALSE);
else else
mod = LookupModule(t); mod = LookupModule(t);
@ -962,15 +962,15 @@ p_first_cl_in_f(void)
SMALLUNSGN mod; SMALLUNSGN mod;
if (IsVarTerm(t = Deref(ARG1)) && !IsAtomTerm(t)) if (IsVarTerm(t = Deref(ARG1)) || !IsAtomTerm(t))
return (FALSE); return (FALSE);
else else
at = AtomOfTerm(t); at = AtomOfTerm(t);
if (IsVarTerm(t = Deref(ARG2)) && !IsIntTerm(t)) if (IsVarTerm(t = Deref(ARG2)) || !IsIntTerm(t))
return (FALSE); return (FALSE);
else else
arity = IntOfTerm(t); arity = IntOfTerm(t);
if (IsVarTerm(t = Deref(ARG3)) && !IsAtomTerm(t)) if (IsVarTerm(t = Deref(ARG3)) || !IsAtomTerm(t))
return (FALSE); return (FALSE);
else else
mod = LookupModule(t); mod = LookupModule(t);

View File

@ -1027,7 +1027,7 @@ execute_goal(Term t, int nargs, SMALLUNSGN mod)
OldTopB = (choiceptr)(LCL0-MyOldTopB); OldTopB = (choiceptr)(LCL0-MyOldTopB);
OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB); OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB);
if (DelayedB != NULL) { if (DelayedB != NULL) {
if (YOUNGER_CP(DelayedB,B)) { if (YOUNGER_CP(B,DelayedB)) {
/* we have a delayed cut to do */ /* we have a delayed cut to do */
if (YOUNGER_CP(OldTopB,DelayedB)) { if (YOUNGER_CP(OldTopB,DelayedB)) {
/* and this delayed cut is to before the c-code that actually called us */ /* and this delayed cut is to before the c-code that actually called us */
@ -1074,7 +1074,7 @@ execute_goal(Term t, int nargs, SMALLUNSGN mod)
OldTopB = (choiceptr)(LCL0-MyOldTopB); OldTopB = (choiceptr)(LCL0-MyOldTopB);
OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB); OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB);
if (DelayedB != NULL) { if (DelayedB != NULL) {
if (YOUNGER_CP(DelayedB,B)) { if (YOUNGER_CP(B,DelayedB)) {
/* we have a delayed cut to do */ /* we have a delayed cut to do */
if (YOUNGER_CP(OldTopB,DelayedB)) { if (YOUNGER_CP(OldTopB,DelayedB)) {
/* and this delayed cut is to before the c-code that actually called us */ /* and this delayed cut is to before the c-code that actually called us */
@ -1254,10 +1254,23 @@ Int
JumpToEnv(Term t) { JumpToEnv(Term t) {
yamop *pos = (yamop *)(PredDollarCatch->LastClause); yamop *pos = (yamop *)(PredDollarCatch->LastClause);
CELL *env; CELL *env;
choiceptr first_func = NULL;
do { do {
/* find the first choicepoint that may be a catch */ /* find the first choicepoint that may be a catch */
while (B->cp_ap != pos) { while (B->cp_ap != pos) {
/* we are already doing a catch */
if (B->cp_ap == (yamop *)(PredHandleThrow->LastClause)) {
if (DelayedB == NULL || YOUNGER_CP(B,DelayedB))
DelayedB = B;
P = (yamop *)FAILCODE;
if (first_func != NULL) {
B = first_func;
}
return(FALSE);
}
if (B->cp_ap == (yamop *) NOCODE && first_func == NULL)
first_func = B;
B = B->cp_b; B = B->cp_b;
} }
/* is it a continuation? */ /* is it a continuation? */
@ -1278,7 +1291,12 @@ JumpToEnv(Term t) {
/* I could backtrack here, but it is easier to leave the unwinding /* I could backtrack here, but it is easier to leave the unwinding
to the emulator */ to the emulator */
B->cp_a3 = t; B->cp_a3 = t;
if (DelayedB == NULL || YOUNGER_CP(B,DelayedB))
DelayedB = B;
P = (yamop *)FAILCODE; P = (yamop *)FAILCODE;
if (first_func != NULL) {
B = first_func;
}
return(FALSE); return(FALSE);
} }

View File

@ -220,7 +220,7 @@ putAtom(Atom atom) /* writes an atom */
char *s = RepAtom(atom)->StrOfAE; char *s = RepAtom(atom)->StrOfAE;
wtype atom_or_symbol = AtomIsSymbols(s); wtype atom_or_symbol = AtomIsSymbols(s);
#define CRYPT_FOR_STEVE 1 /* #define CRYPT_FOR_STEVE 1*/
#ifdef CRYPT_FOR_STEVE #ifdef CRYPT_FOR_STEVE
if (GetValue(LookupAtom("crypt_atoms")) != TermNil && GetAProp(atom, OpProperty) == NIL) { if (GetValue(LookupAtom("crypt_atoms")) != TermNil && GetAProp(atom, OpProperty) == NIL) {
char s[16]; char s[16];