root/tags/lgt2311/configs/open.config

Revision 3986, 12.9 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 Open Prolog 1.1b5
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
27initialization(Goal) :-
28    call(Goal).
29
30
31% '$lgt_iso_predicate'(?callable).
32
33'$lgt_iso_predicate'(abolish(_)).
34'$lgt_iso_predicate'(atom_codes(_, _)).
35'$lgt_iso_predicate'(atom_concat(_, _, _)).
36'$lgt_iso_predicate'(current_predicate(_)).
37'$lgt_iso_predicate'(float(_)).
38'$lgt_iso_predicate'(nl(_)).
39'$lgt_iso_predicate'(number_codes(_, _)).
40'$lgt_iso_predicate'(open(_, _, _, _)).
41'$lgt_iso_predicate'(read_term(_, _, _)).
42'$lgt_iso_predicate'(write_canonical(_, _)).
43'$lgt_iso_predicate'(write_term(_, _, _)).
44
45
46abolish(Functor/Arity) :-
47    abolish(Functor, Arity).
48
49
50atom_codes(Atom, Codes) :-
51    name(Atom, Codes).
52
53
54atom_concat(Atom1, Atom2, Atom3) :-
55    nonvar(Atom1), nonvar(Atom2),
56    !,
57    name(Atom1, Codes1),
58    name(Atom2, Codes2),
59    '$lgt_append'(Codes1, Codes2, Codes3),
60    name(Atom3, Codes3).
61
62atom_concat(Atom1, Atom2, Atom3) :-
63    nonvar(Atom3),
64    !,
65    name(Atom3, Codes3),
66    '$lgt_append'(Codes1, Codes2, Codes3),
67    name(Atom1, Codes1),
68    name(Atom2, Codes2).
69
70
71current_predicate(Functor/Arity) :-
72    current_predicate(Functor, Term),
73    functor(Term, Functor, Arity).
74
75
76float(Term) :-
77    number(Term).
78
79
80nl(Stream) :-
81    telling(Current),
82    tell(Stream),
83    nl,
84    tell(Current).
85
86
87number_codes(Number, Codes) :-
88    name(Number, Codes).
89
90
91open(File, Mode, Stream, []) :-
92    open(File, Mode, Stream).
93
94
95read_term(Stream, Term, Options) :-
96    seeing(Current),
97    see(Stream),
98    read_term(Term, Options),
99    see(Current).
100
101
102write_canonical(Stream, Term) :-
103    telling(Current),
104    tell(Stream),
105    writeq(Term),
106    tell(Current).
107
108
109write_term(Stream, Term, [quoted(true)]) :-
110    !,
111    telling(Current),
112    tell(Stream),
113    writeq(Term),
114    tell(Current).
115
116write_term(Stream, Term, _) :-
117    telling(Current),
118    tell(Stream),
119    write(Term),
120    tell(Current).
121
122
123
124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125%
126%  predicate properties
127%
128%  this predicate must return at least static, dynamic, and built_in
129%  properties for an existing predicate
130%
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132
133
134% '$lgt_predicate_property'(+callable, ?predicate_property)
135
136'$lgt_predicate_property'(Term, built_in) :-
137    'system$predicate'(_, Term, 'built-in').
138
139'$lgt_predicate_property'(Term, static) :-
140    'system$predicate'(_, Term, 'built-in').
141
142'$lgt_predicate_property'(Term, (dynamic)) :-
143    'system$predicate'(_, Term, normal).
144
145
146
147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148%
149%  meta-predicates
150%
151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152
153
154% call_cleanup(+callable, +callble)
155
156call_cleanup(_, _) :-
157    throw(not_supported(call_cleanup/2)).
158
159
160% forall(+callable, +callble) -- built-in
161
162forall(Generate, Test) :-
163    \+ (call(Generate), \+ call(Test)).
164
165
166% retractall(+callable)
167
168retractall(Head) :-
169    retract(Head),
170    fail.
171
172retractall(Head) :-
173    retract((Head :- _)),
174    fail.
175
176retractall(_).
177
178
179% call_with_args/2-9
180%
181% use these definitions only if your compiler does
182% not provide call_with_args/2-9 as built-in predicates
183
184call_with_args(F, A) :-
185    Call =.. [F, A],
186    call(Call).
187
188call_with_args(F, A1, A2) :-
189    Call =.. [F, A1, A2],
190    call(Call).
191
192call_with_args(F, A1, A2, A3) :-
193    Call =.. [F, A1, A2, A3],
194    call(Call).
195
196call_with_args(F, A1, A2, A3, A4) :-
197    Call =.. [F, A1, A2, A3, A4],
198    call(Call).
199
200call_with_args(F, A1, A2, A3, A4, A5) :-
201    Call =.. [F, A1, A2, A3, A4, A5],
202    call(Call).
203
204call_with_args(F, A1, A2, A3, A4, A5, A6) :-
205    Call =.. [F, A1, A2, A3, A4, A5, A6],
206    call(Call).
207
208call_with_args(F, A1, A2, A3, A4, A5, A6, A7) :-
209    Call =.. [F, A1, A2, A3, A4, A5, A6, A7],
210    call(Call).
211
212call_with_args(F, A1, A2, A3, A4, A5, A6, A7, A8) :-
213    Call =.. [F, A1, A2, A3, A4, A5, A6, A7, A8],
214    call(Call).
215
216
217
218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
219%
220%  Prolog built-in meta-predicates
221%
222%  (excluding ISO Prolog Standard meta-predicates)
223%
224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225
226
227% '$lgt_pl_meta_predicate'(?callable).
228
229'$lgt_pl_meta_predicate'(_) :-
230    fail.
231
232
233
234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235%
236%  file extension predicates
237%
238%  these extensions are used by Logtalk load/compile predicates
239%
240%  you may want to change the extension for Prolog files to match
241%  the one expected by your Prolog compiler
242%
243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244
245
246% '$lgt_file_extension'(?atom, ?atom)
247
248'$lgt_file_extension'(logtalk, '.lgt').
249'$lgt_file_extension'(prolog, '.pl').
250'$lgt_file_extension'(xml, '.xml').
251
252
253
254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255%
256%  default flag values
257%
258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259
260
261% '$lgt_default_flag'(?atom, ?atom)
262%
263% default values for all flags
264
265'$lgt_default_flag'(xmldocs, on).
266'$lgt_default_flag'(xslfile, 'lgtxml.xsl').
267'$lgt_default_flag'(xmlspec, dtd).
268'$lgt_default_flag'(xmlsref, local).
269
270'$lgt_default_flag'(unknown, warning).
271'$lgt_default_flag'(misspelt, warning).
272'$lgt_default_flag'(singletons, warning).
273'$lgt_default_flag'(lgtredef, warning).
274'$lgt_default_flag'(plredef, silent).
275'$lgt_default_flag'(portability, silent).
276
277'$lgt_default_flag'(report, on).
278
279'$lgt_default_flag'(smart_compilation, off).
280'$lgt_default_flag'(reload, always).
281
282'$lgt_default_flag'(startup_message, flags(verbose)).
283
284'$lgt_default_flag'(underscore_variables, singletons).
285
286'$lgt_default_flag'(code_prefix, '').
287
288'$lgt_default_flag'(debug, off).
289'$lgt_default_flag'(break_predicate, false).
290
291'$lgt_default_flag'(events, off).
292
293'$lgt_default_flag'(altdirs, off).
294'$lgt_default_flag'(tmpdir, 'lgt_tmp/').
295'$lgt_default_flag'(xmldir, 'xml_docs/').
296
297'$lgt_default_flag'(encoding_directive, unsupported).
298'$lgt_default_flag'(threads, unsupported).
299
300'$lgt_default_flag'(context_switching_calls, allow).
301
302
303
304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
305%
306%  list predicates
307%
308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
310
311'$lgt_append'([], List, List).
312'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
313    '$lgt_append'(Tail, List, Tail2).
314
315
316'$lgt_member'(Head, [Head| _]).
317'$lgt_member'(Head, [_| Tail]) :-
318    '$lgt_member'(Head, Tail).
319
320
321'$lgt_member_var'(V, [H| _]) :-
322    V == H.
323'$lgt_member_var'(V, [_| T]) :-
324    '$lgt_member_var'(V, T).
325
326
327'$lgt_is_list'([]) :-
328    !.
329'$lgt_is_list'([_| Tail]) :-
330    '$lgt_is_list'(Tail).
331
332
333'$lgt_is_proper_list'(List) :-
334    List == [], !.
335'$lgt_is_proper_list'([_| Tail]) :-
336    nonvar(Tail),
337    '$lgt_is_proper_list'(Tail).
338
339
340
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342%
343%  file predicates
344%
345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346
347
348% '$lgt_file_exists'(+atom)
349%
350% see if a file exist in the current directory
351
352'$lgt_file_exists'(File) :-
353    exists(File).
354
355
356% '$lgt_directory_exists'(+atom)
357%
358% checks if a directory exists
359
360'$lgt_directory_exists'(Directory) :-
361    file_oracle(Directory, exists(true)).
362
363
364% '$lgt_current_directory'(-atom)
365%
366% gets current working directory
367
368'$lgt_current_directory'(Directory) :-
369    current_folder(Current),
370    file_oracle(Current, name(Directory)).
371
372
373% '$lgt_change_directory'(+atom)
374%
375% changes current working directory
376
377'$lgt_change_directory'(Directory) :-
378    set_folder(Directory).
379
380
381% '$lgt_make_directory'(+atom)
382%
383% makes a new directory; succeeds if the directory already exists
384
385'$lgt_make_directory'(_) :-
386    throw(not_supported('$lgt_make_directory'/1)).
387
388
389% '$lgt_load_prolog_code'(+atom, +atom)
390%
391% compile and load a Prolog file
392
393'$lgt_load_prolog_code'(File, _) :-
394    reconsult(File).
395
396
397% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
398%
399% compare file modification times
400
401'$lgt_compare_file_mtimes'(Result, File1, File2) :-
402    current_folder(Folder),
403    op_oracle(file(Folder, File1), modification_date(Time1)),
404    op_oracle(file(Folder, File2), modification_date(Time2)),
405    compare(Result, Time1, Time2).
406
407
408
409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
410%
411%  sorting predicates
412%
413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414
415
416% '$lgt_keysort'(+list, -list)
417
418'$lgt_keysort'(List, Sorted) :-
419    keysort(List, Sorted).
420
421
422% '$lgt_sort'(+list, -list)
423
424'$lgt_sort'(List, Sorted) :-
425    sort(List, Sorted).
426
427
428
429%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
430%
431%  time and date predicates
432%
433%  if your Prolog compiler does not provide access to the operating system
434%  time and date just write dummy definitions
435%
436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437
438
439% '$lgt_current_date'(?Year, ?Month, ?Day)
440
441'$lgt_current_date'(98, 11, 5).
442
443
444% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
445
446'$lgt_current_time'(Hours, Mins, Secs) :-
447    'system$seconds'(Seconds),
448    'system$time'(Seconds, Time),
449    name(Time, [H1, H2, _, M1, M2, _, S1, S2]),
450    name(Hours, [H1, H2]),
451    name(Mins, [M1, M2]),
452    name(Secs, [S1, S2]).
453
454
455
456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457%
458%  timing predicate
459%
460%  if your Prolog compiler does not provide access to a timing predicate
461%  just write dummy definition
462%
463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464
465
466% '$lgt_cpu_time'(-Seconds)
467
468'$lgt_cpu_time'(Seconds) :-
469    statistics(runtime, [Miliseconds,_]),
470    Seconds is Miliseconds / 1000.
471
472
473
474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
475%
476%  comparison predicate
477%
478%  the usual compare/3 definition
479%
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481
482
483% compare(?atom, @term, @term) -- built-in
484
485
486
487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488%
489%  callable predicate
490%
491%  the usual callable/1 definition
492%
493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
494
495
496% callable(@term)
497
498callable(Term) :-
499    nonvar(Term),
500    functor(Term, Functor, _),
501    atom(Functor).
502
503
504
505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
506%
507%  read character predicate
508%
509%  read a single character echoing it and writing a newline after
510%
511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
512
513
514'$lgt_read_single_char'(Char) :-
515    get(Code), name(Char, [Code]).
516
517
518
519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520%
521%  pretty print a term by naming its free variables
522%  (avoid instantiating variables in term by using double negation if necessary)
523%
524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
525
526
527'$lgt_pretty_print_vars'(Stream, Term) :-
528    \+ \+ (numbervars(Term, 0, _), write(Stream, Term)).
529
530
531'$lgt_pretty_print_vars_quoted'(Stream, Term) :-
532    \+ \+ (numbervars(Term, 0, _), writeq(Stream, Term)).
533
534
535
536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
537%
538%  getting stream current line number
539%  (needed for improved compiler error messages)
540%
541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542
543
544% '$lgt_stream_current_line_number'(@stream, -integer)
545
546'$lgt_stream_current_line_number'(_, _) :-
547    fail.
548
549
550
551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
552%
553%  handling of Prolog-proprietary directives on Logtalk source files
554%
555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
556
557
558% '$lgt_ignore_pl_directive'(@callable)
559
560'$lgt_ignore_pl_directive'(_) :-
561    fail.
562
563
564% '$lgt_rewrite_and_copy_pl_directive'(@callable, -callable)
565
566'$lgt_rewrite_and_copy_pl_directive'(_, _) :-
567    fail.
568
569
570% '$lgt_rewrite_and_recompile_pl_directive'(@callable, -callable)
571
572'$lgt_rewrite_and_recompile_pl_directive'(_, _) :-
573    fail.
574
575
576
577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578%
579%  Shortcut to the Logtalk built-in predicate logtalk_load/1
580%
581%  defined in the config files in order to be able to comment it out in case
582%  of conflict with some Prolog native feature; it implies conformance with
583%  the ISO Prolog standard regarding the definition of the {}/1 syntax
584%
585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
586
587{File, Files} :-
588    !,
589    logtalk_load(File),
590    {Files}.
591{File} :-
592    logtalk_load(File).
593
594
595
596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
597%
598%  end!
599%
600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracBrowser for help on using the browser.