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:
26
C/exec.c
26
C/exec.c
@@ -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 !! */
|
||||
|
Reference in New Issue
Block a user