root/tags/lgt2311/configs/eclipseiso.config

Revision 3986, 12.7 KB (checked in by pmoura, 13 months ago)

Updated the release number to 2.31.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Open source object-oriented logic programming language
4%  Release 2.31.1
5%
6%  configuration file for ECLiPSe 5.10#26 and later versions
7%
8%  last updated: October 24, 2007
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- pragma(system).
14:- pragma(nodebug).
15
16
17
18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19%
20%  ISO Prolog Standard predicates that we must define because they are
21%  not built-in
22%
23%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
24%  we must define; there must be at least one clause for this predicate
25%  whose call should fail if we don't define any ISO predicates
26%
27%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28
29
30% '$lgt_iso_predicate'(?callable).
31
32'$lgt_iso_predicate'(_) :-
33    fail.
34
35
36:- use_module(library(iso)).
37:- import abolish/1 from iso.
38
39
40
41%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42%
43%  predicate properties
44%
45%  this predicate must return at least static, dynamic, and built_in
46%  properties for an existing predicate
47%
48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49
50
51% '$lgt_predicate_property'(+callable, ?predicate_property)
52
53'$lgt_predicate_property'(Predicate, built_in) :-
54    functor(Predicate, Functor, Arity),
55    current_built_in(Functor/Arity).
56
57'$lgt_predicate_property'(Predicate, dynamic) :-
58    functor(Predicate, Functor, Arity),
59    current_predicate(Functor/Arity),
60    is_dynamic(Functor/Arity).
61
62'$lgt_predicate_property'(Predicate, static) :-
63    functor(Predicate, Functor, Arity),
64    current_built_in(Functor/Arity).
65
66'$lgt_predicate_property'(Predicate, static) :-
67    functor(Predicate, Functor, Arity),
68    current_predicate(Functor/Arity),
69    \+ is_dynamic(Functor/Arity).
70
71
72
73%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74%
75%  meta-predicates
76%
77%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78
79
80% call_cleanup(+callable, +callble)
81
82call_cleanup(_, _) :-
83    throw(not_supported(call_cleanup/2)).
84
85
86% forall(+callable, +callble) -- built-in
87
88forall(Generate, Test) :-
89    \+ (call(Generate), \+ call(Test)).
90
91
92% retractall(+callable)
93
94retractall(Head) :-
95    retract_all(Head).
96
97
98% call_with_args/2-9
99%
100% use these definitions only if your compiler does
101% not provide call_with_args/2-9 as built-in predicates
102
103call_with_args(F, A) :-
104    Call =.. [F, A],
105    call(Call).
106
107call_with_args(F, A1, A2) :-
108    Call =.. [F, A1, A2],
109    call(Call).
110
111call_with_args(F, A1, A2, A3) :-
112    Call =.. [F, A1, A2, A3],
113    call(Call).
114
115call_with_args(F, A1, A2, A3, A4) :-
116    Call =.. [F, A1, A2, A3, A4],
117    call(Call).
118
119call_with_args(F, A1, A2, A3, A4, A5) :-
120    Call =.. [F, A1, A2, A3, A4, A5],
121    call(Call).
122
123call_with_args(F, A1, A2, A3, A4, A5, A6) :-
124    Call =.. [F, A1, A2, A3, A4, A5, A6],
125    call(Call).
126
127call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
128    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
129    call(Call).
130
131call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
132    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
133    call(Call).
134
135
136
137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138%
139%  Prolog built-in meta-predicates
140%
141%  (excluding ISO Prolog Standard meta-predicates)
142%
143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144
145
146% '$lgt_pl_meta_predicate'(?callable).
147
148'$lgt_pl_meta_predicate'(block(::, *, ::)).
149'$lgt_pl_meta_predicate'(call_priority(::, *)).
150'$lgt_pl_meta_predicate'(coverof(*, ::, *)).
151'$lgt_pl_meta_predicate'(do(*, ::)).
152'$lgt_pl_meta_predicate'(event_create(::, *, *)).
153'$lgt_pl_meta_predicate'(make_suspension(::, *, *)).
154'$lgt_pl_meta_predicate'(mutex(*, ::)).
155'$lgt_pl_meta_predicate'(suspend(::, *, *)).
156'$lgt_pl_meta_predicate'(suspend(::, *, *, *)).
157
158
159
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161%
162%  file extension predicates
163%
164%  these extensions are used by Logtalk load/compile predicates
165%
166%  you may want to change the extension for Prolog files to match
167%  the one expected by your Prolog compiler
168%
169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170
171
172% '$lgt_file_extension'(?atom, ?atom)
173
174'$lgt_file_extension'(logtalk, '.lgt').
175'$lgt_file_extension'(prolog, '.pl').
176'$lgt_file_extension'(xml, '.xml').
177
178
179
180%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
181%
182%  default flag values
183%
184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185
186
187% '$lgt_default_flag'(?atom, ?atom)
188%
189% default values for all flags
190
191'$lgt_default_flag'(xmldocs, on).
192'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
193'$lgt_default_flag'(xmlspec, dtd).
194'$lgt_default_flag'(xmlsref, local).
195
196'$lgt_default_flag'(unknown, warning).
197'$lgt_default_flag'(misspelt, warning).
198'$lgt_default_flag'(singletons, warning).
199'$lgt_default_flag'(lgtredef, warning).
200'$lgt_default_flag'(plredef, silent).
201'$lgt_default_flag'(portability, silent).
202
203'$lgt_default_flag'(report, on).
204
205'$lgt_default_flag'(smart_compilation, off).
206'$lgt_default_flag'(reload, always).
207
208'$lgt_default_flag'(startup_message, flags(verbose)).
209
210'$lgt_default_flag'(underscore_variables, dont_care).
211
212'$lgt_default_flag'(code_prefix, '').
213
214'$lgt_default_flag'(debug, off).
215'$lgt_default_flag'(break_predicate, true).
216
217'$lgt_default_flag'(events, off).
218
219'$lgt_default_flag'(altdirs, off).
220'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
221'$lgt_default_flag'(xmldir, 'xml_docs/').
222
223'$lgt_default_flag'(encoding_directive, unsupported).
224'$lgt_default_flag'(threads, unsupported).
225
226'$lgt_default_flag'(context_switching_calls, allow).
227
228
229
230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231%
232%  list predicates
233%
234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235
236
237'$lgt_append'([], List, List).
238'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
239    '$lgt_append'(Tail, List, Tail2).
240
241
242'$lgt_member'(Head, [Head| _]).
243'$lgt_member'(Head, [_| Tail]) :-
244    '$lgt_member'(Head, Tail).
245
246
247'$lgt_member_var'(V, [H| _]) :-
248    V == H.
249'$lgt_member_var'(V, [_| T]) :-
250    '$lgt_member_var'(V, T).
251
252
253'$lgt_is_list'([]) :-
254    !.
255'$lgt_is_list'([_| Tail]) :-
256    '$lgt_is_list'(Tail).
257
258
259'$lgt_is_proper_list'(List) :-
260    List == [], !.
261'$lgt_is_proper_list'([_| Tail]) :-
262    nonvar(Tail),
263    '$lgt_is_proper_list'(Tail).
264
265
266
267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268%
269%  file predicates
270%
271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272
273
274% '$lgt_file_exists'(+atom)
275%
276% checks if a directory exists
277
278'$lgt_file_exists'(File) :-
279    exists(File).
280
281
282% '$lgt_directory_exists'(+atom)
283%
284% checks if a directory exists
285
286'$lgt_directory_exists'(Directory) :-
287    atom_string(Directory, DirectoryString),
288    canonical_path_name(DirectoryString, Path),
289    exists(Path).
290
291
292% '$lgt_current_directory'(-atom)
293%
294% gets current working directory
295
296'$lgt_current_directory'(Directory) :-
297    getcwd(Directory).
298
299
300% '$lgt_change_directory'(+atom)
301%
302% changes current working directory
303
304'$lgt_change_directory'(Directory) :-
305    cd(Directory).
306
307
308% '$lgt_make_directory'(+atom)
309%
310% makes a new directory; succeeds if the directory already exists
311
312'$lgt_make_directory'(Directory) :-
313    (   exists(Directory) ->
314        true
315    ;   mkdir(Directory)
316    ).
317
318
319% '$lgt_load_prolog_code'(+atom, +atom)
320%
321% compile and load a Prolog file
322
323'$lgt_load_prolog_code'(File, _) :-
324    get_flag(debug_compile, Current),
325    set_flag(debug_compile, off),
326    compile(File),
327    set_flag(debug_compile, Current).
328
329
330% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
331%
332% compare file modification times
333
334'$lgt_compare_file_mtimes'(Result, File1, File2) :-
335    get_file_info(File1, mtime, Time1),
336    get_file_info(File2, mtime, Time2),
337    compare(Result, Time1, Time2).
338
339
340
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342%
343%  sorting predicates
344%
345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346
347
348% '$lgt_keysort'(+list, -list)
349
350'$lgt_keysort'(List, Sorted) :-
351    keysort(List, Sorted).
352
353
354% '$lgt_sort'(+list, -list)
355
356'$lgt_sort'(List, Sorted) :-
357    sort(List, Sorted).
358
359
360
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%
363%  time and date predicates
364%
365%  if your Prolog compiler does not provide access to the operating system
366%  time and date just write dummy definitions
367%
368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369
370
371:- use_module(library(calendar)).
372
373
374% '$lgt_current_date'(?Year, ?Month, ?Day)
375
376'$lgt_current_date'(Year, Month, Day) :-
377    mjd_now(MJD),
378    mjd_to_date(MJD, Day/Month/Year).
379
380
381% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
382
383'$lgt_current_time'(Hours, Mins, Secs) :-
384    mjd_now(MJD),
385    mjd_to_time(MJD, Hours:Mins:Secs).
386
387
388
389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390%
391%  timing predicate
392%
393%  if your Prolog compiler does not provide access to a timing predicate
394%  just write dummy definition
395%
396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397
398
399% '$lgt_cpu_time'(-Seconds)
400
401'$lgt_cpu_time'(Seconds) :-
402    cputime(Seconds).
403
404
405
406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407%
408%  comparison predicate
409%
410%  the usual compare/3 definition
411%
412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413
414
415% compare(?atom, @term, @term) -- built-in
416
417
418
419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
420%
421%  callable predicate
422%
423%  the usual callable/1 definition
424%
425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426
427
428% callable(@term)
429
430callable(Term) :-
431    nonvar(Term),
432    functor(Term, Functor, _),
433    atom(Functor).
434
435
436
437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
438%
439%  read character predicate
440%
441%  read a single character echoing it and writing a newline after
442%
443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444
445
446'$lgt_read_single_char'(Char) :-
447    flush(user), tyi(Code), put(Code), nl, char_code(Char, Code).
448
449
450
451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452%
453%  pretty print a term by naming its free variables
454%  (avoid instantiating variables in term by using double negation if necessary)
455%
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457
458
459'$lgt_pretty_print_vars'(Stream, Term) :-
460    write_term(Stream, Term, [numbervars(true)]).
461
462
463'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
464    write_term(Stream, Term, [numbervars(true), quoted(true)]).
465
466
467
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470%  getting stream current line number
471%  (needed for improved compiler error messages)
472%
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474
475
476% '$lgt_stream_current_line_number'(@stream, -integer)
477
478'$lgt_stream_current_line_number'(Stream, Line) :-
479    get_stream_info(Stream, line, Last),
480    Line is Last + 1.
481
482
483
484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
485%
486%  handling of Prolog-proprietary directives on Logtalk source files
487%
488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489
490
491% '$lgt_ignore_pl_directive'(@callable)
492
493'$lgt_ignore_pl_directive'(mode(_)).
494
495
496% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
497
498'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
499    fail.
500
501
502% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
503
504'$lgt_rewrite_and_recompile_pl_directive'(local(Functor/Arity), private(Functor/Arity)).
505
506'$lgt_rewrite_and_recompile_pl_directive'(lib(Library), use_module(library(Library), Exports)) :-
507    '$lgt_eclipse_list_of_exports'(library(Library), Exports).
508
509'$lgt_rewrite_and_recompile_pl_directive'(use_module(Library), use_module(Library, Exports)) :-
510        '$lgt_eclipse_list_of_exports'(Library, Exports).
511
512
513'$lgt_eclipse_list_of_exports'(Library, Exports) :-
514    (   atom(Library) ->
515        Module = Library
516    ;   Library =..[_, Module]
517    ),
518    current_module(Module),
519    get_module_info(Module, interface, Interface),
520    '$lgt_eclipse_filter_exports'(Interface, Exports).
521
522
523'$lgt_eclipse_filter_exports'([], []).
524
525'$lgt_eclipse_filter_exports'([export(Predicate)| Interface], [Predicate| Exports]) :-
526    '$lgt_eclipse_filter_exports'(Interface, Exports).
527
528
529
530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531%
532%  Shortcut to the Logtalk built-in predicate logtalk_load/1
533%
534%  defined in the config files in order to be able to comment it out in case
535%  of conflict with some Prolog native feature; it implies conformance with
536%  the ISO Prolog standard regarding the definition of the {}/1 syntax
537%
538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539
540{File, Files} :-
541    !,
542    logtalk_load(File),
543    {Files}.
544{File} :-
545    logtalk_load(File).
546
547
548
549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
550%
551%  end!
552%
553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.