summaryrefslogtreecommitdiffstats
path: root/plug-ins/script-fu/ftx/ftx-functions.txt
blob: e681261a1e9a633fe5698fd9424a2f35717fefb1 (plain)
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
108
File and Time Extensions for TinyScheme (FTX) 1.0  [August, 2004]

Based on the TinyScheme Extensions (TSX) 1.1  [September, 2002]
(c) 2002 Manuel Heras-Gilsanz (manuel@heras-gilsanz.com)

This software is subject to the license terms contained in the
LICENSE file.


TSX FUNCTIONS

TSX incorporates the following functions:

*File system (included if HAVE_FILESYSTEM is defined in tsx.h)

Scheme already defines functions to read and write files. These
functions allow access to the filesystem to check if a certain
file exists, to get its size, etc.

In addition to these functions, a string constant DIR-SEPARATOR
has been defined. It should be used in scripts which build file
names that include one or more directories to keep the scripts
portable to different operating systems.

(file-exists? filename)
        filename: string

        This function returns #t if the indicated file exists, and
        #f if it does not exist or if it is not accessible to the
        requesting user. Accessibility is based on the real user
        and group ID rather than the effective user ID and group ID.

(file-type filename)
        filename: string

        This function returns a value based on the file type. It
        returns FILE_TYPE_FILE (1) for regular files, FILE_TYPE_DIR
        (2) for directories, and FILE_TYPE_LINK (3) for symbolic
        links. The value FILE_TYPE_OTHER (0) is returned if the file
        is of some other type, does not exist, or if the user does
        not have sufficient privileges to allow the file type to be
        determined.

(file-size filename)
        filename: string

        This function returns the size (in bytes) of the
        indicated file, or #f if the file does not exists or
        is not accessible to the requesting user.

(file-delete filename)
        filename: string

        Removes the specified file. It returns #t if the operation
        succeeds, or #f otherwise (e.g., because the file is
        read-only, or because the file does not exist).

(dir-open-stream path)
        path: string

        Opens a "directory stream" on the provided directory path.
        This stream will provide all the files within the directory,
        using the function read-dir-entry. The stream should be closed
        at the end with dir-close-stream.

(dir-read-entry dirstream)
        dirstream: directory stream, obtained with dir-open-stream.

        It returns the name of the following directory entry, or eof
        if all the entries were provided. Check the return value with
        with eof-object?.

(dir-rewind dirstream)
        dirstream: directory stream, obtained with dir-open-stream.

        Resets the given directory stream. The next call to dir-read-entry
        will return the first entry again. It returns #t if the operation
        succeeds, or #f otherwise (ie. dirstream not valid)..

(dir-close-stream dirstream) 
        dirstream: directory stream, obtained with dir-open-stream.

        Close directory stream. No further calls to read-dir-entry should
        be performed.


*Time (available if HAVE_TIME is defined in tsx.h)

(time)
        Returns the current local time, as a list of integer
        containing:
          (year month day-of-month hour min sec millisec)
        The year is expressed as an offset from 1900.

(gettimeofday)
        Returns a list containing the number of seconds from
        the beginning of the day, and microseconds within the
        current second.

(usleep microsec)
        microsec: integer

        Suspends execution of the calling thread during the
        specified number of microseconds.


END