fix case where people used nth_instance on predicate entries
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1271 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
056ccbc819
commit
5ae92827f4
42
C/dbase.c
42
C/dbase.c
@ -2391,7 +2391,8 @@ GetDBLUKey(PredEntry *ap)
|
|||||||
Int id = ap->src.IndxId;
|
Int id = ap->src.IndxId;
|
||||||
READ_UNLOCK(ap->PRWLock);
|
READ_UNLOCK(ap->PRWLock);
|
||||||
return MkIntegerTerm(id);
|
return MkIntegerTerm(id);
|
||||||
} else if (ap->PredFlags & AtomDBPredFlag) {
|
} else if (ap->PredFlags & AtomDBPredFlag ||
|
||||||
|
(ap->ModuleOfPred != IDB_MODULE && ap->ArityOfPE == 0)) {
|
||||||
Atom at = (Atom)ap->FunctorOfPred;
|
Atom at = (Atom)ap->FunctorOfPred;
|
||||||
READ_UNLOCK(ap->PRWLock);
|
READ_UNLOCK(ap->PRWLock);
|
||||||
return MkAtomTerm(at);
|
return MkAtomTerm(at);
|
||||||
@ -3482,35 +3483,22 @@ p_recorded(void)
|
|||||||
}
|
}
|
||||||
if (ref->Flags & LogUpdMask) {
|
if (ref->Flags & LogUpdMask) {
|
||||||
LogUpdClause *cl = (LogUpdClause *)ref;
|
LogUpdClause *cl = (LogUpdClause *)ref;
|
||||||
PredEntry *ap;
|
PredEntry *ap = cl->ClPred;
|
||||||
if (Yap_op_from_opcode(cl->ClCode->opc) == _unify_idb_term) {
|
op_numbers opc = Yap_op_from_opcode(P->opc);
|
||||||
if (!Yap_unify(ARG2, cl->ClSource->Entry)) {
|
|
||||||
|
if (!Yap_unify(GetDBLUKey(ap), ARG1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
if (opc == _procceed) {
|
||||||
|
P = cl->ClCode;
|
||||||
} else {
|
} else {
|
||||||
Term TermDB;
|
CP = P;
|
||||||
while ((TermDB = GetDBTerm(cl->ClSource)) == (CELL)0) {
|
P = cl->ClCode;
|
||||||
/* oops, we are in trouble, not enough stack space */
|
ENV = YENV;
|
||||||
if (Yap_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
|
YENV = ASP;
|
||||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
YENV[E_CB] = (CELL) B;
|
||||||
if (!Yap_growglobal(NULL)) {
|
|
||||||
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, Yap_ErrorMessage);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
|
||||||
if (!Yap_gcl(Yap_Error_Size, 3, ENV, P)) {
|
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Yap_unify(ARG2,TermDB)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ap = cl->ClPred;
|
|
||||||
return Yap_unify(GetDBLUKey(ap), ARG1);
|
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
Term TermDB;
|
Term TermDB;
|
||||||
while ((TermDB = GetDBTermFromDBEntry(ref)) == (CELL)0) {
|
while ((TermDB = GetDBTermFromDBEntry(ref)) == (CELL)0) {
|
||||||
|
Reference in New Issue
Block a user