more of the same module fixes.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@643 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-10-18 14:52:58 +00:00
parent d21021da0d
commit a721ad3e27
2 changed files with 60 additions and 11 deletions

View File

@ -120,6 +120,28 @@ push_live_regs(yamop *pco)
} }
#endif #endif
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));
}
}
Int Int
absmi(int inp) absmi(int inp)
{ {
@ -11666,8 +11688,12 @@ absmi(int inp)
goto execute_nvar; goto execute_nvar;
} }
} }
d0 = ExecuteCallMetaCall(mod); if (pen->PredFlags & PushModPredFlag) {
goto execute_nvar; d0 = PushModule(d0,mod);
} else {
d0 = ExecuteCallMetaCall(mod);
goto execute_nvar;
}
} }
BEGP(pt1); BEGP(pt1);
pt1 = RepAppl(d0); pt1 = RepAppl(d0);
@ -11785,8 +11811,12 @@ absmi(int inp)
goto execute_within_nvar; goto execute_within_nvar;
} }
} }
d0 = ExecuteCallMetaCall(mod); if (pen->PredFlags & PushModPredFlag) {
goto execute_within_nvar; d0 = PushModule(d0,mod);
} else {
d0 = ExecuteCallMetaCall(mod);
goto execute_within_nvar;
}
} }
BEGP(pt1); BEGP(pt1);
pt1 = RepAppl(d0); pt1 = RepAppl(d0);
@ -11921,8 +11951,12 @@ absmi(int inp)
goto last_execute_within_nvar; goto last_execute_within_nvar;
} }
} }
d0 = ExecuteCallMetaCall(mod); if (pen->PredFlags & PushModPredFlag) {
goto last_execute_within_nvar; d0 = PushModule(d0,mod);
} else {
d0 = ExecuteCallMetaCall(mod);
goto last_execute_within_nvar;
}
} }
BEGP(pt1); BEGP(pt1);
pt1 = RepAppl(d0); pt1 = RepAppl(d0);

View File

@ -266,8 +266,9 @@ do_execute(Term t, SMALLUNSGN mod)
} }
if (pen->PredFlags & PushModPredFlag) { if (pen->PredFlags & PushModPredFlag) {
t = PushModule(t,mod); t = PushModule(t,mod);
} else{
return(CallMetaCall(mod));
} }
return(CallMetaCall(mod));
} }
/* now let us do what we wanted to do from the beginning !! */ /* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
@ -375,7 +376,11 @@ p_execute_within(void)
goto restart_exec; goto restart_exec;
} }
} }
return(CallMetaCallWithin()); if (pen->PredFlags & PushModPredFlag) {
t = PushModule(t,mod);
} else {
return(CallMetaCallWithin());
}
} }
/* now let us do what we wanted to do from the beginning !! */ /* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
@ -473,7 +478,11 @@ p_execute_within2(void)
/* You thought we would be over by now */ /* You thought we would be over by now */
/* but no meta calls require special preprocessing */ /* but no meta calls require special preprocessing */
if (pen->PredFlags & MetaPredFlag) { if (pen->PredFlags & MetaPredFlag) {
return(CallMetaCallWithin()); if (pen->PredFlags & PushModPredFlag) {
t = PushModule(t,mod);
} else {
return(CallMetaCallWithin());
}
} }
/* at this point check if we should enter creep mode */ /* at this point check if we should enter creep mode */
/* now let us do what we wanted to do from the beginning !! */ /* now let us do what we wanted to do from the beginning !! */
@ -568,6 +577,10 @@ p_execute0(void)
goto restart_exec; goto restart_exec;
} }
} }
pe = PredPropByFunc(f, mod);
if (RepPredProp(pe)->PredFlags & PushModPredFlag) {
t = PushModule(t,mod);
}
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
otherwise I would dereference the argument and otherwise I would dereference the argument and
@ -584,7 +597,6 @@ p_execute0(void)
XREGS[i] = *pt++; XREGS[i] = *pt++;
#endif #endif
} }
pe = PredPropByFunc(f, mod);
} else { } else {
Error(TYPE_ERROR_CALLABLE,ARG3,"call/1"); Error(TYPE_ERROR_CALLABLE,ARG3,"call/1");
return(FALSE); return(FALSE);
@ -1249,6 +1261,10 @@ p_at_execute(void)
} }
Error(TYPE_ERROR_ATOM, ARG1, "calling clause in debugger"); Error(TYPE_ERROR_ATOM, ARG1, "calling clause in debugger");
} }
pe = PredPropByFunc(f,mod);
if (RepPredProp(pe)->PredFlags & PushModPredFlag) {
t = PushModule(t,mod);
}
arity = ArityOfFunctor(f); arity = ArityOfFunctor(f);
a = NameOfFunctor(f); a = NameOfFunctor(f);
/* I cannot use the standard macro here because /* I cannot use the standard macro here because
@ -1267,7 +1283,6 @@ p_at_execute(void)
#else #else
XREGS[i] = *pt++; XREGS[i] = *pt++;
#endif #endif
pe = PredPropByFunc(f,mod);
} else } else
return (FALSE); /* for the moment */ return (FALSE); /* for the moment */
if (IsVarTerm(t2) || !IsIntTerm(t2)) if (IsVarTerm(t2) || !IsIntTerm(t2))