root/tags/lgt2212/configs/lpawin.config

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