fixes to modules.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@988 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-02-13 23:53:20 +00:00
parent 97c809d955
commit 8e18b8cdf7
3 changed files with 10 additions and 7 deletions

View File

@ -2870,7 +2870,7 @@ Yap_InitComma(void)
code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3); code_p->u.sla.s = emit_count(-Signed(RealEnvSize) - sizeof(CELL) * 3);
code_p->u.sla.sla_u.p = code_p->u.sla.sla_u.p =
code_p->u.sla.p0 = code_p->u.sla.p0 =
RepPredProp(PredPropByFunc(FunctorComma,2)); RepPredProp(PredPropByFunc(FunctorComma,0));
code_p->u.sla.bmap = NULL; code_p->u.sla.bmap = NULL;
GONEXT(sla); GONEXT(sla);
if (PRED_GOAL_EXPANSION_ON) { if (PRED_GOAL_EXPANSION_ON) {

View File

@ -713,6 +713,7 @@ InitCodes(void)
Functor Functor
FunctorThrow; FunctorThrow;
heap_regs->term_prolog = MkAtomTerm(Yap_LookupAtom("prolog"));
heap_regs->user_module = MkAtomTerm(Yap_LookupAtom("user")); heap_regs->user_module = MkAtomTerm(Yap_LookupAtom("user"));
heap_regs->idb_module = MkAtomTerm(Yap_LookupAtom("idb")); heap_regs->idb_module = MkAtomTerm(Yap_LookupAtom("idb"));
heap_regs->attributes_module = MkAtomTerm(Yap_LookupAtom("attributes")); heap_regs->attributes_module = MkAtomTerm(Yap_LookupAtom("attributes"));
@ -991,7 +992,6 @@ InitCodes(void)
#ifdef EUROTRA #ifdef EUROTRA
heap_regs->term_dollar_u = MkAtomTerm(Yap_FullLookupAtom("$u")); heap_regs->term_dollar_u = MkAtomTerm(Yap_FullLookupAtom("$u"));
#endif #endif
heap_regs->term_prolog = MkAtomTerm(Yap_LookupAtom("prolog"));
heap_regs->term_refound_var = MkAtomTerm(Yap_FullLookupAtom("$I_FOUND_THE_VARIABLE_AGAIN")); heap_regs->term_refound_var = MkAtomTerm(Yap_FullLookupAtom("$I_FOUND_THE_VARIABLE_AGAIN"));
heap_regs->dyn_array_list = NULL; heap_regs->dyn_array_list = NULL;
heap_regs->n_of_file_aliases = 0; heap_regs->n_of_file_aliases = 0;

View File

@ -51,6 +51,9 @@ LookupModule(Term a)
{ {
unsigned int i; unsigned int i;
/* prolog module */
if (a == 0)
return 0;
for (i = 0; i < NoOfModules; ++i) { for (i = 0; i < NoOfModules; ++i) {
if (ModuleName[i] == a) { if (ModuleName[i] == a) {
return i; return i;
@ -121,13 +124,13 @@ p_change_module(void)
static Int static Int
cont_current_module(void) cont_current_module(void)
{ {
Int mod = IntOfTerm(EXTRA_CBACK_ARG(1,1)); Int imod = IntOfTerm(EXTRA_CBACK_ARG(1,1));
Term t = ModuleName[mod]; Term t = ModuleName[imod];
if (mod == NoOfModules) { if (imod == NoOfModules) {
cut_fail(); cut_fail();
} }
EXTRA_CBACK_ARG(1,1) = MkIntTerm(mod+1); EXTRA_CBACK_ARG(1,1) = MkIntTerm(imod+1);
return(Yap_unify(ARG1,t)); return(Yap_unify(ARG1,t));
} }
@ -152,7 +155,7 @@ Yap_InitModulesC(void)
void void
Yap_InitModules(void) Yap_InitModules(void)
{ {
ModuleName[0] = ModuleName[PROLOG_MODULE] =
TermProlog; TermProlog;
ModuleName[1] = ModuleName[1] =
USER_MODULE; USER_MODULE;