1
File and Time Extensions for TinyScheme (FTX) 1.0 [August, 2004]
3
Based on the TinyScheme Extensions (TSX) 1.1 [September, 2002]
4
(c) 2002 Manuel Heras-Gilsanz (manuel@heras-gilsanz.com)
6
This software is subject to the license terms contained in the
12
TSX incorporates the following functions:
14
*File system (included if HAVE_FILESYSTEM is defined in tsx.h)
16
Scheme already defines functions to read and write files. These
17
functions allow access to the filesystem to check if a certain
18
file exists, to get its size, etc.
20
In addition to these functions, a string constant DIR-SEPARATOR
21
has been defined. It should be used in scripts which build file
22
names that include one or more directories to keep the scripts
23
portable to different operating systems.
25
(file-exists? filename)
28
This function returns #t if the indicated file exists, and
29
#f if it does not exist or if it is not accessible to the
30
requesting user. Accessibility is based on the real user
31
and group ID rather than the effective user ID and group ID.
36
This function returns a value based on the file type. It
37
returns FILE_TYPE_FILE (1) for regular files, FILE_TYPE_DIR
38
(2) for directories, and FILE_TYPE_LINK (3) for symbolic
39
links. The value FILE_TYPE_OTHER (0) is returned if the file
40
is of some other type, does not exist, or if the user does
41
not have sufficient priveleges to allow the file type to be
47
This function returns the size (in bytes) of the
48
indicated file, or #f if the file does not exists or
49
is not accessible to the requesting user.
51
(file-delete filename)
54
Removes the specified file. It returns #t if the operation
55
succeeds, or #f otherwise (e.g., because the file is
56
read-only, or because the file does not exist).
58
(dir-open-stream path)
61
Opens a "directory stream" on the provided directory path.
62
This stream will provide all the files within the directory,
63
using the function read-dir-entry. The stream should be closed
64
at the end with dir-close-stream.
66
(dir-read-entry dirstream)
67
dirstream: directory stream, obtained with dir-open-stream.
69
It returns the name of the following directory entry, or eof
70
if all the entries were provided. Check the return value with
73
(dir-rewind dirstream)
74
dirstream: directory stream, obtained with dir-open-stream.
76
Resets the given directory stream. The next call to dir-read-entry
77
will return the first entry again. It returns #t if the operation
78
succeeds, or #f otherwise (ie. dirstream not valid)..
80
(dir-close-stream dirstream)
81
dirstream: directory stream, obtained with dir-open-stream.
83
Close directory stream. No further calls to read-dir-entry should
87
*Time (available if HAVE_TIME is defined in tsx.h)
90
Returns the current local time, as a list of integer
92
(year month day-of-month hour min sec millisec)
93
The year is expressed as an offsett from 1900.
96
Returns a list containing the number of seconds from
97
the beginning of the day, and microseconds within the
103
Suspends execution of the calling thread during the
104
specified number of microseconds.