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