add attvar/1 to system.

sort before printing attributed variables to get rid of duplicates.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1132 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-09-10 20:18:01 +00:00
parent c042f13930
commit 27a98ecdde
6 changed files with 28 additions and 14 deletions

View File

@ -149,6 +149,8 @@ WakeAttVar(CELL* pt1, CELL reg2)
CELL *bind_ptr;
if (IsVarTerm(reg2)) {
if (pt1 == VarOfTerm(reg2))
return;
if (IsAttachedTerm(reg2)) {
attvar_record *susp2 = (attvar_record *)VarOfTerm(reg2);
@ -711,7 +713,7 @@ void Yap_InitAttVarPreds(void)
#endif /* COROUTINING */
Yap_InitCPred("all_attvars", 1, p_all_attvars, SafePredFlag);
CurrentModule = OldCurrentModule;
Yap_InitCPred("$is_att_variable", 1, p_is_attvar, SafePredFlag|TestPredFlag);
Yap_InitCPred("attvar", 1, p_is_attvar, SafePredFlag|TestPredFlag);
Yap_InitCPred("$att_bound", 1, p_attvar_bound, SafePredFlag|TestPredFlag);
}

View File

@ -2799,10 +2799,11 @@ syntax_error (TokEntry * tokptr)
Term ts[2];
if (H > ASP-1024) {
H = Hi;
tf[3] = TermNil;
err = 0;
end = 0;
/* for some reason moving this earlier confuses gcc on solaris */
H = Hi;
break;
}
if (tokptr == Yap_toktide) {
@ -2813,8 +2814,9 @@ syntax_error (TokEntry * tokptr)
switch (tokptr->Tok) {
case Name_tok:
{
Term t0 = MkAtomTerm((Atom)info);
ts[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("atom"),1),1,&t0);
Term t0[1];
t0[0] = MkAtomTerm((Atom)info);
ts[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("atom"),1),1,t0);
}
break;
case Number_tok:

View File

@ -120,8 +120,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* extern int gc_calls; */
vsc_count++;
if (vsc_count < 464900)
return;
#ifdef COMMENTED
// if (vsc_count == 218280)
// vsc_xstop = 1;

View File

@ -9017,7 +9017,6 @@ these builtins are rewritten by the system into internal builtins, and
that the rewriting process @emph{depends} on the module on which the
builtins have been invoked.
@table @code
@item @var{Module}:get_atts(@var{-Var},@var{?ListOfAttributes})
@findex get_atts/2
@syindex get_atts/2
@ -9080,8 +9079,16 @@ unification will fail.
Notice that the @t{verify_attributes/3} may be called even if @var{Var}
has no attributes in module @t{Module}. In this case the routine should
simply succeed with @var{Goals} unified with the empty list.
@table @code
@item attvar(@var{-Var})
@findex attvar/1
@snindex attvar/1
@cnindex attvar/1
Succeed if @var{Var} is an attributed variable.
@end table
@node Displaying Attributes, Projecting Attributes,Attributed Unification, Attributed Variables
@section Displaying Attributes

View File

@ -214,7 +214,7 @@ dif(_, _).
%
% We still have some more conditions: continue the analysis.
%
'$redo_freeze'(Done, V, '$when'(C, G, Done)) :- !,
'$redo_freeze'(Done, _, '$when'(C, G, Done)) :- !,
'$when'(C, G, Done).
%
@ -503,13 +503,13 @@ frozen(V, LG) :-
'$simplify_list_of_frozen_goals'(Gs,NGs).
'$find_att_vars'([], []).
'$find_att_vars'([V|LGs], [V|AttVars]) :- '$is_att_variable'(V), !,
'$find_att_vars'([V|LGs], [V|AttVars]) :- attvar(V), !,
'$find_att_vars'(LGs, AttVars).
'$find_att_vars'([_|LGs], AttVars) :-
'$find_att_vars'(LGs, AttVars).
'$purge_done_goals'([], []).
'$purge_done_goals'([V|G0], GF) :- '$is_att_variable'(V), !,
'$purge_done_goals'([V|G0], GF) :- attvar(V), !,
'$purge_done_goals'(G0, GF).
'$purge_done_goals'(['$redo_dif'(Done, _ , _)|G0], GF) :- nonvar(Done), !,
'$purge_done_goals'(G0, GF).
@ -523,14 +523,14 @@ frozen(V, LG) :-
'$purge_done_goals'(G0, GF).
'$convert_frozen_goal'(V, _, _, V, _) :- '$is_att_variable'(V), !.
'$convert_frozen_goal'(V, _, _, V, _) :- attvar(V), !.
'$convert_frozen_goal'('$redo_dif'(Done, X, Y), LV, Done, [X,Y|LV], dif(X,Y)).
'$convert_frozen_goal'('$redo_freeze'(Done, FV, G), LV, Done, [FV|LV], G).
'$convert_frozen_goal'('$redo_eq'(Done, X, Y, G), LV, Done, [X,Y|LV], G).
'$convert_frozen_goal'('$redo_ground'(Done, V, G), LV, Done, [V|LV], G).
'$fetch_same_done_goals'([], _, [], []).
'$fetch_same_done_goals'([V|G0], Done, NL, GF) :- '$is_att_variable'(V), !,
'$fetch_same_done_goals'([V|G0], Done, NL, GF) :- attvar(V), !,
'$fetch_same_done_goals'(G0, Done, NL, GF).
'$fetch_same_done_goals'(['$redo_dif'(Done, X , Y)|G0], D0, [X,Y|LV], GF) :-
Done == D0, !,
@ -573,7 +573,7 @@ call_residue(Goal,Residue) :-
'$purge_and_set_done_goals'([], L, L).
'$purge_and_set_done_goals'([AttV|G0], [_-GS|GF], Atts) :-
'$is_att_variable'(AttV), !,
attvar(AttV), !,
attributes:convert_att_var(AttV, GS),
'$purge_and_set_done_goals'(G0, GF, Atts).
'$purge_and_set_done_goals'(['$redo_dif'(Done, X , Y)|G0], [LVars-dif(X,Y)|GF], Atts) :-
@ -632,7 +632,7 @@ call_residue(Goal,Residue) :-
'$undefined'(convert_att_var(Vs,LIV),attributes), !.
'$convert_att_vars'(Vs0, LIV, LGs) :-
'$sort'(Vs0, Vs),
'$do_convert_att_vars'(Vs0, LIV, LGs).
'$do_convert_att_vars'(Vs, LIV, LGs).
'$do_convert_att_vars'([], _, []).
'$do_convert_att_vars'([V|LAV], LIV, NGs) :-

View File

@ -55,6 +55,11 @@ numbervars(Term, M, N) :-
'$numbermarked_vars'(L, M, N).
'$numbermarked_vars'([], M, M).
/*
'$numbermarked_vars'([V|L], M, N) :-
attvar(V), !,
'$numbermarked_vars'(L, M, N).
*/
'$numbermarked_vars'(['$VAR'(M)|L], M, N) :-
M1 is M+1,
'$numbermarked_vars'(L, M1, N).