fix current_predicate
init spelling
This commit is contained in:
parent
98e8bf63e0
commit
962130734e
65
C/stdpreds.c
65
C/stdpreds.c
@ -233,7 +233,7 @@
|
|||||||
* fix situation where we might assume nonextsing double initialization of C
|
* fix situation where we might assume nonextsing double initialization of C
|
||||||
*predicates (use
|
*predicates (use
|
||||||
* Hidden Pred Flag).
|
* Hidden Pred Flag).
|
||||||
* $host_type was double initialised.
|
* $host_type was double initialized.
|
||||||
*
|
*
|
||||||
* Revision 1.71 2004/07/23 21:08:44 vsc
|
* Revision 1.71 2004/07/23 21:08:44 vsc
|
||||||
* windows fixes
|
* windows fixes
|
||||||
@ -880,9 +880,9 @@ static bool valid_prop(Prop p, Term task) {
|
|||||||
if (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE)
|
if (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE)
|
||||||
return false;
|
return false;
|
||||||
if ((RepPredProp(p)->PredFlags & (HiddenPredFlag | StandardPredFlag))) {
|
if ((RepPredProp(p)->PredFlags & (HiddenPredFlag | StandardPredFlag))) {
|
||||||
return (task == SYSTEM_MODULE || task == TermTrue);
|
return (task == SYSTEM_MODULE || task == TermTrue || IsVarTerm(task));
|
||||||
} else {
|
} else {
|
||||||
return (task == USER_MODULE || task == TermTrue);
|
return (task == USER_MODULE || task == TermTrue || IsVarTerm(task));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ static PropEntry *nextPredForAtom(PropEntry *p, Term task) {
|
|||||||
FunctorEntry *f = pe->FunctorOfPred;
|
FunctorEntry *f = pe->FunctorOfPred;
|
||||||
// first search remainder of functor list
|
// first search remainder of functor list
|
||||||
PropEntry *pf;
|
PropEntry *pf;
|
||||||
if ((pf = followLinkedListOfProps(p->NextOfPE, task)), task) {
|
if ((pf = followLinkedListOfProps(p->NextOfPE, task))) {
|
||||||
return pf;
|
return pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,6 +1018,27 @@ static Int cont_current_predicate(USES_REGS1) {
|
|||||||
if (IsNonVarTerm(t3)) {
|
if (IsNonVarTerm(t3)) {
|
||||||
PropEntry *np, *p;
|
PropEntry *np, *p;
|
||||||
|
|
||||||
|
if (IsNonVarTerm(t2)) {
|
||||||
|
// module and functor known, should be easy
|
||||||
|
if (IsAtomTerm(t2)) {
|
||||||
|
if ((p = Yap_GetPredPropByAtom(AtomOfTerm(t3), t2)) &&
|
||||||
|
valid_prop(p, task)
|
||||||
|
) {
|
||||||
|
cut_succeed();
|
||||||
|
} else {
|
||||||
|
cut_fail();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((p = Yap_GetPredPropByFunc(FunctorOfTerm(t3), t2)) &&
|
||||||
|
valid_prop(p, task)
|
||||||
|
) {
|
||||||
|
cut_succeed();
|
||||||
|
} else {
|
||||||
|
cut_fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// t3 is a functor, or compound term,
|
// t3 is a functor, or compound term,
|
||||||
// just follow the functor chain
|
// just follow the functor chain
|
||||||
p = AbsPredProp(pp);
|
p = AbsPredProp(pp);
|
||||||
@ -1029,30 +1050,20 @@ static Int cont_current_predicate(USES_REGS1) {
|
|||||||
if (p == NIL)
|
if (p == NIL)
|
||||||
cut_fail();
|
cut_fail();
|
||||||
pp = RepPredProp(p);
|
pp = RepPredProp(p);
|
||||||
if (!IsVarTerm(t2)) {
|
}
|
||||||
do {
|
np = followLinkedListOfProps(p->NextOfPE, task);
|
||||||
if (t2 == TermProlog)
|
Term mod = pp->ModuleOfPred;
|
||||||
t2 = PROLOG_MODULE;
|
if (mod == PROLOG_MODULE)
|
||||||
if (pp->ModuleOfPred == t2) {
|
mod = TermProlog;
|
||||||
will_cut = true;
|
bool b = Yap_unify(t2, mod);
|
||||||
break;
|
if (!np) {
|
||||||
} else {
|
if (b) cut_succeed();
|
||||||
pp = RepPredProp(p = followLinkedListOfProps(p->NextOfPE, task));
|
else cut_fail();
|
||||||
}
|
} else {
|
||||||
} while (!will_cut && p);
|
EXTRA_CBACK_ARG(4, 1) = MkAddressTerm(RepPredProp(np));
|
||||||
}
|
B->cp_h = HR;
|
||||||
if (!p)
|
return b;
|
||||||
cut_fail();
|
|
||||||
}
|
}
|
||||||
do {
|
|
||||||
np = followLinkedListOfProps(p->NextOfPE, task);
|
|
||||||
if (!np) {
|
|
||||||
will_cut = true;
|
|
||||||
} else {
|
|
||||||
EXTRA_CBACK_ARG(4, 1) = MkAddressTerm(RepPredProp(np));
|
|
||||||
B->cp_h = HR;
|
|
||||||
}
|
|
||||||
} while (p == NULL);
|
|
||||||
} else if (IsNonVarTerm(t1)) {
|
} else if (IsNonVarTerm(t1)) {
|
||||||
PropEntry *np, *p;
|
PropEntry *np, *p;
|
||||||
// run over the same atomany predicate defined for that atom
|
// run over the same atomany predicate defined for that atom
|
||||||
|
Reference in New Issue
Block a user