fix multi-file preds defined in Prolog mode to be actuall defined in that mode.

This commit is contained in:
Vitor Santos Costa 2011-09-07 08:02:54 +02:00
parent 04f0a4bb73
commit db0a7771ba

View File

@ -2136,9 +2136,9 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
PELOCK(20,p); PELOCK(20,p);
pflags = p->PredFlags; pflags = p->PredFlags;
/* we are redefining a prolog module predicate */ /* we are redefining a prolog module predicate */
if ((pflags & (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) || if ((pflags &
(p->ModuleOfPred == PROLOG_MODULE && (UserCPredFlag|CArgsPredFlag|NumberDBPredFlag|AtomDBPredFlag|TestPredFlag|AsmPredFlag|CPredFlag|BinaryPredFlag)) ||
mod != TermProlog && mod) ) { (p->ModuleOfPred == PROLOG_MODULE && mod != TermProlog && mod && !(p->PredFlags & (DynamicPredFlag|LogUpdatePredFlag|MultiFileFlag)))) {
addcl_permission_error(RepAtom(at), Arity, FALSE); addcl_permission_error(RepAtom(at), Arity, FALSE);
UNLOCKPE(30,p); UNLOCKPE(30,p);
return TermNil; return TermNil;
@ -2884,8 +2884,6 @@ p_new_multifile( USES_REGS1 )
pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity),mod)); pe = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, arity),mod));
PELOCK(26,pe); PELOCK(26,pe);
pe->PredFlags |= MultiFileFlag; pe->PredFlags |= MultiFileFlag;
if (pe->ModuleOfPred == PROLOG_MODULE)
pe->ModuleOfPred = TermProlog;
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) { if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
/* static */ /* static */
pe->PredFlags |= (SourcePredFlag|CompiledPredFlag); pe->PredFlags |= (SourcePredFlag|CompiledPredFlag);