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