root/tags/lgt2311/configs/sicstus.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 SICStus Prolog 3.8 and later versions
7%
8%  last updated: November 3, 2007
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- use_module(library(system)).
14
15:- set_prolog_flag(language, iso). % recomended, but optional
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% '$lgt_iso_predicate'(?callable).
32
33'$lgt_iso_predicate'(_) :-
34    fail.
35
36
37
38%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39%
40%  predicate properties
41%
42%  this predicate must return at least static, dynamic, and built_in
43%  properties for an existing predicate
44%
45%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46
47
48% '$lgt_predicate_property'(+callable, ?predicate_property)
49
50'$lgt_predicate_property'(Pred, Prop) :-
51    predicate_property(Pred, Prop).
52
53
54
55%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56%
57%  meta-predicates
58%
59%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60
61
62% call_cleanup(+callable, +callble) -- built-in
63
64
65% forall(+callable, +callble) -- built-in
66
67forall(Generate, Test) :-
68    \+ (call(Generate), \+ call(Test)).
69
70
71% retractall(+callable) -- built-in
72
73
74% call_with_args/2-9
75%
76% use these definitions only if your compiler does
77% not provide call_with_args/2-9 as built-in predicates
78
79call_with_args(F, A) :-
80    Call =.. [F, A],
81    call(Call).
82
83call_with_args(F, A1, A2) :-
84    Call =.. [F, A1, A2],
85    call(Call).
86
87call_with_args(F, A1, A2, A3) :-
88    Call =.. [F, A1, A2, A3],
89    call(Call).
90
91call_with_args(F, A1, A2, A3, A4) :-
92    Call =.. [F, A1, A2, A3, A4],
93    call(Call).
94
95call_with_args(F, A1, A2, A3, A4, A5) :-
96    Call =.. [F, A1, A2, A3, A4, A5],
97    call(Call).
98
99call_with_args(F, A1, A2, A3, A4, A5, A6) :-
100    Call =.. [F, A1, A2, A3, A4, A5, A6],
101    call(Call).
102
103call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
104    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
105    call(Call).
106
107call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
108    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
109    call(Call).
110
111
112
113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114%
115%  Prolog built-in meta-predicates
116%
117%  (excluding ISO Prolog Standard meta-predicates)
118%
119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
121
122% '$lgt_pl_meta_predicate'(?callable).
123
124'$lgt_pl_meta_predicate'(call_cleanup(::, ::)).
125'$lgt_pl_meta_predicate'(call_residue(::, *)).
126'$lgt_pl_meta_predicate'(findall(*, ::, *, *)).
127'$lgt_pl_meta_predicate'(freeze(*, ::)).
128'$lgt_pl_meta_predicate'(if(::, ::, ::)).
129'$lgt_pl_meta_predicate'(on_exception(*, ::, ::)).
130'$lgt_pl_meta_predicate'(undo(::)).
131'$lgt_pl_meta_predicate'(when(*, ::)).
132
133
134
135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136%
137%  file extension predicates
138%
139%  these extensions are used by Logtalk load/compile predicates
140%
141%  you may want to change the extension for Prolog files to match
142%  the one expected by your Prolog compiler
143%
144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
145
146
147% '$lgt_file_extension'(?atom, ?atom)
148
149'$lgt_file_extension'(logtalk, '.lgt').
150'$lgt_file_extension'(prolog, '.pl').
151'$lgt_file_extension'(xml, '.xml').
152
153
154
155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156%
157%  default flag values
158%
159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160
161
162% '$lgt_default_flag'(?atom, ?atom)
163%
164% default values for all flags
165
166'$lgt_default_flag'(xmldocs, on).
167'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
168'$lgt_default_flag'(xmlspec, dtd).
169'$lgt_default_flag'(xmlsref, local).
170
171'$lgt_default_flag'(unknown, warning).
172'$lgt_default_flag'(misspelt, warning).
173'$lgt_default_flag'(singletons, warning).
174'$lgt_default_flag'(lgtredef, warning).
175'$lgt_default_flag'(plredef, silent).
176'$lgt_default_flag'(portability, silent).
177
178'$lgt_default_flag'(report, on).
179
180'$lgt_default_flag'(smart_compilation, off).
181'$lgt_default_flag'(reload, always).
182
183'$lgt_default_flag'(startup_message, flags(verbose)).
184
185'$lgt_default_flag'(underscore_variables, singletons).
186
187'$lgt_default_flag'(code_prefix, '').
188
189'$lgt_default_flag'(debug, off).
190'$lgt_default_flag'(break_predicate, true).
191
192'$lgt_default_flag'(events, off).
193
194'$lgt_default_flag'(altdirs, off).
195'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
196'$lgt_default_flag'(xmldir, 'xml_docs/').
197
198'$lgt_default_flag'(encoding_directive, unsupported).
199'$lgt_default_flag'(threads, unsupported).
200
201'$lgt_default_flag'(context_switching_calls, allow).
202
203
204
205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206%
207%  list predicates
208%
209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
210
211
212'$lgt_append'([], List, List).
213'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
214    '$lgt_append'(Tail, List, Tail2).
215
216
217'$lgt_member'(Head, [Head| _]).
218'$lgt_member'(Head, [_| Tail]) :-
219    '$lgt_member'(Head, Tail).
220
221
222'$lgt_member_var'(V, [H| _]) :-
223    V == H.
224'$lgt_member_var'(V, [_| T]) :-
225    '$lgt_member_var'(V, T).
226
227
228'$lgt_is_list'([]) :-
229    !.
230'$lgt_is_list'([_| Tail]) :-
231    '$lgt_is_list'(Tail).
232
233
234'$lgt_is_proper_list'(List) :-
235    List == [], !.
236'$lgt_is_proper_list'([_| Tail]) :-
237    nonvar(Tail),
238    '$lgt_is_proper_list'(Tail).
239
240
241
242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
243%
244%  file predicates
245%
246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247
248
249% '$lgt_file_exists'(+atom)
250%
251% checks if a file exist in the current directory
252
253'$lgt_file_exists'(File) :-
254    file_exists(File).
255
256
257% '$lgt_directory_exists'(+atom)
258%
259% checks if a directory exists
260
261'$lgt_directory_exists'(Directory) :-
262    file_exists(Directory),
263    file_property(Directory, type(directory)).
264
265
266% '$lgt_current_directory'(-atom)
267%
268% gets current working directory
269
270'$lgt_current_directory'(Directory) :-
271    working_directory(Directory, Directory).
272
273
274% '$lgt_change_directory'(+atom)
275%
276% changes current working directory
277
278'$lgt_change_directory'(Directory) :-
279    working_directory(_, Directory).
280
281
282% '$lgt_make_directory'(+atom)
283%
284% makes a new directory; succeeds if the directory already exists
285
286'$lgt_make_directory'(Directory) :-
287    file_exists(Directory) ->
288        true
289        ;
290        make_directory(Directory).
291
292
293% '$lgt_load_prolog_code'(+atom, +atom)
294%
295% compile and load a Prolog file
296
297'$lgt_load_prolog_code'(File, _) :-
298    compile(File).
299
300
301% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
302%
303% compare file modification times
304
305'$lgt_compare_file_mtimes'(Result, File1, File2) :-
306    file_property(File1, mod_time(Time1)),
307    file_property(File2, mod_time(Time2)),
308    compare(Result, Time1, Time2).
309
310
311
312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313%
314%  sorting predicates
315%
316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317
318
319% '$lgt_keysort'(+list, -list)
320
321'$lgt_keysort'(List, Sorted) :-
322    keysort(List, Sorted).
323
324
325% '$lgt_sort'(+list, -list)
326
327'$lgt_sort'(List, Sorted) :-
328    sort(List, Sorted).
329
330
331
332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
333%
334%  time and date predicates
335%
336%  if your Prolog compiler does not provide access to the operating system
337%  time and date just write dummy definitions
338%
339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340
341
342% '$lgt_current_date'(?Year, ?Month, ?Day)
343
344'$lgt_current_date'(Year, Month, Day) :-
345    datime(datime(Year, Month, Day, _, _, _)).
346
347
348% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
349
350'$lgt_current_time'(Hours, Mins, Secs) :-
351    datime(datime(_, _, _, Hours, Mins, Secs)).
352
353
354
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356%
357%  timing predicate
358%
359%  if your Prolog compiler does not provide access to a timing predicate
360%  just write dummy definition
361%
362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363
364
365% '$lgt_cpu_time'(-Seconds)
366
367'$lgt_cpu_time'(Seconds) :-
368    statistics(runtime, [Miliseconds| _]),
369    Seconds is Miliseconds / 1000.
370
371
372
373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374%
375%  comparison predicate
376%
377%  the usual compare/3 definition
378%
379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
380
381
382% compare(?atom, @term, @term) -- built-in
383
384
385
386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
387%
388%  callable predicate
389%
390%  the usual callable/1 definition
391%
392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393
394
395% callable(@term) -- built-in
396
397
398
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400%
401%  read character predicate
402%
403%  read a single character echoing it and writing a newline after
404%
405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
406
407
408'$lgt_read_single_char'(Char) :-
409    get_char(Char),
410    (   peek_code(10) ->    % hack to workaround the lack of built-in
411        get_code(_)         % support for unbuffered character input
412    ;   true
413    ).
414
415
416
417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
418%
419%  pretty print a term by naming its free variables
420%  (avoid instantiating variables in term by using double negation if necessary)
421%
422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423
424
425'$lgt_pretty_print_vars'(Stream, Term) :-
426    \+ \+ (
427        numbervars(Term, 0, _),
428        write_term(Stream, Term, [numbervars(true)])).
429
430
431'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
432    \+ \+ (
433        numbervars(Term, 0, _),
434        write_term(Stream, Term, [numbervars(true), quoted(true)])).
435
436
437
438%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
439%
440%  getting stream current line number
441%  (needed for improved compiler error messages)
442%
443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444
445
446% '$lgt_stream_current_line_number'(@stream, -integer)
447
448'$lgt_stream_current_line_number'(Stream, Line) :-
449    stream_property(Stream, position(Position)),
450    stream_position_data(line_count, Position, Line).
451
452
453
454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455%
456%  handling of Prolog-proprietary directives on Logtalk source files
457%
458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
459
460
461% '$lgt_ignore_pl_directive'(@callable)
462
463'$lgt_ignore_pl_directive'(mode(_)).
464
465
466% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
467
468'$lgt_rewrite_and_copy_pl_directive'(volatile(PIs), volatile(CPIs)) :-
469    '$lgt_rewrite_and_copy_pl_directive_pis'(PIs, CPIs).
470
471
472'$lgt_rewrite_and_copy_pl_directive_pis'(PIs, _) :-
473    var(PIs),
474    throw(instantiation_error).
475'$lgt_rewrite_and_copy_pl_directive_pis'([], []) :-
476    !.
477'$lgt_rewrite_and_copy_pl_directive_pis'([PI| PIs], [CPI| CPIs]) :-
478    !,
479    '$lgt_rewrite_and_copy_pl_directive_pis'(PI, CPI),
480    '$lgt_rewrite_and_copy_pl_directive_pis'(PIs, CPIs).
481'$lgt_rewrite_and_copy_pl_directive_pis'((PI, PIs), (CPI, CPIs)) :-
482    !,
483    '$lgt_rewrite_and_copy_pl_directive_pis'(PI, CPI),
484    '$lgt_rewrite_and_copy_pl_directive_pis'(PIs, CPIs).
485'$lgt_rewrite_and_copy_pl_directive_pis'(Functor/Arity, TFunctor/TArity) :-
486    '$lgt_pp_object_'(_, Prefix, _, _, _, _, _, _, _, _, _),
487    '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor),
488    functor(Meta, Functor, Arity),
489    (   '$lgt_pp_meta_predicate_'(Meta) ->
490        TArity is Arity + 4
491    ;   TArity is Arity + 3
492    ).
493
494
495% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
496
497'$lgt_rewrite_and_recompile_pl_directive'(module(Module, Exports, _), module(Module, Exports)).
498
499
500
501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502%
503%  Shortcut to the Logtalk built-in predicate logtalk_load/1
504%
505%  defined in the config files in order to be able to comment it out in case
506%  of conflict with some Prolog native feature; it implies conformance with
507%  the ISO Prolog standard regarding the definition of the {}/1 syntax
508%
509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
510
511{File, Files} :-
512    !,
513    logtalk_load(File),
514    {Files}.
515{File} :-
516    logtalk_load(File).
517
518
519
520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521%
522%  end!
523%
524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.