root/tags/lgt2311/configs/eclipse.config

Revision 3986, 14.5 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:- dynamic(lgt_exception_/1).
31
32
33initialization(Goal) :-
34    call(Goal).
35
36
37% '$lgt_iso_predicate'(?callable).
38
39'$lgt_iso_predicate'(assertz(_)).
40'$lgt_iso_predicate'(atom_codes(_, _)).
41'$lgt_iso_predicate'(atom_concat(_, _, _)).
42'$lgt_iso_predicate'(catch(_, _, _)).
43'$lgt_iso_predicate'(current_input(_)).
44'$lgt_iso_predicate'(current_output(_)).
45'$lgt_iso_predicate'(number_codes(_, _)).
46'$lgt_iso_predicate'(throw(_)).
47'$lgt_iso_predicate'(unify_with_occurs_check(_, _)).
48
49
50assertz(Clause) :-
51    assert(Clause).
52
53
54atom_codes(Atom, List) :-
55    var(Atom),
56    string_list(String, List),
57    atom_string(Atom, String).
58
59atom_codes(Atom, List) :-
60    nonvar(Atom),
61    atom_string(Atom, String),
62    string_list(String, List).
63
64
65atom_concat(Atom1, Atom2, Atom3) :-
66    nonvar(Atom1), nonvar(Atom2),
67    !,
68    concat_atoms(Atom1, Atom2, Atom3).
69
70atom_concat(Atom1, Atom2, Atom3) :-
71    nonvar(Atom3),
72    name(Atom3, Codes3),
73    '$lgt_append'(Codes1, Codes2, Codes3),
74    name(Atom1, Codes1),
75    name(Atom2, Codes2).
76
77
78catch(Goal, Catcher, Recovery) :-
79    block(Goal, Tag, lgt_catch_recovery(Tag, Catcher, Recovery)).
80
81
82lgt_catch_recovery(Tag, Catcher, Recovery) :-
83    (   Tag = lgt_error ->
84        retract(lgt_exception_(Ball)),
85        !,
86        (   Catcher = Ball ->
87            call(Recovery)
88        ;   exit_block(Tag)
89        )
90    ;   exit_block(Tag)
91    ).
92
93
94lgt_uncatched_exception :-
95    (   retract(lgt_exception_(Ball)) ->
96        writeq(Ball), nl
97    ;   write('uncatched exception'), nl
98    ),
99    abort.
100
101
102:- set_error_handler(230, lgt_uncatched_exception/0).
103
104
105current_input(Stream) :-
106    get_stream(input, Stream).
107
108
109current_output(Stream) :-
110    get_stream(output, Stream).
111
112
113number_codes(Number, Codes) :-
114    var(Number),
115    string_list(String, Codes),
116    number_string(Number, String).
117
118number_codes(Number, Codes) :-
119    nonvar(Number),
120    number_string(Number, String),
121    string_list(String, Codes).
122
123
124throw(Ball) :-
125    asserta(lgt_exception_(Ball)),
126    exit_block(lgt_error).
127
128
129:- set_flag(occur_check, on).
130unify_with_occurs_check(X, X).
131:- set_flag(occur_check, off).
132
133
134
135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136%
137%  predicate properties
138%
139%  this predicate must return at least static, dynamic, and built_in
140%  properties for an existing predicate
141%
142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143
144
145% '$lgt_predicate_property'(+callable, ?predicate_property)
146
147'$lgt_predicate_property'(Predicate, built_in) :-
148    functor(Predicate, Functor, Arity),
149    current_built_in(Functor/Arity).
150
151'$lgt_predicate_property'(Predicate, dynamic) :-
152    functor(Predicate, Functor, Arity),
153    current_predicate(Functor/Arity),
154    is_dynamic(Functor/Arity).
155
156'$lgt_predicate_property'(Predicate, static) :-
157    functor(Predicate, Functor, Arity),
158    current_built_in(Functor/Arity).
159
160'$lgt_predicate_property'(Predicate, static) :-
161    functor(Predicate, Functor, Arity),
162    current_predicate(Functor/Arity),
163    \+ is_dynamic(Functor/Arity).
164
165
166
167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168%
169%  meta-predicates
170%
171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172
173
174% call_cleanup(+callable, +callble)
175
176call_cleanup(_, _) :-
177    throw(not_supported(call_cleanup/2)).
178
179
180% forall(+callable, +callble) -- built-in
181
182forall(Generate, Test) :-
183    \+ (call(Generate), \+ call(Test)).
184
185
186% retractall(+callable)
187
188retractall(Head) :-
189    retract_all(Head).
190
191
192% call_with_args/2-9
193%
194% use these definitions only if your compiler does
195% not provide call_with_args/2-9 as built-in predicates
196
197call_with_args(F, A) :-
198    Call =.. [F, A],
199    call(Call).
200
201call_with_args(F, A1, A2) :-
202    Call =.. [F, A1, A2],
203    call(Call).
204
205call_with_args(F, A1, A2, A3) :-
206    Call =.. [F, A1, A2, A3],
207    call(Call).
208
209call_with_args(F, A1, A2, A3, A4) :-
210    Call =.. [F, A1, A2, A3, A4],
211    call(Call).
212
213call_with_args(F, A1, A2, A3, A4, A5) :-
214    Call =.. [F, A1, A2, A3, A4, A5],
215    call(Call).
216
217call_with_args(F, A1, A2, A3, A4, A5, A6) :-
218    Call =.. [F, A1, A2, A3, A4, A5, A6],
219    call(Call).
220
221call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
222    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
223    call(Call).
224
225call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
226    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
227    call(Call).
228
229
230
231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232%
233%  Prolog built-in meta-predicates
234%
235%  (excluding ISO Prolog Standard meta-predicates)
236%
237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
239
240% '$lgt_pl_meta_predicate'(?callable).
241
242'$lgt_pl_meta_predicate'(block(::, *, ::)).
243'$lgt_pl_meta_predicate'(call_priority(::, *)).
244'$lgt_pl_meta_predicate'(coverof(*, ::, *)).
245'$lgt_pl_meta_predicate'(do(*, ::)).
246'$lgt_pl_meta_predicate'(event_create(::, *, *)).
247'$lgt_pl_meta_predicate'(make_suspension(::, *, *)).
248'$lgt_pl_meta_predicate'(mutex(*, ::)).
249'$lgt_pl_meta_predicate'(suspend(::, *, *)).
250'$lgt_pl_meta_predicate'(suspend(::, *, *, *)).
251
252
253
254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255%
256%  file extension predicates
257%
258%  these extensions are used by Logtalk load/compile predicates
259%
260%  you may want to change the extension for Prolog files to match
261%  the one expected by your Prolog compiler
262%
263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264
265
266% '$lgt_file_extension'(?atom, ?atom)
267
268'$lgt_file_extension'(logtalk, '.lgt').
269'$lgt_file_extension'(prolog, '.pl').
270'$lgt_file_extension'(xml, '.xml').
271
272
273
274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
275%
276%  default flag values
277%
278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279
280
281% '$lgt_default_flag'(?atom, ?atom)
282%
283% default values for all flags
284
285'$lgt_default_flag'(xmldocs, on).
286'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
287'$lgt_default_flag'(xmlspec, dtd).
288'$lgt_default_flag'(xmlsref, local).
289
290'$lgt_default_flag'(unknown, warning).
291'$lgt_default_flag'(misspelt, warning).
292'$lgt_default_flag'(singletons, warning).
293'$lgt_default_flag'(lgtredef, warning).
294'$lgt_default_flag'(plredef, silent).
295'$lgt_default_flag'(portability, silent).
296
297'$lgt_default_flag'(report, on).
298
299'$lgt_default_flag'(smart_compilation, off).
300'$lgt_default_flag'(reload, always).
301
302'$lgt_default_flag'(startup_message, flags(verbose)).
303
304'$lgt_default_flag'(underscore_variables, dont_care).
305
306'$lgt_default_flag'(code_prefix, '').
307
308'$lgt_default_flag'(debug, off).
309'$lgt_default_flag'(break_predicate, true).
310
311'$lgt_default_flag'(events, off).
312
313'$lgt_default_flag'(altdirs, off).
314'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
315'$lgt_default_flag'(xmldir, 'xml_docs/').
316
317'$lgt_default_flag'(encoding_directive, unsupported).
318'$lgt_default_flag'(threads, unsupported).
319
320'$lgt_default_flag'(context_switching_calls, allow).
321
322
323
324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
325%
326%  list predicates
327%
328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329
330
331'$lgt_append'([], List, List).
332'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
333    '$lgt_append'(Tail, List, Tail2).
334
335
336'$lgt_member'(Head, [Head| _]).
337'$lgt_member'(Head, [_| Tail]) :-
338    '$lgt_member'(Head, Tail).
339
340
341'$lgt_member_var'(V, [H| _]) :-
342    V == H.
343'$lgt_member_var'(V, [_| T]) :-
344    '$lgt_member_var'(V, T).
345
346
347'$lgt_is_list'([]) :-
348    !.
349'$lgt_is_list'([_| Tail]) :-
350    '$lgt_is_list'(Tail).
351
352
353'$lgt_is_proper_list'(List) :-
354    List == [], !.
355'$lgt_is_proper_list'([_| Tail]) :-
356    nonvar(Tail),
357    '$lgt_is_proper_list'(Tail).
358
359
360
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362%
363%  file predicates
364%
365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366
367
368% '$lgt_file_exists'(+atom)
369%
370% see if a file exist in the current directory
371
372'$lgt_file_exists'(File) :-
373    exists(File).
374
375
376% '$lgt_directory_exists'(+atom)
377%
378% checks if a directory exists
379
380'$lgt_directory_exists'(Directory) :-
381    atom_string(Directory, DirectoryString),
382    canonical_path_name(DirectoryString, Path),
383    exists(Path).
384
385
386% '$lgt_current_directory'(-atom)
387%
388% gets current working directory
389
390'$lgt_current_directory'(Directory) :-
391    getcwd(Directory).
392
393
394% '$lgt_change_directory'(+atom)
395%
396% changes current working directory
397
398'$lgt_change_directory'(Directory) :-
399    cd(Directory).
400
401
402% '$lgt_make_directory'(+atom)
403%
404% makes a new directory; succeeds if the directory already exists
405
406'$lgt_make_directory'(Directory) :-
407    (   exists(Directory) ->
408        true
409    ;   mkdir(Directory)
410    ).
411
412
413% '$lgt_load_prolog_code'(+atom, +atom)
414%
415% compile and load a Prolog file
416
417'$lgt_load_prolog_code'(File, _) :-
418    get_flag(debug_compile, Current),
419    set_flag(debug_compile, off),
420    compile(File),
421    set_flag(debug_compile, Current).
422
423
424% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
425%
426% compare file modification times
427
428'$lgt_compare_file_mtimes'(Result, File1, File2) :-
429    get_file_info(File1, mtime, Time1),
430    get_file_info(File2, mtime, Time2),
431    compare(Result, Time1, Time2).
432
433
434
435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436%
437%  sorting predicates
438%
439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440
441
442% '$lgt_keysort'(+list, -list)
443
444'$lgt_keysort'(List, Sorted) :-
445    keysort(List, Sorted).
446
447
448% '$lgt_sort'(+list, -list)
449
450'$lgt_sort'(List, Sorted) :-
451    sort(List, Sorted).
452
453
454
455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
456%
457%  time and date predicates
458%
459%  if your Prolog compiler does not provide access to the operating system
460%  time and date just write dummy definitions
461%
462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463
464
465:-  use_module(library(calendar)).
466
467
468% '$lgt_current_date'(?Year, ?Month, ?Day)
469
470'$lgt_current_date'(Year, Month, Day) :-
471    mjd_now(MJD),
472    mjd_to_date(MJD, Day/Month/Year).
473
474
475% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
476
477'$lgt_current_time'(Hours, Mins, Secs) :-
478    mjd_now(MJD),
479    mjd_to_time(MJD, Hours:Mins:Secs).
480
481
482
483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
484%
485%  timing predicate
486%
487%  if your Prolog compiler does not provide access to a timing predicate
488%  just write dummy definition
489%
490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491
492
493% '$lgt_cpu_time'(-Seconds)
494
495'$lgt_cpu_time'(Seconds) :-
496    cputime(Seconds).
497
498
499
500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501%
502%  comparison predicate
503%
504%  the usual compare/3 definition
505%
506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507
508
509% compare(?atom, @term, @term) -- built-in
510
511
512
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514%
515%  callable predicate
516%
517%  the usual callable/1 definition
518%
519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520
521
522% callable(@term)
523
524callable(Term) :-
525    nonvar(Term),
526    functor(Term, Functor, _),
527    atom(Functor).
528
529
530
531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
532%
533%  read character predicate
534%
535%  read a single character echoing it and writing a newline after
536%
537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538
539
540'$lgt_read_single_char'(Char) :-
541    flush(user), tyi(Code), put(Code), nl, char_code(Char, Code).
542
543
544
545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
546%
547%  pretty print a term by naming its free variables
548%  (avoid instantiating variables in term by using double negation if necessary)
549%
550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551
552
553'$lgt_pretty_print_vars'(Stream, Term) :-
554    write_term(Stream, Term, [numbervars(true)]).
555
556
557'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
558    write_term(Stream, Term, [numbervars(true), quoted(true)]).
559
560
561
562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
563%
564%  getting stream current line number
565%  (needed for improved compiler error messages)
566%
567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568
569
570% '$lgt_stream_current_line_number'(@stream, -integer)
571
572'$lgt_stream_current_line_number'(Stream, Line) :-
573    get_stream_info(Stream, line, Last),
574    Line is Last + 1.
575
576
577
578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
579%
580%  handling of Prolog-proprietary directives on Logtalk source files
581%
582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
583
584
585% '$lgt_ignore_pl_directive'(@callable)
586
587'$lgt_ignore_pl_directive'(mode(_)).
588
589
590% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
591
592'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
593    fail.
594
595
596% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
597
598'$lgt_rewrite_and_recompile_pl_directive'(local(Functor/Arity), private(Functor/Arity)).
599
600'$lgt_rewrite_and_recompile_pl_directive'(lib(Library), use_module(library(Library), Exports)) :-
601    '$lgt_eclipse_list_of_exports'(library(Library), Exports).
602
603'$lgt_rewrite_and_recompile_pl_directive'(use_module(Library), use_module(Library, Exports)) :-
604        '$lgt_eclipse_list_of_exports'(Library, Exports).
605
606
607'$lgt_eclipse_list_of_exports'(Library, Exports) :-
608    (   atom(Library) ->
609        Module = Library
610    ;   Library =..[_, Module]
611    ),
612    current_module(Module),
613    get_module_info(Module, interface, Interface),
614    '$lgt_eclipse_filter_exports'(Interface, Exports).
615
616
617'$lgt_eclipse_filter_exports'([], []).
618
619'$lgt_eclipse_filter_exports'([export(Predicate)| Interface], [Predicate| Exports]) :-
620    '$lgt_eclipse_filter_exports'(Interface, Exports).
621
622
623
624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625%
626%  Shortcut to the Logtalk built-in predicate logtalk_load/1
627%
628%  defined in the config files in order to be able to comment it out in case
629%  of conflict with some Prolog native feature; it implies conformance with
630%  the ISO Prolog standard regarding the definition of the {}/1 syntax
631%
632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
633
634{File, Files} :-
635    !,
636    logtalk_load(File),
637    {Files}.
638{File} :-
639    logtalk_load(File).
640
641
642
643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
644%
645%  end!
646%
647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.