This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/library/experimental/qp/system.lgt
pmoura b25690af56 Logtalk 2.17.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1071 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2004-06-06 22:46:45 +00:00

108 lines
1.7 KiB
Plaintext

:- 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.