make sure we can consult from external code directly.

This commit is contained in:
Vítor Santos Costa 2012-02-27 16:37:31 +00:00
parent e38c850361
commit ddcf1f003b

View File

@ -229,8 +229,7 @@ use_module(M,F,Is) :-
'$csult'([F|L], M) :- '$consult'(F, M), '$csult'(L, M).
'$do_lf'(ContextModule, Stream, InfLevel, _, Imports, SkipUnixComments, CompMode, Reconsult, UseModule) :-
nb_getval('$if_level',OldIncludeLevel),
nb_setval('$if_level',0),
'$reset_if'(OldIfLevel),
( nb_getval('$system_mode', OldMode) -> true ; OldMode = off),
( OldMode == off -> '$enter_system_mode' ; true ),
'$record_loaded'(Stream, ContextModule, Reconsult),
@ -285,7 +284,7 @@ use_module(M,F,Is) :-
% surely, we were in run mode or we would not have included the file!
nb_setval('$if_skip_mode',run),
% back to include mode!
nb_setval('$if_level',OldIncludeLevel),
nb_setval('$if_level',OldIfLevel),
'$bind_module'(Mod, UseModule),
'$import_to_current_module'(File, ContextModule, Imports),
( LC == 0 -> prompt(_,' |: ') ; true),
@ -293,6 +292,12 @@ use_module(M,F,Is) :-
'$exec_initialisation_goals',
!.
'$reset_if'(OldIfLevel) :-
catch(nb_getval('$if_level',OldIncludeLevel),_,fail), !,
nb_setval('$if_level',0).
'$reset_if'(0) :-
nb_setval('$if_level',0).
'$bind_module'(_, load_files).
'$bind_module'(Mod, use_module(Mod)).