From 533365611c24ce1521ff0ba774d3fafd2056602c Mon Sep 17 00:00:00 2001 From: vsc Date: Thu, 30 Jan 2003 18:00:26 +0000 Subject: [PATCH] fix meta_calls with modules inside comma git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@753 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 4 +++- C/exec.c | 5 +++-- pl/init.yap | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 1ac585655..45f20dce8 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -11770,12 +11770,15 @@ Yap_absmi(int inp) execute_comma_nvar: if (IsAtomTerm(d1)) { E_YREG[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByAtom(AtomOfTerm(d1),mod)); + E_YREG[-EnvSizeInCells-3] = MkIntTerm(mod); } else if (IsApplTerm(d1)) { Functor f = FunctorOfTerm(d1); if (IsExtensionFunctor(f)) { goto execute_metacall; } else { + if (f == FunctorModule) goto execute_metacall; E_YREG[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByFunc(f,mod)); + E_YREG[-EnvSizeInCells-3] = MkIntTerm(mod); } } else { goto execute_metacall; @@ -11787,7 +11790,6 @@ Yap_absmi(int inp) E_YREG[E_DEPTH] = DEPTH; #endif /* DEPTH_LIMIT */ E_YREG[-EnvSizeInCells-1] = d1; - E_YREG[-EnvSizeInCells-3] = MkIntTerm(mod); ENV = E_YREG; E_YREG -= EnvSizeInCells+3; PREG = COMMA_CODE; diff --git a/C/exec.c b/C/exec.c index ecd35defb..9f21ab793 100644 --- a/C/exec.c +++ b/C/exec.c @@ -248,17 +248,18 @@ do_execute(Term t, SMALLUNSGN mod) } } else if (f == FunctorComma) { Term d1 = ArgOfTerm(2,t); - YENV = ASP; if (IsVarTerm(d1)) { return CallMetaCall(mod); } if (IsAtomTerm(d1)) { + YENV = ASP; YENV[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByAtom(AtomOfTerm(d1),mod)); } else if (IsApplTerm(d1)) { Functor f = FunctorOfTerm(d1); - if (IsExtensionFunctor(f)) { + if (IsExtensionFunctor(f) || f == FunctorModule) { return CallMetaCall(mod); } else { + YENV = ASP; YENV[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByFunc(f,mod)); } } else { diff --git a/pl/init.yap b/pl/init.yap index fc141a7c4..37df55db8 100644 --- a/pl/init.yap +++ b/pl/init.yap @@ -34,6 +34,7 @@ false :- fail. \+(G) :- '$meta_call'(\+(G),prolog). not(G) :- '$meta_call'(not(G),prolog). + :- '$set_value'('$doindex',true). :- ['errors.yap',