root/tags/lgt2311/configs/lpamac.config

Revision 3986, 12.4 KB (checked in by pmoura, 13 months ago)

Updated the release number to 2.31.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Open source object-oriented logic programming language
4%  Release 2.31.1
5%
6%  configuration file for LPA MacProlog32 1.25
7%
8%  last updated: October 24, 2007
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'(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    name(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
103nl(Stream) :-
104    nl ~> Stream.
105
106
107number_codes(Number, Codes) :-
108    name(Number, Codes).
109
110
111once(Goal) :-
112    one(Goal).
113
114
115open(File, Mode, File) :-
116    open(File, Mode).
117
118
119open(File, Mode, File, []) :-
120    open(File, Mode).
121
122
123read_term(Stream, Term, [singletons([])]) :-
124    !,
125    read(Term) <~ Stream.
126
127read_term(Stream, Term, _) :-
128    read(Term) <~ Stream.
129
130
131throw(Error) :-
132    asserta(lgt_exception_(Error)),
133    throw(999, Error).
134
135
136write_canonical(Stream, Term) :-
137    writeq(Term) ~> Stream.
138
139
140write_term(Stream, Term, [quoted(true)]) :-
141    !,
142    writeq(Term) ~> Stream.
143
144write_term(Stream, Term, _) :-
145    write(Term) ~> Stream.
146
147
148
149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150%
151%  predicate properties
152%
153%  this predicate must return at least static, dynamic, and built_in
154%  properties for an existing predicate
155%
156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157
158
159% '$lgt_predicate_property'(+callable, ?predicate_property)
160
161'$lgt_predicate_property'(Pred, Prop) :-
162    predicate_property(Pred, Prop).
163
164
165
166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167%
168%  meta-predicates
169%
170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171
172
173% call_cleanup(+callable, +callble)
174
175call_cleanup(_, _) :-
176    throw(not_supported(call_cleanup/2)).
177
178
179% forall(+callable, +callble) -- built-in
180
181
182% retractall(+callable) -- built-in
183
184
185% call_with_args/2-9
186%
187% use these definitions only if your compiler does
188% not provide call_with_args/2-9 as built-in predicates
189
190call_with_args(F, A) :-
191    F(A).
192
193call_with_args(F, A1, A2) :-
194    F(A1, A2).
195
196call_with_args(F, A1, A2, A3) :-
197    F(A1, A2, A3).
198
199call_with_args(F, A1, A2, A3, A4) :-
200    F(A1, A2, A3, A4).
201
202call_with_args(F, A1, A2, A3, A4, A5) :-
203    F(A1, A2, A3, A4, A5).
204
205call_with_args(F, A1, A2, A3, A4, A5, A6) :-
206    F(A1, A2, A3, A4, A5, A6).
207
208call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
209    F(A1, A2, A3, A4, A5, A6, A7).
210
211call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
212    F(A1, A2, A3, A4, A5, A6, A7, A8).
213
214
215
216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217%
218%  Prolog built-in meta-predicates
219%
220%  (excluding ISO Prolog Standard meta-predicates)
221%
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223
224
225% '$lgt_pl_meta_predicate'(?callable).
226
227'$lgt_pl_meta_predicate'(_) :-
228    fail.
229
230
231
232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233%
234%  file extension predicates
235%
236%  these extensions are used by Logtalk load/compile predicates
237%
238%  you may want to change the extension for Prolog files to match
239%  the one expected by your Prolog compiler
240%
241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242
243
244% '$lgt_file_extension'(?atom, ?atom)
245
246'$lgt_file_extension'(logtalk, '.lgt').
247'$lgt_file_extension'(prolog, '.pl').
248'$lgt_file_extension'(xml, '.xml').
249
250
251
252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253%
254%  default flag values
255%
256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257
258
259% '$lgt_default_flag'(?atom, ?atom)
260%
261% default values for all flags
262
263'$lgt_default_flag'(xmldocs, on).
264'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
265'$lgt_default_flag'(xmlspec, dtd).
266'$lgt_default_flag'(xmlsref, local).
267
268'$lgt_default_flag'(unknown, warning).
269'$lgt_default_flag'(misspelt, warning).
270'$lgt_default_flag'(singletons, warning).
271'$lgt_default_flag'(lgtredef, warning).
272'$lgt_default_flag'(plredef, silent).
273'$lgt_default_flag'(portability, silent).
274
275'$lgt_default_flag'(report, on).
276
277'$lgt_default_flag'(smart_compilation, off).
278'$lgt_default_flag'(reload, always).
279
280'$lgt_default_flag'(startup_message, flags(verbose)).
281
282'$lgt_default_flag'(underscore_variables, singletons).
283
284'$lgt_default_flag'(code_prefix, '').
285
286'$lgt_default_flag'(debug, off).
287'$lgt_default_flag'(break_predicate, false).
288
289'$lgt_default_flag'(events, off).
290
291'$lgt_default_flag'(altdirs, off).
292'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
293'$lgt_default_flag'(xmldir, 'xml_docs/').
294
295'$lgt_default_flag'(encoding_directive, unsupported).
296'$lgt_default_flag'(threads, unsupported).
297
298'$lgt_default_flag'(context_switching_calls, allow).
299
300
301
302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
303%
304%  list predicates
305%
306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
307
308
309'$lgt_append'([], List, List).
310'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
311    '$lgt_append'(Tail, List, Tail2).
312
313
314'$lgt_member'(Head, [Head| _]).
315'$lgt_member'(Head, [_| Tail]) :-
316    '$lgt_member'(Head, Tail).
317
318
319'$lgt_member_var'(V, [H| _]) :-
320    V == H.
321'$lgt_member_var'(V, [_| T]) :-
322    '$lgt_member_var'(V, T).
323
324
325'$lgt_is_list'([]) :-
326    !.
327'$lgt_is_list'([_| Tail]) :-
328    '$lgt_is_list'(Tail).
329
330
331'$lgt_is_proper_list'(List) :-
332    List == [], !.
333'$lgt_is_proper_list'([_| Tail]) :-
334    nonvar(Tail),
335    '$lgt_is_proper_list'(Tail).
336
337
338
339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340%
341%  file predicates
342%
343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
344
345
346% '$lgt_file_exists'(+atom)
347%
348% checks if a file exist in the current directory
349
350'$lgt_file_exists'(File) :-
351    absolute_file_name(File, [access(exist)], _).
352
353
354% '$lgt_directory_exists'(+atom)
355%
356% checks if a directory exists
357
358'$lgt_directory_exists'(Directory) :-
359    absolute_file_name(Directory, [access(exist)], _),
360    absolute_file_name(Directory, [file_type(directory)], _).
361
362
363% '$lgt_current_directory'(-atom)
364%
365% gets current working directory
366
367'$lgt_current_directory'(Directory) :-
368    var(Directory),
369    dvol(Directory).
370
371
372% '$lgt_change_directory'(+atom)
373%
374% changes current working directory
375
376'$lgt_change_directory'(Directory) :-
377    dvol(Directory).
378
379
380% '$lgt_make_directory'(+atom)
381%
382% makes a new directory; succeeds if the directory already exists
383
384'$lgt_make_directory'(_) :-
385    throw(not_supported('$lgt_make_directory'/1)).
386
387
388% '$lgt_load_prolog_code'(+atom, +atom)
389%
390% compile and load a Prolog file
391
392'$lgt_load_prolog_code'(File, _) :-
393    reconsult(File).
394
395
396% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
397%
398% compare file modification times
399
400'$lgt_compare_file_mtimes'(Result, File1, File2) :-
401    fmdatetime(File1, Time1),
402    fmdatetime(File2, Time2),
403    compare(Result, Time1, Time2).
404
405
406
407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408%
409%  sorting predicates
410%
411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
412
413
414% '$lgt_keysort'(+list, -list)
415
416'$lgt_keysort'(List, Sorted) :-
417    keysort(List, Sorted).
418
419
420% '$lgt_sort'(+list, -list)
421
422'$lgt_sort'(List, Sorted) :-
423    sort(List, Sorted).
424
425
426
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428%
429%  time and date predicates
430%
431%  if your Prolog compiler does not provide access to the operating system
432%  time and date just write dummy definitions
433%
434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
435
436
437% '$lgt_current_date'(?Year, ?Month, ?Day)
438
439'$lgt_current_date'(Year, Month, Day) :-
440    date(Day, Month, Year).
441
442
443% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
444
445'$lgt_current_time'(Hours, Mins, Secs) :-
446    time(Hours, Mins, Secs, _).
447
448
449
450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451%
452%  timing predicate
453%
454%  if your Prolog compiler does not provide access to a timing predicate
455%  just write dummy definition
456%
457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458
459
460% '$lgt_cpu_time'(-Seconds)
461
462'$lgt_cpu_time'(Seconds) :-
463    ticks(Ticks),
464    Seconds is Ticks / 60.
465
466
467
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470%  comparison predicate
471%
472%  the usual compare/3 definition
473%
474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
475
476
477% compare(?atom, @term, @term) -- built-in
478
479
480
481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482%
483%  callable predicate
484%
485%  the usual callable/1 definition
486%
487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488
489
490% callable(@term) -- built-in
491
492
493
494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495%
496%  read character predicate
497%
498%  read a single character echoing it and writing a newline after
499%
500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501
502
503'$lgt_read_single_char'(Char) :-
504    get(Code), name(Char, [Code]).
505
506
507
508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509%
510%  pretty print a term by naming its free variables
511%  (avoid instantiating variables in term by using double negation if necessary)
512%
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514
515
516'$lgt_pretty_print_vars'(Stream, Term) :-
517    write(Stream, Term).
518
519
520'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
521    writeq(Stream, Term).
522
523
524
525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
526%
527%  getting stream current line number
528%  (needed for improved compiler error messages)
529%
530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531
532
533% '$lgt_stream_current_line_number'(@stream, -integer)
534
535'$lgt_stream_current_line_number'(_, _) :-
536    fail.
537
538
539
540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
541%
542%  handling of Prolog-proprietary directives on Logtalk source files
543%
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545
546
547% '$lgt_ignore_pl_directive'(@callable)
548
549'$lgt_ignore_pl_directive'(_) :-
550    fail.
551
552
553% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
554
555'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
556    fail.
557
558
559% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
560
561'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
562    fail.
563
564
565
566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
567%
568%  Shortcut to the Logtalk built-in predicate logtalk_load/1
569%
570%  defined in the config files in order to be able to comment it out in case
571%  of conflict with some Prolog native feature; it implies conformance with
572%  the ISO Prolog standard regarding the definition of the {}/1 syntax
573%
574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
575
576{File, Files} :-
577    !,
578    logtalk_load(File),
579    {Files}.
580{File} :-
581    logtalk_load(File).
582
583
584
585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586%
587%  end!
588%
589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.