root/tags/lgt2311/configs/k6.config

Revision 3991, 10.8 KB (checked in by pmoura, 13 months ago)

Updated the K-Prolog integration scripts to use the new 6.0.1 version by default. Updated the Linux (RMP and Debian) and MacOS X package build scripts to include Prolog version compatibility information. Minor documentation improvements.

  • Property svn:eol-style set to native
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3%  Logtalk - Open source object-oriented logic programming language
4%  Release 2.31.1
5%
6%  configuration file for K-Prolog 6.0.1 and later versions
7%
8%  last updated: December 29, 2007
9%
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12
13
14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15%
16%  ISO Prolog Standard predicates that we must define because they are
17%  not built-in
18%
19%  add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
20%  we must define; there must be at least one clause for this predicate
21%  whose call should fail if we don't define any ISO predicates
22%
23%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24
25
26% '$lgt_iso_predicate'(?callable).
27
28'$lgt_iso_predicate'(_) :-
29    fail.
30
31
32
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34%
35%  predicate properties
36%
37%  this predicate must return at least static, dynamic, and built_in
38%  properties for an existing predicate
39%
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
42
43% '$lgt_predicate_property'(+callable, ?predicate_property)
44
45'$lgt_predicate_property'(Pred, Prop) :-
46    predicate_property(Pred, Prop).
47
48
49
50%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51%
52%  meta-predicates
53%
54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55
56
57% call_cleanup(+callable, +callble)
58
59call_cleanup(_, _) :-
60    throw(not_supported(call_cleanup/2)).
61
62
63% forall(+callable, +callble) -- built-in
64
65
66% retractall(+callable)
67
68retractall(Head) :-
69    (   retract((Head:-_)),
70        fail
71    ;   true
72    ).
73
74
75% call_with_args/2-9
76%
77% use these definitions only if your compiler does
78% not provide call_with_args/2-9 as built-in predicates
79
80call_with_args(F, A) :-
81    call(F, A).
82
83call_with_args(F, A1, A2) :-
84    call(F, A1, A2).
85
86call_with_args(F, A1, A2, A3) :-
87    call(F, A1, A2, A3).
88
89call_with_args(F, A1, A2, A3, A4) :-
90    call(F, A1, A2, A3, A4).
91
92call_with_args(F, A1, A2, A3, A4, A5) :-
93    call(F, A1, A2, A3, A4, A5).
94
95call_with_args(F, A1, A2, A3, A4, A5, A6) :-
96    call(F, A1, A2, A3, A4, A5, A6).
97
98call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
99    call(F, A1, A2, A3, A4, A5, A6, A7).
100
101call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
102    call(F, A1, A2, A3, A4, A5, A6, A7, A8).
103
104
105
106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107%
108%  Prolog built-in meta-predicates
109%
110%  (excluding ISO Prolog Standard meta-predicates)
111%
112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
114
115% '$lgt_pl_meta_predicate'(?callable).
116
117'$lgt_pl_meta_predicate'(_) :-
118    fail.
119
120
121
122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123%
124%  file extension predicates
125%
126%  these extensions are used by Logtalk load/compile predicates
127%
128%  you may want to change the extension for Prolog files to match
129%  the one expected by your Prolog compiler
130%
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132
133
134% '$lgt_file_extension'(?atom, ?atom)
135
136'$lgt_file_extension'(logtalk, '.lgt').
137'$lgt_file_extension'(prolog, '.pl').
138'$lgt_file_extension'(xml, '.xml').
139
140
141
142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143%
144%  default flag values
145%
146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
148
149% '$lgt_default_flag'(?atom, ?atom)
150%
151% default values for all flags
152
153'$lgt_default_flag'(xmldocs, on).
154'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
155'$lgt_default_flag'(xmlspec, dtd).
156'$lgt_default_flag'(xmlsref, local).
157
158'$lgt_default_flag'(unknown, warning).
159'$lgt_default_flag'(misspelt, warning).
160'$lgt_default_flag'(singletons, warning).
161'$lgt_default_flag'(lgtredef, warning).
162'$lgt_default_flag'(plredef, silent).
163'$lgt_default_flag'(portability, silent).
164
165'$lgt_default_flag'(report, on).
166
167'$lgt_default_flag'(smart_compilation, off).
168'$lgt_default_flag'(reload, always).
169
170'$lgt_default_flag'(startup_message, flags(verbose)).
171
172'$lgt_default_flag'(underscore_variables, dont_care).
173
174'$lgt_default_flag'(code_prefix, '').
175
176'$lgt_default_flag'(debug, off).
177'$lgt_default_flag'(break_predicate, true).
178
179'$lgt_default_flag'(events, off).
180
181'$lgt_default_flag'(altdirs, off).
182'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
183'$lgt_default_flag'(xmldir, 'xml_docs/').
184
185'$lgt_default_flag'(encoding_directive, unsupported).
186'$lgt_default_flag'(threads, unsupported).
187
188'$lgt_default_flag'(context_switching_calls, allow).
189
190
191
192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193%
194%  list predicates
195%
196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
197
198
199'$lgt_append'(List1, List2, List) :-
200    append(List1, List2, List).
201
202
203'$lgt_member'(Element, List) :-
204    member(Element, List).
205
206
207'$lgt_member_var'(V, [H| _]) :-
208    V == H.
209'$lgt_member_var'(V, [_| T]) :-
210    '$lgt_member_var'(V, T).
211
212
213'$lgt_is_list'([]) :-
214    !.
215'$lgt_is_list'([_| Tail]) :-
216    '$lgt_is_list'(Tail).
217
218
219'$lgt_is_proper_list'(List) :-
220    List == [], !.
221'$lgt_is_proper_list'([_| Tail]) :-
222    nonvar(Tail),
223    '$lgt_is_proper_list'(Tail).
224
225
226
227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
228%
229%  file predicates
230%
231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232
233
234% '$lgt_file_exists'(+atom)
235%
236% see if a file exist in the current directory
237
238'$lgt_file_exists'(File) :-
239    dir('.', Files, _),
240    '$lgt_member'(Name, Files),
241    fname(Name, File),
242    !.
243
244
245% '$lgt_directory_exists'(+atom)
246%
247% checks if a directory exists
248
249'$lgt_directory_exists'(Directory) :-
250    fname(Directory, Path),
251    atom_concat(PathNoSlashAtEnd, '/', Path),
252    dir(PathNoSlashAtEnd, _, _).
253
254
255% '$lgt_current_directory'(-atom)
256%
257% gets current working directory
258
259'$lgt_current_directory'(Directory) :-
260    getenv(os, OS),
261    name(AOS, OS),
262    (   sub_atom(AOS, 0, 7, _, 'Windows') ->
263        seepipe(chdir)
264    ;   seepipe('sh -c pwd')
265    ),
266    getln(String),
267    seen,
268    atom_codes(Directory, String).
269
270
271% '$lgt_change_directory'(+atom)
272%
273% changes current working directory
274
275'$lgt_change_directory'(Directory) :-
276    cd(Directory).
277
278
279% '$lgt_make_directory'(+atom)
280%
281% makes a new directory; succeeds if the directory already exists
282
283'$lgt_make_directory'(Directory) :-
284    (   dir(Directory, _, _) ->
285        true
286    ;   atom_concat('mkdir ', Directory, Command),
287        system(Command)
288    ).
289
290
291% '$lgt_load_prolog_code'(+atom, +atom)
292%
293% compile and load a Prolog file
294
295'$lgt_load_prolog_code'(File, _) :-
296    reconsult(File).
297
298
299% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
300%
301% compare file modification times
302
303'$lgt_compare_file_mtimes'(Result, File1, File2) :-
304    ftime(File1, _, Time1, _, Return1), Return1 = 0,
305    ftime(File2, _, Time2, _, Return2), Return2 = 0,
306    compare(Result, Time1, Time2).
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, -list)
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    time(_, _, _, Day, Month, Year, _, _, _).
344
345
346% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
347
348'$lgt_current_time'(Hours, Mins, Secs) :-
349    time(Secs, Mins, Hours, _, _, _, _, _, _).
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    Seconds is time.
367
368
369
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371%
372%  comparison predicate
373%
374%  the usual compare/3 definition
375%
376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377
378
379% compare(?atom, @term, @term) -- built-in
380
381
382
383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
384%
385%  callable predicate
386%
387%  the usual callable/1 definition
388%
389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
390
391
392% callable(@term) -- built-in
393
394
395
396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397%
398%  read character predicate
399%
400%  read a single character echoing it and writing a newline after
401%
402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
403
404
405'$lgt_read_single_char'(Char) :-
406    get(Code), char_code(Char, Code).
407
408
409
410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
411%
412%  pretty print a term by naming its free variables
413%  (avoid instantiating variables in term by using double negation if necessary)
414%
415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
416
417
418'$lgt_pretty_print_vars'(Stream, Term) :-
419    write_term(Stream, Term, []).
420
421
422'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
423    write_term(Stream, Term, [quoted(true)]).
424
425
426
427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428%
429%  getting stream current line number
430%  (needed for improved compiler error messages)
431%
432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433
434
435% '$lgt_stream_current_line_number'(@stream, -integer)
436
437'$lgt_stream_current_line_number'(_, _) :-
438    fail.
439
440
441
442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443%
444%  handling of Prolog-proprietary directives on Logtalk source files
445%
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447
448
449% '$lgt_ignore_pl_directive'(@callable)
450
451'$lgt_ignore_pl_directive'(_) :-
452    fail.
453
454
455% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
456
457'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
458    fail.
459
460
461% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
462
463'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
464    fail.
465
466
467
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470%  Shortcut to the Logtalk built-in predicate logtalk_load/1
471%
472%  defined in the config files in order to be able to comment it out in case
473%  of conflict with some Prolog native feature; it implies conformance with
474%  the ISO Prolog standard regarding the definition of the {}/1 syntax
475%
476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477
478{File, Files} :-
479    !,
480    logtalk_load(File),
481    {Files}.
482{File} :-
483    logtalk_load(File).
484
485
486
487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488%
489%  end!
490%
491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.