root/tags/lgt2306/configs/bin.config

Revision 3867, 12.9 KB (checked in by pmoura, 16 months ago)

Changed handling of the encoding/1 directive by the Logtalk compiler in order to improve compatibility with YAP and SICStus Prolog. Removed from the config files the now obsolete '$lgt_set_stream_encoding'/2 predicate definition. Renamed the compiler option "supports_encoding_dir" to "encoding_directive" and changed its possible values to "unsupported", "full" (used in both Logtalk source files and compiler generated Prolog files), and "source" (used only in Logtalk source files).

  • 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.30.6
5%
6%  configuration file for BinProlog 8.x~10.x
7%
8%  last updated: September 27, 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
296
297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
298%
299%  list predicates
300%
301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302
303
304'$lgt_append'(List1, List2, List3) :-
305    append(List1, List2, List3).
306
307
308'$lgt_member'(Term, List) :-
309    member(Term, List).
310
311
312'$lgt_member_var'(V, [H| _]) :-
313    V == H.
314'$lgt_member_var'(V, [_| T]) :-
315    '$lgt_member_var'(V, T).
316
317
318'$lgt_is_list'([]) :-
319    !.
320'$lgt_is_list'([_| Tail]) :-
321    '$lgt_is_list'(Tail).
322
323
324'$lgt_is_proper_list'(List) :-
325    List == [], !.
326'$lgt_is_proper_list'([_| Tail]) :-
327    nonvar(Tail),
328    '$lgt_is_proper_list'(Tail).
329
330
331
332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
333%
334%  file predicates
335%
336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
337
338
339% '$lgt_file_exists'(+atom)
340%
341% checks if a file exist in the current directory
342
343'$lgt_file_exists'(File) :-
344    exists_file(File).
345
346
347% '$lgt_directory_exists'(+atom)
348%
349% checks if a directory exists
350
351'$lgt_directory_exists'(Directory) :-
352    exists_file(Directory).
353
354
355% '$lgt_current_directory'(-atom)
356%
357% gets current working directory
358
359'$lgt_current_directory'(Directory) :-
360    pwd(Chars), atom_chars(Directory, Chars).
361
362
363% '$lgt_change_directory'(+atom)
364%
365% changes current working directory
366
367'$lgt_change_directory'(Directory) :-
368    cd(Directory).
369
370
371% '$lgt_make_directory'(+atom)
372%
373% makes a new directory; succeeds if the directory already exists
374
375'$lgt_make_directory'(Directory) :-
376    exists_file(Directory) ->
377        true
378        ;
379        atom_concat('mkdir ', Directory, Command),
380        unix(Command).
381
382
383% '$lgt_load_prolog_code'(+atom, +atom)
384%
385% compile and load a Prolog file
386
387'$lgt_load_prolog_code'(File, _) :-
388    consult(File).
389
390
391% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
392%
393% compare file modification times
394
395'$lgt_compare_file_mtimes'(Result, File1, File2) :-
396    exists_file(File1),
397    exists_file(File2),
398    (older_file(File1, File2) ->
399        Result = '<'
400        ;
401        (older_file(File2, File1) ->
402            Result = '>'
403            ;
404            Result = '=')).
405
406
407
408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409%
410%  sorting predicates
411%
412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413
414
415% '$lgt_keysort'(+list, -list)
416
417'$lgt_keysort'(List, Sorted) :-
418    keysort(List, Sorted).
419
420
421% '$lgt_sort'(+list, -list)
422
423'$lgt_sort'(List, Sorted) :-
424    sort(List, Sorted).
425
426
427
428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429%
430%  time and date predicates
431%
432%  if your Prolog compiler does not provide access to the operating system
433%  time and date just write dummy definitions
434%
435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436
437
438% '$lgt_current_date'(?Year, ?Month, ?Day)
439
440'$lgt_current_date'(1998, 2, 27).
441
442
443% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
444
445'$lgt_current_time'(0, 0, 0).
446
447
448
449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
450%
451%  timing predicate
452%
453%  if your Prolog compiler does not provide access to a timing predicate
454%  just write dummy definition
455%
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457
458
459% '$lgt_cpu_time'(-Seconds)
460
461'$lgt_cpu_time'(Seconds) :-
462    ctime(Miliseconds),
463    Seconds is Miliseconds / 1000 .
464
465
466
467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468%
469%  comparison predicate
470%
471%  the usual compare/3 definition
472%
473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474
475
476% compare(?atom, @term, @term) -- built-in
477
478
479
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481%
482%  callable predicate
483%
484%  the usual callable/1 definition
485%
486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487
488
489% callable(@term) -- built-in
490
491
492
493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494%
495%  read character predicate
496%
497%  read a single character echoing it and writing a newline after
498%
499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500
501
502'$lgt_read_single_char'(Char) :-
503    current_input(Stream),
504    get_char(Stream, Char).
505
506
507
508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509%
510%  pretty print a term by naming its free variables
511%  (avoid instantiating variables in term by using double negation if necessary)
512%
513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514
515
516'$lgt_pretty_print_vars'(Stream, Term) :-
517    \+ \+ (numbervars(Term, 0, _), write(Stream, Term)).
518
519
520'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
521    \+ \+ (numbervars(Term, 0, _), writeq(Stream, Term)).
522
523
524
525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
526%
527%  getting stream current line number
528%  (needed for improved compiler error messages)
529%
530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531
532
533% '$lgt_stream_current_line_number'(@stream, -integer)
534
535'$lgt_stream_current_line_number'(_, _) :-
536    fail.
537
538
539
540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
541%
542%  handling of Prolog-proprietary directives on Logtalk source files
543%
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545
546
547% '$lgt_ignore_pl_directive'(@callable)
548
549'$lgt_ignore_pl_directive'(_) :-
550    fail.
551
552
553% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
554
555'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
556    fail.
557
558
559% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
560
561'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
562    fail.
563
564
565
566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
567%
568%  Shortcut to the Logtalk built-in predicate logtalk_load/1
569%
570%  defined in the config files in order to be able to comment it out in case
571%  of conflict with some Prolog native feature; it implies conformance with
572%  the ISO Prolog standard regarding the definition of the {}/1 syntax
573%
574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
575
576{File, Files} :-
577    !,
578    logtalk_load(File),
579    {Files}.
580{File} :-
581    logtalk_load(File).
582
583
584
585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586%
587%  end!
588%
589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.