current_predicate
This commit is contained in:
parent
bdb2f0562a
commit
1a23e47316
32
C/cdmgr.c
32
C/cdmgr.c
@ -2908,36 +2908,8 @@ static Int p_clean_up_dead_clauses(USES_REGS1) {
|
|||||||
|
|
||||||
void Yap_HidePred(PredEntry *pe) {
|
void Yap_HidePred(PredEntry *pe) {
|
||||||
Prop p0 = AbsPredProp(pe);
|
Prop p0 = AbsPredProp(pe);
|
||||||
if (pe->ArityOfPE == 0) {
|
|
||||||
Atom a = (Atom)pe->FunctorOfPred;
|
|
||||||
|
|
||||||
p0 = RepAtom(a)->PropsOfAE;
|
pe->PredFlags |= (HiddenPredFlag | NoSpyPredFlag | NoTracePredFlag);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int /* $system_predicate(P) */
|
static Int /* $system_predicate(P) */
|
||||||
@ -3022,7 +2994,7 @@ restart_system_pred:
|
|||||||
return false;
|
return false;
|
||||||
if (EndOfPAEntr(pe))
|
if (EndOfPAEntr(pe))
|
||||||
return false;
|
return false;
|
||||||
pe->PredFlags |= (HiddenPredFlag / NoSpyPredFlag | NoTracePredFlag);
|
pe->PredFlags |= (HiddenPredFlag | NoSpyPredFlag | NoTracePredFlag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1876,6 +1876,7 @@ static LogUpdClause *new_lu_db_entry(Term t, PredEntry *pe) {
|
|||||||
cl->ClTimeStart = 0L;
|
cl->ClTimeStart = 0L;
|
||||||
}
|
}
|
||||||
cl->ClTimeEnd = TIMESTAMP_EOT;
|
cl->ClTimeEnd = TIMESTAMP_EOT;
|
||||||
|
|
||||||
#if MULTIPLE_STACKS
|
#if MULTIPLE_STACKS
|
||||||
// INIT_LOCK(cl->ClLock);
|
// INIT_LOCK(cl->ClLock);
|
||||||
INIT_CLREF_COUNT(cl);
|
INIT_CLREF_COUNT(cl);
|
||||||
@ -2709,6 +2710,8 @@ static PredEntry *new_lu_entry(Term t) {
|
|||||||
}
|
}
|
||||||
pe->ArityOfPE = 3;
|
pe->ArityOfPE = 3;
|
||||||
pe->OpcodeOfPred = Yap_opcode(_op_fail);
|
pe->OpcodeOfPred = Yap_opcode(_op_fail);
|
||||||
|
if (CurrentModule == PROLOG_MODULE)
|
||||||
|
pe->PredFlags |= StandardPredFlag;
|
||||||
pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = FAILCODE;
|
pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = FAILCODE;
|
||||||
return pe;
|
return pe;
|
||||||
}
|
}
|
||||||
|
17
C/stdpreds.c
17
C/stdpreds.c
@ -878,13 +878,20 @@ static Int
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool valid_prop(Prop p, Term task) {
|
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;
|
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) {
|
static PropEntry *followLinkedListOfProps(PropEntry *p, Term task) {
|
||||||
|
18
pl/absf.yap
18
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
|
@ingroup builtins
|
||||||
|
|
||||||
@ -24,14 +32,6 @@
|
|||||||
variables and registry information to search for files.
|
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( '$_boot', ['$system_catch'/4]).
|
||||||
|
|
||||||
:- use_system_module( '$_errors', ['$do_error'/2]).
|
:- use_system_module( '$_errors', ['$do_error'/2]).
|
||||||
|
@ -20,14 +20,11 @@ xc/*************************************************************************
|
|||||||
% 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' :-
|
'$protect' :-
|
||||||
current_atom(Name),
|
'$current_predicate'(Name,M,P,_),riteln(P),
|
||||||
'$current_predicate'(Name,M,P,_),
|
|
||||||
M \= user,
|
M \= user,
|
||||||
functor(P,Name,Arity),
|
functor(P,Name,Arity),
|
||||||
'$new_system_predicate'(Name,Arity,M),
|
'$new_system_predicate'(Name,Arity,M),
|
||||||
sub_atom(Name,0,1,_, '$'),
|
sub_atom(Name,0,1,_, '$'),
|
||||||
\+ '$visible'(Name),
|
|
||||||
hide_predicate(M:P),
|
|
||||||
fail.
|
fail.
|
||||||
'$protect' :-
|
'$protect' :-
|
||||||
current_atom(Name),
|
current_atom(Name),
|
||||||
@ -60,4 +57,3 @@ xc/*************************************************************************
|
|||||||
'$visible'('$qq_open').
|
'$visible'('$qq_open').
|
||||||
'$visible'('$live').
|
'$visible'('$live').
|
||||||
'$visible'('$init_prolog').
|
'$visible'('$init_prolog').
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user