|
5.7.1 Operating System interface
register-exit-function! proc | bigloo procedure |
Register proc as an exit functions. Proc is a procedure
accepting of one argument. This argument is the numerical value which
is the status of the exit call. The registered functions are called when the
execution ends.
|
Apply all the registered exit functions then stops an execution,
returning the integer int .
|
signal n proc | bigloo procedure |
Provides a signal handler for the operating system dependent signal
n . proc is a procedure of one argument.
|
get-signal-handler n | bigloo procedure |
Returns the current handler associated with signal n or
#f if no handler is installed.
|
system . strings | bigloo procedure |
Append all the arguments strings and invoke the native host
system command on that new string which returns an integer.
|
system->string . strings | bigloo procedure |
Append all the arguments strings and invoke the native host
system command on that new string. If the command completes,
system->string returns a string made of the output of the
command.
|
getenv string | bigloo procedure |
Returns the string value of the Unix shell's string variable. If no
such variable is bound, getenv returns #f .
|
putenv string val | bigloo procedure |
Adds or modifies the global environment variable string so that
it is bound to val after the call. This facility is not supported
by all back-end. In particular, the JVM back-end does not support it.
|
Returns the current date in a string . See also Date.
|
Sleeps for a delay during at least ms microseconds.
|
command-line | bigloo procedure |
Returns a list of strings which are the Unix command line arguments.
|
executable-name | bigloo procedure |
Returns the name of the running executable.
|
Gives the OS class (e.g. unix).
|
Gives the OS name (e.g. Linux).
|
Gives the host architecture (e.g. i386).
|
os-version | bigloo procedure |
Gives the operating system version (e.g. RedHat 2.0.27).
|
Gives the regular temporary directory (e.g. /tmp).
|
file-separator | bigloo procedure |
Gives the operating system file separator (e.g. #\/).
|
path-separator | bigloo procedure |
Gives the operating system file path separator (e.g.#\:).
|
For additional functions (such as directory->list )
see Input and Output.
unix-path->list | bigloo procedure |
Converts a Unix path to a Bigloo list of strings.
(unix-path->list ".") => (".")
(unix-path->list ".:/usr/bin") => ("." "/usr/bin")
|
|
Returns the fully qualified name of the current host.
|
5.7.2 Files
See Input and Output for file and directory handling. This
section only deals with name handling. Four procedures exist to
manipulate Unix filenames.
basename string | bigloo procedure |
Returns a copy of string where the longest prefix ending in / is
deleted if any existed.
|
prefix string | bigloo procedure |
Returns a copy of string where the suffix starting by
the char #\. is deleted. If no prefix is found,
the result of prefix is a copy of string . For
instance:
(prefix "foo.scm")
=> "foo"
(prefix "./foo.scm")
=> "./foo"
(prefix "foo.tar.gz")
=> "foo.tar"
|
|
suffix string | bigloo procedure |
Returns a new string which is the suffix of string . If no
suffix is found, this function returns an empty string. For instance,
(suffix "foo.scm")
=> "scm"
(suffix "./foo.scm")
=> "scm"
(suffix "foo.tar.gz")
=> "gz"
|
|
dirname string | bigloo procedure |
Returns a new string which is the directory component of string .
For instance:
(dirname "abc/def/ghi")
=> "abc/def"
(dirname "abc")
=> "."
(dirname "abc/")
=> "abc"
(dirname "/abc")
=> "/"
|
|
Returns the current working directory.
|
chdir dir-name | bigloo procedure |
Changes the current directory to dir-name . On success, chdir
returns #t . On failure it returns #f .
|
make-file-name dir-name name | bigloo procedure |
Make an absolute file-name from a directory name dir-name and a relative
name name .
|
make-file-path dir-name name . names | bigloo procedure |
Make an absolute file-name from a directory name dir-name and a relative
name name s.
|
find-file/path name path | bigloo procedure |
Search, in sequence, in the directory list path for the file
name . If name is an absolute name, then path is not
used to find the file. If name is a relative name, the function
make-file-name is used to build absolute name from name and
the directories in path . The current path is not included
automatically in the list of path . In consequence, to check the
current directory one may add "." to the path list. On
success, the absolute file name is returned. On failure,
#f is returned. Example:
(find-file/path "/etc/passwd" '("/toto" "/titi"))
=> "/etc/passwd"
(find-file/path "passwd" '("/toto" "/etc))
=> "/etc/passwd"
(find-file/path "pass-wd" '("." "/etc"))
=> #f
|
|
make-static-library-name name | bigloo procedure |
Make a static library name from
name by adding the static library regular suffix.
|
make-shared-library-name name | bigloo procedure |
Make a shared library name from
name by adding the shared library regular suffix.
|
file-exists? string | bigloo procedure |
This procedure returns #t if the file string exists. Otherwise
it returns #f .
|
delete-file string | bigloo procedure |
Deletes the file named string . The result of this procedure
is #f is the operation succeeded. The result is #t otherwise.
|
rename-file string1 string2 | bigloo procedure |
Renames the file string1 as string2 . The two files have to
be located on the same file system. If the renaming succeeds, the result
is #t , otherwise it is #f .
|
directory? string | bigloo procedure |
This procedure returns #t if the file string exists and is a
directory. Otherwise it returns #f .
|
make-directory string | bigloo procedure |
Creates a new directory named string . It returns #t if the
directory was created. It returns #f otherwise.
|
make-directories string | bigloo procedure |
Creates a new directory named string , including any necessary
but nonexistent parent directories. It returns #t if the
directory was created. It returns #f otherwise. Note that
if this operation fails it may have succeeded in creating some
of the necessary parent directories.
|
delete-directory string | bigloo procedure |
Deletes the directory named string . The directory must be empty
in order to be deleted. The result of this procedure is unspecified.
|
directory->list string | bigloo procedure |
If file string exists and is a directory, this function returns the
list of files in string .
|
file-modification-time string | bigloo procedure |
The date (in second) of the last modification for file string . The
number of seconds is represented by a value that may be converted into
a date by the means of seconds->date (see Date).
|
file-size string | bigloo procedure |
Returns the size (in bytes) for file string .
|
chmod string [option] | bigloo procedure |
Change the access mode of the file named string . The option
must be either a list of the following symbols read , write
and execute or an integer. If the operation succeeds, chmod
returns #t . It returns #f otherwise.
Example:
(chmod (make-file-name (getenv "HOME") ".bigloorc") 'read 'write)
(chmod (make-file-name (getenv "HOME") ".bigloorc") #o777)
|
|
|