[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The procedures described in these sections are supported by all implementations as part of the ‘*.init’ files or by ‘require.scm’.
2.1 Vicinity | Pathname Management | |
2.2 Configuration | Characteristics of Scheme Implementation | |
2.3 Input/Output | Things not provided by the Scheme specs. | |
2.4 System | LOADing, EVALing, ERRORing, and EXITing | |
2.5 Miscellany |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A vicinity is a descriptor for a place in the file system. Vicinities hide from the programmer the concepts of host, volume, directory, and version. Vicinities express only the concept of a file environment where a file name can be resolved to a file in a system independent manner. Vicinities can even be used on flat file systems (which have no directory structure) by having the vicinity express constraints on the file name.
All of these procedures are file-system dependent. Use of these vicinity procedures can make programs file-system independent.
These procedures are provided by all implementations. On most systems a vicinity is a string.
Returns dirpath as a vicinity for use as first argument to
in-vicinity
.
Returns the vicinity containing path.
(pathname->vicinity "/usr/local/lib/scm/Link.scm") ⇒ "/usr/local/lib/scm/" |
Returns the vicinity of the currently loading Scheme code. For an
interpreter this would be the directory containing source code. For a
compiled system (with multiple files) this would be the directory
where the object or executable files are. If no file is currently
loading, then the result is undefined. Warning:
program-vicinity
can return incorrect values if your program
escapes back into a load
continuation.
Returns the vicinity of the shared Scheme library.
Returns the vicinity of the underlying Scheme implementation. This vicinity will likely contain startup code and messages and a compiler.
Returns the vicinity of the current directory of the user. On most systems this is ‘""’ (the empty string).
Returns the vicinity of the user’s HOME directory, the directory
which typically contains files which customize a computer environment
for a user. If scheme is running without a user (eg. a daemon) or if
this concept is meaningless for the platform, then home-vicinity
returns #f
.
Returns the ‘#t’ if chr is a vicinity suffix character; and
#f
otherwise. Typical vicinity suffixes are ‘/’,
‘:’, and ‘\’,
Returns a filename suitable for use by slib:load
,
slib:load-source
, slib:load-compiled
,
open-input-file
, open-output-file
, etc. The returned
filename is filename in vicinity. in-vicinity
should
allow filename to override vicinity when filename is
an absolute pathname and vicinity is equal to the value of
(user-vicinity)
. The behavior of in-vicinity
when
filename is absolute and vicinity is not equal to the value
of (user-vicinity)
is unspecified. For most systems
in-vicinity
can be string-append
.
Returns the vicinity of vicinity restricted to name. This
is used for large systems where names of files in subsystems could
conflict. On systems with directory structure sub-vicinity
will
return a pathname of the subdirectory name of
vicinity.
path should be a string naming a file being read or loaded.
with-load-pathname
evaluates thunk in a dynamic scope
where an internal variable is bound to path; the internal
variable is used for messages and program-vicinity
.
with-load-pathname
returns the value returned by thunk.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These constants and procedures describe characteristics of the Scheme and underlying operating system. They are provided by all implementations.
An integer 1 larger that the largest value which can be returned by
char->integer
.
In implementations which support integers of practically unlimited size, most-positive-fixnum is a large exact integer within the range of exact integers that may result from computing the length of a list, vector, or string.
In implementations which do not support integers of practically unlimited size, most-positive-fixnum is the largest exact integer that may result from computing the length of a list, vector, or string.
The tab character.
The form-feed character.
Returns a symbol denoting the generic operating system type. For
instance, unix
, vms
, macos
, amiga
, or
ms-dos
.
Displays the versions of SLIB and the underlying Scheme implementation and the name of the operating system. An unspecified value is returned.
(slib:report-version) ⇒ slib "3b1" on scm "5b1" on unix |
Displays the information of (slib:report-version)
followed by
almost all the information neccessary for submitting a problem report.
An unspecified value is returned.
provides a more verbose listing.
Writes the report to file ‘filename’.
(slib:report) ⇒ slib "3b1" on scm "5b1" on unix (implementation-vicinity) is "/usr/local/lib/scm/" (library-vicinity) is "/usr/local/lib/slib/" (scheme-file-suffix) is ".scm" loaded slib:features : trace alist qp sort common-list-functions macro values getopt compiled implementation slib:features : bignum complex real rational inexact vicinity ed getenv tmpnam abort transcript with-file ieee-p1178 r4rs rev4-optional-procedures hash object-hash delay eval dynamic-wind multiarg-apply multiarg/and- logical defmacro string-port source current-time record rev3-procedures rev2-procedures sun-dl string-case array dump char-ready? full-continuation system implementation *catalog* : (i/o-extensions compiled "/usr/local/lib/scm/ioext.so") ... |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These procedures are provided by all implementations.
Returns #t
if the specified file exists. Otherwise, returns
#f
. If the underlying implementation does not support this
feature then #f
is always returned.
Deletes the file specified by filename. If filename can not
be deleted, #f
is returned. Otherwise, #t
is
returned.
filename should be a string naming a file. open-file
returns a port depending on the symbol modes:
an input port capable of delivering characters from the file.
a binary input port capable of delivering characters from the file.
an output port capable of writing characters to a new file by that name.
a binary output port capable of writing characters to a new file by that name.
If an implementation does not distinguish between binary and non-binary files, then it must treat rb as r and wb as w.
If the file cannot be opened, either #f is returned or an error is signalled. For output, if a file with the given name already exists, the effect is unspecified.
Returns #t if obj is an input or output port, otherwise returns #f.
Closes the file associated with port, rendering the port incapable of delivering or accepting characters.
close-file
has no effect if the file has already been closed.
The value returned is unspecified.
Proc should be a procedure that accepts as many arguments as there
are ports passed to call-with-open-ports
.
call-with-open-ports
calls proc with ports ….
If proc returns, then the ports are closed automatically and the
value yielded by the proc is returned. If proc does not
return, then the ports will not be closed automatically unless it is
possible to prove that the ports will never again be used for a read or
write operation.
Returns a pathname for a file which will likely not be used by any other
process. Successive calls to (tmpnam)
will return different
pathnames.
Returns the current port to which diagnostic and error output is directed.
Forces any pending output on port to be delivered to the output
device and returns an unspecified value. The port argument may be
omitted, in which case it defaults to the value returned by
(current-output-port)
.
port must be open to a file. file-position
returns the
current position of the character in port which will next be
read or written. If the implementation does not support
file-position, then #f
is returned.
port must be open to a file. file-position
sets the
current position in port which will next be read or written. If
successful, #f
is returned; otherwise file-position
returns #f
.
Returns the width of port, which defaults to
(current-output-port)
if absent. If the width cannot be
determined 79 is returned.
Returns the height of port, which defaults to
(current-output-port)
if absent. If the height cannot be
determined 24 is returned.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These procedures are provided by all implementations.
Loads a file of Scheme source code from name with the default
filename extension used in SLIB. For instance if the filename extension
used in SLIB is ‘.scm’ then (slib:load-source "foo")
will
load from file ‘foo.scm’.
On implementations which support separtely loadable compiled modules, loads a file of compiled code from name with the implementation’s filename extension for compiled code appended.
Loads a file of Scheme source or compiled code from name with the appropriate suffixes appended. If both source and compiled code are present with the appropriate names then the implementation will load just one. It is up to the implementation to choose which one will be loaded.
If an implementation does not support compiled code then
slib:load
will be identical to slib:load-source
.
eval
returns the value of obj evaluated in the current top
level environment. Eval provides a more general evaluation
facility.
filename should be a string. If filename names an existing file,
the Scheme source code expressions and definitions are read from the
file and eval called with them sequentially. The
slib:eval-load
procedure does not affect the values returned by
current-input-port
and current-output-port
.
Outputs a warning message containing the arguments.
Outputs an error message containing the arguments, aborts evaluation of the current form and responds in a system dependent way to the error. Typical responses are to abort the program or to enter a read-eval-print loop.
Exits from the Scheme session returning status n to the system.
If n is omitted or #t
, a success status is returned to
the system (if possible). If n is #f
a failure is
returned to the system (if possible). If n is an integer, then
n is returned to the system (if possible). If the Scheme
session cannot exit, then an unspecified value is returned from
slib:exit
.
Web browsers have become so ubiquitous that programming languagues should support a uniform interface to them.
If a browser is running, browse-url
causes the browser to
display the page specified by string url and returns #t
.
If the browser is not running, browse-url
starts a browser
displaying the argument url. If the browser starts as a
background job, browse-url
returns #t
immediately; if
the browser starts as a foreground job, then browse-url
returns
#t
when the browser exits; otherwise (if no browser) it returns
#f
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These procedures are provided by all implementations.
identity returns its argument.
Example:
(identity 3) ⇒ 3 (identity '(foo bar)) ⇒ (foo bar) (map identity lst) ≡ (copy-list lst) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
An exchanger is a procedure of one argument regulating mutually exclusive access to a resource. When a exchanger is called, its current content is returned, while being replaced by its argument in an atomic operation.
Returns a new exchanger with the argument obj as its initial content.
(define queue (make-exchanger (list a))) |
A queue implemented as an exchanger holding a list can be protected from reentrant execution thus:
(define (pop queue) (let ((lst #f)) (dynamic-wind (lambda () (set! lst (queue #f))) (lambda () (and lst (not (null? lst)) (let ((ret (car lst))) (set! lst (cdr lst)) ret))) (lambda () (and lst (queue lst)))))) (pop queue) ⇒ a (pop queue) ⇒ #f |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following procedures were present in Scheme until R4RS (see (r4rs)Notes section ‘Language changes’ in Revised(4) Scheme). They are provided by all SLIB implementations.
Defined as #t
.
Defined as #f
.
Returns the last pair in the list l. Example:
(last-pair (cons 1 2)) ⇒ (1 . 2) (last-pair '(1 2)) ⇒ (2) ≡ (cons 2 '()) |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by root on March 20, 2014 using texi2html 1.82.