Logtalk 2.17.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1071 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -9,22 +9,24 @@
|
||||
before_event_registry, after_event_registry,
|
||||
monitorp, monitor,
|
||||
|
||||
event_dbgp, % debugging
|
||||
event_dbgp, % debugging
|
||||
event_dbg,
|
||||
|
||||
subject, % dependents
|
||||
subject, % dependents
|
||||
observer,
|
||||
|
||||
hierarchyp, % hierarchies
|
||||
hierarchyp, % hierarchies
|
||||
proto_hierarchyp, proto_hierarchy,
|
||||
class_hierarchyp, class_hierarchy,
|
||||
|
||||
|
||||
metap, meta, % metapredicates
|
||||
loopp, loop,
|
||||
|
||||
|
||||
randomp, % random
|
||||
random,
|
||||
|
||||
|
||||
systemp, % os interface protocol
|
||||
|
||||
termp, term, % types
|
||||
atomic,
|
||||
atom, callable,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -5,9 +5,9 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
version is 1.1,
|
||||
author is 'Paulo Moura',
|
||||
date is 2000/7/24,
|
||||
date is 2004/5/9,
|
||||
comment is 'Difference list predicates.']).
|
||||
|
||||
|
||||
@@ -178,19 +178,31 @@
|
||||
once(member(Element, List)).
|
||||
|
||||
|
||||
nth(Position, List, Element) :-
|
||||
nth(Element, List, 1, Position).
|
||||
nth0(Position, List, Element) :-
|
||||
nth(Element, List, 0, Position, _).
|
||||
|
||||
|
||||
nth(Element, List-Back, Position, Position) :-
|
||||
nth0(Nth, List, Element, Tail) :-
|
||||
nth(Element, List, 0, Nth, Tail).
|
||||
|
||||
|
||||
nth1(Position, List, Element) :-
|
||||
nth(Element, List, 1, Position, _).
|
||||
|
||||
|
||||
nth1(Nth, List, Element, Tail) :-
|
||||
nth(Element, List, 1, Nth, Tail).
|
||||
|
||||
|
||||
nth(Element, List-Back, Position, Position, Tail-Back) :-
|
||||
List \== Back,
|
||||
List = [Element| _].
|
||||
List = [Element| Tail].
|
||||
|
||||
nth(Element, List-Back, Count, Position) :-
|
||||
nth(Element, List-Back, Count, Position, Tail-Back) :-
|
||||
List \== Back,
|
||||
List = [_| Tail],
|
||||
List = [_| List2],
|
||||
Count2 is Count + 1,
|
||||
nth(Element, Tail-Back, Count2, Position).
|
||||
nth(Element, List2-Back, Count2, Position, Tail-Back).
|
||||
|
||||
|
||||
min(List-Back, Min) :-
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
12
Logtalk/library/experimental/NOTES
Normal file
12
Logtalk/library/experimental/NOTES
Normal file
@@ -0,0 +1,12 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
This folder contains objects, categories, and protocols whose
|
||||
implementation is Prolog-compiler dependent. Each sub-folder
|
||||
contains files specific for a Prolog compiler. All code in this
|
||||
folder is under development, incomplete, and should be considered
|
||||
highly experimental.
|
120
Logtalk/library/experimental/als/system.lgt
Normal file
120
Logtalk/library/experimental/als/system.lgt
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for ALS Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{change_cwd(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{get_cwd(Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{files(Directory, '*', Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{is_absolute_path(File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{path_directory_tail(File, _, Name),
|
||||
file_extension(Name, Base, _)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{path_directory_tail(File, _, Name),
|
||||
file_extension(Name, _, Extension)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{path_directory_tail(File, Directory, _)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{exists_file(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{file_status(File, Status),
|
||||
dmember(mod_time=Time, Status)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_status(File, Status),
|
||||
dmember(size=Size, Status)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{file_status(File, Status),
|
||||
dmember(type=Type, Status)}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_status(File, Status),
|
||||
dmember(permissions=Permissions, Status),
|
||||
member(Permission, Permissions)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{remove_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{datetime(Year/Month/Day, Hours:Mins:Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{Time is cputime}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
100
Logtalk/library/experimental/amzi/system.lgt
Normal file
100
Logtalk/library/experimental/amzi/system.lgt
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
:- use_module(library(system)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for Amzi! Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{mkdir(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{rmdir(Directory, 0)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{chdir(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{curdir(Directory, Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory_files(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{stat(File, _, _, Time, _, _, _, _, _)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{stat(File, _, _, _, Size, _, _, _, _)}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{stat(File, _, _, _, _, Permission, _, _, _)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delfile(File, 0)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{get_env_var(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{date(Year, Month, Day), time(Hours, Mins, Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{Time is cputime}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{current_host(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
101
Logtalk/library/experimental/b/system.lgt
Normal file
101
Logtalk/library/experimental/b/system.lgt
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for B-Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{atom_concat('mkdir ', Directory, Command), system(Command)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{atom_concat('rmdir ', Directory, Command), system(Command)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{chdir(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{atom_concat('rm ', File, Command), system(Command)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{atom_concat('mv ', Old, Temp), atom_concat(' ', New, Command), system(Command)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{environ(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{date(Year, Month, Day), time(Hours, Mins, Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{cputime(Miliseconds), Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
107
Logtalk/library/experimental/bin/system.lgt
Normal file
107
Logtalk/library/experimental/bin/system.lgt
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for Bin Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{atom_concat('mkdir ', Directory, Command), unix(Command)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{atom_concat('rmdir ', Directory, Command), unix(Command)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{cd(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{pwd(Chars), atom_chars(Directory, Chars)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{exists_file(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_size(File, Size)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_permission(File, read) :-
|
||||
{unix_access(File, 4)}.
|
||||
|
||||
file_permission(File, write) :-
|
||||
{unix_access(File, 2)}.
|
||||
|
||||
file_permission(File, execute) :-
|
||||
{unix_access(File, 1)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{atom_concat('rm ', File, Command), unix(Command)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{atom_concat('mv ', Old, Temp), atom_concat(' ', New, Command), unix(Command)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{unix_getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{ctime(Miliseconds), Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{hostname(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
124
Logtalk/library/experimental/ciao/system.lgt
Normal file
124
Logtalk/library/experimental/ciao/system.lgt
Normal file
@@ -0,0 +1,124 @@
|
||||
|
||||
:- use_module(library(system)).
|
||||
:- use_module(library(filenames)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for CIAO.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{make_directory(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete_directory(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{cd(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{working_directory(Directory, Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory_files(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{absolute_file_name(File, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{no_path_file_name_(File, Name),
|
||||
file_name_extension(Name, Base, _)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{no_path_file_name_(File, Name),
|
||||
file_name_extension(Name, _, Extension)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{no_path_file_name_(File, Name),
|
||||
absolute_file_name(File, Full),
|
||||
atom_concat(Directory, Name, Full)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{modif_time(File, Time)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_property(File, size(Size))}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{file_property(File, type(Type))}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_exists(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename_file(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{file_property(File, linkto(Target))}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenvstr(Variable, Codes),
|
||||
atom_codes(Value, Codes)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{atom_codes(Value, Codes),
|
||||
setenvstr(Variable, Codes)}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{datime(datime(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{datime(Time, Year, Month, Day, Hours, Mins, Secs, _, _)}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{statistics(runtime, [Miliseconds| _]),
|
||||
Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{current_host(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
129
Logtalk/library/experimental/eclipse/system.lgt
Normal file
129
Logtalk/library/experimental/eclipse/system.lgt
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
:- use_module(library(calendar)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for ECLiPSe.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{mkdir(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{cd(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{getcwd(Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{read_directory(Directory, "*", _, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
absolute_file_name(File, File).
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{Rel == user ->
|
||||
Abs == user % treat user specially
|
||||
; get_flag(prolog_suffix, Sufs),
|
||||
(existing_file(Rel, Sufs, [], ExtRel) -> true ; ExtRel = Rel),
|
||||
canonical_path_name(ExtRel, Abs)}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{pathname(File, _, Base, _)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{pathname(File, _, _, Extension)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{pathname(File, Directory, _, _)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{get_file_info(File, mtime, Time)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{get_file_info(File, size, Size)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{get_file_info(File, mode, Mode)},
|
||||
Mode /\ 8'170000 =:= Result,
|
||||
file_mode_type(Result, Type).
|
||||
|
||||
file_mode_type(8'100000, regular) :- !.
|
||||
file_mode_type(8'040000, directory) :- !.
|
||||
file_mode_type(8'140000, socket) :- !.
|
||||
file_mode_type(8'120000, symlink) :- !.
|
||||
file_mode_type(_, unknown).
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{mjd_now(MJD),
|
||||
mjd_to_date(MJD, Day/Month/Year),
|
||||
mjd_to_time(MJD, Hours:Mins:Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, _) :-
|
||||
{unix_to_mjd(Time, MJD),
|
||||
mjd_to_date(MJD, Day/Month/Year),
|
||||
mjd_to_time(MJD, Hours:Mins:Secs)}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{cputime(Time)}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{get_flag(hostname, String),
|
||||
atom_string(Name, String)}.
|
||||
|
||||
|
||||
:- end_object.
|
115
Logtalk/library/experimental/gprolog/system.lgt
Normal file
115
Logtalk/library/experimental/gprolog/system.lgt
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for GNU Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{make_directory(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete_directory(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{change_directory(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{working_directory(Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{file_exists(Directory),
|
||||
file_property(File, type(directory))}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory_files(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{absolute_file_name(File, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{decompose_file_name(File, _, Base, _)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{decompose_file_name(File, _, _, Extension)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{decompose_file_name(File, Directory, _, _)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_property(File, size(Size))}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{file_property(File, type(Type))}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_permission(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename_file(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{file_property(File, real_file_name(Target))}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{environ(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{date_time(dt(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{cpu_time(Miliseconds),
|
||||
Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{host_name(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
109
Logtalk/library/experimental/ifprolog/system.lgt
Normal file
109
Logtalk/library/experimental/ifprolog/system.lgt
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
:- use_module(library(system)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for IF/Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{chdir(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{getcwd(Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_test(File, read)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{get_file_info(File, mtime, Time)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{get_file_info(File, size, Size)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{get_file_info(File, mode, Mode)},
|
||||
file_mode_type(Mode, Type).
|
||||
|
||||
file_mode_type(ifreg, regular).
|
||||
file_mode_type(ifdir, directory).
|
||||
file_mode_type(iflnk, symlink).
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_test(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{localtime(time, Year, Month, Day, _, _, Hours, Min, Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, _) :-
|
||||
{localtime(Time, Year, Month, Day, _, _, Hours, Min, Secs)}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{Time is cputime}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{current_host(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
105
Logtalk/library/experimental/k/system.lgt
Normal file
105
Logtalk/library/experimental/k/system.lgt
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for K-Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{atom_concat('mkdir ', Directory, Command), system(Command)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{atom_concat('rmdir ', Directory, Command), system(Command)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{chdir(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{dir(Directory, Files, _)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{atom_concat('rm ', File, Command),
|
||||
system(Command)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{atom_concat('mv ', Old, Temp),
|
||||
atom_concat(Temp, ' ', Temp2),
|
||||
atom_concat(Temp2, New, Command),
|
||||
system(Command)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{time(Secs, Mins, Hours, Day, Month, Year, _, _, _)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{statistics(_, _, _, _, Time, _, _)}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
107
Logtalk/library/experimental/qp/system.lgt
Normal file
107
Logtalk/library/experimental/qp/system.lgt
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for Qu-Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{atom_concat('mkdir ', Directory, Command), os(system(Command))}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{atom_concat('rmdir ', Directory, Command), os(system(Command))}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{chdir(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{access(File, 0, 0)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_permission(File, read) :-
|
||||
{access(File, 4, 0)}.
|
||||
|
||||
file_permission(File, write) :-
|
||||
{access(File, 2, 0)}.
|
||||
|
||||
file_permission(File, execute) :-
|
||||
{access(File, 1, 0)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{atom_concat('rm ', File, Command), os(system(Command))}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{concat_atom([mv, Old, New], ' ', Command), os(system(Command))}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{realtime(RT), localtime(RT, LT), LT = local_time(Year, Month, Day, Hours, Mins, Secs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, _) :-
|
||||
{localtime(Time, LT), LT = local_time(Year, Month, Day, Hours, Mins, Secs)}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{statistics(runtime, [Start,_]), Time is Start/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
102
Logtalk/library/experimental/quintus/system.lgt
Normal file
102
Logtalk/library/experimental/quintus/system.lgt
Normal file
@@ -0,0 +1,102 @@
|
||||
|
||||
:- [library(files)].
|
||||
:- [library(directory)].
|
||||
:- [library(date)].
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for Quintus Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{atom_concat('mkdir ', Directory, Command), unix(Command)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{atom_concat('rmdir ', Directory, Command), unix(Command)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{unix(cd(Directory))}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{file_members_of_directory(Directory, '*', Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{absolute_file_name(File, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_property(File, size, Size)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{file_property(File, type, Type)}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_exists(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename_file(Old, New)}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{date(date(Day, Month, Year)), time(time(Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{statistics(runtime, [Miliseconds| _]), Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
100
Logtalk/library/experimental/sicstus/system.lgt
Normal file
100
Logtalk/library/experimental/sicstus/system.lgt
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
:- use_module(library(system)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for SICStus Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{make_directory(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete_file(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{working_directory(_, Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{working_directory(Directory, Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory_files(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{absolute_file_name(File, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{file_property(File, mod_time(Size))}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_property(File, size(Size))}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_exists(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename_file(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{environ(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{datime(datime(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, _) :-
|
||||
{datime(Time, datime(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{statistics(runtime, [Miliseconds| _]), Time is Miliseconds/1000}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{host_name(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
120
Logtalk/library/experimental/swi/system.lgt
Normal file
120
Logtalk/library/experimental/swi/system.lgt
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for SWI-Prolog.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{make_directory(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete_directory(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{working_directory(_, Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{working_directory(Directory, Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{exists_directory(Directory)}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{is_absolute_file_name(File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{file_base_name(File, Name),
|
||||
file_name_extension(Base, _, Name)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{file_base_name(File, Name),
|
||||
file_name_extension(_, Extension, Name)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{file_directory_name(File, Directory)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{exists_file(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{time_file(File, Time)}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{size_file(File, Size)}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{access_file(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename_file(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{read_link(File, _, Target)}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{getenv(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{setenv(Variable, Value)}.
|
||||
|
||||
|
||||
time_stamp(Time) :-
|
||||
{get_time(Time)}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{get_time(Time),
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs)}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs)}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{Time is cputime}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
122
Logtalk/library/experimental/xsb/system.lgt
Normal file
122
Logtalk/library/experimental/xsb/system.lgt
Normal file
@@ -0,0 +1,122 @@
|
||||
|
||||
:- import path_sysop/2, path_sysop/3 from file_io.
|
||||
:- import datime/1 from standard.
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for XSB.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{path_sysop(mkdir, Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{path_sysop(rmdir, Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{path_sysop(chdir, Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{path_sysop(cwd, Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{path_sysop(isdir, Directory)
|
||||
path_sysop(exists, Directory)}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{path_sysop(isabsolute, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{path_sysop(expand, File, Full)}.
|
||||
|
||||
|
||||
file_base_name(File, Base) :-
|
||||
{path_sysop(basename, File, Base)}.
|
||||
|
||||
|
||||
file_name_extension(File, Extension) :-
|
||||
{path_sysop(extension, File, Extension)}.
|
||||
|
||||
|
||||
file_name_directory(File, Directory) :-
|
||||
{path_sysop(dirname, File, Directory)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{path_sysop(isplain, File)
|
||||
path_sysop(exists, File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{path_sysop(modtime, File, [High, Low]),
|
||||
Time is Low + High * 2 ** 24}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{path_sysop(size, File, Size)}.
|
||||
|
||||
|
||||
file_permission(File, read) :-
|
||||
{path_sysop(readable, File)}.
|
||||
|
||||
file_permission(File, write) :-
|
||||
{path_sysop(writable, File)}.
|
||||
|
||||
file_permission(File, execute) :-
|
||||
{path_sysop(executable, File)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{path_sysop(rm, Directory)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{path_sysop(rename, Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{datime(datime(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{cputime(Time)}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
:- end_object.
|
104
Logtalk/library/experimental/yap/system.lgt
Normal file
104
Logtalk/library/experimental/yap/system.lgt
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
:- use_module(library(system)).
|
||||
|
||||
|
||||
:- object(system,
|
||||
implements(systemp)).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/5,
|
||||
comment is 'Operating system interface for YAP.']).
|
||||
|
||||
|
||||
make_directory(Directory) :-
|
||||
{make_directory(Directory)}.
|
||||
|
||||
|
||||
delete_directory(Directory) :-
|
||||
{delete_file(Directory)}.
|
||||
|
||||
|
||||
change_directory(Directory) :-
|
||||
{cd(Directory)}.
|
||||
|
||||
|
||||
working_directory(Directory) :-
|
||||
{getcwd(Directory)}.
|
||||
|
||||
|
||||
directory_exists(Directory) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
directory_files(Directory, Files) :-
|
||||
{directory_files(Directory, Files)}.
|
||||
|
||||
|
||||
absolute_file_name(File) :-
|
||||
{absolute_file_name(File, File)}.
|
||||
|
||||
|
||||
absolute_file_name(File, Full) :-
|
||||
{absolute_file_name(File, Full)}.
|
||||
|
||||
|
||||
file_exists(File) :-
|
||||
{file_exists(File)}.
|
||||
|
||||
|
||||
file_modification_time(File, Time) :-
|
||||
{file_property(File, mod_time(Time))}.
|
||||
|
||||
|
||||
file_size(File, Size) :-
|
||||
{file_property(File, size(Size))}.
|
||||
|
||||
|
||||
file_type(File, Type) :-
|
||||
{file_property(File, type(Type))}.
|
||||
|
||||
|
||||
file_permission(File, Permission) :-
|
||||
{file_exists(File, Permission)}.
|
||||
|
||||
|
||||
delete_file(File) :-
|
||||
{delete_file(File)}.
|
||||
|
||||
|
||||
rename_file(Old, New) :-
|
||||
{rename(Old, New)}.
|
||||
|
||||
|
||||
symbolic_link(File, Target) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
environment_variable(Variable, Value) :-
|
||||
{environ(Variable, Value)}.
|
||||
|
||||
|
||||
set_environment_variable(Variable, Value) :-
|
||||
{putenv(Variable, Value)}.
|
||||
|
||||
|
||||
date_time(Year, Month, Day, Hours, Mins, Secs, 0) :-
|
||||
{datime(datime(Year, Month, Day, Hours, Mins, Secs))}.
|
||||
|
||||
|
||||
convert_time(Time, Year, Month, Day, Hours, Mins, Secs, Milisecs) :-
|
||||
{fail}.
|
||||
|
||||
|
||||
cpu_time(Time) :-
|
||||
{Time is cputime}.
|
||||
|
||||
|
||||
host_name(Name) :-
|
||||
{host_name(Name)}.
|
||||
|
||||
|
||||
:- end_object.
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -5,9 +5,9 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.1,
|
||||
version is 1.2,
|
||||
author is 'Paulo Moura',
|
||||
date is 2003/4/25,
|
||||
date is 2004/5/9,
|
||||
comment is 'List predicates.']).
|
||||
|
||||
|
||||
@@ -152,15 +152,33 @@
|
||||
new([]).
|
||||
|
||||
|
||||
nth(Nth, List, Element) :-
|
||||
nth(Element, List, 1, Nth).
|
||||
nextto(X, Y, [X, Y| _]).
|
||||
|
||||
nextto(X, Y, [_| Tail]) :-
|
||||
nextto(X, Y, Tail).
|
||||
|
||||
|
||||
nth(Head, [Head| _], Position, Position).
|
||||
nth0(Nth, List, Element) :-
|
||||
nth(Element, List, 0, Nth, _).
|
||||
|
||||
nth(Head, [_| Tail], Count, Position) :-
|
||||
|
||||
nth0(Nth, List, Element, Tail) :-
|
||||
nth(Element, List, 0, Nth, Tail).
|
||||
|
||||
|
||||
nth1(Nth, List, Element) :-
|
||||
nth(Element, List, 1, Nth, _).
|
||||
|
||||
|
||||
nth1(Nth, List, Element, Tail) :-
|
||||
nth(Element, List, 1, Nth, Tail).
|
||||
|
||||
|
||||
nth(Head, [Head| Tail], Position, Position, Tail).
|
||||
|
||||
nth(Head, [_| List], Count, Position, Tail) :-
|
||||
Count2 is Count + 1,
|
||||
nth(Head, Tail, Count2, Position).
|
||||
nth(Head, List, Count2, Position, Tail).
|
||||
|
||||
|
||||
permutation(List, Permutation) :-
|
||||
|
@@ -3,9 +3,9 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.1,
|
||||
version is 1.2,
|
||||
author is 'Paulo Moura',
|
||||
date is 2003/4/17,
|
||||
date is 2004/5/9,
|
||||
comment is 'List protocol.']).
|
||||
|
||||
|
||||
@@ -117,15 +117,51 @@
|
||||
argnames is ['List', 'Minimum']]).
|
||||
|
||||
|
||||
:- public(nth/3).
|
||||
:- public(nextto/3).
|
||||
|
||||
:- mode(nth(?integer, +list, ?term), zero_or_more).
|
||||
:- mode(nextto(?term, ?term, ?list), zero_or_more).
|
||||
|
||||
:- info(nth/3, [
|
||||
comment is 'Nth element of a list.',
|
||||
:- info(nextto/3, [
|
||||
comment is 'X and Y are consecutive elements in List.',
|
||||
argnames is ['X', 'Y', 'List']]).
|
||||
|
||||
|
||||
:- public(nth0/3).
|
||||
|
||||
:- mode(nth0(?integer, ?list, ?term), zero_or_more).
|
||||
|
||||
:- info(nth0/3, [
|
||||
comment is 'Nth element of a list (counting from zero).',
|
||||
argnames is ['Nth', 'List', 'Element']]).
|
||||
|
||||
|
||||
:- public(nth0/4).
|
||||
|
||||
:- mode(nth0(?integer, ?list, ?term, ?list), zero_or_more).
|
||||
|
||||
:- info(nth0/4, [
|
||||
comment is 'Nth element of a list (counting from zero).',
|
||||
argnames is ['Nth', 'List', 'Element', 'Residue']]).
|
||||
|
||||
|
||||
:- public(nth1/3).
|
||||
|
||||
:- mode(nth1(?integer, ?list, ?term), zero_or_more).
|
||||
|
||||
:- info(nth1/3, [
|
||||
comment is 'Nth element of a list (counting from one).',
|
||||
argnames is ['Nth', 'List', 'Element']]).
|
||||
|
||||
|
||||
:- public(nth1/4).
|
||||
|
||||
:- mode(nth1(?integer, ?list, ?term, ?list), zero_or_more).
|
||||
|
||||
:- info(nth1/4, [
|
||||
comment is 'Nth element of a list (counting from zero).',
|
||||
argnames is ['Nth', 'List', 'Element', 'Residue']]).
|
||||
|
||||
|
||||
:- public(permutation/2).
|
||||
|
||||
:- mode(permutation(?list, ?list), zero_or_more).
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,111 +1,361 @@
|
||||
|
||||
|
||||
:- protocol(systemp).
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
version is 1.3,
|
||||
author is 'Paulo Moura',
|
||||
date is 2002/8/4,
|
||||
comment is 'Operating system protocol.']).
|
||||
|
||||
date is 2004/6/4,
|
||||
comment is 'Operating system access protocol.']).
|
||||
|
||||
:- public(make_directory/1).
|
||||
|
||||
:- mode(make_directory(+atom), zero_or_one).
|
||||
|
||||
:- info(make_directory/1, [
|
||||
comment is 'Make a new directory.',
|
||||
argnames is ['Directory']]).
|
||||
|
||||
comment is 'Makes a new directory.',
|
||||
argnames is ['Directory'],
|
||||
exceptions is [
|
||||
'Argument is not instantiated' - instantiation_error,
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory'),
|
||||
'No permission for creating a new directory' - permission_error(modify, 'Directory')]]).
|
||||
|
||||
:- public(delete_directory/1).
|
||||
|
||||
:- mode(delete_directory(+atom), zero_or_one).
|
||||
|
||||
:- info(delete_directory/1, [
|
||||
comment is 'Delete a directory.',
|
||||
argnames is ['Directory']]).
|
||||
|
||||
comment is 'Deletes a directory.',
|
||||
argnames is ['Directory'],
|
||||
exceptions is [
|
||||
'Argument is not instantiated' - instantiation_error,
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory'),
|
||||
'No permission for deleting the directory' - permission_error(modify, 'Directory')]]).
|
||||
|
||||
:- public(change_directory/1).
|
||||
|
||||
:- mode(change_directory(+atom), zero_or_one).
|
||||
|
||||
:- info(change_directory/1, [
|
||||
comment is 'Change working directory.',
|
||||
argnames is ['Directory']]).
|
||||
|
||||
comment is 'Changes current working directory.',
|
||||
argnames is ['Directory'],
|
||||
exceptions is [
|
||||
'Argument is not instantiated' - instantiation_error,
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory'),
|
||||
'No permission for accessing the directory' - permission_error(access, 'Directory')]]).
|
||||
|
||||
:- public(working_directory/1).
|
||||
|
||||
:- mode(working_directory(?atom), zero_or_one).
|
||||
|
||||
:- info(working_directory/1, [
|
||||
comment is 'Current working directory.',
|
||||
argnames is ['Directory']]).
|
||||
argnames is ['Directory'],
|
||||
exceptions is [
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory')]]).
|
||||
|
||||
:- public(directory_exists/1).
|
||||
:- mode(directory_exists(+atom), zero_or_one).
|
||||
:- info(directory_exists/1, [
|
||||
comment is 'True if the specified directory exists.',
|
||||
argnames is ['Directory'],
|
||||
exceptions is [
|
||||
'Argument is not instantiated' - instantiation_error,
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory'),
|
||||
'No access permission for the directory' - permission_error(access, 'Directory')]]).
|
||||
|
||||
:- public(directory_files/2).
|
||||
|
||||
:- mode(directory_files(+atom, -list), zero_or_one).
|
||||
|
||||
:- info(directory_files/2, [
|
||||
comment is 'List of all directory files.',
|
||||
argnames is ['Directory', 'Files']]).
|
||||
|
||||
comment is 'List of all directory files. Returns an empty list if the directory is empty.',
|
||||
argnames is ['Directory', 'Files'],
|
||||
exceptions is [
|
||||
'Directory is not instantiated' - instantiation_error,
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory'),
|
||||
'No access permission for the directory' - permission_error(access, 'Directory'),
|
||||
'Directory does not exists' - existence_error('Directory')]]).
|
||||
|
||||
:- public(file_exists/1).
|
||||
|
||||
:- mode(file_exists(+atom), zero_or_one).
|
||||
|
||||
:- info(file_exists/1, [
|
||||
comment is 'True if the specified file exists.',
|
||||
argnames is ['File']]).
|
||||
argnames is ['File'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- public(file_modification_time/2).
|
||||
:- mode(file_modification_time(+atom, -nonvar), zero_or_one).
|
||||
:- info(file_modification_time/2, [
|
||||
comment is 'File modification time using a system-dependent time stamp.',
|
||||
argnames is ['File', 'Time'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- public(file_property/2).
|
||||
:- public(file_size/2).
|
||||
:- mode(file_size(+atom, -integer), zero_or_one).
|
||||
:- info(file_size/2, [
|
||||
comment is 'File size in bytes.',
|
||||
argnames is ['File', 'Size'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- mode(file_property(+atom, ?nonvar), zero_or_more).
|
||||
|
||||
:- info(file_property/2, [
|
||||
comment is 'Access to file properties. Fails if the file does not exist or is not user readable.',
|
||||
argnames is ['File', 'Property']]).
|
||||
:- public(file_type/2).
|
||||
:- mode(file_type(+atom, ?atom), zero_or_one).
|
||||
:- info(file_type/2, [
|
||||
comment is 'File type (regular, directory, symlink, fifo, socket, and unknown).',
|
||||
argnames is ['File', 'Type'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Type is neither a variable nor a valid file type' - type_error(file_type, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- public(file_permission/2).
|
||||
:- mode(file_permission(+atom, ?atom), zero_or_more).
|
||||
:- info(file_permission/2, [
|
||||
comment is 'File permission (read, write, execute, and search).',
|
||||
argnames is ['File', 'Permission'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Permission is neither a variable nor a valid file permission' - type_error(file_permission, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- public(delete_file/1).
|
||||
|
||||
:- mode(delete_file(+atom), zero_or_one).
|
||||
|
||||
:- info(delete_file/1, [
|
||||
comment is 'Deletes a file.',
|
||||
argnames is ['File']]).
|
||||
|
||||
argnames is ['File'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'No write permission to the file' - permission_error(modify, 'File')]]).
|
||||
|
||||
:- public(rename_file/2).
|
||||
|
||||
:- mode(rename_file(+atom, +atom), zero_or_one).
|
||||
|
||||
:- info(rename_file/2, [
|
||||
comment is 'Renames a file. Fails if the file does not exist or cannot be renamed.',
|
||||
argnames is ['Old', 'New']]).
|
||||
comment is 'Renames a file.',
|
||||
argnames is ['Old', 'New'],
|
||||
exceptions is [
|
||||
'Old is not instantiated' - instantiation_error,
|
||||
'New is not instantiated' - instantiation_error,
|
||||
'Old is neither a variable nor a valid file name' - type_error(file_name, 'Old'),
|
||||
'New is neither a variable nor a valid file name' - type_error(file_name, 'New'),
|
||||
'File Old does not exists' - existence_error('Old'),
|
||||
'No write permission to the file' - permission_error(modify, 'Old')]]).
|
||||
|
||||
:- public(copy_file/2).
|
||||
:- mode(copy_file(+atom, +atom), zero_or_one).
|
||||
:- info(copy_file/2, [
|
||||
comment is 'Makes a copy of a file.',
|
||||
argnames is ['Original', 'Copy'],
|
||||
exceptions is [
|
||||
'Original is not instantiated' - instantiation_error,
|
||||
'Copy is not instantiated' - instantiation_error,
|
||||
'Original is neither a variable nor a valid file name' - type_error(file_name, 'Original'),
|
||||
'Copy is neither a variable nor a valid file name' - type_error(file_name, 'Copy'),
|
||||
'File Original does not exists' - existence_error('Original'),
|
||||
'No read permission to the file' - permission_error(read, 'Original')]]).
|
||||
|
||||
:- public(environment/2).
|
||||
:- public(symbolic_link/2).
|
||||
:- mode(symbolic_link(+atom, -atom), zero_or_one).
|
||||
:- info(symbolic_link/2, [
|
||||
comment is 'Follows a symbolic link returning the target full path.',
|
||||
argnames is ['File', 'Target'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'No access permission to the file' - permission_error(access, 'File')]]).
|
||||
|
||||
:- mode(environment(?atom, ?atom), zero_or_more).
|
||||
:- public(environment_variable/2).
|
||||
:- mode(environment_variable(+atom, ?atom), zero_or_one).
|
||||
:- info(environment_variable/2, [
|
||||
comment is 'Gets environment variable value.',
|
||||
argnames is ['Variable', 'Value'],
|
||||
exceptions is [
|
||||
'Variable is not instantiated' - instantiation_error,
|
||||
'Variable is neither a variable nor an atom' - type_error(atom, 'Variable'),
|
||||
'Value is neither a variable nor an atom' - type_error(atom, 'Value')]]).
|
||||
|
||||
:- info(environment/2, [
|
||||
comment is 'Environment variable value.',
|
||||
argnames is ['Variable', 'Value']]).
|
||||
:- public(set_environment_variable/2).
|
||||
:- mode(set_environment_variable(+atom, +atom), zero_or_one).
|
||||
:- info(set_environment_variable/2, [
|
||||
comment is 'Sets environment variable value.',
|
||||
argnames is ['Variable', 'Value'],
|
||||
exceptions is [
|
||||
'Variable is not instantiated' - instantiation_error,
|
||||
'Value is not instantiated' - instantiation_error,
|
||||
'Variable is neither a variable nor an atom' - type_error(atom, 'Variable'),
|
||||
'Value is neither a variable nor an atom' - type_error(atom, 'Value')]]).
|
||||
|
||||
:- public(time_stamp/1).
|
||||
:- mode(time_stamp(-number), one).
|
||||
:- info(time_stamp/1, [
|
||||
comment is 'Returns the current system-dependent time stamp.',
|
||||
argnames is ['Time']]).
|
||||
|
||||
:- public(date_time/6).
|
||||
:- public(date_time/7).
|
||||
:- mode(date_time(?integer, ?integer, ?integer, ?integer, ?integer, ?integer, ?integer), zero_or_one).
|
||||
:- info(date_time/7, [
|
||||
comment is 'Current calendar date and time.',
|
||||
argnames is ['Year', 'Month', 'Day', 'Hours', 'Mins', 'Secs', 'Milisecs']]).
|
||||
|
||||
:- mode(date_time(?integer, ?integer, ?integer, ?integer, ?integer, ?integer), zero_or_one).
|
||||
:- public(convert_time/8).
|
||||
:- mode(convert_time(+number, ?integer, ?integer, ?integer, ?integer, ?integer, ?integer), zero_or_one).
|
||||
:- info(convert_time/8, [
|
||||
comment is 'Converts a system-dependent time stamp to calendar local date and time.',
|
||||
argnames is ['Time', 'Year', 'Month', 'Day', 'Hours', 'Mins', 'Secs', 'Milisecs'],
|
||||
exceptions is [
|
||||
'Time is not instantiated' - instantiation_error,
|
||||
'Time is neither a variable nor a valid time stamp' - type_error(time_stamp, 'Variable')]]).
|
||||
|
||||
:- info(date_time/6, [
|
||||
comment is 'System date and time.',
|
||||
argnames is ['Year', 'Month', 'Day', 'Hour', 'Min', 'Sec']]).
|
||||
:- public(cpu_time/1).
|
||||
:- mode(cpu_time(-number), zero_or_one).
|
||||
:- info(cpu_time/1, [
|
||||
comment is 'System cpu time in seconds.',
|
||||
argnames is ['Time']]).
|
||||
|
||||
:- public(host_name/1).
|
||||
:- mode(host_name(-atom), one).
|
||||
:- info(host_name/1, [
|
||||
comment is 'Host name.',
|
||||
argnames is ['Name']]).
|
||||
|
||||
:- public(canonical_os_path/2).
|
||||
:- mode(canonical_os_path(+atom, -atom), one).
|
||||
:- mode(canonical_os_path(-atom, +atom), one).
|
||||
:- info(canonical_os_path/2, [
|
||||
comment is 'Converts between canonical and operating system dependent paths.',
|
||||
argnames is ['Canonical', 'OS']]).
|
||||
|
||||
:- public(canonical_path/3).
|
||||
:- mode(canonical_path(+atom, -atom, -atom), zero_or_one).
|
||||
:- mode(canonical_path(-atom, +atom, -atom), zero_or_one).
|
||||
:- mode(canonical_path(-atom, -atom, +atom), zero_or_one).
|
||||
:- info(canonical_path/3, [
|
||||
comment is 'Converts between relative, absolute, and full canonical paths.',
|
||||
argnames is ['Relative', 'Absolute', 'Full'],
|
||||
exceptions is [
|
||||
'None of the arguments is instantiated' - instantiation_error,
|
||||
'Relative is neither a variable nor a relative path' - type_error(relative_file_name, 'Relative'),
|
||||
'Absolute is neither a variable nor a absolute path' - type_error(absolute_path, 'Absolute'),
|
||||
'Full is neither a variable nor a full path' - type_error(full_file_name, 'Full')]]).
|
||||
|
||||
:- public(relative_file_name/1).
|
||||
:- mode(relative_file_name(+atom), zero_or_one).
|
||||
:- info(relative_file_name/1, [
|
||||
comment is 'True when the argument is a valid, relative file name.',
|
||||
argnames is ['File'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File')]]).
|
||||
|
||||
:- public(absolute_file_name/1).
|
||||
:- mode(absolute_file_name(+atom), zero_or_one).
|
||||
:- info(absolute_file_name/1, [
|
||||
comment is 'True if the argument is a valid, absolute file name.',
|
||||
argnames is ['File'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File')]]).
|
||||
|
||||
:- public(full_file_name/1).
|
||||
:- mode(full_file_name(+atom), zero_or_one).
|
||||
:- info(full_file_name/1, [
|
||||
comment is 'True when the argument is a valid, full file name.',
|
||||
argnames is ['File'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File')]]).
|
||||
|
||||
:- public(absolute_file_name/2).
|
||||
:- mode(absolute_file_name(+atom, ?atom), zero_or_one).
|
||||
:- info(absolute_file_name/2, [
|
||||
comment is 'Expands a file name into an absolute file name.',
|
||||
argnames is ['File', 'Absolute'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Absolute is neither a variable nor a valid file name' - type_error(file_name, 'Absolute')]]).
|
||||
|
||||
:- public(full_file_name/2).
|
||||
:- mode(full_file_name(+atom, ?atom), zero_or_one).
|
||||
:- info(full_file_name/2, [
|
||||
comment is 'Expands a file name into a full file name.',
|
||||
argnames is ['File', 'Full'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Full is neither a variable nor a valid file name' - type_error(file_name, 'Full')]]).
|
||||
|
||||
:- public(file_name_extension/2).
|
||||
:- mode(file_name_extension(+atom, ?atom), zero_or_one).
|
||||
:- info(file_name_extension/2, [
|
||||
comment is 'Extracts a file name extension (without the dot). Returns the empty atom if no extension exists.',
|
||||
argnames is ['File', 'Extension'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Extension is neither a variable nor an atom' - type_error(atom, 'Extension')]]).
|
||||
|
||||
:- public(file_base_name/2).
|
||||
:- mode(file_base_name(+atom, ?atom), zero_or_one).
|
||||
:- info(file_base_name/2, [
|
||||
comment is 'Extracts a file base name.',
|
||||
argnames is ['File', 'Base'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Base is neither a variable nor an atom' - type_error(atom, 'Base')]]).
|
||||
|
||||
:- public(file_name_directory/2).
|
||||
:- mode(file_name_directory(+atom, ?atom), zero_or_one).
|
||||
:- info(file_name_directory/2, [
|
||||
comment is 'Extracts a file name directory (ends with the directory path separator).',
|
||||
argnames is ['File', 'Directory'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Directory is neither a variable nor a valid file name' - type_error(file_name, 'Directory')]]).
|
||||
|
||||
:- public(file_name_protocol/2).
|
||||
:- mode(file_name_protocol(+atom, ?atom), zero_or_one).
|
||||
:- info(file_name_protocol/2, [
|
||||
comment is 'Extracts a file name access protocol.',
|
||||
argnames is ['File', 'Protocol'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Protocol is neither a variable nor a valid file access protocol' - type_error(file_protocol, 'Protocol')]]).
|
||||
|
||||
:- public(file_name_login/3).
|
||||
:- mode(file_name_login(+atom, ?atom, ?atom), zero_or_one).
|
||||
:- info(file_name_login/3, [
|
||||
comment is 'Extracts the username and the password from a file name.',
|
||||
argnames is ['File', 'User', 'Password'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'User is neither a variable nor an atom' - type_error(atom, 'User'),
|
||||
'Password is neither a variable nor an atom' - type_error(atom, 'Password')]]).
|
||||
|
||||
:- public(file_name_host/3).
|
||||
:- mode(file_name_host(+atom, ?atom, ?float), zero_or_one).
|
||||
:- info(file_name_host/3, [
|
||||
comment is 'Extracts the host name and the host port from a file name.',
|
||||
argnames is ['File', 'Host', 'Port'],
|
||||
exceptions is [
|
||||
'File is not instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Host is neither a variable nor an atom' - type_error(atom, 'Host'),
|
||||
'Port is neither a variable nor an integer' - type_error(integer, 'Port')]]).
|
||||
|
||||
:- public(file_name_parts/2).
|
||||
:- mode(file_name_parts(+atom, -list), one).
|
||||
:- mode(file_name_parts(-atom, +list), zero_or_one).
|
||||
:- info(file_name_parts/2, [
|
||||
comment is 'Converts between a file name and its constituent parts (represented as a list of compound terms).',
|
||||
argnames is ['File', 'Parts'],
|
||||
exceptions is [
|
||||
'None of the arguments are instantiated' - instantiation_error,
|
||||
'File is neither a variable nor a valid file name' - type_error(file_name, 'File'),
|
||||
'Parts is neither a variable nor a list' - type_error(list, 'Host')]]).
|
||||
|
||||
:- end_protocol.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.17.0
|
||||
Release 2.17.1
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
Reference in New Issue
Block a user