diff options
Diffstat (limited to 'slib_2.html')
-rw-r--r-- | slib_2.html | 824 |
1 files changed, 824 insertions, 0 deletions
diff --git a/slib_2.html b/slib_2.html new file mode 100644 index 0000000..ef8c059 --- /dev/null +++ b/slib_2.html @@ -0,0 +1,824 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html40/loose.dtd"> +<HTML> +<!-- Created on January, 10 2005 by texi2html 1.66 --> +<!-- +Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) + Karl Berry <karl@freefriends.org> + Olaf Bachmann <obachman@mathematik.uni-kl.de> + and many others. +Maintained by: Many creative people <dev@texi2html.cvshome.org> +Send bugs and suggestions to <users@texi2html.cvshome.org> + +--> +<HEAD> +<TITLE>SLIB: Universal SLIB Procedures</TITLE> + +<META NAME="description" CONTENT="SLIB: Universal SLIB Procedures"> +<META NAME="keywords" CONTENT="SLIB: Universal SLIB Procedures"> +<META NAME="resource-type" CONTENT="document"> +<META NAME="distribution" CONTENT="global"> +<META NAME="Generator" CONTENT="texi2html 1.66"> + +</HEAD> + +<BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> + +<A NAME="SEC13"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_1.html#SEC12"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC14"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_1.html#SEC1"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H1> 2. Universal SLIB Procedures </H1> +<!--docid::SEC13::--> +<P> + +The procedures described in these sections are supported by all +implementations as part of the `<SAMP>*.init</SAMP>' files or by +`<TT>require.scm</TT>'. +</P> +<P> + +<TABLE BORDER="0" CELLSPACING="0"> +<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC14">2.1 Vicinity</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Pathname Management</TD></TR> +<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC15">2.2 Configuration</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Characteristics of Scheme Implementation</TD></TR> +<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC16">2.3 Input/Output</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">Things not provided by the Scheme specs.</TD></TR> +<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC17">2.4 System</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">LOADing, EVALing, ERRORing, and EXITing</TD></TR> +<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="slib_2.html#SEC18">2.5 Miscellany</A></TD><TD> </TD><TD ALIGN="left" VALIGN="TOP"></TD></TR> +</TABLE> +<P> + +<A NAME="Vicinity"></A> +<HR SIZE="6"> +<A NAME="SEC14"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC15"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H2> 2.1 Vicinity </H2> +<!--docid::SEC14::--> +<P> + +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 <EM>flat</EM> file systems (which +have no directory structure) by having the vicinity express constraints +on the file name. On most systems a vicinity would be a string. All of +these procedures are file system dependent. +</P> +<P> + +These procedures are provided by all implementations. +</P> +<P> + +<A NAME="IDX56"></A> +</P> +<DL> +<DT><U>Function:</U> <B>make-vicinity</B> <I>dirpath</I> +<DD>Returns <VAR>dirpath</VAR> as a vicinity for use as first argument to +<CODE>in-vicinity</CODE>. +</DL> +<P> + +<A NAME="IDX57"></A> +</P> +<DL> +<DT><U>Function:</U> <B>pathname->vicinity</B> <I>path</I> +<DD>Returns the vicinity containing <VAR>path</VAR>. +<TABLE><tr><td> </td><td class=example><pre>(pathname->vicinity "/usr/local/lib/scm/Link.scm") + => "/usr/local/lib/scm/" +</pre></td></tr></table></DL> +<P> + +<A NAME="IDX58"></A> +</P> +<DL> +<DT><U>Function:</U> <B>program-vicinity</B> +<DD>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 it +the result is undefined. <STRONG>Warning:</STRONG> <CODE>program-vicinity</CODE> can +return incorrect values if your program escapes back into a +<CODE>load</CODE>. +</DL> +<P> + +<A NAME="IDX59"></A> +</P> +<DL> +<DT><U>Function:</U> <B>library-vicinity</B> +<DD>Returns the vicinity of the shared Scheme library. +</DL> +<P> + +<A NAME="IDX60"></A> +</P> +<DL> +<DT><U>Function:</U> <B>implementation-vicinity</B> +<DD>Returns the vicinity of the underlying Scheme implementation. This +vicinity will likely contain startup code and messages and a compiler. +</DL> +<P> + +<A NAME="IDX61"></A> +</P> +<DL> +<DT><U>Function:</U> <B>user-vicinity</B> +<DD>Returns the vicinity of the current directory of the user. On most +systems this is `<TT>""</TT>' (the empty string). +</DL> +<P> + +<A NAME="IDX62"></A> +</P> +<DL> +<DT><U>Function:</U> <B>home-vicinity</B> +<DD>Returns the vicinity of the user's <EM>HOME</EM> directory, the directory +<A NAME="IDX63"></A> +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 <CODE>home-vicinity</CODE> +returns <CODE>#f</CODE>. +</DL> +<P> + +<A NAME="IDX64"></A> +</P> +<DL> +<DT><U>Function:</U> <B>vicinity:suffix?</B> <I>chr</I> +<DD>Returns the `<SAMP>#t</SAMP>' if <VAR>chr</VAR> is a vicinity suffix character; and +<CODE>#f</CODE> otherwise. Typical vicinity suffixes are `<SAMP>/</SAMP>', +`<SAMP>:</SAMP>', and `<SAMP>\</SAMP>', +</DL> +<P> + +<A NAME="IDX65"></A> +</P> +<DL> +<DT><U>Function:</U> <B>in-vicinity</B> <I>vicinity filename</I> +<DD>Returns a filename suitable for use by <CODE>slib:load</CODE>, +<CODE>slib:load-source</CODE>, <CODE>slib:load-compiled</CODE>, +<CODE>open-input-file</CODE>, <CODE>open-output-file</CODE>, etc. The returned +filename is <VAR>filename</VAR> in <VAR>vicinity</VAR>. <CODE>in-vicinity</CODE> should +allow <VAR>filename</VAR> to override <VAR>vicinity</VAR> when <VAR>filename</VAR> is +an absolute pathname and <VAR>vicinity</VAR> is equal to the value of +<CODE>(user-vicinity)</CODE>. The behavior of <CODE>in-vicinity</CODE> when +<VAR>filename</VAR> is absolute and <VAR>vicinity</VAR> is not equal to the value +of <CODE>(user-vicinity)</CODE> is unspecified. For most systems +<CODE>in-vicinity</CODE> can be <CODE>string-append</CODE>. +</DL> +<P> + +<A NAME="IDX66"></A> +</P> +<DL> +<DT><U>Function:</U> <B>sub-vicinity</B> <I>vicinity name</I> +<DD>Returns the vicinity of <VAR>vicinity</VAR> restricted to <VAR>name</VAR>. This +is used for large systems where names of files in subsystems could +conflict. On systems with directory structure <CODE>sub-vicinity</CODE> will +return a pathname of the subdirectory <VAR>name</VAR> of +<VAR>vicinity</VAR>. +</DL> +<P> + +<A NAME="Configuration"></A> +<HR SIZE="6"> +<A NAME="SEC15"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC14"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC16"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H2> 2.2 Configuration </H2> +<!--docid::SEC15::--> +<P> + +These constants and procedures describe characteristics of the Scheme +and underlying operating system. They are provided by all +implementations. +</P> +<P> + +<A NAME="IDX67"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>char-code-limit</B> +<DD>An integer 1 larger that the largest value which can be returned by +<CODE>char->integer</CODE>. +</DL> +<P> + +<A NAME="IDX68"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>most-positive-fixnum</B> +<DD>In implementations which support integers of practically unlimited size, +<VAR>most-positive-fixnum</VAR> is a large exact integer within the range of +exact integers that may result from computing the length of a list, +vector, or string. +<P> + +In implementations which do not support integers of practically +unlimited size, <VAR>most-positive-fixnum</VAR> is the largest exact integer +that may result from computing the length of a list, vector, or string. +</P> +</DL> +<P> + +<A NAME="IDX69"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>slib:tab</B> +<DD>The tab character. +</DL> +<P> + +<A NAME="IDX70"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>slib:form-feed</B> +<DD>The form-feed character. +</DL> +<P> + +<A NAME="IDX71"></A> +</P> +<DL> +<DT><U>Function:</U> <B>software-type</B> +<DD>Returns a symbol denoting the generic operating system type. For +instance, <CODE>unix</CODE>, <CODE>vms</CODE>, <CODE>macos</CODE>, <CODE>amiga</CODE>, or +<CODE>ms-dos</CODE>. +</DL> +<P> + +<A NAME="IDX72"></A> +</P> +<DL> +<DT><U>Function:</U> <B>slib:report-version</B> +<DD>Displays the versions of SLIB and the underlying Scheme implementation +and the name of the operating system. An unspecified value is returned. +<P> + +<TABLE><tr><td> </td><td class=example><pre>(slib:report-version) => slib "3a1" on scm "5b1" on unix +</pre></td></tr></table></DL> +<P> + +<A NAME="IDX73"></A> +</P> +<DL> +<DT><U>Function:</U> <B>slib:report</B> +<DD>Displays the information of <CODE>(slib:report-version)</CODE> followed by +almost all the information neccessary for submitting a problem report. +An unspecified value is returned. +<P> + +<A NAME="IDX74"></A> +<DT><U>Function:</U> <B>slib:report</B> <I>#t</I> +<DD>provides a more verbose listing. +</P> +<P> + +<A NAME="IDX75"></A> +<DT><U>Function:</U> <B>slib:report</B> <I>filename</I> +<DD>Writes the report to file `<TT>filename</TT>'. +</P> +<P> + +<TABLE><tr><td> </td><td class=example><pre>(slib:report) +=> +slib "3a1" 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 *features* : + trace alist qp sort + common-list-functions macro values getopt + compiled +implementation *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") + ... +</pre></td></tr></table></DL> +<P> + +<A NAME="Input/Output"></A> +<HR SIZE="6"> +<A NAME="SEC16"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC15"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC17"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H2> 2.3 Input/Output </H2> +<!--docid::SEC16::--> +<P> + +These procedures are provided by all implementations. +</P> +<P> + +<A NAME="IDX76"></A> +</P> +<DL> +<DT><U>Function:</U> <B>file-exists?</B> <I>filename</I> +<DD>Returns <CODE>#t</CODE> if the specified file exists. Otherwise, returns +<CODE>#f</CODE>. If the underlying implementation does not support this +feature then <CODE>#f</CODE> is always returned. +</DL> +<P> + +<A NAME="IDX77"></A> +</P> +<DL> +<DT><U>Function:</U> <B>delete-file</B> <I>filename</I> +<DD>Deletes the file specified by <VAR>filename</VAR>. If <VAR>filename</VAR> can not +be deleted, <CODE>#f</CODE> is returned. Otherwise, <CODE>#t</CODE> is +returned. +</DL> +<P> + +<A NAME="IDX78"></A> +</P> +<DL> +<DT><U>Function:</U> <B>open-file</B> <I>filename modes</I> +<DD><VAR>filename</VAR> should be a string naming a file. <CODE>open-file</CODE> +returns a port depending on the symbol <VAR>modes</VAR>: +<P> + +</P> +<DL COMPACT> +<DT>r +<DD>an input port capable of delivering characters from the file. +<DT>rb +<DD>a <EM>binary</EM> input port capable of delivering characters from the file. +<DT>w +<DD>an output port capable of writing characters to a new file by that name. +<DT>wb +<DD>a <EM>binary</EM> output port capable of writing characters to a new file +by that name. +</DL> +<P> + +If an implementation does not distinguish between binary and non-binary +files, then it must treat rb as r and wb as w. +</P> +<P> + +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. +</P> +</DL> +<P> + +<A NAME="IDX79"></A> +</P> +<DL> +<DT><U>Function:</U> <B>port?</B> <I>obj</I> +<DD>Returns <TT>#t</TT> if <VAR>obj</VAR> is an input or output port, otherwise +returns <TT>#f</TT>. +</DL> +<P> + +<A NAME="IDX80"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>close-port</B> <I>port</I> +<DD>Closes the file associated with <VAR>port</VAR>, rendering the <VAR>port</VAR> +incapable of delivering or accepting characters. +<P> + +<CODE>close-file</CODE> has no effect if the file has already been closed. +The value returned is unspecified. +</P> +</DL> +<P> + +<A NAME="IDX81"></A> +</P> +<DL> +<DT><U>Function:</U> <B>call-with-open-ports</B> <I>proc ports <small>...</small></I> +<DD><A NAME="IDX82"></A> +<DT><U>Function:</U> <B>call-with-open-ports</B> <I>ports <small>...</small> proc</I> +<DD><VAR>Proc</VAR> should be a procedure that accepts as many arguments as there +are <VAR>ports</VAR> passed to <CODE>call-with-open-ports</CODE>. +<CODE>call-with-open-ports</CODE> calls <VAR>proc</VAR> with <VAR>ports</VAR> <small>...</small>. +If <VAR>proc</VAR> returns, then the ports are closed automatically and the +value yielded by the <VAR>proc</VAR> is returned. If <VAR>proc</VAR> 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. +</DL> +<P> + +<A NAME="IDX83"></A> +</P> +<DL> +<DT><U>Function:</U> <B>tmpnam</B> +<DD>Returns a pathname for a file which will likely not be used by any other +process. Successive calls to <CODE>(tmpnam)</CODE> will return different +pathnames. +</DL> +<P> + +<A NAME="IDX84"></A> +</P> +<DL> +<DT><U>Function:</U> <B>current-error-port</B> +<DD>Returns the current port to which diagnostic and error output is +directed. +</DL> +<P> + +<A NAME="IDX85"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>force-output</B> +<DD><A NAME="IDX86"></A> +<DT><U>Procedure:</U> <B>force-output</B> <I>port</I> +<DD>Forces any pending output on <VAR>port</VAR> to be delivered to the output +device and returns an unspecified value. The <VAR>port</VAR> argument may be +omitted, in which case it defaults to the value returned by +<CODE>(current-output-port)</CODE>. +</DL> +<P> + +<A NAME="IDX87"></A> +</P> +<DL> +<DT><U>Function:</U> <B>output-port-width</B> +<DD><A NAME="IDX88"></A> +<DT><U>Function:</U> <B>output-port-width</B> <I>port</I> +<DD><P> + +Returns the width of <VAR>port</VAR>, which defaults to +<CODE>(current-output-port)</CODE> if absent. If the width cannot be +determined 79 is returned. +</P> +</DL> +<P> + +<A NAME="IDX89"></A> +</P> +<DL> +<DT><U>Function:</U> <B>output-port-height</B> +<DD><A NAME="IDX90"></A> +<DT><U>Function:</U> <B>output-port-height</B> <I>port</I> +<DD><P> + +Returns the height of <VAR>port</VAR>, which defaults to +<CODE>(current-output-port)</CODE> if absent. If the height cannot be +determined 24 is returned. +</P> +</DL> +<P> + +<A NAME="System"></A> +<HR SIZE="6"> +<A NAME="SEC17"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC16"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC18"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H2> 2.4 System </H2> +<!--docid::SEC17::--> +<P> + +These procedures are provided by all implementations. +</P> +<P> + +<A NAME="IDX91"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:load-source</B> <I>name</I> +<DD>Loads a file of Scheme source code from <VAR>name</VAR> with the default +filename extension used in SLIB. For instance if the filename extension +used in SLIB is `<TT>.scm</TT>' then <CODE>(slib:load-source "foo")</CODE> will +load from file `<TT>foo.scm</TT>'. +</DL> +<P> + +<A NAME="IDX92"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:load-compiled</B> <I>name</I> +<DD>On implementations which support separtely loadable compiled modules, +loads a file of compiled code from <VAR>name</VAR> with the implementation's +filename extension for compiled code appended. +</DL> +<P> + +<A NAME="IDX93"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:load</B> <I>name</I> +<DD>Loads a file of Scheme source or compiled code from <VAR>name</VAR> 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. +<P> + +If an implementation does not support compiled code then +<CODE>slib:load</CODE> will be identical to <CODE>slib:load-source</CODE>. +</P> +</DL> +<P> + +<A NAME="IDX94"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:eval</B> <I>obj</I> +<DD><CODE>eval</CODE> returns the value of <VAR>obj</VAR> evaluated in the current top +level environment. <A HREF="slib_7.html#SEC246">7.4.11 Eval</A> provides a more general evaluation +facility. +</DL> +<P> + +<A NAME="IDX95"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:eval-load</B> <I>filename eval</I> +<DD><VAR>filename</VAR> should be a string. If filename names an existing file, +the Scheme source code expressions and definitions are read from the +file and <VAR>eval</VAR> called with them sequentially. The +<CODE>slib:eval-load</CODE> procedure does not affect the values returned by +<CODE>current-input-port</CODE> and <CODE>current-output-port</CODE>. +</DL> +<P> + +<A NAME="IDX96"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:warn</B> <I>arg1 arg2 <small>...</small></I> +<DD>Outputs a warning message containing the arguments. +</DL> +<P> + +<A NAME="IDX97"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:error</B> <I>arg1 arg2 <small>...</small></I> +<DD>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. +</DL> +<P> + +<A NAME="IDX98"></A> +</P> +<DL> +<DT><U>Procedure:</U> <B>slib:exit</B> <I>n</I> +<DD><A NAME="IDX99"></A> +<DT><U>Procedure:</U> <B>slib:exit</B> +<DD>Exits from the Scheme session returning status <VAR>n</VAR> to the system. +If <VAR>n</VAR> is omitted or <CODE>#t</CODE>, a success status is returned to the +system (if possible). If <VAR>n</VAR> is <CODE>#f</CODE> a failure is returned to +the system (if possible). If <VAR>n</VAR> is an integer, then <VAR>n</VAR> is +returned to the system (if possible). If the Scheme session cannot exit +an unspecified value is returned from <CODE>slib:exit</CODE>. +</DL> +<P> + +<A NAME="IDX100"></A> +</P> +<DL> +<DT><U>Function:</U> <B>browse-url</B> <I>url</I> +<DD>Web browsers have become so ubiquitous that programming languagues +should support a uniform interface to them. +<P> + +If a `<SAMP>netscape</SAMP>' browser is running, <CODE>browse-url</CODE> causes the +browser to display the page specified by string <VAR>url</VAR> and returns +#t. +</P> +<P> + +If the browser is not running, <CODE>browse-url</CODE> starts a browser +displaying the argument <VAR>url</VAR>. If the browser starts as a +background job, <CODE>browse-url</CODE> returns #t immediately; if the +browser starts as a foreground job, then <CODE>browse-url</CODE> returns #t +when the browser exits; otherwise it returns #f. +</P> +</DL> +<P> + +<A NAME="Miscellany"></A> +<HR SIZE="6"> +<A NAME="SEC18"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC17"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC19"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H2> 2.5 Miscellany </H2> +<!--docid::SEC18::--> +<P> + +These procedures are provided by all implementations. +</P> +<P> + +<A NAME="IDX101"></A> +</P> +<DL> +<DT><U>Function:</U> <B>identity</B> <I>x</I> +<DD><VAR>identity</VAR> returns its argument. +<P> + +Example: +<TABLE><tr><td> </td><td class=example><pre>(identity 3) + => 3 +(identity '(foo bar)) + => (foo bar) +(map identity <VAR>lst</VAR>) + == (copy-list <VAR>lst</VAR>) +</pre></td></tr></table></DL> +<P> + +<HR SIZE="6"> +<A NAME="SEC19"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC18"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC20"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H3> 2.5.1 Mutual Exclusion </H3> +<!--docid::SEC19::--> +<P> + +An <EM>exchanger</EM> is a procedure of one argument regulating mutually +<A NAME="IDX102"></A> +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. +</P> +<P> + +<A NAME="IDX103"></A> +</P> +<DL> +<DT><U>Function:</U> <B>make-exchanger</B> <I>obj</I> +<DD><P> + +Returns a new exchanger with the argument <VAR>obj</VAR> as its initial +content. +</P> +<P> + +<TABLE><tr><td> </td><td class=example><pre>(define queue (make-exchanger (list a))) +</pre></td></tr></table><P> + +A queue implemented as an exchanger holding a list can be protected from +reentrant execution thus: +</P> +<P> + +<TABLE><tr><td> </td><td class=example><pre>(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 +</pre></td></tr></table></DL> +<P> + +<HR SIZE="6"> +<A NAME="SEC20"></A> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC19"> < </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> > </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> Up </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<H3> 2.5.2 Legacy </H3> +<!--docid::SEC20::--> +<P> + +The following procedures were present in Scheme until R4RS +(see section `Language changes' in <CITE>Revised(4) Scheme</CITE>). +They are provided by all SLIB implementations. +</P> +<P> + +<A NAME="IDX104"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>t</B> +<DD>Derfined as <CODE>#t</CODE>. +</DL> +<P> + +<A NAME="IDX105"></A> +</P> +<DL> +<DT><U>Constant:</U> <B>nil</B> +<DD>Defined as <CODE>#f</CODE>. +</DL> +<P> + +<A NAME="IDX106"></A> +</P> +<DL> +<DT><U>Function:</U> <B>last-pair</B> <I>l</I> +<DD>Returns the last pair in the list <VAR>l</VAR>. Example: +<TABLE><tr><td> </td><td class=example><pre>(last-pair (cons 1 2)) + => (1 . 2) +(last-pair '(1 2)) + => (2) + == (cons 2 '()) +</pre></td></tr></table></DL> +<P> + +<A NAME="Scheme Syntax Extension Packages"></A> +<HR SIZE="6"> +<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> +<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_2.html#SEC13"> << </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_3.html#SEC21"> >> </A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib.html#SEC_Top">Top</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_toc.html#SEC_Contents">Contents</A>]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> +<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="slib_abt.html#SEC_About"> ? </A>]</TD> +</TR></TABLE> +<BR> +<FONT SIZE="-1"> +This document was generated +by <I>Steve Langasek</I> on <I>January, 10 2005</I> +using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A> +</FONT> + +</BODY> +</HTML> |