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
% 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' :-
current_atom(Name),
atom_codes(Name,[0'$|_]),
% '$hide_predicates'(Name),
'$hide'(Name).
sub_atom(Name,0,1,_,'$'),
'$hide'(Name),
'$current_predicate'(Name, Mod, P, _Flags0),
'$hide_predicate'(P,Mod),
fail.
'$protect' :-
'$hide_predicates'(bootstrap),
'$hide'(bootstrap).
'$hide'(bootstrap),
'$hide_predicate'(bootstrap),
fail.
'$protect'.
'$hide_predicates'(Name) :-
'$current_predicate'(Name, Mod, P, _),
'$hide_predicate'(P,Mod),
fail.
'$hide_predicates'(_).
'$notrace_predicate'(Mod:P, Flags0) :-
Flags is Flags0 \/ 0x400000000,
'$flags'(P, Mod, Flags0, Flags ).
% hide all atoms who start by '$'
'$hide'('$VAR') :- !, fail. /* not $VAR */