root/tags/lgt2311/configs/lpawin.config

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