fix current_modules/1 and 2 to return all predefined modules.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@594 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
8ba604d9b3
commit
89565bf45a
22
C/modules.c
22
C/modules.c
@ -113,6 +113,26 @@ p_module_number(void)
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static Int
|
||||
cont_current_module(void)
|
||||
{
|
||||
Int mod = IntOfTerm(EXTRA_CBACK_ARG(1,1));
|
||||
Term t = ModuleName[mod];
|
||||
|
||||
if (mod == NoOfModules) {
|
||||
cut_fail();
|
||||
}
|
||||
EXTRA_CBACK_ARG(1,1) = MkIntTerm(mod+1);
|
||||
return(unify(ARG1,t));
|
||||
}
|
||||
|
||||
static Int
|
||||
init_current_module(void)
|
||||
{ /* current_module(?ModuleName) */
|
||||
EXTRA_CBACK_ARG(1,1) = MkIntTerm(0);
|
||||
return (cont_current_module());
|
||||
}
|
||||
|
||||
void
|
||||
InitModules(void)
|
||||
{
|
||||
@ -126,4 +146,6 @@ InitModules(void)
|
||||
InitCPred("$current_module", 1, p_current_module1, SafePredFlag|SyncPredFlag);
|
||||
InitCPred("$change_module", 1, p_change_module, SafePredFlag|SyncPredFlag);
|
||||
InitCPred("$module_number", 2, p_module_number, SafePredFlag);
|
||||
InitCPredBack("$all_current_modules", 1, 1, init_current_module, cont_current_module,
|
||||
SafePredFlag|SyncPredFlag);
|
||||
}
|
||||
|
@ -510,11 +510,12 @@ module(N) :-
|
||||
'$not_in_vars'(_,[]).
|
||||
'$not_in_vars'(V,[X|L]) :- X\==V, '$not_in_vars'(V,L).
|
||||
|
||||
current_module(Mod) :-
|
||||
'$recorded'('$module','$module'(Mod),_).
|
||||
current_module(Mod) :-
|
||||
'$all_current_modules'(Mod).
|
||||
|
||||
current_module(Mod,TFN) :-
|
||||
'$recorded'('$module','$module'(TFN,Mod,_Publics),_).
|
||||
'$all_current_modules'(Mod),
|
||||
( '$recorded'('$module','$module'(TFN,Mod,_Publics),_) -> true ; TFN = user ).
|
||||
|
||||
source_module(Mod) :-
|
||||
'$current_module'(Mod).
|
||||
|
Reference in New Issue
Block a user