File: system.lgt

package info (click to toggle)
yap 5.1.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 16,124 kB
  • ctags: 14,650
  • sloc: ansic: 122,796; perl: 22,545; sh: 3,768; java: 1,277; makefile: 1,191; xml: 739; tcl: 624; lisp: 142; awk: 9
file content (107 lines) | stat: -rw-r--r-- 1,784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

:- object(system,
	implements(systemp)).


	:- info([
		version is 1.0,
		author is 'Paulo Moura',
		date is 2004/12/1,
		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) :-
		{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) :-
		{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.