Changeset 4599 for trunk/compiler
- Timestamp:
- 11/21/08 12:47:26 (7 weeks ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4598 r4599 255 255 256 256 :- dynamic('$lgt_pp_hook_term_expansion_'/2). % '$lgt_pp_hook_term_expansion_'(Term, Terms) 257 :- dynamic('$lgt_pp_hook_goal_expansion_'/2). % '$lgt_pp_hook_goal_expansion_'( Term, Terms)257 :- dynamic('$lgt_pp_hook_goal_expansion_'/2). % '$lgt_pp_hook_goal_expansion_'(Goal, EGoal) 258 258 259 259 :- dynamic('$lgt_pp_threaded_'/0). % '$lgt_pp_threaded_' … … 1772 1772 ( Obj == user -> % to speed up entity compilation 1773 1773 TermExpansionGoal = term_expansion(Term, Terms), 1774 GoalExpansionGoal = goal_expansion( Term, Terms)1774 GoalExpansionGoal = goal_expansion(Goal, EGoal) 1775 1775 ; '$lgt_tr_msg'(term_expansion(Term, Terms), Obj, TermExpansionGoal, user), 1776 '$lgt_tr_msg'(goal_expansion( Term, Terms), Obj, GoalExpansionGoal, user)1776 '$lgt_tr_msg'(goal_expansion(Goal, EGoal), Obj, GoalExpansionGoal, user) 1777 1777 ), 1778 1778 assertz(('$lgt_pp_hook_term_expansion_'(Term, Terms) :- catch(TermExpansionGoal, _, fail))), 1779 assertz(('$lgt_pp_hook_goal_expansion_'( Term, Terms) :- catch(GoalExpansionGoal, _, fail)))1779 assertz(('$lgt_pp_hook_goal_expansion_'(Goal, EGoal) :- catch(GoalExpansionGoal, _, fail))) 1780 1780 ; true 1781 1781 ). … … 2945 2945 2946 2946 2947 2947 2948 % '$lgt_term_expansion'(+object_identifier, ?term, ?term, +object_identifier, @scope) 2948 2949 % … … 2964 2965 true 2965 2966 ; call_with_args(DDef, term_expansion(Term, Expansion), Obj, Obj, Obj, Call) 2967 ) 2968 ), 2969 !, 2970 once(Call). 2971 2972 2973 2974 % '$lgt_expand_goal'(+object_identifier, ?term, ?term, +object_identifier, @scope) 2975 % 2976 % expand_goal/2 built-in method 2977 2978 '$lgt_expand_goal'(Obj, Goal, Expansion, Sender, Scope) :- 2979 ( var(Goal) -> 2980 Expansion = Goal 2981 ; '$lgt_goal_expansion'(Obj, Goal, Expand, Sender, Scope) -> 2982 Expansion = Expand 2983 ; Expansion = Goal 2984 ). 2985 2986 2987 2988 % '$lgt_goal_expansion'(+object_identifier, ?term, ?term, +object_identifier, @scope) 2989 % 2990 % calls the goal_expansion/2 user-defined predicate 2991 % 2992 % if there is a scope directive, then the call fails if the sender is not within scope; 2993 % when there is no scope directive, then we call any local definition when the sender 2994 % and the target object are the same 2995 2996 '$lgt_goal_expansion'(Obj, Goal, Expansion, Sender, Scope) :- 2997 '$lgt_current_object_'(Obj, _, Dcl, Def, _, _, _, _, DDef, _, _), 2998 ( ( call_with_args(Dcl, goal_expansion(_, _), PScope, _, _, _, _, SCtn, _) -> 2999 ( (\+ \+ PScope = Scope; Sender = SCtn) -> 3000 call_with_args(Def, goal_expansion(Goal, Expansion), Sender, Obj, Obj, Call, _) 3001 ) 3002 ) 3003 ; Obj = Sender, 3004 ( call_with_args(Def, goal_expansion(Goal, Expansion), Obj, Obj, Obj, Call) -> 3005 true 3006 ; call_with_args(DDef, goal_expansion(Goal, Expansion), Obj, Obj, Obj, Call) 2966 3007 ) 2967 3008 ), … … 5278 5319 5279 5320 5280 % '$lgt_tr_term'( +term, +integer, @stream, @stream)5321 % '$lgt_tr_term'(@term, +integer, @stream, @stream) 5281 5322 % 5282 5323 % translates a source file term (clauses, directives, and grammar rules) … … 5295 5336 5296 5337 5297 % '$lgt_tr_expanded_terms'(+list, +integer, @stream, @stream) 5298 % 5299 % translates a list of source file terms 5300 5301 '$lgt_tr_expanded_terms'([], _, _, _). 5338 % '$lgt_tr_expanded_terms'(@term, +integer, @stream, @stream) 5339 % 5340 % translates the expanded terms (which can be a list of terms) 5341 5342 '$lgt_tr_expanded_terms'([], _, _, _) :- 5343 !. 5302 5344 5303 5345 '$lgt_tr_expanded_terms'([Term| Terms], Line, Input, Output) :- 5346 !, 5304 5347 '$lgt_tr_expanded_term'(Term, Line, Input, Output), 5305 5348 '$lgt_tr_expanded_terms'(Terms, Line, Input, Output). 5349 5350 '$lgt_tr_expanded_terms'(Term, Line, Input, Output) :- 5351 !, 5352 '$lgt_tr_expanded_term'(Term, Line, Input, Output). 5306 5353 5307 5354 … … 7655 7702 7656 7703 7657 % DCGpredicates7704 % term and goal expansion predicates 7658 7705 7659 7706 '$lgt_tr_body'(expand_term(Term, Clause), '$lgt_expand_term'(This, Term, Clause, This, p(_)), '$lgt_dbg_goal'(expand_term(Term, Clause), '$lgt_expand_term'(This, Term, Clause, This, p(_)), DbgCtx), Ctx) :- … … 7661 7708 '$lgt_ctx_this'(Ctx, This), 7662 7709 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx). 7710 7711 '$lgt_tr_body'(expand_goal(Goal, EGoal), '$lgt_expand_goal'(This, Goal, EGoal, This, p(_)), '$lgt_dbg_goal'(expand_goal(Goal, EGoal), '$lgt_expand_goal'(This, Goal, EGoal, This, p(_)), DbgCtx), Ctx) :- 7712 !, 7713 '$lgt_ctx_this'(Ctx, This), 7714 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx). 7715 7716 7717 % DCG predicates 7663 7718 7664 7719 '$lgt_tr_body'(phrase(GRBody, Input), '$lgt_phrase'(This, GRBody, Input, This, _), '$lgt_dbg_goal'(phrase(GRBody, Input), '$lgt_phrase'(This, GRBody, Input, This, _), DbgCtx), Ctx) :- … … 8445 8500 8446 8501 8447 % DCGpredicates8502 % term and goal expansion predicates 8448 8503 8449 8504 '$lgt_tr_msg'(expand_term(Term, Clause), Obj, '$lgt_expand_term'(Obj, Term, Clause, This, p(p(p))), This) :- 8450 8505 !. 8506 8507 '$lgt_tr_msg'(expand_goal(Goal, EGoal), Obj, '$lgt_expand_goal'(Obj, Goal, EGoal, This, p(p(p))), This) :- 8508 !. 8509 8510 8511 % DCG predicates 8451 8512 8452 8513 '$lgt_tr_msg'(phrase(GRBody, List), Obj, '$lgt_phrase'(Obj, GRBody, List, This, p(p(p))), This) :- … … 8656 8717 8657 8718 8658 8659 % DCG predicates 8719 % term and goal expansion predicates 8660 8720 8661 8721 '$lgt_tr_self_msg'(expand_term(Term, Clause), '$lgt_expand_term'(Self, Term, Clause, This, p(_)), This, Self) :- 8662 8722 !. 8723 8724 '$lgt_tr_self_msg'(expand_goal(Goal, EGoal), '$lgt_expand_goal'(Self, Goal, EGoal, This, p(_)), This, Self) :- 8725 !. 8726 8727 8728 % DCG predicates 8663 8729 8664 8730 '$lgt_tr_self_msg'(phrase(GRBody, List), '$lgt_phrase'(Self, GRBody, List, This, p(_)), This, Self) :- … … 11557 11623 11558 11624 '$lgt_built_in_method'(expand_term(_, _), p(p(p))). 11625 '$lgt_built_in_method'(expand_goal(_, _), p(p(p))). 11626 11559 11627 '$lgt_built_in_method'(phrase(_, _), p(p(p))). 11560 11628 '$lgt_built_in_method'(phrase(_, _, _), p(p(p))).
