Changeset 4271 for trunk/compiler/logtalk.pl
- Timestamp:
- 05/23/08 15:12:42 (6 months ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4270 r4271 41 41 42 42 43 % category predicate directcall operator43 % imported/inherited predicate call operator 44 44 45 45 :- op(600, fy, :). … … 65 65 66 66 :- dynamic('$lgt_current_protocol_'/3). % '$lgt_current_protocol_'(Ptc, Prefix, Type) 67 :- dynamic('$lgt_current_category_'/ 4). % '$lgt_current_category_'(Ctg, Prefix, Type, Synchronized)67 :- dynamic('$lgt_current_category_'/5). % '$lgt_current_category_'(Ctg, Prefix, Def, Type, Synchronized) 68 68 :- dynamic('$lgt_current_object_'/8). % '$lgt_current_object_'(Obj, Prefix, Dcl, Def, Super, Type, Synchronized, Threaded) 69 69 … … 314 314 ; '$lgt_extends_protocol_'(_, CtgOrPtc, _), \+ '$lgt_current_protocol_'(CtgOrPtc, _, _) -> 315 315 throw(error(existence_error(protocol, CtgOrPtc), _, _)) 316 ; '$lgt_imports_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _ ) ->316 ; '$lgt_imports_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _) -> 317 317 throw(error(existence_error(category, CtgOrPtc), _, _)) 318 ; '$lgt_extends_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _ ) ->318 ; '$lgt_extends_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _) -> 319 319 throw(error(existence_error(category, CtgOrPtc), _, _)) 320 320 ). … … 408 408 409 409 current_category(Ctg) :- 410 '$lgt_current_category_'(Ctg, _, _, _ ).410 '$lgt_current_category_'(Ctg, _, _, _, _). 411 411 412 412 … … 452 452 453 453 category_property(Ctg, Prop) :- % static/dynamic property 454 '$lgt_current_category_'(Ctg, _, Prop, _).454 '$lgt_current_category_'(Ctg, _, _, Prop, _). 455 455 456 456 category_property(Ctg, synchronized) :- 457 '$lgt_current_category_'(Ctg, _, _, yes).457 '$lgt_current_category_'(Ctg, _, _, _, yes). 458 458 459 459 … … 491 491 492 492 create_object(Obj, Rels, Dirs, Clauses) :- 493 '$lgt_current_category_'(Obj, _, _, _ ),493 '$lgt_current_category_'(Obj, _, _, _, _), 494 494 throw(error(permission_error(modify, category, Obj), create_object(Obj, Rels, Dirs, Clauses))). 495 495 … … 537 537 538 538 create_category(Ctg, Rels, Dirs, Clauses) :- 539 '$lgt_current_category_'(Ctg, _, _, _ ),539 '$lgt_current_category_'(Ctg, _, _, _, _), 540 540 throw(error(permission_error(modify, category, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). 541 541 … … 594 594 595 595 create_protocol(Ptc, Rels, Dirs) :- 596 '$lgt_current_category_'(Ptc, _, _, _ ),596 '$lgt_current_category_'(Ptc, _, _, _, _), 597 597 throw(error(permission_error(modify, category, Ptc), create_protocol(Ptc, Rels, Dirs))). 598 598 … … 670 670 671 671 abolish_category(Ctg) :- 672 ( '$lgt_current_category_'(Ctg, Prefix, Type, _) ->672 ( '$lgt_current_category_'(Ctg, Prefix, _, Type, _) -> 673 673 ( Type == (dynamic) -> 674 674 call_with_args(Prefix, Dcl, Def, Rnm), … … 679 679 abolish(Rnm/3), 680 680 abolish(Prefix/3), 681 retractall('$lgt_current_category_'(Ctg, _, _, _ )),681 retractall('$lgt_current_category_'(Ctg, _, _, _, _)), 682 682 retractall('$lgt_extends_category_'(Ctg, _, _)), 683 683 retractall('$lgt_implements_protocol_'(Ctg, _, _)), … … 1963 1963 '$lgt_alias_pred'(Ctg1, _, Alias, Pred, _) :- 1964 1964 '$lgt_extends_category_'(Ctg1, Ctg2, _), 1965 '$lgt_current_category_'(Ctg2, Prefix, _, _ ),1965 '$lgt_current_category_'(Ctg2, Prefix, _, _, _), 1966 1966 '$lgt_alias_pred'(Ctg2, Prefix, Alias, Pred, _). 1967 1967 1968 1968 '$lgt_alias_pred'(Obj, _, Alias, Pred, _) :- 1969 1969 '$lgt_imports_category_'(Obj, Ctg, _), 1970 '$lgt_current_category_'(Ctg, Prefix, _, _ ),1970 '$lgt_current_category_'(Ctg, Prefix, _, _, _), 1971 1971 '$lgt_alias_pred'(Ctg, Prefix, Alias, Pred, _). 1972 1972 … … 3154 3154 3155 3155 3156 % '$lgt_call_pred_from_this'(+atom, +object_identifier, +atom, +atom, +callable, +object_identifier, +object_identifier, +object_identifier) 3157 % '$lgt_call_pred_from_this'(+atom, +category_identifier, +atom, +atom, +callable, +object_identifier, +object_identifier, +object_identifier) 3158 % 3159 % calls a predicate from "this", without using the message sending mechanism 3160 % prevent loops by ensuring that we look for an inherited or imported definition 3161 3162 '$lgt_call_pred_from_this'(object, Obj, Dcl, Def, Pred, Sender, This, Self) :- 3156 % '$lgt_call_ctg_pred'(+atom, +callable, +object_identifier, +object_identifier, +object_identifier) 3157 % 3158 % calls a category predicate directly, without using the message sending mechanism 3159 3160 '$lgt_call_ctg_pred'(Dcl, Pred, Sender, This, Self) :- 3163 3161 ( call_with_args(Dcl, Pred, _, _, _, _, _, _, _) -> 3164 ( call_with_args(Def, Pred, Sender, This, Self, Call, Ctn), Obj \= Ctn -> 3165 call(Call) 3166 ) 3167 ; throw(error(existence_error(predicate_declaration, Pred), ':'(Pred), This)) 3168 ). 3169 3170 '$lgt_call_pred_from_this'(category, Ctg, Dcl, Def, Pred, Sender, This, Self) :- 3171 ( call_with_args(Dcl, Pred, _, _, _, _, _, _) -> 3172 ( call_with_args(Def, Pred, Sender, This, Self, Call, Ctn), Ctg \= Ctn -> 3162 ( '$lgt_imports_category_'(This, Ctg, _), 3163 '$lgt_current_category_'(Ctg, _, Def, _, _), 3164 call_with_args(Def, Pred, Sender, This, Self, Call, _) -> 3173 3165 call(Call) 3174 3166 ) … … 3331 3323 3332 3324 '$lgt_hidden_functor'(Functor) :- 3333 '$lgt_current_category_'(_, Prefix, _, _ ),3325 '$lgt_current_category_'(_, Prefix, _, _, _), 3334 3326 atom_concat(Prefix, _, Functor), 3335 3327 !. … … 4073 4065 4074 4066 '$lgt_redefined_entity'(Entity, category) :- 4075 '$lgt_current_category_'(Entity, _, _, _ ).4067 '$lgt_current_category_'(Entity, _, _, _, _). 4076 4068 4077 4069 … … 4929 4921 !. 4930 4922 4931 '$lgt_pp_rclause'('$lgt_current_category_'(Ctg, Prefix, Mode, Synchronized)) :-4932 '$lgt_pp_category_'(Ctg, Prefix, _, _, _, Mode),4923 '$lgt_pp_rclause'('$lgt_current_category_'(Ctg, Prefix, Def, Mode, Synchronized)) :- 4924 '$lgt_pp_category_'(Ctg, Prefix, _, Def, _, Mode), 4933 4925 ( '$lgt_pp_synchronized_' -> 4934 4926 Synchronized = yes … … 6933 6925 '$lgt_tr_body'(':'(Pred), _, _, _) :- 6934 6926 \+ '$lgt_pp_imported_category_'(_, _, _, _, _), 6935 \+ '$lgt_pp_extended_category_'(_, _, _, _, _),6936 \+ '$lgt_pp_extended_object_'(_, _, _, _, _, _, _, _, _, _),6937 \+ '$lgt_pp_instantiated_class_'(_, _, _, _, _, _, _, _, _, _),6938 \+ '$lgt_pp_specialized_class_'(_, _, _, _, _, _, _, _, _, _),6939 6927 throw(existence_error(procedure, Pred)). 6940 6928 6941 6929 '$lgt_tr_body'(':'(Alias), TPred, '$lgt_dbg_goal'(':'(Alias), TPred, DbgCtx), Ctx) :- 6942 '$lgt_pp_object_'(Obj, _, Dcl, Def, _, IDcl, IDef, _, _, _, _),6943 !,6944 6930 '$lgt_ctx_ctx'(Ctx, _, Sender, This, Self, _, _, _), 6945 6931 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), … … 6952 6938 true 6953 6939 ; Pred = Alias, 6940 '$lgt_pp_object_'(_, _, Dcl, _, _, IDcl, _, _, _, _, _), 6954 6941 ( ('$lgt_pp_instantiated_class_'(_, _, _, _, _, _, _, _, _, _); '$lgt_pp_specialized_class_'(_, _, _, _, _, _, _, _, _, _)) -> 6955 TPred = '$lgt_call_ pred_from_this'(object, Obj, IDcl, IDef, Pred, Sender, This, Self)6956 ; TPred = '$lgt_call_ pred_from_this'(object, Obj, Dcl, Def, Pred, Sender, This, Self)6942 TPred = '$lgt_call_ctg_pred'(IDcl, Pred, Sender, This, Self) 6943 ; TPred = '$lgt_call_ctg_pred'(Dcl, Pred, Sender, This, Self) 6957 6944 ) 6958 ).6959 6960 '$lgt_tr_body'(':'(Alias), TPred, '$lgt_dbg_goal'(':'(Alias), TPred, DbgCtx), Ctx) :-6961 '$lgt_pp_category_'(Ctg, _, Dcl, Def, _, _),6962 '$lgt_ctx_ctx'(Ctx, _, Sender, This, Self, _, _, _),6963 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx),6964 ( '$lgt_pp_extended_category_'(Ctg2, _, _, _, _),6965 ( '$lgt_pp_alias_'(Ctg2, Pred, Alias) ->6966 true6967 ; Pred = Alias6968 ),6969 '$lgt_ctg_static_binding_cache'(Ctg2, Pred, Sender, This, Self, TPred) ->6970 true6971 ; Pred = Alias,6972 TPred = '$lgt_call_pred_from_this'(category, Ctg, Dcl, Def, Pred, Sender, This, Self)6973 6945 ). 6974 6946 … … 8801 8773 '$lgt_unknown_category'(Ctg) :- 8802 8774 '$lgt_pp_referenced_category_'(Ctg), 8803 \+ '$lgt_current_category_'(Ctg, _, _, _ ),% not a currently loaded category8775 \+ '$lgt_current_category_'(Ctg, _, _, _, _), % not a currently loaded category 8804 8776 \+ '$lgt_pp_category_'(Ctg, _, _, _, _, _), % not the category being compiled (self references) 8805 8777 \+ '$lgt_pp_entity_init_'(category, Ctg, _). % not a category defined in the source file being compiled … … 10631 10603 retractall('$lgt_current_object_'(Entity, _, _, _, _, _, _, _)), 10632 10604 retractall('$lgt_current_protocol_'(Entity, _, _)), 10633 retractall('$lgt_current_category_'(Entity, _, _, _ )),10605 retractall('$lgt_current_category_'(Entity, _, _, _, _)), 10634 10606 retractall('$lgt_implements_protocol_'(Entity, _, _)), 10635 10607 retractall('$lgt_imports_category_'(Entity, _, _)), … … 10698 10670 '$lgt_construct_category_functors'(Ctg, Prefix, Dcl, Def, Rnm) :- 10699 10671 ( '$lgt_built_in_category'(Ctg) -> 10700 '$lgt_current_category_'(Ctg, Prefix, _, _ ),10672 '$lgt_current_category_'(Ctg, Prefix, _, _, _), 10701 10673 Call =.. [Prefix, Dcl, Def, Rnm], 10702 10674 once(Call) … … 10747 10719 ( '$lgt_current_object_'(Entity, Prefix, _, _, _, _, _, _), 10748 10720 Type = object 10749 ; '$lgt_current_category_'(Entity, Prefix, _, _ ),10721 ; '$lgt_current_category_'(Entity, Prefix, _, _, _), 10750 10722 Type = category 10751 10723 ), … … 13358 13330 true 13359 13331 ; '$lgt_static_binding_entity_'(Ctg), 13360 '$lgt_current_category_'(Ctg, Prefix, _, _ ),13332 '$lgt_current_category_'(Ctg, Prefix, _, _, _), 13361 13333 Clause =.. [Prefix, Dcl, Def, _], 13362 13334 call(Clause),
