5. Bigloo -- Standard Library<BR>5.7 System programming

5. Bigloo -- Standard Library
5.7 System programming

Browsing

Home: Bigloo
A ``practical Scheme compiler''
for Bigloo version 2.5a
April 2002

Previous chapter: Core Language
Next chapter: Pattern Matching


Standard Library

5.1 Scheme Library
5.2 Input and output
5.3 Structures and Records
5.4 Serialization
5.5 Bit manipulation
5.6 Hash Tables
5.7 System programming
5.8 Process support
5.9 Socket support
5.10 Posix Regular Expressions


Chapters

Copyright
Acknowledgements
1. Table of contents
2. Overview of Bigloo
3. Modules
4. Core Language
5. Standard Library
6. Pattern Matching
7. Object System
8. Threads
9. Regular parsing
10. Lalr(1) parsing
11. Errors and Assertions
12. Eval and code interpretation
13. Macro expansion
14. Command Line Parsing
15. Explicit typing
16. The C interface
17. The Java interface
18. Bigloo Libraries
19. SRFIs
20. DSSSL support
21. Compiler description
22. User Extensions
23. Bigloo Development Environment
24. Global Index
25. Library Index
Bibliography


5.7.1 Operating System interface

register-exit-function! procbigloo 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.

exit intbigloo procedure
Apply all the registered exit functions then stops an execution, returning the integer int.

signal n procbigloo procedure
Provides a signal handler for the operating system dependent signal n. proc is a procedure of one argument.

get-signal-handler nbigloo procedure
Returns the current handler associated with signal n or #f if no handler is installed.

system . stringsbigloo procedure
Append all the arguments strings and invoke the native host system command on that new string which returns an integer.

getenv stringbigloo procedure
Returns the string value of the Unix shell's string variable. If no such variable is bound, getenv returns #f.

datebigloo procedure
Returns the current date in a string.

command-linebigloo procedure
Returns a list of strings which are the Unix command line arguments.

executable-namebigloo procedure
Returns the name of the running executable.

os-classbigloo procedure
Gives the OS class (e.g. unix).

os-namebigloo procedure
Gives the OS name (e.g. Linux).

os-archbigloo procedure
Gives the host architecture (e.g. i386).

os-versionbigloo procedure
Gives the operating system version (e.g. RedHat 2.0.27).

os-tmpbigloo procedure
Gives the regular temporary directory (e.g. /tmp).

file-separatorbigloo procedure
Gives the operating system file separator (e.g. #\/).

path-separatorbigloo procedure
Gives the operating system file path separator (e.g.#\:).

For additional functions (such as directory->list) see
Input and Output.

unix-path->listbigloo procedure
Converts a Unix path to a Bigloo list of strings.

(unix-path->list ".")           => (".")
(unix-path->list ".:/usr/bin")  => ("." "/usr/bin")


5.7.2 File name handling

See Input and Output for file and directory handling. This section only deals with name handling. Four procedures exist to manipulate Unix filenames.

basename stringbigloo procedure
Returns a copy of string where the longest prefix ending in / is deleted if any existed.

prefix stringbigloo 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 stringbigloo 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 stringbigloo 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") 
   => "/"

pwdbigloo procedure
Returns the current working directory.

chdir dir-namebigloo procedure
Changes the current directory to dir-name.

make-file-name dir-name namebigloo procedure
Make an absolute file-name from a directory name dir-name and a relative name name.

find-file/path name pathbigloo 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 namebigloo procedure
Make a static library name from name by adding the static library regular suffix.

make-shared-library-name namebigloo procedure
Make a shared library name from name by adding the shared library regular suffix.

file-exists? stringbigloo procedure
This procedure returns #t if the file string exists. Otherwise it returns #f.

delete-file stringbigloo procedure
Deletes the file named string. The result of this procedure is unspecified.

rename-file string1 string2bigloo 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? stringbigloo procedure
This procedure returns #t if the file string exists and is a directory. Otherwise it returns #f.

delete-directory stringbigloo procedure
Deletes the directory named string. The result of this procedure is unspecified.

directory->list stringbigloo procedure
If file string exists and is a directory, this function returns the list of files in string.

file-modification-time stringbigloo procedure
The date (in second) of the last modification for file string.

file-size stringbigloo procedure
Returns the size (in bytes) for file string.



This
Scribe page has been generated by scribeinfo.
Last update Thu Apr 25 09:40:15 2002