root/tags/lgt2311/configs/b.config

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