diff --git a/C/cdmgr.c b/C/cdmgr.c index 7a175fdd7..8e50c251a 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -2908,36 +2908,8 @@ static Int p_clean_up_dead_clauses(USES_REGS1) { void Yap_HidePred(PredEntry *pe) { Prop p0 = AbsPredProp(pe); - if (pe->ArityOfPE == 0) { - Atom a = (Atom)pe->FunctorOfPred; - p0 = RepAtom(a)->PropsOfAE; - if (p0 == AbsPredProp(pe)) { - RepAtom(a)->PropsOfAE = pe->NextOfPE; - } else { - while (p0->NextOfPE != AbsPredProp(pe)) - p0 = p0->NextOfPE; - if (p0 == NIL) - return; - p0->NextOfPE = pe->NextOfPE; - } - } else { - Functor funt = pe->FunctorOfPred; - - p0 = funt->PropsOfFE; - if (p0 == AbsPredProp(pe)) { - funt->PropsOfFE = pe->NextOfPE; - } else { - while (p0->NextOfPE != AbsPredProp(pe)) - p0 = p0->NextOfPE; - if (p0 == NIL) - return; - p0->NextOfPE = pe->NextOfPE; - } - } - pe->NextOfPE = HIDDEN_PREDICATES; - HIDDEN_PREDICATES = AbsPredProp(pe); - pe->PredFlags |= HiddenPredFlag; + pe->PredFlags |= (HiddenPredFlag | NoSpyPredFlag | NoTracePredFlag); } static Int /* $system_predicate(P) */ @@ -3022,7 +2994,7 @@ restart_system_pred: return false; if (EndOfPAEntr(pe)) return false; - pe->PredFlags |= (HiddenPredFlag / NoSpyPredFlag | NoTracePredFlag); + pe->PredFlags |= (HiddenPredFlag | NoSpyPredFlag | NoTracePredFlag); return true; } diff --git a/C/dbase.c b/C/dbase.c index e7cc30b9e..32d35a09f 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -1876,6 +1876,7 @@ static LogUpdClause *new_lu_db_entry(Term t, PredEntry *pe) { cl->ClTimeStart = 0L; } cl->ClTimeEnd = TIMESTAMP_EOT; + #if MULTIPLE_STACKS // INIT_LOCK(cl->ClLock); INIT_CLREF_COUNT(cl); @@ -2709,6 +2710,8 @@ static PredEntry *new_lu_entry(Term t) { } pe->ArityOfPE = 3; pe->OpcodeOfPred = Yap_opcode(_op_fail); + if (CurrentModule == PROLOG_MODULE) + pe->PredFlags |= StandardPredFlag; pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = FAILCODE; return pe; } @@ -5107,7 +5110,7 @@ static Int p_dequeue(USES_REGS1) { QueueEntry *cur_instance; Term Father = Deref(ARG1); Int rc; - + if (IsVarTerm(Father)) { Yap_Error(INSTANTIATION_ERROR, Father, "dequeue"); return FALSE; diff --git a/C/stdpreds.c b/C/stdpreds.c index 3d383ff68..841dbe14f 100755 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -878,13 +878,20 @@ static Int } static bool valid_prop(Prop p, Term task) { - if (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE) + if ((RepPredProp(p)->PredFlags & HiddenPredFlag) || + (RepPredProp(p)->OpcodeOfPred == UNDEF_OPCODE) ){ return false; - if ((RepPredProp(p)->PredFlags & (HiddenPredFlag | StandardPredFlag))) { - return (task == SYSTEM_MODULE || task == TermTrue || IsVarTerm(task)); - } else { - return (task == USER_MODULE || task == TermTrue || IsVarTerm(task)); } + if(task == TermSystem || task == TermProlog) { + return RepPredProp(p)->PredFlags & StandardPredFlag; + } + if(task == TermUser) { + return !(RepPredProp(p)->PredFlags & StandardPredFlag); + } + if (IsVarTerm(task)) { + return true; + } + return false; } static PropEntry *followLinkedListOfProps(PropEntry *p, Term task) { diff --git a/pl/absf.yap b/pl/absf.yap index aa12815ce..5dc87d98a 100755 --- a/pl/absf.yap +++ b/pl/absf.yap @@ -13,7 +13,15 @@ %% @{ -/** @defgroup absolute_file_name File Name Resolution +:- system_module( absf, [absolute_file_name/2, + absolute_file_name/3, + add_to_path/1, + add_to_path/2, + path/1, + remove_from_path/1], ['$full_filename'/3, + '$system_library_directories'/2]). + +/** @defgroup absf File Name Resolution @ingroup builtins @@ -24,14 +32,6 @@ variables and registry information to search for files. **/ -:- system_module( absolute_file_name, [absolute_file_name/2, - absolute_file_name/3, - add_to_path/1, - add_to_path/2, - path/1, - remove_from_path/1], ['$full_filename'/3, - '$system_library_directories'/2]). - :- use_system_module( '$_boot', ['$system_catch'/4]). :- use_system_module( '$_errors', ['$do_error'/2]). diff --git a/pl/protect.yap b/pl/protect.yap index 5b890cb65..cdba357d5 100755 --- a/pl/protect.yap +++ b/pl/protect.yap @@ -20,14 +20,11 @@ xc/************************************************************************* % This protects all code from further changes % and also makes it impossible from some predicates to be seen '$protect' :- - current_atom(Name), - '$current_predicate'(Name,M,P,_), + '$current_predicate'(Name,M,P,_),riteln(P), M \= user, functor(P,Name,Arity), '$new_system_predicate'(Name,Arity,M), sub_atom(Name,0,1,_, '$'), - \+ '$visible'(Name), - hide_predicate(M:P), fail. '$protect' :- current_atom(Name), @@ -44,15 +41,15 @@ xc/************************************************************************* '$visible'('$dbref'). /* not stream position */ '$visible'('$stream'). /* not $STREAM */ '$visible'('$stream_position'). /* not stream position */ -'$visible'('$hacks'). -'$visible'('$source_location'). -'$visible'('$messages'). -'$visible'('$push_input_context'). -'$visible'('$pop_input_context'). -'$visible'('$set_source_module'). -'$visible'('$declare_module'). -'$visible'('$store_clause'). -'$visible'('$skip_list'). +'$visible'('$hacks'). +'$visible'('$source_location'). +'$visible'('$messages'). +'$visible'('$push_input_context'). +'$visible'('$pop_input_context'). +'$visible'('$set_source_module'). +'$visible'('$declare_module'). +'$visible'('$store_clause'). +'$visible'('$skip_list'). '$visible'('$win_insert_menu_item'). '$visible'('$set_predicate_attribute'). '$visible'('$parse_quasi_quotations'). @@ -60,4 +57,3 @@ xc/************************************************************************* '$visible'('$qq_open'). '$visible'('$live'). '$visible'('$init_prolog'). -