add debugging code to verify when a specific predicate is added.

This commit is contained in:
Vitor Santos Costa 2014-06-17 15:06:23 +01:00
parent e8f2c37000
commit 92f0a91f85
4 changed files with 32 additions and 14 deletions

View File

@ -812,6 +812,10 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
else
p->ModuleOfPred = cur_mod;
//TRUE_FUNC_WRITE_LOCK(fe);
#if DEBUG_NEW_FUNCTOR
if (!strcmp(fe->NameOfFE->StrOfAE, "library_directory"))
jmp_deb(1);
#endif
INIT_LOCK(p->PELock);
p->KindOfPE = PEProp;
p->ArityOfPE = fe->ArityOfFE;

View File

@ -263,6 +263,21 @@ p_strip_module( USES_REGS1 )
Yap_unify(ARG2, tmod);
}
static Int
p_system_module( USES_REGS1 )
{
Term t1 = Deref(ARG1);
if (t1 == PROLOG_MODULE) {
return TRUE;
}
return t1 == TermProlog ||
t1 == IDB_MODULE ||
t1 == IDB_MODULE ||
t1 == ATTRIBUTES_MODULE ||
t1 == SYSTEM_MODULE ||
t1 == GLOBALS_MODULE;
}
static Int
p_context_module( USES_REGS1 )
{
@ -336,6 +351,7 @@ Yap_InitModulesC(void)
Yap_InitCPred("$change_module", 1, p_change_module, SafePredFlag|SyncPredFlag);
Yap_InitCPred("strip_module", 3, p_strip_module, SafePredFlag|SyncPredFlag);
Yap_InitCPred("context_module", 1, p_context_module, 0);
Yap_InitCPred("$system_module", 1, p_system_module, 0);
Yap_InitCPredBack("$all_current_modules", 1, 1, init_current_module, cont_current_module,
SafePredFlag|SyncPredFlag);
}

View File

@ -148,11 +148,11 @@ IDNUM id_table_retrieve(const ID_TABLE *this, TERM term)
IDNUM id_table_register(ID_TABLE *this, TERM term)
{
BPULONG hash;
// BPULONG hash;
IDNUM i;
term = term_pool_register(this->store, term);
hash = (BPULONG)(term);
//hash = (BPULONG)(term);
i = id_table_search(this, term);
if (i == ID_NONE) {

View File

@ -1063,23 +1063,21 @@ module_property(Mod, file(F)) :-
module_property(Mod, exports(Es)) :-
recorded('$module','$module'(_,Mod,Es,_),_).
'$module_class'(system, L) :- '$system_module'(L).
'$module_class'(library, L) :- '$library_module'(L).
'$module_class'(user, L) :- '$user_module'(L).
'$module_class'(temporary, L) :- fail.
'$module_class'(test, L) :- fail.
'$module_class'(development, L) :- fail.
'$system_module'(prolog).
'$system_module'(system).
'$module_class'(Mod, system) :- '$system_module'( Mod ).
'$module_class'(Mod, library) :- '$library_module'( Mod ).
'$module_class'(Mod, user) :- '$user_module'( Mod ).
'$module_class'(_, temporary) :- fail.
'$module_class'(_, test) :- fail.
'$module_class'(_, development) :- fail.
'$library_module'(M1) :-
recorded('$module','$module'(F, M1, _MyExports,_Line),_),
library_directory(D),
user:library_directory(D),
sub_atom(F, 0, _, _, D).
'$user_module'(_).
'$user_module'( Mod ) :-
\+ '$library_module'( Mod),
\+ '$system_module'( Mod).
ls_imports :-
recorded('$import','$import'(M0,M,G0,G,_N,_K),_R),