keep on simplifying modules

This commit is contained in:
Vítor Santos Costa 2016-03-05 12:36:54 +00:00
parent 2fe198f68a
commit fdcc75d4ae
4 changed files with 21 additions and 8 deletions

View File

@ -1461,7 +1461,7 @@ bootstrap(F) :-
!,
'$yap_strip_module'(M1:MH,M,H),
( M == M1 -> B = B0 ; B = M1:B0),
error:is_callable(M:H,P).
is_callable(M:H,P).
'$check_head_and_body'(MH, M, H, true, P) :-
'$yap_strip_module'(MH,M,H),

View File

@ -1418,8 +1418,8 @@ initialization(_G,_OPT) :-
stop_low_level_trace.
'$initialization'(G,OPT) :-
error:must_be_of_type(callable, G, initialization(G,OPT)),
error:must_be_of_type(oneof([after_load, now, restore]),
must_be_of_type(callable, G, initialization(G,OPT)),
must_be_of_type(oneof([after_load, now, restore]),
OPT, initialization(G,OPT)),
(
OPT == now

View File

@ -42,12 +42,16 @@ to other modules; they can, however, be accessed by prefixing the module
name with the `:/2` operator.
**/
'$module_dec'(system(N, Ss), Ps) :- !,
new_system_module(N),
'$mk_system_predicates'( Ss , N ),
'$module_dec'(N, Ps).
'$module_dec'(system(N), Ps) :- !,
new_system_module(N),
recordz('$system_initialization', prolog:'$mk_system_predicates'( Ps , N ), _),
'$current_module'(_,N).
% '$mk_system_predicates'( Ps , N ),
'$module_dec'(N, Ps).
'$module_dec'(N, Ps) :-
source_location(F,_Line),
source_location(F,_Line),
'$nb_getval'( '$user_source_file', F0 , fail),
'$add_module_on_file'(N, F, F0, Ps),
'$current_module'(_,N).
@ -55,7 +59,7 @@ name with the `:/2` operator.
'$mk_system_predicates'( Ps, N ) :-
lists:member(Name/A , Ps),
functor(P,Name,A),
'$mk_system_predicate'(P, N),
'$new_system_predicate'(P, prolog),
fail.
'$mk_system_predicates'( _Ps, _N ).

View File

@ -20,11 +20,20 @@
% This protects all code from further changes
% and also makes it impossible from some predicates to be seen
'$protect' :-
'$current_predicate'(Name,M,P,_),
'$current_predicate'(Name,prolog,P,_),
M \= user,
functor(P,Name,Arity),
'$new_system_predicate'(Name,Arity,M),
sub_atom(Name,0,1,_, '$'),
functor(P,Name,Arity),
'$hide_predicate'(P,M),
fail.
'$protect' :-
'$system_module'(M),
'$current_predicate'(Name,M,P,_),
M \= user,
functor(P,Name,Arity),
'$new_system_predicate'(Name,Arity,M),
fail.
'$protect' :-
current_atom(Name),