Changeset 4526 for trunk/compiler
- Timestamp:
- 10/21/08 09:08:54 (3 months ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4525 r4526 100 100 :- dynamic('$lgt_extends_protocol_'/3). 101 101 102 :- multifile('$lgt_complemented_object_'/ 4). % '$lgt_complemented_object_'(Obj, Ctg, Dcl, Def)103 :- dynamic('$lgt_complemented_object_'/ 4).102 :- multifile('$lgt_complemented_object_'/5). % '$lgt_complemented_object_'(Obj, Ctg, Dcl, Def, Rnm) 103 :- dynamic('$lgt_complemented_object_'/5). 104 104 105 105 … … 216 216 :- dynamic('$lgt_pp_extended_protocol_'/4). % '$lgt_pp_extended_protocol_'(Ptc, Prefix, Dcl, Scope) 217 217 :- dynamic('$lgt_pp_extended_category_'/5). % '$lgt_pp_extended_category_'(Ctg, Prefix, Dcl, Def, Scope) 218 :- dynamic('$lgt_pp_complemented_object_'/1). % '$lgt_pp_complemented_object_'(Obj) 218 219 219 220 :- dynamic('$lgt_pp_file_init_'/1). % '$lgt_pp_file_init_'(Goal) … … 1078 1079 1079 1080 complements_object(Category, Object) :- 1080 '$lgt_complemented_object_'(Object, Category, _, _ ).1081 '$lgt_complemented_object_'(Object, Category, _, _, _). 1081 1082 1082 1083 … … 2408 2409 % object doesn't supports dynamic declaration of new predicates: 2409 2410 throw(error(permission_error(modify, object_protocol, Pred), Goal, Sender)) 2410 ; '$lgt_assert_ddcl_clause'(DDcl, Pred, DclScope), 2411 ; functor(Pred, Functor, Arity), 2412 functor(DPred, Functor, Arity), 2413 Clause =.. [DDcl, DPred, DclScope], 2414 assertz(Clause), 2411 2415 (Scope, Type, Meta) = (DclScope, (dynamic), no) 2412 2416 ) … … 3327 3331 % lookup predicate declarations in any category that complements the given object 3328 3332 3329 '$lgt_complemented_object'(This, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, Ctn) :- 3330 '$lgt_complemented_object_'(This, _, Dcl, _), 3331 call_with_args(Dcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, Ctn). 3333 '$lgt_complemented_object'(This, ThisDcl, Alias, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn) :- 3334 '$lgt_complemented_object_'(This, _, Dcl, _, Rnm), 3335 ( call_with_args(Dcl, Alias, Scope, Compilation, Meta, NonTerminal, Synchronized, TCtn), 3336 SCtn = This 3337 ; call_with_args(Rnm, This, Pred, Alias), 3338 Pred \= Alias, 3339 call_with_args(ThisDcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn) 3340 ). 3332 3341 3333 3342 … … 3335 3344 % lookup predicate definitions in any category that complements the given object 3336 3345 3337 '$lgt_complemented_object'(Pred, Sender, This, Self, Call, Ctn) :- 3338 '$lgt_complemented_object_'(This, _, _, Def), 3339 call_with_args(Def, Pred, Sender, This, Self, Call, Ctn). 3346 '$lgt_complemented_object'(ThisDef, Alias, Sender, This, Self, Call, Ctn) :- 3347 '$lgt_complemented_object_'(This, _, _, Def, Rnm), 3348 ( call_with_args(Def, Alias, Sender, This, Self, Call, Ctn) 3349 ; call_with_args(Rnm, This, Pred, Alias), 3350 Pred \= Alias, 3351 call_with_args(ThisDef, Pred, Sender, This, Self, Call, Ctn) 3352 ). 3340 3353 3341 3354 … … 4281 4294 retractall('$lgt_extends_object_'(Entity, _, _)), 4282 4295 retractall('$lgt_extends_category_'(Entity, _, _)), 4283 retractall('$lgt_complemented_object_'(_, Entity, _, _ )),4296 retractall('$lgt_complemented_object_'(_, Entity, _, _, _)), 4284 4297 retractall('$lgt_debugging_'(Entity)). 4285 4298 … … 4957 4970 retractall('$lgt_pp_extended_protocol_'(_, _, _, _)), 4958 4971 retractall('$lgt_pp_extended_category_'(_, _, _, _, _)), 4972 retractall('$lgt_pp_complemented_object_'(_)), 4959 4973 retractall('$lgt_pp_uses_'(_)), 4960 4974 retractall('$lgt_pp_uses_'(_, _, _)), … … 5732 5746 ; '$lgt_pp_instantiated_class_'(Entity, _, _, _, _, _, _, _, _, _) 5733 5747 ; '$lgt_pp_specialized_class_'(Entity, _, _, _, _, _, _, _, _, _) 5748 ; '$lgt_pp_complemented_object_'(Entity) 5734 5749 ), 5735 5750 !, … … 9057 9072 9058 9073 '$lgt_tr_complements_category'(Objs, Ctg) :- 9059 '$lgt_pp_category_'(Ctg, _, Dcl, Def, _, _) ->9060 '$lgt_tr_complements_category'(Objs, Ctg, Dcl, Def ).9061 9062 9063 '$lgt_tr_complements_category'([], _, _, _ ).9064 9065 '$lgt_tr_complements_category'([Obj| _], _, _, _ ) :-9074 '$lgt_pp_category_'(Ctg, _, Dcl, Def, Rnm, _) -> 9075 '$lgt_tr_complements_category'(Objs, Ctg, Dcl, Def, Rnm). 9076 9077 9078 '$lgt_tr_complements_category'([], _, _, _, _). 9079 9080 '$lgt_tr_complements_category'([Obj| _], _, _, _, _) :- 9066 9081 var(Obj), 9067 9082 throw(instantiation_error). 9068 9083 9069 '$lgt_tr_complements_category'([Obj| Objs], Ctg, Dcl, Def ) :-9084 '$lgt_tr_complements_category'([Obj| Objs], Ctg, Dcl, Def, Rnm) :- 9070 9085 ( callable(Obj) -> 9071 9086 assertz('$lgt_pp_referenced_object_'(Obj)), 9072 assertz('$lgt_pp_rclause_'('$lgt_complemented_object_'(Obj, Ctg, Dcl, Def))), 9073 '$lgt_tr_complements_category'(Objs, Ctg, Dcl, Def) 9087 assertz('$lgt_pp_complemented_object_'(Obj)), 9088 assertz('$lgt_pp_rclause_'('$lgt_complemented_object_'(Obj, Ctg, Dcl, Def, Rnm))), 9089 '$lgt_tr_complements_category'(Objs, Ctg, Dcl, Def, Rnm) 9074 9090 ; throw(type_error(object_identifier, Obj)) 9075 9091 ). … … 9339 9355 '$lgt_clean_lookup_caches'(Head) 9340 9356 ). 9341 9342 9343 9344 % '$lgt_assert_ddcl_clause'(+atom, +term, +term)9345 %9346 % asserts a dynamic predicate declaration9347 9348 '$lgt_assert_ddcl_clause'(DDcl, Pred, Scope) :-9349 functor(Pred, Functor, Arity),9350 functor(DPred, Functor, Arity),9351 Clause =.. [DDcl, DPred, Scope],9352 assertz(Clause).9353 9357 9354 9358 … … 9860 9864 ( '$lgt_compiler_flag'(complements, on) -> 9861 9865 '$lgt_pp_object_'(Obj, _, ODcl, _, _, _, _, _, _, _, _) -> 9862 Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, Obj,Ctn],9863 Lookup = '$lgt_complemented_object'(Obj, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized,Ctn),9866 Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn], 9867 Lookup = '$lgt_complemented_object'(Obj, ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn), 9864 9868 assertz('$lgt_pp_dcl_'((Head:-Lookup))) 9865 9869 ; true … … 9939 9943 '$lgt_pp_object_'(Obj, _, _, ODef, _, _, _, _, _, _, _) -> 9940 9944 Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], 9941 Lookup = '$lgt_complemented_object'( Pred, Sender, Obj, Self, Call, Ctn),9945 Lookup = '$lgt_complemented_object'(ODef, Pred, Sender, Obj, Self, Call, Ctn), 9942 9946 assertz('$lgt_pp_fdef_'((Head:-Lookup))) 9943 9947 ; true … … 10121 10125 ( '$lgt_compiler_flag'(complements, on) -> 10122 10126 '$lgt_pp_object_'(Obj, _, _, _, _, OIDcl, _, _, _, _, _) -> 10123 Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, Obj,Ctn],10124 Lookup = '$lgt_complemented_object'(Obj, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized,Ctn),10127 Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn], 10128 Lookup = '$lgt_complemented_object'(Obj, OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Synchronized, SCtn, TCtn), 10125 10129 assertz('$lgt_pp_dcl_'((Head:-Lookup))) 10126 10130 ; true … … 10201 10205 '$lgt_pp_object_'(Obj, _, _, ODef, _, _, _, _, _, _, _) -> 10202 10206 Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], 10203 Lookup = '$lgt_complemented_object'( Pred, Sender, Obj, Self, Call, Ctn),10207 Lookup = '$lgt_complemented_object'(ODef, Pred, Sender, Obj, Self, Call, Ctn), 10204 10208 assertz('$lgt_pp_fdef_'((Head:-Lookup))) 10205 10209 ; true … … 10267 10271 '$lgt_pp_object_'(Obj, _, _, _, _, _, OIDef, _, _, _, _) -> 10268 10272 Head =.. [OIDef, Pred, Sender, Obj, Self, Call, Ctn], 10269 Lookup = '$lgt_complemented_object'( Pred, Sender, Obj, Self, Call, Ctn),10273 Lookup = '$lgt_complemented_object'(OIDef, Pred, Sender, Obj, Self, Call, Ctn), 10270 10274 assertz('$lgt_pp_fdef_'((Head:-Lookup))) 10271 10275 ; true … … 10831 10835 '$lgt_write_runtime_clauses'(Stream, '$lgt_extends_object_'/3), 10832 10836 '$lgt_write_runtime_clauses'(Stream, '$lgt_extends_protocol_'/3), 10833 '$lgt_write_runtime_clauses'(Stream, '$lgt_complemented_object_'/ 4),10837 '$lgt_write_runtime_clauses'(Stream, '$lgt_complemented_object_'/5), 10834 10838 '$lgt_write_runtime_clauses'(Stream, '$lgt_debugging_'/1) 10835 10839 ; true
