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:
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.
|
||||
Reference in New Issue
Block a user