root/tags/lgt2311/configs/als.config

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