diff --git a/C/absmi.c b/C/absmi.c index 65092fc50..764ff672d 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -7816,13 +7816,11 @@ absmi(int inp) DelayedB = pt0; } /* find where to cut to */ -#ifdef YAPOR if (SHOULD_CUT_UP_TO(B,pt0)) { /* Wow, we're gonna cut!!! */ +#ifdef YAPOR CUT_prune_to(pt0); #else - if (SHOULD_CUT_UP_TO(B,pt0)) { - /* Wow, we're gonna cut!!! */ B = pt0; #endif /* YAPOR */ HBREG = PROTECT_FROZEN_H(B); diff --git a/C/cdmgr.c b/C/cdmgr.c index 715406717..3182406c5 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -922,15 +922,15 @@ p_in_this_f_before(void) Prop p0; SMALLUNSGN mod; - if (IsVarTerm(t = Deref(ARG1)) && !IsAtomTerm(t)) + if (IsVarTerm(t = Deref(ARG1)) || !IsAtomTerm(t)) return (FALSE); else at = AtomOfTerm(t); - if (IsVarTerm(t = Deref(ARG2)) && !IsIntTerm(t)) + if (IsVarTerm(t = Deref(ARG2)) || !IsIntTerm(t)) return (FALSE); else arity = IntOfTerm(t); - if (IsVarTerm(t = Deref(ARG3)) && !IsAtomTerm(t)) + if (IsVarTerm(t = Deref(ARG3)) || !IsAtomTerm(t)) return (FALSE); else mod = LookupModule(t); @@ -962,15 +962,15 @@ p_first_cl_in_f(void) SMALLUNSGN mod; - if (IsVarTerm(t = Deref(ARG1)) && !IsAtomTerm(t)) + if (IsVarTerm(t = Deref(ARG1)) || !IsAtomTerm(t)) return (FALSE); else at = AtomOfTerm(t); - if (IsVarTerm(t = Deref(ARG2)) && !IsIntTerm(t)) + if (IsVarTerm(t = Deref(ARG2)) || !IsIntTerm(t)) return (FALSE); else arity = IntOfTerm(t); - if (IsVarTerm(t = Deref(ARG3)) && !IsAtomTerm(t)) + if (IsVarTerm(t = Deref(ARG3)) || !IsAtomTerm(t)) return (FALSE); else mod = LookupModule(t); diff --git a/C/exec.c b/C/exec.c index cc6d5f6db..e7cc80487 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1027,7 +1027,7 @@ execute_goal(Term t, int nargs, SMALLUNSGN mod) OldTopB = (choiceptr)(LCL0-MyOldTopB); OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB); if (DelayedB != NULL) { - if (YOUNGER_CP(DelayedB,B)) { + if (YOUNGER_CP(B,DelayedB)) { /* we have a delayed cut to do */ if (YOUNGER_CP(OldTopB,DelayedB)) { /* 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); OldDelayedB = (choiceptr)(LCL0-MyOldDelayedB); if (DelayedB != NULL) { - if (YOUNGER_CP(DelayedB,B)) { + if (YOUNGER_CP(B,DelayedB)) { /* we have a delayed cut to do */ if (YOUNGER_CP(OldTopB,DelayedB)) { /* and this delayed cut is to before the c-code that actually called us */ @@ -1254,10 +1254,23 @@ Int JumpToEnv(Term t) { yamop *pos = (yamop *)(PredDollarCatch->LastClause); CELL *env; + choiceptr first_func = NULL; do { /* find the first choicepoint that may be a catch */ 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; } /* is it a continuation? */ @@ -1278,7 +1291,12 @@ JumpToEnv(Term t) { /* I could backtrack here, but it is easier to leave the unwinding to the emulator */ B->cp_a3 = t; + if (DelayedB == NULL || YOUNGER_CP(B,DelayedB)) + DelayedB = B; P = (yamop *)FAILCODE; + if (first_func != NULL) { + B = first_func; + } return(FALSE); } diff --git a/C/write.c b/C/write.c index 0ccc43640..d7894e84b 100644 --- a/C/write.c +++ b/C/write.c @@ -220,7 +220,7 @@ putAtom(Atom atom) /* writes an atom */ char *s = RepAtom(atom)->StrOfAE; wtype atom_or_symbol = AtomIsSymbols(s); -#define CRYPT_FOR_STEVE 1 + /* #define CRYPT_FOR_STEVE 1*/ #ifdef CRYPT_FOR_STEVE if (GetValue(LookupAtom("crypt_atoms")) != TermNil && GetAProp(atom, OpProperty) == NIL) { char s[16];