root/tags/lgt2311/configs/k.config

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