root/tags/lgt2215/configs/eclipse.config

Revision 1657, 11.8 KB (checked in by pmoura, 4 years ago)

Added a new optimization compiler flag, "events", which can be used to switch off event-driven programming support when not needed, resulting in increased message sending performance.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Object oriented extension to Prolog
4%  Release 2.21.5
5%
6%  configuration file for ECLiPSe 5.5 and later versions
7%
8%  last updated: October 30, 2004
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            ;
89            exit_block(Tag))
90        ;
91        exit_block(Tag).
92
93
94lgt_uncatched_exception :-
95    (retract(lgt_exception_(Ball)) ->
96        writeq(Ball), nl
97        ;
98        write('uncatched exception'), nl),
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%  metapredicates
170%
171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
172
173
174% forall(+callable, +callble)
175
176forall(Generate, Test) :-
177    \+ call((Generate, \+ call(Test))).
178
179
180% retractall(+callable)
181
182retractall(Head) :-
183    retract_all(Head).
184
185
186% lgt_call/2-8
187%
188% use these definitions only if your compiler does
189% not provide call/1-8 as built-in predicates
190
191'$lgt_call'(F, A) :-
192    Call =.. [F, A],
193    call(Call).
194
195
196'$lgt_call'(F, A1, A2) :-
197    Call =.. [F, A1, A2],
198    call(Call).
199
200
201'$lgt_call'(F, A1, A2, A3) :-
202    Call =.. [F, A1, A2, A3],
203    call(Call).
204
205
206'$lgt_call'(F, A1, A2, A3, A4) :-
207    Call =.. [F, A1, A2, A3, A4],
208    call(Call).
209
210
211'$lgt_call'(F, A1, A2, A3, A4, A5) :-
212    Call =.. [F, A1, A2, A3, A4, A5],
213    call(Call).
214
215
216'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
217    Call =.. [F, A1, A2, A3, A4, A5, A6],
218    call(Call).
219
220
221'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
222    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
223    call(Call).
224
225
226% lgt_once/2-8
227%
228% if your compiler provides call/1-8 as built-in
229% predicates rewrite these definitions using call(...), !.
230
231'$lgt_once'(F, A) :-
232    Call =.. [F, A],
233    once(Call).
234
235
236'$lgt_once'(F, A1, A2) :-
237    Call =.. [F, A1, A2],
238    once(Call).
239
240
241'$lgt_once'(F, A1, A2, A3) :-
242    Call =.. [F, A1, A2, A3],
243    once(Call).
244
245
246'$lgt_once'(F, A1, A2, A3, A4) :-
247    Call =.. [F, A1, A2, A3, A4],
248    once(Call).
249
250
251'$lgt_once'(F, A1, A2, A3, A4, A5) :-
252    Call =.. [F, A1, A2, A3, A4, A5],
253    once(Call).
254
255
256'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
257    Call =.. [F, A1, A2, A3, A4, A5, A6],
258    once(Call).
259
260
261'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
262    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
263    once(Call).
264
265
266
267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268%
269%  Prolog built-in metapredicates
270%
271%  (excluding ISO Prolog Standard metapredicates)
272%
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274
275
276% '$lgt_pl_metapredicate'(?callable).
277
278'$lgt_pl_metapredicate'(block(::, *, ::)).
279'$lgt_pl_metapredicate'(call_priority(::, *)).
280'$lgt_pl_metapredicate'(coverof(*, ::, *)).
281'$lgt_pl_metapredicate'(make_suspension(::, *, *)).
282'$lgt_pl_metapredicate'(mutex(*, ::)).
283'$lgt_pl_metapredicate'(suspend(::, *, *)).
284'$lgt_pl_metapredicate'(suspend(::, *, *, *)).
285
286
287
288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289%
290%  file extension predicates
291%
292%  these extensions are used by Logtalk load/compile predicates
293%
294%  you may want to change the extension for Prolog files to match
295%  the one expected by your Prolog compiler
296%
297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298
299
300% '$lgt_file_extension'(?atom, ?atom)
301
302'$lgt_file_extension'(metafile, '.mlgt').
303'$lgt_file_extension'(logtalk, '.lgt').
304'$lgt_file_extension'(prolog, '.pl').
305'$lgt_file_extension'(xml, '.xml').
306
307
308
309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310%
311%  default flag values
312%
313%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314
315
316% '$lgt_default_flag'(?atom, ?atom)
317%
318% default values for all flags
319
320'$lgt_default_flag'(iso_initialization_dir, false).
321
322'$lgt_default_flag'(xml, on).
323'$lgt_default_flag'(xsl, 'lgtxml.xsl').
324'$lgt_default_flag'(xmlspec, dtd).
325'$lgt_default_flag'(doctype, local).
326
327'$lgt_default_flag'(unknown, warning).
328'$lgt_default_flag'(misspelt, warning).
329'$lgt_default_flag'(singletons, warning).
330'$lgt_default_flag'(lgtredef, warning).
331'$lgt_default_flag'(plredef, silent).
332'$lgt_default_flag'(portability, silent).
333
334'$lgt_default_flag'(report, on).
335
336'$lgt_default_flag'(smart_compilation, off).
337
338'$lgt_default_flag'(startup_message, flags).
339
340'$lgt_default_flag'(underscore_vars, singletons).
341
342'$lgt_default_flag'(code_prefix, '').
343
344'$lgt_default_flag'(debug, off).
345'$lgt_default_flag'(supports_break_predicate, true).
346
347'$lgt_default_flag'(events, on).
348
349
350
351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352%
353%  list predicates
354%
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
357
358'$lgt_append'([], List, List).
359'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
360    '$lgt_append'(Tail, List, Tail2).
361
362
363'$lgt_member'(Head, [Head| _]).
364'$lgt_member'(Head, [_| Tail]) :-
365    '$lgt_member'(Head, Tail).
366
367
368'$lgt_member_var'(V, [H| _]) :-
369    V == H.
370'$lgt_member_var'(V, [_| T]) :-
371    '$lgt_member_var'(V, T).
372
373
374'$lgt_proper_list'([]).
375'$lgt_proper_list'([_| List]) :-
376    '$lgt_proper_list'(List).
377
378
379'$lgt_reverse'(List, Reversed) :-
380    '$lgt_reverse'(List, [], Reversed, Reversed).
381
382'$lgt_reverse'([], Reversed, Reversed, []).
383'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
384    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
385
386
387
388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
389%
390%  file predicates
391%
392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393
394
395% '$lgt_file_exists'(+atom)
396%
397% see if a file exist in the current directory
398
399'$lgt_file_exists'(File) :-
400    exists(File).
401
402
403% '$lgt_load_prolog_code'(+atom)
404%
405% compile and load a Prolog file
406
407'$lgt_load_prolog_code'(File) :-
408    get_flag(debug_compile, Current),
409    set_flag(debug_compile, off),
410    compile(File),
411    set_flag(debug_compile, Current).
412
413
414% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
415%
416% compare file modification times
417
418'$lgt_compare_file_mtimes'(Result, File1, File2) :-
419    get_file_info(File1, mtime, Time1),
420    get_file_info(File2, mtime, Time2),
421    compare(Result, Time1, Time2).
422
423
424
425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426%
427%  sorting predicates
428%
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430
431
432% '$lgt_keysort'(+list, -list)
433
434'$lgt_keysort'(List, Sorted) :-
435    keysort(List, Sorted).
436
437
438% '$lgt_sort'(+list, -list)
439
440'$lgt_sort'(List, Sorted) :-
441    sort(List, Sorted).
442
443
444
445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
446%
447%  time and date predicates
448%
449%  if your Prolog compiler does not provide access to the operating system
450%  time and date just write dummy definitions
451%
452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
453
454
455:-  use_module(library(calendar)).
456
457
458% '$lgt_current_date'(?Year, ?Month, ?Day)
459
460'$lgt_current_date'(Year, Month, Day) :-
461    mjd_now(MJD),
462    mjd_to_date(MJD, Day/Month/Year).
463
464
465% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
466
467'$lgt_current_time'(Hours, Mins, Secs) :-
468    mjd_now(MJD),
469    mjd_to_time(MJD, Hours:Mins:Secs).
470
471
472
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474%
475%  timing predicate
476%
477%  if your Prolog compiler does not provide access to a timing predicate
478%  just write dummy definition
479%
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481
482
483% '$lgt_cpu_time'(-Seconds)
484
485'$lgt_cpu_time'(Seconds) :-
486    cputime(Seconds).
487
488
489
490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491%
492%  comparison predicate
493%
494%  the usual compare/3 definition
495%
496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
497
498
499% compare(?atom, @term, @term) -- built-in
500
501
502
503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
504%
505%  callable predicate
506%
507%  the usual callable/1 definition
508%
509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
510
511
512% callable(@term)
513
514callable(Term) :-
515    once((atom(Term); compound(Term))).
516
517
518
519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520%
521%  read character predicate
522%
523%  read a single character echoing it and writing a newline after
524%
525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
526
527
528'$lgt_read_single_char'(Char) :-
529    flush(user), tyi(Code), put(Code), nl, char_code(Char, Code).
530
531
532
533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534%
535%  pretty print a term by naming its free variables
536%  (avoid instantiating variables in term by using double negation if necessary)
537%
538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
539
540
541'$lgt_pretty_print_vars'(Stream, Term) :-
542    write_term(Stream, Term, [numbervars(true)]).
543
544
545'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
546    write_term(Stream, Term, [numbervars(true), quoted(true)]).
547
548
549
550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551%
552%  end!
553%
554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.