root/tags/lgt2311/configs/prologII.config

Revision 3986, 11.0 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 PrologII+ 4.5 and later versions
7%
8%  last updated: October 24, 2007
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13:- set_prolog_flag(unknown, :fail).
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% '$lgt_iso_predicate'(?callable).
30
31'$lgt_iso_predicate'(_) :-
32    fail.
33
34
35
36%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37%
38%  predicate properties
39%
40%  this predicate must return at least static, dynamic, and built_in
41%  properties for an existing predicate
42%
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44
45
46% '$lgt_predicate_property'(+callable, ?predicate_property)
47
48'$lgt_predicate_property'(Pred, built_in) :-
49    predefined(Pred).
50
51'$lgt_predicate_property'(_, dynamic).
52
53'$lgt_predicate_property'(_, static) :-
54    fail.
55
56
57
58%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59%
60%  meta-predicates
61%
62%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63
64
65% call_cleanup(+callable, +callble)
66
67call_cleanup(_, _) :-
68    throw(not_supported(call_cleanup/2)).
69
70
71% forall(+callable, +callble) -- built-in
72
73forall(Generate, Test) :-
74    \+ (call(Generate), \+ call(Test)).
75
76
77% retractall(+callable) -- built-in
78
79
80% call_with_args/2-9
81%
82% use these definitions only if your compiler does
83% not provide call_with_args/2-9 as built-in predicates
84
85call_with_args(F, A) :-
86    Call =.. [F, A],
87    call(Call).
88
89call_with_args(F, A1, A2) :-
90    Call =.. [F, A1, A2],
91    call(Call).
92
93call_with_args(F, A1, A2, A3) :-
94    Call =.. [F, A1, A2, A3],
95    call(Call).
96
97call_with_args(F, A1, A2, A3, A4) :-
98    Call =.. [F, A1, A2, A3, A4],
99    call(Call).
100
101call_with_args(F, A1, A2, A3, A4, A5) :-
102    Call =.. [F, A1, A2, A3, A4, A5],
103    call(Call).
104
105call_with_args(F, A1, A2, A3, A4, A5, A6) :-
106    Call =.. [F, A1, A2, A3, A4, A5, A6],
107    call(Call).
108
109call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
110    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
111    call(Call).
112
113call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
114    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
115    call(Call).
116
117
118
119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120%
121%  Prolog built-in meta-predicates
122%
123%  (excluding ISO Prolog Standard meta-predicates)
124%
125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126
127
128% '$lgt_pl_meta_predicate'(?callable).
129
130'$lgt_pl_meta_predicate'(_) :-
131    fail.
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, false).
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'(Var, [Head| _]) :-
223    Var == Head.
224'$lgt_member_var'(Var, [_| Tail]) :-
225    '$lgt_member_var'(Var, Tail).
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% see if a file exist in the current directory
252
253'$lgt_file_exists'(File) :-   
254    nonvar(File),
255    catch(open(File, :read, Stream), _, fail),
256    close(Stream).
257
258
259% '$lgt_directory_exists'(+atom)
260%
261% checks if a directory exists
262
263'$lgt_directory_exists'(_).
264
265
266% '$lgt_current_directory'(-atom)
267%
268% gets current working directory
269
270'$lgt_current_directory'(Directory) :-
271    import_dir(Directory).
272
273
274% '$lgt_change_directory'(+atom)
275%
276% changes current working directory
277
278'$lgt_change_directory'(Directory) :-
279    set_import_dir(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'(_) :-
287    throw(not_supported('$lgt_make_directory'/1)).
288
289
290% '$lgt_load_prolog_code'(+atom, +atom)
291%
292% compile and load a Prolog file
293
294'$lgt_load_prolog_code'(File, _) :-
295    reconsult(File),
296    write(File),
297    write(' loaded'),
298    nl.
299
300
301% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
302%
303% compare file modification times
304
305'$lgt_compare_file_mtimes'(_, _, _) :-
306    fail.
307
308
309
310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311%
312%  sorting predicates
313%
314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315
316
317% '$lgt_keysort'(+list, -list)
318
319'$lgt_keysort'(List, Sorted) :-
320    keysort(List, Sorted).
321
322
323% '$lgt_sort'( +List, -Sorted )
324
325'$lgt_sort'(List, Sorted) :-
326    sort(List, Sorted).
327
328
329
330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331%
332%  time and date predicates
333%
334%  if your Prolog compiler does not provide access to the operating system
335%  time and date just write dummy definitions
336%
337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
338
339
340% '$lgt_current_date'(?Year, ?Month, ?Day)
341
342'$lgt_current_date'(Year, Month, Day) :-
343    date(Day, Month, Year, _).
344
345
346% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
347
348'$lgt_current_time'(Hours, Mins, Secs) :-
349    time(Hours, Mins, Secs).
350
351
352
353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354%
355%  timing predicate
356%
357%  if your Prolog compiler does not provide access to a timing predicate
358%  just write dummy definition
359%
360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361
362
363% '$lgt_cpu_time'(-Seconds)
364
365'$lgt_cpu_time'(Seconds) :-
366    cpu_time(Milliseconds),
367    Seconds is Milliseconds/1000.0.
368
369
370
371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372%
373%  comparison predicate
374%
375%  the usual compare/3 definition
376%
377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378
379
380% compare(?atom, @term, @term)
381
382compare(<, X, Y) :-
383    X @< Y, !.
384
385compare(=, X, Y) :-
386    X == Y, !.
387   
388compare(>, X, Y) :-
389    X @> Y.
390
391
392
393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394%
395%  callable predicate
396%
397%  the usual callable/1 definition
398%
399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400
401
402% callable(@term)
403
404callable(Term) :-
405    nonvar(Term),
406    functor(Term, Functor, _),
407    atom(Functor).
408
409
410
411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
412%
413%  read character predicate
414%
415%  read a single character echoing it and writing a newline after
416%
417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
418
419
420'$lgt_read_single_char'(Char) :-
421    get_char(Char),
422    (   peek_code(10) ->    % hack to workaround the lack of built-in
423        get_code(_)         % support for unbuffered character input
424    ;   true
425    ).
426
427
428
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430%
431%  pretty print a term by naming its free variables
432%  (avoid instantiating variables in term by using double negation if necessary)
433%
434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
435
436
437'$lgt_pretty_print_vars'(Stream, Term) :-
438    write(Stream, Term).
439
440
441'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
442    writeq(Stream, Term).
443
444
445
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447%
448%  getting stream current line number
449%  (needed for improved compiler error messages)
450%
451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452
453
454% '$lgt_stream_current_line_number'(@stream, -integer)
455
456'$lgt_stream_current_line_number'(_, _) :-
457    fail.
458
459
460
461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462%
463%  handling of Prolog-proprietary directives on Logtalk source files
464%
465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466
467
468% '$lgt_ignore_pl_directive'(@callable)
469
470'$lgt_ignore_pl_directive'(_) :-
471    fail.
472
473
474% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
475
476'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
477    fail.
478
479
480% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
481
482'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
483    fail.
484
485
486
487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488%
489%  Shortcut to the Logtalk built-in predicate logtalk_load/1
490%
491%  defined in the config files in order to be able to comment it out in case
492%  of conflict with some Prolog native feature; it implies conformance with
493%  the ISO Prolog standard regarding the definition of the {}/1 syntax
494%
495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
496
497{File, Files} :-
498    !,
499    logtalk_load(File),
500    {Files}.
501{File} :-
502    logtalk_load(File).
503
504
505
506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507%
508%  end!
509%
510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.