/* PROTECT : Setting the flags for the system predicates

                                                Lawrence
                                                Updated: 16 January 82
*/


$mem(X,[X|_]).
$mem(X,[_|Rest]) :- $mem(X,Rest).


                        % Cut must be transparent due to the way it's currently
                        %  implemented (this fixes bug that prevented tracing
                        %  past cuts).
                        % Note that transparent also seem to imply untracable,
                        %  which means you don't see cuts at all.

  :- $sysflgs(!,64).


                        % This list are all transparent and untracable.

  :-(( $mem(X,[ call(_),(A,B),(A;B),$call(_) ]),
       $sysflgs(X,96), fail  ;  true )).


                        % ALL predicates whose names start with a dollar sign
                        %  are made untracable.

  :-(( current_atom(A), name(A,[36|_]), $current_functor(A,Arity,256,0),
       functor(Pred,A,Arity), $flags(Pred,Flags,Flags\/32), fail  ;  true )).


                        % The following predicates are better off invisible so
                        %  they are made untracable as well.

  :-(( $mem(X,[
          write(_), writeq(_), nl, get0(_), get(_), skip(_), put(_), tab(_),
          display(_), ttynl(_), ttytab(_)
         ]),
             $sysflgs(X,32), fail  ;  true )).


                        % And now - ALL current predicates are turned into
                        %  system predicates (which cannot be redefined, seen
                        %  by listing etc).

  :-(( current_atom(A), $current_functor(A,Arity,256,0),
       functor(Pred,A,Arity), $flags(Pred,Flags,Flags\/128), fail  ;  true )).

