root/tags/lgt2311/configs/ifprolog.config

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