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;
}
/* 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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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];