current_pred might lose the first solution
This commit is contained in:
parent
fd23360c63
commit
8594c41487
13
C/stdpreds.c
13
C/stdpreds.c
@ -631,15 +631,15 @@ static Int
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool valid_prop(Prop p, Term task) {
|
static bool valid_prop(Prop p, Term task) {
|
||||||
if ((RepPredProp(p)->PredFlags & HiddenPredFlag) ||
|
PredEntry *pe = RepPredProp(p);
|
||||||
(RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE)) {
|
if ((pe->PredFlags & HiddenPredFlag) || (pe->OpcodeOfPred == UNDEF_OPCODE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (task == TermSystem || task == TermProlog) {
|
if (task == TermSystem || task == TermProlog) {
|
||||||
return RepPredProp(p)->PredFlags & StandardPredFlag;
|
return pe->PredFlags & StandardPredFlag;
|
||||||
}
|
}
|
||||||
if (task == TermUser) {
|
if (task == TermUser) {
|
||||||
return !(RepPredProp(p)->PredFlags & StandardPredFlag);
|
return !(pe->PredFlags & StandardPredFlag);
|
||||||
}
|
}
|
||||||
if (IsVarTerm(task)) {
|
if (IsVarTerm(task)) {
|
||||||
return true;
|
return true;
|
||||||
@ -860,7 +860,10 @@ static Int cont_current_predicate(USES_REGS1) {
|
|||||||
Yap_Error(TYPE_ERROR_ATOM, t2, "module name");
|
Yap_Error(TYPE_ERROR_ATOM, t2, "module name");
|
||||||
}
|
}
|
||||||
ModEntry *m = Yap_GetModuleEntry(t2);
|
ModEntry *m = Yap_GetModuleEntry(t2);
|
||||||
pp = firstModulePred(m->PredForME, task);
|
pp = m->PredForME;
|
||||||
|
while (pp && !valid_prop(AbsPredProp(pp), task)) {
|
||||||
|
pp = pp->NextPredOfModule;
|
||||||
|
}
|
||||||
if (!pp) {
|
if (!pp) {
|
||||||
/* try Prolog Module */
|
/* try Prolog Module */
|
||||||
cut_fail();
|
cut_fail();
|
||||||
|
Reference in New Issue
Block a user