root/tags/lgt293/configs/eclipse.config

Revision 70, 9.0 KB (checked in by pmoura, 7 years ago)

Changed comments about Logtalk flags.

  • 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.9.3
5%
6%  configuration file for ECLiPSe 4.2.2, 5.x
7%
8%  last updated: December 30, 2001
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- nodbgcomp.
14
15:- pragma(system).
16
17
18
19%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20%
21%  ISO Prolog Standard predicates that we must define because they are
22%  not built-in
23%
24%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
25%  we must define; there must be at least one clause for this predicate
26%  whose call should fail if we don't define any ISO predicates
27%
28%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29
30
31:- dynamic(lgt_exception_/1).
32
33
34initialization(Goal) :-
35    call(Goal).
36
37
38% lgt_iso_predicate(?callable).
39
40lgt_iso_predicate(assertz(_)).
41lgt_iso_predicate(atom_codes(_, _)).
42lgt_iso_predicate(atom_concat(_, _, _)).
43lgt_iso_predicate(catch(_, _, _)).
44lgt_iso_predicate(float(_)).
45lgt_iso_predicate(number_codes(_, _)).
46lgt_iso_predicate(read_term(_, _, _)).
47lgt_iso_predicate(throw(_)).
48lgt_iso_predicate(write_term(_, _, _)).
49
50
51assertz(Clause) :-
52    assert(Clause).
53
54
55atom_codes(Atom, List) :-
56    var(Atom),
57    string_list(String, List),
58    atom_string(Atom, String).
59
60atom_codes(Atom, List) :-
61    nonvar(Atom),
62    atom_string(Atom, String),
63    string_list(String, List).
64
65
66atom_concat(Atom1, Atom2, Atom3) :-
67    nonvar(Atom1), nonvar(Atom2),
68    !,
69    concat_atoms(Atom1, Atom2, Atom3).
70
71atom_concat(Atom1, Atom2, Atom3) :-
72    nonvar(Atom3),
73    name(Atom3, Codes3),
74    lgt_append(Codes1, Codes2, Codes3),
75    name(Atom1, Codes1),
76    name(Atom2, Codes2).
77
78
79catch(Goal, Catcher, Recovery) :-
80    block(Goal, Tag, lgt_catch_recovery(Tag, Catcher, Recovery)).
81
82
83lgt_catch_recovery(Tag, Catcher, Recovery) :-
84    Tag = lgt_error ->
85        retract(lgt_exception_(Ball)),
86        !,
87        (Catcher = Ball ->
88            call(Recovery)
89            ;
90            exit_block(Tag))
91        ;
92        exit_block(Tag).
93
94
95lgt_uncatched_exception :-
96    (retract(lgt_exception_(Ball)) ->
97        writeq(Ball), nl
98        ;
99        write('uncatched exception'), nl),
100    abort.
101
102
103:- set_error_handler(230, lgt_uncatched_exception/0).
104
105
106float(Term) :-
107    real(Term).
108
109
110number_codes(Number, Codes) :-
111    var(Number),
112    string_list(String, Codes),
113    number_string(Number, String).
114
115number_codes(Number, Codes) :-
116    nonvar(Number),
117    number_string(Number, String),
118    string_list(String, Codes).
119
120
121read_term(Stream, Term, [singletons([])]) :-
122    !,
123    read(Stream, Term).
124
125read_term(Stream, Term, _) :-
126    read(Stream, Term).
127
128
129throw(Ball) :-
130    asserta(lgt_exception_(Ball)),
131    exit_block(lgt_error).
132
133
134write_term(Stream, Term, [quoted(true)]) :-
135    !,
136    writeq(Stream, Term).
137
138write_term(Stream, Term, _) :-
139    write(Stream, Term).
140
141
142
143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144%
145%  predicate properties
146%
147%  this predicate must return at least static, dynamic and built_in
148%  properties for an existing predicate
149%
150%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151
152
153% lgt_predicate_property(+callable, ?predicate_property)
154
155lgt_predicate_property(Predicate, built_in) :-
156    functor(Predicate, Functor, Arity),
157    current_built_in(Functor/Arity).
158
159lgt_predicate_property(Predicate, dynamic) :-
160    functor(Predicate, Functor, Arity),
161    current_predicate(Functor/Arity),
162    is_dynamic(Functor/Arity).
163
164lgt_predicate_property(Predicate, static) :-
165    functor(Predicate, Functor, Arity),
166    current_built_in(Functor/Arity).
167
168lgt_predicate_property(Predicate, static) :-
169    functor(Predicate, Functor, Arity),
170    current_predicate(Functor/Arity),
171    \+ is_dynamic(Functor/Arity).
172
173
174
175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176%
177%  metapredicates
178%
179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180
181
182% forall(+callable, +callble)
183
184forall(Generate, Test) :-
185    \+ call((Generate, \+ call(Test))).
186
187
188% retractall(+callable)
189
190retractall(Head) :-
191    retract_all(Head).
192
193
194% lgt_call/2-8
195%
196% use these definitions only if your compiler does
197% not provide call/1-8 as built-in predicates
198
199lgt_call(F, A) :-
200    Call =.. [F, A],
201    call(Call).
202
203
204lgt_call(F, A1, A2) :-
205    Call =.. [F, A1, A2],
206    call(Call).
207
208
209lgt_call(F, A1, A2, A3) :-
210    Call =.. [F, A1, A2, A3],
211    call(Call).
212
213
214lgt_call(F, A1, A2, A3, A4) :-
215    Call =.. [F, A1, A2, A3, A4],
216    call(Call).
217
218
219lgt_call(F, A1, A2, A3, A4, A5) :-
220    Call =.. [F, A1, A2, A3, A4, A5],
221    call(Call).
222
223
224lgt_call(F, A1, A2, A3, A4, A5, A6) :-
225    Call =.. [F, A1, A2, A3, A4, A5, A6],
226    call(Call).
227
228
229lgt_call(F, A1, A2, A3, A4, A5, A6, A7) :-
230    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
231    call(Call).
232
233
234% lgt_once/2-8
235%
236% if your compiler provides call/1-8 as built-in
237% predicates rewrite these definitions using call(...), !.
238
239lgt_once(F, A) :-
240    Call =.. [F, A],
241    once(Call).
242
243
244lgt_once(F, A1, A2) :-
245    Call =.. [F, A1, A2],
246    once(Call).
247
248
249lgt_once(F, A1, A2, A3) :-
250    Call =.. [F, A1, A2, A3],
251    once(Call).
252
253
254lgt_once(F, A1, A2, A3, A4) :-
255    Call =.. [F, A1, A2, A3, A4],
256    once(Call).
257
258
259lgt_once(F, A1, A2, A3, A4, A5) :-
260    Call =.. [F, A1, A2, A3, A4, A5],
261    once(Call).
262
263
264lgt_once(F, A1, A2, A3, A4, A5, A6) :-
265    Call =.. [F, A1, A2, A3, A4, A5, A6],
266    once(Call).
267
268
269lgt_once(F, A1, A2, A3, A4, A5, A6, A7) :-
270    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
271    once(Call).
272
273
274
275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276%
277%  file extension predicates
278%
279%  these extensions are used by Logtalk load/compile predicates
280%
281%  you may want to change the extension for Prolog files to match
282%  the one expected by your Prolog compiler
283%
284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
285
286
287% lgt_file_extension(?atom, ?atom)
288
289lgt_file_extension(logtalk, '.lgt').
290lgt_file_extension(prolog, '.pl').
291lgt_file_extension(xml, '.xml').
292
293
294
295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296%
297%  default flag values
298%
299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300
301
302% lgt_default_flag(?atom, ?atom)
303%
304% default values for all flags
305
306lgt_default_flag(iso_initialization_dir, false).
307
308lgt_default_flag(xml, on).
309lgt_default_flag(xsl, 'lgtxml.xsl').
310
311lgt_default_flag(unknown, warning).
312lgt_default_flag(misspelt, warning).
313lgt_default_flag(singletons, warning).
314lgt_default_flag(lgtredef, warning).
315lgt_default_flag(plredef, silent).
316lgt_default_flag(portability, silent).
317
318lgt_default_flag(report, on).
319
320
321
322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323%
324%  list predicates
325%
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327
328
329lgt_append([], List, List).
330lgt_append([Head| Tail], List, [Head| Tail2]) :-
331    lgt_append(Tail, List, Tail2).
332
333
334lgt_member(Head, [Head| _]).
335lgt_member(Head, [_| Tail]) :-
336    lgt_member(Head, Tail).
337
338
339lgt_member_var(V, [H| _]) :-
340    V == H.
341lgt_member_var(V, [_| T]) :-
342    lgt_member_var(V, T).
343
344
345lgt_proper_list([]).
346lgt_proper_list([_| List]) :-
347    lgt_proper_list(List).
348
349
350
351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352%
353%  file predicates
354%
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356
357
358% lgt_file_exists(+atom)
359%
360% see if a file exist in the current directory
361
362lgt_file_exists(File) :-
363    exists(File).
364
365
366% lgt_load_prolog_code(+atom)
367%
368% compile and load a Prolog file
369
370lgt_load_prolog_code(File) :-
371    compile(File).
372
373
374
375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376%
377%  sorting predicates
378%
379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
380
381
382% lgt_keysort(+list, -list)
383
384lgt_keysort(List, Sorted) :-
385    keysort(List, Sorted).
386
387
388% lgt_sort(+list, -list)
389
390lgt_sort(List, Sorted) :-
391    sort(List, Sorted).
392
393
394
395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396%
397%  time and date predicates
398%
399%  if your Prolog compiler does not provide access to the operating system
400%  time and date just write dummy definitions
401%
402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
403
404
405:-  use_module(library(calendar)).
406
407
408% lgt_current_date(?Year, ?Month, ?Day)
409
410lgt_current_date(Year, Month, Day) :-
411    mjd_now(MJD),
412    mjd_to_date(MJD, Day/Month/Year).
413
414
415% lgt_current_time(?Hours, ?Mins, ?Secs)
416
417lgt_current_time(Hours, Mins, Secs) :-
418    mjd_now(MJD),
419    mjd_to_time(MJD, Hours:Mins:Secs).
420
421
422
423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424%
425%  timing predicate
426%
427%  if your Prolog compiler does not provide access to a timing predicate
428%  just write dummy definition
429%
430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
431
432
433% lgt_cpu_time(-Seconds)
434
435lgt_cpu_time(Seconds) :-
436    cputime(Seconds).
437
438
439
440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441%
442%  comparison predicate
443%
444%  the usual compare/3 definition
445%
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447
448
449% compare(?atom, @term, @term) -- built-in
450
451
452
453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
454%
455%  end!
456%
457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.