ensure order

This commit is contained in:
Vitor Santos Costa 2015-01-16 20:04:12 -08:00
parent 408333f0d4
commit 242844d12f
1 changed files with 12 additions and 17 deletions

View File

@ -19,28 +19,23 @@
% This protects all code from further changes % This protects all code from further changes
% and also makes it impossible from some predicates to be seen % and also makes it impossible from some predicates to be seen
'$protect' :-
fail,
'$system_mod'( M ),
'$current_predicate'(_A, M, T0, Flags),
NFlags is Flags \/ 0x00004000,
'$flags'(M:T0, Flags, NFlags),
fail.
'$protect' :- '$protect' :-
current_atom(Name), current_atom(Name),
atom_codes(Name,[0'$|_]), sub_atom(Name,0,1,_,'$'),
% '$hide_predicates'(Name), '$hide'(Name),
'$hide'(Name). '$current_predicate'(Name, Mod, P, _Flags0),
'$hide_predicate'(P,Mod),
fail.
'$protect' :- '$protect' :-
'$hide_predicates'(bootstrap), '$hide'(bootstrap),
'$hide'(bootstrap). '$hide_predicate'(bootstrap),
fail.
'$protect'. '$protect'.
'$hide_predicates'(Name) :- '$notrace_predicate'(Mod:P, Flags0) :-
'$current_predicate'(Name, Mod, P, _), Flags is Flags0 \/ 0x400000000,
'$hide_predicate'(P,Mod), '$flags'(P, Mod, Flags0, Flags ).
fail.
'$hide_predicates'(_).
% hide all atoms who start by '$' % hide all atoms who start by '$'
'$hide'('$VAR') :- !, fail. /* not $VAR */ '$hide'('$VAR') :- !, fail. /* not $VAR */