get rid of UnCutable

a:(a(X),b(X)) should be the same as a:a(X), a:b(X). Use PushModPred to
force that.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@642 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2002-10-18 13:54:53 +00:00
parent e19f91db60
commit d21021da0d
6 changed files with 63 additions and 43 deletions

View File

@@ -206,6 +206,29 @@ EnterCreepMode(SMALLUNSGN mod) {
return (CallPredicate(PredSpy, B));
}
/* push module inside so that it will visible to the next calls */
static Term
PushModule(Term t,SMALLUNSGN mod) {
Functor f = FunctorOfTerm(t);
Term tmod = ModuleName[mod];
if (ArityOfFunctor(f) == 2) {
Term ti[2], tf[2];
ti[0] = tmod;
ti[1] = ArgOfTerm(1,t);
tf[0] = MkApplTerm(FunctorModule,2,ti);
ti[0] = tmod;
ti[1] = ArgOfTerm(2,t);
tf[1] = MkApplTerm(FunctorModule,2,ti);
return(MkApplTerm(f,2,tf));
} else {
Term ti[2], tf[1];
ti[0] = tmod;
ti[1] = ArgOfTerm(1,t);
tf[0] = MkApplTerm(FunctorModule,2,ti);
return(MkApplTerm(f,1,tf));
}
}
inline static Int
do_execute(Term t, SMALLUNSGN mod)
{
@@ -241,6 +264,9 @@ do_execute(Term t, SMALLUNSGN mod)
goto restart_exec;
}
}
if (pen->PredFlags & PushModPredFlag) {
t = PushModule(t,mod);
}
return(CallMetaCall(mod));
}
/* now let us do what we wanted to do from the beginning !! */