root/tags/lgt2212/configs/lpamac.config

Revision 1540, 10.3 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 LPA MacProlog32 1.25
7%
8%  last updated: July 17, 2004
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- prolog_flag(syntax_errors, _, error).
14
15
16
17%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18%
19%  ISO Prolog Standard predicates that we must define because they are
20%  not built-in
21%
22%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
23%  we must define; there must be at least one clause for this predicate
24%  whose call should fail if we don't define any ISO predicates
25%
26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28
29:- dynamic(lgt_exception_/1).
30
31
32% '$lgt_iso_predicate'(?callable).
33
34'$lgt_iso_predicate'(atom_codes(_, _)).
35'$lgt_iso_predicate'(atom_concat(_, _, _)).
36'$lgt_iso_predicate'(catch(_, _, _)).
37'$lgt_iso_predicate'(nl(_)).
38'$lgt_iso_predicate'(number_codes(_, _)).
39'$lgt_iso_predicate'(once(_)).
40'$lgt_iso_predicate'(open(_, _, _)).
41'$lgt_iso_predicate'(read_term(_, _, _)).
42'$lgt_iso_predicate'(throw(_)).
43'$lgt_iso_predicate'(write_canonical(_, _)).
44'$lgt_iso_predicate'(write_term(_, _, _)).
45
46
47atom_codes(Atom, Codes) :-
48    name(Atom, Codes).
49
50
51atom_concat(Atom1, Atom2, Atom3) :-
52    nonvar(Atom1), nonvar(Atom2),
53    !,
54    name(Atom1, Codes1),
55    name(Atom2, Codes2),
56    '$lgt_append'(Codes1, Codes2, Codes3),
57    name(Atom3, Codes3).
58
59atom_concat(Atom1, Atom2, Atom3) :-
60    nonvar(Atom3),
61    !,
62    name(Atom3, Codes3),
63    '$lgt_append'(Codes1, Codes2, Codes3),
64    name(Atom1, Codes1),
65    name(Atom2, Codes2).
66
67
68lpa_catch(Error, Goal) :-
69    catch(Error, Goal).
70
71
72:- hide(catch).
73
74
75catch(Error, Goal) :-
76    lpa_catch(Error, Goal).
77
78
79catch(Goal, Catcher, Recovery) :-
80    lpa_catch(Error, Goal),
81    (Error = 0 ->
82        true
83        ;
84        (Error = -1 ->
85            fail
86            ;
87            (Error = 999 ->
88                retract(lgt_exception_(Ball)),
89                !,
90                (Catcher = Ball ->
91                    call(Recovery)
92                    ;
93                    throw(Ball))
94                ;
95                error_message(Error, Message),
96                (Catcher = Message ->
97                    call(Recovery)
98                    ;
99                    write(Message), nl, abort)))).
100
101
102nl(Stream) :-
103    nl ~> Stream.
104
105
106number_codes(Number, Codes) :-
107    name(Number, Codes).
108
109
110once(Goal) :-
111    one(Goal).
112
113
114open(File, Mode, File) :-
115    open(File, Mode).
116
117
118read_term(Stream, Term, [singletons([])]) :-
119    !,
120    read(Term) <~ Stream.
121
122read_term(Stream, Term, _) :-
123    read(Term) <~ Stream.
124
125
126throw(Error) :-
127    asserta(lgt_exception_(Error)),
128    throw(999, Error).
129
130
131write_canonical(Stream, Term) :-
132    writeq(Term) ~> Stream.
133
134
135write_term(Stream, Term, [quoted(true)]) :-
136    !,
137    writeq(Term) ~> Stream.
138
139write_term(Stream, Term, _) :-
140    write(Term) ~> Stream.
141
142
143
144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145%
146%  predicate properties
147%
148%  this predicate must return at least static, dynamic, and built_in
149%  properties for an existing predicate
150%
151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152
153
154% '$lgt_predicate_property'(+callable, ?predicate_property)
155
156'$lgt_predicate_property'(Pred, Prop) :-
157    predicate_property(Pred, Prop).
158
159
160
161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162%
163%  metapredicates
164%
165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166
167
168% lgt_call/2-8
169%
170% use these definitions only if your compiler does
171% not provide call/1-8 as built-in predicates
172
173'$lgt_call'(F, A) :-
174    F(A).
175
176
177'$lgt_call'(F, A1, A2) :-
178    F(A1, A2).
179
180
181'$lgt_call'(F, A1, A2, A3) :-
182    F(A1, A2, A3).
183
184
185'$lgt_call'(F, A1, A2, A3, A4) :-
186    F(A1, A2, A3, A4).
187
188
189'$lgt_call'(F, A1, A2, A3, A4, A5) :-
190    F(A1, A2, A3, A4, A5).
191
192
193'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
194    F(A1, A2, A3, A4, A5, A6).
195
196
197'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
198    F(A1, A2, A3, A4, A5, A6, A7).
199
200
201% lgt_once/2-8
202%
203% if your compiler provides call/1-8 as built-in
204% predicates rewrite these definitions using call(...), !.
205
206'$lgt_once'(F, A) :-
207    one(F(A)).
208
209
210'$lgt_once'(F, A1, A2) :-
211    one(F(A1, A2)).
212
213
214'$lgt_once'(F, A1, A2, A3) :-
215    one(F(A1, A2, A3)).
216
217
218'$lgt_once'(F, A1, A2, A3, A4) :-
219    one(F(A1, A2, A3, A4)).
220
221
222'$lgt_once'(F, A1, A2, A3, A4, A5) :-
223    one(F(A1, A2, A3, A4, A5)).
224
225
226'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
227    one(F(A1, A2, A3, A4, A5, A6)).
228
229
230'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
231    one(F(A1, A2, A3, A4, A5, A6, A7)).
232
233
234
235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236%
237%  Prolog built-in metapredicates
238%
239%  (excluding ISO Prolog Standard metapredicates)
240%
241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242
243
244% '$lgt_pl_metapredicate'(?callable).
245
246'$lgt_pl_metapredicate'(_) :-
247    fail.
248
249
250
251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252%
253%  file extension predicates
254%
255%  these extensions are used by Logtalk load/compile predicates
256%
257%  you may want to change the extension for Prolog files to match
258%  the one expected by your Prolog compiler
259%
260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261
262
263% '$lgt_file_extension'(?atom, ?atom)
264
265'$lgt_file_extension'(metafile, '.mlgt').
266'$lgt_file_extension'(logtalk, '.lgt').
267'$lgt_file_extension'(prolog, '.pl').
268'$lgt_file_extension'(xml, '.xml').
269
270
271
272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
273%
274%  default flag values
275%
276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277
278
279% '$lgt_default_flag'(?atom, ?atom)
280%
281% default values for all flags
282
283'$lgt_default_flag'(iso_initialization_dir, true).
284
285'$lgt_default_flag'(xml, on).
286'$lgt_default_flag'(xsl, 'lgtxml.xsl').
287'$lgt_default_flag'(xmlspec, dtd).
288'$lgt_default_flag'(doctype, 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
301'$lgt_default_flag'(startup_message, flags).
302
303'$lgt_default_flag'(underscore_vars, singletons).
304
305'$lgt_default_flag'(code_prefix, '').
306
307'$lgt_default_flag'(debug, off).
308'$lgt_default_flag'(supports_break_predicate, false).
309
310
311
312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313%
314%  list predicates
315%
316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317
318
319'$lgt_append'([], List, List).
320'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
321    '$lgt_append'(Tail, List, Tail2).
322
323
324'$lgt_member'(Head, [Head| _]).
325'$lgt_member'(Head, [_| Tail]) :-
326    '$lgt_member'(Head, Tail).
327
328
329'$lgt_member_var'(V, [H| _]) :-
330    V == H.
331'$lgt_member_var'(V, [_| T]) :-
332    '$lgt_member_var'(V, T).
333
334
335'$lgt_proper_list'([]).
336'$lgt_proper_list'([_| List]) :-
337    '$lgt_proper_list'(List).
338
339
340'$lgt_reverse'(List, Reversed) :-
341    '$lgt_reverse'(List, [], Reversed, Reversed).
342
343'$lgt_reverse'([], Reversed, Reversed, []).
344'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :-
345    '$lgt_reverse'(Tail, [Head| List], Reversed, Bound).
346
347
348
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350%
351%  file predicates
352%
353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354
355
356% '$lgt_file_exists'(+atom)
357%
358% see if a file exist in the current directory
359
360'$lgt_file_exists'(File) :-
361    catch(absolute_file_name(File, [access(exist)], _), _, fail).
362
363
364% '$lgt_load_prolog_code'(+atom)
365%
366% compile and load a Prolog file
367
368'$lgt_load_prolog_code'(File) :-
369    reconsult(File).
370
371
372% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
373%
374% compare file modification times
375
376'$lgt_compare_file_mtimes'(Result, File1, File2) :-
377    fmdatetime(File1, Time1),
378    fmdatetime(File2, Time2),
379    compare(Result, Time1, Time2).
380
381
382
383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
384%
385%  sorting predicates
386%
387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
388
389
390% '$lgt_keysort'(+list, -list)
391
392'$lgt_keysort'(List, Sorted) :-
393    keysort(List, Sorted).
394
395
396% '$lgt_sort'(+list, -list)
397
398'$lgt_sort'(List, Sorted) :-
399    sort(List, Sorted).
400
401
402
403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404%
405%  time and date predicates
406%
407%  if your Prolog compiler does not provide access to the operating system
408%  time and date just write dummy definitions
409%
410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
411
412
413% '$lgt_current_date'(?Year, ?Month, ?Day)
414
415'$lgt_current_date'(Year, Month, Day) :-
416    date(Day, Month, Year).
417
418
419% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
420
421'$lgt_current_time'(Hours, Mins, Secs) :-
422    time(Hours, Mins, Secs, _).
423
424
425
426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
427%
428%  timing predicate
429%
430%  if your Prolog compiler does not provide access to a timing predicate
431%  just write dummy definition
432%
433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434
435
436% '$lgt_cpu_time'(-Seconds)
437
438'$lgt_cpu_time'(Seconds) :-
439    ticks(Ticks),
440    Seconds is Ticks / 60.
441
442
443
444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445%
446%  comparison predicate
447%
448%  the usual compare/3 definition
449%
450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451
452
453% compare(?atom, @term, @term) -- built-in
454
455
456
457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458%
459%  callable predicate
460%
461%  the usual callable/1 definition
462%
463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464
465
466% callable(@term) -- built-in
467
468
469
470%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
471%
472%  read character predicate
473%
474%  read a single character echoing it and writing a newline after
475%
476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477
478
479'$lgt_read_single_char'(Char) :-
480    get(Code), name(Char, [Code]).
481
482
483
484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
485%
486%  pretty print a term by naming its free variables
487%  (avoid instantiating variables in term by using double negation if necessary)
488%
489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
490
491
492'$lgt_pretty_print_vars'(Stream, Term) :-
493    write(Stream, Term).
494
495
496'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
497    writeq(Stream, Term).
498
499
500
501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502%
503%  end!
504%
505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.