2001-06-06 20:40:57 +01:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% Logtalk - Object oriented extension to Prolog
|
2002-08-01 00:34:42 +01:00
|
|
|
% Release 2.14.1
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
|
|
|
% configuration file for YAP Prolog 4.3.x
|
|
|
|
%
|
2002-05-06 14:10:02 +01:00
|
|
|
% last updated: April 19, 2002
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
|
|
|
% the following initialization is not needed to run Logtalk altough
|
|
|
|
% is recommended; you can comment it out if needed
|
|
|
|
|
|
|
|
:- initialization(
|
|
|
|
(set_prolog_flag(update_semantics, logical),
|
|
|
|
set_prolog_flag(unknown, error))).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% ISO Prolog Standard predicates that we must define because they are
|
|
|
|
% not built-in
|
|
|
|
%
|
|
|
|
% add a clause for lgt_iso_predicate/1 declaring each ISO predicate that
|
|
|
|
% we must define; there must be at least one clause for this predicate
|
|
|
|
% whose call should fail if we don't define any ISO predicates
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_iso_predicate'(?callable).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_iso_predicate'(_) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
fail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% predicate properties
|
|
|
|
%
|
|
|
|
% this predicate must return at least static, dynamic and built_in
|
|
|
|
% properties for an existing predicate
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_predicate_property'(+callable, ?predicate_property)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_predicate_property'(Pred, Prop) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
predicate_property(Pred, Prop).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% metapredicates
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
|
|
|
% forall(+callable, +callble)
|
|
|
|
|
|
|
|
forall(Generate, Test) :-
|
|
|
|
\+ call((Generate, \+ call(Test))).
|
|
|
|
|
|
|
|
|
|
|
|
% lgt_call/2-8
|
|
|
|
%
|
|
|
|
% use these definitions only if your compiler does
|
|
|
|
% not provide call/1-8 as built-in predicates
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2, A3) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2, A3, A4) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2, A3, A4, A5) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2, A3, A4, A5, A6) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5, A6).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_call'(F, A1, A2, A3, A4, A5, A6, A7) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5, A6, A7).
|
|
|
|
|
|
|
|
|
|
|
|
% lgt_once/2-8
|
|
|
|
%
|
|
|
|
% if your compiler provides call/1-8 as built-in
|
|
|
|
% predicates rewrite these definitions using call(...), !.
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2, A3) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2, A3, A4) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2, A3, A4, A5) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2, A3, A4, A5, A6) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5, A6),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_once'(F, A1, A2, A3, A4, A5, A6, A7) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
call_with_args(F, A1, A2, A3, A4, A5, A6, A7),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% file extension predicates
|
|
|
|
%
|
|
|
|
% these extensions are used by Logtalk load/compile predicates
|
|
|
|
%
|
|
|
|
% you may want to change the extension for Prolog files to match
|
|
|
|
% the one expected by your Prolog compiler
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_file_extension'(?atom, ?atom)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_file_extension'(logtalk, '.lgt').
|
|
|
|
'$lgt_file_extension'(prolog, '.pl').
|
|
|
|
'$lgt_file_extension'(xml, '.xml').
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
2002-02-08 19:57:23 +00:00
|
|
|
% default flag values
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_default_flag'(?atom, ?atom)
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
2002-02-08 19:57:23 +00:00
|
|
|
% default values for all flags
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(iso_initialization_dir, true).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(xml, on).
|
|
|
|
'$lgt_default_flag'(xsl, 'lgtxml.xsl').
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(unknown, warning).
|
|
|
|
'$lgt_default_flag'(misspelt, warning).
|
|
|
|
'$lgt_default_flag'(singletons, warning).
|
|
|
|
'$lgt_default_flag'(lgtredef, warning).
|
|
|
|
'$lgt_default_flag'(plredef, silent).
|
|
|
|
'$lgt_default_flag'(portability, silent).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(report, on).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(smart_compilation, off).
|
2002-05-06 14:10:02 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_default_flag'(startup_message, on).
|
|
|
|
|
|
|
|
'$lgt_default_flag'(named_anonymous_vars, off).
|
|
|
|
|
|
|
|
'$lgt_default_flag'(code_prefix, '').
|
2002-05-06 14:10:02 +01:00
|
|
|
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% list predicates
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_append'([], List, List).
|
|
|
|
'$lgt_append'([Head| Tail], List, [Head| Tail2]) :-
|
|
|
|
'$lgt_append'(Tail, List, Tail2).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_member'(Head, [Head| _]).
|
|
|
|
'$lgt_member'(Head, [_| Tail]) :-
|
|
|
|
'$lgt_member'(Head, Tail).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_member_var'(V, [H| _]) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
V == H.
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_member_var'(V, [_| T]) :-
|
|
|
|
'$lgt_member_var'(V, T).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_proper_list'([]).
|
|
|
|
'$lgt_proper_list'([_| List]) :-
|
|
|
|
'$lgt_proper_list'(List).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% file predicates
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_file_exists'(+atom)
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
|
|
|
% see if a file exist in the current directory
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_file_exists'(File) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
exists(File).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_load_prolog_code'(+atom)
|
2001-06-06 20:40:57 +01:00
|
|
|
%
|
|
|
|
% compile and load a Prolog file
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_load_prolog_code'(File) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
reconsult(File).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_compare_file_mtimes'(?atom, +atom, +atom)
|
2002-05-06 14:10:02 +01:00
|
|
|
%
|
|
|
|
% compare file modification times
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_compare_file_mtimes'(Result, File1, File2) :-
|
2002-05-06 14:10:02 +01:00
|
|
|
file_property(File1, mod_time(Time1)),
|
|
|
|
file_property(File2, mod_time(Time2)),
|
|
|
|
compare(Result, Time1, Time2).
|
|
|
|
|
|
|
|
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% sorting predicates
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_keysort'(+list, -list)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_keysort'(List, Sorted) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
keysort(List, Sorted).
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_sort'(+list, -list)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_sort'(List, Sorted) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
sort(List, Sorted).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% time and date predicates
|
|
|
|
%
|
|
|
|
% if your Prolog compiler does not provide access to the operating system
|
|
|
|
% time and date just write dummy definitions
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_current_date'(?Year, ?Month, ?Day)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_current_date'(99, 2, 7).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_current_time'(?Hours, ?Mins, ?Secs)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_current_time'(0, 0, 0).
|
2001-06-06 20:40:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% timing predicate
|
|
|
|
%
|
|
|
|
% if your Prolog compiler does not provide access to a timing predicate
|
|
|
|
% just write dummy definition
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
% '$lgt_cpu_time'(-Seconds)
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2002-08-01 00:34:42 +01:00
|
|
|
'$lgt_cpu_time'(Seconds) :-
|
2001-06-06 20:40:57 +01:00
|
|
|
Seconds is cputime.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% comparison predicate
|
|
|
|
%
|
|
|
|
% the usual compare/3 definition
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
|
|
|
|
% compare(?atom, @term, @term) -- built-in
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%
|
|
|
|
% end!
|
|
|
|
%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|