Changeset 4521 for trunk/compiler
- Timestamp:
- 10/19/08 20:18:33 (3 months ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4518 r4521 41 41 % bitwise left-shift operator (used for unit test context-switching) 42 42 43 :- op(400, yfx, <<). 43 :- op(400, yfx, <<). % some Prolog compilers don't declare this operator 44 44 45 45 … … 1545 1545 '$lgt_set_compiler_flags'(Flags), 1546 1546 '$lgt_compile_files'(Files), 1547 '$lgt_clear_compiler_flags', 1547 1548 '$lgt_report_warning_numbers'(logtalk_compile(Files, Flags))), 1548 1549 Error, 1549 ('$lgt_reset_warnings_counter', 1550 ('$lgt_clear_compiler_flags', 1551 '$lgt_reset_warnings_counter', 1550 1552 throw(error(Error, logtalk_compile(Files, Flags))))). 1551 1553 … … 1751 1753 1752 1754 '$lgt_set_compiler_flags'(Flags) :- 1753 retractall('$lgt_pp_compiler_flag_'(_, _)), % retract old flag values1754 retractall('$lgt_pp_hook_term_expansion_'(_, _)), % and any old term and1755 retractall('$lgt_pp_hook_goal_expansion_'(_, _)), % goal expansion hooks1756 1755 '$lgt_assert_compiler_flags'(Flags), 1757 1756 ( '$lgt_pp_compiler_flag_'(debug, on) -> % debug flag on requires the … … 1783 1782 1784 1783 1784 % '$lgt_clear_compiler_flags'(@list) 1785 % 1786 % clears the compiler flag options 1787 1788 '$lgt_clear_compiler_flags' :- 1789 retractall('$lgt_pp_compiler_flag_'(_, _)), % retract flag values 1790 retractall('$lgt_pp_hook_term_expansion_'(_, _)), % and any term and 1791 retractall('$lgt_pp_hook_goal_expansion_'(_, _)). % goal expansion hooks 1792 1793 1794 1785 1795 % logtalk_load(@source_file_name) 1786 1796 % logtalk_load(@source_file_name_list) … … 1810 1820 '$lgt_set_compiler_flags'(Flags), 1811 1821 '$lgt_load_files'(Files), 1822 '$lgt_clear_compiler_flags', 1812 1823 '$lgt_report_warning_numbers'(logtalk_load(Files, Flags))), 1813 1824 Error, 1814 ('$lgt_reset_warnings_counter', 1825 ('$lgt_clear_compiler_flags', 1826 '$lgt_reset_warnings_counter', 1815 1827 throw(error(Error, logtalk_load(Files, Flags))))). 1816 1828 … … 4743 4755 write(': '). 4744 4756 4745 'lgt_report_singletons_term'(Term) :- 4757 'lgt_report_singletons_term'(Term) :- % facts 4746 4758 functor(Term, Functor, Arity), 4747 4759 write('in clause for predicate '), … … 5214 5226 throw(error(instantiantion_error, directive(Dir))). 5215 5227 5216 '$lgt_tr_directive'(Dir, _, _, _) :- % closing entity directive occurs before the opening5217 \+ '$lgt_pp_entity'(_, _, _, _, _), % entity directive; the opening directive is probably5218 functor(Dir, Functor, Arity), % missing or misspelt5228 '$lgt_tr_directive'(Dir, _, _, _) :- % closing entity directive occurs before the opening 5229 \+ '$lgt_pp_entity'(_, _, _, _, _), % entity directive; the opening directive is probably 5230 functor(Dir, Functor, Arity), % missing or misspelt 5219 5231 '$lgt_lgt_closing_directive'(Functor, Arity), 5220 5232 throw(error(unmatched_directive, directive(Dir))). 5221 5233 5222 '$lgt_tr_directive'(Dir, _, _, _) :-5223 \+ '$lgt_pp_entity'(_, _, _, _, _), % directive occurs before opening entity directive5234 '$lgt_tr_directive'(Dir, Line, Input, Output) :- 5235 \+ '$lgt_pp_entity'(_, _, _, _, _), % directive occurs before opening entity directive 5224 5236 functor(Dir, Functor, Arity), 5225 5237 \+ '$lgt_lgt_opening_directive'(Functor, Arity), 5226 5238 !, 5227 '$lgt_tr_file_directive'(Dir ).% translate it as a source file-level directive5228 5229 '$lgt_tr_directive'(Dir, Line, Input, Output) :- % entity closing directive5239 '$lgt_tr_file_directive'(Dir, Line, Input, Output). % translate it as a source file-level directive 5240 5241 '$lgt_tr_directive'(Dir, Line, Input, Output) :- % entity closing directive 5230 5242 functor(Dir, Functor, Arity), 5231 5243 '$lgt_lgt_closing_directive'(Functor, Arity), … … 5240 5252 !. 5241 5253 5242 '$lgt_tr_directive'(Dir, Line, Input, Output) :- % entity opening directive or entity directive5254 '$lgt_tr_directive'(Dir, Line, Input, Output) :- % entity opening directive or entity directive 5243 5255 functor(Dir, Functor, Arity), 5244 5256 '$lgt_lgt_directive'(Functor, Arity), … … 5287 5299 5288 5300 5289 % '$lgt_tr_file_directive'(@nonvar )5301 % '$lgt_tr_file_directive'(@nonvar, +integer, @stream, @stream) 5290 5302 % 5291 5303 % translates file-level directives, i.e. directives that are not encapsulated in a Logtalk entity 5292 5304 % error-checking is delegated in most cases to the back-end Prolog compiler 5293 5305 5294 '$lgt_tr_file_directive'(encoding(_) ) :- % the encoding/1 directive is already processed5306 '$lgt_tr_file_directive'(encoding(_), _, _, _) :- % the encoding/1 directive is already processed 5295 5307 !. 5296 5308 5297 '$lgt_tr_file_directive'(ensure_loaded(File) ) :-5309 '$lgt_tr_file_directive'(ensure_loaded(File), _, _, _) :- 5298 5310 !, 5299 ensure_loaded(File), % assume that ensure_loaded/1 is also a built-in predicate5311 ensure_loaded(File), % assume that ensure_loaded/1 is also a built-in predicate 5300 5312 assertz('$lgt_pp_directive_'(ensure_loaded(File))). 5301 5313 5302 '$lgt_tr_file_directive'(initialization(Goal) ) :-5314 '$lgt_tr_file_directive'(initialization(Goal), _, _, _) :- 5303 5315 !, 5304 5316 ( callable(Goal) -> … … 5307 5319 ). 5308 5320 5309 '$lgt_tr_file_directive'(op(Pr, Spec, Ops) ) :- % op/3 directives must be used during entity compilation5310 !, 5311 op(Pr, Spec, Ops), 5321 '$lgt_tr_file_directive'(op(Pr, Spec, Ops), _, _, _) :- 5322 !, 5323 op(Pr, Spec, Ops), % op/3 directives must be used during entity compilation 5312 5324 assertz('$lgt_pp_directive_'(op(Pr, Spec, Ops))), 5313 5325 ( atom(Ops) -> … … 5317 5329 ). 5318 5330 5319 '$lgt_tr_file_directive'(set_prolog_flag(Flag, Value) ) :-5331 '$lgt_tr_file_directive'(set_prolog_flag(Flag, Value), _, _, _) :- 5320 5332 !, 5321 5333 set_prolog_flag(Flag, Value), 5322 5334 assertz('$lgt_pp_directive_'(set_prolog_flag(Flag, Value))). 5323 5335 5324 '$lgt_tr_file_directive'(Dir ) :-5325 assertz('$lgt_pp_directive_'(Dir)). % directive will be copied to the generated Prolog file5336 '$lgt_tr_file_directive'(Dir, _, _, _) :- 5337 assertz('$lgt_pp_directive_'(Dir)). % directive will be copied to the generated Prolog file 5326 5338 5327 5339 … … 5352 5364 '$lgt_add_entity_file_properties'(start(Line), Obj), 5353 5365 '$lgt_save_file_op_table', 5354 '$lgt_tr_object_id'(Obj, static), % assume static object5366 '$lgt_tr_object_id'(Obj, static), % assume static object 5355 5367 '$lgt_tr_object_relations'(Rels, Obj). 5356 5368 … … 5385 5397 '$lgt_add_entity_file_properties'(start(Line), Ptc), 5386 5398 '$lgt_save_file_op_table', 5387 '$lgt_tr_protocol_id'(Ptc, static), % assume static protocol5399 '$lgt_tr_protocol_id'(Ptc, static), % assume static protocol 5388 5400 '$lgt_tr_protocol_relations'(Rels, Ptc). 5389 5401 … … 5419 5431 '$lgt_add_entity_file_properties'(start(Line), Ctg), 5420 5432 '$lgt_save_file_op_table', 5421 '$lgt_tr_category_id'(Ctg, static), % assume static category5433 '$lgt_tr_category_id'(Ctg, static), % assume static category 5422 5434 '$lgt_tr_category_relations'(Rels, Ctg). 5423 5435 … … 5447 5459 5448 5460 '$lgt_tr_directive'(module, [Module, ExportList], Line, Input, Output) :- 5449 assertz('$lgt_pp_module_'(Module)), % remeber we are compiling a module5461 assertz('$lgt_pp_module_'(Module)), % remeber we are compiling a module 5450 5462 '$lgt_report_compiling_entity'(module, Module), 5451 '$lgt_tr_object_id'(Module, static), % assume static module/object5463 '$lgt_tr_object_id'(Module, static), % assume static module/object 5452 5464 '$lgt_tr_directive'((public), ExportList, Line, Input, Output), % make the export list public predicates 5453 5465 '$lgt_save_file_op_table'.
