go back to model where multifile cannot be in module 0.
This commit is contained in:
parent
0febddf090
commit
bf54802c49
12
C/adtdefs.c
12
C/adtdefs.c
@ -991,9 +991,15 @@ Yap_PredPropByFunctorNonThreadLocal(Functor f, Term cur_mod)
|
||||
return Yap_NewPredPropByFunctor(f,cur_mod);
|
||||
|
||||
if ((p->ModuleOfPred == cur_mod || !(p->ModuleOfPred))) {
|
||||
/* don't match multi-files */
|
||||
if (!(p->PredFlags & MultiFileFlag) ||
|
||||
p->ModuleOfPred ||
|
||||
!cur_mod ||
|
||||
cur_mod == TermProlog) {
|
||||
WRITE_UNLOCK(f->FRWLock);
|
||||
return AbsPredProp(p);
|
||||
}
|
||||
}
|
||||
if (p->NextOfPE) {
|
||||
UInt hash = PRED_HASH(f,cur_mod,PredHashTableSize);
|
||||
READ_LOCK(PredHashRWLock);
|
||||
@ -1027,9 +1033,15 @@ Yap_PredPropByAtomNonThreadLocal(Atom at, Term cur_mod)
|
||||
PredEntry *pe = RepPredProp(p0);
|
||||
if ( pe->KindOfPE == PEProp &&
|
||||
(pe->ModuleOfPred == cur_mod || !pe->ModuleOfPred)) {
|
||||
/* don't match multi-files */
|
||||
if (!(pe->PredFlags & MultiFileFlag) ||
|
||||
pe->ModuleOfPred ||
|
||||
!cur_mod ||
|
||||
cur_mod == TermProlog) {
|
||||
WRITE_UNLOCK(ae->ARWLock);
|
||||
return(p0);
|
||||
}
|
||||
}
|
||||
p0 = pe->NextOfPE;
|
||||
}
|
||||
return Yap_NewPredPropByAtom(ae,cur_mod);
|
||||
|
@ -2136,9 +2136,9 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
|
||||
PELOCK(20,p);
|
||||
pflags = p->PredFlags;
|
||||
/* we are redefining a prolog module predicate */
|
||||
if ((pflags &
|
||||
(UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) ||
|
||||
(p->ModuleOfPred == PROLOG_MODULE && mod != TermProlog && mod && !(p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag|MultiFileFlag)))) {
|
||||
if ((pflags & (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) ||
|
||||
(p->ModuleOfPred == PROLOG_MODULE &&
|
||||
mod != TermProlog && mod) ) {
|
||||
addcl_permission_error(RepAtom(at), Arity, FALSE);
|
||||
UNLOCKPE(30,p);
|
||||
return TermNil;
|
||||
@ -2884,6 +2884,9 @@ p_new_multifile( USES_REGS1 )
|
||||
pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity),mod));
|
||||
PELOCK(26,pe);
|
||||
pe->PredFlags |= MultiFileFlag;
|
||||
/* mutifile-predicates are weird, they do not seat really on the default module */
|
||||
if (pe->ModuleOfPred == PROLOG_MODULE)
|
||||
pe->ModuleOfPred = TermProlog;
|
||||
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
|
||||
/* static */
|
||||
pe->PredFlags |= (SourcePredFlag|CompiledPredFlag);
|
||||
|
3
C/qlyr.c
3
C/qlyr.c
@ -906,6 +906,9 @@ read_pred(IOSTREAM *stream, Term mod) {
|
||||
ap->src.OwnerFile = AtomAdjust(ap->src.OwnerFile);
|
||||
}
|
||||
}
|
||||
/* multifile predicates cannot reside in module 0 */
|
||||
if (flags & MultiFileFlag && ap->ModuleOfPred == PROLOG_MODULE)
|
||||
ap->ModuleOfPred = TermProlog;
|
||||
read_clauses(stream, ap, nclauses, flags);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user