itry to respect SWI semantics on expand_goal/2.

This commit is contained in:
Vítor Santos Costa 2010-12-13 22:03:54 +00:00
parent eec588f488
commit 666ef1877d
2 changed files with 24 additions and 23 deletions

View File

@ -309,8 +309,6 @@ module(N) :-
expand_goal(G, G) :-
var(G), !.
expand_goal(G, M:NG) :-
'$do_expand'(G, M, NG), !.
expand_goal(M:G, M:NG) :-
'$do_expand'(G, M, NG), !.
expand_goal(G, NG) :-
@ -318,25 +316,8 @@ expand_goal(G, NG) :-
'$do_expand'(G, M, NG), !.
expand_goal(G, G).
'$do_expand'((G1,G2), CurMod, (GI1,GI2)) :- !,
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1;G2), CurMod, (GI1;GI2)) :- !,
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1*->G2), CurMod, (GI1*->GI2)) :- !,
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1|G2), CurMod, (GI1|GI2)) :- !,
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1->G2), CurMod, (GI1->GI2)) :- !,
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'(\+G1, CurMod, \+GI1) :- !,
'$do_expand'(G1, CurMod, GI1).
'$do_expand'(not(G1), CurMod, not(GI1)) :- !,
'$do_expand'(G1, CurMod, GI1).
'$do_expand'(M:G, CurMod, M:GI) :- !,
'$do_expand'(G, M, GI).
'$do_expand'(G, CurMod, GI) :-
(
'$pred_exists'(goal_expansion(G,GI), CurMod),
@ -353,7 +334,26 @@ expand_goal(G, G).
true
;
user:goal_expansion(G, GI)
).
), !.
'$do_expand'((G1,G2), CurMod, (GI1,GI2)) :-
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1;G2), CurMod, (GI1;GI2)) :-
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1*->G2), CurMod, (GI1*->GI2)) :-
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1|G2), CurMod, (GI1|GI2)) :-
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'((G1->G2), CurMod, (GI1->GI2)) :-
'$do_expand'(G1, CurMod, GI1),
'$do_expand'(G2, CurMod, GI2).
'$do_expand'(\+G1, CurMod, \+GI1) :-
'$do_expand'(G1, CurMod, GI1).
'$do_expand'(not(G1), CurMod, not(GI1)) :-
'$do_expand'(G1, CurMod, GI1).
% args are:
% goal to expand

View File

@ -212,7 +212,8 @@ assertz_static(C) :-
'$head_and_body'(C,H,B),
'$assertat_d'(last,H,B,C0,Mod,_).
'$assertz_dynamic'(X,C,C0,Mod) :-
'$head_and_body'(C,H,B), functor(H,N,A),
'$head_and_body'(C,H,B),
functor(H,N,A),
('$check_if_reconsulted'(N,A) ->
true
;