root/tags/lgt2212/configs/eclipse.config

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

Updated release number to 2.21.2.

  • 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.2
5%
6%  configuration file for ECLiPSe 5.5 and later versions
7%
8%  last updated: July 17, 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
348
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350%
351%  list predicates
352%
353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354
355
356'$lgt_append'([], List, List).
357'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
358    '$lgt_append'(Tail, List, Tail2).
359
360
361'$lgt_member'(Head, [Head| _]).
362'$lgt_member'(Head, [_| Tail]) :-
363    '$lgt_member'(Head, Tail).
364
365
366'$lgt_member_var'(V, [H| _]) :-
367    V == H.
368'$lgt_member_var'(V, [_| T]) :-
369    '$lgt_member_var'(V, T).
370
371
372'$lgt_proper_list'([]).
373'$lgt_proper_list'([_| List]) :-
374    '$lgt_proper_list'(List).
375
376
377'$lgt_reverse'(List, Reversed) :-
378    '$lgt_reverse'(List, [], Reversed, Reversed).
379
380'$lgt_reverse'([], Reversed, Reversed, []).
381'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
382    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
383
384
385
386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
387%
388%  file predicates
389%
390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391
392
393% '$lgt_file_exists'(+atom)
394%
395% see if a file exist in the current directory
396
397'$lgt_file_exists'(File) :-
398    exists(File).
399
400
401% '$lgt_load_prolog_code'(+atom)
402%
403% compile and load a Prolog file
404
405'$lgt_load_prolog_code'(File) :-
406    get_flag(debug_compile, Current),
407    set_flag(debug_compile, off),
408    compile(File),
409    set_flag(debug_compile, Current).
410
411
412% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
413%
414% compare file modification times
415
416'$lgt_compare_file_mtimes'(Result, File1, File2) :-
417    get_file_info(File1, mtime, Time1),
418    get_file_info(File2, mtime, Time2),
419    compare(Result, Time1, Time2).
420
421
422
423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424%
425%  sorting predicates
426%
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428
429
430% '$lgt_keysort'(+list, -list)
431
432'$lgt_keysort'(List, Sorted) :-
433    keysort(List, Sorted).
434
435
436% '$lgt_sort'(+list, -list)
437
438'$lgt_sort'(List, Sorted) :-
439    sort(List, Sorted).
440
441
442
443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444%
445%  time and date predicates
446%
447%  if your Prolog compiler does not provide access to the operating system
448%  time and date just write dummy definitions
449%
450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451
452
453:-  use_module(library(calendar)).
454
455
456% '$lgt_current_date'(?Year, ?Month, ?Day)
457
458'$lgt_current_date'(Year, Month, Day) :-
459    mjd_now(MJD),
460    mjd_to_date(MJD, Day/Month/Year).
461
462
463% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
464
465'$lgt_current_time'(Hours, Mins, Secs) :-
466    mjd_now(MJD),
467    mjd_to_time(MJD, Hours:Mins:Secs).
468
469
470
471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
472%
473%  timing predicate
474%
475%  if your Prolog compiler does not provide access to a timing predicate
476%  just write dummy definition
477%
478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
479
480
481% '$lgt_cpu_time'(-Seconds)
482
483'$lgt_cpu_time'(Seconds) :-
484    cputime(Seconds).
485
486
487
488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489%
490%  comparison predicate
491%
492%  the usual compare/3 definition
493%
494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495
496
497% compare(?atom, @term, @term) -- built-in
498
499
500
501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502%
503%  callable predicate
504%
505%  the usual callable/1 definition
506%
507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508
509
510% callable(@term)
511
512callable(Term) :-
513    once((atom(Term); compound(Term))).
514
515
516
517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
518%
519%  read character predicate
520%
521%  read a single character echoing it and writing a newline after
522%
523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524
525
526'$lgt_read_single_char'(Char) :-
527    flush(user), tyi(Code), put(Code), nl, char_code(Char, Code).
528
529
530
531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
532%
533%  pretty print a term by naming its free variables
534%  (avoid instantiating variables in term by using double negation if necessary)
535%
536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
537
538
539'$lgt_pretty_print_vars'(Stream, Term) :-
540    write_term(Stream, Term, [numbervars(true)]).
541
542
543'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
544    write_term(Stream, Term, [numbervars(true), quoted(true)]).
545
546
547
548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
549%
550%  end!
551%
552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.