Node: System interface, Previous: Output, Up: Input and Output



System interface

load filename R5RS
Filename should be a string naming an existing file containing Scheme expressions. Load has been extended in STKLOS to allow loading of file containing Scheme compiled code as well as object files (aka shared objects). The loading of object files is not available on all architectures. The value returned by load is void.

If the file whose name is filename cannot be located, load will try to find it in one of the directories given by (get-load-path) with the suffixes given by (get-load-suffixes).

try-load filename STKLOS Procedure
try-load tries to load the file named filename. As load, try-load tries to find the file given the current load path and a set of suffixes if filename cannot be loaded. If try-load is able to find a readable file, it is loaded, and try-load returns #t. Otherwise, try-load retuns #f.

load-path STKLOS Procedure
Returns the current load path. The load path is a list of strings which correspond to the directories in which a file must be searched for loading. Directories of the load path are prepended (in their apparition order) to the file name given to load or try-load until the file can be loaded.

The initial value of the current load path can be set from the shell, by setting the STKLOS_LOAD_PATH variable.

set-load-path! new-path STKLOS Procedure
Sets the current load path to the list of strings given in new-path.

load-suffixes STKLOS Procedure
Returns the list of possible suffixes for a Scheme file. Each suffix, must be a string. Suffixes are appended (in their apparition order) to a file name is appended to a file name given to load or try-load until the file can be loaded.

set-load-suffixes! suffixes STKLOS Procedure
Sets the possible suffixes to the list of strings given in suffixes.

find-path str STKLOS Procedure
find-path str path STKLOS Procedure
find-path str path suffixes STKLOS Procedure
In its first form, find-path returns the path name of the file that should be loaded by the procedure load given the name str. The string returned depends of the current load path and of the currently accepted suffixes. The other forms of find-path are more general and allow to give a path list (a list of strings representing supposed directories) and a set of suffixes (given as a list of strings too) to try for finding a file. If no file is found, find-path returns #f.

For instance, on a "classical" Unix box:

          (find-path "passwd" '("/bin" "/etc" "/tmp"))
                      => "/etc/passwd"
          (find-path "stdio" '("/usr" "/usr/include") '("c" "h" "stk"))
                      => "/usr/include/stdio.h"
          

require string STKLOS Procedure
provide string STKLOS Procedure
provided? string STKLOS Procedure
Require loads the file whose name is string if it was not previously "provided". Provide permits to store string in the list of already provided files. Providing a file permits to avoid subsequent loads of this file. Provided? returns #t if string was already provided; it returns #f otherwise.