root/tags/lgt290/configs/eclipse.config

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

Initial revision

  • 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.0
5%
6%  configuration file for ECLiPSe 4.2.2
7%
8%  last updated: August 24, 2000
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 compiler options
298%
299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
300
301
302% lgt_default_compiler_option(?atom, ?atom)
303%
304% default values for all compiler options
305
306lgt_default_compiler_option(iso_initialization_dir, false).
307
308lgt_default_compiler_option(xml, on).
309lgt_default_compiler_option(xsl, 'lgtxml.xsl').
310
311lgt_default_compiler_option(unknown, warning).
312lgt_default_compiler_option(misspelt, warning).
313lgt_default_compiler_option(singletons, warning).
314lgt_default_compiler_option(lgtredef, warning).
315lgt_default_compiler_option(plredef, silent).
316
317lgt_default_compiler_option(report, on).
318
319
320
321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322%
323%  list predicates
324%
325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
326
327
328lgt_append([], List, List).
329lgt_append([Head| Tail], List, [Head| Tail2]) :-
330    lgt_append(Tail, List, Tail2).
331
332
333lgt_member(Head, [Head| _]).
334lgt_member(Head, [_| Tail]) :-
335    lgt_member(Head, Tail).
336
337
338lgt_member_var(V, [H| _]) :-
339    V == H.
340lgt_member_var(V, [_| T]) :-
341    lgt_member_var(V, T).
342
343
344lgt_proper_list([]).
345lgt_proper_list([_| List]) :-
346    lgt_proper_list(List).
347
348
349
350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
351%
352%  file predicates
353%
354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355
356
357% lgt_file_exists(+atom)
358%
359% see if a file exist in the current directory
360
361lgt_file_exists(File) :-
362    exists(File).
363
364
365% lgt_load_prolog_code(+atom)
366%
367% compile and load a Prolog file
368
369lgt_load_prolog_code(File) :-
370    compile(File).
371
372
373
374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375%
376%  sorting predicates
377%
378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379
380
381% lgt_keysort(+list, -list)
382
383lgt_keysort(List, Sorted) :-
384    keysort(List, Sorted).
385
386
387% lgt_sort(+list, -list)
388
389lgt_sort(List, Sorted) :-
390    sort(List, Sorted).
391
392
393
394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395%
396%  time and date predicates
397%
398%  if your Prolog compiler does not provide access to the operating system
399%  time and date just write dummy definitions
400%
401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402
403
404:-  use_module(library(calendar)).
405
406
407% lgt_current_date(?Year, ?Month, ?Day)
408
409lgt_current_date(Year, Month, Day) :-
410    mjd_now(MJD),
411    mjd_to_date(MJD, Day/Month/Year).
412
413
414% lgt_current_time(?Hours, ?Mins, ?Secs)
415
416lgt_current_time(Hours, Mins, Secs) :-
417    mjd_now(MJD),
418    mjd_to_time(MJD, Hours:Mins:Secs).
419
420
421
422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423%
424%  timing predicate
425%
426%  if your Prolog compiler does not provide access to a timing predicate
427%  just write dummy definition
428%
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430
431
432% lgt_cpu_time(-Seconds)
433
434lgt_cpu_time(Seconds) :-
435    cputime(Seconds).
436
437
438
439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440%
441%  comparison predicate
442%
443%  the usual compare/3 definition
444%
445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
446
447
448% compare(?atom, @term, @term) -- built-in
449
450
451
452%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
453%
454%  end!
455%
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.