| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created on September 18, 2014 by texi2html 1.82 |
| 4 |
texi2html was written by: |
| 5 |
Lionel Cons <[email protected]> (original author) |
| 6 |
Karl Berry <[email protected]> |
| 7 |
Olaf Bachmann <[email protected]> |
| 8 |
and many others. |
| 9 |
Maintained by: Many creative people. |
| 10 |
Send bugs and suggestions to <[email protected]> |
| 11 |
--> |
| 12 |
<head> |
| 13 |
<title>Gambit-C, a portable implementation of Scheme</title> |
| 14 |
|
| 15 |
<meta name="description" content="Gambit-C, a portable implementation of Scheme"> |
| 16 |
<meta name="keywords" content="Gambit-C, a portable implementation of Scheme"> |
| 17 |
<meta name="resource-type" content="document"> |
| 18 |
<meta name="distribution" content="global"> |
| 19 |
<meta name="Generator" content="texi2html 1.82"> |
| 20 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 21 |
|
| 22 |
<script> |
| 23 |
|
| 24 |
function gestureStart() { |
| 25 |
var metas = document.getElementsByTagName('meta'); |
| 26 |
for (var i=0; i<metas.length; i++) { |
| 27 |
if (metas[i].name === "viewport") { |
| 28 |
metas[i].content = "width=device-width, initial-scale=1.0, minimum-scale=0.25, maximum-scale=1.6"; |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
document.addEventListener("gesturestart", gestureStart, false); |
| 34 |
|
| 35 |
</script> |
| 36 |
|
| 37 |
<style type="text/css"> |
| 38 |
<!-- |
| 39 |
a.summary-letter {text-decoration: none} |
| 40 |
a:link {color: #0000e0} |
| 41 |
a:visited {color: #0000e0} |
| 42 |
blockquote.smallquotation {font-size: smaller} |
| 43 |
pre.display {font-family: serif} |
| 44 |
pre.format {font-family: serif} |
| 45 |
pre.menu-comment {font-family: serif} |
| 46 |
pre.menu-preformatted {font-family: serif} |
| 47 |
pre.smalldisplay {font-family: serif; font-size: smaller} |
| 48 |
pre.smallexample {font-size: smaller} |
| 49 |
pre.smallformat {font-family: serif; font-size: smaller} |
| 50 |
pre.smalllisp {font-size: smaller} |
| 51 |
span.roman {font-family:serif; font-weight:normal;} |
| 52 |
span.sansserif {font-family:sans-serif; font-weight:normal;} |
| 53 |
ul.toc {list-style: none} |
| 54 |
--> |
| 55 |
</style> |
| 56 |
|
| 57 |
|
| 58 |
</head> |
| 59 |
|
| 60 |
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| 61 |
|
| 62 |
<a name="Top"></a> |
| 63 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 64 |
<tr><td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 65 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 66 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 67 |
</tr></table> |
| 68 |
<a name="Gambit_002dC"></a> |
| 69 |
<h1 class="settitle">Gambit-C</h1> |
| 70 |
<a name="index-Gambit_002dC"></a> |
| 71 |
<a name="index-Scheme_002c-implementation-of"></a> |
| 72 |
|
| 73 |
<center><a href="gambit.pdf">[View PDF version]</a></center> |
| 74 |
|
| 75 |
<p>This manual documents Gambit-C. It covers release v4.7.3. |
| 76 |
</p> |
| 77 |
<table class="menu" border="0" cellspacing="0"> |
| 78 |
<tr><td align="left" valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 79 |
<tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 80 |
<tr><td align="left" valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 81 |
<tr><td align="left" valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 82 |
<tr><td align="left" valign="top"><a href="#Runtime-options">4. Runtime options</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 83 |
<tr><td align="left" valign="top"><a href="#Debugging">5. Debugging</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 84 |
<tr><td align="left" valign="top"><a href="#Scheme-extensions">6. Scheme extensions</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 85 |
<tr><td align="left" valign="top"><a href="#Namespaces">7. Namespaces</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 86 |
<tr><td align="left" valign="top"><a href="#Characters-and-strings">8. Characters and strings</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 87 |
<tr><td align="left" valign="top"><a href="#Numbers">9. Numbers</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 88 |
<tr><td align="left" valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 89 |
<tr><td align="left" valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 90 |
<tr><td align="left" valign="top"><a href="#Records">12. Records</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 91 |
<tr><td align="left" valign="top"><a href="#Threads">13. Threads</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 92 |
<tr><td align="left" valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 93 |
<tr><td align="left" valign="top"><a href="#Exceptions">15. Exceptions</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 94 |
<tr><td align="left" valign="top"><a href="#Host-environment">16. Host environment</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 95 |
<tr><td align="left" valign="top"><a href="#I_002fO-and-ports">17. I/O and ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 96 |
<tr><td align="left" valign="top"><a href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 97 |
<tr><td align="left" valign="top"><a href="#C_002dinterface">19. C-interface</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 98 |
<tr><td align="left" valign="top"><a href="#System-limitations">20. System limitations</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 99 |
<tr><td align="left" valign="top"><a href="#Copyright-and-license">21. Copyright and license</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 100 |
<tr><td align="left" valign="top"><a href="#General-index">General index</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 101 |
</table> |
| 102 |
|
| 103 |
|
| 104 |
<a name="The-Gambit_002dC-system"></a><hr size="1"><br/><br/><br/> |
| 105 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 106 |
<tr><td valign="middle" align="left"><a href="#Top" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 107 |
<td valign="middle" align="left"><a href="#Accessing-the-system-files" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 108 |
<td valign="middle" align="left"> </td> |
| 109 |
<td valign="middle" align="left"><a href="#Top" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 110 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 111 |
<td valign="middle" align="left"><a href="#GSI" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 112 |
<td valign="middle" align="left"> </td> |
| 113 |
<td valign="middle" align="left"> </td> |
| 114 |
<td valign="middle" align="left"> </td> |
| 115 |
<td valign="middle" align="left"> </td> |
| 116 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 117 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 118 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 119 |
</tr></table> |
| 120 |
<a name="The-Gambit_002dC-system-1"></a> |
| 121 |
<h1 class="chapter">1. The Gambit-C system</h1> |
| 122 |
<a name="index-Gambit"></a> |
| 123 |
<a name="index-Gambit_002dC-1"></a> |
| 124 |
<a name="index-Scheme"></a> |
| 125 |
|
| 126 |
<a name="index-gsi"></a> |
| 127 |
<a name="index-gsc"></a> |
| 128 |
<p>The Gambit programming system is a full implementation of the Scheme |
| 129 |
language which conforms to the R4RS, R5RS and IEEE Scheme standards. It |
| 130 |
consists of two main programs: <code>gsi</code>, the Gambit Scheme |
| 131 |
interpreter, and <code>gsc</code>, the Gambit Scheme compiler. |
| 132 |
</p> |
| 133 |
<p>Gambit-C is a version of the Gambit programming system in which the |
| 134 |
compiler generates portable C code, making the whole Gambit-C system and |
| 135 |
the programs compiled with it easily portable to many computer |
| 136 |
architectures for which a C compiler is available. With appropriate |
| 137 |
declarations in the source code the executable programs generated by |
| 138 |
the compiler run roughly as fast as equivalent C programs. |
| 139 |
</p> |
| 140 |
<p>For the most up to date information on Gambit and add-on packages |
| 141 |
please check the Gambit web page at |
| 142 |
<a href="event:browse:http://gambitscheme.org">http://gambitscheme.org</a>. The web page has links to the |
| 143 |
Gambit mailing list, the bug reporting system, and the source code |
| 144 |
repository. |
| 145 |
</p> |
| 146 |
<table class="menu" border="0" cellspacing="0"> |
| 147 |
<tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 148 |
</table> |
| 149 |
|
| 150 |
<a name="Accessing-the-system-files"></a><hr size="6"><br/><br/><br/> |
| 151 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 152 |
<tr><td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 153 |
<td valign="middle" align="left"><a href="#GSI" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 154 |
<td valign="middle" align="left"> </td> |
| 155 |
<td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 156 |
<td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 157 |
<td valign="middle" align="left"><a href="#GSI" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 158 |
<td valign="middle" align="left"> </td> |
| 159 |
<td valign="middle" align="left"> </td> |
| 160 |
<td valign="middle" align="left"> </td> |
| 161 |
<td valign="middle" align="left"> </td> |
| 162 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 163 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 164 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 165 |
</tr></table> |
| 166 |
<a name="Accessing-the-system-files-1"></a> |
| 167 |
<h2 class="section">1.1 Accessing the system files</h2> |
| 168 |
|
| 169 |
<p>Files related to Gambit, such as executables, libraries and header files, |
| 170 |
are stored in multiple <em>Gambit installation directories</em>. |
| 171 |
Gambit may be installed on a system according to two different |
| 172 |
installation models. |
| 173 |
</p> |
| 174 |
<p>In the first model there is a single directory where all the Gambit |
| 175 |
installation directories are stored. This <em>central installation |
| 176 |
directory</em> is typically <code>/usr/local/Gambit-C</code> under UNIX, |
| 177 |
<code>/Library/Gambit-C</code> under Mac OS X and <code>C:/Program |
| 178 |
Files/Gambit-C</code> under Microsoft Windows. This may have been |
| 179 |
overridden when the system was built with the command ‘<samp>configure |
| 180 |
--prefix=/my/Gambit-C</samp>’. If the system was built with the command |
| 181 |
‘<samp>configure --enable-multiple-versions</samp>’ then the central |
| 182 |
installation directory is <code><span class="roman"><i>prefix</i></span>/<span class="roman"><i>version</i></span></code>, where |
| 183 |
<code><span class="roman"><i>version</i></span></code> is the system version string |
| 184 |
(e.g. <code>v4.7.3</code> for Gambit v4.7.3). Moreover, |
| 185 |
<code><span class="roman"><i>prefix</i></span>/current</code> will be a symbolic link which points to |
| 186 |
the central installation directory. In this model, the Gambit |
| 187 |
installation directory named <var>X</var> is simply the subdirectory |
| 188 |
<var>X</var> of the central installation directory. |
| 189 |
</p> |
| 190 |
<p>In the second model some or all of the Gambit installation directories |
| 191 |
are stored in installation specific directories. The location of |
| 192 |
these directories is assigned when the system is built using the |
| 193 |
command ‘<samp>configure --bindir=/my/bin --includedir=/my/include |
| 194 |
--libdir=/my/lib</samp>’. |
| 195 |
</p> |
| 196 |
<p>The advantage of the first model is that it is easy to have multiple |
| 197 |
versions of Gambit coexist and to remove all the files of a given |
| 198 |
version. However, the second model may be necessary to conform to the |
| 199 |
package installation conventions of some operating systems. |
| 200 |
</p> |
| 201 |
<p>Executable programs such as the interpreter <code>gsi</code> and compiler |
| 202 |
<code>gsc</code> can be found in the <code>bin</code> installation directory. |
| 203 |
Adding this directory to the <code>PATH</code> environment variable allows |
| 204 |
these programs to be started by simply entering their name. This is |
| 205 |
done automatically by the Mac OS X and Microsoft Windows installers. |
| 206 |
</p> |
| 207 |
<p>The runtime library is located in the <code>lib</code> installation |
| 208 |
directory. When the system’s runtime library is built as a |
| 209 |
shared-library (with the command ‘<samp>configure --enable-shared</samp>’) all |
| 210 |
programs built with Gambit-C, including the interpreter and compiler, |
| 211 |
need to find this library when they are executed and consequently this |
| 212 |
directory must be in the path searched by the system for |
| 213 |
shared-libraries. This path is normally specified through an |
| 214 |
environment variable which is <code>LD_LIBRARY_PATH</code> on most versions |
| 215 |
of UNIX, <code>LIBPATH</code> on AIX, <code>SHLIB_PATH</code> on HPUX, |
| 216 |
<code>DYLD_LIBRARY_PATH</code> on Mac OS X, and <code>PATH</code> on Microsoft |
| 217 |
Windows. If the shell is <code>sh</code>, the setting of the path can be |
| 218 |
made for a single execution by prefixing the program name with the |
| 219 |
environment variable assignment, as in: |
| 220 |
</p> |
| 221 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>LD_LIBRARY_PATH=/usr/local/Gambit-C/lib gsi</b> |
| 222 |
</pre></td></tr></table> |
| 223 |
|
| 224 |
<p>A similar problem exists with the Gambit header file <code>gambit.h</code>, |
| 225 |
located in the <code>include</code> installation directory. This header |
| 226 |
file is needed for compiling Scheme programs with the Gambit-C |
| 227 |
compiler. When the C compiler is being called explicitly it may be |
| 228 |
necessary to use a <code>-I<var><dir></var></code> command line option to |
| 229 |
indicate where to find header files and a <code>-L<var><dir></var></code> command |
| 230 |
line option to indicate where to find libraries. |
| 231 |
</p> |
| 232 |
<p>Access to both of these files can be simplified by creating a link to |
| 233 |
them in the appropriate system directories (special privileges may |
| 234 |
however be required): |
| 235 |
</p> |
| 236 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>ln -s /usr/local/Gambit-C/lib/libgambc.a /usr/lib</b> <span class="roman"><i># name may vary</i></span> |
| 237 |
$ <b>ln -s /usr/local/Gambit-C/include/gambit.h /usr/include</b> |
| 238 |
</pre></td></tr></table> |
| 239 |
|
| 240 |
<p>Alternatively these files can be copied or linked in the directory |
| 241 |
where the C compiler is invoked (this requires no special privileges). |
| 242 |
</p> |
| 243 |
<p>Another approach is to set some environment variables which |
| 244 |
are used to tell the C compiler where to find header files |
| 245 |
and libraries. For example, the following settings can be |
| 246 |
used for the <code>gcc</code> C compiler: |
| 247 |
</p> |
| 248 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>export LIBRARY_PATH=/usr/local/Gambit-C/lib</b> |
| 249 |
$ <b>export CPATH=/usr/local/Gambit-C/include</b> |
| 250 |
</pre></td></tr></table> |
| 251 |
|
| 252 |
<p>Note that this may have been done by the installation process. In |
| 253 |
particular, the Mac OS X and Microsoft Windows prebuilt installers set |
| 254 |
up the environment so that the <code>gcc</code> compiler finds these files |
| 255 |
automatically. |
| 256 |
</p> |
| 257 |
|
| 258 |
<a name="GSI"></a><hr size="6"><br/><br/><br/> |
| 259 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 260 |
<tr><td valign="middle" align="left"><a href="#Accessing-the-system-files" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 261 |
<td valign="middle" align="left"><a href="#GSI-interactive-mode" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 262 |
<td valign="middle" align="left"> </td> |
| 263 |
<td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 264 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 265 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 266 |
<td valign="middle" align="left"> </td> |
| 267 |
<td valign="middle" align="left"> </td> |
| 268 |
<td valign="middle" align="left"> </td> |
| 269 |
<td valign="middle" align="left"> </td> |
| 270 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 271 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 272 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 273 |
</tr></table> |
| 274 |
<a name="The-Gambit-Scheme-interpreter"></a> |
| 275 |
<h1 class="chapter">2. The Gambit Scheme interpreter</h1> |
| 276 |
<a name="index-interpreter"></a> |
| 277 |
|
| 278 |
<p>Synopsis: |
| 279 |
</p> |
| 280 |
<table><tr><td> </td><td><pre class="example"><b></b>gsi <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,…<span class="roman">]</span> <span class="roman">[</span>-i<span class="roman">]</span> <span class="roman">[</span>-f<span class="roman">]</span> <span class="roman">[</span>-v<span class="roman">]</span> <span class="roman">[</span><span class="roman">[</span>-<span class="roman">]</span> <span class="roman">[</span>-e <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span><span class="roman"><var>file</var></span><span class="roman">]</span><span class="roman">]</span>… |
| 281 |
</pre></td></tr></table> |
| 282 |
|
| 283 |
<a name="index-gsi-1"></a> |
| 284 |
<p>The interpreter is executed in <em>interactive mode</em> when no file or |
| 285 |
‘<samp>-</samp>’ or ‘<samp>-e</samp>’ option is given on the command line. Otherwise |
| 286 |
the interpreter is executed in <em>batch mode</em>. The ‘<samp>-i</samp>’ option |
| 287 |
is ignored by the interpreter. The initialization file will be |
| 288 |
examined unless the ‘<samp>-f</samp>’ option is present (see section <a href="#GSI-customization">Customization</a>). The ‘<samp>-v</samp>’ option prints the system version |
| 289 |
string, system time stamp, operating system type, and configure script |
| 290 |
options on standard output and exits. Runtime options are explained |
| 291 |
in <a href="#Runtime-options">Runtime options</a>. |
| 292 |
</p> |
| 293 |
<table class="menu" border="0" cellspacing="0"> |
| 294 |
<tr><td align="left" valign="top"><a href="#GSI-interactive-mode">2.1 Interactive mode</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 295 |
<tr><td align="left" valign="top"><a href="#GSI-batch-mode">2.2 Batch mode</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 296 |
<tr><td align="left" valign="top"><a href="#GSI-customization">2.3 Customization</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 297 |
<tr><td align="left" valign="top"><a href="#GSI-exit-status">2.4 Process exit status</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 298 |
<tr><td align="left" valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 299 |
</table> |
| 300 |
|
| 301 |
<a name="GSI-interactive-mode"></a><hr size="6"><br/><br/><br/> |
| 302 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 303 |
<tr><td valign="middle" align="left"><a href="#GSI" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 304 |
<td valign="middle" align="left"><a href="#GSI-batch-mode" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 305 |
<td valign="middle" align="left"> </td> |
| 306 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 307 |
<td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 308 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 309 |
<td valign="middle" align="left"> </td> |
| 310 |
<td valign="middle" align="left"> </td> |
| 311 |
<td valign="middle" align="left"> </td> |
| 312 |
<td valign="middle" align="left"> </td> |
| 313 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 314 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 315 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 316 |
</tr></table> |
| 317 |
<a name="Interactive-mode-1"></a> |
| 318 |
<h2 class="section">2.1 Interactive mode</h2> |
| 319 |
|
| 320 |
<p>In interactive mode a read-eval-print loop (REPL) is started for the |
| 321 |
user to interact with the interpreter. At each iteration of this loop |
| 322 |
the interpreter displays a prompt, reads a command and executes it. |
| 323 |
The commands can be expressions to evaluate (the typical case) |
| 324 |
or special commands related to debugging, for example ‘<samp>,q</samp>’ to |
| 325 |
terminate the process (for a complete list of commands see |
| 326 |
<a href="#Debugging">Debugging</a>). Most commands produce some output, such as the |
| 327 |
value or error message resulting from an evaluation. |
| 328 |
</p> |
| 329 |
<p>The input and output of the interaction is done on the |
| 330 |
<em>interaction channel</em>. The interaction channel can be specified |
| 331 |
through the runtime options but if none is specified the system uses a |
| 332 |
reasonable default that depends on the system’s configuration. When |
| 333 |
the system’s runtime library was built with support for GUIDE, the |
| 334 |
Gambit Universal IDE (with the command ‘<samp>configure |
| 335 |
--enable-guide</samp>’) the interaction channel corresponds to the |
| 336 |
<em>console window</em> of the primordial thread (for details see |
| 337 |
<a href="#GUIDE">GUIDE</a>), otherwise the interaction channel is the user’s |
| 338 |
<em>console</em>, also known as the <em>controlling terminal</em> in the |
| 339 |
UNIX world. When the REPL starts, the ports associated with |
| 340 |
‘<samp>(current-input-port)</samp>’, ‘<samp>(current-output-port)</samp>’ and |
| 341 |
‘<samp>(current-error-port)</samp>’ all refer to the interaction channel. |
| 342 |
</p> |
| 343 |
<p>Expressions are evaluated in the global <em>interaction environment</em>. |
| 344 |
The interpreter adds to this environment any definition entered using |
| 345 |
the <code>define</code> and <code>define-macro</code> |
| 346 |
special forms. Once the evaluation of an expression is completed, the |
| 347 |
value or values resulting from the evaluation are output to the |
| 348 |
interaction channel by the pretty printer. The special “void” |
| 349 |
object is not output. This object is returned by most procedures and |
| 350 |
special forms which the Scheme standard defines as returning an |
| 351 |
unspecified value (e.g. <code>write</code>, <code>set!</code>, <code>define</code>). |
| 352 |
</p> |
| 353 |
<p>Here is a sample interaction with <code>gsi</code>: |
| 354 |
</p> |
| 355 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b> |
| 356 |
Gambit v4.7.3 |
| 357 |
|
| 358 |
> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b> |
| 359 |
> <b>(map fact '(1 2 3 4 5 6))</b> |
| 360 |
(1 2 6 24 120 720) |
| 361 |
> <b>(values (fact 10) (fact 40))</b> |
| 362 |
3628800 |
| 363 |
815915283247897734345611269596115894272000000000 |
| 364 |
> <b>,q</b> |
| 365 |
</pre></td></tr></table> |
| 366 |
|
| 367 |
<p>What happens when errors occur is explained in <a href="#Debugging">Debugging</a>. |
| 368 |
</p> |
| 369 |
<a name="GSI-batch-mode"></a><hr size="6"><br/><br/><br/> |
| 370 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 371 |
<tr><td valign="middle" align="left"><a href="#GSI-interactive-mode" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 372 |
<td valign="middle" align="left"><a href="#GSI-customization" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 373 |
<td valign="middle" align="left"> </td> |
| 374 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 375 |
<td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 376 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 377 |
<td valign="middle" align="left"> </td> |
| 378 |
<td valign="middle" align="left"> </td> |
| 379 |
<td valign="middle" align="left"> </td> |
| 380 |
<td valign="middle" align="left"> </td> |
| 381 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 382 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 383 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 384 |
</tr></table> |
| 385 |
<a name="Batch-mode-1"></a> |
| 386 |
<h2 class="section">2.2 Batch mode</h2> |
| 387 |
|
| 388 |
<p>In batch mode the command line arguments denote files to be loaded, |
| 389 |
REPL interactions to start (‘<samp>-</samp>’ option), and expressions to be |
| 390 |
evaluated (‘<samp>-e</samp>’ option). Note that the ‘<samp>-</samp>’ and ‘<samp>-e</samp>’ |
| 391 |
options can be interspersed with the files on the command line and can |
| 392 |
occur multiple times. The interpreter processes the command line |
| 393 |
arguments from left to right, loading files with the <code>load</code> |
| 394 |
procedure and evaluating expressions with the <code>eval</code> procedure in |
| 395 |
the global interaction environment. After this processing the |
| 396 |
interpreter exits. |
| 397 |
</p> |
| 398 |
<p>When the file name has no extension the <code>load</code> procedure first |
| 399 |
attempts to load the file with no extension as a Scheme source file. |
| 400 |
If that file doesn’t exist it will search for both a source file and |
| 401 |
an object file. The object file’s name is obtained by adding to the |
| 402 |
file name a ‘<samp>.o<var>n</var></samp>’ extension with the highest consecutive |
| 403 |
version number starting with 1. The source file’s name is obtained by |
| 404 |
adding to the file name the file extensions ‘<samp>.scm</samp>’ and |
| 405 |
‘<samp>.six</samp>’ (the first found is the source file). If both a source |
| 406 |
file and an object file exist, then the one with the latest |
| 407 |
modification time is loaded. Otherwise the file that is found is |
| 408 |
loaded. When the file name has an extension, the <code>load</code> |
| 409 |
procedure will only attempt to load the file with that specific name. |
| 410 |
</p> |
| 411 |
<p>When the extension of the file loaded is ‘<samp>.scm</samp>’ the content of |
| 412 |
the file will be parsed using the normal Scheme prefix syntax. When |
| 413 |
the extension of the file loaded is ‘<samp>.six</samp>’ the content of the |
| 414 |
file will be parsed using the Scheme infix syntax extension (see |
| 415 |
<a href="#Scheme-infix-syntax-extension">Scheme infix syntax extension</a>). Otherwise, <code>gsi</code> will |
| 416 |
parse the file using the normal Scheme prefix syntax. |
| 417 |
</p> |
| 418 |
<p>The ports associated with ‘<samp>(current-input-port)</samp>’, |
| 419 |
‘<samp>(current-output-port)</samp>’ and ‘<samp>(current-error-port)</samp>’ initially |
| 420 |
refer respectively to the standard input (‘<samp>stdin</samp>’), standard |
| 421 |
output (‘<samp>stdout</samp>’) and the standard error (‘<samp>stderr</samp>’) of the |
| 422 |
interpreter. This is true even in REPLs started with the ‘<samp>-</samp>’ |
| 423 |
option. The usual interaction channel (console or IDE’s console |
| 424 |
window) is still used to read expressions and commands and to display |
| 425 |
results. This makes it possible to use REPLs to debug programs which |
| 426 |
read the standard input and write to the standard output, even when |
| 427 |
these have been redirected. |
| 428 |
</p> |
| 429 |
<p>Here is a sample use of the interpreter in batch mode, under UNIX: |
| 430 |
</p> |
| 431 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b> |
| 432 |
(display "hello") (newline) |
| 433 |
$ <b>cat w.six</b> |
| 434 |
display("world"); newline(); |
| 435 |
$ <b>gsi h.scm - w.six -e "(pretty-print 1)(pretty-print 2)"</b> |
| 436 |
hello |
| 437 |
> <b>(define (display x) (write (reverse (string->list x))))</b> |
| 438 |
> <b>,(c 0)</b> |
| 439 |
(#\d #\l #\r #\o #\w) |
| 440 |
1 |
| 441 |
2 |
| 442 |
</pre></td></tr></table> |
| 443 |
|
| 444 |
<a name="GSI-customization"></a><hr size="6"><br/><br/><br/> |
| 445 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 446 |
<tr><td valign="middle" align="left"><a href="#GSI-batch-mode" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 447 |
<td valign="middle" align="left"><a href="#GSI-exit-status" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 448 |
<td valign="middle" align="left"> </td> |
| 449 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 450 |
<td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 451 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 452 |
<td valign="middle" align="left"> </td> |
| 453 |
<td valign="middle" align="left"> </td> |
| 454 |
<td valign="middle" align="left"> </td> |
| 455 |
<td valign="middle" align="left"> </td> |
| 456 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 457 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 458 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 459 |
</tr></table> |
| 460 |
<a name="Customization-1"></a> |
| 461 |
<h2 class="section">2.3 Customization</h2> |
| 462 |
|
| 463 |
<p>There are two ways to customize the interpreter. When the interpreter |
| 464 |
starts off it tries to execute a ‘<samp>(load "~~lib/gambcext")</samp>’ (for an |
| 465 |
explanation of how file names are interpreted see <a href="#Host-environment">Host environment</a>). |
| 466 |
An error is not signaled when the file does not exist. Interpreter |
| 467 |
extensions and patches that are meant to apply to all users and all |
| 468 |
modes should go in that file. |
| 469 |
</p> |
| 470 |
<p>Extensions which are meant to apply to a single user or to a specific |
| 471 |
working directory are best placed in the <em>initialization file</em>, |
| 472 |
which is a file containing Scheme code. In all modes, the interpreter |
| 473 |
first tries to locate the initialization file by searching the following |
| 474 |
locations: ‘<tt>.gambcini</tt>’ and ‘<tt>~/.gambcini</tt>’ (with no extension, a |
| 475 |
‘<samp>.scm</samp>’ extension, and a ‘<samp>.six</samp>’ extension in that order). The |
| 476 |
first file that is found is examined as though the expression |
| 477 |
<code>(include <var>initialization-file</var>)</code> had been entered at the |
| 478 |
read-eval-print loop where <var>initialization-file</var> is the file that |
| 479 |
was found. Note that by using an <code>include</code> the macros defined in |
| 480 |
the initialization file will be visible from the read-eval-print loop |
| 481 |
(this would not have been the case if <code>load</code> had been used). The |
| 482 |
initialization file is not searched for or examined when the ‘<samp>-f</samp>’ |
| 483 |
option is specified. |
| 484 |
</p> |
| 485 |
<a name="GSI-exit-status"></a><hr size="6"><br/><br/><br/> |
| 486 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 487 |
<tr><td valign="middle" align="left"><a href="#GSI-customization" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 488 |
<td valign="middle" align="left"><a href="#Scheme-scripts" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 489 |
<td valign="middle" align="left"> </td> |
| 490 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 491 |
<td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 492 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 493 |
<td valign="middle" align="left"> </td> |
| 494 |
<td valign="middle" align="left"> </td> |
| 495 |
<td valign="middle" align="left"> </td> |
| 496 |
<td valign="middle" align="left"> </td> |
| 497 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 498 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 499 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 500 |
</tr></table> |
| 501 |
<a name="Process-exit-status"></a> |
| 502 |
<h2 class="section">2.4 Process exit status</h2> |
| 503 |
|
| 504 |
<p>The status is zero when the interpreter exits normally and is nonzero |
| 505 |
when the interpreter exits due to an error. Here is the meaning of |
| 506 |
the exit statuses: |
| 507 |
</p> |
| 508 |
<dl compact="compact"> |
| 509 |
<dt> <code>0</code></dt> |
| 510 |
<dd><p>The execution of the primordial thread (i.e. the main thread) did not |
| 511 |
encounter any error. It is however possible that other threads |
| 512 |
terminated abnormally (by default threads other than the primordial |
| 513 |
thread terminate silently when they raise an exception that is not |
| 514 |
handled). |
| 515 |
</p> |
| 516 |
</dd> |
| 517 |
<dt> <code>64</code></dt> |
| 518 |
<dd><p>The runtime options or the environment variable ‘<samp>GAMBCOPT</samp>’ |
| 519 |
contained a syntax error or were invalid. |
| 520 |
</p> |
| 521 |
</dd> |
| 522 |
<dt> <code>70</code></dt> |
| 523 |
<dd><p>This normally indicates that an exception was raised in the primordial |
| 524 |
thread and the exception was not handled. |
| 525 |
</p> |
| 526 |
</dd> |
| 527 |
<dt> <code>71</code></dt> |
| 528 |
<dd><p>There was a problem initializing the runtime system, for example |
| 529 |
insufficient memory to allocate critical tables. |
| 530 |
</p> |
| 531 |
</dd> |
| 532 |
</dl> |
| 533 |
|
| 534 |
<p>For example, if the shell is <code>sh</code>: |
| 535 |
</p> |
| 536 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:d0 -e "(pretty-print (expt 2 100))"</b> |
| 537 |
1267650600228229401496703205376 |
| 538 |
$ <b>echo $?</b> |
| 539 |
0 |
| 540 |
$ <b>gsi -:d0,unknown <span class="roman"><i># try to use an unknown runtime option</i></span></b> |
| 541 |
$ <b>echo $?</b> |
| 542 |
64 |
| 543 |
$ <b>gsi -:d0 nonexistent.scm <span class="roman"><i># try to load a file that does not exist</i></span></b> |
| 544 |
$ <b>echo $?</b> |
| 545 |
70 |
| 546 |
$ <b>gsi nonexistent.scm</b> |
| 547 |
*** ERROR IN ##main -- No such file or directory |
| 548 |
(load "nonexistent.scm") |
| 549 |
$ <b>echo $?</b> |
| 550 |
70 |
| 551 |
</pre></td></tr></table> |
| 552 |
|
| 553 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>$ <b>gsi -:m4000000 <span class="roman"><i># ask for a 4 gigabyte heap</i></span></b> |
| 554 |
*** malloc: vm_allocate(size=528384) failed (error code=3) |
| 555 |
*** malloc[15068]: error: Can't allocate region |
| 556 |
$ <b>echo $?</b> |
| 557 |
71 |
| 558 |
</pre></td></tr></table> |
| 559 |
|
| 560 |
<p>Note the use of the runtime option ‘<samp>-:d0</samp>’ that prevents error |
| 561 |
messages from being output, and the runtime option ‘<samp>-:m4000000</samp>’ |
| 562 |
which sets the minimum heap size to 4 gigabytes. |
| 563 |
</p> |
| 564 |
<a name="Scheme-scripts"></a><hr size="6"><br/><br/><br/> |
| 565 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 566 |
<tr><td valign="middle" align="left"><a href="#GSI-exit-status" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 567 |
<td valign="middle" align="left"><a href="#Scripts-under-UNIX-and-Mac-OS-X" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 568 |
<td valign="middle" align="left"> </td> |
| 569 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 570 |
<td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 571 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 572 |
<td valign="middle" align="left"> </td> |
| 573 |
<td valign="middle" align="left"> </td> |
| 574 |
<td valign="middle" align="left"> </td> |
| 575 |
<td valign="middle" align="left"> </td> |
| 576 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 577 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 578 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 579 |
</tr></table> |
| 580 |
<a name="Scheme-scripts-1"></a> |
| 581 |
<h2 class="section">2.5 Scheme scripts</h2> |
| 582 |
|
| 583 |
<p>The <code>load</code> procedure treats specially files that begin with the |
| 584 |
two characters ‘<samp>#!</samp>’ and ‘<samp>@;</samp>’. Such files are called |
| 585 |
<em>script files</em> and the first line is called the <em>script line</em>. |
| 586 |
In addition to indicating that the file is a script, the script line |
| 587 |
provides information about the source code language to be used by the |
| 588 |
<code>load</code> procedure. After the two characters ‘<samp>#!</samp>’ and |
| 589 |
‘<samp>@;</samp>’ the system will search for the first substring matching one |
| 590 |
of the following language specifying tokens: |
| 591 |
</p> |
| 592 |
<dl compact="compact"> |
| 593 |
<dt> <code>scheme-r4rs</code></dt> |
| 594 |
<dd><a name="index-scheme_002dr4rs"></a> |
| 595 |
<p>R4RS language with prefix syntax, case-insensitivity, keyword syntax |
| 596 |
not supported |
| 597 |
</p> |
| 598 |
</dd> |
| 599 |
<dt> <code>scheme-r5rs</code></dt> |
| 600 |
<dd><a name="index-scheme_002dr5rs"></a> |
| 601 |
<p>R5RS language with prefix syntax, case-insensitivity, keyword syntax |
| 602 |
not supported |
| 603 |
</p> |
| 604 |
</dd> |
| 605 |
<dt> <code>scheme-ieee-1178-1990</code></dt> |
| 606 |
<dd><a name="index-scheme_002dieee_002d1178_002d1990"></a> |
| 607 |
<p>IEEE 1178-1990 language with prefix syntax, case-insensitivity, keyword |
| 608 |
syntax not supported |
| 609 |
</p> |
| 610 |
</dd> |
| 611 |
<dt> <code>scheme-srfi-0</code></dt> |
| 612 |
<dd><a name="index-scheme_002dsrfi_002d0"></a> |
| 613 |
<p>R5RS language with prefix syntax and SRFI 0 support |
| 614 |
(i.e. <code>cond-expand</code> special form), case-insensitivity, keyword |
| 615 |
syntax not supported |
| 616 |
</p> |
| 617 |
</dd> |
| 618 |
<dt> <code>gsi-script</code></dt> |
| 619 |
<dd><a name="index-gsi_002dscript"></a> |
| 620 |
<p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword |
| 621 |
syntax supported |
| 622 |
</p> |
| 623 |
</dd> |
| 624 |
<dt> <code>gsc-script</code></dt> |
| 625 |
<dd><a name="index-gsc_002dscript"></a> |
| 626 |
<p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword |
| 627 |
syntax supported |
| 628 |
</p> |
| 629 |
</dd> |
| 630 |
<dt> <code>six-script</code></dt> |
| 631 |
<dd><a name="index-six_002dscript"></a> |
| 632 |
<p>Full Gambit Scheme language with infix syntax, case-sensitivity, keyword |
| 633 |
syntax supported |
| 634 |
</p> |
| 635 |
</dd> |
| 636 |
</dl> |
| 637 |
|
| 638 |
<p>If a language specifying token is not found, <code>load</code> will use the |
| 639 |
same language as a nonscript file (i.e. it uses the file extension and |
| 640 |
runtime system options to determine the language). |
| 641 |
</p> |
| 642 |
<p>After processing the script line, <code>load</code> will parse the rest of |
| 643 |
the file (using the syntax of the language indicated) and then execute |
| 644 |
it. When the file is being loaded because it is an argument on the |
| 645 |
interpreter’s command line, the interpreter will: |
| 646 |
</p> |
| 647 |
<ul> |
| 648 |
<li> |
| 649 |
<a name="index-command_002dline"></a> |
| 650 |
Setup the <code>command-line</code> procedure so that it returns a list |
| 651 |
containing the expanded file name of the script file and the |
| 652 |
arguments following the script file on the command line. |
| 653 |
This is done before the script is executed. The expanded file name |
| 654 |
of the script file can be used to determine the directory that |
| 655 |
contains the script (i.e. <code>(path-directory (car (command-line)))</code>). |
| 656 |
|
| 657 |
</li><li> |
| 658 |
After the script is loaded the procedure <code>main</code> is called with |
| 659 |
the command-line arguments. The way this is done depends on the |
| 660 |
language specifying token. For <code>scheme-r4rs</code>, |
| 661 |
<code>scheme-r5rs</code>, <code>scheme-ieee-1178-1990</code>, and |
| 662 |
<code>scheme-srfi-0</code>, the <code>main</code> procedure is called with the |
| 663 |
equivalent of <code>(main (cdr (command-line)))</code> and <code>main</code> is |
| 664 |
expected to return a process exit status code in the range 0 to 255. |
| 665 |
This conforms to the “Running Scheme Scripts on Unix SRFI” (SRFI |
| 666 |
22). For <code>gsi-script</code> and <code>six-script</code> the <code>main</code> |
| 667 |
procedure is called with the equivalent of <code>(apply main (cdr |
| 668 |
(command-line)))</code> and the process exit status code is 0 (<code>main</code>’s |
| 669 |
result is ignored). The Gambit-C system has a predefined <code>main</code> |
| 670 |
procedure which accepts any number of arguments and returns 0, so it |
| 671 |
is perfectly valid for a script to not define <code>main</code> and to do |
| 672 |
all its processing with top-level expressions (examples are given in |
| 673 |
the next section). |
| 674 |
|
| 675 |
</li><li> |
| 676 |
When <code>main</code> returns, the interpreter exits. The command-line |
| 677 |
arguments after a script file are consequently not processed (however |
| 678 |
they do appear in the list returned by the <code>command-line</code> |
| 679 |
procedure, after the script file’s expanded file name, so it is up to |
| 680 |
the script to process them). |
| 681 |
|
| 682 |
</li></ul> |
| 683 |
|
| 684 |
<table class="menu" border="0" cellspacing="0"> |
| 685 |
<tr><td align="left" valign="top"><a href="#Scripts-under-UNIX-and-Mac-OS-X">2.5.1 Scripts under UNIX and Mac OS X</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 686 |
<tr><td align="left" valign="top"><a href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 687 |
<tr><td align="left" valign="top"><a href="#Compiling-scripts">2.5.3 Compiling scripts</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 688 |
</table> |
| 689 |
|
| 690 |
<a name="Scripts-under-UNIX-and-Mac-OS-X"></a><hr size="6"><br/><br/><br/> |
| 691 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 692 |
<tr><td valign="middle" align="left"><a href="#Scheme-scripts" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 693 |
<td valign="middle" align="left"><a href="#Scripts-under-Microsoft-Windows" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 694 |
<td valign="middle" align="left"> </td> |
| 695 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 696 |
<td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 697 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 698 |
<td valign="middle" align="left"> </td> |
| 699 |
<td valign="middle" align="left"> </td> |
| 700 |
<td valign="middle" align="left"> </td> |
| 701 |
<td valign="middle" align="left"> </td> |
| 702 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 703 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 704 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 705 |
</tr></table> |
| 706 |
<a name="Scripts-under-UNIX-and-Mac-OS-X-1"></a> |
| 707 |
<h3 class="subsection">2.5.1 Scripts under UNIX and Mac OS X</h3> |
| 708 |
|
| 709 |
<p>Under UNIX and Mac OS X, the Gambit-C installation process creates the |
| 710 |
executable ‘<samp>gsi</samp>’ and also the executables ‘<samp>six</samp>’, |
| 711 |
‘<samp>gsi-script</samp>’, ‘<samp>six-script</samp>’, ‘<samp>scheme-r5rs</samp>’, |
| 712 |
‘<samp>scheme-srfi-0</samp>’, etc as links to ‘<samp>gsi</samp>’. A Scheme script |
| 713 |
need only start with the name of the desired Scheme language variant |
| 714 |
prefixed with ‘<samp>#!</samp>’ and the directory where the Gambit-C |
| 715 |
executables are stored. This script should be made executable by |
| 716 |
setting the execute permission bits (with a ‘<samp>chmod +x |
| 717 |
<var>script</var></samp>’). Here is an example of a script which lists on standard |
| 718 |
output the files in the current directory: |
| 719 |
</p> |
| 720 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit-C/bin/gsi-script |
| 721 |
(for-each pretty-print (directory-files)) |
| 722 |
</pre></td></tr></table> |
| 723 |
|
| 724 |
<p>Here is another UNIX script, using the Scheme infix syntax extension, |
| 725 |
which takes a single integer argument and prints on standard output the |
| 726 |
numbers from 1 to that integer: |
| 727 |
</p> |
| 728 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit-C/bin/six-script |
| 729 |
|
| 730 |
void main (obj n_str) |
| 731 |
{ |
| 732 |
int n = \string->number(n_str); |
| 733 |
for (int i=1; i<=n; i++) |
| 734 |
\pretty-print(i); |
| 735 |
} |
| 736 |
</pre></td></tr></table> |
| 737 |
|
| 738 |
<p>For maximal portability it is a good idea to start scripts indirectly |
| 739 |
through the ‘<samp>/usr/bin/env</samp>’ program, so that the executable of the |
| 740 |
interpreter will be searched in the user’s ‘<samp>PATH</samp>’. This is what |
| 741 |
SRFI 22 recommends. For example here is a script that mimics the UNIX |
| 742 |
‘<samp>cat</samp>’ utility for text files: |
| 743 |
</p> |
| 744 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>#!/usr/bin/env gsi-script |
| 745 |
|
| 746 |
(define (display-file filename) |
| 747 |
(display (call-with-input-file filename |
| 748 |
(lambda (port) |
| 749 |
(read-line port #f))))) |
| 750 |
|
| 751 |
(for-each display-file (cdr (command-line))) |
| 752 |
</pre></td></tr></table> |
| 753 |
|
| 754 |
<a name="Scripts-under-Microsoft-Windows"></a><hr size="6"><br/><br/><br/> |
| 755 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 756 |
<tr><td valign="middle" align="left"><a href="#Scripts-under-UNIX-and-Mac-OS-X" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 757 |
<td valign="middle" align="left"><a href="#Compiling-scripts" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 758 |
<td valign="middle" align="left"> </td> |
| 759 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 760 |
<td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 761 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 762 |
<td valign="middle" align="left"> </td> |
| 763 |
<td valign="middle" align="left"> </td> |
| 764 |
<td valign="middle" align="left"> </td> |
| 765 |
<td valign="middle" align="left"> </td> |
| 766 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 767 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 768 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 769 |
</tr></table> |
| 770 |
<a name="Scripts-under-Microsoft-Windows-1"></a> |
| 771 |
<h3 class="subsection">2.5.2 Scripts under Microsoft Windows</h3> |
| 772 |
|
| 773 |
<p>Under Microsoft Windows, the Gambit-C installation process creates the |
| 774 |
executable ‘<samp>gsi.exe</samp>’ and ‘<samp>six.exe</samp>’ and also the batch files |
| 775 |
‘<samp>gsi-script.bat</samp>’, ‘<samp>six-script.bat</samp>’, ‘<samp>scheme-r5rs.bat</samp>’, |
| 776 |
‘<samp>scheme-srfi-0.bat</samp>’, etc which simply invoke ‘<samp>gsi.exe</samp>’ with |
| 777 |
the same command line arguments. A Scheme script need only start with |
| 778 |
the name of the desired Scheme language variant prefixed with |
| 779 |
‘<samp>@;</samp>’. A UNIX script can be converted to a Microsoft Windows |
| 780 |
script simply by changing the script line and storing the script in a |
| 781 |
file whose name has a ‘<samp>.bat</samp>’ or ‘<samp>.cmd</samp>’ extension: |
| 782 |
</p> |
| 783 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>@;gsi-script %~f0 %* |
| 784 |
(display "files:\n") |
| 785 |
(pretty-print (directory-files)) |
| 786 |
</pre></td></tr></table> |
| 787 |
|
| 788 |
<p>Note that Microsoft Windows always searches executables in the user’s |
| 789 |
‘<samp>PATH</samp>’, so there is no need for an indirection such as the UNIX |
| 790 |
‘<samp>/usr/bin/env</samp>’. However the script line must end with ‘<samp>%~f0 |
| 791 |
%*</samp>’ to pass the expanded filename of the script and command line |
| 792 |
arguments to the interpreter. |
| 793 |
</p> |
| 794 |
<a name="Compiling-scripts"></a><hr size="6"><br/><br/><br/> |
| 795 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 796 |
<tr><td valign="middle" align="left"><a href="#Scripts-under-Microsoft-Windows" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 797 |
<td valign="middle" align="left"><a href="#GSC" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 798 |
<td valign="middle" align="left"> </td> |
| 799 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 800 |
<td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 801 |
<td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 802 |
<td valign="middle" align="left"> </td> |
| 803 |
<td valign="middle" align="left"> </td> |
| 804 |
<td valign="middle" align="left"> </td> |
| 805 |
<td valign="middle" align="left"> </td> |
| 806 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 807 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 808 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 809 |
</tr></table> |
| 810 |
<a name="Compiling-scripts-1"></a> |
| 811 |
<h3 class="subsection">2.5.3 Compiling scripts</h3> |
| 812 |
|
| 813 |
<p>A script file can be compiled using the Gambit Scheme compiler |
| 814 |
(see section <a href="#GSC">The Gambit Scheme compiler</a>) into a standalone executable. The script line will |
| 815 |
provide information to the compiler on which language to use. The |
| 816 |
script line also provides information on which runtime options to use |
| 817 |
when executing the compiled script. This is useful to set the default |
| 818 |
runtime options of an executable program. |
| 819 |
</p> |
| 820 |
<p>The compiled script will be executed similarly to an interpreted |
| 821 |
script (i.e. the list of command line arguments returned by the |
| 822 |
<code>command-line</code> procedure and the invocation of the <code>main</code> |
| 823 |
procedure). |
| 824 |
</p> |
| 825 |
<p>For example: |
| 826 |
</p> |
| 827 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat square.scm</b> |
| 828 |
#!/usr/local/Gambit-C/bin/gsi-script -:d0 |
| 829 |
(define (main arg) |
| 830 |
(pretty-print (expt (string->number arg) 2))) |
| 831 |
$ <b>gsi square 30 <span class="roman"><i># gsi will load square.scm</i></span></b> |
| 832 |
900 |
| 833 |
$ <b>gsc -exe square <span class="roman"><i># compile the script to a standalone program</i></span></b> |
| 834 |
$ <b>./square 30</b> |
| 835 |
900 |
| 836 |
$ <b>./square 1 2 3 <span class="roman"><i># too many arguments to main</i></span></b> |
| 837 |
$ <b>echo $?</b> |
| 838 |
70 |
| 839 |
$ <b>./square -:d1 1 2 3 <span class="roman"><i># ask for error message</i></span></b> |
| 840 |
*** ERROR -- Wrong number of arguments passed to procedure |
| 841 |
(main "1" "2" "3") |
| 842 |
</pre></td></tr></table> |
| 843 |
|
| 844 |
<a name="GSC"></a><hr size="6"><br/><br/><br/> |
| 845 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 846 |
<tr><td valign="middle" align="left"><a href="#Compiling-scripts" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 847 |
<td valign="middle" align="left"><a href="#GSC-interactive-mode" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 848 |
<td valign="middle" align="left"> </td> |
| 849 |
<td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 850 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 851 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 852 |
<td valign="middle" align="left"> </td> |
| 853 |
<td valign="middle" align="left"> </td> |
| 854 |
<td valign="middle" align="left"> </td> |
| 855 |
<td valign="middle" align="left"> </td> |
| 856 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 857 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 858 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 859 |
</tr></table> |
| 860 |
<a name="The-Gambit-Scheme-compiler"></a> |
| 861 |
<h1 class="chapter">3. The Gambit Scheme compiler</h1> |
| 862 |
<a name="index-compiler"></a> |
| 863 |
<a name="index-interpreter-1"></a> |
| 864 |
|
| 865 |
<p>Synopsis: |
| 866 |
</p> |
| 867 |
<table><tr><td> </td><td><pre class="example"><b></b>gsc <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,…<span class="roman">]</span> <span class="roman">[</span>-i<span class="roman">]</span> <span class="roman">[</span>-f<span class="roman">]</span> <span class="roman">[</span>-v<span class="roman">]</span> |
| 868 |
<span class="roman">[</span>-prelude <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span>-postlude <span class="roman"><var>expressions</var></span><span class="roman">]</span> |
| 869 |
<span class="roman">[</span>-dynamic<span class="roman">]</span> <span class="roman">[</span>-exe<span class="roman">]</span> <span class="roman">[</span>-obj<span class="roman">]</span> <span class="roman">[</span>-cc-options <span class="roman"><var>options</var></span><span class="roman">]</span> |
| 870 |
<span class="roman">[</span>-ld-options-prelude <span class="roman"><var>options</var></span><span class="roman">]</span> <span class="roman">[</span>-ld-options <span class="roman"><var>options</var></span><span class="roman">]</span> |
| 871 |
<span class="roman">[</span>-warnings<span class="roman">]</span> <span class="roman">[</span>-verbose<span class="roman">]</span> <span class="roman">[</span>-report<span class="roman">]</span> <span class="roman">[</span>-expansion<span class="roman">]</span> <span class="roman">[</span>-gvm<span class="roman">]</span> |
| 872 |
<span class="roman">[</span>-debug<span class="roman">]</span> <span class="roman">[</span>-debug-location<span class="roman">]</span> <span class="roman">[</span>-debug-source<span class="roman">]</span> |
| 873 |
<span class="roman">[</span>-debug-environments<span class="roman">]</span> <span class="roman">[</span>-track-scheme<span class="roman">]</span> |
| 874 |
<span class="roman">[</span>-o <span class="roman"><var>output</var></span><span class="roman">]</span> <span class="roman">[</span>-c<span class="roman">]</span> <span class="roman">[</span>-keep-c<span class="roman">]</span> <span class="roman">[</span>-link<span class="roman">]</span> <span class="roman">[</span>-flat<span class="roman">]</span> <span class="roman">[</span>-l <span class="roman"><var>base</var></span><span class="roman">]</span> |
| 875 |
<span class="roman">[</span><span class="roman">[</span>-<span class="roman">]</span> <span class="roman">[</span>-e <span class="roman"><var>expressions</var></span><span class="roman">]</span> <span class="roman">[</span><span class="roman"><var>file</var></span><span class="roman">]</span><span class="roman">]</span>… |
| 876 |
</pre></td></tr></table> |
| 877 |
|
| 878 |
<table class="menu" border="0" cellspacing="0"> |
| 879 |
<tr><td align="left" valign="top"><a href="#GSC-interactive-mode">3.1 Interactive mode</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 880 |
<tr><td align="left" valign="top"><a href="#GSC-customization">3.2 Customization</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 881 |
<tr><td align="left" valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 882 |
<tr><td align="left" valign="top"><a href="#Link-files">3.4 Link files</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 883 |
<tr><td align="left" valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 884 |
</table> |
| 885 |
|
| 886 |
<a name="GSC-interactive-mode"></a><hr size="6"><br/><br/><br/> |
| 887 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 888 |
<tr><td valign="middle" align="left"><a href="#GSC" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 889 |
<td valign="middle" align="left"><a href="#GSC-customization" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 890 |
<td valign="middle" align="left"> </td> |
| 891 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 892 |
<td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 893 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 894 |
<td valign="middle" align="left"> </td> |
| 895 |
<td valign="middle" align="left"> </td> |
| 896 |
<td valign="middle" align="left"> </td> |
| 897 |
<td valign="middle" align="left"> </td> |
| 898 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 899 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 900 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 901 |
</tr></table> |
| 902 |
<a name="Interactive-mode"></a> |
| 903 |
<h2 class="section">3.1 Interactive mode</h2> |
| 904 |
|
| 905 |
<p>When no command line argument is present other than options the |
| 906 |
compiler behaves like the interpreter in interactive mode. The only |
| 907 |
difference with the interpreter is that the compilation related |
| 908 |
procedures listed in this chapter are also available |
| 909 |
(i.e. <code>compile-file</code>, <code>compile-file-to-target</code>, etc). |
| 910 |
</p> |
| 911 |
<a name="GSC-customization"></a><hr size="6"><br/><br/><br/> |
| 912 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 913 |
<tr><td valign="middle" align="left"><a href="#GSC-interactive-mode" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 914 |
<td valign="middle" align="left"><a href="#GSC-batch-mode" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 915 |
<td valign="middle" align="left"> </td> |
| 916 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 917 |
<td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 918 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 919 |
<td valign="middle" align="left"> </td> |
| 920 |
<td valign="middle" align="left"> </td> |
| 921 |
<td valign="middle" align="left"> </td> |
| 922 |
<td valign="middle" align="left"> </td> |
| 923 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 924 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 925 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 926 |
</tr></table> |
| 927 |
<a name="Customization"></a> |
| 928 |
<h2 class="section">3.2 Customization</h2> |
| 929 |
|
| 930 |
<p>Like the interpreter, the compiler will examine the initialization |
| 931 |
file unless the ‘<samp>-f</samp>’ option is specified. |
| 932 |
</p> |
| 933 |
<a name="GSC-batch-mode"></a><hr size="6"><br/><br/><br/> |
| 934 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 935 |
<tr><td valign="middle" align="left"><a href="#GSC-customization" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 936 |
<td valign="middle" align="left"><a href="#Link-files" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 937 |
<td valign="middle" align="left"> </td> |
| 938 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 939 |
<td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 940 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 941 |
<td valign="middle" align="left"> </td> |
| 942 |
<td valign="middle" align="left"> </td> |
| 943 |
<td valign="middle" align="left"> </td> |
| 944 |
<td valign="middle" align="left"> </td> |
| 945 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 946 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 947 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 948 |
</tr></table> |
| 949 |
<a name="Batch-mode"></a> |
| 950 |
<h2 class="section">3.3 Batch mode</h2> |
| 951 |
|
| 952 |
<a name="index-gsc-1"></a> |
| 953 |
<a name="index-_002escm"></a> |
| 954 |
<a name="index-_002esix"></a> |
| 955 |
<a name="index-_002ec"></a> |
| 956 |
<a name="index-file_002escm"></a> |
| 957 |
<a name="index-file_002esix"></a> |
| 958 |
<a name="index-file_002ec"></a> |
| 959 |
<p>In batch mode <code>gsc</code> takes a set of file names (with either no |
| 960 |
extension, or a C file extension, or some other extension) on the |
| 961 |
command line and compiles each Scheme file into a C file. |
| 962 |
The recognized C file extensions are ‘<samp>.c</samp>’, ‘<samp>.C</samp>’, ‘<samp>.cc</samp>’, |
| 963 |
‘<samp>.cp</samp>’, ‘<samp>.cpp</samp>’, ‘<samp>.CPP</samp>’, ‘<samp>.cxx</samp>’, ‘<samp>.c++</samp>’, |
| 964 |
‘<samp>.m</samp>’, ‘<samp>.M</samp>’, and ‘<samp>.mm</samp>’. |
| 965 |
The extension can be omitted from <var>file</var> when the Scheme file has a |
| 966 |
‘<samp>.scm</samp>’ or ‘<samp>.six</samp>’ extension. When the extension of the |
| 967 |
Scheme file is ‘<samp>.six</samp>’ the content of the file will be parsed |
| 968 |
using the Scheme infix syntax extension (see <a href="#Scheme-infix-syntax-extension">Scheme infix syntax extension</a>). Otherwise, <code>gsc</code> will parse the Scheme file using the |
| 969 |
normal Scheme prefix syntax. Files with a C file extension must |
| 970 |
have been previously produced by <code>gsc</code>, with the ‘<samp>-c</samp>’ option, |
| 971 |
and are used by Gambit’s linker. |
| 972 |
</p> |
| 973 |
<p>For each Scheme file a C file ‘<samp><var>file</var>.c</samp>’ will be produced. |
| 974 |
The C file’s name is the same as the Scheme file, but the extension is |
| 975 |
changed to ‘<samp>.c</samp>’. By default the C file is created in the same |
| 976 |
directory as the Scheme file. This default can be overridden with the |
| 977 |
compiler’s ‘<samp>-o</samp>’ option. |
| 978 |
</p> |
| 979 |
<p>The C files produced by the compiler serve two purposes. They will be |
| 980 |
processed by a C compiler to generate object files, and they also |
| 981 |
contain information to be read by Gambit’s linker to generate a |
| 982 |
<em>link file</em>. The link file is a C file that collects various |
| 983 |
linking information for a group of modules, such as the set of all |
| 984 |
symbols and global variables used by the modules. |
| 985 |
<a name="index-_002dlink"></a> |
| 986 |
<a name="index-_002dexe"></a> |
| 987 |
The linker is only invoked when the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ |
| 988 |
options appear on the command line. |
| 989 |
</p> |
| 990 |
<p>Compiler options must be specified before the first file name and |
| 991 |
after the ‘<samp>-:</samp>’ runtime option (see section <a href="#Runtime-options">Runtime options</a>). If |
| 992 |
present, the ‘<samp>-i</samp>’, ‘<samp>-f</samp>’, and ‘<samp>-v</samp>’ compiler options |
| 993 |
must come first. The available options are: |
| 994 |
</p> |
| 995 |
<a name="index-compiler-options"></a> |
| 996 |
<a name="index-options_002c-compiler"></a> |
| 997 |
<dl compact="compact"> |
| 998 |
<dt> <code>-i</code></dt> |
| 999 |
<dd><p>Force interpreter mode. |
| 1000 |
</p></dd> |
| 1001 |
<dt> <code>-f</code></dt> |
| 1002 |
<dd><p>Do not examine the initialization file. |
| 1003 |
</p></dd> |
| 1004 |
<dt> <code>-v</code></dt> |
| 1005 |
<dd><p>Print the system version string, system time stamp, operating system |
| 1006 |
type, and configure script options on standard output and exit. |
| 1007 |
</p></dd> |
| 1008 |
<dt> <code>-prelude <var>expressions</var></code></dt> |
| 1009 |
<dd><p>Add expressions to the top of the source code being compiled. |
| 1010 |
</p></dd> |
| 1011 |
<dt> <code>-postlude <var>expressions</var></code></dt> |
| 1012 |
<dd><p>Add expressions to the bottom of the source code being compiled. |
| 1013 |
</p></dd> |
| 1014 |
<dt> <code>-cc-options <var>options</var></code></dt> |
| 1015 |
<dd><p>Add options to the command that invokes the C compiler. |
| 1016 |
</p></dd> |
| 1017 |
<dt> <code>-ld-options-prelude <var>options</var></code></dt> |
| 1018 |
<dd><p>Add options to the command that invokes the C linker. |
| 1019 |
</p></dd> |
| 1020 |
<dt> <code>-ld-options <var>options</var></code></dt> |
| 1021 |
<dd><p>Add options to the command that invokes the C linker. |
| 1022 |
</p></dd> |
| 1023 |
<dt> <code>-warnings</code></dt> |
| 1024 |
<dd><p>Display warnings. |
| 1025 |
</p></dd> |
| 1026 |
<dt> <code>-verbose</code></dt> |
| 1027 |
<dd><p>Display a trace of the compiler’s activity. |
| 1028 |
</p></dd> |
| 1029 |
<dt> <code>-report</code></dt> |
| 1030 |
<dd><p>Display a global variable usage report. |
| 1031 |
</p></dd> |
| 1032 |
<dt> <code>-expansion</code></dt> |
| 1033 |
<dd><p>Display the source code after expansion. |
| 1034 |
</p></dd> |
| 1035 |
<dt> <code>-gvm</code></dt> |
| 1036 |
<dd><p>Generate a listing of the GVM code. |
| 1037 |
</p></dd> |
| 1038 |
<dt> <code>-debug</code></dt> |
| 1039 |
<dd><p>Include all debugging information in the code generated. |
| 1040 |
</p></dd> |
| 1041 |
<dt> <code>-debug-location</code></dt> |
| 1042 |
<dd><p>Include source code location debugging information in the code generated. |
| 1043 |
</p></dd> |
| 1044 |
<dt> <code>-debug-source</code></dt> |
| 1045 |
<dd><p>Include the source code debugging information in the code generated. |
| 1046 |
</p></dd> |
| 1047 |
<dt> <code>-debug-environments</code></dt> |
| 1048 |
<dd><p>Include environment debugging information in the code generated. |
| 1049 |
</p></dd> |
| 1050 |
<dt> <code>-track-scheme</code></dt> |
| 1051 |
<dd><p>Generate ‘<samp>#line</samp>’ directives referring back to the Scheme code. |
| 1052 |
</p></dd> |
| 1053 |
<dt> <code>-o <var>output</var></code></dt> |
| 1054 |
<dd><p>Set name of output file or directory where output file(s) are written. |
| 1055 |
</p></dd> |
| 1056 |
<dt> <code>-dynamic</code></dt> |
| 1057 |
<dd><p>Compile Scheme source files to dynamically loadable object |
| 1058 |
files (this is the default). |
| 1059 |
</p></dd> |
| 1060 |
<dt> <code>-exe</code></dt> |
| 1061 |
<dd><p>Compile Scheme source files into an executable program. |
| 1062 |
</p></dd> |
| 1063 |
<dt> <code>-obj</code></dt> |
| 1064 |
<dd><p>Compile Scheme source files to object files. |
| 1065 |
</p></dd> |
| 1066 |
<dt> <code>-keep-c</code></dt> |
| 1067 |
<dd><p>Keep any intermediate ‘<samp>.c</samp>’ files that are generated. |
| 1068 |
</p></dd> |
| 1069 |
<dt> <code>-c</code></dt> |
| 1070 |
<dd><p>Compile Scheme source files to C without generating link file. |
| 1071 |
</p></dd> |
| 1072 |
<dt> <code>-link</code></dt> |
| 1073 |
<dd><p>Compile Scheme source files to C and generate a link file. |
| 1074 |
</p></dd> |
| 1075 |
<dt> <code>-flat</code></dt> |
| 1076 |
<dd><p>Generate a flat link file instead of the default incremental link file. |
| 1077 |
</p></dd> |
| 1078 |
<dt> <code>-l <var>base</var></code></dt> |
| 1079 |
<dd><p>Specify the link file of the base library to use for the link. |
| 1080 |
</p></dd> |
| 1081 |
<dt> <code>-</code></dt> |
| 1082 |
<dd><p>Start REPL interaction. |
| 1083 |
</p></dd> |
| 1084 |
<dt> <code>-e <var>expressions</var></code></dt> |
| 1085 |
<dd><p>Evaluate expressions in the interaction environment. |
| 1086 |
</p></dd> |
| 1087 |
</dl> |
| 1088 |
|
| 1089 |
<a name="index-_002di"></a> |
| 1090 |
<p>The ‘<samp>-i</samp>’ option forces the compiler to process the remaining |
| 1091 |
command line arguments like the interpreter. |
| 1092 |
</p> |
| 1093 |
<a name="index-_002dprelude"></a> |
| 1094 |
<p>The ‘<samp>-prelude</samp>’ option adds the specified expressions to the top of |
| 1095 |
the source code being compiled. The main use of this option is to |
| 1096 |
supply declarations on the command line. For example the following |
| 1097 |
invocation of the compiler will compile the file ‘<samp>bench.scm</samp>’ in |
| 1098 |
unsafe mode: |
| 1099 |
</p> |
| 1100 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -prelude "(declare (not safe))" bench.scm</b> |
| 1101 |
</pre></td></tr></table> |
| 1102 |
|
| 1103 |
<a name="index-_002dpostlude"></a> |
| 1104 |
<p>The ‘<samp>-postlude</samp>’ option adds the specified expressions to the bottom |
| 1105 |
of the source code being compiled. The main use of this option is to |
| 1106 |
supply the expression that will start the execution of the program. For |
| 1107 |
example: |
| 1108 |
</p> |
| 1109 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -postlude "(start-bench)" bench.scm</b> |
| 1110 |
</pre></td></tr></table> |
| 1111 |
|
| 1112 |
<a name="index-_002dcc_002doptions"></a> |
| 1113 |
<p>The ‘<samp>-cc-options</samp>’ option is only meaningful when a dynamically |
| 1114 |
loadable object file is being generated (neither the ‘<samp>-c</samp>’ or |
| 1115 |
‘<samp>-link</samp>’ options are used). The ‘<samp>-cc-options</samp>’ option adds |
| 1116 |
the specified options to the command that invokes the C compiler. The |
| 1117 |
main use of this option is to specify the include path, some symbols |
| 1118 |
to define or undefine, the optimization level, or any C compiler |
| 1119 |
option that is different from the default. For example: |
| 1120 |
</p> |
| 1121 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -cc-options "-U___SINGLE_HOST -O2 -I../include" bench.scm</b> |
| 1122 |
</pre></td></tr></table> |
| 1123 |
|
| 1124 |
<a name="index-_002dld_002doptions_002dprelude"></a> |
| 1125 |
<a name="index-_002dld_002doptions"></a> |
| 1126 |
<p>The ‘<samp>-ld-options-prelude</samp>’ and ‘<samp>-ld-options</samp>’ options are only |
| 1127 |
meaningful when a dynamically loadable object file is being generated |
| 1128 |
(neither the ‘<samp>-c</samp>’ or ‘<samp>-link</samp>’ options are used). The |
| 1129 |
‘<samp>-ld-options-prelude</samp>’ and ‘<samp>-ld-options</samp>’ options add the |
| 1130 |
specified options to the command that invokes the C linker (the |
| 1131 |
options in <var>ld-options-prelude</var> are passed to the C linker before |
| 1132 |
the input file and the options in <var>ld-options</var> are passed after). |
| 1133 |
The main use of this option is to specify additional object files or |
| 1134 |
libraries that need to be linked, or any C linker option that is |
| 1135 |
different from the default (such as the library search path and flags |
| 1136 |
to select between static and dynamic linking). For example: |
| 1137 |
</p> |
| 1138 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -ld-options "-L/usr/X11R6/lib -lX11 -dynamic" bench.scm</b> |
| 1139 |
</pre></td></tr></table> |
| 1140 |
|
| 1141 |
<a name="index-_002dwarnings"></a> |
| 1142 |
<p>The ‘<samp>-warnings</samp>’ option displays on standard output all warnings |
| 1143 |
that the compiler may have. |
| 1144 |
</p> |
| 1145 |
<a name="index-_002dverbose"></a> |
| 1146 |
<p>The ‘<samp>-verbose</samp>’ option displays on standard output a trace of the |
| 1147 |
compiler’s activity. |
| 1148 |
</p> |
| 1149 |
<a name="index-_002dreport"></a> |
| 1150 |
<p>The ‘<samp>-report</samp>’ option displays on standard output a global |
| 1151 |
variable usage report. Each global variable used in the program is |
| 1152 |
listed with 4 flags that indicate whether the global variable is |
| 1153 |
defined, referenced, mutated and called. |
| 1154 |
</p> |
| 1155 |
<a name="index-_002dexpansion"></a> |
| 1156 |
<p>The ‘<samp>-expansion</samp>’ option displays on standard output the source code |
| 1157 |
after expansion and inlining by the front end. |
| 1158 |
</p> |
| 1159 |
<a name="index-_002dgvm"></a> |
| 1160 |
<p>The ‘<samp>-gvm</samp>’ option generates a listing of the intermediate code |
| 1161 |
for the “Gambit Virtual Machine” (GVM) of each Scheme file on |
| 1162 |
‘<samp><var>file</var>.gvm</samp>’. |
| 1163 |
</p> |
| 1164 |
<a name="index-_002ddebug"></a> |
| 1165 |
<a name="index-debug"></a> |
| 1166 |
<p>The ‘<samp>-debug</samp>’ option causes all kinds of debugging information to |
| 1167 |
be saved in the code generated. See the documentation of the |
| 1168 |
‘<samp>debug</samp>’ declaration for details. |
| 1169 |
</p> |
| 1170 |
<a name="index-_002ddebug_002dlocation"></a> |
| 1171 |
<a name="index-debug_002dlocation"></a> |
| 1172 |
<p>The ‘<samp>-debug-location</samp>’ option causes source code location |
| 1173 |
debugging information to be saved in the code generated. See the |
| 1174 |
documentation of the ‘<samp>debug-location</samp>’ declaration for details. |
| 1175 |
</p> |
| 1176 |
<a name="index-_002ddebug_002dsource"></a> |
| 1177 |
<a name="index-debug_002dsource"></a> |
| 1178 |
<p>The ‘<samp>-debug-source</samp>’ option causes source code debugging |
| 1179 |
information to be saved in the code generated. See the documentation |
| 1180 |
of the ‘<samp>debug-source</samp>’ declaration for details. |
| 1181 |
</p> |
| 1182 |
<a name="index-_002ddebug_002denvironments"></a> |
| 1183 |
<a name="index-debug_002denvironments"></a> |
| 1184 |
<p>The ‘<samp>-debug-environments</samp>’ option causes environment debugging |
| 1185 |
information to be saved in the code generated. See the documentation |
| 1186 |
of the ‘<samp>debug-environments</samp>’ declaration for details. |
| 1187 |
</p> |
| 1188 |
<a name="index-_002dtrack_002dscheme"></a> |
| 1189 |
<p>The ‘<samp>-track-scheme</samp>’ options causes the generation of ‘<samp>#line</samp>’ |
| 1190 |
directives that refer back to the Scheme source code. This allows the |
| 1191 |
use of a C debugger or profiler to debug Scheme code. |
| 1192 |
</p> |
| 1193 |
<a name="index-_002do-output"></a> |
| 1194 |
<p>The ‘<samp>-o</samp>’ option sets the filename of the output file, or the |
| 1195 |
directory in which the output file(s) generated by the compiler are |
| 1196 |
written. |
| 1197 |
</p> |
| 1198 |
<a name="index-_002dc"></a> |
| 1199 |
<a name="index-_002ddynamic"></a> |
| 1200 |
<a name="index-_002dexe-1"></a> |
| 1201 |
<a name="index-_002dobj"></a> |
| 1202 |
<a name="index-_002dlink-1"></a> |
| 1203 |
<a name="index-_002dkeep_002dc"></a> |
| 1204 |
<a name="index-last_005f_002ec"></a> |
| 1205 |
<p>If the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options appear on the command line, |
| 1206 |
the Gambit linker is invoked to generate the link file from the set of |
| 1207 |
C files specified on the command line or produced by the Gambit |
| 1208 |
compiler. By default the link file is ‘<samp><var>last</var>_.c</samp>’, where |
| 1209 |
‘<samp><var>last</var>.c</samp>’ is the last file in the set of C files. When the |
| 1210 |
‘<samp>-c</samp>’ option is specified, the Scheme source files are compiled to |
| 1211 |
C files. When the ‘<samp>-exe</samp>’ option is specified, the generated C |
| 1212 |
files and link file are compiled and linked using the C compiler to |
| 1213 |
produce an executable program whose name defaults to |
| 1214 |
‘<samp><var>last</var>.exe</samp>’. When the ‘<samp>-obj</samp>’ option is specified, the |
| 1215 |
generated C files are compiled using the C compiler to produce object |
| 1216 |
files (‘<samp>.o</samp>’ or ‘<samp>.obj</samp>’ extensions). If neither the |
| 1217 |
‘<samp>-link</samp>’, ‘<samp>-c</samp>’, ‘<samp>-exe</samp>’, ‘<samp>-obj</samp>’ options appear on |
| 1218 |
the command line, the Scheme source files are compiled to dynamically |
| 1219 |
loadable object files (‘<samp>.o<var>n</var></samp>’ extension). The |
| 1220 |
‘<samp>-keep-c</samp>’ option will prevent the deletion of any intermediate |
| 1221 |
‘<samp>.c</samp>’ file that is generated. Note that in this case the |
| 1222 |
intermediate ‘<samp>.c</samp>’ file will be generated in the same directory as |
| 1223 |
the Scheme source file even if the ‘<samp>-o</samp>’ option is used. |
| 1224 |
</p> |
| 1225 |
<a name="index-_002dflat"></a> |
| 1226 |
<p>The ‘<samp>-flat</samp>’ option is only meaningful when a link file is being |
| 1227 |
generated (i.e. the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options also appear on |
| 1228 |
the command line). The ‘<samp>-flat</samp>’ option directs the Gambit linker |
| 1229 |
to generate a flat link file. By default, the linker generates an |
| 1230 |
incremental link file (see the next section for a description of the |
| 1231 |
two types of link files). |
| 1232 |
</p> |
| 1233 |
<a name="index-_002dl-base"></a> |
| 1234 |
<p>The ‘<samp>-l</samp>’ option is only meaningful when an incremental link file |
| 1235 |
is being generated (i.e. the ‘<samp>-link</samp>’ or ‘<samp>-exe</samp>’ options |
| 1236 |
appear on the command line and the ‘<samp>-flat</samp>’ option is absent). |
| 1237 |
The ‘<samp>-l</samp>’ option specifies the link file (without the ‘<samp>.c</samp>’ |
| 1238 |
extension) of the base library to use for the incremental link. By |
| 1239 |
default the link file of the Gambit runtime library is used |
| 1240 |
(i.e. ‘<samp>~~lib/_gambc.c</samp>’). |
| 1241 |
</p> |
| 1242 |
<a name="index-_002d"></a> |
| 1243 |
<p>The ‘<samp>-</samp>’ option starts a REPL interaction. |
| 1244 |
</p> |
| 1245 |
<a name="index-_002de"></a> |
| 1246 |
<p>The ‘<samp>-e</samp>’ option evaluates the specified expressions in the |
| 1247 |
interaction environment. |
| 1248 |
</p> |
| 1249 |
<a name="Link-files"></a><hr size="6"><br/><br/><br/> |
| 1250 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1251 |
<tr><td valign="middle" align="left"><a href="#GSC-batch-mode" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1252 |
<td valign="middle" align="left"><a href="#Building-an-executable-program" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1253 |
<td valign="middle" align="left"> </td> |
| 1254 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1255 |
<td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1256 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1257 |
<td valign="middle" align="left"> </td> |
| 1258 |
<td valign="middle" align="left"> </td> |
| 1259 |
<td valign="middle" align="left"> </td> |
| 1260 |
<td valign="middle" align="left"> </td> |
| 1261 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1262 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1263 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1264 |
</tr></table> |
| 1265 |
<a name="Link-files-1"></a> |
| 1266 |
<h2 class="section">3.4 Link files</h2> |
| 1267 |
|
| 1268 |
<p>Gambit can be used to create programs and libraries of Scheme |
| 1269 |
modules. This section explains the steps required to do so and the role |
| 1270 |
played by the link files. |
| 1271 |
</p> |
| 1272 |
<p>In general, a program is composed of a set of Scheme modules and C |
| 1273 |
modules. Some of the modules are part of the Gambit runtime library and |
| 1274 |
the other modules are supplied by the user. When the program is |
| 1275 |
started it must setup various global tables (including the symbol table |
| 1276 |
and the global variable table) and then sequentially execute the Scheme |
| 1277 |
modules (more or less as though they were being loaded one after another). |
| 1278 |
The information required for this is contained in one or more <em>link |
| 1279 |
files</em> generated by the Gambit linker from the C files produced by the |
| 1280 |
Gambit compiler. |
| 1281 |
</p> |
| 1282 |
<p>The order of execution of the Scheme modules corresponds to the order of |
| 1283 |
the modules on the command line which produced the link file. The order |
| 1284 |
is usually important because most modules define variables and |
| 1285 |
procedures which are used by other modules (for this reason the |
| 1286 |
program’s main computation is normally started by the last module). |
| 1287 |
</p> |
| 1288 |
<p>When a single link file is used to contain the linking information of |
| 1289 |
all the Scheme modules it is called a <em>flat link file</em>. Thus a |
| 1290 |
program built with a flat link file contains in its link file both |
| 1291 |
information on the user modules and on the runtime library. This is |
| 1292 |
fine if the program is to be statically linked but is wasteful in |
| 1293 |
a shared-library context because the linking information of the |
| 1294 |
runtime library can’t be shared and will be duplicated in all |
| 1295 |
programs (this linking information typically takes hundreds of kilobytes). |
| 1296 |
</p> |
| 1297 |
<p>Flat link files are mainly useful to bundle multiple Scheme modules to |
| 1298 |
make a runtime library (such as the Gambit runtime library) or to make a |
| 1299 |
single file that can be loaded with the <code>load</code> procedure. |
| 1300 |
</p> |
| 1301 |
<p>An <em>incremental link file</em> contains only the linking information |
| 1302 |
that is not already contained in a second link file (the “base” link |
| 1303 |
file). Assuming that a flat link file was produced when the runtime |
| 1304 |
library was linked, a program can be built by linking the user |
| 1305 |
modules with the runtime library’s link file, producing an incremental |
| 1306 |
link file. This allows the creation of a shared-library which |
| 1307 |
contains the modules of the runtime library and its flat link file. |
| 1308 |
The program is dynamically linked with this shared-library and |
| 1309 |
only contains the user modules and the incremental link file. For |
| 1310 |
small programs this approach greatly reduces the size of the |
| 1311 |
program because the incremental link file is small. A “hello |
| 1312 |
world” program built this way can be as small as 5 Kbytes. Note that |
| 1313 |
it is perfectly fine to use an incremental link file for statically |
| 1314 |
linked programs (there is very little loss compared to a single flat |
| 1315 |
link file). |
| 1316 |
</p> |
| 1317 |
<p>Incremental link files may be built from other incremental link files. |
| 1318 |
This allows the creation of shared-libraries which extend the |
| 1319 |
functionality of the Gambit runtime library. |
| 1320 |
</p> |
| 1321 |
<table class="menu" border="0" cellspacing="0"> |
| 1322 |
<tr><td align="left" valign="top"><a href="#Building-an-executable-program">3.4.1 Building an executable program</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 1323 |
<tr><td align="left" valign="top"><a href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 1324 |
<tr><td align="left" valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 1325 |
<tr><td align="left" valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 1326 |
</table> |
| 1327 |
|
| 1328 |
<a name="Building-an-executable-program"></a><hr size="6"><br/><br/><br/> |
| 1329 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1330 |
<tr><td valign="middle" align="left"><a href="#Link-files" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1331 |
<td valign="middle" align="left"><a href="#Building-a-loadable-library" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1332 |
<td valign="middle" align="left"> </td> |
| 1333 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1334 |
<td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1335 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1336 |
<td valign="middle" align="left"> </td> |
| 1337 |
<td valign="middle" align="left"> </td> |
| 1338 |
<td valign="middle" align="left"> </td> |
| 1339 |
<td valign="middle" align="left"> </td> |
| 1340 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1341 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1342 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1343 |
</tr></table> |
| 1344 |
<a name="Building-an-executable-program-1"></a> |
| 1345 |
<h3 class="subsection">3.4.1 Building an executable program</h3> |
| 1346 |
|
| 1347 |
<p>The simplest way to create an executable program is to invoke |
| 1348 |
<code>gsc</code> with the ‘<samp>-exe</samp>’ option. The compiler will |
| 1349 |
transparently perform all the steps necessary, including compiling |
| 1350 |
Scheme source files to C files, generating the link file, compiling |
| 1351 |
the C files generated to object files, and creating the final |
| 1352 |
executable file using the C linker. The following example shows how |
| 1353 |
to build the executable program ‘<samp>hello.exe</samp>’ which contains the |
| 1354 |
two Scheme modules ‘<samp>h.scm</samp>’ and ‘<samp>w.six</samp>’. |
| 1355 |
</p> |
| 1356 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b> |
| 1357 |
(display "hello") (newline) |
| 1358 |
$ <b>cat w.six</b> |
| 1359 |
display("world"); newline(); |
| 1360 |
$ <b>gsc -o hello.exe -exe h.scm w.six</b> |
| 1361 |
h.scm: |
| 1362 |
/Users/feeley/gambit/doc/h.c: |
| 1363 |
w.six: |
| 1364 |
/Users/feeley/gambit/doc/w.c: |
| 1365 |
/Users/feeley/gambit/doc/w_.c: |
| 1366 |
$ <b>./hello.exe</b> |
| 1367 |
hello |
| 1368 |
world |
| 1369 |
</pre></td></tr></table> |
| 1370 |
|
| 1371 |
<p>The detailed steps which are performed can be viewed by setting the |
| 1372 |
‘<samp>GAMBC_CC_VERBOSE</samp>’ environment variable to a nonnull value. For |
| 1373 |
example: |
| 1374 |
</p> |
| 1375 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>export GAMBC_CC_VERBOSE=yes</b> |
| 1376 |
$ <b>gsc -o hello.exe -exe h.scm w.six</b> |
| 1377 |
h.scm: |
| 1378 |
/Users/feeley/gambit/doc/h.c: |
| 1379 |
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 |
| 1380 |
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer |
| 1381 |
-fPIC -fno-common -I"/usr/local/Gambit-C/include" -c -o "h.o" h.c |
| 1382 |
w.six: |
| 1383 |
/Users/feeley/gambit/doc/w.c: |
| 1384 |
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 |
| 1385 |
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer |
| 1386 |
-fPIC -fno-common -I"/usr/local/Gambit-C/include" -c -o "w.o" w.c |
| 1387 |
/Users/feeley/gambit/doc/w_.c: |
| 1388 |
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 |
| 1389 |
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer |
| 1390 |
-fPIC -fno-common -I"/usr/local/Gambit-C/include" -c -o "w_.o" w_.c |
| 1391 |
gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 |
| 1392 |
-fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer |
| 1393 |
-fPIC -fno-common -I"/usr/local/Gambit-C/include" |
| 1394 |
-o "hello.exe" h.o w.o w_.o "/usr/local/Gambit-C/lib/libgambc.a" |
| 1395 |
</pre></td></tr></table> |
| 1396 |
|
| 1397 |
<p>Using a single invocation of <code>gsc</code> with the ‘<samp>-exe</samp>’ option is |
| 1398 |
sometimes inappropriate when the build process is more complex, for |
| 1399 |
example when the program is composed of several seperately compiled |
| 1400 |
modules. In such a case it is useful to decompose the build process |
| 1401 |
into smaller compilation steps. The ‘<samp>hello.exe</samp>’ executable |
| 1402 |
program could have been built by seperating the generation of C files |
| 1403 |
from the C compilation and linking: |
| 1404 |
</p> |
| 1405 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -c h.scm</b> |
| 1406 |
$ <b>gsc -c w.six</b> |
| 1407 |
$ <b>gsc -o hello.exe -exe h.c w.c</b> |
| 1408 |
</pre></td></tr></table> |
| 1409 |
|
| 1410 |
<p>When even finer control is desired the build process can be decomposed |
| 1411 |
into smaller steps that invoke the C compiler and linker explicitly. |
| 1412 |
This is described in the rest of this section. |
| 1413 |
</p> |
| 1414 |
<p>The <code>gsc</code> compiler can be invoked to compile each Scheme module |
| 1415 |
into a C file and to create an incremental link file. The C files and |
| 1416 |
the link file must then be compiled with a C compiler and linked (at |
| 1417 |
the object file level) with the Gambit runtime library and possibly |
| 1418 |
other libraries (such as the math library and the dynamic loading |
| 1419 |
library). |
| 1420 |
</p> |
| 1421 |
<p>Here is for example how a program with three modules (one in C and two |
| 1422 |
in Scheme) can be built. The content of the three source files (‘<samp>m1.c</samp>’, |
| 1423 |
‘<samp>m2.scm</samp>’ and ‘<samp>m3.scm</samp>’) is: |
| 1424 |
</p> |
| 1425 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>/* File: "m1.c" */ |
| 1426 |
int power_of_2 (int x) { return 1<<x; } |
| 1427 |
|
| 1428 |
; File: "m2.scm" |
| 1429 |
(c-declare "extern int power_of_2 ();") |
| 1430 |
(define pow2 (c-lambda (int) int "power_of_2")) |
| 1431 |
(define (twice x) (cons x x)) |
| 1432 |
|
| 1433 |
; File: "m3.scm" |
| 1434 |
(write (map twice (map pow2 '(1 2 3 4)))) (newline) |
| 1435 |
</pre></td></tr></table> |
| 1436 |
|
| 1437 |
<p>The compilation of the two Scheme source files can be done with |
| 1438 |
three invocations of <code>gsc</code>: |
| 1439 |
</p> |
| 1440 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -c m2.scm <span class="roman"><i># create m2.c (note: .scm is optional)</i></span></b> |
| 1441 |
$ <b>gsc -c m3.scm <span class="roman"><i># create m3.c (note: .scm is optional)</i></span></b> |
| 1442 |
$ <b>gsc -link m2.c m3.c <span class="roman"><i># create the incremental link file m3_.c</i></span></b> |
| 1443 |
</pre></td></tr></table> |
| 1444 |
|
| 1445 |
<p>Alternatively, the three invocations of <code>gsc</code> can be replaced by a |
| 1446 |
single invocation: |
| 1447 |
</p> |
| 1448 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link m2 m3</b> |
| 1449 |
m2: |
| 1450 |
m3: |
| 1451 |
</pre></td></tr></table> |
| 1452 |
|
| 1453 |
<p>At this point there will be 4 C files: ‘<samp>m1.c</samp>’, ‘<samp>m2.c</samp>’, |
| 1454 |
‘<samp>m3.c</samp>’, and ‘<samp>m3_.c</samp>’. To produce an executable program these |
| 1455 |
files must be compiled with a C compiler and linked with the Gambit-C |
| 1456 |
runtime library. The C compiler options needed will depend on the C |
| 1457 |
compiler and the operating system (in particular it may be necessary |
| 1458 |
to add the options ‘<samp>-I/usr/local/Gambit-C/include |
| 1459 |
-L/usr/local/Gambit-C/lib</samp>’ to access the ‘<samp>gambit.h</samp>’ header file |
| 1460 |
and the Gambit-C runtime library). |
| 1461 |
</p> |
| 1462 |
<p>Here is an example under Mac OS X: |
| 1463 |
</p> |
| 1464 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1465 |
Darwin 8.1.0 Power Macintosh powerpc |
| 1466 |
$ <b>gsc -obj m1.c m2.c m3.c m3_.c</b> |
| 1467 |
m1.c: |
| 1468 |
m2.c: |
| 1469 |
m3.c: |
| 1470 |
m3_.c: |
| 1471 |
$ <b>gcc m1.o m2.o m3.o m3_.o -lgambc</b> |
| 1472 |
$ <b>./a.out</b> |
| 1473 |
((2 . 2) (4 . 4) (8 . 8) (16 . 16)) |
| 1474 |
</pre></td></tr></table> |
| 1475 |
|
| 1476 |
<p>Here is an example under Linux: |
| 1477 |
</p> |
| 1478 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1479 |
Linux 2.6.8-1.521 i686 athlon |
| 1480 |
$ <b>gsc -obj m1.c m2.c m3.c m3_.c</b> |
| 1481 |
m1.c: |
| 1482 |
m2.c: |
| 1483 |
m3.c: |
| 1484 |
m3_.c: |
| 1485 |
$ <b>gcc m1.o m2.o m3.o m3_.o -lgambc -lm -ldl -lutil</b> |
| 1486 |
$ <b>./a.out</b> |
| 1487 |
((2 . 2) (4 . 4) (8 . 8) (16 . 16)) |
| 1488 |
</pre></td></tr></table> |
| 1489 |
|
| 1490 |
<a name="Building-a-loadable-library"></a><hr size="6"><br/><br/><br/> |
| 1491 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1492 |
<tr><td valign="middle" align="left"><a href="#Building-an-executable-program" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1493 |
<td valign="middle" align="left"><a href="#Building-a-shared_002dlibrary" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1494 |
<td valign="middle" align="left"> </td> |
| 1495 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1496 |
<td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1497 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1498 |
<td valign="middle" align="left"> </td> |
| 1499 |
<td valign="middle" align="left"> </td> |
| 1500 |
<td valign="middle" align="left"> </td> |
| 1501 |
<td valign="middle" align="left"> </td> |
| 1502 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1503 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1504 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1505 |
</tr></table> |
| 1506 |
<a name="Building-a-loadable-library-1"></a> |
| 1507 |
<h3 class="subsection">3.4.2 Building a loadable library</h3> |
| 1508 |
|
| 1509 |
<a name="index-_002dD_005f_005f_005fDYNAMIC"></a> |
| 1510 |
<p>To bundle multiple modules into a single object file that can be |
| 1511 |
dynamically loaded with the <code>load</code> procedure, a flat link file is |
| 1512 |
needed. The compiler’s ‘<samp>-o</samp>’ option must be used to name the C |
| 1513 |
file generated as follows. If the dynamically loadable object file is |
| 1514 |
to be named ‘<samp><var>myfile</var>.o<var>n</var></samp>’ then the ‘<samp>-o</samp>’ option |
| 1515 |
must set the name of the link file generated to |
| 1516 |
‘<samp><var>myfile</var>.o<var>n</var>.c</samp>’ (note that the ‘<samp>.c</samp>’ extension |
| 1517 |
could also be ‘<samp>.cc</samp>’, ‘<samp>.cpp</samp>’ or whatever extension is |
| 1518 |
appropriate for C/C++ source files). The three modules of the |
| 1519 |
previous example can be bundled by generating a link file in this way: |
| 1520 |
</p> |
| 1521 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link -flat -o foo.o1.c m2 m3</b> |
| 1522 |
m2: |
| 1523 |
m3: |
| 1524 |
*** WARNING -- "cons" is not defined, |
| 1525 |
*** referenced in: ("m2.c") |
| 1526 |
*** WARNING -- "map" is not defined, |
| 1527 |
*** referenced in: ("m3.c") |
| 1528 |
*** WARNING -- "newline" is not defined, |
| 1529 |
*** referenced in: ("m3.c") |
| 1530 |
*** WARNING -- "write" is not defined, |
| 1531 |
*** referenced in: ("m3.c") |
| 1532 |
</pre></td></tr></table> |
| 1533 |
|
| 1534 |
<p>The warnings indicate that there are no definitions (<code>define</code>s or |
| 1535 |
<code>set!</code>s) of the variables <code>cons</code>, <code>map</code>, <code>newline</code> |
| 1536 |
and <code>write</code> in the set of modules being linked. Before |
| 1537 |
‘<samp>foo.o1</samp>’ is loaded, these variables will have to be bound; either |
| 1538 |
implicitly (by the runtime library) or explicitly. |
| 1539 |
</p> |
| 1540 |
<p>When compiling the C files and link file generated, the flag |
| 1541 |
‘<samp>-D___DYNAMIC</samp>’ must be passed to the C compiler and the C |
| 1542 |
compiler and linker must be told to generate a dynamically loadable |
| 1543 |
shared library. |
| 1544 |
</p> |
| 1545 |
<p>Here is an example under Mac OS X: |
| 1546 |
</p> |
| 1547 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1548 |
Darwin 10.5.0 i386 i386 |
| 1549 |
$ <b>gsc -link -flat -o foo.o1.c m2 m3 > /dev/null</b> |
| 1550 |
m2: |
| 1551 |
m3: |
| 1552 |
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m1.c m2.c m3.c foo.o1.c</b> |
| 1553 |
m1.c: |
| 1554 |
m2.c: |
| 1555 |
m3.c: |
| 1556 |
foo.o1.c: |
| 1557 |
$ <b>gcc -bundle m1.o m2.o m3.o foo.o1.o -o foo.o1</b> |
| 1558 |
$ <b>gsi foo.o1</b> |
| 1559 |
((2 . 2) (4 . 4) (8 . 8) (16 . 16)) |
| 1560 |
</pre></td></tr></table> |
| 1561 |
|
| 1562 |
<p>Here is an example under Linux: |
| 1563 |
</p> |
| 1564 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1565 |
Linux 2.6.8-1.521 i686 athlon |
| 1566 |
$ <b>gsc -link -flat -o foo.o1.c m2 m3 > /dev/null</b> |
| 1567 |
m2: |
| 1568 |
m3: |
| 1569 |
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m1.c m2.c m3.c foo.o1.c</b> |
| 1570 |
m1.c: |
| 1571 |
m2.c: |
| 1572 |
m3.c: |
| 1573 |
foo.o1.c: |
| 1574 |
$ <b>gcc -shared m1.o m2.o m3.o foo.o1.o -o foo.o1</b> |
| 1575 |
$ <b>gsi foo.o1</b> |
| 1576 |
((2 . 2) (4 . 4) (8 . 8) (16 . 16)) |
| 1577 |
</pre></td></tr></table> |
| 1578 |
|
| 1579 |
<p>Here is a more complex example, under Solaris, which shows how to build |
| 1580 |
a loadable library ‘<samp>mymod.o1</samp>’ composed of the files ‘<samp>m4.scm</samp>’, |
| 1581 |
‘<samp>m5.scm</samp>’ and ‘<samp>x.c</samp>’ that links to system shared libraries (for |
| 1582 |
X-windows): |
| 1583 |
</p> |
| 1584 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1585 |
SunOS ungava 5.6 Generic_105181-05 sun4m sparc SUNW,SPARCstation-20 |
| 1586 |
$ <b>gsc -link -flat -o mymod.o1.c m4 m5</b> |
| 1587 |
m4: |
| 1588 |
m5: |
| 1589 |
*** WARNING -- "*" is not defined, |
| 1590 |
*** referenced in: ("m4.c") |
| 1591 |
*** WARNING -- "+" is not defined, |
| 1592 |
*** referenced in: ("m5.c") |
| 1593 |
*** WARNING -- "display" is not defined, |
| 1594 |
*** referenced in: ("m5.c" "m4.c") |
| 1595 |
*** WARNING -- "newline" is not defined, |
| 1596 |
*** referenced in: ("m5.c" "m4.c") |
| 1597 |
*** WARNING -- "write" is not defined, |
| 1598 |
*** referenced in: ("m5.c") |
| 1599 |
$ <b>gsc -cc-options "-D___DYNAMIC" -obj m4.c m5.c x.c mymod.o1.c</b> |
| 1600 |
m4.c: |
| 1601 |
m5.c: |
| 1602 |
x.c: |
| 1603 |
mymod.o1.c: |
| 1604 |
$ <b>/usr/ccs/bin/ld -G -o mymod.o1 mymod.o1.o m4.o m5.o x.o -lX11 -lsocket</b> |
| 1605 |
$ <b>gsi mymod.o1</b> |
| 1606 |
hello from m4 |
| 1607 |
hello from m5 |
| 1608 |
(f1 10) = 22 |
| 1609 |
$ <b>cat m4.scm</b> |
| 1610 |
(define (f1 x) (* 2 (f2 x))) |
| 1611 |
(display "hello from m4") |
| 1612 |
(newline) |
| 1613 |
|
| 1614 |
(c-declare #<<c-declare-end |
| 1615 |
#include "x.h" |
| 1616 |
c-declare-end |
| 1617 |
) |
| 1618 |
(define x-initialize (c-lambda (char-string) bool "x_initialize")) |
| 1619 |
(define x-display-name (c-lambda () char-string "x_display_name")) |
| 1620 |
(define x-bell (c-lambda (int) void "x_bell")) |
| 1621 |
$ <b>cat m5.scm</b> |
| 1622 |
(define (f2 x) (+ x 1)) |
| 1623 |
(display "hello from m5") |
| 1624 |
(newline) |
| 1625 |
|
| 1626 |
(display "(f1 10) = ") |
| 1627 |
(write (f1 10)) |
| 1628 |
(newline) |
| 1629 |
|
| 1630 |
(x-initialize (x-display-name)) |
| 1631 |
(x-bell 50) ; sound the bell at 50% |
| 1632 |
$ <b>cat x.c</b> |
| 1633 |
#include <X11/Xlib.h> |
| 1634 |
|
| 1635 |
static Display *display; |
| 1636 |
|
| 1637 |
int x_initialize (char *display_name) |
| 1638 |
{ |
| 1639 |
display = XOpenDisplay (display_name); |
| 1640 |
return display != NULL; |
| 1641 |
} |
| 1642 |
|
| 1643 |
char *x_display_name (void) |
| 1644 |
{ |
| 1645 |
return XDisplayName (NULL); |
| 1646 |
} |
| 1647 |
|
| 1648 |
void x_bell (int volume) |
| 1649 |
{ |
| 1650 |
XBell (display, volume); |
| 1651 |
XFlush (display); |
| 1652 |
} |
| 1653 |
$ <b>cat x.h</b> |
| 1654 |
int x_initialize (char *display_name); |
| 1655 |
char *x_display_name (void); |
| 1656 |
void x_bell (int); |
| 1657 |
</pre></td></tr></table> |
| 1658 |
|
| 1659 |
<a name="Building-a-shared_002dlibrary"></a><hr size="6"><br/><br/><br/> |
| 1660 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1661 |
<tr><td valign="middle" align="left"><a href="#Building-a-loadable-library" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1662 |
<td valign="middle" align="left"><a href="#Other-compilation-options" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1663 |
<td valign="middle" align="left"> </td> |
| 1664 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1665 |
<td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1666 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1667 |
<td valign="middle" align="left"> </td> |
| 1668 |
<td valign="middle" align="left"> </td> |
| 1669 |
<td valign="middle" align="left"> </td> |
| 1670 |
<td valign="middle" align="left"> </td> |
| 1671 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1672 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1673 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1674 |
</tr></table> |
| 1675 |
<a name="Building-a-shared_002dlibrary-1"></a> |
| 1676 |
<h3 class="subsection">3.4.3 Building a shared-library</h3> |
| 1677 |
|
| 1678 |
<a name="index-_002dD_005f_005f_005fPRIMAL"></a> |
| 1679 |
<a name="index-_002dD_005f_005f_005fLIBRARY"></a> |
| 1680 |
<a name="index-_002dD_005f_005f_005fSHARED"></a> |
| 1681 |
<p>A shared-library can be built using an incremental link file or a flat |
| 1682 |
link file. An incremental link file is normally used when the Gambit |
| 1683 |
runtime library (or some other library) is to be extended with new |
| 1684 |
procedures. A flat link file is mainly useful when building a |
| 1685 |
“primal” runtime library, which is a library (such as the Gambit |
| 1686 |
runtime library) that does not extend another library. When compiling |
| 1687 |
the C files and link file generated, the flags ‘<samp>-D___LIBRARY</samp>’ and |
| 1688 |
‘<samp>-D___SHARED</samp>’ must be passed to the C compiler. The flag |
| 1689 |
‘<samp>-D___PRIMAL</samp>’ must also be passed to the C compiler when a primal |
| 1690 |
library is being built. |
| 1691 |
</p> |
| 1692 |
<p>A shared-library ‘<samp>mylib.so</samp>’ containing the two first modules of |
| 1693 |
the previous example can be built this way: |
| 1694 |
</p> |
| 1695 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1696 |
Linux bailey 1.2.13 #2 Wed Aug 28 16:29:41 GMT 1996 i586 |
| 1697 |
$ <b>gsc -link -o mylib.c m2</b> |
| 1698 |
$ <b>gsc -obj -cc-options "-D___SHARED" m1.c m2.c mylib.c</b> |
| 1699 |
m1.c: |
| 1700 |
m2.c: |
| 1701 |
mylib.c: |
| 1702 |
$ <b>gcc -shared m1.o m2.o mylib.o -o mylib.so</b> |
| 1703 |
</pre></td></tr></table> |
| 1704 |
|
| 1705 |
<p>Note that this shared-library is built using an incremental link file |
| 1706 |
(it extends the Gambit runtime library with the procedures <code>pow2</code> |
| 1707 |
and <code>twice</code>). This shared-library can in turn be used to build |
| 1708 |
an executable program from the third module of the previous example: |
| 1709 |
</p> |
| 1710 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsc -link -l mylib m3</b> |
| 1711 |
$ <b>gsc -obj m3.c m3_.c</b> |
| 1712 |
m3.c: |
| 1713 |
m3_.c: |
| 1714 |
$ <b>gcc m3.o m3_.o mylib.so -lgambc</b> |
| 1715 |
$ <b>LD_LIBRARY_PATH=.:/usr/local/lib ./a.out</b> |
| 1716 |
((2 . 2) (4 . 4) (8 . 8) (16 . 16)) |
| 1717 |
</pre></td></tr></table> |
| 1718 |
|
| 1719 |
<a name="Other-compilation-options"></a><hr size="6"><br/><br/><br/> |
| 1720 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1721 |
<tr><td valign="middle" align="left"><a href="#Building-a-shared_002dlibrary" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1722 |
<td valign="middle" align="left"><a href="#Procedures-specific-to-compiler" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1723 |
<td valign="middle" align="left"> </td> |
| 1724 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1725 |
<td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1726 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1727 |
<td valign="middle" align="left"> </td> |
| 1728 |
<td valign="middle" align="left"> </td> |
| 1729 |
<td valign="middle" align="left"> </td> |
| 1730 |
<td valign="middle" align="left"> </td> |
| 1731 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1732 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1733 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1734 |
</tr></table> |
| 1735 |
<a name="Other-compilation-options-1"></a> |
| 1736 |
<h3 class="subsection">3.4.4 Other compilation options</h3> |
| 1737 |
|
| 1738 |
<a name="index-_002dD_005f_005f_005fSINGLE_005fHOST"></a> |
| 1739 |
<a name="index-_002dO"></a> |
| 1740 |
<p>The performance of the code can be increased by passing the |
| 1741 |
‘<samp>-D___SINGLE_HOST</samp>’ flag to the C compiler. This will merge all |
| 1742 |
the procedures of a module into a single C procedure, which reduces |
| 1743 |
the cost of intra-module procedure calls. In addition the ‘<samp>-O</samp>’ |
| 1744 |
option can be passed to the C compiler. For large modules, it will |
| 1745 |
not be practical to specify both ‘<samp>-O</samp>’ and ‘<samp>-D___SINGLE_HOST</samp>’ |
| 1746 |
for typical C compilers because the compile time will be high and the |
| 1747 |
C compiler might even fail to compile the program for lack of memory. |
| 1748 |
It has been observed that lower levels of optimization (e.g. ‘<samp>-O1</samp>’) |
| 1749 |
often give faster compilation and also generate faster code. It is |
| 1750 |
a good idea to experiment. |
| 1751 |
</p> |
| 1752 |
<a name="index-_002dI_002fusr_002flocal_002fGambit_002dC_002finclude"></a> |
| 1753 |
<a name="index-_002dL_002fusr_002flocal_002fGambit_002dC_002flib"></a> |
| 1754 |
<p>Normally C compilers will not automatically search |
| 1755 |
‘<samp>/usr/local/Gambit-C/include</samp>’ for header files so the flag |
| 1756 |
‘<samp>-I/usr/local/Gambit-C/include</samp>’ should be passed to the C |
| 1757 |
compiler. Similarly, C compilers/linkers will not automatically |
| 1758 |
search ‘<samp>/usr/local/Gambit-C/lib</samp>’ for libraries so the flag |
| 1759 |
‘<samp>-L/usr/local/Gambit-C/lib</samp>’ should be passed to the C |
| 1760 |
compiler/linker. Alternatives are given in <a href="#Accessing-the-system-files">Accessing the system files</a>. |
| 1761 |
</p> |
| 1762 |
<a name="index-_002dshared"></a> |
| 1763 |
<a name="index-_002dcall_005fshared"></a> |
| 1764 |
<a name="index-_002drdynamic"></a> |
| 1765 |
<a name="index-_002dfpic"></a> |
| 1766 |
<a name="index-_002dfPIC"></a> |
| 1767 |
<a name="index-_002dKpic"></a> |
| 1768 |
<a name="index-_002dKPIC"></a> |
| 1769 |
<a name="index-_002dpic"></a> |
| 1770 |
<a name="index-_002bz"></a> |
| 1771 |
<a name="index-_002dG"></a> |
| 1772 |
<p>A variety of flags are needed by some C compilers when compiling a |
| 1773 |
shared-library or a dynamically loadable library. Some of these flags |
| 1774 |
are: ‘<samp>-shared</samp>’, ‘<samp>-call_shared</samp>’, ‘<samp>-rdynamic</samp>’, |
| 1775 |
‘<samp>-fpic</samp>’, ‘<samp>-fPIC</samp>’, ‘<samp>-Kpic</samp>’, ‘<samp>-KPIC</samp>’, ‘<samp>-pic</samp>’, |
| 1776 |
‘<samp>+z</samp>’, ‘<samp>-G</samp>’. Check your compiler’s documentation to see |
| 1777 |
which flag you need. |
| 1778 |
</p> |
| 1779 |
<a name="Procedures-specific-to-compiler"></a><hr size="6"><br/><br/><br/> |
| 1780 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 1781 |
<tr><td valign="middle" align="left"><a href="#Other-compilation-options" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 1782 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 1783 |
<td valign="middle" align="left"> </td> |
| 1784 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 1785 |
<td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 1786 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 1787 |
<td valign="middle" align="left"> </td> |
| 1788 |
<td valign="middle" align="left"> </td> |
| 1789 |
<td valign="middle" align="left"> </td> |
| 1790 |
<td valign="middle" align="left"> </td> |
| 1791 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 1792 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 1793 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 1794 |
</tr></table> |
| 1795 |
<a name="Procedures-specific-to-compiler-1"></a> |
| 1796 |
<h2 class="section">3.5 Procedures specific to compiler</h2> |
| 1797 |
|
| 1798 |
<p>The Gambit Scheme compiler features the following procedures that |
| 1799 |
are not available in the Gambit Scheme interpreter. |
| 1800 |
</p> |
| 1801 |
<a name="Definition_of_compile-file-to-target"></a><a name="Procedure_compile-file-to-target"></a><a name="index-compile_002dfile_002dto_002dtarget"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_compile-file-to-target">compile-file-to-target</a></b></code><i> <var>file</var> <span class="roman">[</span><code>options:</code> <var>options</var><span class="roman">]</span> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>module-name:</code> <var>module-name</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 1802 |
<a name="index-gsc-2"></a> |
| 1803 |
|
| 1804 |
<p>The <var>file</var> parameter must be a string naming an existing file |
| 1805 |
containing Scheme source code. The extension can be omitted from |
| 1806 |
<var>file</var> when the Scheme file has a ‘<samp>.scm</samp>’ or ‘<samp>.six</samp>’ |
| 1807 |
extension. This procedure compiles the source file into a file |
| 1808 |
containing C code. By default, this file is named after <var>file</var> |
| 1809 |
with the extension replaced with ‘<samp>.c</samp>’. The name of the generated |
| 1810 |
file can be specified with the <var>output</var> parameter. If |
| 1811 |
<var>output</var> is a string naming a directory then the C file is created |
| 1812 |
in that directory. Otherwise the name of the C file is <var>output</var>. |
| 1813 |
The name of the generated module can be specified with the |
| 1814 |
<var>module-name</var> parameter. If <var>module-name</var> is <code>#f</code> or is |
| 1815 |
not specified, then the name of the module is derived from the name of |
| 1816 |
the C file generated, without the extension. |
| 1817 |
</p> |
| 1818 |
<p>Compilation options are specified through the <var>options</var> parameter |
| 1819 |
which must be a list of symbols. Any combination of the following |
| 1820 |
options can be used: ‘<samp>verbose</samp>’, ‘<samp>report</samp>’, ‘<samp>expansion</samp>’, |
| 1821 |
‘<samp>gvm</samp>’, and ‘<samp>debug</samp>’. |
| 1822 |
</p> |
| 1823 |
<p>When the compilation is successful, <code>compile-file-to-target</code> returns |
| 1824 |
the name of the C file generated. When there is a compilation error, |
| 1825 |
<code>#f</code> is returned. |
| 1826 |
</p> |
| 1827 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b> |
| 1828 |
(display "hello") (newline) |
| 1829 |
$ <b>gsc</b> |
| 1830 |
Gambit v4.7.3 |
| 1831 |
|
| 1832 |
> <b>(compile-file-to-target "h")</b> |
| 1833 |
"/Users/feeley/gambit/doc/h.c" |
| 1834 |
</pre></td></tr></table> |
| 1835 |
|
| 1836 |
|
| 1837 |
<a name="Definition_of_compile-file"></a><a name="Procedure_compile-file"></a><a name="index-compile_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_compile-file">compile-file</a></b></code><i> <var>file</var> <span class="roman">[</span><code>options:</code> <var>options</var><span class="roman">]</span> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>cc-options:</code> <var>cc-options</var><span class="roman">]</span> <span class="roman">[</span><code>ld-options-prelude:</code> <var>ld-options-prelude</var><span class="roman">]</span> <span class="roman">[</span><code>ld-options:</code> <var>ld-options</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 1838 |
<a name="index-gsc-3"></a> |
| 1839 |
<a name="index-load"></a> |
| 1840 |
<a name="index-object-file"></a> |
| 1841 |
|
| 1842 |
<p>The <var>file</var>, <var>options</var>, and <var>output</var> parameters have the |
| 1843 |
same meaning as for the <code>compile-file-to-target</code> procedure, except that |
| 1844 |
<var>file</var> may be a Scheme source file or a |
| 1845 |
C file possibly generated by the Gambit Scheme compiler (for example |
| 1846 |
with the <code>compile-file-to-target</code> procedure). The |
| 1847 |
<var>cc-options</var> parameter is a string containing the options to pass |
| 1848 |
to the C compiler and the <var>ld-options-prelude</var> and |
| 1849 |
<var>ld-options</var> parameters are strings containing the options to pass |
| 1850 |
to the C linker (the options in <var>ld-options-prelude</var> are passed to |
| 1851 |
the C linker before the input file and the options in <var>ld-options</var> |
| 1852 |
are passed after). |
| 1853 |
</p> |
| 1854 |
<p>The <code>compile-file</code> procedure compiles the source file <var>file</var> |
| 1855 |
into an object file, which is either a file dynamically loadable using |
| 1856 |
the <code>load</code> procedure, or a C linkable object file destined to be |
| 1857 |
linked with the C linker (for example to create a standalone |
| 1858 |
executable program). The presence of the |
| 1859 |
<code>obj</code> option in <var>options</var> will cause the creation of a C |
| 1860 |
linkable object file and therefore the options |
| 1861 |
<var>ld-options-prelude</var> and <var>ld-options</var> are ignored, otherwise a |
| 1862 |
dynamically loadable file is created. In both cases, if <var>file</var> is |
| 1863 |
a Scheme source file, the compiler first compiles <var>file</var> to a C |
| 1864 |
file which is created in the same directory as <var>file</var> regardless |
| 1865 |
of the <var>output</var> parameter. Then the C file is compiled with the C |
| 1866 |
compiler. |
| 1867 |
</p> |
| 1868 |
<p>When the compilation is successful, <code>compile-file</code> returns the |
| 1869 |
name of the object file generated. When there is a compilation error, |
| 1870 |
<code>#f</code> is returned. |
| 1871 |
</p> |
| 1872 |
<p>The name of the object file can be specified with the <var>output</var> |
| 1873 |
parameter. If <var>output</var> is a string naming a directory then the |
| 1874 |
object file is created in that directory. Otherwise the name of the |
| 1875 |
object file is <var>output</var>. |
| 1876 |
</p> |
| 1877 |
<p>In the case of a dynamically loadable object file, by default the |
| 1878 |
object file is named after <var>file</var> with the extension replaced with |
| 1879 |
‘<samp>.o<var>n</var></samp>’, where <var>n</var> is a positive integer that acts as a |
| 1880 |
version number. The next available version number is generated |
| 1881 |
automatically by <code>compile-file</code>. |
| 1882 |
</p> |
| 1883 |
<p>When dynamically loaded object files are loaded using the <code>load</code> |
| 1884 |
procedure, the ‘<samp>.o<var>n</var></samp>’ extension can be specified (to select |
| 1885 |
a particular version) or omitted (to load the file with a |
| 1886 |
‘<samp>.o<var>n</var></samp>’ extension with the highest <var>n</var> consecutively from |
| 1887 |
1). When the ‘<samp>.o<var>n</var></samp>’ extension is not specified and older |
| 1888 |
versions are no longer needed, all versions must be deleted and the |
| 1889 |
compilation must be repeated (this is necessary because the file name, |
| 1890 |
including the extension, is used to name some of the exported symbols |
| 1891 |
of the object file). |
| 1892 |
</p> |
| 1893 |
<p>Note that dynamically loadable object files can only be generated on |
| 1894 |
host operating systems that support dynamic loading. |
| 1895 |
</p> |
| 1896 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat h.scm</b> |
| 1897 |
(display "hello") (newline) |
| 1898 |
$ <b>gsc</b> |
| 1899 |
Gambit v4.7.3 |
| 1900 |
|
| 1901 |
> <b>(compile-file "h")</b> |
| 1902 |
"/Users/feeley/gambit/doc/h.o1" |
| 1903 |
> <b>(load "h")</b> |
| 1904 |
hello |
| 1905 |
"/Users/feeley/gambit/doc/h.o1" |
| 1906 |
> <b>(compile-file-to-target "h" output: "h.o99.c")</b> |
| 1907 |
"/Users/feeley/gambit/doc/h.o99.c" |
| 1908 |
> <b>(compile-file "h.o99.c")</b> |
| 1909 |
"/Users/feeley/gambit/doc/h.o99" |
| 1910 |
> <b>(load "h.o99")</b> |
| 1911 |
hello |
| 1912 |
"/Users/feeley/gambit/doc/h.o99" |
| 1913 |
> <b>(compile-file-to-target "h")</b> |
| 1914 |
"/Users/feeley/gambit/doc/h.c" |
| 1915 |
> <b>(compile-file "h.c" options: '(obj))</b> |
| 1916 |
"/Users/feeley/gambit/doc/h.o" |
| 1917 |
</pre></td></tr></table> |
| 1918 |
|
| 1919 |
|
| 1920 |
|
| 1921 |
<a name="Definition_of_link-incremental"></a><a name="Procedure_link-incremental"></a><a name="index-link_002dincremental"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_link-incremental">link-incremental</a></b></code><i> <var>module-list</var> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>base:</code> <var>base</var><span class="roman">]</span> <span class="roman">[</span><code>warnings?:</code> <var>warnings?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 1922 |
<a name="index-gsc-4"></a> |
| 1923 |
|
| 1924 |
<p>The first parameter must be a non empty list of strings naming Scheme |
| 1925 |
modules to link (the file extension may be omitted). An incremental link |
| 1926 |
file is generated for the modules specified in <var>module-list</var>. By |
| 1927 |
default the link file generated is named ‘<samp><var>last</var>_.c</samp>’, where |
| 1928 |
<var>last</var> is the name of the last module, without the file extension. |
| 1929 |
The name of the generated |
| 1930 |
link file can be specified with the <var>output</var> parameter. If |
| 1931 |
<var>output</var> is a string naming a directory then the link file is |
| 1932 |
created in that directory. Otherwise the name of the link file is |
| 1933 |
<var>output</var>. |
| 1934 |
</p> |
| 1935 |
<p>The base link file is specified by the <var>base</var> parameter, which |
| 1936 |
must be a string. By default the base link file is the Gambit runtime |
| 1937 |
library link file ‘<samp>~~lib/_gambc.c</samp>’. However, when <var>base</var> is |
| 1938 |
supplied it is the name of the base link file (the file extension |
| 1939 |
may be omitted). |
| 1940 |
</p> |
| 1941 |
<p>The <var>warnings?</var> parameter controls whether warnings are |
| 1942 |
generated for undefined references. |
| 1943 |
</p> |
| 1944 |
<p>The following example shows how to build the executable program |
| 1945 |
‘<samp>hello</samp>’ which contains the two Scheme modules ‘<samp>h.scm</samp>’ and |
| 1946 |
‘<samp>w.six</samp>’. |
| 1947 |
</p> |
| 1948 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 1949 |
Darwin 8.1.0 Power Macintosh powerpc |
| 1950 |
$ <b>cat h.scm</b> |
| 1951 |
(display "hello") (newline) |
| 1952 |
$ <b>cat w.six</b> |
| 1953 |
display("world"); newline(); |
| 1954 |
$ <b>gsc</b> |
| 1955 |
Gambit v4.7.3 |
| 1956 |
|
| 1957 |
> <b>(compile-file-to-target "h")</b> |
| 1958 |
"/Users/feeley/gambit/doc/h.c" |
| 1959 |
> <b>(compile-file-to-target "w")</b> |
| 1960 |
"/Users/feeley/gambit/doc/w.c" |
| 1961 |
> <b>(link-incremental '("h" "w") output: "hello.c")</b> |
| 1962 |
"/Users/feeley/gambit/doc/hello_.c" |
| 1963 |
> <b>,q</b> |
| 1964 |
$ <b>gsc -obj h.c w.c hello.c</b> |
| 1965 |
h.c: |
| 1966 |
w.c: |
| 1967 |
hello.c: |
| 1968 |
$ <b>gcc h.o w.o hello.o -lgambc -o hello</b> |
| 1969 |
$ <b>./hello</b> |
| 1970 |
hello |
| 1971 |
world |
| 1972 |
</pre></td></tr></table> |
| 1973 |
|
| 1974 |
|
| 1975 |
|
| 1976 |
<a name="Definition_of_link-flat"></a><a name="Procedure_link-flat"></a><a name="index-link_002dflat"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_link-flat">link-flat</a></b></code><i> <var>module-list</var> <span class="roman">[</span><code>output:</code> <var>output</var><span class="roman">]</span> <span class="roman">[</span><code>warnings?:</code> <var>warnings?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 1977 |
<a name="index-gsc-5"></a> |
| 1978 |
|
| 1979 |
<p>The first parameter must be a non empty list of strings naming Scheme |
| 1980 |
modules to link (the file extension may be omitted). The first string |
| 1981 |
must be the name of a Scheme module |
| 1982 |
or the name of a link file and the remaining strings must name Scheme |
| 1983 |
modules. A flat link file |
| 1984 |
is generated for the modules specified in <var>module-list</var>. By |
| 1985 |
default the link file generated is named ‘<samp><var>last</var>_.c</samp>’, where |
| 1986 |
<var>last</var> is the name of the last module. The name of the generated |
| 1987 |
link file can be specified with the <var>output</var> parameter. If |
| 1988 |
<var>output</var> is a string naming a directory then the link file is |
| 1989 |
created in that directory. Otherwise the name of the link file is |
| 1990 |
<var>output</var>. If a dynamically loadable object file is produced from |
| 1991 |
the link file ‘<samp><var>output</var></samp>’, then the name of the dynamically |
| 1992 |
loadable object file must be ‘<samp><var>output</var></samp>’ stripped of its file |
| 1993 |
extension. |
| 1994 |
</p> |
| 1995 |
<p>The <var>warnings?</var> parameter controls whether warnings are |
| 1996 |
generated for undefined references. |
| 1997 |
</p> |
| 1998 |
<p>The following example shows how to build the dynamically loadable object |
| 1999 |
file ‘<samp>lib.o1</samp>’ which contains the two Scheme modules |
| 2000 |
‘<samp>m6.scm</samp>’ and ‘<samp>m7.scm</samp>’. |
| 2001 |
</p> |
| 2002 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>uname -srmp</b> |
| 2003 |
Darwin 8.1.0 Power Macintosh powerpc |
| 2004 |
$ <b>cat m6.scm</b> |
| 2005 |
(define (f x) (g (* x x))) |
| 2006 |
$ <b>cat m7.scm</b> |
| 2007 |
(define (g y) (+ n y)) |
| 2008 |
$ <b>gsc</b> |
| 2009 |
Gambit v4.7.3 |
| 2010 |
|
| 2011 |
> <b>(compile-file-to-target "m6")</b> |
| 2012 |
"/Users/feeley/gambit/doc/m6.c" |
| 2013 |
> <b>(compile-file-to-target "m7")</b> |
| 2014 |
"/Users/feeley/gambit/doc/m7.c" |
| 2015 |
> <b>(link-flat '("m6" "m7") output: "lib.o1.c")</b> |
| 2016 |
*** WARNING -- "*" is not defined, |
| 2017 |
*** referenced in: ("m6.c") |
| 2018 |
*** WARNING -- "+" is not defined, |
| 2019 |
*** referenced in: ("m7.c") |
| 2020 |
*** WARNING -- "n" is not defined, |
| 2021 |
*** referenced in: ("m7.c") |
| 2022 |
"/Users/feeley/gambit/doc/lib.o1.c" |
| 2023 |
> <b>,q</b> |
| 2024 |
$ <b>gcc -bundle -D___DYNAMIC m6.c m7.c lib.o1.c -o lib.o1</b> |
| 2025 |
$ <b>gsc</b> |
| 2026 |
Gambit v4.7.3 |
| 2027 |
|
| 2028 |
> <b>(load "lib")</b> |
| 2029 |
*** WARNING -- Variable "n" used in module "m7" is undefined |
| 2030 |
"/Users/feeley/gambit/doc/lib.o1" |
| 2031 |
> <b>(define n 10)</b> |
| 2032 |
> <b>(f 5)</b> |
| 2033 |
35 |
| 2034 |
> <b>,q</b> |
| 2035 |
</pre></td></tr></table> |
| 2036 |
|
| 2037 |
<p>The warnings indicate that there are no definitions (<code>define</code>s or |
| 2038 |
<code>set!</code>s) of the variables <code>*</code>, <code>+</code> and <code>n</code> in the |
| 2039 |
modules contained in the library. Before the library is used, these |
| 2040 |
variables will have to be bound; either implicitly (by the runtime |
| 2041 |
library) or explicitly. |
| 2042 |
</p> |
| 2043 |
|
| 2044 |
|
| 2045 |
<a name="Runtime-options"></a><hr size="6"><br/><br/><br/> |
| 2046 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2047 |
<tr><td valign="middle" align="left"><a href="#Procedures-specific-to-compiler" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2048 |
<td valign="middle" align="left"><a href="#Debugging" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2049 |
<td valign="middle" align="left"> </td> |
| 2050 |
<td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2051 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2052 |
<td valign="middle" align="left"><a href="#Debugging" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2053 |
<td valign="middle" align="left"> </td> |
| 2054 |
<td valign="middle" align="left"> </td> |
| 2055 |
<td valign="middle" align="left"> </td> |
| 2056 |
<td valign="middle" align="left"> </td> |
| 2057 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2058 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2059 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2060 |
</tr></table> |
| 2061 |
<a name="Runtime-options-1"></a> |
| 2062 |
<h1 class="chapter">4. Runtime options</h1> |
| 2063 |
<a name="index-runtime-options"></a> |
| 2064 |
<a name="index-options_002c-runtime"></a> |
| 2065 |
|
| 2066 |
<a name="index-gsc-6"></a> |
| 2067 |
<a name="index-gsi-2"></a> |
| 2068 |
<p>Both <code>gsi</code> and <code>gsc</code> as well as executable programs compiled |
| 2069 |
and linked using <code>gsc</code> take a ‘<samp>-:</samp>’ option which supplies |
| 2070 |
parameters to the runtime system. This option must appear first on |
| 2071 |
the command line. The colon is followed by a comma separated list of |
| 2072 |
options with no intervening spaces. The available options are: |
| 2073 |
</p> |
| 2074 |
<dl compact="compact"> |
| 2075 |
<dt> <code>m<var>HEAPSIZE</var></code></dt> |
| 2076 |
<dd><p>Set minimum heap size in kilobytes. |
| 2077 |
</p></dd> |
| 2078 |
<dt> <code>h<var>HEAPSIZE</var></code></dt> |
| 2079 |
<dd><p>Set maximum heap size in kilobytes. |
| 2080 |
</p></dd> |
| 2081 |
<dt> <code>l<var>LIVEPERCENT</var></code></dt> |
| 2082 |
<dd><p>Set heap occupation after garbage collection. |
| 2083 |
</p></dd> |
| 2084 |
<dt> <code>s</code></dt> |
| 2085 |
<dd><p>Select standard Scheme mode. |
| 2086 |
</p></dd> |
| 2087 |
<dt> <code>S</code></dt> |
| 2088 |
<dd><p>Select Gambit Scheme mode. |
| 2089 |
</p></dd> |
| 2090 |
<dt> <code>d<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt> |
| 2091 |
<dd><p>Set debugging options. |
| 2092 |
</p></dd> |
| 2093 |
<dt> <code>@<span class="roman">[</span><var>INTF</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></dt> |
| 2094 |
<dd><p>Override the configuration of the main RPC server. |
| 2095 |
</p></dd> |
| 2096 |
<dt> <code>=<var>DIRECTORY</var></code></dt> |
| 2097 |
<dd><p>Override the central installation directory. |
| 2098 |
</p></dd> |
| 2099 |
<dt> <code>~~<var>DIR</var>=<var>DIRECTORY</var></code></dt> |
| 2100 |
<dd><p>Override the <var>DIR</var> installation directory. |
| 2101 |
</p></dd> |
| 2102 |
<dt> <code>+<var>ARGUMENT</var></code></dt> |
| 2103 |
<dd><p>Add <var>ARGUMENT</var> to the command line before other arguments. |
| 2104 |
</p></dd> |
| 2105 |
<dt> <code>f<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt> |
| 2106 |
<dd><p>Set file options. |
| 2107 |
</p></dd> |
| 2108 |
<dt> <code>t<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt> |
| 2109 |
<dd><p>Set terminal options. |
| 2110 |
</p></dd> |
| 2111 |
<dt> <code>-<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt> |
| 2112 |
<dd><p>Set standard input and output options. |
| 2113 |
</p></dd> |
| 2114 |
</dl> |
| 2115 |
|
| 2116 |
<a name="index-_002d_003am"></a> |
| 2117 |
<p>The ‘<samp>m</samp>’ option specifies the minimum size of the heap. The |
| 2118 |
‘<samp>m</samp>’ is immediately followed by an integer indicating the number |
| 2119 |
of kilobytes of memory. The heap will not shrink lower than this |
| 2120 |
size. By default, the minimum size is 0. |
| 2121 |
</p> |
| 2122 |
<a name="index-_002d_003ah"></a> |
| 2123 |
<p>The ‘<samp>h</samp>’ option specifies the maximum size of the heap. The |
| 2124 |
‘<samp>h</samp>’ is immediately followed by an integer indicating the number |
| 2125 |
of kilobytes of memory. The heap will not grow larger than this size. |
| 2126 |
By default, there is no limit (i.e. the heap will grow until the |
| 2127 |
virtual memory is exhausted). |
| 2128 |
</p> |
| 2129 |
<a name="index-_002d_003al"></a> |
| 2130 |
<p>The ‘<samp>l</samp>’ option specifies the percentage of the heap that will be |
| 2131 |
occupied with live objects after the heap is resized at the end of a |
| 2132 |
garbage collection. The ‘<samp>l</samp>’ is immediately followed by an |
| 2133 |
integer between 1 and 100 inclusively indicating the desired |
| 2134 |
percentage. The garbage collector resizes the heap to reach this |
| 2135 |
percentage occupation. By default, the percentage is 50. |
| 2136 |
</p> |
| 2137 |
<a name="index-_002d_003as"></a> |
| 2138 |
<a name="index-_002d_003aS"></a> |
| 2139 |
<p>The ‘<samp>s</samp>’ option selects standard Scheme mode. In this mode the |
| 2140 |
reader is case-insensitive and keywords are not recognized. The |
| 2141 |
‘<samp>S</samp>’ option selects Gambit Scheme mode (the reader is case-sensitive |
| 2142 |
and recognizes keywords which end with a colon). By default Gambit |
| 2143 |
Scheme mode is used. |
| 2144 |
</p> |
| 2145 |
<a name="index-_002d_003ad"></a> |
| 2146 |
<p>The ‘<samp>d</samp>’ option sets various debugging options. The letter |
| 2147 |
‘<samp>d</samp>’ is followed by a sequence of letters indicating suboptions. |
| 2148 |
</p> |
| 2149 |
<dl compact="compact"> |
| 2150 |
<dt> <code>p</code></dt> |
| 2151 |
<dd><a name="index-_002d_003adp"></a> |
| 2152 |
<p>Uncaught exceptions will be treated as “errors” in the primordial thread |
| 2153 |
only. |
| 2154 |
</p> |
| 2155 |
</dd> |
| 2156 |
<dt> <code>a</code></dt> |
| 2157 |
<dd><a name="index-_002d_003ada"></a> |
| 2158 |
<p>Uncaught exceptions will be treated as “errors” in all threads. |
| 2159 |
</p> |
| 2160 |
</dd> |
| 2161 |
<dt> <code>r</code></dt> |
| 2162 |
<dd><a name="index-_002d_003adr"></a> |
| 2163 |
<p>When an “error” occurs a new REPL will be started. |
| 2164 |
</p> |
| 2165 |
</dd> |
| 2166 |
<dt> <code>s</code></dt> |
| 2167 |
<dd><a name="index-_002d_003ads"></a> |
| 2168 |
<p>When an “error” occurs a new REPL will be started. |
| 2169 |
Moreover the program starts in single-stepping mode. |
| 2170 |
</p> |
| 2171 |
</dd> |
| 2172 |
<dt> <code>q</code></dt> |
| 2173 |
<dd><a name="index-_002d_003adq"></a> |
| 2174 |
<p>When an “error” occurs the program will terminate with a nonzero |
| 2175 |
exit status. |
| 2176 |
</p> |
| 2177 |
</dd> |
| 2178 |
<dt> <code>R</code></dt> |
| 2179 |
<dd><a name="index-_002d_003adR"></a> |
| 2180 |
<a name="index-_005eC"></a> |
| 2181 |
<p>When a user interrupt occurs a new REPL will be started. User |
| 2182 |
interrupts are typically obtained by typing <^C>. Note that with |
| 2183 |
some system configurations <^C> abruptly terminates the process. |
| 2184 |
For example, under Microsoft Windows, <^C> works fine with the |
| 2185 |
standard console but with the MSYS terminal window it terminates the |
| 2186 |
process. |
| 2187 |
</p> |
| 2188 |
</dd> |
| 2189 |
<dt> <code>D</code></dt> |
| 2190 |
<dd><a name="index-_002d_003adD"></a> |
| 2191 |
<p>When a user interrupt occurs it will be deferred until the parameter |
| 2192 |
<code>current-user-interrupt-handler</code> is bound. |
| 2193 |
</p> |
| 2194 |
</dd> |
| 2195 |
<dt> <code>Q</code></dt> |
| 2196 |
<dd><a name="index-_002d_003adQ"></a> |
| 2197 |
<p>When a user interrupt occurs the program will terminate with a nonzero |
| 2198 |
exit status. |
| 2199 |
</p> |
| 2200 |
</dd> |
| 2201 |
<dt> <code><var>LEVEL</var></code></dt> |
| 2202 |
<dd><a name="index-_002d_003adLEVEL"></a> |
| 2203 |
<p>The verbosity level is set to <var>LEVEL</var> (a digit from 0 to 9). |
| 2204 |
At level 0 the runtime system will not display error messages |
| 2205 |
and warnings. |
| 2206 |
</p> |
| 2207 |
</dd> |
| 2208 |
<dt> <code>i</code></dt> |
| 2209 |
<dd><a name="index-_002d_003adi"></a> |
| 2210 |
<p>The REPL interaction channel will be the IDE REPL window (if the IDE |
| 2211 |
is available). |
| 2212 |
</p> |
| 2213 |
</dd> |
| 2214 |
<dt> <code>c</code></dt> |
| 2215 |
<dd><a name="index-_002d_003adc"></a> |
| 2216 |
<p>The REPL interaction channel will be the console. |
| 2217 |
</p> |
| 2218 |
</dd> |
| 2219 |
<dt> <code>-</code></dt> |
| 2220 |
<dd><a name="index-_002d_003ad_002d"></a> |
| 2221 |
<p>The REPL interaction channel will be standard input and standard output. |
| 2222 |
</p> |
| 2223 |
</dd> |
| 2224 |
<dt> <code>@<span class="roman">[</span><var>HOST</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></dt> |
| 2225 |
<dd><a name="index-_002d_003ad_0040_005bHOST_005d_005b_003aPORT_005d"></a> |
| 2226 |
<p>The REPL interaction channel will be connected to the remote debugger |
| 2227 |
at address <var>HOST</var>:<var>PORT</var> (if there is a remote debugger at |
| 2228 |
that address). The default <var>HOST</var> is 127.0.0.1 and the default |
| 2229 |
<var>PORT</var> is 44555. |
| 2230 |
THIS OPTION IS NOT YET IMPLEMENTED! |
| 2231 |
</p> |
| 2232 |
</dd> |
| 2233 |
</dl> |
| 2234 |
|
| 2235 |
<p>The default debugging options are equivalent to <code>-:dpqQ1i</code> |
| 2236 |
(i.e. an uncaught exception in the primordial thread terminates the |
| 2237 |
program after displaying an error message). When the letter ‘<samp>d</samp>’ |
| 2238 |
is not followed by suboptions, it is equivalent to <code>-:dprR1i</code> |
| 2239 |
(i.e. a new REPL is started only when an uncaught exception occurs in |
| 2240 |
the primordial thread). When <code>gsi</code> and <code>gsc</code> are running |
| 2241 |
the main REPL, the debugging options are changed to cause errors in |
| 2242 |
the primordial thread and user interrupts to start a nested REPL. |
| 2243 |
</p> |
| 2244 |
<a name="index-_002d_003a_0040"></a> |
| 2245 |
<p>The ‘<samp>@<span class="roman">[</span><var>INTF</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></samp>’ option |
| 2246 |
overrides the configuration of the main RPC server. The default |
| 2247 |
<var>INTF</var> is 127.0.0.1 and the default <var>PORT</var> is 44556. |
| 2248 |
THIS OPTION IS NOT YET IMPLEMENTED! |
| 2249 |
</p> |
| 2250 |
<a name="index-_002d_003a_003d"></a> |
| 2251 |
<p>The ‘<samp>=<var>DIRECTORY</var></samp>’ option overrides the setting of the |
| 2252 |
central installation directory. |
| 2253 |
</p> |
| 2254 |
<a name="index-_002d_003a_007e_007e"></a> |
| 2255 |
<p>The ‘<samp>~~<var>DIR</var>=<var>DIRECTORY</var></samp>’ option overrides the setting of |
| 2256 |
the <var>DIR</var> installation directory. |
| 2257 |
</p> |
| 2258 |
<a name="index-_002d_003a_002b"></a> |
| 2259 |
<p>The ‘<samp>+</samp>’ option adds the text that follows to the command line |
| 2260 |
before other arguments. |
| 2261 |
</p> |
| 2262 |
<a name="index-_002d_003af"></a> |
| 2263 |
<a name="index-_002d_003at"></a> |
| 2264 |
<a name="index-_002d_003a_002d"></a> |
| 2265 |
<p>The ‘<samp>f</samp>’, ‘<samp>t</samp>’ and ‘<samp>-</samp>’ options specify the default |
| 2266 |
settings of the ports created for files, terminals and standard input |
| 2267 |
and output respectively. The default character encoding, end-of-line |
| 2268 |
encoding and buffering can be set. Moreover, for terminals the |
| 2269 |
line-editing feature can be enabled or disabled. The ‘<samp>f</samp>’, |
| 2270 |
‘<samp>t</samp>’ and ‘<samp>-</samp>’ must be followed by a sequence of these options: |
| 2271 |
</p> |
| 2272 |
<dl compact="compact"> |
| 2273 |
<dt> <code>A</code></dt> |
| 2274 |
<dd><p>ASCII character encoding. |
| 2275 |
</p></dd> |
| 2276 |
<dt> <code>1</code></dt> |
| 2277 |
<dd><p>ISO-8859-1 character encoding. |
| 2278 |
</p></dd> |
| 2279 |
<dt> <code>2</code></dt> |
| 2280 |
<dd><p>UCS-2 character encoding. |
| 2281 |
</p></dd> |
| 2282 |
<dt> <code>4</code></dt> |
| 2283 |
<dd><p>UCS-4 character encoding. |
| 2284 |
</p></dd> |
| 2285 |
<dt> <code>6</code></dt> |
| 2286 |
<dd><p>UTF-16 character encoding. |
| 2287 |
</p></dd> |
| 2288 |
<dt> <code>8</code></dt> |
| 2289 |
<dd><p>UTF-8 character encoding. |
| 2290 |
</p></dd> |
| 2291 |
<dt> <code>U</code></dt> |
| 2292 |
<dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present. |
| 2293 |
</p></dd> |
| 2294 |
<dt> <code>UA</code></dt> |
| 2295 |
<dd><p>UTF character encoding with fallback to ASCII on input if no BOM is present. |
| 2296 |
</p></dd> |
| 2297 |
<dt> <code>U1</code></dt> |
| 2298 |
<dd><p>UTF character encoding with fallback to ISO-8859-1 on input if no BOM is present. |
| 2299 |
</p></dd> |
| 2300 |
<dt> <code>U6</code></dt> |
| 2301 |
<dd><p>UTF character encoding with fallback to UTF-16 on input if no BOM is present. |
| 2302 |
</p></dd> |
| 2303 |
<dt> <code>U8</code></dt> |
| 2304 |
<dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present. |
| 2305 |
</p></dd> |
| 2306 |
<dt> <code>c</code></dt> |
| 2307 |
<dd><p>End-of-line is encoded as CR (carriage-return). |
| 2308 |
</p></dd> |
| 2309 |
<dt> <code>l</code></dt> |
| 2310 |
<dd><p>End-of-line is encoded as LF (linefeed) |
| 2311 |
</p></dd> |
| 2312 |
<dt> <code>cl</code></dt> |
| 2313 |
<dd><p>End-of-line is encoded as CR-LF. |
| 2314 |
</p></dd> |
| 2315 |
<dt> <code>u</code></dt> |
| 2316 |
<dd><p>Unbuffered I/O. |
| 2317 |
</p></dd> |
| 2318 |
<dt> <code>n</code></dt> |
| 2319 |
<dd><p>Line buffered I/O (‘<samp>n</samp>’ for “at newline”). |
| 2320 |
</p></dd> |
| 2321 |
<dt> <code>f</code></dt> |
| 2322 |
<dd><p>Fully buffered I/O. |
| 2323 |
</p></dd> |
| 2324 |
<dt> <code>r</code></dt> |
| 2325 |
<dd><p>Illegal character encoding is treated as an error (exception raised). |
| 2326 |
</p></dd> |
| 2327 |
<dt> <code>R</code></dt> |
| 2328 |
<dd><p>Silently replace illegal character encodings with Unicode character #xfffd |
| 2329 |
(replacement character). |
| 2330 |
</p></dd> |
| 2331 |
<dt> <code>e</code></dt> |
| 2332 |
<dd><p>Enable line-editing (applies to terminals only). |
| 2333 |
</p></dd> |
| 2334 |
<dt> <code>E</code></dt> |
| 2335 |
<dd><p>Disable line-editing (applies to terminals only). |
| 2336 |
</p></dd> |
| 2337 |
</dl> |
| 2338 |
|
| 2339 |
<a name="index-_002d_003a_003a"></a> |
| 2340 |
<a name="index-GAMBCOPT_002c-environment-variable"></a> |
| 2341 |
<p>When a program’s execution starts, the runtime system obtains the |
| 2342 |
runtime options by processing in turn four sources of runtime options: |
| 2343 |
the defaults, the environment variable ‘<samp>GAMBCOPT</samp>’, the script |
| 2344 |
line of the source code, and the first command line argument of the |
| 2345 |
program. Any runtime option can be overriden by a subsequent source |
| 2346 |
of runtime options. It is sometimes useful to prevent overriding |
| 2347 |
the runtime options of the script line. This can be achieved by |
| 2348 |
starting the script line runtime options with ‘<samp>-::</samp>’. In |
| 2349 |
this case the environment variable ‘<samp>GAMBCOPT</samp>’ is ignored, |
| 2350 |
and the first command line argument of the program is |
| 2351 |
not used for runtime options (it is treated like a normal |
| 2352 |
command line argument). |
| 2353 |
</p> |
| 2354 |
<p>For example: |
| 2355 |
</p> |
| 2356 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>GAMBCOPT=d0,=~/my-gambit2</b> |
| 2357 |
$ <b>export GAMBCOPT</b> |
| 2358 |
$ <b>gsi -e '(pretty-print (path-expand "~~")) (/ 1 0)'</b> |
| 2359 |
"/Users/feeley/my-gambit2/" |
| 2360 |
$ <b>echo $?</b> |
| 2361 |
70 |
| 2362 |
$ <b>gsi -:d1 -e '(pretty-print (path-expand "~~")) (/ 1 0)'</b> |
| 2363 |
"/Users/feeley/my-gambit2/" |
| 2364 |
*** ERROR IN (string)@1.3 -- Divide by zero |
| 2365 |
(/ 1 0) |
| 2366 |
</pre></td></tr></table> |
| 2367 |
|
| 2368 |
<a name="Debugging"></a><hr size="6"><br/><br/><br/> |
| 2369 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2370 |
<tr><td valign="middle" align="left"><a href="#Runtime-options" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2371 |
<td valign="middle" align="left"><a href="#Debugging-model" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2372 |
<td valign="middle" align="left"> </td> |
| 2373 |
<td valign="middle" align="left"><a href="#Runtime-options" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2374 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2375 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2376 |
<td valign="middle" align="left"> </td> |
| 2377 |
<td valign="middle" align="left"> </td> |
| 2378 |
<td valign="middle" align="left"> </td> |
| 2379 |
<td valign="middle" align="left"> </td> |
| 2380 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2381 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2382 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2383 |
</tr></table> |
| 2384 |
<a name="Debugging-1"></a> |
| 2385 |
<h1 class="chapter">5. Debugging</h1> |
| 2386 |
|
| 2387 |
<table class="menu" border="0" cellspacing="0"> |
| 2388 |
<tr><td align="left" valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2389 |
<tr><td align="left" valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2390 |
<tr><td align="left" valign="top"><a href="#Debugging-example">5.3 Debugging example</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2391 |
<tr><td align="left" valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2392 |
<tr><td align="left" valign="top"><a href="#Console-line_002dediting">5.5 Console line-editing</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2393 |
<tr><td align="left" valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2394 |
<tr><td align="left" valign="top"><a href="#GUIDE">5.7 GUIDE</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 2395 |
</table> |
| 2396 |
|
| 2397 |
<a name="Debugging-model"></a><hr size="6"><br/><br/><br/> |
| 2398 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2399 |
<tr><td valign="middle" align="left"><a href="#Debugging" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2400 |
<td valign="middle" align="left"><a href="#Debugging-commands" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2401 |
<td valign="middle" align="left"> </td> |
| 2402 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2403 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2404 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2405 |
<td valign="middle" align="left"> </td> |
| 2406 |
<td valign="middle" align="left"> </td> |
| 2407 |
<td valign="middle" align="left"> </td> |
| 2408 |
<td valign="middle" align="left"> </td> |
| 2409 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2410 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2411 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2412 |
</tr></table> |
| 2413 |
<a name="Debugging-model-1"></a> |
| 2414 |
<h2 class="section">5.1 Debugging model</h2> |
| 2415 |
|
| 2416 |
<p>The evaluation of an expression may stop before it is completed for the |
| 2417 |
following reasons: |
| 2418 |
</p> |
| 2419 |
<ol> |
| 2420 |
<li> An evaluation error has occured, such as attempting to |
| 2421 |
divide by zero. |
| 2422 |
|
| 2423 |
<a name="index-_005eC-1"></a> |
| 2424 |
</li><li> The user has interrupted the evaluation (usually by typing <^C>). |
| 2425 |
|
| 2426 |
</li><li> A breakpoint has been reached or <code>(step)</code> was evaluated. |
| 2427 |
|
| 2428 |
</li><li> Single-stepping mode is enabled. |
| 2429 |
|
| 2430 |
</li></ol> |
| 2431 |
|
| 2432 |
<p>When an evaluation stops, a message is displayed indicating the reason |
| 2433 |
and location where the evaluation was stopped. The location |
| 2434 |
information includes, if known, the name of the procedure where the |
| 2435 |
evaluation was stopped and the source code location in the format |
| 2436 |
‘<samp><var>stream</var>@<var>line</var>.<var>column</var></samp>’, where <var>stream</var> is |
| 2437 |
either a string naming a file or a symbol within parentheses, such as |
| 2438 |
‘<samp>(console)</samp>’. |
| 2439 |
</p> |
| 2440 |
<p>A <em>nested REPL</em> is then initiated in the context of the point of |
| 2441 |
execution where the evaluation was stopped. The nested REPL’s |
| 2442 |
continuation and evaluation environment are the same as the point where |
| 2443 |
the evaluation was stopped. For example when evaluating the expression |
| 2444 |
‘<samp>(let ((y (- 1 1))) (* (/ x y) 2))</samp>’, a “divide by zero” error is |
| 2445 |
reported and the nested REPL’s continuation is the one that takes the |
| 2446 |
result and multiplies it by two. The REPL’s lexical environment |
| 2447 |
includes the lexical variable ‘<samp>y</samp>’. This allows the inspection of |
| 2448 |
the evaluation context (i.e. the lexical and dynamic environments and |
| 2449 |
continuation), which is particularly useful to determine the exact |
| 2450 |
location and cause of an error. |
| 2451 |
</p> |
| 2452 |
<a name="index-_005eD"></a> |
| 2453 |
<p>The prompt of nested REPLs includes the nesting level; ‘<samp>1></samp>’ is the |
| 2454 |
prompt at the first nesting level, ‘<samp>2></samp>’ at the second nesting |
| 2455 |
level, and so on. An end of file (usually <^D>) will cause the |
| 2456 |
current REPL to be terminated and the enclosing REPL (one nesting level |
| 2457 |
less) to be resumed. |
| 2458 |
</p> |
| 2459 |
<p>At any time the user can examine the frames in the REPL’s |
| 2460 |
continuation, which is useful to determine which chain of procedure |
| 2461 |
calls lead to an error. A backtrace that lists the chain of active |
| 2462 |
continuation frames in the REPL’s continuation can be obtained with |
| 2463 |
the ‘<samp>,b</samp>’ command. The frames are numbered from 0, that is frame |
| 2464 |
0 is the most recent frame of the continuation where execution |
| 2465 |
stopped, frame 1 is the parent frame of frame 0, and so on. It is |
| 2466 |
also possible to move the REPL to a specific parent continuation |
| 2467 |
(i.e. a specific frame of the continuation where execution stopped) |
| 2468 |
with the ‘<samp>,<var>N</var></samp>’, ‘<samp>,<var>N</var>+</samp>’, ‘<samp>,<var>N</var>-</samp>’, |
| 2469 |
‘<samp>,+</samp>’, ‘<samp>,-</samp>’, ‘<samp>,++</samp>’, and ‘<samp>,--</samp>’ commands. When the |
| 2470 |
frame number of the frame being examined is not zero, it is shown in |
| 2471 |
the prompt after the nesting level, for example ‘<samp>1\5></samp>’ is the |
| 2472 |
prompt when the REPL nesting level is 1 and the frame number is 5. |
| 2473 |
</p> |
| 2474 |
<p>Expressions entered at a nested REPL are evaluated in the environment |
| 2475 |
(both lexical and dynamic) of the continuation frame currently being |
| 2476 |
examined if that frame was created by interpreted Scheme code. If the |
| 2477 |
frame was created by compiled Scheme code then expressions get evaluated |
| 2478 |
in the global interaction environment. This feature may be used in |
| 2479 |
interpreted code to fetch the value of a variable in the current frame |
| 2480 |
or to change its value with <code>set!</code>. Note that some special forms |
| 2481 |
(<code>define</code> in particular) can only be evaluated in the global |
| 2482 |
interaction environment. |
| 2483 |
</p> |
| 2484 |
<a name="Debugging-commands"></a><hr size="6"><br/><br/><br/> |
| 2485 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2486 |
<tr><td valign="middle" align="left"><a href="#Debugging-model" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2487 |
<td valign="middle" align="left"><a href="#Debugging-example" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2488 |
<td valign="middle" align="left"> </td> |
| 2489 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2490 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2491 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2492 |
<td valign="middle" align="left"> </td> |
| 2493 |
<td valign="middle" align="left"> </td> |
| 2494 |
<td valign="middle" align="left"> </td> |
| 2495 |
<td valign="middle" align="left"> </td> |
| 2496 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2497 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2498 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2499 |
</tr></table> |
| 2500 |
<a name="Debugging-commands-1"></a> |
| 2501 |
<h2 class="section">5.2 Debugging commands</h2> |
| 2502 |
|
| 2503 |
<p>In addition to expressions, the REPL accepts the following special |
| 2504 |
“comma” commands: |
| 2505 |
</p> |
| 2506 |
<dl compact="compact"> |
| 2507 |
<dt> <code>,?</code></dt> |
| 2508 |
<dd><a name="index-_002c_003f"></a> |
| 2509 |
<p>Give a summary of the REPL commands. |
| 2510 |
</p> |
| 2511 |
</dd> |
| 2512 |
<dt> <code>,(h <var>subject</var>)</code></dt> |
| 2513 |
<dd><a name="index-_002c_0028h-subject_0029"></a> |
| 2514 |
<p>This command will show the section of the Gambit manual with the |
| 2515 |
definition of the procedure or special form <var>subject</var>, which must |
| 2516 |
be a symbol. For example ‘<samp>,(h time)</samp>’ will show the section |
| 2517 |
documenting the <code>time</code> special form. Please see the <code>help</code> |
| 2518 |
procedure for additional information. |
| 2519 |
</p> |
| 2520 |
</dd> |
| 2521 |
<dt> <code>,h</code></dt> |
| 2522 |
<dd><a name="index-_002ch"></a> |
| 2523 |
<p>This command will show the section of the Gambit manual with the |
| 2524 |
definition of the procedure which raised the exception for which this |
| 2525 |
REPL was started. |
| 2526 |
</p> |
| 2527 |
</dd> |
| 2528 |
<dt> <code>,q</code></dt> |
| 2529 |
<dd><a name="index-_002cq"></a> |
| 2530 |
<p>Terminate the process with exit status 0. This is equivalent to |
| 2531 |
calling <code>(exit 0)</code>. |
| 2532 |
</p> |
| 2533 |
</dd> |
| 2534 |
<dt> <code>,qt</code></dt> |
| 2535 |
<dd><a name="index-_002cqt"></a> |
| 2536 |
<p>Terminate the current thread (note that terminating the primordial |
| 2537 |
thread terminates the process). |
| 2538 |
</p> |
| 2539 |
</dd> |
| 2540 |
<dt> <code>,t</code></dt> |
| 2541 |
<dd><a name="index-_002ct"></a> |
| 2542 |
<p>Return to the outermost REPL, also known as the “top-level REPL”. |
| 2543 |
</p> |
| 2544 |
</dd> |
| 2545 |
<dt> <code>,d</code></dt> |
| 2546 |
<dd><a name="index-_002cd"></a> |
| 2547 |
<p>Leave the current REPL and resume the enclosing REPL. This command does |
| 2548 |
nothing in the top-level REPL. |
| 2549 |
</p> |
| 2550 |
</dd> |
| 2551 |
<dt> <code>,(c <var>expr</var>)</code></dt> |
| 2552 |
<dd><a name="index-_002c_0028c-expr_0029"></a> |
| 2553 |
<p>Leave the current REPL and continue the computation that initiated the |
| 2554 |
REPL with a specific value. This command can only be used to continue |
| 2555 |
a computation that signaled an error. The expression <var>expr</var> is |
| 2556 |
evaluated in the current context and the resulting value is returned |
| 2557 |
as the value of the expression which signaled the error. For example, |
| 2558 |
if the evaluation of the expression ‘<samp>(* (/ x y) 2)</samp>’ signaled an |
| 2559 |
error because ‘<samp>y</samp>’ is zero, then in the nested REPL a ‘<samp>,(c (+ |
| 2560 |
4 y))</samp>’ will resume the computation of ‘<samp>(* (/ x y) 2)</samp>’ as though |
| 2561 |
the value of ‘<samp>(/ x y)</samp>’ was 4. This command must be used |
| 2562 |
carefully because the context where the error occured may rely on the |
| 2563 |
result being of a particular type. For instance a ‘<samp>,(c #f)</samp>’ in |
| 2564 |
the previous example will cause ‘<samp>*</samp>’ to signal a type error (this |
| 2565 |
problem is the most troublesome when debugging Scheme code that was |
| 2566 |
compiled with type checking turned off so be careful). |
| 2567 |
</p> |
| 2568 |
</dd> |
| 2569 |
<dt> <code>,c</code></dt> |
| 2570 |
<dd><a name="index-_002cc"></a> |
| 2571 |
<p>Leave the current REPL and continue the computation that initiated the |
| 2572 |
REPL. This command can only be used to continue a computation that was |
| 2573 |
stopped due to a user interrupt, breakpoint or a single-step. |
| 2574 |
</p> |
| 2575 |
</dd> |
| 2576 |
<dt> <code>,s</code></dt> |
| 2577 |
<dd><a name="index-_002cs"></a> |
| 2578 |
<p>Leave the current REPL and continue the computation that initiated the |
| 2579 |
REPL in single-stepping mode. The computation will perform an |
| 2580 |
evaluation step (as defined by <code>step-level-set!</code>) and then stop, |
| 2581 |
causing a nested REPL to be entered. Just before the evaluation step is |
| 2582 |
performed, a line is displayed (in the same format as <code>trace</code>) |
| 2583 |
which indicates the expression that is being evaluated. If the |
| 2584 |
evaluation step produces a result, the result is also displayed on |
| 2585 |
another line. A nested REPL is then entered after displaying a message |
| 2586 |
which describes the next step of the computation. This command can |
| 2587 |
only be used to continue a computation that was stopped due to a user |
| 2588 |
interrupt, breakpoint or a single-step. |
| 2589 |
</p> |
| 2590 |
</dd> |
| 2591 |
<dt> <code>,l</code></dt> |
| 2592 |
<dd><a name="index-_002cl"></a> |
| 2593 |
<p>This command is similar to ‘<samp>,s</samp>’ except that it “leaps” over |
| 2594 |
procedure calls, that is procedure calls are treated like a single step. |
| 2595 |
Single-stepping mode will resume when the procedure call returns, or if |
| 2596 |
and when the execution of the called procedure encounters a breakpoint. |
| 2597 |
</p> |
| 2598 |
</dd> |
| 2599 |
<dt> <code>,<var>N</var></code></dt> |
| 2600 |
<dd><a name="index-_002cN"></a> |
| 2601 |
<p>Move to frame number <var>N</var> of the continuation. After changing the |
| 2602 |
current frame, a one-line summary of the frame is displayed as if the |
| 2603 |
‘<samp>,y</samp>’ command was entered. |
| 2604 |
</p> |
| 2605 |
</dd> |
| 2606 |
<dt> <code>,<var>N</var>+</code></dt> |
| 2607 |
<dd><a name="index-_002cN_002b"></a> |
| 2608 |
<p>Move forward by <var>N</var> frames in the chain of continuation frames |
| 2609 |
(i.e. towards older continuation frames). After changing the current |
| 2610 |
frame, a one-line summary of the frame is displayed as if the |
| 2611 |
‘<samp>,y</samp>’ command was entered. |
| 2612 |
</p> |
| 2613 |
</dd> |
| 2614 |
<dt> <code>,<var>N</var>-</code></dt> |
| 2615 |
<dd><a name="index-_002cN_002d"></a> |
| 2616 |
<p>Move backward by <var>N</var> frames in the chain of continuation frames |
| 2617 |
(i.e. towards more recent continuation frames). After changing the |
| 2618 |
current frame, a one-line summary of the frame is displayed as if the |
| 2619 |
‘<samp>,y</samp>’ command was entered. |
| 2620 |
</p> |
| 2621 |
</dd> |
| 2622 |
<dt> <code>,+</code></dt> |
| 2623 |
<dd><a name="index-_002c_002b"></a> |
| 2624 |
<p>Equivalent to ‘<samp>,1+</samp>’. |
| 2625 |
</p> |
| 2626 |
</dd> |
| 2627 |
<dt> <code>,-</code></dt> |
| 2628 |
<dd><a name="index-_002c_002d"></a> |
| 2629 |
<p>Equivalent to ‘<samp>,1-</samp>’. |
| 2630 |
</p> |
| 2631 |
</dd> |
| 2632 |
<dt> <code>,++</code></dt> |
| 2633 |
<dd><a name="index-_002c_002b_002b"></a> |
| 2634 |
<p>Equivalent to ‘<samp>,<var>N</var>+</samp>’ where <var>N</var> is the number of |
| 2635 |
continuation frames displayed at the head of a backtrace. |
| 2636 |
</p> |
| 2637 |
</dd> |
| 2638 |
<dt> <code>,--</code></dt> |
| 2639 |
<dd><a name="index-_002c_002d_002d"></a> |
| 2640 |
<p>Equivalent to ‘<samp>,<var>N</var>-</samp>’ where <var>N</var> is the number of |
| 2641 |
continuation frames displayed at the head of a backtrace. |
| 2642 |
</p> |
| 2643 |
</dd> |
| 2644 |
<dt> <code>,y</code></dt> |
| 2645 |
<dd><a name="index-_002cy"></a> |
| 2646 |
<p>Display a one-line summary of the current frame. The information is |
| 2647 |
displayed in four fields. The first field is the frame number. The |
| 2648 |
second field is the procedure that created the frame or |
| 2649 |
‘<samp>(interaction)</samp>’ if the frame was created by an expression entered |
| 2650 |
at the REPL. The remaining fields describe the subproblem associated |
| 2651 |
with the frame, that is the expression whose value is being computed. |
| 2652 |
The third field is the location of the subproblem’s source code and |
| 2653 |
the fourth field is a reproduction of the source code, possibly |
| 2654 |
truncated to fit on the line. The last two fields may be missing if |
| 2655 |
that information is not available. In particular, the third field is |
| 2656 |
missing when the frame was created by a user call to the ‘<samp>eval</samp>’ |
| 2657 |
procedure or by a compiled procedure not compiled with the declaration |
| 2658 |
‘<samp>debug-location</samp>’, and the last field is missing when the frame |
| 2659 |
was created by a compiled procedure not compiled with the declaration |
| 2660 |
‘<samp>debug-source</samp>’. |
| 2661 |
</p> |
| 2662 |
</dd> |
| 2663 |
<dt> <code>,b</code></dt> |
| 2664 |
<dd><a name="index-_002cb"></a> |
| 2665 |
<p>Display a backtrace summarizing each frame in the chain of continuation |
| 2666 |
frames starting with the current frame. For each frame, the same |
| 2667 |
information as for the ‘<samp>,y</samp>’ command is displayed (except that |
| 2668 |
location information is displayed in the format |
| 2669 |
‘<samp><var>stream</var>@<var>line</var>:<var>column</var></samp>’). If there are more than 15 |
| 2670 |
frames in the chain of continuation frames, some of the middle frames |
| 2671 |
will be omitted. |
| 2672 |
</p> |
| 2673 |
</dd> |
| 2674 |
<dt> <code>,be</code></dt> |
| 2675 |
<dd><a name="index-_002cbe"></a> |
| 2676 |
<p>Like the ‘<samp>,b</samp>’ command but also display the environment. |
| 2677 |
</p> |
| 2678 |
</dd> |
| 2679 |
<dt> <code>,bed</code></dt> |
| 2680 |
<dd><a name="index-_002cbed"></a> |
| 2681 |
<p>Like the ‘<samp>,be</samp>’ command but also display the dynamic environment. |
| 2682 |
</p> |
| 2683 |
</dd> |
| 2684 |
<dt> <code>,(b <var>expr</var>)</code></dt> |
| 2685 |
<dd><a name="index-_002c_0028b-expr_0029"></a> |
| 2686 |
<p>Display the backtrace of <var>expr</var>’s value, <var>X</var>, which is |
| 2687 |
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must |
| 2688 |
be a continuation or a thread. When <var>X</var> is a continuation, the |
| 2689 |
frames in that continuation are displayed. When <var>X</var> is a thread, |
| 2690 |
the backtrace of the current continuation of that thread is displayed. |
| 2691 |
</p> |
| 2692 |
</dd> |
| 2693 |
<dt> <code>,(be <var>expr</var>)</code></dt> |
| 2694 |
<dd><a name="index-_002c_0028be-expr_0029"></a> |
| 2695 |
<p>Like the ‘<samp>,(b <var>expr</var>)</samp>’ command but also display the |
| 2696 |
environment. |
| 2697 |
</p> |
| 2698 |
</dd> |
| 2699 |
<dt> <code>,(bed <var>expr</var>)</code></dt> |
| 2700 |
<dd><a name="index-_002c_0028bed-expr_0029"></a> |
| 2701 |
<p>Like the ‘<samp>,(be <var>expr</var>)</samp>’ command but also display the dynamic |
| 2702 |
environment. |
| 2703 |
</p> |
| 2704 |
</dd> |
| 2705 |
<dt> <code>,i</code></dt> |
| 2706 |
<dd><a name="index-_002ci"></a> |
| 2707 |
<p>Pretty print the procedure that created the current frame or |
| 2708 |
‘<samp>(interaction)</samp>’ if the frame was created by an expression entered |
| 2709 |
at the REPL. Compiled procedures will only be pretty printed when |
| 2710 |
they are compiled with the declaration ‘<samp>debug-source</samp>’. |
| 2711 |
</p> |
| 2712 |
</dd> |
| 2713 |
<dt> <code>,e</code></dt> |
| 2714 |
<dd><a name="index-_002ce"></a> |
| 2715 |
<p>Display the environment which is accessible from the current frame. |
| 2716 |
The lexical environment is displayed, followed by the dynamic |
| 2717 |
environment if the parameter object |
| 2718 |
<code>repl-display-dynamic-environment?</code> is not false. Global lexical |
| 2719 |
variables are not displayed. Moreover the frame must have been |
| 2720 |
created by interpreted code or code compiled with the declaration |
| 2721 |
‘<samp>debug-environments</samp>’. Due to space safety |
| 2722 |
considerations and compiler optimizations, some of the lexical |
| 2723 |
variable bindings may be missing. Lexical variable bindings are |
| 2724 |
displayed using the format ‘<samp><var>variable</var> = <var>expression</var></samp>’ |
| 2725 |
(when <var>variable</var> is mutable) or ‘<samp><var>variable</var> == <var>expression</var></samp>’ |
| 2726 |
(when <var>variable</var> is immutable, which may happen in compiled code |
| 2727 |
due to compiler optimization) |
| 2728 |
and dynamically-bound parameter bindings are displayed using the |
| 2729 |
format ‘<samp>(<var>parameter</var>) = <var>expression</var></samp>’. Note that |
| 2730 |
<var>expression</var> can be a self-evaluating expression (number, string, |
| 2731 |
boolean, character, ...), a quoted expression, a lambda expression or |
| 2732 |
a global variable (the last two cases, which are only used when the |
| 2733 |
value of the variable or parameter is a procedure, simplifies the |
| 2734 |
debugging of higher-order procedures). A <var>parameter</var> can be a |
| 2735 |
quoted expression or a global variable. Lexical bindings are |
| 2736 |
displayed in inverse binding order (most deeply nested first) and |
| 2737 |
shadowed variables are included in the list. |
| 2738 |
</p> |
| 2739 |
</dd> |
| 2740 |
<dt> <code>,ed</code></dt> |
| 2741 |
<dd><a name="index-_002ced"></a> |
| 2742 |
<p>Like the ‘<samp>,e</samp>’ command but the dynamic environment is always |
| 2743 |
displayed. |
| 2744 |
</p> |
| 2745 |
</dd> |
| 2746 |
<dt> <code>,(e <var>expr</var>)</code></dt> |
| 2747 |
<dd><a name="index-_002c_0028e-expr_0029"></a> |
| 2748 |
<p>Display the environment of <var>expr</var>’s value, <var>X</var>, which is |
| 2749 |
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must |
| 2750 |
be a continuation, a thread, a procedure, or a nonnegative integer. |
| 2751 |
When <var>X</var> is a continuation, the environment at that point in the |
| 2752 |
code is displayed. When <var>X</var> is a thread, the environment of the |
| 2753 |
current continuation of that thread is displayed. When <var>X</var> is a |
| 2754 |
procedure, the lexical environment where <var>X</var> was created is |
| 2755 |
combined with the current continuation and this combined environment |
| 2756 |
is displayed. When <var>X</var> is an integer, the environment at frame |
| 2757 |
number <var>X</var> of the continuation is displayed. |
| 2758 |
</p> |
| 2759 |
</dd> |
| 2760 |
<dt> <code>,(ed <var>expr</var>)</code></dt> |
| 2761 |
<dd><a name="index-_002c_0028ed-expr_0029"></a> |
| 2762 |
<p>Like the ‘<samp>,(e <var>expr</var>)</samp>’ command but the dynamic environment is |
| 2763 |
always displayed. |
| 2764 |
</p> |
| 2765 |
</dd> |
| 2766 |
<dt> <code>,st</code></dt> |
| 2767 |
<dd><a name="index-_002cst"></a> |
| 2768 |
<p>Display the state of the threads in the current thread’s thread group. |
| 2769 |
A thread can be: uninitialized, initialized, active, and |
| 2770 |
terminated (normally or abnormally). Active threads can be |
| 2771 |
running, sleeping and waiting on a synchronization object |
| 2772 |
(mutex, condition variable or port) possibly with a timeout. |
| 2773 |
</p> |
| 2774 |
</dd> |
| 2775 |
<dt> <code>,(st <var>expr</var>)</code></dt> |
| 2776 |
<dd><a name="index-_002c_0028st-expr_0029"></a> |
| 2777 |
<p>Display the state of a specific thread or thread group. |
| 2778 |
The value of <var>expr</var> must be a thread or thread group. |
| 2779 |
</p> |
| 2780 |
</dd> |
| 2781 |
<dt> <code>,(v <var>expr</var>)</code></dt> |
| 2782 |
<dd><a name="index-_002c_0028v-expr_0029"></a> |
| 2783 |
<p>Start a new REPL visiting <var>expr</var>’s value, <var>X</var>, which is |
| 2784 |
obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must |
| 2785 |
be a continuation, a thread, a procedure, or a nonnegative integer. |
| 2786 |
When <var>X</var> is a continuation, the new REPL’s continuation is <var>X</var> |
| 2787 |
and evaluations are done in the environment at that point in the code. |
| 2788 |
When <var>X</var> is a thread, the thread is interrupted and the new REPL’s |
| 2789 |
continuation is the point where the thread was interrupted. When |
| 2790 |
<var>X</var> is a procedure, the lexical environment where <var>X</var> was |
| 2791 |
created is combined with the current continuation and evaluations are |
| 2792 |
done in this combined environment. When <var>X</var> is an integer, the |
| 2793 |
REPL is started in frame number <var>X</var> of the continuation. |
| 2794 |
</p> |
| 2795 |
</dd> |
| 2796 |
</dl> |
| 2797 |
|
| 2798 |
<a name="Debugging-example"></a><hr size="6"><br/><br/><br/> |
| 2799 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2800 |
<tr><td valign="middle" align="left"><a href="#Debugging-commands" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2801 |
<td valign="middle" align="left"><a href="#Procedures-related-to-debugging" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2802 |
<td valign="middle" align="left"> </td> |
| 2803 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2804 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2805 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2806 |
<td valign="middle" align="left"> </td> |
| 2807 |
<td valign="middle" align="left"> </td> |
| 2808 |
<td valign="middle" align="left"> </td> |
| 2809 |
<td valign="middle" align="left"> </td> |
| 2810 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2811 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2812 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2813 |
</tr></table> |
| 2814 |
<a name="Debugging-example-1"></a> |
| 2815 |
<h2 class="section">5.3 Debugging example</h2> |
| 2816 |
|
| 2817 |
<p>Here is a sample interaction with <code>gsi</code>: |
| 2818 |
</p> |
| 2819 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b> |
| 2820 |
Gambit v4.7.3 |
| 2821 |
|
| 2822 |
> <b>(define (invsqr x) (/ 1 (expt x 2)))</b> |
| 2823 |
> <b>(define (mymap fn lst) |
| 2824 |
(define (mm in) |
| 2825 |
(if (null? in) |
| 2826 |
'() |
| 2827 |
(cons (fn (car in)) (mm (cdr in))))) |
| 2828 |
(mm lst))</b> |
| 2829 |
> <b>(mymap invsqr '(5 2 hello 9 1))</b> |
| 2830 |
*** ERROR IN invsqr, (console)@1.25 -- (Argument 1) NUMBER expected |
| 2831 |
(expt 'hello 2) |
| 2832 |
1> <b>,i</b> |
| 2833 |
#<procedure #2 invsqr> = |
| 2834 |
(lambda (x) (/ 1 (expt x 2))) |
| 2835 |
1> <b>,e</b> |
| 2836 |
x = 'hello |
| 2837 |
1> <b>,b</b> |
| 2838 |
0 invsqr (console)@1:25 (expt x 2) |
| 2839 |
1 #<procedure #4> (console)@6:17 (fn (car in)) |
| 2840 |
2 #<procedure #4> (console)@6:31 (mm (cdr in)) |
| 2841 |
3 #<procedure #4> (console)@6:31 (mm (cdr in)) |
| 2842 |
4 (interaction) (console)@8:1 (mymap invsqr '(5 2 hel... |
| 2843 |
1> <b>,+</b> |
| 2844 |
1 #<procedure #4> (console)@6.17 (fn (car in)) |
| 2845 |
1\1> <b>(pp #4)</b> |
| 2846 |
(lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in))))) |
| 2847 |
1\1> <b>,e</b> |
| 2848 |
in = '(hello 9 1) |
| 2849 |
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in))))) |
| 2850 |
fn = invsqr |
| 2851 |
lst = '(5 2 hello 9 1) |
| 2852 |
1\1> <b>,(e mm)</b> |
| 2853 |
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in))))) |
| 2854 |
fn = invsqr |
| 2855 |
lst = '(5 2 hello 9 1) |
| 2856 |
1\1> <b>fn</b> |
| 2857 |
#<procedure #2 invsqr> |
| 2858 |
1\1> <b>(pp fn)</b> |
| 2859 |
(lambda (x) (/ 1 (expt x 2))) |
| 2860 |
1\1> <b>,+</b> |
| 2861 |
2 #<procedure #4> (console)@6.31 (mm (cdr in)) |
| 2862 |
1\2> <b>,e</b> |
| 2863 |
in = '(2 hello 9 1) |
| 2864 |
mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in))))) |
| 2865 |
fn = invsqr |
| 2866 |
lst = '(5 2 hello 9 1) |
| 2867 |
1\2> <b>,(c (list 3 4 5))</b> |
| 2868 |
(1/25 1/4 3 4 5) |
| 2869 |
> <b>,q</b> |
| 2870 |
</pre></td></tr></table> |
| 2871 |
|
| 2872 |
<a name="Procedures-related-to-debugging"></a><hr size="6"><br/><br/><br/> |
| 2873 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 2874 |
<tr><td valign="middle" align="left"><a href="#Debugging-example" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 2875 |
<td valign="middle" align="left"><a href="#Console-line_002dediting" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 2876 |
<td valign="middle" align="left"> </td> |
| 2877 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 2878 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 2879 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 2880 |
<td valign="middle" align="left"> </td> |
| 2881 |
<td valign="middle" align="left"> </td> |
| 2882 |
<td valign="middle" align="left"> </td> |
| 2883 |
<td valign="middle" align="left"> </td> |
| 2884 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 2885 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 2886 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 2887 |
</tr></table> |
| 2888 |
<a name="Procedures-related-to-debugging-1"></a> |
| 2889 |
<h2 class="section">5.4 Procedures related to debugging</h2> |
| 2890 |
|
| 2891 |
<a name="Definition_of_help"></a><a name="Procedure_help"></a><a name="index-help"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_help">help</a></b></code><i> <var>subject</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2892 |
<a name="Definition_of_help-browser"></a><a name="Procedure_help-browser"></a><a name="index-help_002dbrowser"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_help-browser">help-browser</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2893 |
|
| 2894 |
<p>The <code>help</code> procedure displays the section of the Gambit manual |
| 2895 |
with the definition of the procedure or special form <var>subject</var>, |
| 2896 |
which must be a procedure or symbol. For example the call <code>(help |
| 2897 |
gensym)</code> will show the section documenting the <code>gensym</code> procedure |
| 2898 |
and the call <code>(help 'time)</code> will show the section documenting the |
| 2899 |
<code>time</code> special form. The <code>help</code> procedure returns the void |
| 2900 |
object. |
| 2901 |
</p> |
| 2902 |
<p>The parameter object <code>help-browser</code> is bound to a string naming |
| 2903 |
the external program that is used by the <code>help</code> procedure to view |
| 2904 |
the documentation. Initially it is bound to the empty string. In |
| 2905 |
normal circumstances when <code>help-browser</code> is bound to an empty |
| 2906 |
string the <code>help</code> procedure runs the script |
| 2907 |
<code>~~bin/gambc-doc.bat</code> which searches for a suitable web browser |
| 2908 |
to open the documentation in HTML format. Unless the system was built |
| 2909 |
with the command ‘<samp>configure --enable-help-browser=...</samp>’, the |
| 2910 |
text-only browser ‘<samp>lynx</samp>’ (see <a href="event:browse:http://lynx.isc.org/">http://lynx.isc.org/</a>) will |
| 2911 |
be used by default if it is available. We highly recommend that you |
| 2912 |
install this browser if you are interested in viewing the |
| 2913 |
documentation within the console in which the REPL is running. You |
| 2914 |
can exit ‘<samp>lynx</samp>’ conveniently by typing an end of file (usually |
| 2915 |
<^D>). |
| 2916 |
</p> |
| 2917 |
<p>For example: |
| 2918 |
</p> |
| 2919 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(help-browser "firefox")</b> <span class="roman"><i>; use firefox instead of lynx</i></span> |
| 2920 |
> <b>(help 'gensym)</b> |
| 2921 |
> <b>(help gensym)</b> <span class="roman"><i>; OK because gensym is a procedure</i></span> |
| 2922 |
> <b>(help 'time)</b> |
| 2923 |
> <b>(help time)</b> <span class="roman"><i>; not OK because time is a special form</i></span> |
| 2924 |
*** ERROR IN (console)@5.7 -- Macro name can't be used as a variable: time |
| 2925 |
> |
| 2926 |
</pre></td></tr></table> |
| 2927 |
|
| 2928 |
|
| 2929 |
|
| 2930 |
<a name="Definition_of_repl-result-history-ref"></a><a name="Procedure_repl-result-history-ref"></a><a name="index-repl_002dresult_002dhistory_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_repl-result-history-ref">repl-result-history-ref</a></b></code><i> <var>i</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2931 |
<a name="Definition_of_repl-result-history-max-length-set!"></a><a name="Procedure_repl-result-history-max-length-set!"></a><a name="index-repl_002dresult_002dhistory_002dmax_002dlength_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_repl-result-history-max-length-set!">repl-result-history-max-length-set!</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2932 |
|
| 2933 |
<a name="index-_0023"></a> |
| 2934 |
<a name="index-_0023_0023"></a> |
| 2935 |
<p>The REPL keeps a history of the last few results printed by the |
| 2936 |
REPL. The call <code>(repl-result-history-ref <var>i</var>)</code> returns the |
| 2937 |
<var>i</var>th previous result (the last for <var>i</var>=0, the next to last |
| 2938 |
for <var>i</var>=1, etc). By default the REPL result history remembers up |
| 2939 |
to 3 results. The maximal length of the history can be set to <var>n</var> |
| 2940 |
between 0 and 10 by a call to |
| 2941 |
<code>(repl-result-history-max-length-set! <var>n</var>)</code>. |
| 2942 |
</p> |
| 2943 |
<p>For convenience the reader defines an abbreviation for calling |
| 2944 |
<code>repl-result-history-ref</code>. Tokens formed by a sequence of one or |
| 2945 |
more hash signs, such as ‘<samp><code>#</code></samp>’, ‘<samp><code>##</code></samp>’, etc, are |
| 2946 |
expanded by the reader into the list <code>(repl-result-history-ref |
| 2947 |
<var>i</var>)</code>, where <var>i</var> is the number of hash signs minus 1. In |
| 2948 |
other words, ‘<samp><code>#</code></samp>’ will return the last result printed by |
| 2949 |
the REPL, ‘<samp><code>##</code></samp>’ will return the next to last, etc. |
| 2950 |
</p> |
| 2951 |
<p>For example: |
| 2952 |
</p> |
| 2953 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map (lambda (x) (* x x)) '(1 2 3))</b> |
| 2954 |
(1 4 9) |
| 2955 |
> <b>(reverse #)</b> |
| 2956 |
(9 4 1) |
| 2957 |
> <b>(append # ##)</b> |
| 2958 |
(9 4 1 1 4 9) |
| 2959 |
> <b>1</b> |
| 2960 |
1 |
| 2961 |
> <b>1</b> |
| 2962 |
1 |
| 2963 |
> <b>(+ # ##)</b> |
| 2964 |
2 |
| 2965 |
> <b>(+ # ##)</b> |
| 2966 |
3 |
| 2967 |
> <b>(+ # ##)</b> |
| 2968 |
5 |
| 2969 |
> <b>####</b> |
| 2970 |
*** ERROR IN (console)@9.1 -- (Argument 1) Out of range |
| 2971 |
(repl-result-history-ref 3) |
| 2972 |
1> |
| 2973 |
</pre></td></tr></table> |
| 2974 |
|
| 2975 |
|
| 2976 |
|
| 2977 |
<a name="Definition_of_trace"></a><a name="Procedure_trace"></a><a name="index-trace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_trace">trace</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2978 |
<a name="Definition_of_untrace"></a><a name="Procedure_untrace"></a><a name="index-untrace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_untrace">untrace</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 2979 |
|
| 2980 |
<p>The <code>trace</code> procedure starts tracing calls to the specified |
| 2981 |
procedures. When a traced procedure is called, a line containing the |
| 2982 |
procedure and its arguments is displayed (using the procedure call |
| 2983 |
expression syntax). The line is indented with a sequence of vertical |
| 2984 |
bars which indicate the nesting depth of the procedure’s continuation. |
| 2985 |
After the vertical bars is a greater-than sign which indicates that |
| 2986 |
the evaluation of the call is starting. |
| 2987 |
</p> |
| 2988 |
<p>When a traced procedure returns a result, it is displayed with the same |
| 2989 |
indentation as the call but without the greater-than sign. This makes |
| 2990 |
it easy to match calls and results (the result of a given call is the |
| 2991 |
value at the same indentation as the greater-than sign). If a traced |
| 2992 |
procedure P1 performs a tail call to a traced procedure P2, then P2 will |
| 2993 |
use the same indentation as P1. This makes it easy to spot tail calls. |
| 2994 |
The special handling for tail calls is needed to preserve the space |
| 2995 |
complexity of the program (i.e. tail calls are implemented as required |
| 2996 |
by Scheme even when they involve traced procedures). |
| 2997 |
</p> |
| 2998 |
<p>The <code>untrace</code> procedure stops tracing calls to the specified |
| 2999 |
procedures. When no argument is passed to the <code>trace</code> |
| 3000 |
procedure, the list of procedures currently being traced is returned. |
| 3001 |
The void object is returned by the <code>trace</code> procedure when it is |
| 3002 |
passed one or more arguments. When no argument is passed to the |
| 3003 |
<code>untrace</code> procedure stops all tracing and returns the void |
| 3004 |
object. A compiled procedure may be traced but only if it is bound to |
| 3005 |
a global variable. |
| 3006 |
</p> |
| 3007 |
<p>For example: |
| 3008 |
</p> |
| 3009 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b> |
| 3010 |
> <b>(trace fact)</b> |
| 3011 |
> <b>(fact 5)</b> |
| 3012 |
| > (fact 5) |
| 3013 |
| | > (fact 4) |
| 3014 |
| | | > (fact 3) |
| 3015 |
| | | | > (fact 2) |
| 3016 |
| | | | | > (fact 1) |
| 3017 |
| | | | | 1 |
| 3018 |
| | | | 2 |
| 3019 |
| | | 6 |
| 3020 |
| | 24 |
| 3021 |
| 120 |
| 3022 |
120 |
| 3023 |
> <b>(trace -)</b> |
| 3024 |
*** WARNING -- Rebinding global variable "-" to an interpreted procedure |
| 3025 |
> <b>(define (fact-iter n r) (if (< n 2) r (fact-iter (- n 1) (* n r))))</b> |
| 3026 |
> <b>(trace fact-iter)</b> |
| 3027 |
> <b>(fact-iter 5 1)</b> |
| 3028 |
| > (fact-iter 5 1) |
| 3029 |
| | > (- 5 1) |
| 3030 |
| | 4 |
| 3031 |
| > (fact-iter 4 5) |
| 3032 |
| | > (- 4 1) |
| 3033 |
| | 3 |
| 3034 |
| > (fact-iter 3 20) |
| 3035 |
| | > (- 3 1) |
| 3036 |
| | 2 |
| 3037 |
| > (fact-iter 2 60) |
| 3038 |
| | > (- 2 1) |
| 3039 |
| | 1 |
| 3040 |
| > (fact-iter 1 120) |
| 3041 |
| 120 |
| 3042 |
120 |
| 3043 |
> <b>(trace)</b> |
| 3044 |
(#<procedure #2 fact-iter> #<procedure #3 -> #<procedure #4 fact>) |
| 3045 |
> <b>(untrace)</b> |
| 3046 |
> <b>(fact 5)</b> |
| 3047 |
120 |
| 3048 |
</pre></td></tr></table> |
| 3049 |
|
| 3050 |
|
| 3051 |
|
| 3052 |
<a name="Definition_of_step"></a><a name="Procedure_step"></a><a name="index-step"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_step">step</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3053 |
<a name="Definition_of_step-level-set!"></a><a name="Procedure_step-level-set!"></a><a name="index-step_002dlevel_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_step-level-set!">step-level-set!</a></b></code><i> <var>level</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3054 |
|
| 3055 |
<p>The <code>step</code> procedure enables single-stepping mode. After the call |
| 3056 |
to <code>step</code> the computation will stop just before the interpreter |
| 3057 |
executes the next evaluation step (as defined by |
| 3058 |
<code>step-level-set!</code>). A nested REPL is then started. Note that |
| 3059 |
because single-stepping is stopped by the REPL whenever the prompt is |
| 3060 |
displayed it is pointless to enter <code>(step)</code> by itself. On the |
| 3061 |
other hand entering <code>(begin (step) <var>expr</var>)</code> will evaluate |
| 3062 |
<var>expr</var> in single-stepping mode. |
| 3063 |
</p> |
| 3064 |
<p>The procedure <code>step-level-set!</code> sets the stepping level which |
| 3065 |
determines the granularity of the evaluation steps when single-stepping |
| 3066 |
is enabled. The stepping level <var>level</var> must be an exact integer in |
| 3067 |
the range 0 to 7. At a level of 0, the interpreter ignores |
| 3068 |
single-stepping mode. At higher levels the interpreter stops the |
| 3069 |
computation just before it performs the following operations, depending |
| 3070 |
on the stepping level: |
| 3071 |
</p> |
| 3072 |
<ol> |
| 3073 |
<li> |
| 3074 |
procedure call |
| 3075 |
|
| 3076 |
|
| 3077 |
</li><li> |
| 3078 |
<code>delay</code> special form and operations at lower levels |
| 3079 |
|
| 3080 |
</li><li> |
| 3081 |
<code>lambda</code> special form and operations at lower levels |
| 3082 |
|
| 3083 |
</li><li> |
| 3084 |
<code>define</code> special form and operations at lower levels |
| 3085 |
|
| 3086 |
</li><li> |
| 3087 |
<code>set!</code> special form and operations at lower levels |
| 3088 |
|
| 3089 |
</li><li> |
| 3090 |
variable reference and operations at lower levels |
| 3091 |
|
| 3092 |
</li><li> |
| 3093 |
constant reference and operations at lower levels |
| 3094 |
|
| 3095 |
</li></ol> |
| 3096 |
|
| 3097 |
<p>The default stepping level is 7. |
| 3098 |
</p> |
| 3099 |
<p>For example: |
| 3100 |
</p> |
| 3101 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (fact n) (if (< n 2) 1 (* n (fact (- n 1)))))</b> |
| 3102 |
> <b>(step-level-set! 1)</b> |
| 3103 |
> <b>(begin (step) (fact 5))</b> |
| 3104 |
*** STOPPED IN (console)@3.15 |
| 3105 |
1> <b>,s</b> |
| 3106 |
| > (fact 5) |
| 3107 |
*** STOPPED IN fact, (console)@1.22 |
| 3108 |
1> <b>,s</b> |
| 3109 |
| | > (< n 2) |
| 3110 |
| | #f |
| 3111 |
*** STOPPED IN fact, (console)@1.43 |
| 3112 |
1> <b>,s</b> |
| 3113 |
| | > (- n 1) |
| 3114 |
| | 4 |
| 3115 |
*** STOPPED IN fact, (console)@1.37 |
| 3116 |
1> <b>,s</b> |
| 3117 |
| | > (fact (- n 1)) |
| 3118 |
*** STOPPED IN fact, (console)@1.22 |
| 3119 |
1> <b>,s</b> |
| 3120 |
| | | > (< n 2) |
| 3121 |
| | | #f |
| 3122 |
*** STOPPED IN fact, (console)@1.43 |
| 3123 |
1> <b>,s</b> |
| 3124 |
| | | > (- n 1) |
| 3125 |
| | | 3 |
| 3126 |
*** STOPPED IN fact, (console)@1.37 |
| 3127 |
1> <b>,l</b> |
| 3128 |
| | | > (fact (- n 1)) |
| 3129 |
*** STOPPED IN fact, (console)@1.22 |
| 3130 |
1> <b>,l</b> |
| 3131 |
| | > (* n (fact (- n 1))) |
| 3132 |
| | 24 |
| 3133 |
*** STOPPED IN fact, (console)@1.32 |
| 3134 |
1> <b>,l</b> |
| 3135 |
| > (* n (fact (- n 1))) |
| 3136 |
| 120 |
| 3137 |
120 |
| 3138 |
</pre></td></tr></table> |
| 3139 |
|
| 3140 |
|
| 3141 |
|
| 3142 |
<a name="Definition_of_break"></a><a name="Procedure_break"></a><a name="index-break"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_break">break</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3143 |
<a name="Definition_of_unbreak"></a><a name="Procedure_unbreak"></a><a name="index-unbreak"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbreak">unbreak</a></b></code><i> <var>proc</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3144 |
|
| 3145 |
<p>The <code>break</code> procedure places a breakpoint on each of the |
| 3146 |
specified procedures. When a procedure is called that has a |
| 3147 |
breakpoint, the interpreter will enable single-stepping mode (as if |
| 3148 |
<code>step</code> had been called). This typically causes the computation |
| 3149 |
to stop soon inside the procedure if the stepping level is high |
| 3150 |
enough. |
| 3151 |
</p> |
| 3152 |
<p>The <code>unbreak</code> procedure removes the breakpoints on the specified |
| 3153 |
procedures. With no argument, <code>break</code> returns the list of |
| 3154 |
procedures currently containing breakpoints. The void object is |
| 3155 |
returned by <code>break</code> if it is passed one or more arguments. With |
| 3156 |
no argument <code>unbreak</code> removes all the breakpoints and returns the |
| 3157 |
void object. A breakpoint can be placed on a compiled procedure but |
| 3158 |
only if it is bound to a global variable. |
| 3159 |
</p> |
| 3160 |
<p>For example: |
| 3161 |
</p> |
| 3162 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (double x) (+ x x))</b> |
| 3163 |
> <b>(define (triple y) (- (double (double y)) y))</b> |
| 3164 |
> <b>(define (f z) (* (triple z) 10))</b> |
| 3165 |
> <b>(break double)</b> |
| 3166 |
> <b>(break -)</b> |
| 3167 |
*** WARNING -- Rebinding global variable "-" to an interpreted procedure |
| 3168 |
> <b>(f 5)</b> |
| 3169 |
*** STOPPED IN double, (console)@1.21 |
| 3170 |
1> <b>,b</b> |
| 3171 |
0 double (console)@1:21 + |
| 3172 |
1 triple (console)@2:31 (double y) |
| 3173 |
2 f (console)@3:18 (triple z) |
| 3174 |
3 (interaction) (console)@6:1 (f 5) |
| 3175 |
1> <b>,e</b> |
| 3176 |
x = 5 |
| 3177 |
1> <b>,c</b> |
| 3178 |
*** STOPPED IN double, (console)@1.21 |
| 3179 |
1> <b>,c</b> |
| 3180 |
*** STOPPED IN f, (console)@3.29 |
| 3181 |
1> <b>,c</b> |
| 3182 |
150 |
| 3183 |
> <b>(break)</b> |
| 3184 |
(#<procedure #3 -> #<procedure #4 double>) |
| 3185 |
> <b>(unbreak)</b> |
| 3186 |
> <b>(f 5)</b> |
| 3187 |
150 |
| 3188 |
</pre></td></tr></table> |
| 3189 |
|
| 3190 |
|
| 3191 |
|
| 3192 |
<a name="Definition_of_generate-proper-tail-calls"></a><a name="Procedure_generate-proper-tail-calls"></a><a name="index-generate_002dproper_002dtail_002dcalls"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_generate-proper-tail-calls">generate-proper-tail-calls</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3193 |
|
| 3194 |
<a name="index-proper-tail_002dcalls"></a> |
| 3195 |
<a name="index-tail_002dcalls"></a> |
| 3196 |
|
| 3197 |
<p>[Note: this procedure is DEPRECATED and will be removed |
| 3198 |
in a future version of Gambit. Use the ‘<samp>proper-tail-calls</samp>’ |
| 3199 |
declaration instead.] |
| 3200 |
</p> |
| 3201 |
<p>The parameter object <code>generate-proper-tail-calls</code> is bound to a |
| 3202 |
boolean value controlling how the interpreter handles tail calls. |
| 3203 |
When it is bound to <code>#f</code> the interpreter will treat tail calls |
| 3204 |
like nontail calls, that is a new continuation will be created for the |
| 3205 |
call. This setting is useful for debugging, because when a primitive |
| 3206 |
signals an error the location information will point to the call site |
| 3207 |
of the primitive even if this primitive was called with a tail call. |
| 3208 |
The initial value of this parameter object is <code>#t</code>, which means |
| 3209 |
that a tail call will reuse the continuation of the calling function. |
| 3210 |
</p> |
| 3211 |
<p>This parameter object only affects code that is subsequently processed |
| 3212 |
by <code>load</code> or <code>eval</code>, or entered at the REPL. |
| 3213 |
</p> |
| 3214 |
<p>For example: |
| 3215 |
</p> |
| 3216 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(generate-proper-tail-calls)</b> |
| 3217 |
#t |
| 3218 |
> <b>(let loop ((i 1)) (if (< i 10) (loop (* i 2)) oops))</b> |
| 3219 |
*** ERROR IN #<procedure #2>, (console)@2.47 -- Unbound variable: oops |
| 3220 |
1> <b>,b</b> |
| 3221 |
0 #<procedure #2> (console)@2:47 oops |
| 3222 |
1 (interaction) (console)@2:1 ((letrec ((loop (lambda... |
| 3223 |
1> <b>,t</b> |
| 3224 |
> <b>(generate-proper-tail-calls #f)</b> |
| 3225 |
> <b>(let loop ((i 1)) (if (< i 10) (loop (* i 2)) oops))</b> |
| 3226 |
*** ERROR IN #<procedure #3>, (console)@6.47 -- Unbound variable: oops |
| 3227 |
1> <b>,b</b> |
| 3228 |
0 #<procedure #3> (console)@6:47 oops |
| 3229 |
1 #<procedure #3> (console)@6:32 (loop (* i 2)) |
| 3230 |
2 #<procedure #3> (console)@6:32 (loop (* i 2)) |
| 3231 |
3 #<procedure #3> (console)@6:32 (loop (* i 2)) |
| 3232 |
4 #<procedure #3> (console)@6:32 (loop (* i 2)) |
| 3233 |
5 (interaction) (console)@6:1 ((letrec ((loop (lambda... |
| 3234 |
|
| 3235 |
</pre></td></tr></table> |
| 3236 |
|
| 3237 |
|
| 3238 |
|
| 3239 |
<a name="Definition_of_display-environment-set!"></a><a name="Procedure_display-environment-set!"></a><a name="index-display_002denvironment_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-environment-set!">display-environment-set!</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3240 |
|
| 3241 |
<p>[Note: this procedure is DEPRECATED and will be removed |
| 3242 |
in a future version of Gambit. Use the parameter object |
| 3243 |
<code>repl-display-environment?</code> instead.] |
| 3244 |
</p> |
| 3245 |
<p>This procedure sets a flag that controls the automatic display of the |
| 3246 |
environment by the REPL. If <var>display?</var> is true, the environment |
| 3247 |
is displayed by the REPL before the prompt. The default setting is |
| 3248 |
not to display the environment. |
| 3249 |
</p> |
| 3250 |
|
| 3251 |
|
| 3252 |
<a name="Definition_of_repl-display-environment?"></a><a name="Procedure_repl-display-environment?"></a><a name="index-repl_002ddisplay_002denvironment_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_repl-display-environment?">repl-display-environment?</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3253 |
|
| 3254 |
<p>The parameter object <code>repl-display-environment?</code> is bound to a |
| 3255 |
boolean value that controls the automatic display of the environment |
| 3256 |
by the REPL. If <var>display?</var> is true, the environment is displayed |
| 3257 |
by the REPL before the prompt. This is particularly useful in |
| 3258 |
single-stepping mode. The default setting is not to display the |
| 3259 |
environment. |
| 3260 |
</p> |
| 3261 |
|
| 3262 |
|
| 3263 |
<a name="Definition_of_display-dynamic-environment?"></a><a name="Procedure_display-dynamic-environment?"></a><a name="index-display_002ddynamic_002denvironment_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-dynamic-environment?">display-dynamic-environment?</a></b></code><i> <var>display?</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3264 |
|
| 3265 |
<p>The parameter object <code>display-dynamic-environment?</code> is bound to a |
| 3266 |
boolean value that controls wether the dynamic environment is |
| 3267 |
displayed when the environment is displayed. The default setting is |
| 3268 |
not to display the dynamic environment. |
| 3269 |
</p> |
| 3270 |
|
| 3271 |
|
| 3272 |
<a name="Definition_of_pretty-print"></a><a name="Procedure_pretty-print"></a><a name="index-pretty_002dprint"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_pretty-print">pretty-print</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3273 |
|
| 3274 |
<p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. If it |
| 3275 |
is not specified, <var>port</var> defaults to the current output-port. |
| 3276 |
</p> |
| 3277 |
<p>For example: |
| 3278 |
</p> |
| 3279 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(pretty-print |
| 3280 |
(let* ((x '(1 2 3 4)) (y (list x x x))) (list y y y)))</b> |
| 3281 |
(((1 2 3 4) (1 2 3 4) (1 2 3 4)) |
| 3282 |
((1 2 3 4) (1 2 3 4) (1 2 3 4)) |
| 3283 |
((1 2 3 4) (1 2 3 4) (1 2 3 4))) |
| 3284 |
</pre></td></tr></table> |
| 3285 |
|
| 3286 |
|
| 3287 |
|
| 3288 |
<a name="Definition_of_pp"></a><a name="Procedure_pp"></a><a name="index-pp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_pp">pp</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3289 |
|
| 3290 |
<p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. When |
| 3291 |
<var>obj</var> is a procedure created by the interpreter or a procedure |
| 3292 |
created by code compiled with the declaration |
| 3293 |
‘<samp>debug-source</samp>’, the procedure’s source code is |
| 3294 |
displayed. If it is not specified, <var>port</var> defaults to the |
| 3295 |
interaction channel (i.e. the output will appear at the REPL). |
| 3296 |
</p> |
| 3297 |
<p>For example: |
| 3298 |
</p> |
| 3299 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f g) (+ (time (g 100)) (time (g 1000))))</b> |
| 3300 |
> <b>(pp f)</b> |
| 3301 |
(lambda (g) |
| 3302 |
(+ (##time (lambda () (g 100)) '(g 100)) |
| 3303 |
(##time (lambda () (g 1000)) '(g 1000)))) |
| 3304 |
</pre></td></tr></table> |
| 3305 |
|
| 3306 |
|
| 3307 |
|
| 3308 |
<a name="Definition_of_gc-report-set!"></a><a name="Procedure_gc-report-set!"></a><a name="index-gc_002dreport_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_gc-report-set!">gc-report-set!</a></b></code><i> <var>report?</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3309 |
<a name="index-GC"></a> |
| 3310 |
|
| 3311 |
<p>This procedure controls the generation of reports during garbage |
| 3312 |
collections. If the argument is true, a brief report of memory usage |
| 3313 |
is generated after every garbage collection. It contains: the time |
| 3314 |
taken for this garbage collection, the amount of memory allocated in |
| 3315 |
megabytes since the program was started, the size of the heap in |
| 3316 |
megabytes, the heap memory in megabytes occupied by live data, the |
| 3317 |
proportion of the heap occupied by live data, and the number of bytes |
| 3318 |
occupied by movable and nonmovable objects. |
| 3319 |
</p> |
| 3320 |
|
| 3321 |
|
| 3322 |
<a name="Console-line_002dediting"></a><hr size="6"><br/><br/><br/> |
| 3323 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3324 |
<tr><td valign="middle" align="left"><a href="#Procedures-related-to-debugging" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3325 |
<td valign="middle" align="left"><a href="#Emacs-interface" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3326 |
<td valign="middle" align="left"> </td> |
| 3327 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3328 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3329 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3330 |
<td valign="middle" align="left"> </td> |
| 3331 |
<td valign="middle" align="left"> </td> |
| 3332 |
<td valign="middle" align="left"> </td> |
| 3333 |
<td valign="middle" align="left"> </td> |
| 3334 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3335 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3336 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3337 |
</tr></table> |
| 3338 |
<a name="Console-line_002dediting-1"></a> |
| 3339 |
<h2 class="section">5.5 Console line-editing</h2> |
| 3340 |
|
| 3341 |
<p>The console implements a simple Scheme-friendly line-editing |
| 3342 |
user-interface that is enabled by default. It offers parentheses |
| 3343 |
balancing, a history of previous commands, symbol completion, and |
| 3344 |
several emacs-compatible keyboard commands. The user’s input is |
| 3345 |
displayed in a bold font and the output produced by the system is in a |
| 3346 |
plain font. The history of previous commands is saved in the file |
| 3347 |
‘<tt>~/.gambc_history</tt>’. It is restored when a REPL is started. |
| 3348 |
</p> |
| 3349 |
<p>Symbol completion is triggered with the tab key. When the cursor is |
| 3350 |
after a sequence of characters that can form a symbol, typing the tab |
| 3351 |
key will search the symbol table for the first symbol (in alphabetical |
| 3352 |
order) that begins with that sequence and insert that symbol. Typing |
| 3353 |
the tab key in succession will cycle through all symbols with that |
| 3354 |
prefix. When all possible symbols have been shown or there are no |
| 3355 |
possible completions, the text reverts to the uncompleted symbol and |
| 3356 |
the bell is rung. |
| 3357 |
</p> |
| 3358 |
<p>Here are the keyboard commands available (where the ‘<samp><code>M-</code></samp>’ |
| 3359 |
prefix means the escape key is typed and the ‘<samp><code>C-</code></samp>’ prefix |
| 3360 |
means the control key is pressed): |
| 3361 |
</p> |
| 3362 |
<dl compact="compact"> |
| 3363 |
<dt> <code>C-d</code></dt> |
| 3364 |
<dd><p>Generate an end-of-file when the line is empty, otherwise delete |
| 3365 |
character at cursor. |
| 3366 |
</p> |
| 3367 |
</dd> |
| 3368 |
<dt> <code>delete <span class="roman">or backspace</span></code></dt> |
| 3369 |
<dd><p>Delete character before cursor. |
| 3370 |
</p> |
| 3371 |
</dd> |
| 3372 |
<dt> <code>M-C-d</code></dt> |
| 3373 |
<dd><p>Delete word forward and keep a copy of this text on the clipboard. |
| 3374 |
</p> |
| 3375 |
</dd> |
| 3376 |
<dt> <code>M-delete</code></dt> |
| 3377 |
<dd><p>Delete word backward and keep a copy of this text on the clipboard. |
| 3378 |
</p> |
| 3379 |
</dd> |
| 3380 |
<dt> <code>M-backspace</code></dt> |
| 3381 |
<dd><p>Delete S-expression backward and keep a copy of this text on the clipboard. |
| 3382 |
</p> |
| 3383 |
</dd> |
| 3384 |
<dt> <code>C-a</code></dt> |
| 3385 |
<dd><p>Move cursor to beginning of line. |
| 3386 |
</p> |
| 3387 |
</dd> |
| 3388 |
<dt> <code>C-e</code></dt> |
| 3389 |
<dd><p>Move cursor to end of line. |
| 3390 |
</p> |
| 3391 |
</dd> |
| 3392 |
<dt> <code>C-b <span class="roman">or <i>left-arrow</i></span></code></dt> |
| 3393 |
<dd><p>Move cursor left one character. |
| 3394 |
</p> |
| 3395 |
</dd> |
| 3396 |
<dt> <code>M-b</code></dt> |
| 3397 |
<dd><p>Move cursor left one word. |
| 3398 |
</p> |
| 3399 |
</dd> |
| 3400 |
<dt> <code>M-C-b <span class="roman">or <code>M-</code><i>left-arrow</i></span></code></dt> |
| 3401 |
<dd><p>Move cursor left one S-expression. |
| 3402 |
</p> |
| 3403 |
</dd> |
| 3404 |
<dt> <code>C-f <span class="roman">or <i>right-arrow</i></span></code></dt> |
| 3405 |
<dd><p>Move cursor right one character. |
| 3406 |
</p> |
| 3407 |
</dd> |
| 3408 |
<dt> <code>M-f</code></dt> |
| 3409 |
<dd><p>Move cursor right one word. |
| 3410 |
</p> |
| 3411 |
</dd> |
| 3412 |
<dt> <code>M-C-f <span class="roman">or <code>M-</code><i>right-arrow</i></span></code></dt> |
| 3413 |
<dd><p>Move cursor right one S-expression. |
| 3414 |
</p> |
| 3415 |
</dd> |
| 3416 |
<dt> <code>C-p <span class="roman">or <code>M-p</code> or <i>up-arrow</i></span></code></dt> |
| 3417 |
<dd><p>Move to previous line in history. |
| 3418 |
</p> |
| 3419 |
</dd> |
| 3420 |
<dt> <code>C-n <span class="roman">or <code>M-n</code> or <i>down-arrow</i></span></code></dt> |
| 3421 |
<dd><p>Move to next line in history. |
| 3422 |
</p> |
| 3423 |
</dd> |
| 3424 |
<dt> <code>C-t</code></dt> |
| 3425 |
<dd><p>Transpose character at cursor with previous character. |
| 3426 |
</p> |
| 3427 |
</dd> |
| 3428 |
<dt> <code>M-t</code></dt> |
| 3429 |
<dd><p>Transpose word after cursor with previous word. |
| 3430 |
</p> |
| 3431 |
</dd> |
| 3432 |
<dt> <code>M-C-t</code></dt> |
| 3433 |
<dd><p>Transpose S-expression after cursor with previous S-expression. |
| 3434 |
</p> |
| 3435 |
</dd> |
| 3436 |
<dt> <code>C-l</code></dt> |
| 3437 |
<dd><p>Clear console and redraw line being edited. |
| 3438 |
</p> |
| 3439 |
</dd> |
| 3440 |
<dt> <code>C-<i>nul</i></code></dt> |
| 3441 |
<dd><p>Set the mark to the cursor. |
| 3442 |
</p> |
| 3443 |
</dd> |
| 3444 |
<dt> <code>C-w</code></dt> |
| 3445 |
<dd><p>Delete the text between the cursor and the mark and keep a copy |
| 3446 |
of this text on the clipboard. |
| 3447 |
</p> |
| 3448 |
</dd> |
| 3449 |
<dt> <code>C-k</code></dt> |
| 3450 |
<dd><p>Delete the text from the cursor to the end of the line and keep a copy |
| 3451 |
of this text on the clipboard. |
| 3452 |
</p> |
| 3453 |
</dd> |
| 3454 |
<dt> <code>C-y</code></dt> |
| 3455 |
<dd><p>Paste the text that is on the clipboard. |
| 3456 |
</p> |
| 3457 |
</dd> |
| 3458 |
<dt> <code>F8</code></dt> |
| 3459 |
<dd><p>Same as typing ‘<samp>#||#,c;</samp>’ (REPL command to continue the computation). |
| 3460 |
</p> |
| 3461 |
</dd> |
| 3462 |
<dt> <code>F9</code></dt> |
| 3463 |
<dd><p>Same as typing ‘<samp>#||#,-;</samp>’ (REPL command to move to newer frame). |
| 3464 |
</p> |
| 3465 |
</dd> |
| 3466 |
<dt> <code>F10</code></dt> |
| 3467 |
<dd><p>Same as typing ‘<samp>#||#,+;</samp>’ (REPL command to move to older frame). |
| 3468 |
</p> |
| 3469 |
</dd> |
| 3470 |
<dt> <code>F11</code></dt> |
| 3471 |
<dd><p>Same as typing ‘<samp>#||#,s;</samp>’ (REPL command to step the computation). |
| 3472 |
</p> |
| 3473 |
</dd> |
| 3474 |
<dt> <code>F12</code></dt> |
| 3475 |
<dd><p>Same as typing ‘<samp>#||#,l;</samp>’ (REPL command to leap the computation). |
| 3476 |
</p> |
| 3477 |
</dd> |
| 3478 |
</dl> |
| 3479 |
|
| 3480 |
<p>On Mac OS X, depending on your configuration, you may have to press |
| 3481 |
the <code>fn</code> key to access the function key <code>F12</code> and the |
| 3482 |
<code>option</code> key to access the other function keys. |
| 3483 |
</p> |
| 3484 |
<p>On Microsoft Windows the clipboard is the system clipboard. This |
| 3485 |
allows text to be copied and pasted between the program and other |
| 3486 |
applications. On other operating systems the clipboard is internal to |
| 3487 |
the program (it is not integrated with the operating system). |
| 3488 |
</p> |
| 3489 |
<a name="Emacs-interface"></a><hr size="6"><br/><br/><br/> |
| 3490 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3491 |
<tr><td valign="middle" align="left"><a href="#Console-line_002dediting" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3492 |
<td valign="middle" align="left"><a href="#GUIDE" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3493 |
<td valign="middle" align="left"> </td> |
| 3494 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3495 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3496 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3497 |
<td valign="middle" align="left"> </td> |
| 3498 |
<td valign="middle" align="left"> </td> |
| 3499 |
<td valign="middle" align="left"> </td> |
| 3500 |
<td valign="middle" align="left"> </td> |
| 3501 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3502 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3503 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3504 |
</tr></table> |
| 3505 |
<a name="Emacs-interface-1"></a> |
| 3506 |
<h2 class="section">5.6 Emacs interface</h2> |
| 3507 |
<a name="index-Emacs"></a> |
| 3508 |
<a name="index-gambit_002eel"></a> |
| 3509 |
|
| 3510 |
<p>Gambit comes with the Emacs package ‘<samp>gambit.el</samp>’ which provides a |
| 3511 |
nice environment for running Gambit from within the Emacs editor. |
| 3512 |
This package filters the standard output of the Gambit process and |
| 3513 |
when it intercepts a location information (in the format |
| 3514 |
‘<samp><var>stream</var>@<var>line</var>.<var>column</var></samp>’ where <var>stream</var> is |
| 3515 |
either ‘<samp>(stdin)</samp>’ when the expression was obtained from standard |
| 3516 |
input, ‘<samp>(console)</samp>’ when the expression was obtained from the |
| 3517 |
console, or a string naming a file) it opens a window to highlight the |
| 3518 |
corresponding expression. |
| 3519 |
</p> |
| 3520 |
<p>To use this package, make sure the file ‘<samp>gambit.el</samp>’ is accessible |
| 3521 |
from your load-path and that the following lines are in your |
| 3522 |
‘<samp>.emacs</samp>’ file: |
| 3523 |
</p> |
| 3524 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(autoload 'gambit-inferior-mode "gambit" "Hook Gambit mode into cmuscheme.") |
| 3525 |
(autoload 'gambit-mode "gambit" "Hook Gambit mode into scheme.") |
| 3526 |
(add-hook 'inferior-scheme-mode-hook (function gambit-inferior-mode)) |
| 3527 |
(add-hook 'scheme-mode-hook (function gambit-mode)) |
| 3528 |
(setq scheme-program-name "gsi -:d-") |
| 3529 |
</pre></td></tr></table> |
| 3530 |
|
| 3531 |
<p>Alternatively, if you don’t mind always loading this package, |
| 3532 |
you can simply add this line to your ‘<samp>.emacs</samp>’ file: |
| 3533 |
</p> |
| 3534 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(require 'gambit) |
| 3535 |
</pre></td></tr></table> |
| 3536 |
|
| 3537 |
<p>You can then start an inferior Gambit process by typing ‘<samp>M-x |
| 3538 |
run-scheme</samp>’. The commands provided in ‘<samp>cmuscheme</samp>’ mode will be |
| 3539 |
available in the Gambit interaction buffer (i.e. ‘<samp>*scheme*</samp>’) and in |
| 3540 |
buffers attached to Scheme source files. Here is a list of the most |
| 3541 |
useful commands (for a complete list type ‘<samp>C-h m</samp>’ in the Gambit |
| 3542 |
interaction buffer): |
| 3543 |
</p><dl compact="compact"> |
| 3544 |
<dt> <code>C-x C-e</code></dt> |
| 3545 |
<dd><p>Evaluate the expression which is before the cursor (the expression will |
| 3546 |
be copied to the Gambit interaction buffer). |
| 3547 |
</p></dd> |
| 3548 |
<dt> <code>C-c C-z</code></dt> |
| 3549 |
<dd><p>Switch to Gambit interaction buffer. |
| 3550 |
</p></dd> |
| 3551 |
<dt> <code>C-c C-l</code></dt> |
| 3552 |
<dd><p>Load a file (file attached to current buffer is default) using |
| 3553 |
<code>(load <var>file</var>)</code>. |
| 3554 |
</p></dd> |
| 3555 |
<dt> <code>C-c C-k</code></dt> |
| 3556 |
<dd><p>Compile a file (file attached to current buffer is default) using |
| 3557 |
<code>(compile-file <var>file</var>)</code>. |
| 3558 |
</p></dd> |
| 3559 |
</dl> |
| 3560 |
|
| 3561 |
<p>The file ‘<samp>gambit.el</samp>’ provides these additional commands: |
| 3562 |
</p> |
| 3563 |
<dl compact="compact"> |
| 3564 |
<dt> <code>F8 <span class="roman"><i>or</i></span> C-c c</code></dt> |
| 3565 |
<dd><p>Continue the computation (same as typing ‘<samp>#||#,c;</samp>’ to the REPL). |
| 3566 |
</p></dd> |
| 3567 |
<dt> <code>F9 <span class="roman"><i>or</i></span> C-c ]</code></dt> |
| 3568 |
<dd><p>Move to newer frame (same as typing ‘<samp>#||#,-;</samp>’ to the REPL). |
| 3569 |
</p></dd> |
| 3570 |
<dt> <code>F10 <span class="roman"><i>or</i></span> C-c [</code></dt> |
| 3571 |
<dd><p>Move to older frame (same as typing ‘<samp>#||#,+;</samp>’ to the REPL). |
| 3572 |
</p></dd> |
| 3573 |
<dt> <code>F11 <span class="roman"><i>or</i></span> C-c s</code></dt> |
| 3574 |
<dd><p>Step the computation (same as typing ‘<samp>#||#,s;</samp>’ to the REPL). |
| 3575 |
</p></dd> |
| 3576 |
<dt> <code>F12 <span class="roman"><i>or</i></span> C-c l</code></dt> |
| 3577 |
<dd><p>Leap the computation (same as typing ‘<samp>#||#,l;</samp>’ to the REPL). |
| 3578 |
</p></dd> |
| 3579 |
<dt> <code>C-c _</code></dt> |
| 3580 |
<dd><p>Removes the last window that was opened to highlight an expression. |
| 3581 |
</p></dd> |
| 3582 |
</dl> |
| 3583 |
|
| 3584 |
<p>The two keystroke version of these commands can be shortened to |
| 3585 |
‘<samp>M-c</samp>’, ‘<samp>M-[</samp>’, ‘<samp>M-]</samp>’, ‘<samp>M-s</samp>’, ‘<samp>M-l</samp>’, and |
| 3586 |
‘<samp>M-_</samp>’ respectively by adding this line to your ‘<samp>.emacs</samp>’ |
| 3587 |
file: |
| 3588 |
</p> |
| 3589 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(setq gambit-repl-command-prefix "\e") |
| 3590 |
</pre></td></tr></table> |
| 3591 |
|
| 3592 |
<p>This is more convenient to type than the two keystroke ‘<samp>C-c</samp>’ based |
| 3593 |
sequences but the purist may not like this because it does not follow |
| 3594 |
normal Emacs conventions. |
| 3595 |
</p> |
| 3596 |
<p>Here is what a typical ‘<samp>.emacs</samp>’ file will look like: |
| 3597 |
</p> |
| 3598 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(setq load-path ; add directory containing gambit.el |
| 3599 |
(cons "/usr/local/Gambit-C/share/emacs/site-lisp" |
| 3600 |
load-path)) |
| 3601 |
(setq scheme-program-name "/tmp/gsi -:d-") ; if gsi not in executable path |
| 3602 |
(setq gambit-highlight-color "gray") ; if you don't like the default |
| 3603 |
(setq gambit-repl-command-prefix "\e") ; if you want M-c, M-s, etc |
| 3604 |
(require 'gambit) |
| 3605 |
</pre></td></tr></table> |
| 3606 |
|
| 3607 |
<a name="GUIDE"></a><hr size="6"><br/><br/><br/> |
| 3608 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3609 |
<tr><td valign="middle" align="left"><a href="#Emacs-interface" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3610 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3611 |
<td valign="middle" align="left"> </td> |
| 3612 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3613 |
<td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3614 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3615 |
<td valign="middle" align="left"> </td> |
| 3616 |
<td valign="middle" align="left"> </td> |
| 3617 |
<td valign="middle" align="left"> </td> |
| 3618 |
<td valign="middle" align="left"> </td> |
| 3619 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3620 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3621 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3622 |
</tr></table> |
| 3623 |
<a name="GUIDE-1"></a> |
| 3624 |
<h2 class="section">5.7 GUIDE</h2> |
| 3625 |
|
| 3626 |
<p>The implementation and documentation for GUIDE, the Gambit Universal |
| 3627 |
IDE, are not yet complete. |
| 3628 |
</p> |
| 3629 |
<a name="Scheme-extensions"></a><hr size="6"><br/><br/><br/> |
| 3630 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3631 |
<tr><td valign="middle" align="left"><a href="#GUIDE" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3632 |
<td valign="middle" align="left"><a href="#Extensions-to-standard-procedures" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3633 |
<td valign="middle" align="left"> </td> |
| 3634 |
<td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3635 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3636 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3637 |
<td valign="middle" align="left"> </td> |
| 3638 |
<td valign="middle" align="left"> </td> |
| 3639 |
<td valign="middle" align="left"> </td> |
| 3640 |
<td valign="middle" align="left"> </td> |
| 3641 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3642 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3643 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3644 |
</tr></table> |
| 3645 |
<a name="Scheme-extensions-1"></a> |
| 3646 |
<h1 class="chapter">6. Scheme extensions</h1> |
| 3647 |
|
| 3648 |
<table class="menu" border="0" cellspacing="0"> |
| 3649 |
<tr><td align="left" valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 3650 |
<tr><td align="left" valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 3651 |
<tr><td align="left" valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 3652 |
<tr><td align="left" valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 3653 |
</table> |
| 3654 |
|
| 3655 |
<a name="Extensions-to-standard-procedures"></a><hr size="6"><br/><br/><br/> |
| 3656 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3657 |
<tr><td valign="middle" align="left"><a href="#Scheme-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3658 |
<td valign="middle" align="left"><a href="#Extensions-to-standard-special-forms" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3659 |
<td valign="middle" align="left"> </td> |
| 3660 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3661 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3662 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3663 |
<td valign="middle" align="left"> </td> |
| 3664 |
<td valign="middle" align="left"> </td> |
| 3665 |
<td valign="middle" align="left"> </td> |
| 3666 |
<td valign="middle" align="left"> </td> |
| 3667 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3668 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3669 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3670 |
</tr></table> |
| 3671 |
<a name="Extensions-to-standard-procedures-1"></a> |
| 3672 |
<h2 class="section">6.1 Extensions to standard procedures</h2> |
| 3673 |
|
| 3674 |
<a name="Definition_of_transcript-on"></a><a name="Procedure_transcript-on"></a><a name="index-transcript_002don"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_transcript-on">transcript-on</a></b></code><i> <var>file</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3675 |
<a name="Definition_of_transcript-off"></a><a name="Procedure_transcript-off"></a><a name="index-transcript_002doff"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_transcript-off">transcript-off</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3676 |
|
| 3677 |
<p>These procedures do nothing. |
| 3678 |
</p> |
| 3679 |
|
| 3680 |
|
| 3681 |
<a name="Definition_of_call-with-current-continuation"></a><a name="Procedure_call-with-current-continuation"></a><a name="index-call_002dwith_002dcurrent_002dcontinuation"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-current-continuation">call-with-current-continuation</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3682 |
<a name="Definition_of_call/cc"></a><a name="Procedure_call/cc"></a><a name="index-call_002fcc"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call/cc">call/cc</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3683 |
|
| 3684 |
<p>The procedure <code>call-with-current-continuation</code> is bound to the |
| 3685 |
global variables <code>call-with-current-continuation</code> and |
| 3686 |
<code>call/cc</code>. |
| 3687 |
</p> |
| 3688 |
|
| 3689 |
|
| 3690 |
<a name="Extensions-to-standard-special-forms"></a><hr size="6"><br/><br/><br/> |
| 3691 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3692 |
<tr><td valign="middle" align="left"><a href="#Extensions-to-standard-procedures" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3693 |
<td valign="middle" align="left"><a href="#Miscellaneous-extensions" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3694 |
<td valign="middle" align="left"> </td> |
| 3695 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3696 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3697 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3698 |
<td valign="middle" align="left"> </td> |
| 3699 |
<td valign="middle" align="left"> </td> |
| 3700 |
<td valign="middle" align="left"> </td> |
| 3701 |
<td valign="middle" align="left"> </td> |
| 3702 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3703 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3704 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3705 |
</tr></table> |
| 3706 |
<a name="Extensions-to-standard-special-forms-1"></a> |
| 3707 |
<h2 class="section">6.2 Extensions to standard special forms</h2> |
| 3708 |
|
| 3709 |
<a name="Definition_of_lambda"></a><a name="Special_form_lambda"></a><a name="index-lambda"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_lambda">lambda</a></b></code><i> <span class="roman"><i>lambda-formals</i></span> <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 3710 |
<a name="Definition_of_define"></a><a name="Special_form_define"></a><a name="index-define"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define">define</a></b></code><i> (<span class="roman"><i>variable</i></span> <span class="roman"><i>define-formals</i></span>) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 3711 |
|
| 3712 |
<ul class="toc"> |
| 3713 |
<li> <var> </var> |
| 3714 |
<i>lambda-formals</i> = <code>(</code> <i>formal-argument-list</i> <code>)</code> | <i>r4rs-lambda-formals</i> |
| 3715 |
</li><li> <var> </var> |
| 3716 |
<i>define-formals</i> = <i>formal-argument-list</i> | <i>r4rs-define-formals</i> |
| 3717 |
</li><li> <var> </var> |
| 3718 |
<i>formal-argument-list</i> = <i>dsssl-formal-argument-list</i> | <i>rest-at-end-formal-argument-list</i> |
| 3719 |
</li><li> <var> </var> |
| 3720 |
<i>dsssl-formal-argument-list</i> = <i>reqs</i> <i>opts</i> <i>rest</i> <i>keys</i> |
| 3721 |
</li><li> <var> </var> |
| 3722 |
<i>rest-at-end-formal-argument-list</i> = <i>reqs</i> <i>opts</i> <i>keys</i> <i>rest</i> | <i>reqs</i> <i>opts</i> <i>keys</i> <code>.</code> <i>rest-formal-argument</i> |
| 3723 |
</li><li> <var> </var> |
| 3724 |
<i>reqs</i> = <i>required-formal-argument</i>* |
| 3725 |
</li><li> <var> </var> |
| 3726 |
<i>required-formal-argument</i> = <i>variable</i> |
| 3727 |
</li><li> <var> </var> |
| 3728 |
<i>opts</i> = <code>#!optional</code> <i>optional-formal-argument</i>* | <i>empty</i> |
| 3729 |
</li><li> <var> </var> |
| 3730 |
<i>optional-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code> |
| 3731 |
</li><li> <var> </var> |
| 3732 |
<i>rest</i> = <code>#!rest</code> <i>rest-formal-argument</i> | <i>empty</i> |
| 3733 |
</li><li> <var> </var> |
| 3734 |
<i>rest-formal-argument</i> = <i>variable</i> |
| 3735 |
</li><li> <var> </var> |
| 3736 |
<i>keys</i> = <code>#!key</code> <i>keyword-formal-argument</i>* | <i>empty</i> |
| 3737 |
</li><li> <var> </var> |
| 3738 |
<i>keyword-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code> |
| 3739 |
</li><li> <var> </var> |
| 3740 |
<i>initializer</i> = <i>expression</i> |
| 3741 |
</li><li> <var> </var> |
| 3742 |
<i>r4rs-lambda-formals</i> = <code>(</code> <i>variable</i>* <code>)</code> | |
| 3743 |
<code>(</code> <i>variable</i>+ <code>.</code> <i>variable</i> <code>)</code> | |
| 3744 |
<i>variable</i> |
| 3745 |
</li><li> <var> </var> |
| 3746 |
<i>r4rs-define-formals</i> = <i>variable</i>* | <i>variable</i>* <code>.</code> <i>variable</i> |
| 3747 |
</li></ul> |
| 3748 |
|
| 3749 |
<p>These forms are extended versions of the <code>lambda</code> and <code>define</code> |
| 3750 |
special forms of standard Scheme. They allow the use of optional formal |
| 3751 |
arguments, either positional or named, and support the syntax and semantics |
| 3752 |
of the DSSSL standard. |
| 3753 |
</p> |
| 3754 |
<p>When the procedure introduced by a <code>lambda</code> (or <code>define</code>) is |
| 3755 |
applied to a list of actual arguments, the formal and actual arguments |
| 3756 |
are processed as specified in the R4RS if the <i>lambda-formals</i> (or |
| 3757 |
<i>define-formals</i>) is a <i>r4rs-lambda-formals</i> (or |
| 3758 |
<i>r4rs-define-formals</i>). |
| 3759 |
</p> |
| 3760 |
<p>If the <i>formal-argument-list</i> matches |
| 3761 |
<i>dsssl-formal-argument-list</i> or <i>extended-formal-argument-list</i> |
| 3762 |
they are processed as follows: |
| 3763 |
</p> |
| 3764 |
<ol> |
| 3765 |
<li> |
| 3766 |
<i>Variable</i>s in <i>required-formal-argument</i>s are bound to |
| 3767 |
successive actual arguments starting with the first actual argument. It |
| 3768 |
shall be an error if there are fewer actual arguments than |
| 3769 |
<i>required-formal-argument</i>s. |
| 3770 |
|
| 3771 |
</li><li> |
| 3772 |
Next <i>variable</i>s in <i>optional-formal-argument</i>s are bound to |
| 3773 |
remaining actual arguments. If there are fewer remaining actual |
| 3774 |
arguments than <i>optional-formal-argument</i>s, then the variables are |
| 3775 |
bound to the result of evaluating <i>initializer</i>, if one was |
| 3776 |
specified, and otherwise to <code>#f</code>. The <i>initializer</i> is |
| 3777 |
evaluated in an environment in which all previous formal arguments have |
| 3778 |
been bound. |
| 3779 |
|
| 3780 |
</li><li> |
| 3781 |
If <code>#!key</code> does not appear in the <i>formal-argument-list</i> |
| 3782 |
and there is no <i>rest-formal-argument</i> then it shall be an error |
| 3783 |
if there are any remaining actual arguments. |
| 3784 |
|
| 3785 |
</li><li> |
| 3786 |
If <code>#!key</code> does not appear in the <i>formal-argument-list</i> |
| 3787 |
and there is a <i>rest-formal-argument</i> then the |
| 3788 |
<i>rest-formal-argument</i> is bound to a list of all remaining actual |
| 3789 |
arguments. |
| 3790 |
|
| 3791 |
</li><li> |
| 3792 |
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is |
| 3793 |
no <i>rest-formal-argument</i> then there shall be an even number of |
| 3794 |
remaining actual arguments. These are interpreted as a series of |
| 3795 |
pairs, where the first member of each pair is a keyword specifying the |
| 3796 |
argument name, and the second is the corresponding value. It shall be |
| 3797 |
an error if the first member of a pair is not a keyword. It shall be |
| 3798 |
an error if the argument name is not the same as a variable in a |
| 3799 |
<i>keyword-formal-argument</i>. If the same argument name occurs more |
| 3800 |
than once in the list of actual arguments, then the first value is |
| 3801 |
used. If there is no actual argument for a particular |
| 3802 |
<i>keyword-formal-argument</i>, then the variable is bound to the |
| 3803 |
result of evaluating <i>initializer</i> if one was specified, and |
| 3804 |
otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an |
| 3805 |
environment in which all previous formal arguments have been bound. |
| 3806 |
|
| 3807 |
</li><li> |
| 3808 |
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is |
| 3809 |
a <i>rest-formal-argument</i> <b>before</b> the <code>#!key</code> then there |
| 3810 |
may be an even or odd number of remaining actual arguments and the |
| 3811 |
<i>rest-formal-argument</i> is bound to a list of all remaining actual |
| 3812 |
arguments. Then, these remaining actual arguments are scanned from |
| 3813 |
left to right in pairs, stopping at the first pair whose first element |
| 3814 |
is not a keyword. Each pair whose first element is a keyword matching |
| 3815 |
the name of a <i>keyword-formal-argument</i> gives the value (i.e. the |
| 3816 |
second element of the pair) of the corresponding formal argument. If |
| 3817 |
the same argument name occurs more than once in the list of actual |
| 3818 |
arguments, then the first value is used. If there is no actual |
| 3819 |
argument for a particular <i>keyword-formal-argument</i>, then the |
| 3820 |
variable is bound to the result of evaluating <i>initializer</i> if one |
| 3821 |
was specified, and otherwise to <code>#f</code>. The <i>initializer</i> is |
| 3822 |
evaluated in an environment in which all previous formal arguments |
| 3823 |
have been bound. |
| 3824 |
|
| 3825 |
</li><li> |
| 3826 |
If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is |
| 3827 |
a <i>rest-formal-argument</i> <b>after</b> the <code>#!key</code> then there may |
| 3828 |
be an even or odd number of remaining actual arguments. The remaining |
| 3829 |
actual arguments are scanned from left to right in pairs, stopping at |
| 3830 |
the first pair whose first element is not a keyword. Each pair shall |
| 3831 |
have as its first element a keyword matching the name of a |
| 3832 |
<i>keyword-formal-argument</i>; the second element gives the value of |
| 3833 |
the corresponding formal argument. If the same argument name occurs |
| 3834 |
more than once in the list of actual arguments, then the first value |
| 3835 |
is used. If there is no actual argument for a particular |
| 3836 |
<i>keyword-formal-argument</i>, then the variable is bound to the |
| 3837 |
result of evaluating <i>initializer</i> if one was specified, and |
| 3838 |
otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an |
| 3839 |
environment in which all previous formal arguments have been bound. |
| 3840 |
Finally, the <i>rest-formal-argument</i> is bound to the list of the |
| 3841 |
actual arguments that were not scanned (i.e. after the last |
| 3842 |
keyword/value pair). |
| 3843 |
</li></ol> |
| 3844 |
|
| 3845 |
<p>In all cases it is an error for a <i>variable</i> to appear more than |
| 3846 |
once in a <i>formal-argument-list</i>. |
| 3847 |
</p> |
| 3848 |
<p>Note that this specification is compatible with the DSSSL language |
| 3849 |
standard (i.e. a correct DSSSL program will have the same semantics |
| 3850 |
when run with Gambit). |
| 3851 |
</p> |
| 3852 |
<p>It is unspecified whether variables receive their value by binding or by |
| 3853 |
assignment. Currently the compiler and interpreter use different |
| 3854 |
methods, which can lead to different semantics if |
| 3855 |
<code>call-with-current-continuation</code> is used in an <i>initializer</i>. |
| 3856 |
Note that this is irrelevant for DSSSL programs because |
| 3857 |
<code>call-with-current-continuation</code> does not exist in DSSSL. |
| 3858 |
</p> |
| 3859 |
<p>For example: |
| 3860 |
</p> |
| 3861 |
<table><tr><td> </td><td><pre class="smallexample">> <b>((lambda (#!rest x) x) 1 2 3)</b> |
| 3862 |
(1 2 3) |
| 3863 |
> <b>(define (f a #!optional b) (list a b))</b> |
| 3864 |
> <b>(define (g a #!optional (b a) #!key (k (* a b))) (list a b k))</b> |
| 3865 |
> <b>(define (h1 a #!rest r #!key k) (list a k r))</b> |
| 3866 |
> <b>(define (h2 a #!key k #!rest r) (list a k r))</b> |
| 3867 |
> <b>(f 1)</b> |
| 3868 |
(1 #f) |
| 3869 |
> <b>(f 1 2)</b> |
| 3870 |
(1 2) |
| 3871 |
> <b>(g 3)</b> |
| 3872 |
(3 3 9) |
| 3873 |
> <b>(g 3 4)</b> |
| 3874 |
(3 4 12) |
| 3875 |
> <b>(g 3 4 k: 5)</b> |
| 3876 |
(3 4 5) |
| 3877 |
> <b>(g 3 4 k: 5 k: 6)</b> |
| 3878 |
(3 4 5) |
| 3879 |
> <b>(h1 7)</b> |
| 3880 |
(7 #f ()) |
| 3881 |
> <b>(h1 7 k: 8 9)</b> |
| 3882 |
(7 8 (k: 8 9)) |
| 3883 |
> <b>(h1 7 k: 8 z: 9)</b> |
| 3884 |
(7 8 (k: 8 z: 9)) |
| 3885 |
> <b>(h2 7)</b> |
| 3886 |
(7 #f ()) |
| 3887 |
> <b>(h2 7 k: 8 9)</b> |
| 3888 |
(7 8 (9)) |
| 3889 |
> <b>(h2 7 k: 8 z: 9)</b> |
| 3890 |
*** ERROR IN (console)@17.1 -- Unknown keyword argument passed to procedure |
| 3891 |
(h2 7 k: 8 z: 9) |
| 3892 |
</pre></td></tr></table> |
| 3893 |
|
| 3894 |
|
| 3895 |
|
| 3896 |
<a name="Miscellaneous-extensions"></a><hr size="6"><br/><br/><br/> |
| 3897 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 3898 |
<tr><td valign="middle" align="left"><a href="#Extensions-to-standard-special-forms" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 3899 |
<td valign="middle" align="left"><a href="#Undocumented-extensions" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 3900 |
<td valign="middle" align="left"> </td> |
| 3901 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 3902 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 3903 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 3904 |
<td valign="middle" align="left"> </td> |
| 3905 |
<td valign="middle" align="left"> </td> |
| 3906 |
<td valign="middle" align="left"> </td> |
| 3907 |
<td valign="middle" align="left"> </td> |
| 3908 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 3909 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 3910 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 3911 |
</tr></table> |
| 3912 |
<a name="Miscellaneous-extensions-1"></a> |
| 3913 |
<h2 class="section">6.3 Miscellaneous extensions</h2> |
| 3914 |
|
| 3915 |
<a name="Definition_of_vector-copy"></a><a name="Procedure_vector-copy"></a><a name="index-vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_vector-copy">vector-copy</a></b></code><i> <var>vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3916 |
|
| 3917 |
<p>This procedure returns a newly allocated vector with the same content |
| 3918 |
as the vector <var>vector</var>. Note that the elements are not |
| 3919 |
recursively copied. |
| 3920 |
</p> |
| 3921 |
<p>For example: |
| 3922 |
</p> |
| 3923 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v1 '#(1 2 3))</b> |
| 3924 |
> <b>(define v2 (vector-copy v1))</b> |
| 3925 |
> <b>v2</b> |
| 3926 |
#(1 2 3) |
| 3927 |
> <b>(eq? v1 v2)</b> |
| 3928 |
#f |
| 3929 |
</pre></td></tr></table> |
| 3930 |
|
| 3931 |
|
| 3932 |
|
| 3933 |
<a name="Definition_of_subvector"></a><a name="Procedure_subvector"></a><a name="index-subvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subvector">subvector</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3934 |
|
| 3935 |
<p>This procedure is the vector analog of the <code>substring</code> |
| 3936 |
procedure. It returns a newly allocated vector formed from the |
| 3937 |
elements of the vector <var>vector</var> beginning with index <var>start</var> |
| 3938 |
(inclusive) and ending with index <var>end</var> (exclusive). |
| 3939 |
</p> |
| 3940 |
<p>For example: |
| 3941 |
</p> |
| 3942 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(subvector '#(a b c d e f) 3 5)</b> |
| 3943 |
#(d e) |
| 3944 |
</pre></td></tr></table> |
| 3945 |
|
| 3946 |
|
| 3947 |
|
| 3948 |
<a name="Definition_of_vector-append"></a><a name="Procedure_vector-append"></a><a name="index-vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_vector-append">vector-append</a></b></code><i> <var>vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3949 |
|
| 3950 |
<p>This procedure is the vector analog of the <code>string-append</code> |
| 3951 |
procedure. It returns a newly allocated vector whose elements |
| 3952 |
form the concatenation of the given vectors. |
| 3953 |
</p> |
| 3954 |
<p>For example: |
| 3955 |
</p> |
| 3956 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v '#(1 2 3))</b> |
| 3957 |
> <b>(vector-append v v v)</b> |
| 3958 |
#(1 2 3 1 2 3 1 2 3) |
| 3959 |
</pre></td></tr></table> |
| 3960 |
|
| 3961 |
|
| 3962 |
|
| 3963 |
<a name="Definition_of_vector-concatenate"></a><a name="Procedure_vector-concatenate"></a><a name="index-append_002dvectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_vector-concatenate">vector-concatenate</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3964 |
|
| 3965 |
<p>This procedure returns a newly allocated vector whose elements form |
| 3966 |
the concatenation of all the vectors in the list <var>lst</var>. It is |
| 3967 |
equivalent to <code>(apply vector-append <span class="roman"><var>lst</var></span>)</code>. |
| 3968 |
</p> |
| 3969 |
<p>For example: |
| 3970 |
</p> |
| 3971 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v '#(1 2 3))</b> |
| 3972 |
> <b>(vector-concatenate (list v v v))</b> |
| 3973 |
#(1 2 3 1 2 3 1 2 3) |
| 3974 |
</pre></td></tr></table> |
| 3975 |
|
| 3976 |
|
| 3977 |
|
| 3978 |
<a name="Definition_of_subvector-fill!"></a><a name="Procedure_subvector-fill!"></a><a name="index-subvector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subvector-fill!">subvector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3979 |
|
| 3980 |
<p>This procedure is like <code>vector-fill!</code>, but fills a selected part |
| 3981 |
of the given vector. It sets the elements of the vector <var>vector</var>, |
| 3982 |
beginning with index <var>start</var> (inclusive) and ending with index |
| 3983 |
<var>end</var> (exclusive) to <var>fill</var>. The value returned is |
| 3984 |
unspecified. |
| 3985 |
</p> |
| 3986 |
<p>For example: |
| 3987 |
</p> |
| 3988 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b> |
| 3989 |
> <b>(subvector-fill! v 3 5 'x)</b> |
| 3990 |
> <b>v</b> |
| 3991 |
#(a b c x x f) |
| 3992 |
</pre></td></tr></table> |
| 3993 |
|
| 3994 |
|
| 3995 |
|
| 3996 |
<a name="Definition_of_subvector-move!"></a><a name="Procedure_subvector-move!"></a><a name="index-subvector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subvector-move!">subvector-move!</a></b></code><i> <var>src-vector</var> <var>src-start</var> <var>src-end</var> <var>dst-vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 3997 |
|
| 3998 |
<p>This procedure replaces part of the contents of vector |
| 3999 |
<var>dst-vector</var> with part of the contents of vector |
| 4000 |
<var>src-vector</var>. It copies elements from <var>src-vector</var>, beginning |
| 4001 |
with index <var>src-start</var> (inclusive) and ending with index |
| 4002 |
<var>src-end</var> (exclusive) to <var>dst-vector</var> beginning with index |
| 4003 |
<var>dst-start</var> (inclusive). The value returned is unspecified. |
| 4004 |
</p> |
| 4005 |
<p>For example: |
| 4006 |
</p> |
| 4007 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v1 '#(1 2 3 4 5 6))</b> |
| 4008 |
> <b>(define v2 (vector 'a 'b 'c 'd 'e 'f))</b> |
| 4009 |
> <b>(subvector-move! v1 3 5 v2 1)</b> |
| 4010 |
> <b>v2</b> |
| 4011 |
#(a 4 5 d e f) |
| 4012 |
</pre></td></tr></table> |
| 4013 |
|
| 4014 |
|
| 4015 |
|
| 4016 |
<a name="Definition_of_vector-shrink!"></a><a name="Procedure_vector-shrink!"></a><a name="index-vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_vector-shrink!">vector-shrink!</a></b></code><i> <var>vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4017 |
|
| 4018 |
<p>This procedure shortens the vector <var>vector</var> so that its new size |
| 4019 |
is <var>k</var>. The value returned is unspecified. |
| 4020 |
</p> |
| 4021 |
<p>For example: |
| 4022 |
</p> |
| 4023 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b> |
| 4024 |
> <b>v</b> |
| 4025 |
#(a b c d e f) |
| 4026 |
> <b>(vector-shrink! v 3)</b> |
| 4027 |
> <b>v</b> |
| 4028 |
#(a b c) |
| 4029 |
</pre></td></tr></table> |
| 4030 |
|
| 4031 |
|
| 4032 |
|
| 4033 |
<a name="Definition_of_string-concatenate"></a><a name="Procedure_string-concatenate"></a><a name="index-append_002dstrings"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-concatenate">string-concatenate</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4034 |
|
| 4035 |
<p>This procedure returns a newly allocated string whose elements form |
| 4036 |
the concatenation of all the strings in the list <var>lst</var>. It is |
| 4037 |
equivalent to <code>(apply string-append <span class="roman"><var>lst</var></span>)</code>. |
| 4038 |
</p> |
| 4039 |
<p>For example: |
| 4040 |
</p> |
| 4041 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s "abc")</b> |
| 4042 |
> <b>(string-concatenate (list s s s))</b> |
| 4043 |
"abcabcabc" |
| 4044 |
</pre></td></tr></table> |
| 4045 |
|
| 4046 |
|
| 4047 |
|
| 4048 |
<a name="Definition_of_substring-fill!"></a><a name="Procedure_substring-fill!"></a><a name="index-substring_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_substring-fill!">substring-fill!</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4049 |
|
| 4050 |
<p>This procedure is like <code>string-fill!</code>, but fills a selected part |
| 4051 |
of the given string. It sets the elements of the string <var>string</var>, |
| 4052 |
beginning with index <var>start</var> (inclusive) and ending with index |
| 4053 |
<var>end</var> (exclusive) to <var>fill</var>. The value returned is |
| 4054 |
unspecified. |
| 4055 |
</p> |
| 4056 |
<p>For example: |
| 4057 |
</p> |
| 4058 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (string #\a #\b #\c #\d #\e #\f))</b> |
| 4059 |
> <b>(substring-fill! s 3 5 #\x)</b> |
| 4060 |
> <b>s</b> |
| 4061 |
"abcxxf" |
| 4062 |
</pre></td></tr></table> |
| 4063 |
|
| 4064 |
|
| 4065 |
|
| 4066 |
<a name="Definition_of_substring-move!"></a><a name="Procedure_substring-move!"></a><a name="index-substring_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_substring-move!">substring-move!</a></b></code><i> <var>src-string</var> <var>src-start</var> <var>src-end</var> <var>dst-string</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4067 |
|
| 4068 |
<p>This procedure replaces part of the contents of string |
| 4069 |
<var>dst-string</var> with part of the contents of string |
| 4070 |
<var>src-string</var>. It copies elements from <var>src-string</var>, beginning |
| 4071 |
with index <var>src-start</var> (inclusive) and ending with index |
| 4072 |
<var>src-end</var> (exclusive) to <var>dst-string</var> beginning with index |
| 4073 |
<var>dst-start</var> (inclusive). The value returned is unspecified. |
| 4074 |
</p> |
| 4075 |
<p>For example: |
| 4076 |
</p> |
| 4077 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s1 "123456")</b> |
| 4078 |
> <b>(define s2 (string #\a #\b #\c #\d #\e #\f))</b> |
| 4079 |
> <b>(substring-move! s1 3 5 s2 1)</b> |
| 4080 |
> <b>s2</b> |
| 4081 |
"a45def" |
| 4082 |
</pre></td></tr></table> |
| 4083 |
|
| 4084 |
|
| 4085 |
|
| 4086 |
<a name="Definition_of_string-shrink!"></a><a name="Procedure_string-shrink!"></a><a name="index-string_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-shrink!">string-shrink!</a></b></code><i> <var>string</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4087 |
|
| 4088 |
<p>This procedure shortens the string <var>string</var> so that its new size |
| 4089 |
is <var>k</var>. The value returned is unspecified. |
| 4090 |
</p> |
| 4091 |
<p>For example: |
| 4092 |
</p> |
| 4093 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (string #\a #\b #\c #\d #\e #\f))</b> |
| 4094 |
> <b>s</b> |
| 4095 |
"abcdef" |
| 4096 |
> <b>(string-shrink! s 3)</b> |
| 4097 |
> <b>s</b> |
| 4098 |
"abc" |
| 4099 |
</pre></td></tr></table> |
| 4100 |
|
| 4101 |
|
| 4102 |
|
| 4103 |
<a name="Definition_of_box"></a><a name="Procedure_box"></a><a name="index-box"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_box">box</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4104 |
<a name="Definition_of_box?"></a><a name="Procedure_box?"></a><a name="index-box_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_box?">box?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4105 |
<a name="Definition_of_unbox"></a><a name="Procedure_unbox"></a><a name="index-unbox"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbox">unbox</a></b></code><i> <var>box</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4106 |
<a name="Definition_of_set-box!"></a><a name="Procedure_set-box!"></a><a name="index-set_002dbox_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_set-box!">set-box!</a></b></code><i> <var>box</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4107 |
<a name="index-boxes"></a> |
| 4108 |
|
| 4109 |
<p>These procedures implement the <em>box</em> data type. A box is a |
| 4110 |
cell containing a single mutable field. The lexical syntax |
| 4111 |
of a box containing the object <var>obj</var> is <code>#&<var>obj</var></code> |
| 4112 |
(see section <a href="#Box-syntax">Box syntax</a>). |
| 4113 |
</p> |
| 4114 |
<p>The procedure <code>box</code> returns a new box object whose content is |
| 4115 |
initialized to <var>obj</var>. The procedure <code>box?</code> returns <code>#t</code> |
| 4116 |
if <var>obj</var> is a box, and otherwise returns <code>#f</code>. The procedure |
| 4117 |
<code>unbox</code> returns the content of the box <var>box</var>. The procedure |
| 4118 |
<code>set-box!</code> changes the content of the box <var>box</var> to <var>obj</var>. |
| 4119 |
The procedure <code>set-box!</code> returns an unspecified value. |
| 4120 |
</p> |
| 4121 |
<p>For example: |
| 4122 |
</p> |
| 4123 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define b (box 0))</b> |
| 4124 |
> <b>b</b> |
| 4125 |
#&0 |
| 4126 |
> <b>(define (inc!) (set-box! b (+ (unbox b) 1)))</b> |
| 4127 |
> <b>(inc!)</b> |
| 4128 |
> <b>b</b> |
| 4129 |
#&1 |
| 4130 |
> <b>(unbox b)</b> |
| 4131 |
1 |
| 4132 |
</pre></td></tr></table> |
| 4133 |
|
| 4134 |
|
| 4135 |
|
| 4136 |
<a name="Definition_of_keyword?"></a><a name="Procedure_keyword?"></a><a name="index-keyword_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword?">keyword?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4137 |
<a name="Definition_of_keyword-%3Estring"></a><a name="Procedure_keyword-%3Estring"></a><a name="index-keyword_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword-%3Estring">keyword->string</a></b></code><i> <var>keyword</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4138 |
<a name="Definition_of_string-%3Ekeyword"></a><a name="Procedure_string-%3Ekeyword"></a><a name="index-string_002d_003ekeyword"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-%3Ekeyword">string->keyword</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4139 |
<a name="index-keywords"></a> |
| 4140 |
|
| 4141 |
<p>These procedures implement the <em>keyword</em> data type. Keywords are |
| 4142 |
similar to symbols but are self evaluating and distinct from the |
| 4143 |
symbol data type. The lexical syntax of keywords is specified in |
| 4144 |
<a href="#Keyword-syntax">Keyword syntax</a>. |
| 4145 |
</p> |
| 4146 |
<p>The procedure <code>keyword?</code> returns <code>#t</code> if <var>obj</var> is a |
| 4147 |
keyword, and otherwise returns <code>#f</code>. The procedure |
| 4148 |
<code>keyword->string</code> returns the name of <var>keyword</var> as a string. |
| 4149 |
The procedure <code>string->keyword</code> returns the keyword whose name is |
| 4150 |
<var>string</var>. |
| 4151 |
</p> |
| 4152 |
<p>For example: |
| 4153 |
</p> |
| 4154 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword? 'color)</b> |
| 4155 |
#f |
| 4156 |
> <b>(keyword? color:)</b> |
| 4157 |
#t |
| 4158 |
> <b>(keyword->string color:)</b> |
| 4159 |
"color" |
| 4160 |
> <b>(string->keyword "color")</b> |
| 4161 |
color: |
| 4162 |
</pre></td></tr></table> |
| 4163 |
|
| 4164 |
|
| 4165 |
|
| 4166 |
<a name="Definition_of_gensym"></a><a name="Procedure_gensym"></a><a name="index-gensym"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_gensym">gensym</a></b></code><i> <span class="roman">[</span><var>prefix</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4167 |
|
| 4168 |
<p>This procedure returns a new <em>uninterned symbol</em>. Uninterned symbols |
| 4169 |
are guaranteed to be distinct from the symbols generated by the |
| 4170 |
procedures <code>read</code> and <code>string->symbol</code>. The symbol |
| 4171 |
<var>prefix</var> is the prefix used to generate the new symbol’s name. If |
| 4172 |
it is not specified, the prefix defaults to ‘<samp>g</samp>’. |
| 4173 |
</p> |
| 4174 |
<p>For example: |
| 4175 |
</p> |
| 4176 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(gensym)</b> |
| 4177 |
#:g0 |
| 4178 |
> <b>(gensym)</b> |
| 4179 |
#:g1 |
| 4180 |
> <b>(gensym 'star-trek-)</b> |
| 4181 |
#:star-trek-2 |
| 4182 |
</pre></td></tr></table> |
| 4183 |
|
| 4184 |
|
| 4185 |
|
| 4186 |
<a name="Definition_of_make-uninterned-symbol"></a><a name="Procedure_make-uninterned-symbol"></a><a name="index-make_002duninterned_002dsymbol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-uninterned-symbol">make-uninterned-symbol</a></b></code><i> <var>name</var> <span class="roman">[</span><var>hash</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4187 |
<a name="Definition_of_uninterned-symbol?"></a><a name="Procedure_uninterned-symbol?"></a><a name="index-uninterned_002dsymbol_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uninterned-symbol?">uninterned-symbol?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4188 |
|
| 4189 |
<p>The procedure <code>make-uninterned-symbol</code> returns a new uninterned |
| 4190 |
symbol whose name is <var>name</var> and hash is <var>hash</var>. The name must |
| 4191 |
be a string and the hash must be a nonnegative fixnum. |
| 4192 |
</p> |
| 4193 |
<p>The procedure <code>uninterned-symbol?</code> returns <code>#t</code> when |
| 4194 |
<var>obj</var> is a symbol that is uninterned and <code>#f</code> otherwise. |
| 4195 |
</p> |
| 4196 |
<p>For example: |
| 4197 |
</p> |
| 4198 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(uninterned-symbol? (gensym))</b> |
| 4199 |
#t |
| 4200 |
> <b>(make-uninterned-symbol "foo")</b> |
| 4201 |
#:foo: |
| 4202 |
> <b>(uninterned-symbol? (make-uninterned-symbol "foo"))</b> |
| 4203 |
#t |
| 4204 |
> <b>(uninterned-symbol? 'hello)</b> |
| 4205 |
#f |
| 4206 |
> <b>(uninterned-symbol? 123)</b> |
| 4207 |
#f |
| 4208 |
</pre></td></tr></table> |
| 4209 |
|
| 4210 |
|
| 4211 |
|
| 4212 |
<a name="Definition_of_make-uninterned-keyword"></a><a name="Procedure_make-uninterned-keyword"></a><a name="index-make_002duninterned_002dkeyword"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-uninterned-keyword">make-uninterned-keyword</a></b></code><i> <var>name</var> <span class="roman">[</span><var>hash</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4213 |
<a name="Definition_of_uninterned-keyword?"></a><a name="Procedure_uninterned-keyword?"></a><a name="index-uninterned_002dkeyword_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uninterned-keyword?">uninterned-keyword?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4214 |
|
| 4215 |
<p>The procedure <code>make-uninterned-keyword</code> returns a new uninterned |
| 4216 |
keyword whose name is <var>name</var> and hash is <var>hash</var>. The name must |
| 4217 |
be a string and the hash must be a nonnegative fixnum. |
| 4218 |
</p> |
| 4219 |
<p>The procedure <code>uninterned-keyword?</code> returns <code>#t</code> when |
| 4220 |
<var>obj</var> is a keyword that is uninterned and <code>#f</code> otherwise. |
| 4221 |
</p> |
| 4222 |
<p>For example: |
| 4223 |
</p> |
| 4224 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-uninterned-keyword "foo")</b> |
| 4225 |
#:foo: |
| 4226 |
> <b>(uninterned-keyword? (make-uninterned-keyword "foo"))</b> |
| 4227 |
#t |
| 4228 |
> <b>(uninterned-keyword? hello:)</b> |
| 4229 |
#f |
| 4230 |
> <b>(uninterned-keyword? 123)</b> |
| 4231 |
#f |
| 4232 |
</pre></td></tr></table> |
| 4233 |
|
| 4234 |
|
| 4235 |
|
| 4236 |
<a name="Definition_of_void"></a><a name="Procedure_void"></a><a name="index-void"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_void">void</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4237 |
|
| 4238 |
<p>This procedure returns the void object. The read-eval-print loop |
| 4239 |
prints nothing when the result is the void object. |
| 4240 |
</p> |
| 4241 |
|
| 4242 |
|
| 4243 |
<a name="Definition_of_eval"></a><a name="Procedure_eval"></a><a name="index-eval"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_eval">eval</a></b></code><i> <var>expr</var> <span class="roman">[</span><var>env</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4244 |
|
| 4245 |
<p>The first parameter is a datum representing an expression. The |
| 4246 |
<code>eval</code> procedure evaluates this expression in the global |
| 4247 |
interaction environment and returns the result. If present, the |
| 4248 |
second parameter is ignored (it is provided for compatibility with |
| 4249 |
R5RS). |
| 4250 |
</p> |
| 4251 |
<p>For example: |
| 4252 |
</p> |
| 4253 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(eval '(+ 1 2))</b> |
| 4254 |
3 |
| 4255 |
> <b>((eval 'car) '(1 2))</b> |
| 4256 |
1 |
| 4257 |
> <b>(eval '(define x 5))</b> |
| 4258 |
> <b>x</b> |
| 4259 |
5 |
| 4260 |
</pre></td></tr></table> |
| 4261 |
|
| 4262 |
|
| 4263 |
|
| 4264 |
<a name="Definition_of_include"></a><a name="Special_form_include"></a><a name="index-include"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_include">include</a></b></code><i> <span class="roman"><i>file</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4265 |
|
| 4266 |
<p>The <i>file</i> parameter must be a string naming an existing file |
| 4267 |
containing Scheme source code. The <code>include</code> special form |
| 4268 |
splices the content of the specified source file. This form can only |
| 4269 |
appear where a <code>define</code> form is acceptable. |
| 4270 |
</p> |
| 4271 |
<p>For example: |
| 4272 |
</p> |
| 4273 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(include "macros.scm") |
| 4274 |
|
| 4275 |
(define (f lst) |
| 4276 |
(include "sort.scm") |
| 4277 |
(map sqrt (sort lst))) |
| 4278 |
</pre></td></tr></table> |
| 4279 |
|
| 4280 |
|
| 4281 |
|
| 4282 |
<a name="Definition_of_define-macro"></a><a name="Special_form_define-macro"></a><a name="index-define_002dmacro"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-macro">define-macro</a></b></code><i> (<span class="roman"><i>name</i></span> <span class="roman"><i>define-formals</i></span>) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4283 |
<a name="index-include-1"></a> |
| 4284 |
|
| 4285 |
<p>Define <i>name</i> as a macro special form which expands into <i>body</i>. |
| 4286 |
This form can only appear where a <code>define</code> form is acceptable. |
| 4287 |
Macros are lexically scoped. The scope of a local macro definition |
| 4288 |
extends from the definition to the end of the body of the surrounding |
| 4289 |
binding construct. Macros defined at the top level of a Scheme module |
| 4290 |
are only visible in that module. To have access to the macro |
| 4291 |
definitions contained in a file, that file must be included using the |
| 4292 |
<code>include</code> special form. Macros which are visible from the REPL are |
| 4293 |
also visible during the compilation of Scheme source files. |
| 4294 |
</p> |
| 4295 |
<p>For example: |
| 4296 |
</p> |
| 4297 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define-macro (unless test . body) |
| 4298 |
`(if ,test #f (begin ,@body))) |
| 4299 |
|
| 4300 |
(define-macro (push var #!optional val) |
| 4301 |
`(set! ,var (cons ,val ,var))) |
| 4302 |
</pre></td></tr></table> |
| 4303 |
|
| 4304 |
<p>To examine the code into which a macro expands you can use the |
| 4305 |
compiler’s ‘<samp>-expansion</samp>’ option or the <code>pp</code> procedure. |
| 4306 |
For example: |
| 4307 |
</p> |
| 4308 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define-macro (push var #!optional val) |
| 4309 |
`(set! ,var (cons ,val ,var)))</b> |
| 4310 |
> <b>(pp (lambda () (push stack 1) (push stack) (push stack 3)))</b> |
| 4311 |
(lambda () |
| 4312 |
(set! stack (cons 1 stack)) |
| 4313 |
(set! stack (cons #f stack)) |
| 4314 |
(set! stack (cons 3 stack))) |
| 4315 |
</pre></td></tr></table> |
| 4316 |
|
| 4317 |
|
| 4318 |
|
| 4319 |
<a name="Definition_of_define-syntax"></a><a name="Special_form_define-syntax"></a><a name="index-define_002dsyntax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-syntax">define-syntax</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>expander</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4320 |
<a name="index-define_002dsyntax-1"></a> |
| 4321 |
<a name="index-syntax_002drules"></a> |
| 4322 |
<a name="index-syntax_002dcase"></a> |
| 4323 |
<a name="index-_002d_003as-1"></a> |
| 4324 |
|
| 4325 |
<p>Define <i>name</i> as a macro special form whose expansion is specified |
| 4326 |
by <i>expander</i>. This form is available only when the runtime option |
| 4327 |
‘<samp>-:s</samp>’ is used. This option causes the loading of the |
| 4328 |
<code>~~lib/syntax-case</code> support library, which is the Hieb and Dybvig |
| 4329 |
portable <code>syntax-case</code> implementation which has been ported to |
| 4330 |
the Gambit interpreter and compiler. Note that this implementation of |
| 4331 |
<code>syntax-case</code> does not support special forms that are specific to |
| 4332 |
Gambit. |
| 4333 |
</p> |
| 4334 |
<p>For example: |
| 4335 |
</p> |
| 4336 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:s</b> |
| 4337 |
Gambit v4.7.3 |
| 4338 |
|
| 4339 |
> <b>(define-syntax unless |
| 4340 |
(syntax-rules () |
| 4341 |
((unless test body ...) |
| 4342 |
(if test #f (begin body ...)))))</b> |
| 4343 |
> <b>(let ((test 111)) (unless (= 1 2) (list test test)))</b> |
| 4344 |
(111 111) |
| 4345 |
> <b>(pp (lambda () (let ((test 111)) (unless (= 1 2) (list test test)))))</b> |
| 4346 |
(lambda () ((lambda (%%test14) (if (= 1 2) #f (list %%test14 %%test14))) 111)) |
| 4347 |
> <b>(unless #f (pp xxx))</b> |
| 4348 |
*** ERROR IN (console)@7.16 -- Unbound variable: xxx |
| 4349 |
</pre></td></tr></table> |
| 4350 |
|
| 4351 |
|
| 4352 |
|
| 4353 |
<a name="Definition_of_declare"></a><a name="Special_form_declare"></a><a name="index-declare"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_declare">declare</a></b></code><i> <span class="roman"><i>declaration</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4354 |
|
| 4355 |
<p>This form introduces declarations to be used by the compiler |
| 4356 |
(currently the interpreter ignores the declarations). This form can |
| 4357 |
only appear where a <code>define</code> form is acceptable. Declarations |
| 4358 |
are lexically scoped in the same way as macros. The following |
| 4359 |
declarations are accepted by the compiler: |
| 4360 |
</p> |
| 4361 |
<dl compact="compact"> |
| 4362 |
<dt> <code>(<var>dialect</var>)</code></dt> |
| 4363 |
<dd><a name="index-ieee_002dscheme"></a> |
| 4364 |
<a name="index-r4rs_002dscheme"></a> |
| 4365 |
<a name="index-r5rs_002dscheme"></a> |
| 4366 |
<a name="index-gambit_002dscheme"></a> |
| 4367 |
<p>Use the given dialect’s semantics. <var>dialect</var> can be: |
| 4368 |
‘<samp>ieee-scheme</samp>’, ‘<samp>r4rs-scheme</samp>’, ‘<samp>r5rs-scheme</samp>’ |
| 4369 |
or ‘<samp>gambit-scheme</samp>’. |
| 4370 |
</p> |
| 4371 |
</dd> |
| 4372 |
<dt> <code>(<var>strategy</var>)</code></dt> |
| 4373 |
<dd><a name="index-block"></a> |
| 4374 |
<a name="index-separate"></a> |
| 4375 |
<p>Select block compilation or separate compilation. In block |
| 4376 |
compilation, the compiler assumes that global variables defined in the |
| 4377 |
current file that are not mutated in the file will never be mutated. |
| 4378 |
<var>strategy</var> can be: ‘<samp>block</samp>’ or ‘<samp>separate</samp>’. |
| 4379 |
</p> |
| 4380 |
</dd> |
| 4381 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline)</code></dt> |
| 4382 |
<dd><a name="index-inline"></a> |
| 4383 |
<p>Allow (or disallow) inlining of user procedures. |
| 4384 |
</p> |
| 4385 |
</dd> |
| 4386 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline-primitives <var>primitive</var>…)</code></dt> |
| 4387 |
<dd><a name="index-inline_002dprimitives"></a> |
| 4388 |
<p>The given primitives should (or should not) be inlined |
| 4389 |
if possible (all primitives if none specified). |
| 4390 |
</p> |
| 4391 |
</dd> |
| 4392 |
<dt> <code>(inlining-limit <var>n</var>)</code></dt> |
| 4393 |
<dd><a name="index-inlining_002dlimit"></a> |
| 4394 |
<p>Select the degree to which the compiler inlines user procedures. |
| 4395 |
<var>n</var> is the upper-bound, in percent, on code expansion that will |
| 4396 |
result from inlining. Thus, a value of 300 indicates that the size of |
| 4397 |
the program will not grow by more than 300 percent (i.e. it will be at |
| 4398 |
most 4 times the size of the original). A value of 0 disables inlining. |
| 4399 |
The size of a program is the total number of subexpressions it contains |
| 4400 |
(i.e. the size of an expression is one plus the size of its immediate |
| 4401 |
subexpressions). The following conditions must hold for a procedure to |
| 4402 |
be inlined: inlining the procedure must not cause the size of the call |
| 4403 |
site to grow more than specified by the inlining limit, the site of |
| 4404 |
definition (the <code>define</code> or <code>lambda</code>) and the call site must |
| 4405 |
be declared as <code>(inline)</code>, and the compiler must be able to find |
| 4406 |
the definition of the procedure referred to at the call site (if the |
| 4407 |
procedure is bound to a global variable, the definition site must have a |
| 4408 |
<code>(block)</code> declaration). Note that inlining usually causes much |
| 4409 |
less code expansion than specified by the inlining limit (an expansion |
| 4410 |
around 10% is common for <var>n</var>=350). |
| 4411 |
</p> |
| 4412 |
</dd> |
| 4413 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> lambda-lift)</code></dt> |
| 4414 |
<dd><a name="index-lambda_002dlift"></a> |
| 4415 |
<p>Lambda-lift (or don’t lambda-lift) locally defined procedures. |
| 4416 |
</p> |
| 4417 |
</dd> |
| 4418 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> constant-fold)</code></dt> |
| 4419 |
<dd><a name="index-constant_002dfold"></a> |
| 4420 |
<p>Allow (or disallow) constant-folding of primitive procedures. |
| 4421 |
</p> |
| 4422 |
</dd> |
| 4423 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> standard-bindings <var>var</var>…)</code></dt> |
| 4424 |
<dd><a name="index-standard_002dbindings"></a> |
| 4425 |
<p>The given global variables are known (or not known) to be equal to |
| 4426 |
the value defined for them in the dialect (all variables defined in |
| 4427 |
the standard if none specified). |
| 4428 |
</p> |
| 4429 |
</dd> |
| 4430 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> extended-bindings <var>var</var>…)</code></dt> |
| 4431 |
<dd><a name="index-extended_002dbindings"></a> |
| 4432 |
<p>The given global variables are known (or not known) to be equal to the |
| 4433 |
value defined for them in the runtime system (all variables defined |
| 4434 |
in the runtime if none specified). |
| 4435 |
</p> |
| 4436 |
</dd> |
| 4437 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> run-time-bindings <var>var</var>…)</code></dt> |
| 4438 |
<dd><a name="index-run_002dtime_002dbindings"></a> |
| 4439 |
<p>The given global variables will be tested at run time to see if they |
| 4440 |
are equal to the value defined for them in the runtime system (all |
| 4441 |
variables defined in the runtime if none specified). |
| 4442 |
</p> |
| 4443 |
</dd> |
| 4444 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> safe)</code></dt> |
| 4445 |
<dd><a name="index-safe"></a> |
| 4446 |
<p>Generate (or don’t generate) code that will prevent fatal errors at |
| 4447 |
run time. Note that in ‘<samp>safe</samp>’ mode certain semantic errors will |
| 4448 |
not be checked as long as they can’t crash the system. For example |
| 4449 |
the primitive <code>char=?</code> may disregard the type of its arguments in |
| 4450 |
‘<samp>safe</samp>’ as well as ‘<samp>not safe</samp>’ mode. |
| 4451 |
</p> |
| 4452 |
</dd> |
| 4453 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> interrupts-enabled)</code></dt> |
| 4454 |
<dd><a name="index-interrupts_002denabled"></a> |
| 4455 |
<p>Generate (or don’t generate) interrupt checks. Interrupt checks are |
| 4456 |
used to detect user interrupts and also to check for stack overflows. |
| 4457 |
Interrupt checking should not be turned off casually. |
| 4458 |
</p> |
| 4459 |
</dd> |
| 4460 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug)</code></dt> |
| 4461 |
<dd><a name="index-debug-1"></a> |
| 4462 |
<a name="index-_002ddebug-1"></a> |
| 4463 |
<p>Enable (or disable) the generation of debugging information. The kind |
| 4464 |
of debugging information that is generated depends on the declarations |
| 4465 |
‘<samp>debug-location</samp>’, ‘<samp>debug-source</samp>’, and |
| 4466 |
‘<samp>debug-environments</samp>’. If any of the command line options |
| 4467 |
‘<samp>-debug</samp>’, ‘<samp>-debug-location</samp>’, ‘<samp>-debug-source</samp>’ and |
| 4468 |
‘<samp>-debug-environments</samp>’ are present, the ‘<samp>debug</samp>’ declaration |
| 4469 |
is initially enabled, otherwise it is initially disabled. When all |
| 4470 |
kinds of debugging information are generated there is a substantial |
| 4471 |
increase in the C compilation time and the size of the generated code. |
| 4472 |
When compiling a 3000 line Scheme file it was observed that the total |
| 4473 |
compilation time is 500% longer and the executable code is 150% |
| 4474 |
bigger. |
| 4475 |
</p> |
| 4476 |
</dd> |
| 4477 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-location)</code></dt> |
| 4478 |
<dd><a name="index-debug_002dlocation-1"></a> |
| 4479 |
<a name="index-_002ddebug_002dlocation-1"></a> |
| 4480 |
<p>Select (or deselect) source code location debugging information. When |
| 4481 |
this declaration and the ‘<samp>debug</samp>’ declaration are in effect, run |
| 4482 |
time error messages indicate the location of the error in the source |
| 4483 |
code file. If any of the command line options ‘<samp>-debug-source</samp>’ |
| 4484 |
and ‘<samp>-debug-environments</samp>’ are present and ‘<samp>-debug-location</samp>’ |
| 4485 |
is absent, the ‘<samp>debug-location</samp>’ declaration is initially |
| 4486 |
disabled, otherwise it is initially enabled. When compiling a 3000 |
| 4487 |
line Scheme file it was observed that the total compilation time is |
| 4488 |
200% longer and the executable code is 60% bigger. |
| 4489 |
</p> |
| 4490 |
</dd> |
| 4491 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-source)</code></dt> |
| 4492 |
<dd><a name="index-debug_002dsource-1"></a> |
| 4493 |
<a name="index-_002ddebug_002dsource-1"></a> |
| 4494 |
<p>Select (or deselect) source code debugging information. When this |
| 4495 |
declaration and the ‘<samp>debug</samp>’ declaration are in effect, run time |
| 4496 |
error messages indicate the source code, the backtraces are more |
| 4497 |
precise, and the <code>pp</code> procedure will display the source code of |
| 4498 |
compiled procedures. If any of the command line options |
| 4499 |
‘<samp>-debug-location</samp>’ and ‘<samp>-debug-environments</samp>’ are present and |
| 4500 |
‘<samp>-debug-source</samp>’ is absent, the ‘<samp>debug-source</samp>’ declaration is |
| 4501 |
initially disabled, otherwise it is initially enabled. When compiling |
| 4502 |
a 3000 line Scheme file it was observed that the total compilation |
| 4503 |
time is 90% longer and the executable code is 90% bigger. |
| 4504 |
</p> |
| 4505 |
</dd> |
| 4506 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-environments)</code></dt> |
| 4507 |
<dd><a name="index-debug_002denvironments-1"></a> |
| 4508 |
<a name="index-_002ddebug_002denvironments-1"></a> |
| 4509 |
<p>Select (or deselect) environment debugging information. When this |
| 4510 |
declaration and the ‘<samp>debug</samp>’ declaration are in effect, the |
| 4511 |
debugger will have access to the environments of the continuations. |
| 4512 |
In other words the local variables defined in compiled procedures (and |
| 4513 |
not optimized away by the compiler) will be shown by the ‘<samp>,e</samp>’ |
| 4514 |
REPL command. If any of the command line options |
| 4515 |
‘<samp>-debug-location</samp>’ and ‘<samp>-debug-source</samp>’ are present and |
| 4516 |
‘<samp>-debug-environments</samp>’ is absent, the ‘<samp>debug-environments</samp>’ |
| 4517 |
declaration is initially disabled, otherwise it is initially enabled. |
| 4518 |
When compiling a 3000 line Scheme file it was observed that the total |
| 4519 |
compilation time is 70% longer and the executable code is 40% bigger. |
| 4520 |
</p> |
| 4521 |
</dd> |
| 4522 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> proper-tail-calls)</code></dt> |
| 4523 |
<dd><a name="index-proper_002dtail_002dcalls"></a> |
| 4524 |
<a name="index-proper-tail_002dcalls-1"></a> |
| 4525 |
<a name="index-tail_002dcalls-1"></a> |
| 4526 |
<p>Generate (or don’t generate) proper tail calls. When proper tail |
| 4527 |
calls are turned off, tail calls are handled like non-tail calls, that |
| 4528 |
is a continuation frame will be created for all calls regardless of |
| 4529 |
their kind. This is useful for debugging because the caller of a |
| 4530 |
procedure will be visible in the backtrace produced by the REPL’s |
| 4531 |
‘<samp>,b</samp>’ command even when the call is a tail call. Be advised that |
| 4532 |
this does cause stack space to be consumed for tail calls which may |
| 4533 |
cause the stack to overflow when performing long iterations with tail |
| 4534 |
calls (whether they are expressed with a <code>letrec</code>, named |
| 4535 |
<code>let</code>, <code>do</code>, or other form). |
| 4536 |
</p> |
| 4537 |
</dd> |
| 4538 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> generative-lambda)</code></dt> |
| 4539 |
<dd><a name="index-generative_002dlambda"></a> |
| 4540 |
<a name="index-generative_002dlambda-1"></a> |
| 4541 |
<p>Force (or don’t force) the creation of fresh closures when evaluating |
| 4542 |
lambda-expressions. A fresh closure is always created when a |
| 4543 |
lambda-expression has at least one free variable (that has not been |
| 4544 |
eliminated by dead-code elimination or other compiler optimization) or |
| 4545 |
when the generative-lambda declaration is turned on. When a |
| 4546 |
lambda-expression has no free variables and the generative-lambda |
| 4547 |
declaration is turned off, the value of the lambda-expression may be |
| 4548 |
the same procedure (in the sense of <code>eq?</code>). |
| 4549 |
</p> |
| 4550 |
</dd> |
| 4551 |
<dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> optimize-dead-local-variables)</code></dt> |
| 4552 |
<dd><a name="index-optimize_002ddead_002dlocal_002dvariables"></a> |
| 4553 |
<p>Remove (or preserve) the dead local variables in the environment. |
| 4554 |
Preserving the dead local variables is useful for debugging because |
| 4555 |
continuations will contain the dead variables. Thus, if the code is |
| 4556 |
also compiled with the declaration ‘<samp>debug-environments</samp>’ |
| 4557 |
the ‘<samp>,e</samp>’, ‘<samp>,ed</samp>’, ‘<samp>,be</samp>’, and ‘<samp>,bed</samp>’ REPL |
| 4558 |
commands will display the dead variables. On the other hand, |
| 4559 |
preserving the dead local variables may change the space complexity of |
| 4560 |
the program (i.e. some of the data that would normally be reclaimed by |
| 4561 |
the garbage collector will not be). Note that due to other compiler |
| 4562 |
optimizations some dead local variables may be removed regardless of |
| 4563 |
this declaration. |
| 4564 |
</p> |
| 4565 |
</dd> |
| 4566 |
<dt> <code>(<var>number-type</var> <var>primitive</var>…)</code></dt> |
| 4567 |
<dd><a name="index-generic"></a> |
| 4568 |
<a name="index-fixnum"></a> |
| 4569 |
<a name="index-flonum"></a> |
| 4570 |
<p>Numeric arguments and result of the specified primitives are |
| 4571 |
known to be of the given type (all primitives if none specified). |
| 4572 |
<var>number-type</var> can be: ‘<samp>generic</samp>’, ‘<samp>fixnum</samp>’, or |
| 4573 |
‘<samp>flonum</samp>’. |
| 4574 |
</p> |
| 4575 |
</dd> |
| 4576 |
<dt> <code>(<var>mostly-number-type</var> <var>primitive</var>…)</code></dt> |
| 4577 |
<dd><a name="index-mostly_002dgeneric"></a> |
| 4578 |
<a name="index-mostly_002dfixnum"></a> |
| 4579 |
<a name="index-mostly_002dfixnum_002dflonum"></a> |
| 4580 |
<a name="index-mostly_002dflonum"></a> |
| 4581 |
<a name="index-mostly_002dflonum_002dfixnum"></a> |
| 4582 |
<p>Numeric arguments and result of the specified primitives are expected |
| 4583 |
to be most often of the given type (all primitives if none specified). |
| 4584 |
<var>mostly-number-type</var> can be: ‘<samp>mostly-generic</samp>’, |
| 4585 |
‘<samp>mostly-fixnum</samp>’, ‘<samp>mostly-fixnum-flonum</samp>’, |
| 4586 |
‘<samp>mostly-flonum</samp>’, or ‘<samp>mostly-flonum-fixnum</samp>’. |
| 4587 |
</p> |
| 4588 |
</dd> |
| 4589 |
</dl> |
| 4590 |
|
| 4591 |
<p>The default declarations used by the compiler are equivalent to: |
| 4592 |
</p> |
| 4593 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(declare |
| 4594 |
(gambit-scheme) |
| 4595 |
(separate) |
| 4596 |
(inline) |
| 4597 |
(inline-primitives) |
| 4598 |
(inlining-limit 350) |
| 4599 |
(constant-fold) |
| 4600 |
(lambda-lift) |
| 4601 |
(not standard-bindings) |
| 4602 |
(not extended-bindings) |
| 4603 |
(run-time-bindings) |
| 4604 |
(safe) |
| 4605 |
(interrupts-enabled) |
| 4606 |
(not debug) ;; depends on debugging command line options |
| 4607 |
(debug-location) ;; depends on debugging command line options |
| 4608 |
(debug-source) ;; depends on debugging command line options |
| 4609 |
(debug-environments) ;; depends on debugging command line options |
| 4610 |
(proper-tail-calls) |
| 4611 |
(not generative-lambda) |
| 4612 |
(optimize-dead-local-variables) |
| 4613 |
(generic) |
| 4614 |
(mostly-fixnum-flonum) |
| 4615 |
) |
| 4616 |
</pre></td></tr></table> |
| 4617 |
|
| 4618 |
<p>These declarations are compatible with the semantics of R5RS Scheme |
| 4619 |
and includes a few procedures from R6RS (mainly fixnum specific and |
| 4620 |
flonum specific procedures). Typically used declarations that enhance |
| 4621 |
performance, at the cost of violating the R5RS Scheme semantics, are: |
| 4622 |
<code>(standard-bindings)</code>, <code>(block)</code>, <code>(not safe)</code> and |
| 4623 |
<code>(fixnum)</code>. |
| 4624 |
</p> |
| 4625 |
|
| 4626 |
|
| 4627 |
<a name="Undocumented-extensions"></a><hr size="6"><br/><br/><br/> |
| 4628 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 4629 |
<tr><td valign="middle" align="left"><a href="#Miscellaneous-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 4630 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 4631 |
<td valign="middle" align="left"> </td> |
| 4632 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 4633 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 4634 |
<td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 4635 |
<td valign="middle" align="left"> </td> |
| 4636 |
<td valign="middle" align="left"> </td> |
| 4637 |
<td valign="middle" align="left"> </td> |
| 4638 |
<td valign="middle" align="left"> </td> |
| 4639 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 4640 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 4641 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 4642 |
</tr></table> |
| 4643 |
<a name="Undocumented-extensions-1"></a> |
| 4644 |
<h2 class="section">6.4 Undocumented extensions</h2> |
| 4645 |
|
| 4646 |
<p>The procedures in this section are not yet documented. |
| 4647 |
</p> |
| 4648 |
<a name="Definition_of_continuation?"></a><a name="Procedure_continuation?"></a><a name="index-continuation_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_continuation?">continuation?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4649 |
<a name="Definition_of_continuation-capture"></a><a name="Procedure_continuation-capture"></a><a name="index-continuation_002dcapture"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_continuation-capture">continuation-capture</a></b></code><i> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4650 |
<a name="Definition_of_continuation-graft"></a><a name="Procedure_continuation-graft"></a><a name="index-continuation_002dgraft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_continuation-graft">continuation-graft</a></b></code><i> <var>cont</var> <var>proc</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4651 |
<a name="Definition_of_continuation-return"></a><a name="Procedure_continuation-return"></a><a name="index-continuation_002dreturn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_continuation-return">continuation-return</a></b></code><i> <var>cont</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4652 |
|
| 4653 |
<p>These procedures provide access to internal first-class continuations |
| 4654 |
which are represented using continuation objects distinct from procedures. |
| 4655 |
</p> |
| 4656 |
<p>The procedure <code>continuation?</code> returns <code>#t</code> when <var>obj</var> is |
| 4657 |
a continuation object and <code>#f</code> otherwise. |
| 4658 |
</p> |
| 4659 |
<p>The procedure <code>continuation-capture</code> is similar to the |
| 4660 |
<code>call/cc</code> procedure but it represents the continuation with a |
| 4661 |
continuation object. The <var>proc</var> parameter must be a procedure |
| 4662 |
accepting a single argument. The procedure |
| 4663 |
<code>continuation-capture</code> reifies its continuation and calls |
| 4664 |
<var>proc</var> with the corresponding continuation object as its sole |
| 4665 |
argument. Like for <code>call/cc</code>, the implicit continuation of the |
| 4666 |
call to <var>proc</var> is the implicit continuation of the call to |
| 4667 |
<code>continuation-capture</code>. |
| 4668 |
</p> |
| 4669 |
<p>The procedure <code>continuation-graft</code> performs a procedure call to |
| 4670 |
the procedure <var>proc</var> with arguments <var>obj</var>… and the |
| 4671 |
implicit continuation corresponding to the continuation object |
| 4672 |
<var>cont</var>. The current continuation of the call to procedure |
| 4673 |
<code>continuation-graft</code> is ignored. |
| 4674 |
</p> |
| 4675 |
<p>The procedure <code>continuation-return</code> invokes the implicit |
| 4676 |
continuation corresponding to the continuation object <var>cont</var> with |
| 4677 |
the result(s) <var>obj</var>…. This procedure can be easily |
| 4678 |
defined in terms of <code>continuation-graft</code>: |
| 4679 |
</p> |
| 4680 |
<table><tr><td> </td><td><pre class="smallexample">(define (continuation-return cont . objs) |
| 4681 |
(continuation-graft (lambda () (apply values objs)))) |
| 4682 |
</pre></td></tr></table> |
| 4683 |
|
| 4684 |
<p>For example: |
| 4685 |
</p> |
| 4686 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define x #f)</b> |
| 4687 |
> <b>(define p (make-parameter 11))</b> |
| 4688 |
> <b>(pp (parameterize ((p 22)) |
| 4689 |
(cons 33 (continuation-capture |
| 4690 |
(lambda (c) (set! x c) 44)))))</b> |
| 4691 |
(33 . 44) |
| 4692 |
> <b>x</b> |
| 4693 |
#<continuation #2> |
| 4694 |
> <b>(continuation-return x 55)</b> |
| 4695 |
(33 . 55) |
| 4696 |
> <b>(continuation-graft x (lambda () (expt 2 10)))</b> |
| 4697 |
(33 . 1024) |
| 4698 |
> <b>(continuation-graft x expt 2 10)</b> |
| 4699 |
(33 . 1024) |
| 4700 |
> <b>(continuation-graft x (lambda () (p)))</b> |
| 4701 |
(33 . 22) |
| 4702 |
> <b>(define (map-sqrt1 lst) |
| 4703 |
(call/cc |
| 4704 |
(lambda (k) |
| 4705 |
(map (lambda (x) |
| 4706 |
(if (< x 0) |
| 4707 |
(k 'error) |
| 4708 |
(sqrt x))) |
| 4709 |
lst))))</b> |
| 4710 |
> <b>(map-sqrt1 '(1 4 9))</b> |
| 4711 |
(1 2 3) |
| 4712 |
> <b>(map-sqrt1 '(1 -1 9))</b> |
| 4713 |
error |
| 4714 |
> <b>(define (map-sqrt2 lst) |
| 4715 |
(continuation-capture |
| 4716 |
(lambda (c) |
| 4717 |
(map (lambda (x) |
| 4718 |
(if (< x 0) |
| 4719 |
(continuation-return c 'error) |
| 4720 |
(sqrt x))) |
| 4721 |
lst))))</b> |
| 4722 |
> <b>(map-sqrt2 '(1 4 9))</b> |
| 4723 |
(1 2 3) |
| 4724 |
> <b>(map-sqrt2 '(1 -1 9))</b> |
| 4725 |
error |
| 4726 |
</pre></td></tr></table> |
| 4727 |
|
| 4728 |
|
| 4729 |
|
| 4730 |
<a name="Definition_of_display-exception"></a><a name="Procedure_display-exception"></a><a name="index-display_002dexception"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-exception">display-exception</a></b></code><i> <var>exc</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4731 |
<a name="Definition_of_display-exception-in-context"></a><a name="Procedure_display-exception-in-context"></a><a name="index-display_002dexception_002din_002dcontext"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-exception-in-context">display-exception-in-context</a></b></code><i> <var>exc</var> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4732 |
<a name="Definition_of_display-procedure-environment"></a><a name="Procedure_display-procedure-environment"></a><a name="index-display_002dprocedure_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-procedure-environment">display-procedure-environment</a></b></code><i> <var>proc</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4733 |
<a name="Definition_of_display-continuation-environment"></a><a name="Procedure_display-continuation-environment"></a><a name="index-display_002dcontinuation_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-continuation-environment">display-continuation-environment</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4734 |
<a name="Definition_of_display-continuation-dynamic-environment"></a><a name="Procedure_display-continuation-dynamic-environment"></a><a name="index-display_002dcontinuation_002ddynamic_002denvironment"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-continuation-dynamic-environment">display-continuation-dynamic-environment</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4735 |
|
| 4736 |
|
| 4737 |
<a name="Definition_of_display-continuation-backtrace"></a><a name="Procedure_display-continuation-backtrace"></a><a name="index-display_002dcontinuation_002dbacktrace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_display-continuation-backtrace">display-continuation-backtrace</a></b></code><i> <var>cont</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>all-frames?</var> <span class="roman">[</span><var>display-env?</var> <span class="roman">[</span><var>max-head</var> <span class="roman">[</span><var>max-tail</var> <span class="roman">[</span><var>depth</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4738 |
|
| 4739 |
<p>The procedure <code>display-continuation-backtrace</code> displays the |
| 4740 |
frames of the continuation corresponding to the continuation object |
| 4741 |
<var>cont</var> on the port <var>port</var>. If it is not specified, <var>port</var> |
| 4742 |
defaults to the current output-port. The frames are displayed in the |
| 4743 |
same format as the REPL’s ‘<samp>,b</samp>’ command. |
| 4744 |
</p> |
| 4745 |
<p>The parameter <var>all-frames?</var>, which defaults to <code>#f</code>, controls |
| 4746 |
which frames are displayed. Some frames of ancillary importance, such |
| 4747 |
as internal frames created by the interpreter, are not displayed when |
| 4748 |
<var>all-frames?</var> is <code>#f</code>. Otherwise all frames are displayed. |
| 4749 |
</p> |
| 4750 |
<p>The parameter <var>display-env?</var>, which defaults to <code>#f</code>, controls |
| 4751 |
if the frames are displayed with its environment (the variables |
| 4752 |
accessible and their bindings). |
| 4753 |
</p> |
| 4754 |
<p>The parameters <var>max-head</var> and <var>max-tail</var>, which default to 10 |
| 4755 |
and 4 respectively, control how many frames are displayed at the head |
| 4756 |
and tail of the continuation. |
| 4757 |
</p> |
| 4758 |
<p>The parameter <var>depth</var>, which defaults to 0, causes the frame numbers |
| 4759 |
to be offset by that value. |
| 4760 |
</p> |
| 4761 |
<p>For example: |
| 4762 |
</p> |
| 4763 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define x #f)</b> |
| 4764 |
> <b>(define (fib n) |
| 4765 |
(if (< n 2) |
| 4766 |
(continuation-capture |
| 4767 |
(lambda (c) (set! x c) 1)) |
| 4768 |
(+ (fib (- n 1)) |
| 4769 |
(fib (- n 2)))))</b> |
| 4770 |
> <b>(fib 10)</b> |
| 4771 |
89 |
| 4772 |
> <b>(display-continuation-backtrace x)</b> |
| 4773 |
0 fib (console)@7:12 (fib (- n 2)) |
| 4774 |
1 fib (console)@7:12 (fib (- n 2)) |
| 4775 |
2 fib (console)@7:12 (fib (- n 2)) |
| 4776 |
3 fib (console)@7:12 (fib (- n 2)) |
| 4777 |
4 fib (console)@7:12 (fib (- n 2)) |
| 4778 |
5 (interaction) (console)@8:1 (fib 10) |
| 4779 |
#f |
| 4780 |
> <b>(display-continuation-backtrace x (current-output-port) #t)</b> |
| 4781 |
0 fib (console)@7:12 (fib (- n 2)) |
| 4782 |
1 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ... |
| 4783 |
2 fib (console)@7:12 (fib (- n 2)) |
| 4784 |
3 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ... |
| 4785 |
4 fib (console)@7:12 (fib (- n 2)) |
| 4786 |
5 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ... |
| 4787 |
6 fib (console)@7:12 (fib (- n 2)) |
| 4788 |
7 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ... |
| 4789 |
8 fib (console)@7:12 (fib (- n 2)) |
| 4790 |
9 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ... |
| 4791 |
... |
| 4792 |
13 ##with-no-result-expected-toplevel |
| 4793 |
14 ##repl-debug |
| 4794 |
15 ##repl-debug-main |
| 4795 |
16 ##kernel-handlers |
| 4796 |
#f |
| 4797 |
> <b>(display-continuation-backtrace x (current-output-port) #f #t)</b> |
| 4798 |
0 fib (console)@7:12 (fib (- n 2)) |
| 4799 |
n = 2 |
| 4800 |
1 fib (console)@7:12 (fib (- n 2)) |
| 4801 |
n = 4 |
| 4802 |
2 fib (console)@7:12 (fib (- n 2)) |
| 4803 |
n = 6 |
| 4804 |
3 fib (console)@7:12 (fib (- n 2)) |
| 4805 |
n = 8 |
| 4806 |
4 fib (console)@7:12 (fib (- n 2)) |
| 4807 |
n = 10 |
| 4808 |
5 (interaction) (console)@8:1 (fib 10) |
| 4809 |
#f |
| 4810 |
> <b>(display-continuation-backtrace x (current-output-port) #f #f 2 1 100)</b> |
| 4811 |
100 fib (console)@7:12 (fib (- n 2)) |
| 4812 |
101 fib (console)@7:12 (fib (- n 2)) |
| 4813 |
... |
| 4814 |
105 (interaction) (console)@8:1 (fib 10) |
| 4815 |
#f |
| 4816 |
</pre></td></tr></table> |
| 4817 |
|
| 4818 |
|
| 4819 |
|
| 4820 |
<a name="Definition_of_make-thread-group"></a><a name="Procedure_make-thread-group"></a><a name="index-make_002dthread_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-thread-group">make-thread-group</a></b></code><i> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4821 |
<a name="Definition_of_thread-group?"></a><a name="Procedure_thread-group?"></a><a name="index-thread_002dgroup_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group?">thread-group?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4822 |
<a name="Definition_of_thread-group-name"></a><a name="Procedure_thread-group-name"></a><a name="index-thread_002dgroup_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-name">thread-group-name</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4823 |
<a name="Definition_of_thread-group-parent"></a><a name="Procedure_thread-group-parent"></a><a name="index-thread_002dgroup_002dparent"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-parent">thread-group-parent</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4824 |
<a name="Definition_of_thread-group-resume!"></a><a name="Procedure_thread-group-resume!"></a><a name="index-thread_002dgroup_002dresume_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-resume!">thread-group-resume!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4825 |
<a name="Definition_of_thread-group-suspend!"></a><a name="Procedure_thread-group-suspend!"></a><a name="index-thread_002dgroup_002dsuspend_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-suspend!">thread-group-suspend!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4826 |
<a name="Definition_of_thread-group-terminate!"></a><a name="Procedure_thread-group-terminate!"></a><a name="index-thread_002dgroup_002dterminate_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-terminate!">thread-group-terminate!</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4827 |
<a name="Definition_of_thread-group-%3Ethread-group-list"></a><a name="Procedure_thread-group-%3Ethread-group-list"></a><a name="index-thread_002dgroup_002d_003ethread_002dgroup_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-list">thread-group->thread-group-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4828 |
<a name="Definition_of_thread-group-%3Ethread-group-vector"></a><a name="Procedure_thread-group-%3Ethread-group-vector"></a><a name="index-thread_002dgroup_002d_003ethread_002dgroup_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-vector">thread-group->thread-group-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4829 |
<a name="Definition_of_thread-group-%3Ethread-list"></a><a name="Procedure_thread-group-%3Ethread-list"></a><a name="index-thread_002dgroup_002d_003ethread_002dlist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-list">thread-group->thread-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4830 |
<a name="Definition_of_thread-group-%3Ethread-vector"></a><a name="Procedure_thread-group-%3Ethread-vector"></a><a name="index-thread_002dgroup_002d_003ethread_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-vector">thread-group->thread-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4831 |
|
| 4832 |
|
| 4833 |
<a name="Definition_of_thread-state"></a><a name="Procedure_thread-state"></a><a name="index-thread_002dstate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state">thread-state</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4834 |
<a name="Definition_of_thread-state-uninitialized?"></a><a name="Procedure_thread-state-uninitialized?"></a><a name="index-thread_002dstate_002duninitialized_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-uninitialized?">thread-state-uninitialized?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4835 |
<a name="Definition_of_thread-state-initialized?"></a><a name="Procedure_thread-state-initialized?"></a><a name="index-thread_002dstate_002dinitialized_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-initialized?">thread-state-initialized?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4836 |
<a name="Definition_of_thread-state-active?"></a><a name="Procedure_thread-state-active?"></a><a name="index-thread_002dstate_002dactive_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-active?">thread-state-active?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4837 |
<a name="Definition_of_thread-state-active-waiting-for"></a><a name="Procedure_thread-state-active-waiting-for"></a><a name="index-thread_002dstate_002dactive_002dwaiting_002dfor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-active-waiting-for">thread-state-active-waiting-for</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4838 |
<a name="Definition_of_thread-state-active-timeout"></a><a name="Procedure_thread-state-active-timeout"></a><a name="index-thread_002dstate_002dactive_002dtimeout"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-active-timeout">thread-state-active-timeout</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4839 |
<a name="Definition_of_thread-state-normally-terminated?"></a><a name="Procedure_thread-state-normally-terminated?"></a><a name="index-thread_002dstate_002dnormally_002dterminated_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-normally-terminated?">thread-state-normally-terminated?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4840 |
<a name="Definition_of_thread-state-normally-terminated-result"></a><a name="Procedure_thread-state-normally-terminated-result"></a><a name="index-thread_002dstate_002dnormally_002dterminated_002dresult"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-normally-terminated-result">thread-state-normally-terminated-result</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4841 |
<a name="Definition_of_thread-state-abnormally-terminated?"></a><a name="Procedure_thread-state-abnormally-terminated?"></a><a name="index-thread_002dstate_002dabnormally_002dterminated_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-abnormally-terminated?">thread-state-abnormally-terminated?</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4842 |
<a name="Definition_of_thread-state-abnormally-terminated-reason"></a><a name="Procedure_thread-state-abnormally-terminated-reason"></a><a name="index-thread_002dstate_002dabnormally_002dterminated_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-state-abnormally-terminated-reason">thread-state-abnormally-terminated-reason</a></b></code><i> <var>thread-state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4843 |
<a name="Definition_of_top"></a><a name="Procedure_top"></a><a name="index-top"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_top">top</a></b></code><i> <span class="roman">[</span><var>thread-group</var> <span class="roman">[</span><var>port</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4844 |
|
| 4845 |
|
| 4846 |
<a name="Definition_of_thread-interrupt!"></a><a name="Procedure_thread-interrupt!"></a><a name="index-thread_002dinterrupt_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-interrupt!">thread-interrupt!</a></b></code><i> <var>thread</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4847 |
|
| 4848 |
|
| 4849 |
<a name="Definition_of_thread-suspend!"></a><a name="Procedure_thread-suspend!"></a><a name="index-thread_002dsuspend_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-suspend!">thread-suspend!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4850 |
<a name="Definition_of_thread-resume!"></a><a name="Procedure_thread-resume!"></a><a name="index-thread_002dresume_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-resume!">thread-resume!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4851 |
|
| 4852 |
|
| 4853 |
<a name="Definition_of_thread-thread-group"></a><a name="Procedure_thread-thread-group"></a><a name="index-thread_002dthread_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-thread-group">thread-thread-group</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4854 |
|
| 4855 |
|
| 4856 |
<a name="Definition_of_define-type-of-thread"></a><a name="Special_form_define-type-of-thread"></a><a name="index-define_002dtype_002dof_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-type-of-thread">define-type-of-thread</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>field</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4857 |
|
| 4858 |
|
| 4859 |
<a name="Definition_of_thread-init!"></a><a name="Procedure_thread-init!"></a><a name="index-thread_002dinit_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-init!">thread-init!</a></b></code><i> <var>thread</var> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4860 |
|
| 4861 |
|
| 4862 |
<a name="Definition_of_initialized-thread-exception?"></a><a name="Procedure_initialized-thread-exception?"></a><a name="index-initialized_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception?">initialized-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4863 |
<a name="Definition_of_initialized-thread-exception-procedure"></a><a name="Procedure_initialized-thread-exception-procedure"></a><a name="index-initialized_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception-procedure">initialized-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4864 |
<a name="Definition_of_initialized-thread-exception-arguments"></a><a name="Procedure_initialized-thread-exception-arguments"></a><a name="index-initialized_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_initialized-thread-exception-arguments">initialized-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4865 |
|
| 4866 |
|
| 4867 |
<a name="Definition_of_uninitialized-thread-exception?"></a><a name="Procedure_uninitialized-thread-exception?"></a><a name="index-uninitialized_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception?">uninitialized-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4868 |
<a name="Definition_of_uninitialized-thread-exception-procedure"></a><a name="Procedure_uninitialized-thread-exception-procedure"></a><a name="index-uninitialized_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception-procedure">uninitialized-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4869 |
<a name="Definition_of_uninitialized-thread-exception-arguments"></a><a name="Procedure_uninitialized-thread-exception-arguments"></a><a name="index-uninitialized_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uninitialized-thread-exception-arguments">uninitialized-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4870 |
|
| 4871 |
|
| 4872 |
<a name="Definition_of_inactive-thread-exception?"></a><a name="Procedure_inactive-thread-exception?"></a><a name="index-inactive_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception?">inactive-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4873 |
<a name="Definition_of_inactive-thread-exception-procedure"></a><a name="Procedure_inactive-thread-exception-procedure"></a><a name="index-inactive_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception-procedure">inactive-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4874 |
<a name="Definition_of_inactive-thread-exception-arguments"></a><a name="Procedure_inactive-thread-exception-arguments"></a><a name="index-inactive_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_inactive-thread-exception-arguments">inactive-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4875 |
|
| 4876 |
|
| 4877 |
<a name="Definition_of_rpc-remote-error-exception?"></a><a name="Procedure_rpc-remote-error-exception?"></a><a name="index-rpc_002dremote_002derror_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception?">rpc-remote-error-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4878 |
<a name="Definition_of_rpc-remote-error-exception-procedure"></a><a name="Procedure_rpc-remote-error-exception-procedure"></a><a name="index-rpc_002dremote_002derror_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-procedure">rpc-remote-error-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4879 |
<a name="Definition_of_rpc-remote-error-exception-arguments"></a><a name="Procedure_rpc-remote-error-exception-arguments"></a><a name="index-rpc_002dremote_002derror_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-arguments">rpc-remote-error-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4880 |
<a name="Definition_of_rpc-remote-error-exception-message"></a><a name="Procedure_rpc-remote-error-exception-message"></a><a name="index-rpc_002dremote_002derror_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_rpc-remote-error-exception-message">rpc-remote-error-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4881 |
|
| 4882 |
|
| 4883 |
<a name="Definition_of_timeout-%3Etime"></a><a name="Procedure_timeout-%3Etime"></a><a name="index-timeout_002d_003etime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_timeout-%3Etime">timeout->time</a></b></code><i> <var>timeout</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4884 |
|
| 4885 |
|
| 4886 |
<a name="Definition_of_open-dummy"></a><a name="Procedure_open-dummy"></a><a name="index-open_002ddummy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-dummy">open-dummy</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4887 |
|
| 4888 |
|
| 4889 |
<a name="Definition_of_port-settings-set!"></a><a name="Procedure_port-settings-set!"></a><a name="index-port_002dsettings_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_port-settings-set!">port-settings-set!</a></b></code><i> <var>port</var> <var>settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4890 |
|
| 4891 |
|
| 4892 |
<a name="Definition_of_port-io-exception-handler-set!"></a><a name="Procedure_port-io-exception-handler-set!"></a><a name="index-port_002dio_002dexception_002dhandler_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_port-io-exception-handler-set!">port-io-exception-handler-set!</a></b></code><i> <var>port</var> <var>handler</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4893 |
|
| 4894 |
|
| 4895 |
<a name="Definition_of_input-port-bytes-buffered"></a><a name="Procedure_input-port-bytes-buffered"></a><a name="index-input_002dport_002dbytes_002dbuffered"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-bytes-buffered">input-port-bytes-buffered</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4896 |
|
| 4897 |
|
| 4898 |
<a name="Definition_of_input-port-characters-buffered"></a><a name="Procedure_input-port-characters-buffered"></a><a name="index-input_002dport_002dcharacters_002dbuffered"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-characters-buffered">input-port-characters-buffered</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4899 |
|
| 4900 |
|
| 4901 |
<a name="Definition_of_nonempty-input-port-character-buffer-exception?"></a><a name="Procedure_nonempty-input-port-character-buffer-exception?"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception?">nonempty-input-port-character-buffer-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4902 |
<a name="Definition_of_nonempty-input-port-character-buffer-exception-arguments"></a><a name="Procedure_nonempty-input-port-character-buffer-exception-arguments"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception-arguments">nonempty-input-port-character-buffer-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4903 |
<a name="Definition_of_nonempty-input-port-character-buffer-exception-procedure"></a><a name="Procedure_nonempty-input-port-character-buffer-exception-procedure"></a><a name="index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonempty-input-port-character-buffer-exception-procedure">nonempty-input-port-character-buffer-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4904 |
|
| 4905 |
|
| 4906 |
<a name="Definition_of_repl-input-port"></a><a name="Procedure_repl-input-port"></a><a name="index-repl_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_repl-input-port">repl-input-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4907 |
<a name="Definition_of_repl-output-port"></a><a name="Procedure_repl-output-port"></a><a name="index-repl_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_repl-output-port">repl-output-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4908 |
<a name="Definition_of_console-port"></a><a name="Procedure_console-port"></a><a name="index-console_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_console-port">console-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4909 |
|
| 4910 |
|
| 4911 |
<a name="Definition_of_current-user-interrupt-handler"></a><a name="Procedure_current-user-interrupt-handler"></a><a name="index-current_002duser_002dinterrupt_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-user-interrupt-handler">current-user-interrupt-handler</a></b></code><i> <span class="roman">[</span><var>handler</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4912 |
<a name="Definition_of_defer-user-interrupts"></a><a name="Procedure_defer-user-interrupts"></a><a name="index-defer_002duser_002dinterrupts"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_defer-user-interrupts">defer-user-interrupts</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4913 |
|
| 4914 |
|
| 4915 |
<a name="Definition_of_primordial-exception-handler"></a><a name="Procedure_primordial-exception-handler"></a><a name="index-primordial_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_primordial-exception-handler">primordial-exception-handler</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4916 |
|
| 4917 |
|
| 4918 |
<a name="Definition_of_err-code-%3Estring"></a><a name="Procedure_err-code-%3Estring"></a><a name="index-err_002dcode_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_err-code-%3Estring">err-code->string</a></b></code><i> <var>code</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4919 |
|
| 4920 |
|
| 4921 |
<a name="Definition_of_foreign?"></a><a name="Procedure_foreign?"></a><a name="index-foreign_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_foreign?">foreign?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4922 |
<a name="Definition_of_foreign-tags"></a><a name="Procedure_foreign-tags"></a><a name="index-foreign_002dtags"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_foreign-tags">foreign-tags</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4923 |
<a name="Definition_of_foreign-address"></a><a name="Procedure_foreign-address"></a><a name="index-foreign_002daddress"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_foreign-address">foreign-address</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4924 |
<a name="Definition_of_foreign-release!"></a><a name="Procedure_foreign-release!"></a><a name="index-foreign_002drelease_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_foreign-release!">foreign-release!</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4925 |
<a name="Definition_of_foreign-released?"></a><a name="Procedure_foreign-released?"></a><a name="index-foreign_002dreleased_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_foreign-released?">foreign-released?</a></b></code><i> <var>foreign</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4926 |
|
| 4927 |
|
| 4928 |
<a name="Definition_of_invalid-hash-number-exception?"></a><a name="Procedure_invalid-hash-number-exception?"></a><a name="index-invalid_002dhash_002dnumber_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception?">invalid-hash-number-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4929 |
<a name="Definition_of_invalid-hash-number-exception-procedure"></a><a name="Procedure_invalid-hash-number-exception-procedure"></a><a name="index-invalid_002dhash_002dnumber_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception-procedure">invalid-hash-number-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4930 |
<a name="Definition_of_invalid-hash-number-exception-arguments"></a><a name="Procedure_invalid-hash-number-exception-arguments"></a><a name="index-invalid_002dhash_002dnumber_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_invalid-hash-number-exception-arguments">invalid-hash-number-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4931 |
|
| 4932 |
|
| 4933 |
<a name="Definition_of_tcp-client-peer-socket-info"></a><a name="Procedure_tcp-client-peer-socket-info"></a><a name="index-tcp_002dclient_002dpeer_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tcp-client-peer-socket-info">tcp-client-peer-socket-info</a></b></code><i> <var>tcp-client-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4934 |
<a name="Definition_of_tcp-client-self-socket-info"></a><a name="Procedure_tcp-client-self-socket-info"></a><a name="index-tcp_002dclient_002dself_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tcp-client-self-socket-info">tcp-client-self-socket-info</a></b></code><i> <var>tcp-client-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4935 |
|
| 4936 |
|
| 4937 |
<a name="Definition_of_tcp-server-socket-info"></a><a name="Procedure_tcp-server-socket-info"></a><a name="index-tcp_002dserver_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tcp-server-socket-info">tcp-server-socket-info</a></b></code><i> <var>tcp-server-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4938 |
|
| 4939 |
|
| 4940 |
<a name="Definition_of_socket-info?"></a><a name="Procedure_socket-info?"></a><a name="index-socket_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_socket-info?">socket-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4941 |
<a name="Definition_of_socket-info-address"></a><a name="Procedure_socket-info-address"></a><a name="index-socket_002dinfo_002daddress"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_socket-info-address">socket-info-address</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4942 |
<a name="Definition_of_socket-info-family"></a><a name="Procedure_socket-info-family"></a><a name="index-socket_002dinfo_002dfamily"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_socket-info-family">socket-info-family</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4943 |
<a name="Definition_of_socket-info-port-number"></a><a name="Procedure_socket-info-port-number"></a><a name="index-socket_002dinfo_002dport_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_socket-info-port-number">socket-info-port-number</a></b></code><i> <var>socket-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4944 |
|
| 4945 |
|
| 4946 |
<a name="Definition_of_system-version"></a><a name="Procedure_system-version"></a><a name="index-system_002dversion"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_system-version">system-version</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4947 |
<a name="Definition_of_system-version-string"></a><a name="Procedure_system-version-string"></a><a name="index-system_002dversion_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_system-version-string">system-version-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4948 |
|
| 4949 |
|
| 4950 |
<a name="Definition_of_system-type"></a><a name="Procedure_system-type"></a><a name="index-system_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_system-type">system-type</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4951 |
<a name="Definition_of_system-type-string"></a><a name="Procedure_system-type-string"></a><a name="index-system_002dtype_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_system-type-string">system-type-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4952 |
<a name="Definition_of_configure-command-string"></a><a name="Procedure_configure-command-string"></a><a name="index-configure_002dcommand_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_configure-command-string">configure-command-string</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4953 |
|
| 4954 |
|
| 4955 |
<a name="Definition_of_system-stamp"></a><a name="Procedure_system-stamp"></a><a name="index-system_002dstamp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_system-stamp">system-stamp</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4956 |
|
| 4957 |
|
| 4958 |
<a name="Definition_of_future"></a><a name="Special_form_future"></a><a name="index-future"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_future">future</a></b></code><i> <var>expr</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4959 |
<a name="Definition_of_touch"></a><a name="Procedure_touch"></a><a name="index-touch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_touch">touch</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4960 |
|
| 4961 |
|
| 4962 |
<a name="Definition_of_tty?"></a><a name="Procedure_tty?"></a><a name="index-tty_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty?">tty?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4963 |
<a name="Definition_of_tty-history"></a><a name="Procedure_tty-history"></a><a name="index-tty_002dhistory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-history">tty-history</a></b></code><i> <var>tty</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4964 |
<a name="Definition_of_tty-history-set!"></a><a name="Procedure_tty-history-set!"></a><a name="index-tty_002dhistory_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-history-set!">tty-history-set!</a></b></code><i> <var>tty</var> <var>history</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4965 |
<a name="Definition_of_tty-history-max-length-set!"></a><a name="Procedure_tty-history-max-length-set!"></a><a name="index-tty_002dhistory_002dmax_002dlength_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-history-max-length-set!">tty-history-max-length-set!</a></b></code><i> <var>tty</var> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4966 |
<a name="Definition_of_tty-paren-balance-duration-set!"></a><a name="Procedure_tty-paren-balance-duration-set!"></a><a name="index-tty_002dparen_002dbalance_002dduration_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-paren-balance-duration-set!">tty-paren-balance-duration-set!</a></b></code><i> <var>tty</var> <var>duration</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4967 |
<a name="Definition_of_tty-text-attributes-set!"></a><a name="Procedure_tty-text-attributes-set!"></a><a name="index-tty_002dtext_002dattributes_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-text-attributes-set!">tty-text-attributes-set!</a></b></code><i> <var>tty</var> <var>attributes</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4968 |
<a name="Definition_of_tty-mode-set!"></a><a name="Procedure_tty-mode-set!"></a><a name="index-tty_002dmode_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-mode-set!">tty-mode-set!</a></b></code><i> <var>tty</var> <var>mode</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4969 |
<a name="Definition_of_tty-type-set!"></a><a name="Procedure_tty-type-set!"></a><a name="index-tty_002dtype_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tty-type-set!">tty-type-set!</a></b></code><i> <var>tty</var> <var>type</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4970 |
|
| 4971 |
|
| 4972 |
<a name="Definition_of_with-input-from-port"></a><a name="Procedure_with-input-from-port"></a><a name="index-with_002dinput_002dfrom_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-port">with-input-from-port</a></b></code><i> <var>port</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4973 |
<a name="Definition_of_with-output-to-port"></a><a name="Procedure_with-output-to-port"></a><a name="index-with_002doutput_002dto_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-port">with-output-to-port</a></b></code><i> <var>port</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4974 |
|
| 4975 |
|
| 4976 |
<a name="Definition_of_input-port-char-position"></a><a name="Procedure_input-port-char-position"></a><a name="index-input_002dport_002dchar_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-char-position">input-port-char-position</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4977 |
<a name="Definition_of_output-port-char-position"></a><a name="Procedure_output-port-char-position"></a><a name="index-output_002dport_002dchar_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-char-position">output-port-char-position</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4978 |
|
| 4979 |
|
| 4980 |
<a name="Definition_of_open-event-queue"></a><a name="Procedure_open-event-queue"></a><a name="index-open_002devent_002dqueue"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-event-queue">open-event-queue</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4981 |
|
| 4982 |
|
| 4983 |
<a name="Definition_of_main"></a><a name="Procedure_main"></a><a name="index-main"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_main">main</a></b></code><i> …</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 4984 |
|
| 4985 |
|
| 4986 |
<a name="Definition_of_define-record-type"></a><a name="Special_form_define-record-type"></a><a name="index-define_002drecord_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-record-type">define-record-type</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4987 |
<a name="Definition_of_define-type"></a><a name="Special_form_define-type"></a><a name="index-define_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-type">define-type</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4988 |
|
| 4989 |
|
| 4990 |
<a name="Definition_of_namespace"></a><a name="Special_form_namespace"></a><a name="index-namespace"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_namespace">namespace</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4991 |
|
| 4992 |
|
| 4993 |
<a name="Definition_of_this-source-file"></a><a name="Special_form_this-source-file"></a><a name="index-this_002dsource_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_this-source-file">this-source-file</a></b></code><code>)</code></td><td align="right">special form</td></tr></table> |
| 4994 |
|
| 4995 |
|
| 4996 |
<a name="Definition_of_receive"></a><a name="Special_form_receive"></a><a name="index-receive"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_receive">receive</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 4997 |
|
| 4998 |
|
| 4999 |
<a name="Definition_of_cond-expand"></a><a name="Special_form_cond-expand"></a><a name="index-cond_002dexpand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_cond-expand">cond-expand</a></b></code><i> …</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5000 |
|
| 5001 |
|
| 5002 |
<a name="Definition_of_define-cond-expand-feature"></a><a name="Special_form_define-cond-expand-feature"></a><a name="index-define_002dcond_002dexpand_002dfeature"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-cond-expand-feature">define-cond-expand-feature</a></b></code><i> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5003 |
|
| 5004 |
|
| 5005 |
<a name="Definition_of_finite?"></a><a name="Procedure_finite?"></a><a name="index-finite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_finite?">finite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5006 |
<a name="Definition_of_infinite?"></a><a name="Procedure_infinite?"></a><a name="index-infinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_infinite?">infinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5007 |
<a name="Definition_of_nan?"></a><a name="Procedure_nan?"></a><a name="index-nan_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nan?">nan?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5008 |
|
| 5009 |
|
| 5010 |
<a name="Definition_of_six.!"></a><a name="Undefined_six.!"></a><a name="index-six_002e_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.!">six.!</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5011 |
<a name="Definition_of_six.!x"></a><a name="Special_form_six.!x"></a><a name="index-six_002e_0021x"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.!x">six.!x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5012 |
<a name="Definition_of_six.&x"></a><a name="Special_form_six.&x"></a><a name="index-six_002e_0026x"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.&x">six.&x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5013 |
<a name="Definition_of_six.%2Ax"></a><a name="Special_form_six.%2Ax"></a><a name="index-six_002e_002ax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.%2Ax">six.*x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5014 |
<a name="Definition_of_six.%2B%2Bx"></a><a name="Special_form_six.%2B%2Bx"></a><a name="index-six_002e_002b_002bx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.%2B%2Bx">six.++x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5015 |
<a name="Definition_of_six.%2Bx"></a><a name="Special_form_six.%2Bx"></a><a name="index-six_002e_002bx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.%2Bx">six.+x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5016 |
<a name="Definition_of_six.--x"></a><a name="Special_form_six.--x"></a><a name="index-six_002e_002d_002dx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.--x">six.--x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5017 |
<a name="Definition_of_six.-x"></a><a name="Special_form_six.-x"></a><a name="index-six_002e_002dx"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.-x">six.-x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5018 |
<a name="Definition_of_six.arrow"></a><a name="Special_form_six.arrow"></a><a name="index-six_002earrow"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.arrow">six.arrow</a></b></code><i> <var>expr</var> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5019 |
<a name="Definition_of_six.break"></a><a name="Undefined_six.break"></a><a name="index-six_002ebreak"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.break">six.break</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5020 |
<a name="Definition_of_six.call"></a><a name="Special_form_six.call"></a><a name="index-six_002ecall"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.call">six.call</a></b></code><i> <var>func</var> <var>arg</var>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5021 |
<a name="Definition_of_six.case"></a><a name="Undefined_six.case"></a><a name="index-six_002ecase"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.case">six.case</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5022 |
<a name="Definition_of_six.clause"></a><a name="Undefined_six.clause"></a><a name="index-six_002eclause"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.clause">six.clause</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5023 |
<a name="Definition_of_six.compound"></a><a name="Special_form_six.compound"></a><a name="index-six_002ecompound"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.compound">six.compound</a></b></code><i> <var>statement</var>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5024 |
<a name="Definition_of_six.cons"></a><a name="Special_form_six.cons"></a><a name="index-six_002econs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.cons">six.cons</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5025 |
<a name="Definition_of_six.continue"></a><a name="Undefined_six.continue"></a><a name="index-six_002econtinue"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.continue">six.continue</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5026 |
<a name="Definition_of_six.define-procedure"></a><a name="Special_form_six.define-procedure"></a><a name="index-six_002edefine_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.define-procedure">six.define-procedure</a></b></code><i> <var>ident</var> <var>proc</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5027 |
<a name="Definition_of_six.define-variable"></a><a name="Special_form_six.define-variable"></a><a name="index-six_002edefine_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.define-variable">six.define-variable</a></b></code><i> <var>ident</var> <var>type</var> <var>dims</var> <var>init</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5028 |
<a name="Definition_of_six.do-while"></a><a name="Special_form_six.do-while"></a><a name="index-six_002edo_002dwhile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.do-while">six.do-while</a></b></code><i> <var>stat</var> <var>expr</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5029 |
<a name="Definition_of_six.dot"></a><a name="Special_form_six.dot"></a><a name="index-six_002edot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.dot">six.dot</a></b></code><i> <var>expr</var> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5030 |
<a name="Definition_of_six.for"></a><a name="Special_form_six.for"></a><a name="index-six_002efor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.for">six.for</a></b></code><i> <var>stat1</var> <var>expr2</var> <var>expr3</var> <var>stat2</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5031 |
<a name="Definition_of_six.goto"></a><a name="Undefined_six.goto"></a><a name="index-six_002egoto"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.goto">six.goto</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5032 |
<a name="Definition_of_six.identifier"></a><a name="Special_form_six.identifier"></a><a name="index-six_002eidentifier"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.identifier">six.identifier</a></b></code><i> <var>ident</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5033 |
<a name="Definition_of_six.if"></a><a name="Special_form_six.if"></a><a name="index-six_002eif"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.if">six.if</a></b></code><i> <var>expr</var> <var>stat1</var> <span class="roman">[</span><var>stat2</var><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5034 |
<a name="Definition_of_six.index"></a><a name="Special_form_six.index"></a><a name="index-six_002eindex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.index">six.index</a></b></code><i> <var>expr1</var> <var>expr2</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5035 |
<a name="Definition_of_six.label"></a><a name="Undefined_six.label"></a><a name="index-six_002elabel"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.label">six.label</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5036 |
<a name="Definition_of_six.list"></a><a name="Special_form_six.list"></a><a name="index-six_002elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.list">six.list</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5037 |
<a name="Definition_of_six.literal"></a><a name="Special_form_six.literal"></a><a name="index-six_002eliteral"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.literal">six.literal</a></b></code><i> <var>value</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5038 |
<a name="Definition_of_six.make-array"></a><a name="Procedure_six.make-array"></a><a name="index-six_002emake_002darray"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_six.make-array">six.make-array</a></b></code><i> <var>init</var> <var>dim</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5039 |
<a name="Definition_of_six.new"></a><a name="Special_form_six.new"></a><a name="index-six_002enew"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.new">six.new</a></b></code><i> <var>ident</var> <var>arg</var>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5040 |
<a name="Definition_of_six.null"></a><a name="Special_form_six.null"></a><a name="index-six_002enull"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.null">six.null</a></b></code><code>)</code></td><td align="right">special form</td></tr></table> |
| 5041 |
<a name="Definition_of_six.prefix"></a><a name="Special_form_six.prefix"></a><a name="index-six_002eprefix"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.prefix">six.prefix</a></b></code><i> <var>datum</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5042 |
<a name="Definition_of_six.procedure"></a><a name="Special_form_six.procedure"></a><a name="index-six_002eprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.procedure">six.procedure</a></b></code><i> <var>type</var> <var>params</var> <var>stat</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5043 |
<a name="Definition_of_six.procedure-body"></a><a name="Special_form_six.procedure-body"></a><a name="index-six_002eprocedure_002dbody"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.procedure-body">six.procedure-body</a></b></code><i> <var>stat</var>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5044 |
<a name="Definition_of_six.return"></a><a name="Undefined_six.return"></a><a name="index-six_002ereturn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.return">six.return</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5045 |
<a name="Definition_of_six.switch"></a><a name="Undefined_six.switch"></a><a name="index-six_002eswitch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.switch">six.switch</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5046 |
<a name="Definition_of_six.while"></a><a name="Special_form_six.while"></a><a name="index-six_002ewhile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.while">six.while</a></b></code><i> <var>expr</var> <var>stat</var>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5047 |
<a name="Definition_of_six.x!=y"></a><a name="Special_form_six.x!=y"></a><a name="index-six_002ex_0021_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x!=y">six.x!=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5048 |
<a name="Definition_of_six.x%25=y"></a><a name="Special_form_six.x%25=y"></a><a name="index-six_002ex_0025_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%25=y">six.x%=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5049 |
<a name="Definition_of_six.x%25y"></a><a name="Special_form_six.x%25y"></a><a name="index-six_002ex_0025y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%25y">six.x%y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5050 |
<a name="Definition_of_six.x&&y"></a><a name="Special_form_six.x&&y"></a><a name="index-six_002ex_0026_0026y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x&&y">six.x&&y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5051 |
<a name="Definition_of_six.x&=y"></a><a name="Special_form_six.x&=y"></a><a name="index-six_002ex_0026_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x&=y">six.x&=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5052 |
<a name="Definition_of_six.x&y"></a><a name="Special_form_six.x&y"></a><a name="index-six_002ex_0026y"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x&y">six.x&y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5053 |
<a name="Definition_of_six.x%2A=y"></a><a name="Special_form_six.x%2A=y"></a><a name="index-six_002ex_002a_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%2A=y">six.x*=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5054 |
<a name="Definition_of_six.x%2Ay"></a><a name="Special_form_six.x%2Ay"></a><a name="index-six_002ex_002ay"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%2Ay">six.x*y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5055 |
<a name="Definition_of_six.x%2B%2B"></a><a name="Special_form_six.x%2B%2B"></a><a name="index-six_002ex_002b_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%2B%2B">six.x++</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5056 |
<a name="Definition_of_six.x%2B=y"></a><a name="Special_form_six.x%2B=y"></a><a name="index-six_002ex_002b_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%2B=y">six.x+=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5057 |
<a name="Definition_of_six.x%2By"></a><a name="Special_form_six.x%2By"></a><a name="index-six_002ex_002by"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%2By">six.x+y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5058 |
<a name="Definition_of_|six.x"></a><a name="Special_form_|six.x"></a><a name="index-_007csix_002ex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_|six.x">|six.x</a></b></code><i>,y| <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5059 |
<a name="Definition_of_six.x--"></a><a name="Special_form_six.x--"></a><a name="index-six_002ex_002d_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x--">six.x--</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5060 |
<a name="Definition_of_six.x-=y"></a><a name="Special_form_six.x-=y"></a><a name="index-six_002ex_002d_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x-=y">six.x-=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5061 |
<a name="Definition_of_six.x-y"></a><a name="Special_form_six.x-y"></a><a name="index-six_002ex_002dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x-y">six.x-y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5062 |
<a name="Definition_of_six.x/=y"></a><a name="Special_form_six.x/=y"></a><a name="index-six_002ex_002f_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x/=y">six.x/=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5063 |
<a name="Definition_of_six.x/y"></a><a name="Special_form_six.x/y"></a><a name="index-six_002ex_002fy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x/y">six.x/y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5064 |
<a name="Definition_of_six.x:-y"></a><a name="Undefined_six.x:-y"></a><a name="index-six_002ex_003a_002dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Undefined_six.x:-y">six.x:-y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">undefined</td></tr></table> |
| 5065 |
<a name="Definition_of_six.x:=y"></a><a name="Special_form_six.x:=y"></a><a name="index-six_002ex_003a_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x:=y">six.x:=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5066 |
<a name="Definition_of_six.x:y"></a><a name="Special_form_six.x:y"></a><a name="index-six_002ex_003ay"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x:y">six.x:y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5067 |
<a name="Definition_of_six.x%3C%3C=y"></a><a name="Special_form_six.x%3C%3C=y"></a><a name="index-six_002ex_003c_003c_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3C%3C=y">six.x<<=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5068 |
<a name="Definition_of_six.x%3C%3Cy"></a><a name="Special_form_six.x%3C%3Cy"></a><a name="index-six_002ex_003c_003cy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3C%3Cy">six.x<<y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5069 |
<a name="Definition_of_six.x%3C=y"></a><a name="Special_form_six.x%3C=y"></a><a name="index-six_002ex_003c_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3C=y">six.x<=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5070 |
<a name="Definition_of_six.x%3Cy"></a><a name="Special_form_six.x%3Cy"></a><a name="index-six_002ex_003cy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3Cy">six.x<y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5071 |
<a name="Definition_of_six.x==y"></a><a name="Special_form_six.x==y"></a><a name="index-six_002ex_003d_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x==y">six.x==y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5072 |
<a name="Definition_of_six.x=y"></a><a name="Special_form_six.x=y"></a><a name="index-six_002ex_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x=y">six.x=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5073 |
<a name="Definition_of_six.x%3E=y"></a><a name="Special_form_six.x%3E=y"></a><a name="index-six_002ex_003e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3E=y">six.x>=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5074 |
<a name="Definition_of_six.x%3E%3E=y"></a><a name="Special_form_six.x%3E%3E=y"></a><a name="index-six_002ex_003e_003e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3E%3E=y">six.x>>=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5075 |
<a name="Definition_of_six.x%3E%3Ey"></a><a name="Special_form_six.x%3E%3Ey"></a><a name="index-six_002ex_003e_003ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3E%3Ey">six.x>>y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5076 |
<a name="Definition_of_six.x%3Ey"></a><a name="Special_form_six.x%3Ey"></a><a name="index-six_002ex_003ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x%3Ey">six.x>y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5077 |
<a name="Definition_of_six.x?y:z"></a><a name="Special_form_six.x?y:z"></a><a name="index-six_002ex_003fy_003az"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x?y:z">six.x?y:z</a></b></code><i> <var>x</var> <var>y</var> <var>z</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5078 |
<a name="Definition_of_six.x^=y"></a><a name="Special_form_six.x^=y"></a><a name="index-six_002ex_005e_003dy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x^=y">six.x^=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5079 |
<a name="Definition_of_six.x^y"></a><a name="Special_form_six.x^y"></a><a name="index-six_002ex_005ey"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.x^y">six.x^y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5080 |
<a name="Definition_of_|six.x\|=y|"></a><a name="Special_form_|six.x\|=y|"></a><a name="index-_007csix_002ex_005c_007c_003dy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_|six.x\|=y|">|six.x\|=y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5081 |
<a name="Definition_of_|six.x\|y|"></a><a name="Special_form_|six.x\|y|"></a><a name="index-_007csix_002ex_005c_007cy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_|six.x\|y|">|six.x\|y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5082 |
<a name="Definition_of_|six.x\|\|y|"></a><a name="Special_form_|six.x\|\|y|"></a><a name="index-_007csix_002ex_005c_007c_005c_007cy_007c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_|six.x\|\|y|">|six.x\|\|y|</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5083 |
<a name="Definition_of_six.~x"></a><a name="Special_form_six.~x"></a><a name="index-six_002e_007ex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_six.~x">six.~x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 5084 |
|
| 5085 |
|
| 5086 |
<a name="Namespaces"></a><hr size="6"><br/><br/><br/> |
| 5087 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5088 |
<tr><td valign="middle" align="left"><a href="#Undocumented-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5089 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5090 |
<td valign="middle" align="left"> </td> |
| 5091 |
<td valign="middle" align="left"><a href="#Scheme-extensions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5092 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5093 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5094 |
<td valign="middle" align="left"> </td> |
| 5095 |
<td valign="middle" align="left"> </td> |
| 5096 |
<td valign="middle" align="left"> </td> |
| 5097 |
<td valign="middle" align="left"> </td> |
| 5098 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5099 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5100 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5101 |
</tr></table> |
| 5102 |
<a name="Namespaces-1"></a> |
| 5103 |
<h1 class="chapter">7. Namespaces</h1> |
| 5104 |
|
| 5105 |
<p>TO DO! |
| 5106 |
</p> |
| 5107 |
<a name="Characters-and-strings"></a><hr size="6"><br/><br/><br/> |
| 5108 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5109 |
<tr><td valign="middle" align="left"><a href="#Namespaces" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5110 |
<td valign="middle" align="left"><a href="#Extensions-to-character-procedures" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5111 |
<td valign="middle" align="left"> </td> |
| 5112 |
<td valign="middle" align="left"><a href="#Namespaces" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5113 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5114 |
<td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5115 |
<td valign="middle" align="left"> </td> |
| 5116 |
<td valign="middle" align="left"> </td> |
| 5117 |
<td valign="middle" align="left"> </td> |
| 5118 |
<td valign="middle" align="left"> </td> |
| 5119 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5120 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5121 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5122 |
</tr></table> |
| 5123 |
<a name="Characters-and-strings-1"></a> |
| 5124 |
<h1 class="chapter">8. Characters and strings</h1> |
| 5125 |
|
| 5126 |
<p>Gambit supports the Unicode character encoding standard. Scheme |
| 5127 |
characters can be any of the characters whose Unicode encoding is in |
| 5128 |
the range 0 to #x10ffff (inclusive) but not in the range #xd800 to |
| 5129 |
#xdfff. Source code can also contain any Unicode character, however |
| 5130 |
to read such source code properly <code>gsi</code> and <code>gsc</code> must be |
| 5131 |
told which character encoding to use for reading the source code |
| 5132 |
(i.e. ASCII, ISO-8859-1, UTF-8, etc). This can be done by specifying |
| 5133 |
the runtime option ‘<samp>-:f</samp>’ when <code>gsi</code> and <code>gsc</code> are |
| 5134 |
started. |
| 5135 |
</p> |
| 5136 |
<table class="menu" border="0" cellspacing="0"> |
| 5137 |
<tr><td align="left" valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5138 |
<tr><td align="left" valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5139 |
</table> |
| 5140 |
|
| 5141 |
<a name="Extensions-to-character-procedures"></a><hr size="6"><br/><br/><br/> |
| 5142 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5143 |
<tr><td valign="middle" align="left"><a href="#Characters-and-strings" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5144 |
<td valign="middle" align="left"><a href="#Extensions-to-string-procedures" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5145 |
<td valign="middle" align="left"> </td> |
| 5146 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5147 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5148 |
<td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5149 |
<td valign="middle" align="left"> </td> |
| 5150 |
<td valign="middle" align="left"> </td> |
| 5151 |
<td valign="middle" align="left"> </td> |
| 5152 |
<td valign="middle" align="left"> </td> |
| 5153 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5154 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5155 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5156 |
</tr></table> |
| 5157 |
<a name="Extensions-to-character-procedures-1"></a> |
| 5158 |
<h2 class="section">8.1 Extensions to character procedures</h2> |
| 5159 |
|
| 5160 |
<a name="Definition_of_char-%3Einteger"></a><a name="Procedure_char-%3Einteger"></a><a name="index-char_002d_003einteger"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-%3Einteger">char->integer</a></b></code><i> <var>char</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5161 |
<a name="Definition_of_integer-%3Echar"></a><a name="Procedure_integer-%3Echar"></a><a name="index-integer_002d_003echar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_integer-%3Echar">integer->char</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5162 |
|
| 5163 |
<p>The procedure <code>char->integer</code> returns the Unicode encoding of |
| 5164 |
the character <var>char</var>. |
| 5165 |
</p> |
| 5166 |
<p>The procedure <code>integer->char</code> returns the character whose |
| 5167 |
Unicode encoding is the exact integer <var>n</var>. |
| 5168 |
</p> |
| 5169 |
<p>For example: |
| 5170 |
</p> |
| 5171 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(char->integer #\!)</b> |
| 5172 |
33 |
| 5173 |
> <b>(integer->char 65)</b> |
| 5174 |
#\A |
| 5175 |
> <b>(integer->char (char->integer #\u1234))</b> |
| 5176 |
#\u1234 |
| 5177 |
> <b>(integer->char #xd800)</b> |
| 5178 |
*** ERROR IN (console)@4.1 -- (Argument 1) Out of range |
| 5179 |
(integer->char 55296) |
| 5180 |
</pre></td></tr></table> |
| 5181 |
|
| 5182 |
|
| 5183 |
|
| 5184 |
<a name="Definition_of_char=?"></a><a name="Procedure_char=?"></a><a name="index-char_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char=?">char=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5185 |
<a name="Definition_of_char%3C?"></a><a name="Procedure_char%3C?"></a><a name="index-char_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char%3C?">char<?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5186 |
<a name="Definition_of_char%3E?"></a><a name="Procedure_char%3E?"></a><a name="index-char_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char%3E?">char>?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5187 |
<a name="Definition_of_char%3C=?"></a><a name="Procedure_char%3C=?"></a><a name="index-char_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char%3C=?">char<=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5188 |
<a name="Definition_of_char%3E=?"></a><a name="Procedure_char%3E=?"></a><a name="index-char_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char%3E=?">char>=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5189 |
<a name="Definition_of_char-ci=?"></a><a name="Procedure_char-ci=?"></a><a name="index-char_002dci_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-ci=?">char-ci=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5190 |
<a name="Definition_of_char-ci%3C?"></a><a name="Procedure_char-ci%3C?"></a><a name="index-char_002dci_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-ci%3C?">char-ci<?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5191 |
<a name="Definition_of_char-ci%3E?"></a><a name="Procedure_char-ci%3E?"></a><a name="index-char_002dci_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-ci%3E?">char-ci>?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5192 |
<a name="Definition_of_char-ci%3C=?"></a><a name="Procedure_char-ci%3C=?"></a><a name="index-char_002dci_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-ci%3C=?">char-ci<=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5193 |
<a name="Definition_of_char-ci%3E=?"></a><a name="Procedure_char-ci%3E=?"></a><a name="index-char_002dci_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_char-ci%3E=?">char-ci>=?</a></b></code><i> <var>char1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5194 |
|
| 5195 |
<p>These procedures take any number of arguments including no argument. |
| 5196 |
This is useful to test if the elements of a list are sorted in a |
| 5197 |
particular order. For example, testing that the list of characters |
| 5198 |
<code>lst</code> is sorted in nondecreasing order can be done with the call |
| 5199 |
<code>(apply char<? lst)</code>. |
| 5200 |
</p> |
| 5201 |
|
| 5202 |
|
| 5203 |
<a name="Extensions-to-string-procedures"></a><hr size="6"><br/><br/><br/> |
| 5204 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5205 |
<tr><td valign="middle" align="left"><a href="#Extensions-to-character-procedures" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5206 |
<td valign="middle" align="left"><a href="#Numbers" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5207 |
<td valign="middle" align="left"> </td> |
| 5208 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5209 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5210 |
<td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5211 |
<td valign="middle" align="left"> </td> |
| 5212 |
<td valign="middle" align="left"> </td> |
| 5213 |
<td valign="middle" align="left"> </td> |
| 5214 |
<td valign="middle" align="left"> </td> |
| 5215 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5216 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5217 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5218 |
</tr></table> |
| 5219 |
<a name="Extensions-to-string-procedures-1"></a> |
| 5220 |
<h2 class="section">8.2 Extensions to string procedures</h2> |
| 5221 |
|
| 5222 |
<a name="Definition_of_string=?"></a><a name="Procedure_string=?"></a><a name="index-string_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string=?">string=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5223 |
<a name="Definition_of_string%3C?"></a><a name="Procedure_string%3C?"></a><a name="index-string_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string%3C?">string<?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5224 |
<a name="Definition_of_string%3E?"></a><a name="Procedure_string%3E?"></a><a name="index-string_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string%3E?">string>?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5225 |
<a name="Definition_of_string%3C=?"></a><a name="Procedure_string%3C=?"></a><a name="index-string_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string%3C=?">string<=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5226 |
<a name="Definition_of_string%3E=?"></a><a name="Procedure_string%3E=?"></a><a name="index-string_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string%3E=?">string>=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5227 |
<a name="Definition_of_string-ci=?"></a><a name="Procedure_string-ci=?"></a><a name="index-string_002dci_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci=?">string-ci=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5228 |
<a name="Definition_of_string-ci%3C?"></a><a name="Procedure_string-ci%3C?"></a><a name="index-string_002dci_003c_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci%3C?">string-ci<?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5229 |
<a name="Definition_of_string-ci%3E?"></a><a name="Procedure_string-ci%3E?"></a><a name="index-string_002dci_003e_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci%3E?">string-ci>?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5230 |
<a name="Definition_of_string-ci%3C=?"></a><a name="Procedure_string-ci%3C=?"></a><a name="index-string_002dci_003c_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci%3C=?">string-ci<=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5231 |
<a name="Definition_of_string-ci%3E=?"></a><a name="Procedure_string-ci%3E=?"></a><a name="index-string_002dci_003e_003d_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci%3E=?">string-ci>=?</a></b></code><i> <var>string1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5232 |
|
| 5233 |
<p>These procedures take any number of arguments including no argument. |
| 5234 |
This is useful to test if the elements of a list are sorted in a |
| 5235 |
particular order. For example, testing that the list of strings |
| 5236 |
<code>lst</code> is sorted in nondecreasing order can be done with the call |
| 5237 |
<code>(apply string<? lst)</code>. |
| 5238 |
</p> |
| 5239 |
|
| 5240 |
|
| 5241 |
<a name="Numbers"></a><hr size="6"><br/><br/><br/> |
| 5242 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5243 |
<tr><td valign="middle" align="left"><a href="#Extensions-to-string-procedures" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5244 |
<td valign="middle" align="left"><a href="#Extensions-to-numeric-procedures" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5245 |
<td valign="middle" align="left"> </td> |
| 5246 |
<td valign="middle" align="left"><a href="#Characters-and-strings" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5247 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5248 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5249 |
<td valign="middle" align="left"> </td> |
| 5250 |
<td valign="middle" align="left"> </td> |
| 5251 |
<td valign="middle" align="left"> </td> |
| 5252 |
<td valign="middle" align="left"> </td> |
| 5253 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5254 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5255 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5256 |
</tr></table> |
| 5257 |
<a name="Numbers-1"></a> |
| 5258 |
<h1 class="chapter">9. Numbers</h1> |
| 5259 |
|
| 5260 |
<table class="menu" border="0" cellspacing="0"> |
| 5261 |
<tr><td align="left" valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5262 |
<tr><td align="left" valign="top"><a href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5263 |
<tr><td align="left" valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5264 |
<tr><td align="left" valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5265 |
<tr><td align="left" valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td><td> </td><td align="left" valign="top"> Operations on fixnums |
| 5266 |
</td></tr> |
| 5267 |
<tr><td align="left" valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td><td> </td><td align="left" valign="top"> Operations on flonums |
| 5268 |
</td></tr> |
| 5269 |
<tr><td align="left" valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 5270 |
</table> |
| 5271 |
|
| 5272 |
<a name="Extensions-to-numeric-procedures"></a><hr size="6"><br/><br/><br/> |
| 5273 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5274 |
<tr><td valign="middle" align="left"><a href="#Numbers" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5275 |
<td valign="middle" align="left"><a href="#IEEE-floating-point-arithmetic" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5276 |
<td valign="middle" align="left"> </td> |
| 5277 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5278 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5279 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5280 |
<td valign="middle" align="left"> </td> |
| 5281 |
<td valign="middle" align="left"> </td> |
| 5282 |
<td valign="middle" align="left"> </td> |
| 5283 |
<td valign="middle" align="left"> </td> |
| 5284 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5285 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5286 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5287 |
</tr></table> |
| 5288 |
<a name="Extensions-to-numeric-procedures-1"></a> |
| 5289 |
<h2 class="section">9.1 Extensions to numeric procedures</h2> |
| 5290 |
|
| 5291 |
<a name="Definition_of_="></a><a name="Procedure_="></a><a name="index-_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_=">=</a></b></code><i> <var>z1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5292 |
<a name="Definition_of_%3C"></a><a name="Procedure_%3C"></a><a name="index-_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_%3C"><</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5293 |
<a name="Definition_of_%3E"></a><a name="Procedure_%3E"></a><a name="index-_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_%3E">></a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5294 |
<a name="Definition_of_%3C="></a><a name="Procedure_%3C="></a><a name="index-_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_%3C="><=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5295 |
<a name="Definition_of_%3E="></a><a name="Procedure_%3E="></a><a name="index-_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_%3E=">>=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5296 |
|
| 5297 |
<p>These procedures take any number of arguments including no argument. |
| 5298 |
This is useful to test if the elements of a list are sorted in a |
| 5299 |
particular order. For example, testing that the list of numbers |
| 5300 |
<code>lst</code> is sorted in nondecreasing order can be done with the call |
| 5301 |
<code>(apply < lst)</code>. |
| 5302 |
</p> |
| 5303 |
|
| 5304 |
|
| 5305 |
<a name="IEEE-floating-point-arithmetic"></a><hr size="6"><br/><br/><br/> |
| 5306 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5307 |
<tr><td valign="middle" align="left"><a href="#Extensions-to-numeric-procedures" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5308 |
<td valign="middle" align="left"><a href="#Integer-square-root-and-nth-root" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5309 |
<td valign="middle" align="left"> </td> |
| 5310 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5311 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5312 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5313 |
<td valign="middle" align="left"> </td> |
| 5314 |
<td valign="middle" align="left"> </td> |
| 5315 |
<td valign="middle" align="left"> </td> |
| 5316 |
<td valign="middle" align="left"> </td> |
| 5317 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5318 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5319 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5320 |
</tr></table> |
| 5321 |
<a name="IEEE-floating-point-arithmetic-1"></a> |
| 5322 |
<h2 class="section">9.2 IEEE floating point arithmetic</h2> |
| 5323 |
|
| 5324 |
<p>To better conform to IEEE floating point arithmetic the standard |
| 5325 |
numeric tower is extended with these special inexact reals: |
| 5326 |
</p> |
| 5327 |
<dl compact="compact"> |
| 5328 |
<dt> <code>+inf.0</code></dt> |
| 5329 |
<dd><p>positive infinity |
| 5330 |
</p></dd> |
| 5331 |
<dt> <code>-inf.0</code></dt> |
| 5332 |
<dd><p>negative infinity |
| 5333 |
</p></dd> |
| 5334 |
<dt> <code>+nan.0</code></dt> |
| 5335 |
<dd><p>“not a number” |
| 5336 |
</p></dd> |
| 5337 |
<dt> <code>-0.</code></dt> |
| 5338 |
<dd><p>negative zero (‘<samp>0.</samp>’ is the positive zero) |
| 5339 |
</p></dd> |
| 5340 |
</dl> |
| 5341 |
|
| 5342 |
<p>The infinities and “not a number” are reals (i.e. <code>(real? |
| 5343 |
+inf.0)</code> is <code>#t</code>) but are not rational (i.e. <code>(rational? |
| 5344 |
+inf.0)</code> is <code>#f</code>). |
| 5345 |
</p> |
| 5346 |
<p>Both zeros are numerically equal (i.e. <code>(= -0. 0.)</code> is <code>#t</code>) |
| 5347 |
but are not equivalent (i.e. <code>(eqv? -0. 0.)</code> and <code>(equal? |
| 5348 |
-0. 0.)</code> are <code>#f</code>). All numerical comparisons with “not a |
| 5349 |
number”, including <code>(= +nan.0 +nan.0)</code>, are <code>#f</code>. |
| 5350 |
</p> |
| 5351 |
<a name="Integer-square-root-and-nth-root"></a><hr size="6"><br/><br/><br/> |
| 5352 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5353 |
<tr><td valign="middle" align="left"><a href="#IEEE-floating-point-arithmetic" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5354 |
<td valign="middle" align="left"><a href="#Bitwise_002doperations-on-exact-integers" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5355 |
<td valign="middle" align="left"> </td> |
| 5356 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5357 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5358 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5359 |
<td valign="middle" align="left"> </td> |
| 5360 |
<td valign="middle" align="left"> </td> |
| 5361 |
<td valign="middle" align="left"> </td> |
| 5362 |
<td valign="middle" align="left"> </td> |
| 5363 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5364 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5365 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5366 |
</tr></table> |
| 5367 |
<a name="Integer-square-root-and-nth-root-1"></a> |
| 5368 |
<h2 class="section">9.3 Integer square root and nth root</h2> |
| 5369 |
|
| 5370 |
<a name="Definition_of_integer-sqrt"></a><a name="Procedure_integer-sqrt"></a><a name="index-integer_002dsqrt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_integer-sqrt">integer-sqrt</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5371 |
|
| 5372 |
<p>This procedure returns the integer part of the square root of the |
| 5373 |
nonnegative exact integer <var>n</var>. |
| 5374 |
</p> |
| 5375 |
<p>For example: |
| 5376 |
</p> |
| 5377 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-sqrt 123)</b> |
| 5378 |
11 |
| 5379 |
</pre></td></tr></table> |
| 5380 |
|
| 5381 |
|
| 5382 |
|
| 5383 |
<a name="Definition_of_integer-nth-root"></a><a name="Procedure_integer-nth-root"></a><a name="index-integer_002dnth_002droot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_integer-nth-root">integer-nth-root</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5384 |
|
| 5385 |
<p>This procedure returns the integer part of <var>n1</var> raised to the |
| 5386 |
power 1/<var>n2</var>, where <var>n1</var> is a nonnegative exact integer and |
| 5387 |
<var>n2</var> is a positive exact integer. |
| 5388 |
</p> |
| 5389 |
<p>For example: |
| 5390 |
</p> |
| 5391 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-nth-root 100 3)</b> |
| 5392 |
4 |
| 5393 |
</pre></td></tr></table> |
| 5394 |
|
| 5395 |
|
| 5396 |
|
| 5397 |
<a name="Bitwise_002doperations-on-exact-integers"></a><hr size="6"><br/><br/><br/> |
| 5398 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5399 |
<tr><td valign="middle" align="left"><a href="#Integer-square-root-and-nth-root" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5400 |
<td valign="middle" align="left"><a href="#Fixnum-specific-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5401 |
<td valign="middle" align="left"> </td> |
| 5402 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5403 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5404 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5405 |
<td valign="middle" align="left"> </td> |
| 5406 |
<td valign="middle" align="left"> </td> |
| 5407 |
<td valign="middle" align="left"> </td> |
| 5408 |
<td valign="middle" align="left"> </td> |
| 5409 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5410 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5411 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5412 |
</tr></table> |
| 5413 |
<a name="Bitwise_002doperations-on-exact-integers-1"></a> |
| 5414 |
<h2 class="section">9.4 Bitwise-operations on exact integers</h2> |
| 5415 |
|
| 5416 |
<p>The procedures defined in this section are compatible with the |
| 5417 |
withdrawn “Integer Bitwise-operation Library SRFI” (SRFI 33). Note |
| 5418 |
that some of the procedures specified in SRFI 33 are not provided. |
| 5419 |
</p> |
| 5420 |
<p>Most procedures in this section are specified in terms of the binary |
| 5421 |
representation of exact integers. The two’s complement representation |
| 5422 |
is assumed where an integer is composed of an infinite number of bits. |
| 5423 |
The upper section of an integer (the most significant bits) are either |
| 5424 |
an infinite sequence of ones when the integer is negative, or they are |
| 5425 |
an infinite sequence of zeros when the integer is nonnegative. |
| 5426 |
</p> |
| 5427 |
<a name="Definition_of_arithmetic-shift"></a><a name="Procedure_arithmetic-shift"></a><a name="index-arithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_arithmetic-shift">arithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5428 |
|
| 5429 |
<p>This procedure returns <var>n1</var> shifted to the left by <var>n2</var> bits, |
| 5430 |
that is <code>(floor (* <var>n1</var> (expt 2 <var>n2</var>)))</code>. Both <var>n1</var> |
| 5431 |
and <var>n2</var> must be exact integers. |
| 5432 |
</p> |
| 5433 |
<p>For example: |
| 5434 |
</p> |
| 5435 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(arithmetic-shift 1000 7) <span class="roman"><i>; n1=...0000001111101000</i></span></b> |
| 5436 |
128000 |
| 5437 |
> <b>(arithmetic-shift 1000 -6) <span class="roman"><i>; n1=...0000001111101000</i></span></b> |
| 5438 |
15 |
| 5439 |
> <b>(arithmetic-shift -23 -3) <span class="roman"><i>; n1=...1111111111101001</i></span></b> |
| 5440 |
-3 |
| 5441 |
</pre></td></tr></table> |
| 5442 |
|
| 5443 |
|
| 5444 |
|
| 5445 |
<a name="Definition_of_bitwise-merge"></a><a name="Procedure_bitwise-merge"></a><a name="index-bitwise_002dmerge"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bitwise-merge">bitwise-merge</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5446 |
|
| 5447 |
<p>This procedure returns an exact integer whose bits combine the bits |
| 5448 |
from <var>n2</var> and <var>n3</var> depending on <var>n1</var>. The bit at index |
| 5449 |
<var>i</var> of the result depends only on the bits at index <var>i</var> in |
| 5450 |
<var>n1</var>, <var>n2</var> and <var>n3</var>: it is equal to the bit in <var>n2</var> |
| 5451 |
when the bit in <var>n1</var> is 0 and it is equal to the bit in <var>n3</var> |
| 5452 |
when the bit in <var>n1</var> is 1. All arguments must be exact integers. |
| 5453 |
</p> |
| 5454 |
<p>For example: |
| 5455 |
</p> |
| 5456 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-merge -4 -11 10) <span class="roman"><i>; ...11111100 ...11110101 ...00001010</i></span></b> |
| 5457 |
9 |
| 5458 |
> <b>(bitwise-merge 12 -11 10) <span class="roman"><i>; ...00001100 ...11110101 ...00001010</i></span></b> |
| 5459 |
-7 |
| 5460 |
</pre></td></tr></table> |
| 5461 |
|
| 5462 |
|
| 5463 |
|
| 5464 |
<a name="Definition_of_bitwise-and"></a><a name="Procedure_bitwise-and"></a><a name="index-bitwise_002dand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bitwise-and">bitwise-and</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5465 |
|
| 5466 |
<p>This procedure returns the bitwise “and” of the exact integers |
| 5467 |
<var>n</var>…. The value -1 is returned when there are no arguments. |
| 5468 |
</p> |
| 5469 |
<p>For example: |
| 5470 |
</p> |
| 5471 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-and 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b> |
| 5472 |
4 |
| 5473 |
> <b>(bitwise-and 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b> |
| 5474 |
4 |
| 5475 |
> <b>(bitwise-and -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b> |
| 5476 |
-8 |
| 5477 |
> <b>(bitwise-and)</b> |
| 5478 |
-1 |
| 5479 |
</pre></td></tr></table> |
| 5480 |
|
| 5481 |
|
| 5482 |
|
| 5483 |
<a name="Definition_of_bitwise-ior"></a><a name="Procedure_bitwise-ior"></a><a name="index-bitwise_002dior"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bitwise-ior">bitwise-ior</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5484 |
|
| 5485 |
<p>This procedure returns the bitwise “inclusive-or” of the exact |
| 5486 |
integers <var>n</var>…. The value 0 is returned when there are no |
| 5487 |
arguments. |
| 5488 |
</p> |
| 5489 |
<p>For example: |
| 5490 |
</p> |
| 5491 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-ior 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b> |
| 5492 |
14 |
| 5493 |
> <b>(bitwise-ior 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b> |
| 5494 |
-2 |
| 5495 |
> <b>(bitwise-ior -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b> |
| 5496 |
-2 |
| 5497 |
> <b>(bitwise-ior)</b> |
| 5498 |
0 |
| 5499 |
</pre></td></tr></table> |
| 5500 |
|
| 5501 |
|
| 5502 |
|
| 5503 |
<a name="Definition_of_bitwise-xor"></a><a name="Procedure_bitwise-xor"></a><a name="index-bitwise_002dxor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bitwise-xor">bitwise-xor</a></b></code><i> <var>n</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5504 |
|
| 5505 |
<p>This procedure returns the bitwise “exclusive-or” of the exact |
| 5506 |
integers <var>n</var>…. The value 0 is returned when there are no |
| 5507 |
arguments. |
| 5508 |
</p> |
| 5509 |
<p>For example: |
| 5510 |
</p> |
| 5511 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-xor 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b> |
| 5512 |
10 |
| 5513 |
> <b>(bitwise-xor 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b> |
| 5514 |
-6 |
| 5515 |
> <b>(bitwise-xor -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b> |
| 5516 |
6 |
| 5517 |
> <b>(bitwise-xor)</b> |
| 5518 |
0 |
| 5519 |
</pre></td></tr></table> |
| 5520 |
|
| 5521 |
|
| 5522 |
|
| 5523 |
<a name="Definition_of_bitwise-not"></a><a name="Procedure_bitwise-not"></a><a name="index-bitwise_002dnot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bitwise-not">bitwise-not</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5524 |
|
| 5525 |
<p>This procedure returns the bitwise complement of the exact integer |
| 5526 |
<var>n</var>. |
| 5527 |
</p> |
| 5528 |
<p>For example: |
| 5529 |
</p> |
| 5530 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bitwise-not 3) <span class="roman"><i>; ...00000011</i></span></b> |
| 5531 |
-4 |
| 5532 |
> <b>(bitwise-not -1) <span class="roman"><i>; ...11111111</i></span></b> |
| 5533 |
0 |
| 5534 |
</pre></td></tr></table> |
| 5535 |
|
| 5536 |
|
| 5537 |
|
| 5538 |
<a name="Definition_of_bit-count"></a><a name="Procedure_bit-count"></a><a name="index-bit_002dcount"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bit-count">bit-count</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5539 |
|
| 5540 |
<p>This procedure returns the bit count of the exact integer <var>n</var>. If |
| 5541 |
<var>n</var> is nonnegative, the bit count is the number of 1 bits in the |
| 5542 |
two’s complement representation of <var>n</var>. If <var>n</var> is negative, |
| 5543 |
the bit count is the number of 0 bits in the two’s complement |
| 5544 |
representation of <var>n</var>. |
| 5545 |
</p> |
| 5546 |
<p>For example: |
| 5547 |
</p> |
| 5548 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(bit-count 0) <span class="roman"><i>; ...00000000</i></span></b> |
| 5549 |
0 |
| 5550 |
> <b>(bit-count 1) <span class="roman"><i>; ...00000001</i></span></b> |
| 5551 |
1 |
| 5552 |
> <b>(bit-count 2) <span class="roman"><i>; ...00000010</i></span></b> |
| 5553 |
1 |
| 5554 |
> <b>(bit-count 3) <span class="roman"><i>; ...00000011</i></span></b> |
| 5555 |
2 |
| 5556 |
> <b>(bit-count 4) <span class="roman"><i>; ...00000100</i></span></b> |
| 5557 |
1 |
| 5558 |
> <b>(bit-count -23) <span class="roman"><i>; ...11101001</i></span></b> |
| 5559 |
3 |
| 5560 |
</pre></td></tr></table> |
| 5561 |
|
| 5562 |
|
| 5563 |
|
| 5564 |
<a name="Definition_of_integer-length"></a><a name="Procedure_integer-length"></a><a name="index-integer_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_integer-length">integer-length</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5565 |
|
| 5566 |
<p>This procedure returns the bit length of the exact integer <var>n</var>. |
| 5567 |
If <var>n</var> is a positive integer the bit length is one more than the |
| 5568 |
index of the highest 1 bit (the least significant bit is at index 0). |
| 5569 |
If <var>n</var> is a negative integer the bit length is one more than the |
| 5570 |
index of the highest 0 bit. If <var>n</var> is zero, the bit length is 0. |
| 5571 |
</p> |
| 5572 |
<p>For example: |
| 5573 |
</p> |
| 5574 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(integer-length 0) <span class="roman"><i>; ...00000000</i></span></b> |
| 5575 |
0 |
| 5576 |
> <b>(integer-length 1) <span class="roman"><i>; ...00000001</i></span></b> |
| 5577 |
1 |
| 5578 |
> <b>(integer-length 2) <span class="roman"><i>; ...00000010</i></span></b> |
| 5579 |
2 |
| 5580 |
> <b>(integer-length 3) <span class="roman"><i>; ...00000011</i></span></b> |
| 5581 |
2 |
| 5582 |
> <b>(integer-length 4) <span class="roman"><i>; ...00000100</i></span></b> |
| 5583 |
3 |
| 5584 |
> <b>(integer-length -23) <span class="roman"><i>; ...11101001</i></span></b> |
| 5585 |
5 |
| 5586 |
</pre></td></tr></table> |
| 5587 |
|
| 5588 |
|
| 5589 |
|
| 5590 |
<a name="Definition_of_bit-set?"></a><a name="Procedure_bit-set?"></a><a name="index-bit_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_bit-set?">bit-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5591 |
|
| 5592 |
<p>This procedure returns a boolean indicating if the bit at index |
| 5593 |
<var>n1</var> of <var>n2</var> is set (i.e. equal to 1) or not. Both <var>n1</var> |
| 5594 |
and <var>n2</var> must be exact integers, and <var>n1</var> must be |
| 5595 |
nonnegative. |
| 5596 |
</p> |
| 5597 |
<p>For example: |
| 5598 |
</p> |
| 5599 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map (lambda (i) (bit-set? i -23)) <span class="roman"><i>; ...11101001</i></span> |
| 5600 |
'(7 6 5 4 3 2 1 0))</b> |
| 5601 |
(#t #t #t #f #t #f #f #t) |
| 5602 |
</pre></td></tr></table> |
| 5603 |
|
| 5604 |
|
| 5605 |
|
| 5606 |
<a name="Definition_of_any-bits-set?"></a><a name="Procedure_any-bits-set?"></a><a name="index-any_002dbits_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_any-bits-set?">any-bits-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5607 |
|
| 5608 |
<p>This procedure returns a boolean indicating if the bitwise and |
| 5609 |
of <var>n1</var> and <var>n2</var> is different from zero or not. This procedure |
| 5610 |
is implemented more efficiently than the naive definition: |
| 5611 |
</p> |
| 5612 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (any-bits-set? n1 n2) (not (zero? (bitwise-and n1 n2)))) |
| 5613 |
</pre></td></tr></table> |
| 5614 |
|
| 5615 |
<p>For example: |
| 5616 |
</p> |
| 5617 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(any-bits-set? 5 10) <span class="roman"><i>; ...00000101 ...00001010</i></span></b> |
| 5618 |
#f |
| 5619 |
> <b>(any-bits-set? -23 32) <span class="roman"><i>; ...11101001 ...00100000</i></span></b> |
| 5620 |
#t |
| 5621 |
</pre></td></tr></table> |
| 5622 |
|
| 5623 |
|
| 5624 |
|
| 5625 |
<a name="Definition_of_all-bits-set?"></a><a name="Procedure_all-bits-set?"></a><a name="index-all_002dbits_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_all-bits-set?">all-bits-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5626 |
|
| 5627 |
<p>This procedure returns a boolean indicating if the bitwise and |
| 5628 |
of <var>n1</var> and <var>n2</var> is equal to <var>n1</var> or not. This procedure |
| 5629 |
is implemented more efficiently than the naive definition: |
| 5630 |
</p> |
| 5631 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (all-bits-set? n1 n2) (= n1 (bitwise-and n1 n2))) |
| 5632 |
</pre></td></tr></table> |
| 5633 |
|
| 5634 |
<p>For example: |
| 5635 |
</p> |
| 5636 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(all-bits-set? 1 3) <span class="roman"><i>; ...00000001 ...00000011</i></span></b> |
| 5637 |
#t |
| 5638 |
> <b>(all-bits-set? 7 3) <span class="roman"><i>; ...00000111 ...00000011</i></span></b> |
| 5639 |
#f |
| 5640 |
</pre></td></tr></table> |
| 5641 |
|
| 5642 |
|
| 5643 |
|
| 5644 |
<a name="Definition_of_first-set-bit"></a><a name="Procedure_first-set-bit"></a><a name="index-first_002dset_002dbit"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_first-set-bit">first-set-bit</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5645 |
|
| 5646 |
<p>This procedure returns the bit index of the least significant bit of |
| 5647 |
<var>n</var> equal to 1 (which is also the number of 0 bits that are below |
| 5648 |
the least significant 1 bit). This procedure returns <code>-1</code> when |
| 5649 |
<var>n</var> is zero. |
| 5650 |
</p> |
| 5651 |
<p>For example: |
| 5652 |
</p> |
| 5653 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(first-set-bit 24) <span class="roman"><i>; ...00011000</i></span></b> |
| 5654 |
3 |
| 5655 |
> <b>(first-set-bit 0) <span class="roman"><i>; ...00000000</i></span></b> |
| 5656 |
-1 |
| 5657 |
</pre></td></tr></table> |
| 5658 |
|
| 5659 |
|
| 5660 |
|
| 5661 |
<a name="Definition_of_extract-bit-field"></a><a name="Procedure_extract-bit-field"></a><a name="index-extract_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_extract-bit-field">extract-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5662 |
<a name="Definition_of_test-bit-field?"></a><a name="Procedure_test-bit-field?"></a><a name="index-test_002dbit_002dfield_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_test-bit-field?">test-bit-field?</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5663 |
<a name="Definition_of_clear-bit-field"></a><a name="Procedure_clear-bit-field"></a><a name="index-clear_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_clear-bit-field">clear-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5664 |
<a name="Definition_of_replace-bit-field"></a><a name="Procedure_replace-bit-field"></a><a name="index-replace_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_replace-bit-field">replace-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var> <var>n4</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5665 |
<a name="Definition_of_copy-bit-field"></a><a name="Procedure_copy-bit-field"></a><a name="index-copy_002dbit_002dfield"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_copy-bit-field">copy-bit-field</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var> <var>n4</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5666 |
|
| 5667 |
<p>These procedures operate on a bit-field which is <var>n1</var> bits wide |
| 5668 |
starting at bit index <var>n2</var>. All arguments must be exact integers |
| 5669 |
and <var>n1</var> and <var>n2</var> must be nonnegative. |
| 5670 |
</p> |
| 5671 |
<p>The procedure <code>extract-bit-field</code> returns the bit-field of |
| 5672 |
<var>n3</var> shifted to the right so that the least significant bit of the |
| 5673 |
bit-field is the least significant bit of the result. |
| 5674 |
</p> |
| 5675 |
<p>The procedure <code>test-bit-field?</code> returns <code>#t</code> if any bit in |
| 5676 |
the bit-field of <var>n3</var> is equal to 1, otherwise <code>#f</code> is |
| 5677 |
returned. |
| 5678 |
</p> |
| 5679 |
<p>The procedure <code>clear-bit-field</code> returns <var>n3</var> with all bits |
| 5680 |
in the bit-field replaced with 0. |
| 5681 |
</p> |
| 5682 |
<p>The procedure <code>replace-bit-field</code> returns <var>n4</var> with the |
| 5683 |
bit-field replaced with the least-significant <var>n1</var> bits of |
| 5684 |
<var>n3</var>. |
| 5685 |
</p> |
| 5686 |
<p>The procedure <code>copy-bit-field</code> returns <var>n4</var> with the |
| 5687 |
bit-field replaced with the (same index and size) bit-field in |
| 5688 |
<var>n3</var>. |
| 5689 |
</p> |
| 5690 |
<p>For example: |
| 5691 |
</p> |
| 5692 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(extract-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b> |
| 5693 |
22 |
| 5694 |
> <b>(test-bit-field? 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b> |
| 5695 |
#t |
| 5696 |
> <b>(test-bit-field? 1 2 -37) <span class="roman"><i>; ...11011011</i></span></b> |
| 5697 |
#f |
| 5698 |
> <b>(clear-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b> |
| 5699 |
-125 |
| 5700 |
> <b>(replace-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b> |
| 5701 |
-21 |
| 5702 |
> <b>(copy-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b> |
| 5703 |
-5 |
| 5704 |
</pre></td></tr></table> |
| 5705 |
|
| 5706 |
|
| 5707 |
|
| 5708 |
<a name="Fixnum-specific-operations"></a><hr size="6"><br/><br/><br/> |
| 5709 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5710 |
<tr><td valign="middle" align="left"><a href="#Bitwise_002doperations-on-exact-integers" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5711 |
<td valign="middle" align="left"><a href="#Flonum-specific-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5712 |
<td valign="middle" align="left"> </td> |
| 5713 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5714 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5715 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5716 |
<td valign="middle" align="left"> </td> |
| 5717 |
<td valign="middle" align="left"> </td> |
| 5718 |
<td valign="middle" align="left"> </td> |
| 5719 |
<td valign="middle" align="left"> </td> |
| 5720 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5721 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5722 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5723 |
</tr></table> |
| 5724 |
<a name="Fixnum-specific-operations-1"></a> |
| 5725 |
<h2 class="section">9.5 Fixnum specific operations</h2> |
| 5726 |
|
| 5727 |
<a name="Definition_of_fixnum?"></a><a name="Procedure_fixnum?"></a><a name="index-fixnum_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fixnum?">fixnum?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5728 |
|
| 5729 |
|
| 5730 |
<a name="Definition_of_fx%2A"></a><a name="Procedure_fx%2A"></a><a name="index-fx_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%2A">fx*</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5731 |
|
| 5732 |
|
| 5733 |
<a name="Definition_of_fx%2B"></a><a name="Procedure_fx%2B"></a><a name="index-fx_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%2B">fx+</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5734 |
|
| 5735 |
|
| 5736 |
<a name="Definition_of_fx-"></a><a name="Procedure_fx-"></a><a name="index-fx_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx-">fx-</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5737 |
|
| 5738 |
|
| 5739 |
<a name="Definition_of_fx%3C"></a><a name="Procedure_fx%3C"></a><a name="index-fx_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%3C">fx<</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5740 |
|
| 5741 |
|
| 5742 |
<a name="Definition_of_fx%3C="></a><a name="Procedure_fx%3C="></a><a name="index-fx_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%3C=">fx<=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5743 |
|
| 5744 |
|
| 5745 |
<a name="Definition_of_fx="></a><a name="Procedure_fx="></a><a name="index-fx_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx=">fx=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5746 |
|
| 5747 |
|
| 5748 |
<a name="Definition_of_fx%3E"></a><a name="Procedure_fx%3E"></a><a name="index-fx_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%3E">fx></a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5749 |
|
| 5750 |
|
| 5751 |
<a name="Definition_of_fx%3E="></a><a name="Procedure_fx%3E="></a><a name="index-fx_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fx%3E=">fx>=</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5752 |
|
| 5753 |
|
| 5754 |
<a name="Definition_of_fxabs"></a><a name="Procedure_fxabs"></a><a name="index-fxabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxabs">fxabs</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5755 |
|
| 5756 |
|
| 5757 |
<a name="Definition_of_fxand"></a><a name="Procedure_fxand"></a><a name="index-fxand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxand">fxand</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5758 |
|
| 5759 |
|
| 5760 |
<a name="Definition_of_fxarithmetic-shift"></a><a name="Procedure_fxarithmetic-shift"></a><a name="index-fxarithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift">fxarithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5761 |
|
| 5762 |
|
| 5763 |
<a name="Definition_of_fxarithmetic-shift-left"></a><a name="Procedure_fxarithmetic-shift-left"></a><a name="index-fxarithmetic_002dshift_002dleft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift-left">fxarithmetic-shift-left</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5764 |
|
| 5765 |
|
| 5766 |
<a name="Definition_of_fxarithmetic-shift-right"></a><a name="Procedure_fxarithmetic-shift-right"></a><a name="index-fxarithmetic_002dshift_002dright"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxarithmetic-shift-right">fxarithmetic-shift-right</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5767 |
|
| 5768 |
|
| 5769 |
<a name="Definition_of_fxbit-count"></a><a name="Procedure_fxbit-count"></a><a name="index-fxbit_002dcount"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxbit-count">fxbit-count</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5770 |
|
| 5771 |
|
| 5772 |
<a name="Definition_of_fxbit-set?"></a><a name="Procedure_fxbit-set?"></a><a name="index-fxbit_002dset_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxbit-set?">fxbit-set?</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5773 |
|
| 5774 |
|
| 5775 |
<a name="Definition_of_fxeven?"></a><a name="Procedure_fxeven?"></a><a name="index-fxeven_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxeven?">fxeven?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5776 |
|
| 5777 |
|
| 5778 |
<a name="Definition_of_fxfirst-set-bit"></a><a name="Procedure_fxfirst-set-bit"></a><a name="index-fxfirst_002dset_002dbit"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxfirst-set-bit">fxfirst-set-bit</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5779 |
|
| 5780 |
|
| 5781 |
<a name="Definition_of_fxif"></a><a name="Procedure_fxif"></a><a name="index-fxif"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxif">fxif</a></b></code><i> <var>n1</var> <var>n2</var> <var>n3</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5782 |
|
| 5783 |
|
| 5784 |
<a name="Definition_of_fxior"></a><a name="Procedure_fxior"></a><a name="index-fxior"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxior">fxior</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5785 |
|
| 5786 |
|
| 5787 |
<a name="Definition_of_fxlength"></a><a name="Procedure_fxlength"></a><a name="index-fxlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxlength">fxlength</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5788 |
|
| 5789 |
|
| 5790 |
<a name="Definition_of_fxmax"></a><a name="Procedure_fxmax"></a><a name="index-fxmax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxmax">fxmax</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5791 |
|
| 5792 |
|
| 5793 |
<a name="Definition_of_fxmin"></a><a name="Procedure_fxmin"></a><a name="index-fxmin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxmin">fxmin</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5794 |
|
| 5795 |
|
| 5796 |
<a name="Definition_of_fxmodulo"></a><a name="Procedure_fxmodulo"></a><a name="index-fxmodulo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxmodulo">fxmodulo</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5797 |
|
| 5798 |
|
| 5799 |
<a name="Definition_of_fxnegative?"></a><a name="Procedure_fxnegative?"></a><a name="index-fxnegative_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxnegative?">fxnegative?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5800 |
|
| 5801 |
|
| 5802 |
<a name="Definition_of_fxnot"></a><a name="Procedure_fxnot"></a><a name="index-fxnot"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxnot">fxnot</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5803 |
|
| 5804 |
|
| 5805 |
<a name="Definition_of_fxodd?"></a><a name="Procedure_fxodd?"></a><a name="index-fxodd_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxodd?">fxodd?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5806 |
|
| 5807 |
|
| 5808 |
<a name="Definition_of_fxpositive?"></a><a name="Procedure_fxpositive?"></a><a name="index-fxpositive_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxpositive?">fxpositive?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5809 |
|
| 5810 |
|
| 5811 |
<a name="Definition_of_fxquotient"></a><a name="Procedure_fxquotient"></a><a name="index-fxquotient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxquotient">fxquotient</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5812 |
|
| 5813 |
|
| 5814 |
<a name="Definition_of_fxremainder"></a><a name="Procedure_fxremainder"></a><a name="index-fxremainder"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxremainder">fxremainder</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5815 |
|
| 5816 |
|
| 5817 |
<a name="Definition_of_fxwrap%2A"></a><a name="Procedure_fxwrap%2A"></a><a name="index-fxwrap_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwrap%2A">fxwrap*</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5818 |
|
| 5819 |
|
| 5820 |
<a name="Definition_of_fxwrap%2B"></a><a name="Procedure_fxwrap%2B"></a><a name="index-fxwrap_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwrap%2B">fxwrap+</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5821 |
|
| 5822 |
|
| 5823 |
<a name="Definition_of_fxwrap-"></a><a name="Procedure_fxwrap-"></a><a name="index-fxwrap_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwrap-">fxwrap-</a></b></code><i> <var>n1</var> <var>n2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5824 |
|
| 5825 |
|
| 5826 |
<a name="Definition_of_fxwrapabs"></a><a name="Procedure_fxwrapabs"></a><a name="index-fxwrapabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwrapabs">fxwrapabs</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5827 |
|
| 5828 |
|
| 5829 |
<a name="Definition_of_fxwraparithmetic-shift"></a><a name="Procedure_fxwraparithmetic-shift"></a><a name="index-fxwraparithmetic_002dshift"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwraparithmetic-shift">fxwraparithmetic-shift</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5830 |
|
| 5831 |
|
| 5832 |
<a name="Definition_of_fxwraparithmetic-shift-left"></a><a name="Procedure_fxwraparithmetic-shift-left"></a><a name="index-fxwraparithmetic_002dshift_002dleft"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwraparithmetic-shift-left">fxwraparithmetic-shift-left</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5833 |
|
| 5834 |
|
| 5835 |
<a name="Definition_of_fxwraplogical-shift-right"></a><a name="Procedure_fxwraplogical-shift-right"></a><a name="index-fxwraplogical_002dshift_002dright"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwraplogical-shift-right">fxwraplogical-shift-right</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5836 |
|
| 5837 |
|
| 5838 |
<a name="Definition_of_fxwrapquotient"></a><a name="Procedure_fxwrapquotient"></a><a name="index-fxwrapquotient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxwrapquotient">fxwrapquotient</a></b></code><i> <var>n1</var> <var>n2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5839 |
|
| 5840 |
|
| 5841 |
<a name="Definition_of_fxxor"></a><a name="Procedure_fxxor"></a><a name="index-fxxor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxxor">fxxor</a></b></code><i> <var>n1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5842 |
|
| 5843 |
|
| 5844 |
<a name="Definition_of_fxzero?"></a><a name="Procedure_fxzero?"></a><a name="index-fxzero_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fxzero?">fxzero?</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5845 |
|
| 5846 |
|
| 5847 |
<a name="Definition_of_fixnum-overflow-exception?"></a><a name="Procedure_fixnum-overflow-exception?"></a><a name="index-fixnum_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception?">fixnum-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5848 |
<a name="Definition_of_fixnum-overflow-exception-procedure"></a><a name="Procedure_fixnum-overflow-exception-procedure"></a><a name="index-fixnum_002doverflow_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception-procedure">fixnum-overflow-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5849 |
<a name="Definition_of_fixnum-overflow-exception-arguments"></a><a name="Procedure_fixnum-overflow-exception-arguments"></a><a name="index-fixnum_002doverflow_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fixnum-overflow-exception-arguments">fixnum-overflow-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5850 |
|
| 5851 |
<p>Fixnum-overflow-exception objects are raised by some of the fixnum |
| 5852 |
specific procedures when the result is larger than can fit in a |
| 5853 |
fixnum. The parameter <var>exc</var> must be a fixnum-overflow-exception |
| 5854 |
object. |
| 5855 |
</p> |
| 5856 |
<p>The procedure <code>fixnum-overflow-exception?</code> returns |
| 5857 |
<code>#t</code> when <var>obj</var> is a fixnum-overflow-exception |
| 5858 |
object and <code>#f</code> otherwise. |
| 5859 |
</p> |
| 5860 |
<p>The procedure <code>fixnum-overflow-exception-procedure</code> |
| 5861 |
returns the procedure that raised <var>exc</var>. |
| 5862 |
</p> |
| 5863 |
<p>The procedure <code>fixnum-overflow-exception-arguments</code> |
| 5864 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 5865 |
</p> |
| 5866 |
<p>For example: |
| 5867 |
</p> |
| 5868 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 5869 |
(if (fixnum-overflow-exception? exc) |
| 5870 |
(list (fixnum-overflow-exception-procedure exc) |
| 5871 |
(fixnum-overflow-exception-arguments exc)) |
| 5872 |
'not-fixnum-overflow-exception))</b> |
| 5873 |
> <b>(with-exception-catcher |
| 5874 |
handler |
| 5875 |
(lambda () (fx* 100000 100000)))</b> |
| 5876 |
(#<procedure #2 fx*> (100000 100000)) |
| 5877 |
</pre></td></tr></table> |
| 5878 |
|
| 5879 |
|
| 5880 |
|
| 5881 |
<a name="Flonum-specific-operations"></a><hr size="6"><br/><br/><br/> |
| 5882 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 5883 |
<tr><td valign="middle" align="left"><a href="#Fixnum-specific-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 5884 |
<td valign="middle" align="left"><a href="#Pseudo-random-numbers" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 5885 |
<td valign="middle" align="left"> </td> |
| 5886 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 5887 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 5888 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 5889 |
<td valign="middle" align="left"> </td> |
| 5890 |
<td valign="middle" align="left"> </td> |
| 5891 |
<td valign="middle" align="left"> </td> |
| 5892 |
<td valign="middle" align="left"> </td> |
| 5893 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 5894 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 5895 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 5896 |
</tr></table> |
| 5897 |
<a name="Flonum-specific-operations-1"></a> |
| 5898 |
<h2 class="section">9.6 Flonum specific operations</h2> |
| 5899 |
|
| 5900 |
<a name="Definition_of_flonum?"></a><a name="Procedure_flonum?"></a><a name="index-flonum_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flonum?">flonum?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5901 |
|
| 5902 |
|
| 5903 |
<a name="Definition_of_fixnum-%3Eflonum"></a><a name="Procedure_fixnum-%3Eflonum"></a><a name="index-fixnum_002d_003eflonum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fixnum-%3Eflonum">fixnum->flonum</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5904 |
|
| 5905 |
|
| 5906 |
<a name="Definition_of_fl%2A"></a><a name="Procedure_fl%2A"></a><a name="index-fl_002a"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%2A">fl*</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5907 |
|
| 5908 |
|
| 5909 |
<a name="Definition_of_fl%2B"></a><a name="Procedure_fl%2B"></a><a name="index-fl_002b"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%2B">fl+</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5910 |
|
| 5911 |
|
| 5912 |
<a name="Definition_of_fl-"></a><a name="Procedure_fl-"></a><a name="index-fl_002d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl-">fl-</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5913 |
|
| 5914 |
|
| 5915 |
<a name="Definition_of_fl/"></a><a name="Procedure_fl/"></a><a name="index-fl_002f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl/">fl/</a></b></code><i> <var>x1</var> <var>x2</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5916 |
|
| 5917 |
|
| 5918 |
<a name="Definition_of_fl%3C"></a><a name="Procedure_fl%3C"></a><a name="index-fl_003c"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%3C">fl<</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5919 |
|
| 5920 |
|
| 5921 |
<a name="Definition_of_fl%3C="></a><a name="Procedure_fl%3C="></a><a name="index-fl_003c_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%3C=">fl<=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5922 |
|
| 5923 |
|
| 5924 |
<a name="Definition_of_fl="></a><a name="Procedure_fl="></a><a name="index-fl_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl=">fl=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5925 |
|
| 5926 |
|
| 5927 |
<a name="Definition_of_fl%3E"></a><a name="Procedure_fl%3E"></a><a name="index-fl_003e"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%3E">fl></a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5928 |
|
| 5929 |
|
| 5930 |
<a name="Definition_of_fl%3E="></a><a name="Procedure_fl%3E="></a><a name="index-fl_003e_003d"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fl%3E=">fl>=</a></b></code><i> <var>x1</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5931 |
|
| 5932 |
|
| 5933 |
<a name="Definition_of_flabs"></a><a name="Procedure_flabs"></a><a name="index-flabs"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flabs">flabs</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5934 |
|
| 5935 |
|
| 5936 |
<a name="Definition_of_flacos"></a><a name="Procedure_flacos"></a><a name="index-flacos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flacos">flacos</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5937 |
|
| 5938 |
|
| 5939 |
<a name="Definition_of_flasin"></a><a name="Procedure_flasin"></a><a name="index-flasin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flasin">flasin</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5940 |
|
| 5941 |
|
| 5942 |
<a name="Definition_of_flatan"></a><a name="Procedure_flatan"></a><a name="index-flatan"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flatan">flatan</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5943 |
<a name="Definition_of_flatan"></a><a name="Procedure_flatan"></a><a name="index-flatan-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flatan">flatan</a></b></code><i> <var>y</var> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5944 |
|
| 5945 |
|
| 5946 |
<a name="Definition_of_flceiling"></a><a name="Procedure_flceiling"></a><a name="index-flceiling"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flceiling">flceiling</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5947 |
|
| 5948 |
|
| 5949 |
<a name="Definition_of_flcos"></a><a name="Procedure_flcos"></a><a name="index-flcos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flcos">flcos</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5950 |
|
| 5951 |
|
| 5952 |
<a name="Definition_of_fldenominator"></a><a name="Procedure_fldenominator"></a><a name="index-fldenominator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fldenominator">fldenominator</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5953 |
|
| 5954 |
|
| 5955 |
<a name="Definition_of_fleven?"></a><a name="Procedure_fleven?"></a><a name="index-fleven_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fleven?">fleven?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5956 |
|
| 5957 |
|
| 5958 |
<a name="Definition_of_flexp"></a><a name="Procedure_flexp"></a><a name="index-flexp"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flexp">flexp</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5959 |
|
| 5960 |
|
| 5961 |
<a name="Definition_of_flexpt"></a><a name="Procedure_flexpt"></a><a name="index-flexpt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flexpt">flexpt</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5962 |
|
| 5963 |
|
| 5964 |
<a name="Definition_of_flfinite?"></a><a name="Procedure_flfinite?"></a><a name="index-flfinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flfinite?">flfinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5965 |
|
| 5966 |
|
| 5967 |
<a name="Definition_of_flfloor"></a><a name="Procedure_flfloor"></a><a name="index-flfloor"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flfloor">flfloor</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5968 |
|
| 5969 |
|
| 5970 |
<a name="Definition_of_flinfinite?"></a><a name="Procedure_flinfinite?"></a><a name="index-flinfinite_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flinfinite?">flinfinite?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5971 |
|
| 5972 |
|
| 5973 |
<a name="Definition_of_flinteger?"></a><a name="Procedure_flinteger?"></a><a name="index-flinteger_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flinteger?">flinteger?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5974 |
|
| 5975 |
|
| 5976 |
<a name="Definition_of_fllog"></a><a name="Procedure_fllog"></a><a name="index-fllog"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fllog">fllog</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5977 |
|
| 5978 |
|
| 5979 |
<a name="Definition_of_flmax"></a><a name="Procedure_flmax"></a><a name="index-flmax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flmax">flmax</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5980 |
|
| 5981 |
|
| 5982 |
<a name="Definition_of_flmin"></a><a name="Procedure_flmin"></a><a name="index-flmin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flmin">flmin</a></b></code><i> <var>x1</var> <var>x2</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5983 |
|
| 5984 |
|
| 5985 |
<a name="Definition_of_flnan?"></a><a name="Procedure_flnan?"></a><a name="index-flnan_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flnan?">flnan?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5986 |
|
| 5987 |
|
| 5988 |
<a name="Definition_of_flnegative?"></a><a name="Procedure_flnegative?"></a><a name="index-flnegative_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flnegative?">flnegative?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5989 |
|
| 5990 |
|
| 5991 |
<a name="Definition_of_flnumerator"></a><a name="Procedure_flnumerator"></a><a name="index-flnumerator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flnumerator">flnumerator</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5992 |
|
| 5993 |
|
| 5994 |
<a name="Definition_of_flodd?"></a><a name="Procedure_flodd?"></a><a name="index-flodd_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flodd?">flodd?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5995 |
|
| 5996 |
|
| 5997 |
<a name="Definition_of_flpositive?"></a><a name="Procedure_flpositive?"></a><a name="index-flpositive_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flpositive?">flpositive?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 5998 |
|
| 5999 |
|
| 6000 |
<a name="Definition_of_flround"></a><a name="Procedure_flround"></a><a name="index-flround"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flround">flround</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6001 |
|
| 6002 |
|
| 6003 |
<a name="Definition_of_flsin"></a><a name="Procedure_flsin"></a><a name="index-flsin"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flsin">flsin</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6004 |
|
| 6005 |
|
| 6006 |
<a name="Definition_of_flsqrt"></a><a name="Procedure_flsqrt"></a><a name="index-flsqrt"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flsqrt">flsqrt</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6007 |
|
| 6008 |
|
| 6009 |
<a name="Definition_of_fltan"></a><a name="Procedure_fltan"></a><a name="index-fltan"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fltan">fltan</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6010 |
|
| 6011 |
|
| 6012 |
<a name="Definition_of_fltruncate"></a><a name="Procedure_fltruncate"></a><a name="index-fltruncate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_fltruncate">fltruncate</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6013 |
|
| 6014 |
|
| 6015 |
<a name="Definition_of_flzero?"></a><a name="Procedure_flzero?"></a><a name="index-flzero_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_flzero?">flzero?</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6016 |
|
| 6017 |
|
| 6018 |
<a name="Pseudo-random-numbers"></a><hr size="6"><br/><br/><br/> |
| 6019 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6020 |
<tr><td valign="middle" align="left"><a href="#Flonum-specific-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6021 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6022 |
<td valign="middle" align="left"> </td> |
| 6023 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6024 |
<td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6025 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6026 |
<td valign="middle" align="left"> </td> |
| 6027 |
<td valign="middle" align="left"> </td> |
| 6028 |
<td valign="middle" align="left"> </td> |
| 6029 |
<td valign="middle" align="left"> </td> |
| 6030 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6031 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6032 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6033 |
</tr></table> |
| 6034 |
<a name="Pseudo-random-numbers-1"></a> |
| 6035 |
<h2 class="section">9.7 Pseudo random numbers</h2> |
| 6036 |
|
| 6037 |
<p>The procedures and variables defined in this section are compatible |
| 6038 |
with the “Sources of Random Bits SRFI” (SRFI 27). The |
| 6039 |
implementation is based on Pierre L’Ecuyer’s MRG32k3a pseudo random |
| 6040 |
number generator. At the heart of SRFI 27’s interface is the random |
| 6041 |
source type which encapsulates the state of a pseudo random number |
| 6042 |
generator. The state of a random source object changes every time a |
| 6043 |
pseudo random number is generated from this random source object. |
| 6044 |
</p> |
| 6045 |
<a name="Definition_of_default-random-source"></a><a name="Variable_default-random-source"></a><a name="index-default_002drandom_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Variable_default-random-source">default-random-source</a></b></code><code>)</code></td><td align="right">variable</td></tr></table> |
| 6046 |
|
| 6047 |
<p>The global variable <code>default-random-source</code> is bound to the |
| 6048 |
random source object which is used by the <code>random-integer</code>, |
| 6049 |
<code>random-real</code>, <code>random-u8vector</code> and <code>random-f64vector</code> |
| 6050 |
procedures. |
| 6051 |
</p> |
| 6052 |
|
| 6053 |
|
| 6054 |
<a name="Definition_of_random-integer"></a><a name="Procedure_random-integer"></a><a name="index-random_002dinteger"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-integer">random-integer</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6055 |
|
| 6056 |
<p>This procedure returns a pseudo random exact integer in the range 0 to |
| 6057 |
<var>n</var>-1. The random source object in the global variable |
| 6058 |
<code>default-random-source</code> is used to generate this number. The |
| 6059 |
parameter <var>n</var> must be a positive exact integer. |
| 6060 |
</p> |
| 6061 |
<p>For example: |
| 6062 |
</p> |
| 6063 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-integer 100)</b> |
| 6064 |
24 |
| 6065 |
> <b>(random-integer 100)</b> |
| 6066 |
2 |
| 6067 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6068 |
6143360270902284438072426748425263488507 |
| 6069 |
</pre></td></tr></table> |
| 6070 |
|
| 6071 |
|
| 6072 |
|
| 6073 |
<a name="Definition_of_random-real"></a><a name="Procedure_random-real"></a><a name="index-random_002dreal"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-real">random-real</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6074 |
|
| 6075 |
<p>This procedure returns a pseudo random inexact real between, but not |
| 6076 |
including, 0 and 1. The random source object in the global variable |
| 6077 |
<code>default-random-source</code> is used to generate this number. |
| 6078 |
</p> |
| 6079 |
<p>For example: |
| 6080 |
</p> |
| 6081 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-real)</b> |
| 6082 |
.24230672079133753 |
| 6083 |
> <b>(random-real)</b> |
| 6084 |
.02317001922506932 |
| 6085 |
</pre></td></tr></table> |
| 6086 |
|
| 6087 |
|
| 6088 |
|
| 6089 |
<a name="Definition_of_random-u8vector"></a><a name="Procedure_random-u8vector"></a><a name="index-random_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-u8vector">random-u8vector</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6090 |
|
| 6091 |
<p>This procedure returns a u8vector of length <var>n</var> containing pseudo |
| 6092 |
random exact integers in the range 0 to 255. The random source object |
| 6093 |
in the global variable <code>default-random-source</code> is used to |
| 6094 |
generate these numbers. The parameter <var>n</var> must be a nonnegative |
| 6095 |
exact integer. |
| 6096 |
</p> |
| 6097 |
<p>For example: |
| 6098 |
</p> |
| 6099 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-u8vector 10)</b> |
| 6100 |
#u8(200 53 29 202 3 85 208 187 73 219) |
| 6101 |
</pre></td></tr></table> |
| 6102 |
|
| 6103 |
|
| 6104 |
|
| 6105 |
<a name="Definition_of_random-f64vector"></a><a name="Procedure_random-f64vector"></a><a name="index-random_002df64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-f64vector">random-f64vector</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6106 |
|
| 6107 |
<p>This procedure returns a f64vector of length <var>n</var> containing pseudo |
| 6108 |
random inexact reals between, but not including, 0 and 1. The random |
| 6109 |
source object in the global variable <code>default-random-source</code> is |
| 6110 |
used to generate these numbers. The parameter <var>n</var> must be a nonnegative |
| 6111 |
exact integer. |
| 6112 |
</p> |
| 6113 |
<p>For example: |
| 6114 |
</p> |
| 6115 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-f64vector 3)</b> |
| 6116 |
#f64(.7145854494613069 .47089632669147946 .5400124875182746) |
| 6117 |
</pre></td></tr></table> |
| 6118 |
|
| 6119 |
|
| 6120 |
|
| 6121 |
<a name="Definition_of_make-random-source"></a><a name="Procedure_make-random-source"></a><a name="index-make_002drandom_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-random-source">make-random-source</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6122 |
|
| 6123 |
<p>This procedure returns a new random source object initialized to a |
| 6124 |
predetermined state (to initialize to a pseudo random state the |
| 6125 |
procedure <code>random-source-randomize!</code> should be called). |
| 6126 |
</p> |
| 6127 |
<p>For example: |
| 6128 |
</p> |
| 6129 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b> |
| 6130 |
> <b>((random-source-make-integers rs) 10000000)</b> |
| 6131 |
8583952 |
| 6132 |
</pre></td></tr></table> |
| 6133 |
|
| 6134 |
|
| 6135 |
|
| 6136 |
<a name="Definition_of_random-source?"></a><a name="Procedure_random-source?"></a><a name="index-random_002dsource_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source?">random-source?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6137 |
|
| 6138 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a random source |
| 6139 |
object and <code>#f</code> otherwise. |
| 6140 |
</p> |
| 6141 |
<p>For example: |
| 6142 |
</p> |
| 6143 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(random-source? default-random-source)</b> |
| 6144 |
#t |
| 6145 |
> <b>(random-source? 123)</b> |
| 6146 |
#f |
| 6147 |
</pre></td></tr></table> |
| 6148 |
|
| 6149 |
|
| 6150 |
|
| 6151 |
<a name="Definition_of_random-source-state-ref"></a><a name="Procedure_random-source-state-ref"></a><a name="index-random_002dsource_002dstate_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-state-ref">random-source-state-ref</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6152 |
<a name="Definition_of_random-source-state-set!"></a><a name="Procedure_random-source-state-set!"></a><a name="index-random_002dsource_002dstate_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-state-set!">random-source-state-set!</a></b></code><i> <var>random-source</var> <var>state</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6153 |
|
| 6154 |
<p>The procedure <code>random-source-state-ref</code> extracts the state of |
| 6155 |
the random source object <var>random-source</var> and returns a vector |
| 6156 |
containing the state. |
| 6157 |
</p> |
| 6158 |
<p>The procedure <code>random-source-state-set!</code> restores the state of |
| 6159 |
the random source object <var>random-source</var> to <var>state</var> which must |
| 6160 |
be a vector returned from a call to the procedure |
| 6161 |
<code>random-source-state-ref</code>. |
| 6162 |
</p> |
| 6163 |
<p>For example: |
| 6164 |
</p> |
| 6165 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (random-source-state-ref default-random-source))</b> |
| 6166 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6167 |
7583880188903074396261960585615270693321 |
| 6168 |
> <b>(random-source-state-set! default-random-source s)</b> |
| 6169 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6170 |
7583880188903074396261960585615270693321 |
| 6171 |
</pre></td></tr></table> |
| 6172 |
|
| 6173 |
|
| 6174 |
|
| 6175 |
<a name="Definition_of_random-source-randomize!"></a><a name="Procedure_random-source-randomize!"></a><a name="index-random_002dsource_002drandomize_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-randomize!">random-source-randomize!</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6176 |
<a name="Definition_of_random-source-pseudo-randomize!"></a><a name="Procedure_random-source-pseudo-randomize!"></a><a name="index-random_002dsource_002dpseudo_002drandomize_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-pseudo-randomize!">random-source-pseudo-randomize!</a></b></code><i> <var>random-source</var> <var>i</var> <var>j</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6177 |
|
| 6178 |
<p>These procedures change the state of the random source object |
| 6179 |
<var>random-source</var>. The procedure <code>random-source-randomize!</code> |
| 6180 |
sets the random source object to a state that depends on the current |
| 6181 |
time (which for typical uses can be considered to randomly initialize |
| 6182 |
the state). The procedure <code>random-source-pseudo-randomize!</code> |
| 6183 |
sets the random source object to a state that is determined only by |
| 6184 |
the current state and the nonnegative exact integers <var>i</var> and |
| 6185 |
<var>j</var>. For both procedures the value returned is unspecified. |
| 6186 |
</p> |
| 6187 |
<p>For example: |
| 6188 |
</p> |
| 6189 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (random-source-state-ref default-random-source))</b> |
| 6190 |
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b> |
| 6191 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6192 |
9816755163910623041601722050112674079767 |
| 6193 |
> <b>(random-source-state-set! default-random-source s)</b> |
| 6194 |
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b> |
| 6195 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6196 |
9816755163910623041601722050112674079767 |
| 6197 |
> <b>(random-source-pseudo-randomize! default-random-source 5 99)</b> |
| 6198 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6199 |
9816755163910623041601722050112674079767 |
| 6200 |
> <b>(random-source-state-set! default-random-source s)</b> |
| 6201 |
> <b>(random-source-randomize! default-random-source)</b> |
| 6202 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6203 |
2271441220851914333384493143687768110622 |
| 6204 |
> <b>(random-source-state-set! default-random-source s)</b> |
| 6205 |
> <b>(random-source-randomize! default-random-source)</b> |
| 6206 |
> <b>(random-integer 10000000000000000000000000000000000000000)</b> |
| 6207 |
6247966138948323029033944059178072366895 |
| 6208 |
</pre></td></tr></table> |
| 6209 |
|
| 6210 |
|
| 6211 |
|
| 6212 |
<a name="Definition_of_random-source-make-integers"></a><a name="Procedure_random-source-make-integers"></a><a name="index-random_002dsource_002dmake_002dintegers"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-make-integers">random-source-make-integers</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6213 |
|
| 6214 |
<p>This procedure returns a procedure for generating pseudo random exact |
| 6215 |
integers using the random source object <var>random-source</var>. The |
| 6216 |
returned procedure accepts a single parameter <var>n</var>, a positive |
| 6217 |
exact integer, and returns a pseudo random exact integer in the range |
| 6218 |
0 to <var>n</var>-1. |
| 6219 |
</p> |
| 6220 |
<p>For example: |
| 6221 |
</p> |
| 6222 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b> |
| 6223 |
> <b>(define ri (random-source-make-integers rs))</b> |
| 6224 |
> <b>(ri 10000000)</b> |
| 6225 |
8583952 |
| 6226 |
> <b>(ri 10000000)</b> |
| 6227 |
2879793 |
| 6228 |
</pre></td></tr></table> |
| 6229 |
|
| 6230 |
|
| 6231 |
|
| 6232 |
<a name="Definition_of_random-source-make-reals"></a><a name="Procedure_random-source-make-reals"></a><a name="index-random_002dsource_002dmake_002dreals"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-make-reals">random-source-make-reals</a></b></code><i> <var>random-source</var> <span class="roman">[</span><var>precision</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6233 |
|
| 6234 |
<p>This procedure returns a procedure for generating pseudo random |
| 6235 |
inexact reals using the random source object <var>random-source</var>. The |
| 6236 |
returned procedure accepts no parameters and returns a pseudo random |
| 6237 |
inexact real between, but not including, 0 and 1. The optional parameter |
| 6238 |
<var>precision</var> specifies an upper bound on the minimum amount by which two |
| 6239 |
generated pseudo-random numbers can be separated. |
| 6240 |
</p> |
| 6241 |
<p>For example: |
| 6242 |
</p> |
| 6243 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b> |
| 6244 |
> <b>(define rr (random-source-make-reals rs))</b> |
| 6245 |
> <b>(rr)</b> |
| 6246 |
.857402537562821 |
| 6247 |
> <b>(rr)</b> |
| 6248 |
.2876463473845367 |
| 6249 |
</pre></td></tr></table> |
| 6250 |
|
| 6251 |
|
| 6252 |
|
| 6253 |
<a name="Definition_of_random-source-make-u8vectors"></a><a name="Procedure_random-source-make-u8vectors"></a><a name="index-random_002dsource_002dmake_002du8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-make-u8vectors">random-source-make-u8vectors</a></b></code><i> <var>random-source</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6254 |
|
| 6255 |
<p>This procedure returns a procedure for generating pseudo random |
| 6256 |
u8vectors using the random source object <var>random-source</var>. The |
| 6257 |
returned procedure accepts a single parameter <var>n</var>, a nonnegative |
| 6258 |
exact integer, and returns a u8vector of length <var>n</var> containing |
| 6259 |
pseudo random exact integers in the range 0 to 255. |
| 6260 |
</p> |
| 6261 |
<p>For example: |
| 6262 |
</p> |
| 6263 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b> |
| 6264 |
> <b>(define rv (random-source-make-u8vectors rs))</b> |
| 6265 |
> <b>(rv 10)</b> |
| 6266 |
#u8(200 53 29 202 3 85 208 187 73 219) |
| 6267 |
> <b>(rv 10)</b> |
| 6268 |
#u8(113 8 182 120 138 103 53 192 40 176) |
| 6269 |
</pre></td></tr></table> |
| 6270 |
|
| 6271 |
|
| 6272 |
|
| 6273 |
<a name="Definition_of_random-source-make-f64vectors"></a><a name="Procedure_random-source-make-f64vectors"></a><a name="index-random_002dsource_002dmake_002df64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_random-source-make-f64vectors">random-source-make-f64vectors</a></b></code><i> <var>random-source</var> <span class="roman">[</span><var>precision</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6274 |
|
| 6275 |
<p>This procedure returns a procedure for generating pseudo random |
| 6276 |
f64vectors using the random source object <var>random-source</var>. The |
| 6277 |
returned procedure accepts a single parameter <var>n</var>, a nonnegative |
| 6278 |
exact integer, and returns an f64vector of length <var>n</var> containing |
| 6279 |
pseudo random inexact reals between, but not including, 0 and 1. |
| 6280 |
The optional parameter <var>precision</var> specifies an upper bound on the |
| 6281 |
minimum amount by which two generated pseudo-random numbers can be separated. |
| 6282 |
</p> |
| 6283 |
<p>For example: |
| 6284 |
</p> |
| 6285 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rs (make-random-source))</b> |
| 6286 |
> <b>(define rv (random-source-make-f64vectors rs))</b> |
| 6287 |
> <b>(rv 3)</b> |
| 6288 |
#f64(.7342236104231586 .2876463473845367 .8574025375628211) |
| 6289 |
> <b>(rv 3)</b> |
| 6290 |
#f64(.013863292728449427 .33449296573515447 .8162050798467028) |
| 6291 |
</pre></td></tr></table> |
| 6292 |
|
| 6293 |
|
| 6294 |
|
| 6295 |
<a name="Homogeneous-vectors"></a><hr size="6"><br/><br/><br/> |
| 6296 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6297 |
<tr><td valign="middle" align="left"><a href="#Pseudo-random-numbers" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6298 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6299 |
<td valign="middle" align="left"> </td> |
| 6300 |
<td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6301 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6302 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6303 |
<td valign="middle" align="left"> </td> |
| 6304 |
<td valign="middle" align="left"> </td> |
| 6305 |
<td valign="middle" align="left"> </td> |
| 6306 |
<td valign="middle" align="left"> </td> |
| 6307 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6308 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6309 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6310 |
</tr></table> |
| 6311 |
<a name="Homogeneous-vectors-1"></a> |
| 6312 |
<h1 class="chapter">10. Homogeneous vectors</h1> |
| 6313 |
<a name="index-homogeneous-vectors"></a> |
| 6314 |
|
| 6315 |
<p>Homogeneous vectors are vectors containing raw numbers of the same |
| 6316 |
type (signed or unsigned exact integers or inexact reals). There are |
| 6317 |
10 types of homogeneous vectors: |
| 6318 |
‘<samp>s8vector</samp>’ (vector of exact integers in the range -2^7 to 2^7-1), |
| 6319 |
‘<samp>u8vector</samp>’ (vector of exact integers in the range 0 to 2^8-1), |
| 6320 |
‘<samp>s16vector</samp>’ (vector of exact integers in the range -2^15 to 2^15-1), |
| 6321 |
‘<samp>u16vector</samp>’ (vector of exact integers in the range 0 to 2^16-1), |
| 6322 |
‘<samp>s32vector</samp>’ (vector of exact integers in the range -2^31 to 2^31-1), |
| 6323 |
‘<samp>u32vector</samp>’ (vector of exact integers in the range 0 to 2^32-1), |
| 6324 |
‘<samp>s64vector</samp>’ (vector of exact integers in the range -2^63 to 2^63-1), |
| 6325 |
‘<samp>u64vector</samp>’ (vector of exact integers in the range 0 to 2^64-1), |
| 6326 |
‘<samp>f32vector</samp>’ (vector of 32 bit floating point numbers), |
| 6327 |
and ‘<samp>f64vector</samp>’ (vector of 64 bit floating point numbers). |
| 6328 |
</p> |
| 6329 |
<p>The lexical syntax of homogeneous vectors is specified in |
| 6330 |
<a href="#Homogeneous-vector-syntax">Homogeneous vector syntax</a>. |
| 6331 |
</p> |
| 6332 |
<p>The procedures available for homogeneous vectors, listed below, are |
| 6333 |
the analog of the normal vector/string procedures for each of the |
| 6334 |
homogeneous vector types. |
| 6335 |
</p> |
| 6336 |
<a name="Definition_of_s8vector?"></a><a name="Procedure_s8vector?"></a><a name="index-s8vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector?">s8vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6337 |
<a name="Definition_of_make-s8vector"></a><a name="Procedure_make-s8vector"></a><a name="index-make_002ds8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-s8vector">make-s8vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6338 |
<a name="Definition_of_s8vector"></a><a name="Procedure_s8vector"></a><a name="index-s8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector">s8vector</a></b></code><i> <var>exact-int8</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6339 |
<a name="Definition_of_s8vector-length"></a><a name="Procedure_s8vector-length"></a><a name="index-s8vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-length">s8vector-length</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6340 |
<a name="Definition_of_s8vector-ref"></a><a name="Procedure_s8vector-ref"></a><a name="index-s8vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-ref">s8vector-ref</a></b></code><i> <var>s8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6341 |
<a name="Definition_of_s8vector-set!"></a><a name="Procedure_s8vector-set!"></a><a name="index-s8vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-set!">s8vector-set!</a></b></code><i> <var>s8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6342 |
<a name="Definition_of_s8vector-%3Elist"></a><a name="Procedure_s8vector-%3Elist"></a><a name="index-s8vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-%3Elist">s8vector->list</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6343 |
<a name="Definition_of_list-%3Es8vector"></a><a name="Procedure_list-%3Es8vector"></a><a name="index-list_002d_003es8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Es8vector">list->s8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6344 |
<a name="Definition_of_s8vector-fill!"></a><a name="Procedure_s8vector-fill!"></a><a name="index-s8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-fill!">s8vector-fill!</a></b></code><i> <var>s8vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6345 |
<a name="Definition_of_subs8vector-fill!"></a><a name="Procedure_subs8vector-fill!"></a><a name="index-subs8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs8vector-fill!">subs8vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6346 |
<a name="Definition_of_append-s8vectors"></a><a name="Procedure_append-s8vectors"></a><a name="index-append_002ds8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-s8vectors">append-s8vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6347 |
<a name="Definition_of_s8vector-copy"></a><a name="Procedure_s8vector-copy"></a><a name="index-s8vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-copy">s8vector-copy</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6348 |
<a name="Definition_of_s8vector-append"></a><a name="Procedure_s8vector-append"></a><a name="index-s8vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-append">s8vector-append</a></b></code><i> <var>s8vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6349 |
<a name="Definition_of_subs8vector"></a><a name="Procedure_subs8vector"></a><a name="index-subs8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs8vector">subs8vector</a></b></code><i> <var>s8vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6350 |
<a name="Definition_of_subs8vector-move!"></a><a name="Procedure_subs8vector-move!"></a><a name="index-subs8vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs8vector-move!">subs8vector-move!</a></b></code><i> <var>src-s8vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s8vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6351 |
<a name="Definition_of_s8vector-shrink!"></a><a name="Procedure_s8vector-shrink!"></a><a name="index-s8vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s8vector-shrink!">s8vector-shrink!</a></b></code><i> <var>s8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6352 |
|
| 6353 |
|
| 6354 |
<a name="Definition_of_u8vector?"></a><a name="Procedure_u8vector?"></a><a name="index-u8vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector?">u8vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6355 |
<a name="Definition_of_make-u8vector"></a><a name="Procedure_make-u8vector"></a><a name="index-make_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-u8vector">make-u8vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6356 |
<a name="Definition_of_u8vector"></a><a name="Procedure_u8vector"></a><a name="index-u8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector">u8vector</a></b></code><i> <var>exact-int8</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6357 |
<a name="Definition_of_u8vector-length"></a><a name="Procedure_u8vector-length"></a><a name="index-u8vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-length">u8vector-length</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6358 |
<a name="Definition_of_u8vector-ref"></a><a name="Procedure_u8vector-ref"></a><a name="index-u8vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-ref">u8vector-ref</a></b></code><i> <var>u8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6359 |
<a name="Definition_of_u8vector-set!"></a><a name="Procedure_u8vector-set!"></a><a name="index-u8vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-set!">u8vector-set!</a></b></code><i> <var>u8vector</var> <var>k</var> <var>exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6360 |
<a name="Definition_of_u8vector-%3Elist"></a><a name="Procedure_u8vector-%3Elist"></a><a name="index-u8vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-%3Elist">u8vector->list</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6361 |
<a name="Definition_of_list-%3Eu8vector"></a><a name="Procedure_list-%3Eu8vector"></a><a name="index-list_002d_003eu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Eu8vector">list->u8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6362 |
<a name="Definition_of_u8vector-fill!"></a><a name="Procedure_u8vector-fill!"></a><a name="index-u8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-fill!">u8vector-fill!</a></b></code><i> <var>u8vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6363 |
<a name="Definition_of_subu8vector-fill!"></a><a name="Procedure_subu8vector-fill!"></a><a name="index-subu8vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu8vector-fill!">subu8vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6364 |
<a name="Definition_of_append-u8vectors"></a><a name="Procedure_append-u8vectors"></a><a name="index-append_002du8vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-u8vectors">append-u8vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6365 |
<a name="Definition_of_u8vector-copy"></a><a name="Procedure_u8vector-copy"></a><a name="index-u8vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-copy">u8vector-copy</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6366 |
<a name="Definition_of_u8vector-append"></a><a name="Procedure_u8vector-append"></a><a name="index-u8vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-append">u8vector-append</a></b></code><i> <var>u8vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6367 |
<a name="Definition_of_subu8vector"></a><a name="Procedure_subu8vector"></a><a name="index-subu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu8vector">subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6368 |
<a name="Definition_of_subu8vector-move!"></a><a name="Procedure_subu8vector-move!"></a><a name="index-subu8vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu8vector-move!">subu8vector-move!</a></b></code><i> <var>src-u8vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u8vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6369 |
<a name="Definition_of_u8vector-shrink!"></a><a name="Procedure_u8vector-shrink!"></a><a name="index-u8vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-shrink!">u8vector-shrink!</a></b></code><i> <var>u8vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6370 |
|
| 6371 |
|
| 6372 |
<a name="Definition_of_s16vector?"></a><a name="Procedure_s16vector?"></a><a name="index-s16vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector?">s16vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6373 |
<a name="Definition_of_make-s16vector"></a><a name="Procedure_make-s16vector"></a><a name="index-make_002ds16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-s16vector">make-s16vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6374 |
<a name="Definition_of_s16vector"></a><a name="Procedure_s16vector"></a><a name="index-s16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector">s16vector</a></b></code><i> <var>exact-int16</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6375 |
<a name="Definition_of_s16vector-length"></a><a name="Procedure_s16vector-length"></a><a name="index-s16vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-length">s16vector-length</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6376 |
<a name="Definition_of_s16vector-ref"></a><a name="Procedure_s16vector-ref"></a><a name="index-s16vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-ref">s16vector-ref</a></b></code><i> <var>s16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6377 |
<a name="Definition_of_s16vector-set!"></a><a name="Procedure_s16vector-set!"></a><a name="index-s16vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-set!">s16vector-set!</a></b></code><i> <var>s16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6378 |
<a name="Definition_of_s16vector-%3Elist"></a><a name="Procedure_s16vector-%3Elist"></a><a name="index-s16vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-%3Elist">s16vector->list</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6379 |
<a name="Definition_of_list-%3Es16vector"></a><a name="Procedure_list-%3Es16vector"></a><a name="index-list_002d_003es16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Es16vector">list->s16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6380 |
<a name="Definition_of_s16vector-fill!"></a><a name="Procedure_s16vector-fill!"></a><a name="index-s16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-fill!">s16vector-fill!</a></b></code><i> <var>s16vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6381 |
<a name="Definition_of_subs16vector-fill!"></a><a name="Procedure_subs16vector-fill!"></a><a name="index-subs16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs16vector-fill!">subs16vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6382 |
<a name="Definition_of_append-s16vectors"></a><a name="Procedure_append-s16vectors"></a><a name="index-append_002ds16vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-s16vectors">append-s16vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6383 |
<a name="Definition_of_s16vector-copy"></a><a name="Procedure_s16vector-copy"></a><a name="index-s16vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-copy">s16vector-copy</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6384 |
<a name="Definition_of_s16vector-append"></a><a name="Procedure_s16vector-append"></a><a name="index-s16vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-append">s16vector-append</a></b></code><i> <var>s16vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6385 |
<a name="Definition_of_subs16vector"></a><a name="Procedure_subs16vector"></a><a name="index-subs16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs16vector">subs16vector</a></b></code><i> <var>s16vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6386 |
<a name="Definition_of_subs16vector-move!"></a><a name="Procedure_subs16vector-move!"></a><a name="index-subs16vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs16vector-move!">subs16vector-move!</a></b></code><i> <var>src-s16vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s16vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6387 |
<a name="Definition_of_s16vector-shrink!"></a><a name="Procedure_s16vector-shrink!"></a><a name="index-s16vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s16vector-shrink!">s16vector-shrink!</a></b></code><i> <var>s16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6388 |
|
| 6389 |
|
| 6390 |
<a name="Definition_of_u16vector?"></a><a name="Procedure_u16vector?"></a><a name="index-u16vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector?">u16vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6391 |
<a name="Definition_of_make-u16vector"></a><a name="Procedure_make-u16vector"></a><a name="index-make_002du16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-u16vector">make-u16vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6392 |
<a name="Definition_of_u16vector"></a><a name="Procedure_u16vector"></a><a name="index-u16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector">u16vector</a></b></code><i> <var>exact-int16</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6393 |
<a name="Definition_of_u16vector-length"></a><a name="Procedure_u16vector-length"></a><a name="index-u16vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-length">u16vector-length</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6394 |
<a name="Definition_of_u16vector-ref"></a><a name="Procedure_u16vector-ref"></a><a name="index-u16vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-ref">u16vector-ref</a></b></code><i> <var>u16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6395 |
<a name="Definition_of_u16vector-set!"></a><a name="Procedure_u16vector-set!"></a><a name="index-u16vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-set!">u16vector-set!</a></b></code><i> <var>u16vector</var> <var>k</var> <var>exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6396 |
<a name="Definition_of_u16vector-%3Elist"></a><a name="Procedure_u16vector-%3Elist"></a><a name="index-u16vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-%3Elist">u16vector->list</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6397 |
<a name="Definition_of_list-%3Eu16vector"></a><a name="Procedure_list-%3Eu16vector"></a><a name="index-list_002d_003eu16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Eu16vector">list->u16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6398 |
<a name="Definition_of_u16vector-fill!"></a><a name="Procedure_u16vector-fill!"></a><a name="index-u16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-fill!">u16vector-fill!</a></b></code><i> <var>u16vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6399 |
<a name="Definition_of_subu16vector-fill!"></a><a name="Procedure_subu16vector-fill!"></a><a name="index-subu16vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu16vector-fill!">subu16vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6400 |
<a name="Definition_of_append-u16vectors"></a><a name="Procedure_append-u16vectors"></a><a name="index-append_002du16vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-u16vectors">append-u16vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6401 |
<a name="Definition_of_u16vector-copy"></a><a name="Procedure_u16vector-copy"></a><a name="index-u16vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-copy">u16vector-copy</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6402 |
<a name="Definition_of_u16vector-append"></a><a name="Procedure_u16vector-append"></a><a name="index-u16vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-append">u16vector-append</a></b></code><i> <var>u16vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6403 |
<a name="Definition_of_subu16vector"></a><a name="Procedure_subu16vector"></a><a name="index-subu16vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu16vector">subu16vector</a></b></code><i> <var>u16vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6404 |
<a name="Definition_of_subu16vector-move!"></a><a name="Procedure_subu16vector-move!"></a><a name="index-subu16vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu16vector-move!">subu16vector-move!</a></b></code><i> <var>src-u16vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u16vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6405 |
<a name="Definition_of_u16vector-shrink!"></a><a name="Procedure_u16vector-shrink!"></a><a name="index-u16vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u16vector-shrink!">u16vector-shrink!</a></b></code><i> <var>u16vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6406 |
|
| 6407 |
|
| 6408 |
<a name="Definition_of_s32vector?"></a><a name="Procedure_s32vector?"></a><a name="index-s32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector?">s32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6409 |
<a name="Definition_of_make-s32vector"></a><a name="Procedure_make-s32vector"></a><a name="index-make_002ds32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-s32vector">make-s32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6410 |
<a name="Definition_of_s32vector"></a><a name="Procedure_s32vector"></a><a name="index-s32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector">s32vector</a></b></code><i> <var>exact-int32</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6411 |
<a name="Definition_of_s32vector-length"></a><a name="Procedure_s32vector-length"></a><a name="index-s32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-length">s32vector-length</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6412 |
<a name="Definition_of_s32vector-ref"></a><a name="Procedure_s32vector-ref"></a><a name="index-s32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-ref">s32vector-ref</a></b></code><i> <var>s32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6413 |
<a name="Definition_of_s32vector-set!"></a><a name="Procedure_s32vector-set!"></a><a name="index-s32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-set!">s32vector-set!</a></b></code><i> <var>s32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6414 |
<a name="Definition_of_s32vector-%3Elist"></a><a name="Procedure_s32vector-%3Elist"></a><a name="index-s32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-%3Elist">s32vector->list</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6415 |
<a name="Definition_of_list-%3Es32vector"></a><a name="Procedure_list-%3Es32vector"></a><a name="index-list_002d_003es32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Es32vector">list->s32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6416 |
<a name="Definition_of_s32vector-fill!"></a><a name="Procedure_s32vector-fill!"></a><a name="index-s32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-fill!">s32vector-fill!</a></b></code><i> <var>s32vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6417 |
<a name="Definition_of_subs32vector-fill!"></a><a name="Procedure_subs32vector-fill!"></a><a name="index-subs32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs32vector-fill!">subs32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6418 |
<a name="Definition_of_append-s32vectors"></a><a name="Procedure_append-s32vectors"></a><a name="index-append_002ds32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-s32vectors">append-s32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6419 |
<a name="Definition_of_s32vector-copy"></a><a name="Procedure_s32vector-copy"></a><a name="index-s32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-copy">s32vector-copy</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6420 |
<a name="Definition_of_s32vector-append"></a><a name="Procedure_s32vector-append"></a><a name="index-s32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-append">s32vector-append</a></b></code><i> <var>s32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6421 |
<a name="Definition_of_subs32vector"></a><a name="Procedure_subs32vector"></a><a name="index-subs32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs32vector">subs32vector</a></b></code><i> <var>s32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6422 |
<a name="Definition_of_subs32vector-move!"></a><a name="Procedure_subs32vector-move!"></a><a name="index-subs32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs32vector-move!">subs32vector-move!</a></b></code><i> <var>src-s32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6423 |
<a name="Definition_of_s32vector-shrink!"></a><a name="Procedure_s32vector-shrink!"></a><a name="index-s32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s32vector-shrink!">s32vector-shrink!</a></b></code><i> <var>s32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6424 |
|
| 6425 |
|
| 6426 |
<a name="Definition_of_u32vector?"></a><a name="Procedure_u32vector?"></a><a name="index-u32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector?">u32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6427 |
<a name="Definition_of_make-u32vector"></a><a name="Procedure_make-u32vector"></a><a name="index-make_002du32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-u32vector">make-u32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6428 |
<a name="Definition_of_u32vector"></a><a name="Procedure_u32vector"></a><a name="index-u32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector">u32vector</a></b></code><i> <var>exact-int32</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6429 |
<a name="Definition_of_u32vector-length"></a><a name="Procedure_u32vector-length"></a><a name="index-u32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-length">u32vector-length</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6430 |
<a name="Definition_of_u32vector-ref"></a><a name="Procedure_u32vector-ref"></a><a name="index-u32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-ref">u32vector-ref</a></b></code><i> <var>u32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6431 |
<a name="Definition_of_u32vector-set!"></a><a name="Procedure_u32vector-set!"></a><a name="index-u32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-set!">u32vector-set!</a></b></code><i> <var>u32vector</var> <var>k</var> <var>exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6432 |
<a name="Definition_of_u32vector-%3Elist"></a><a name="Procedure_u32vector-%3Elist"></a><a name="index-u32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-%3Elist">u32vector->list</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6433 |
<a name="Definition_of_list-%3Eu32vector"></a><a name="Procedure_list-%3Eu32vector"></a><a name="index-list_002d_003eu32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Eu32vector">list->u32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6434 |
<a name="Definition_of_u32vector-fill!"></a><a name="Procedure_u32vector-fill!"></a><a name="index-u32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-fill!">u32vector-fill!</a></b></code><i> <var>u32vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6435 |
<a name="Definition_of_subu32vector-fill!"></a><a name="Procedure_subu32vector-fill!"></a><a name="index-subu32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu32vector-fill!">subu32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6436 |
<a name="Definition_of_append-u32vectors"></a><a name="Procedure_append-u32vectors"></a><a name="index-append_002du32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-u32vectors">append-u32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6437 |
<a name="Definition_of_u32vector-copy"></a><a name="Procedure_u32vector-copy"></a><a name="index-u32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-copy">u32vector-copy</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6438 |
<a name="Definition_of_u32vector-append"></a><a name="Procedure_u32vector-append"></a><a name="index-u32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-append">u32vector-append</a></b></code><i> <var>u32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6439 |
<a name="Definition_of_subu32vector"></a><a name="Procedure_subu32vector"></a><a name="index-subu32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu32vector">subu32vector</a></b></code><i> <var>u32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6440 |
<a name="Definition_of_subu32vector-move!"></a><a name="Procedure_subu32vector-move!"></a><a name="index-subu32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu32vector-move!">subu32vector-move!</a></b></code><i> <var>src-u32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6441 |
<a name="Definition_of_u32vector-shrink!"></a><a name="Procedure_u32vector-shrink!"></a><a name="index-u32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u32vector-shrink!">u32vector-shrink!</a></b></code><i> <var>u32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6442 |
|
| 6443 |
|
| 6444 |
<a name="Definition_of_s64vector?"></a><a name="Procedure_s64vector?"></a><a name="index-s64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector?">s64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6445 |
<a name="Definition_of_make-s64vector"></a><a name="Procedure_make-s64vector"></a><a name="index-make_002ds64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-s64vector">make-s64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6446 |
<a name="Definition_of_s64vector"></a><a name="Procedure_s64vector"></a><a name="index-s64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector">s64vector</a></b></code><i> <var>exact-int64</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6447 |
<a name="Definition_of_s64vector-length"></a><a name="Procedure_s64vector-length"></a><a name="index-s64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-length">s64vector-length</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6448 |
<a name="Definition_of_s64vector-ref"></a><a name="Procedure_s64vector-ref"></a><a name="index-s64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-ref">s64vector-ref</a></b></code><i> <var>s64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6449 |
<a name="Definition_of_s64vector-set!"></a><a name="Procedure_s64vector-set!"></a><a name="index-s64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-set!">s64vector-set!</a></b></code><i> <var>s64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6450 |
<a name="Definition_of_s64vector-%3Elist"></a><a name="Procedure_s64vector-%3Elist"></a><a name="index-s64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-%3Elist">s64vector->list</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6451 |
<a name="Definition_of_list-%3Es64vector"></a><a name="Procedure_list-%3Es64vector"></a><a name="index-list_002d_003es64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Es64vector">list->s64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6452 |
<a name="Definition_of_s64vector-fill!"></a><a name="Procedure_s64vector-fill!"></a><a name="index-s64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-fill!">s64vector-fill!</a></b></code><i> <var>s64vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6453 |
<a name="Definition_of_subs64vector-fill!"></a><a name="Procedure_subs64vector-fill!"></a><a name="index-subs64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs64vector-fill!">subs64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6454 |
<a name="Definition_of_append-s64vectors"></a><a name="Procedure_append-s64vectors"></a><a name="index-append_002ds64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-s64vectors">append-s64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6455 |
<a name="Definition_of_s64vector-copy"></a><a name="Procedure_s64vector-copy"></a><a name="index-s64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-copy">s64vector-copy</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6456 |
<a name="Definition_of_s64vector-append"></a><a name="Procedure_s64vector-append"></a><a name="index-s64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-append">s64vector-append</a></b></code><i> <var>s64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6457 |
<a name="Definition_of_subs64vector"></a><a name="Procedure_subs64vector"></a><a name="index-subs64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs64vector">subs64vector</a></b></code><i> <var>s64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6458 |
<a name="Definition_of_subs64vector-move!"></a><a name="Procedure_subs64vector-move!"></a><a name="index-subs64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subs64vector-move!">subs64vector-move!</a></b></code><i> <var>src-s64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-s64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6459 |
<a name="Definition_of_s64vector-shrink!"></a><a name="Procedure_s64vector-shrink!"></a><a name="index-s64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_s64vector-shrink!">s64vector-shrink!</a></b></code><i> <var>s64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6460 |
|
| 6461 |
|
| 6462 |
<a name="Definition_of_u64vector?"></a><a name="Procedure_u64vector?"></a><a name="index-u64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector?">u64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6463 |
<a name="Definition_of_make-u64vector"></a><a name="Procedure_make-u64vector"></a><a name="index-make_002du64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-u64vector">make-u64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6464 |
<a name="Definition_of_u64vector"></a><a name="Procedure_u64vector"></a><a name="index-u64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector">u64vector</a></b></code><i> <var>exact-int64</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6465 |
<a name="Definition_of_u64vector-length"></a><a name="Procedure_u64vector-length"></a><a name="index-u64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-length">u64vector-length</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6466 |
<a name="Definition_of_u64vector-ref"></a><a name="Procedure_u64vector-ref"></a><a name="index-u64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-ref">u64vector-ref</a></b></code><i> <var>u64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6467 |
<a name="Definition_of_u64vector-set!"></a><a name="Procedure_u64vector-set!"></a><a name="index-u64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-set!">u64vector-set!</a></b></code><i> <var>u64vector</var> <var>k</var> <var>exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6468 |
<a name="Definition_of_u64vector-%3Elist"></a><a name="Procedure_u64vector-%3Elist"></a><a name="index-u64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-%3Elist">u64vector->list</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6469 |
<a name="Definition_of_list-%3Eu64vector"></a><a name="Procedure_list-%3Eu64vector"></a><a name="index-list_002d_003eu64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Eu64vector">list->u64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6470 |
<a name="Definition_of_u64vector-fill!"></a><a name="Procedure_u64vector-fill!"></a><a name="index-u64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-fill!">u64vector-fill!</a></b></code><i> <var>u64vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6471 |
<a name="Definition_of_subu64vector-fill!"></a><a name="Procedure_subu64vector-fill!"></a><a name="index-subu64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu64vector-fill!">subu64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6472 |
<a name="Definition_of_append-u64vectors"></a><a name="Procedure_append-u64vectors"></a><a name="index-append_002du64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-u64vectors">append-u64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6473 |
<a name="Definition_of_u64vector-copy"></a><a name="Procedure_u64vector-copy"></a><a name="index-u64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-copy">u64vector-copy</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6474 |
<a name="Definition_of_u64vector-append"></a><a name="Procedure_u64vector-append"></a><a name="index-u64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-append">u64vector-append</a></b></code><i> <var>u64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6475 |
<a name="Definition_of_subu64vector"></a><a name="Procedure_subu64vector"></a><a name="index-subu64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu64vector">subu64vector</a></b></code><i> <var>u64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6476 |
<a name="Definition_of_subu64vector-move!"></a><a name="Procedure_subu64vector-move!"></a><a name="index-subu64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subu64vector-move!">subu64vector-move!</a></b></code><i> <var>src-u64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-u64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6477 |
<a name="Definition_of_u64vector-shrink!"></a><a name="Procedure_u64vector-shrink!"></a><a name="index-u64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u64vector-shrink!">u64vector-shrink!</a></b></code><i> <var>u64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6478 |
|
| 6479 |
|
| 6480 |
<a name="Definition_of_f32vector?"></a><a name="Procedure_f32vector?"></a><a name="index-f32vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector?">f32vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6481 |
<a name="Definition_of_make-f32vector"></a><a name="Procedure_make-f32vector"></a><a name="index-make_002df32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-f32vector">make-f32vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6482 |
<a name="Definition_of_f32vector"></a><a name="Procedure_f32vector"></a><a name="index-f32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector">f32vector</a></b></code><i> <var>inexact-real</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6483 |
<a name="Definition_of_f32vector-length"></a><a name="Procedure_f32vector-length"></a><a name="index-f32vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-length">f32vector-length</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6484 |
<a name="Definition_of_f32vector-ref"></a><a name="Procedure_f32vector-ref"></a><a name="index-f32vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-ref">f32vector-ref</a></b></code><i> <var>f32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6485 |
<a name="Definition_of_f32vector-set!"></a><a name="Procedure_f32vector-set!"></a><a name="index-f32vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-set!">f32vector-set!</a></b></code><i> <var>f32vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6486 |
<a name="Definition_of_f32vector-%3Elist"></a><a name="Procedure_f32vector-%3Elist"></a><a name="index-f32vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-%3Elist">f32vector->list</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6487 |
<a name="Definition_of_list-%3Ef32vector"></a><a name="Procedure_list-%3Ef32vector"></a><a name="index-list_002d_003ef32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Ef32vector">list->f32vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6488 |
<a name="Definition_of_f32vector-fill!"></a><a name="Procedure_f32vector-fill!"></a><a name="index-f32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-fill!">f32vector-fill!</a></b></code><i> <var>f32vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6489 |
<a name="Definition_of_subf32vector-fill!"></a><a name="Procedure_subf32vector-fill!"></a><a name="index-subf32vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf32vector-fill!">subf32vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6490 |
<a name="Definition_of_append-f32vectors"></a><a name="Procedure_append-f32vectors"></a><a name="index-append_002df32vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-f32vectors">append-f32vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6491 |
<a name="Definition_of_f32vector-copy"></a><a name="Procedure_f32vector-copy"></a><a name="index-f32vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-copy">f32vector-copy</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6492 |
<a name="Definition_of_f32vector-append"></a><a name="Procedure_f32vector-append"></a><a name="index-f32vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-append">f32vector-append</a></b></code><i> <var>f32vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6493 |
<a name="Definition_of_subf32vector"></a><a name="Procedure_subf32vector"></a><a name="index-subf32vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf32vector">subf32vector</a></b></code><i> <var>f32vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6494 |
<a name="Definition_of_subf32vector-move!"></a><a name="Procedure_subf32vector-move!"></a><a name="index-subf32vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf32vector-move!">subf32vector-move!</a></b></code><i> <var>src-f32vector</var> <var>src-start</var> <var>src-end</var> <var>dst-f32vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6495 |
<a name="Definition_of_f32vector-shrink!"></a><a name="Procedure_f32vector-shrink!"></a><a name="index-f32vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f32vector-shrink!">f32vector-shrink!</a></b></code><i> <var>f32vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6496 |
|
| 6497 |
|
| 6498 |
<a name="Definition_of_f64vector?"></a><a name="Procedure_f64vector?"></a><a name="index-f64vector_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector?">f64vector?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6499 |
<a name="Definition_of_make-f64vector"></a><a name="Procedure_make-f64vector"></a><a name="index-make_002df64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-f64vector">make-f64vector</a></b></code><i> <var>k</var> <span class="roman">[</span><var>fill</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6500 |
<a name="Definition_of_f64vector"></a><a name="Procedure_f64vector"></a><a name="index-f64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector">f64vector</a></b></code><i> <var>inexact-real</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6501 |
<a name="Definition_of_f64vector-length"></a><a name="Procedure_f64vector-length"></a><a name="index-f64vector_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-length">f64vector-length</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6502 |
<a name="Definition_of_f64vector-ref"></a><a name="Procedure_f64vector-ref"></a><a name="index-f64vector_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-ref">f64vector-ref</a></b></code><i> <var>f64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6503 |
<a name="Definition_of_f64vector-set!"></a><a name="Procedure_f64vector-set!"></a><a name="index-f64vector_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-set!">f64vector-set!</a></b></code><i> <var>f64vector</var> <var>k</var> <var>inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6504 |
<a name="Definition_of_f64vector-%3Elist"></a><a name="Procedure_f64vector-%3Elist"></a><a name="index-f64vector_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-%3Elist">f64vector->list</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6505 |
<a name="Definition_of_list-%3Ef64vector"></a><a name="Procedure_list-%3Ef64vector"></a><a name="index-list_002d_003ef64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Ef64vector">list->f64vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6506 |
<a name="Definition_of_f64vector-fill!"></a><a name="Procedure_f64vector-fill!"></a><a name="index-f64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-fill!">f64vector-fill!</a></b></code><i> <var>f64vector</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6507 |
<a name="Definition_of_subf64vector-fill!"></a><a name="Procedure_subf64vector-fill!"></a><a name="index-subf64vector_002dfill_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf64vector-fill!">subf64vector-fill!</a></b></code><i> <var>vector</var> <var>start</var> <var>end</var> <var>fill</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6508 |
<a name="Definition_of_append-f64vectors"></a><a name="Procedure_append-f64vectors"></a><a name="index-append_002df64vectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_append-f64vectors">append-f64vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6509 |
<a name="Definition_of_f64vector-copy"></a><a name="Procedure_f64vector-copy"></a><a name="index-f64vector_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-copy">f64vector-copy</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6510 |
<a name="Definition_of_f64vector-append"></a><a name="Procedure_f64vector-append"></a><a name="index-f64vector_002dappend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-append">f64vector-append</a></b></code><i> <var>f64vector</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6511 |
<a name="Definition_of_subf64vector"></a><a name="Procedure_subf64vector"></a><a name="index-subf64vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf64vector">subf64vector</a></b></code><i> <var>f64vector</var> <var>start</var> <var>end</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6512 |
<a name="Definition_of_subf64vector-move!"></a><a name="Procedure_subf64vector-move!"></a><a name="index-subf64vector_002dmove_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_subf64vector-move!">subf64vector-move!</a></b></code><i> <var>src-f64vector</var> <var>src-start</var> <var>src-end</var> <var>dst-f64vector</var> <var>dst-start</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6513 |
<a name="Definition_of_f64vector-shrink!"></a><a name="Procedure_f64vector-shrink!"></a><a name="index-f64vector_002dshrink_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_f64vector-shrink!">f64vector-shrink!</a></b></code><i> <var>f64vector</var> <var>k</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6514 |
|
| 6515 |
|
| 6516 |
<p>For example: |
| 6517 |
</p> |
| 6518 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (u8vector 10 255 13))</b> |
| 6519 |
> <b>(u8vector-set! v 2 99)</b> |
| 6520 |
> <b>v</b> |
| 6521 |
#u8(10 255 99) |
| 6522 |
> <b>(u8vector-ref v 1)</b> |
| 6523 |
255 |
| 6524 |
> <b>(u8vector->list v)</b> |
| 6525 |
(10 255 99) |
| 6526 |
> <b>(u8vector-shrink! v 2)</b> |
| 6527 |
> <b>(v)</b> |
| 6528 |
#u8(10 255) |
| 6529 |
</pre></td></tr></table> |
| 6530 |
|
| 6531 |
<a name="Definition_of_object-%3Eu8vector"></a><a name="Procedure_object-%3Eu8vector"></a><a name="index-object_002d_003eu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_object-%3Eu8vector">object->u8vector</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>encoder</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6532 |
<a name="Definition_of_u8vector-%3Eobject"></a><a name="Procedure_u8vector-%3Eobject"></a><a name="index-u8vector_002d_003eobject"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_u8vector-%3Eobject">u8vector->object</a></b></code><i> <var>u8vector</var> <span class="roman">[</span><var>decoder</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6533 |
<a name="index-serialization"></a> |
| 6534 |
<a name="index-deserialization"></a> |
| 6535 |
|
| 6536 |
<p>The procedure <code>object->u8vector</code> returns a u8vector that contains |
| 6537 |
the sequence of bytes that encodes the object <var>obj</var>. The |
| 6538 |
procedure <code>u8vector->object</code> decodes the sequence of bytes |
| 6539 |
contained in the u8vector <var>u8vector</var>, which was produced by the |
| 6540 |
procedure <code>object->u8vector</code>, and reconstructs an object |
| 6541 |
structurally equal to the original object. In other words the |
| 6542 |
procedures <code>object->u8vector</code> and <code>u8vector->object</code> |
| 6543 |
respectively perform serialization and deserialization of Scheme |
| 6544 |
objects. Note that some objects are non-serializable (e.g. threads, |
| 6545 |
wills, some types of ports, and any object containing a |
| 6546 |
non-serializable object). |
| 6547 |
</p> |
| 6548 |
<p>The optional <var>encoder</var> and <var>decoder</var> parameters are single |
| 6549 |
parameter procedures which default to the identity function. The |
| 6550 |
<var>encoder</var> procedure is called during serialization. As the |
| 6551 |
serializer walks through <var>obj</var>, it calls the <var>encoder</var> |
| 6552 |
procedure on each sub-object <var>X</var> that is encountered. The |
| 6553 |
<var>encoder</var> transforms the object <var>X</var> into an object <var>Y</var> |
| 6554 |
that will be serialized instead of <var>X</var>. Similarly the |
| 6555 |
<var>decoder</var> procedure is called during deserialization. When an |
| 6556 |
object <var>Y</var> is encountered, the <var>decoder</var> procedure is called |
| 6557 |
to transform it into the object <var>X</var> that is the result of |
| 6558 |
deserialization. |
| 6559 |
</p> |
| 6560 |
<p>The <var>encoder</var> and <var>decoder</var> procedures are useful to customize |
| 6561 |
the serialized representation of objects. In particular, it can be |
| 6562 |
used to define the semantics of serializing objects, such as threads |
| 6563 |
and ports, that would otherwise not be serializable. The |
| 6564 |
<var>decoder</var> procedure is typically the inverse of the <var>encoder</var> |
| 6565 |
procedure, i.e. <code>(<var>decoder</var> (<var>encoder</var> <var>X</var>))</code> = |
| 6566 |
<code><var>X</var></code>. |
| 6567 |
</p> |
| 6568 |
<p>For example: |
| 6569 |
</p> |
| 6570 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (make-adder x) (lambda (y) (+ x y)))</b> |
| 6571 |
> <b>(define f (make-adder 10))</b> |
| 6572 |
> <b>(define a (object->u8vector f))</b> |
| 6573 |
> <b>(define b (u8vector->object a))</b> |
| 6574 |
> <b>(u8vector-length a)</b> |
| 6575 |
1639 |
| 6576 |
> <b>(f 5)</b> |
| 6577 |
15 |
| 6578 |
> <b>(b 5)</b> |
| 6579 |
15 |
| 6580 |
> <b>(pp b)</b> |
| 6581 |
(lambda (y) (+ x y)) |
| 6582 |
</pre></td></tr></table> |
| 6583 |
|
| 6584 |
|
| 6585 |
|
| 6586 |
<a name="Hashing-and-weak-references"></a><hr size="6"><br/><br/><br/> |
| 6587 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6588 |
<tr><td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6589 |
<td valign="middle" align="left"><a href="#Hashing" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6590 |
<td valign="middle" align="left"> </td> |
| 6591 |
<td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6592 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6593 |
<td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6594 |
<td valign="middle" align="left"> </td> |
| 6595 |
<td valign="middle" align="left"> </td> |
| 6596 |
<td valign="middle" align="left"> </td> |
| 6597 |
<td valign="middle" align="left"> </td> |
| 6598 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6599 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6600 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6601 |
</tr></table> |
| 6602 |
<a name="Hashing-and-weak-references-1"></a> |
| 6603 |
<h1 class="chapter">11. Hashing and weak references</h1> |
| 6604 |
<a name="index-hashing"></a> |
| 6605 |
<a name="index-weak-references"></a> |
| 6606 |
<a name="index-tables"></a> |
| 6607 |
|
| 6608 |
<table class="menu" border="0" cellspacing="0"> |
| 6609 |
<tr><td align="left" valign="top"><a href="#Hashing">11.1 Hashing</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 6610 |
<tr><td align="left" valign="top"><a href="#Weak-references">11.2 Weak references</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 6611 |
</table> |
| 6612 |
|
| 6613 |
<a name="Hashing"></a><hr size="6"><br/><br/><br/> |
| 6614 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6615 |
<tr><td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6616 |
<td valign="middle" align="left"><a href="#Weak-references" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6617 |
<td valign="middle" align="left"> </td> |
| 6618 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6619 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6620 |
<td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6621 |
<td valign="middle" align="left"> </td> |
| 6622 |
<td valign="middle" align="left"> </td> |
| 6623 |
<td valign="middle" align="left"> </td> |
| 6624 |
<td valign="middle" align="left"> </td> |
| 6625 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6626 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6627 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6628 |
</tr></table> |
| 6629 |
<a name="Hashing-1"></a> |
| 6630 |
<h2 class="section">11.1 Hashing</h2> |
| 6631 |
|
| 6632 |
<a name="Definition_of_object-%3Eserial-number"></a><a name="Procedure_object-%3Eserial-number"></a><a name="index-object_002d_003eserial_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_object-%3Eserial-number">object->serial-number</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6633 |
<a name="Definition_of_serial-number-%3Eobject"></a><a name="Procedure_serial-number-%3Eobject"></a><a name="index-serial_002dnumber_002d_003eobject"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_serial-number-%3Eobject">serial-number->object</a></b></code><i> <var>n</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6634 |
|
| 6635 |
<p>All Scheme objects are uniquely identified with a serial number which |
| 6636 |
is a nonnegative exact integer. The <code>object->serial-number</code> procedure |
| 6637 |
returns the serial number of object <var>obj</var>. This serial number is |
| 6638 |
only allocated the first time the <code>object->serial-number</code> |
| 6639 |
procedure is called on that object. Objects which do not have an |
| 6640 |
external textual representation that can be read by the <code>read</code> |
| 6641 |
procedure, use an external textual representation that includes a |
| 6642 |
serial number of the form <code>#<var>n</var></code>. Consequently, the |
| 6643 |
procedures <code>write</code>, <code>pretty-print</code>, etc will call the |
| 6644 |
<code>object->serial-number</code> procedure to get the serial number, and |
| 6645 |
this may cause the serial number to be allocated. |
| 6646 |
</p> |
| 6647 |
<p>The <code>serial-number->object</code> procedure takes an exact integer |
| 6648 |
parameter <var>n</var> and returns the object whose serial number is |
| 6649 |
<var>n</var>. If no object currently exists with that serial number, |
| 6650 |
<var>default</var> is returned if it is specified, otherwise an |
| 6651 |
unbound-serial-number-exception object is raised. The reader defines |
| 6652 |
the following abbreviation for calling <code>serial-number->object</code>: |
| 6653 |
the syntax <code>#<var>n</var></code>, where <var>n</var> is a sequence of decimal |
| 6654 |
digits and it is not followed by ‘<samp><code>=</code></samp>’ or ‘<samp><code>#</code></samp>’, |
| 6655 |
is equivalent to the list <code>(serial-number->object <var>n</var>)</code>. |
| 6656 |
</p> |
| 6657 |
<p>For example: |
| 6658 |
</p> |
| 6659 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define z (list (lambda (x) (* x x)) (lambda (y) (/ 1 y))))</b> |
| 6660 |
> <b>z</b> |
| 6661 |
(#<procedure #2> #<procedure #3>) |
| 6662 |
> <b>(#3 10)</b> |
| 6663 |
1/10 |
| 6664 |
> <b>'(#3 10)</b> |
| 6665 |
((serial-number->object 3) 10) |
| 6666 |
> <b>car</b> |
| 6667 |
#<procedure #4 car> |
| 6668 |
> <b>(#4 z)</b> |
| 6669 |
#<procedure #2> |
| 6670 |
</pre></td></tr></table> |
| 6671 |
|
| 6672 |
|
| 6673 |
|
| 6674 |
<a name="Definition_of_unbound-serial-number-exception?"></a><a name="Procedure_unbound-serial-number-exception?"></a><a name="index-unbound_002dserial_002dnumber_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception?">unbound-serial-number-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6675 |
<a name="Definition_of_unbound-serial-number-exception-procedure"></a><a name="Procedure_unbound-serial-number-exception-procedure"></a><a name="index-unbound_002dserial_002dnumber_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception-procedure">unbound-serial-number-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6676 |
<a name="Definition_of_unbound-serial-number-exception-arguments"></a><a name="Procedure_unbound-serial-number-exception-arguments"></a><a name="index-unbound_002dserial_002dnumber_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-serial-number-exception-arguments">unbound-serial-number-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6677 |
|
| 6678 |
<p>Unbound-serial-number-exception objects are raised by the procedure |
| 6679 |
<code>serial-number->object</code> when no object currently exists with that |
| 6680 |
serial number. The parameter <var>exc</var> must be an |
| 6681 |
unbound-serial-number-exception object. |
| 6682 |
</p> |
| 6683 |
<p>The procedure <code>unbound-serial-number-exception?</code> returns |
| 6684 |
<code>#t</code> when <var>obj</var> is a unbound-serial-number-exception |
| 6685 |
object and <code>#f</code> otherwise. |
| 6686 |
</p> |
| 6687 |
<p>The procedure <code>unbound-serial-number-exception-procedure</code> |
| 6688 |
returns the procedure that raised <var>exc</var>. |
| 6689 |
</p> |
| 6690 |
<p>The procedure <code>unbound-serial-number-exception-arguments</code> |
| 6691 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 6692 |
</p> |
| 6693 |
<p>For example: |
| 6694 |
</p> |
| 6695 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 6696 |
(if (unbound-serial-number-exception? exc) |
| 6697 |
(list (unbound-serial-number-exception-procedure exc) |
| 6698 |
(unbound-serial-number-exception-arguments exc)) |
| 6699 |
'not-unbound-serial-number-exception))</b> |
| 6700 |
> <b>(with-exception-catcher |
| 6701 |
handler |
| 6702 |
(lambda () (serial-number->object 1000)))</b> |
| 6703 |
(#<procedure #2 serial-number->object> (1000)) |
| 6704 |
</pre></td></tr></table> |
| 6705 |
|
| 6706 |
|
| 6707 |
|
| 6708 |
<a name="Definition_of_symbol-hash"></a><a name="Procedure_symbol-hash"></a><a name="index-symbol_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_symbol-hash">symbol-hash</a></b></code><i> <var>symbol</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6709 |
|
| 6710 |
<p>The <code>symbol-hash</code> procedure returns the hash number of the symbol |
| 6711 |
<var>symbol</var>. The hash number is a small exact integer (fixnum). |
| 6712 |
When <var>symbol</var> is an interned symbol the value returned is the same |
| 6713 |
as <code>(string=?-hash (symbol->string <var>symbol</var>))</code>. |
| 6714 |
</p> |
| 6715 |
<p>For example: |
| 6716 |
</p> |
| 6717 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(symbol-hash 'car)</b> |
| 6718 |
444471047 |
| 6719 |
</pre></td></tr></table> |
| 6720 |
|
| 6721 |
|
| 6722 |
|
| 6723 |
<a name="Definition_of_keyword-hash"></a><a name="Procedure_keyword-hash"></a><a name="index-keyword_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword-hash">keyword-hash</a></b></code><i> <var>keyword</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6724 |
|
| 6725 |
<p>The <code>keyword-hash</code> procedure returns the hash number of the |
| 6726 |
keyword <var>keyword</var>. The hash number is a small exact integer |
| 6727 |
(fixnum). When <var>keyword</var> is an interned keyword the value |
| 6728 |
returned is the same as <code>(string=?-hash (keyword->string |
| 6729 |
<var>keyword</var>))</code>. |
| 6730 |
</p> |
| 6731 |
<p>For example: |
| 6732 |
</p> |
| 6733 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword-hash car:)</b> |
| 6734 |
444471047 |
| 6735 |
</pre></td></tr></table> |
| 6736 |
|
| 6737 |
|
| 6738 |
|
| 6739 |
<a name="Definition_of_string=?-hash"></a><a name="Procedure_string=?-hash"></a><a name="index-string_003d_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string=?-hash">string=?-hash</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6740 |
|
| 6741 |
<p>The <code>string=?-hash</code> procedure returns the hash number of the |
| 6742 |
string <var>string</var>. The hash number is a small exact integer |
| 6743 |
(fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string=? |
| 6744 |
<var>s1</var> <var>s2</var>)</code> implies <code>(= (string=?-hash <var>s1</var>) |
| 6745 |
(string=?-hash <var>s2</var>))</code>. |
| 6746 |
</p> |
| 6747 |
<p>For example: |
| 6748 |
</p> |
| 6749 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(string=?-hash "car")</b> |
| 6750 |
444471047 |
| 6751 |
</pre></td></tr></table> |
| 6752 |
|
| 6753 |
|
| 6754 |
|
| 6755 |
<a name="Definition_of_string-ci=?-hash"></a><a name="Procedure_string-ci=?-hash"></a><a name="index-string_002dci_003d_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_string-ci=?-hash">string-ci=?-hash</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6756 |
|
| 6757 |
<p>The <code>string-ci=?-hash</code> procedure returns the hash number of the |
| 6758 |
string <var>string</var>. The hash number is a small exact integer |
| 6759 |
(fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string-ci=? |
| 6760 |
<var>s1</var> <var>s2</var>)</code> implies <code>(= (string-ci=?-hash <var>s1</var>) |
| 6761 |
(string-ci=?-hash <var>s2</var>))</code>. |
| 6762 |
</p> |
| 6763 |
<p>For example: |
| 6764 |
</p> |
| 6765 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(string-ci=?-hash "CaR")</b> |
| 6766 |
444471047 |
| 6767 |
</pre></td></tr></table> |
| 6768 |
|
| 6769 |
|
| 6770 |
|
| 6771 |
<a name="Definition_of_eq?-hash"></a><a name="Procedure_eq?-hash"></a><a name="index-eq_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_eq?-hash">eq?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6772 |
|
| 6773 |
<p>The <code>eq?-hash</code> procedure returns the hash number of the object |
| 6774 |
<var>obj</var>. The hash number is a small exact integer (fixnum). For |
| 6775 |
any two objects <var>o1</var> and <var>o2</var>, <code>(eq? <var>o1</var> <var>o2</var>)</code> |
| 6776 |
implies <code>(= (eq?-hash <var>o1</var>) (eq?-hash <var>o2</var>))</code>. |
| 6777 |
</p> |
| 6778 |
<p>For example: |
| 6779 |
</p> |
| 6780 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(eq?-hash #t)</b> |
| 6781 |
536870910 |
| 6782 |
</pre></td></tr></table> |
| 6783 |
|
| 6784 |
|
| 6785 |
|
| 6786 |
<a name="Definition_of_eqv?-hash"></a><a name="Procedure_eqv?-hash"></a><a name="index-eqv_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_eqv?-hash">eqv?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6787 |
|
| 6788 |
<p>The <code>eqv?-hash</code> procedure returns the hash number of the object |
| 6789 |
<var>obj</var>. The hash number is a small exact integer (fixnum). For |
| 6790 |
any two objects <var>o1</var> and <var>o2</var>, <code>(eqv? <var>o1</var> <var>o2</var>)</code> |
| 6791 |
implies <code>(= (eqv?-hash <var>o1</var>) (eqv?-hash <var>o2</var>))</code>. |
| 6792 |
</p> |
| 6793 |
<p>For example: |
| 6794 |
</p> |
| 6795 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(eqv?-hash 1.5)</b> |
| 6796 |
496387656 |
| 6797 |
</pre></td></tr></table> |
| 6798 |
|
| 6799 |
|
| 6800 |
|
| 6801 |
<a name="Definition_of_equal?-hash"></a><a name="Procedure_equal?-hash"></a><a name="index-equal_003f_002dhash"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_equal?-hash">equal?-hash</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6802 |
|
| 6803 |
<p>The <code>equal?-hash</code> procedure returns the hash number of the object |
| 6804 |
<var>obj</var>. The hash number is a small exact integer (fixnum). For |
| 6805 |
any two objects <var>o1</var> and <var>o2</var>, <code>(equal? <var>o1</var> <var>o2</var>)</code> |
| 6806 |
implies <code>(= (equal?-hash <var>o1</var>) (equal?-hash <var>o2</var>))</code>. |
| 6807 |
</p> |
| 6808 |
<p>For example: |
| 6809 |
</p> |
| 6810 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(equal?-hash (list 1 2 3))</b> |
| 6811 |
442438567 |
| 6812 |
</pre></td></tr></table> |
| 6813 |
|
| 6814 |
|
| 6815 |
|
| 6816 |
<a name="Weak-references"></a><hr size="6"><br/><br/><br/> |
| 6817 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6818 |
<tr><td valign="middle" align="left"><a href="#Hashing" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6819 |
<td valign="middle" align="left"><a href="#Wills" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6820 |
<td valign="middle" align="left"> </td> |
| 6821 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6822 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6823 |
<td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6824 |
<td valign="middle" align="left"> </td> |
| 6825 |
<td valign="middle" align="left"> </td> |
| 6826 |
<td valign="middle" align="left"> </td> |
| 6827 |
<td valign="middle" align="left"> </td> |
| 6828 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6829 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6830 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6831 |
</tr></table> |
| 6832 |
<a name="Weak-references-1"></a> |
| 6833 |
<h2 class="section">11.2 Weak references</h2> |
| 6834 |
|
| 6835 |
<p>The garbage collector is responsible for reclaiming objects that are |
| 6836 |
no longer needed by the program. This is done by analyzing the |
| 6837 |
reachability graph of all objects from the roots (i.e. the global |
| 6838 |
variables, the runnable threads, permanently allocated objects such as |
| 6839 |
procedures defined in a compiled file, nonexecutable wills, etc). If |
| 6840 |
a root or a reachable object <var>X</var> contains a reference to an object |
| 6841 |
<var>Y</var> then <var>Y</var> is reachable. As a general rule, unreachable |
| 6842 |
objects are reclaimed by the garbage collector. |
| 6843 |
</p> |
| 6844 |
<p>There are two types of references: strong references and weak |
| 6845 |
references. Most objects, including pairs, vectors, records and |
| 6846 |
closures, contain strong references. An object <var>X</var> is |
| 6847 |
<em>strongly reachable</em> if there is a path from the roots to <var>X</var> |
| 6848 |
that traverses only strong references. Weak references only occur in |
| 6849 |
wills and tables. There are two types of weak references: will-weak |
| 6850 |
references and table-weak references. If all paths from the roots to |
| 6851 |
an object <var>Y</var> traverse at least one table-weak reference, then |
| 6852 |
<var>Y</var> will be reclaimed by the garbage collector. The will-weak |
| 6853 |
references are used for finalization and are explained in the next |
| 6854 |
section. |
| 6855 |
</p> |
| 6856 |
<table class="menu" border="0" cellspacing="0"> |
| 6857 |
<tr><td align="left" valign="top"><a href="#Wills">11.2.1 Wills</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 6858 |
<tr><td align="left" valign="top"><a href="#Tables">11.2.2 Tables</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 6859 |
</table> |
| 6860 |
|
| 6861 |
<a name="Wills"></a><hr size="6"><br/><br/><br/> |
| 6862 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6863 |
<tr><td valign="middle" align="left"><a href="#Weak-references" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6864 |
<td valign="middle" align="left"><a href="#Tables" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6865 |
<td valign="middle" align="left"> </td> |
| 6866 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6867 |
<td valign="middle" align="left"><a href="#Weak-references" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6868 |
<td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6869 |
<td valign="middle" align="left"> </td> |
| 6870 |
<td valign="middle" align="left"> </td> |
| 6871 |
<td valign="middle" align="left"> </td> |
| 6872 |
<td valign="middle" align="left"> </td> |
| 6873 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6874 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6875 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6876 |
</tr></table> |
| 6877 |
<a name="Wills-1"></a> |
| 6878 |
<h3 class="subsection">11.2.1 Wills</h3> |
| 6879 |
|
| 6880 |
<p>The following procedures implement the <em>will</em> data type. Will |
| 6881 |
objects provide support for finalization. A will is an object that |
| 6882 |
contains a will-weak reference to a <var>testator</var> object (the object |
| 6883 |
attached to the will), and a strong reference to an <var>action</var> |
| 6884 |
procedure which is a one parameter procedure which is called when the |
| 6885 |
will is executed. |
| 6886 |
</p> |
| 6887 |
<a name="Definition_of_make-will"></a><a name="Procedure_make-will"></a><a name="index-make_002dwill"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-will">make-will</a></b></code><i> <var>testator</var> <var>action</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6888 |
<a name="Definition_of_will?"></a><a name="Procedure_will?"></a><a name="index-will_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_will?">will?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6889 |
<a name="Definition_of_will-testator"></a><a name="Procedure_will-testator"></a><a name="index-will_002dtestator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_will-testator">will-testator</a></b></code><i> <var>will</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6890 |
<a name="Definition_of_will-execute!"></a><a name="Procedure_will-execute!"></a><a name="index-will_002dexecute_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_will-execute!">will-execute!</a></b></code><i> <var>will</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 6891 |
|
| 6892 |
<p>The <code>make-will</code> procedure creates a will object with the given |
| 6893 |
<var>testator</var> object and <var>action</var> procedure. The <code>will?</code> |
| 6894 |
procedure tests if <var>obj</var> is a will object. The |
| 6895 |
<code>will-testator</code> procedure gets the testator object attached to |
| 6896 |
the <var>will</var>. The <code>will-execute!</code> procedure executes |
| 6897 |
<var>will</var>. |
| 6898 |
</p> |
| 6899 |
<p>A will becomes <em>executable</em> when its <var>testator</var> object is not |
| 6900 |
strongly reachable (i.e. the <var>testator</var> object is either |
| 6901 |
unreachable or only reachable using paths from the roots that traverse |
| 6902 |
at least one weak reference). Some objects, including symbols, small |
| 6903 |
exact integers (fixnums), booleans and characters, are considered to |
| 6904 |
be always strongly reachable. |
| 6905 |
</p> |
| 6906 |
<p>When the runtime system detects that a will has become executable the |
| 6907 |
current computation is interrupted, the will’s testator is set to |
| 6908 |
<code>#f</code> and the will’s action procedure is called with the will’s |
| 6909 |
testator as the sole argument. Currently only the garbage collector |
| 6910 |
detects when wills become executable but this may change in future |
| 6911 |
versions of Gambit (for example the compiler could perform an analysis |
| 6912 |
to infer will executability at compile time). The garbage collector |
| 6913 |
builds a list of all executable wills. Shortly after a garbage |
| 6914 |
collection, the action procedures of these wills will be called. The |
| 6915 |
link from the will to the action procedure is severed when the action |
| 6916 |
procedure is called. |
| 6917 |
</p> |
| 6918 |
<p>Note that the testator object will not be reclaimed during the garbage |
| 6919 |
collection that determined executability of the will. It is only when |
| 6920 |
an object is not reachable from the roots that it is reclaimed by the |
| 6921 |
garbage collector. |
| 6922 |
</p> |
| 6923 |
<p>A remarkable feature of wills is that an action procedure can |
| 6924 |
“resurrect” an object. An action procedure could for example assign |
| 6925 |
the testator object to a global variable or create a new will with the |
| 6926 |
same testator object. |
| 6927 |
</p> |
| 6928 |
<p>For example: |
| 6929 |
</p> |
| 6930 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define a (list 123))</b> |
| 6931 |
> <b>(set-cdr! a a) <span class="roman"><i>; create a circular list</i></span></b> |
| 6932 |
> <b>(define b (vector a))</b> |
| 6933 |
> <b>(define c #f)</b> |
| 6934 |
> <b>(define w |
| 6935 |
(let ((obj a)) |
| 6936 |
(make-will obj |
| 6937 |
(lambda (x) ; x will be eq? to obj |
| 6938 |
(display "executing action procedure") |
| 6939 |
(newline) |
| 6940 |
(set! c x)))))</b> |
| 6941 |
> <b>(will? w)</b> |
| 6942 |
#t |
| 6943 |
> <b>(car (will-testator w))</b> |
| 6944 |
123 |
| 6945 |
> <b>(##gc)</b> |
| 6946 |
> <b>(set! a #f)</b> |
| 6947 |
> <b>(##gc)</b> |
| 6948 |
> <b>(set! b #f)</b> |
| 6949 |
> <b>(##gc)</b> |
| 6950 |
executing action procedure |
| 6951 |
> <b>(will-testator w)</b> |
| 6952 |
#f |
| 6953 |
> <b>(car c)</b> |
| 6954 |
123 |
| 6955 |
</pre></td></tr></table> |
| 6956 |
|
| 6957 |
|
| 6958 |
|
| 6959 |
<a name="Tables"></a><hr size="6"><br/><br/><br/> |
| 6960 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 6961 |
<tr><td valign="middle" align="left"><a href="#Wills" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 6962 |
<td valign="middle" align="left"><a href="#Records" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 6963 |
<td valign="middle" align="left"> </td> |
| 6964 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 6965 |
<td valign="middle" align="left"><a href="#Weak-references" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 6966 |
<td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 6967 |
<td valign="middle" align="left"> </td> |
| 6968 |
<td valign="middle" align="left"> </td> |
| 6969 |
<td valign="middle" align="left"> </td> |
| 6970 |
<td valign="middle" align="left"> </td> |
| 6971 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 6972 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 6973 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 6974 |
</tr></table> |
| 6975 |
<a name="Tables-1"></a> |
| 6976 |
<h3 class="subsection">11.2.2 Tables</h3> |
| 6977 |
|
| 6978 |
<p>The following procedures implement the <em>table</em> data type. Tables |
| 6979 |
are heterogenous structures whose elements are indexed by keys which |
| 6980 |
are arbitrary objects. Tables are similar to association lists but |
| 6981 |
are abstract and the access time for large tables is typically smaller. |
| 6982 |
Each key contained in the table is bound to a value. The length of |
| 6983 |
the table is the number of key/value bindings it contains. New |
| 6984 |
key/value bindings can be added to a table, the value bound to a key |
| 6985 |
can be changed, and existing key/value bindings can be removed. |
| 6986 |
</p> |
| 6987 |
<p>The references to the keys can either be all strong or all table-weak |
| 6988 |
and the references to the values can either be all strong or all |
| 6989 |
table-weak. The garbage collector removes key/value bindings from a |
| 6990 |
table when 1) the key is a table-weak reference and the key is |
| 6991 |
unreachable or only reachable using paths from the roots that traverse |
| 6992 |
at least one table-weak reference, or 2) the value is a table-weak |
| 6993 |
reference and the value is unreachable or only reachable using paths |
| 6994 |
from the roots that traverse at least one table-weak reference. |
| 6995 |
Key/value bindings that are removed by the garbage collector are |
| 6996 |
reclaimed immediately. |
| 6997 |
</p> |
| 6998 |
<p>Although there are several possible ways of implementing tables, the |
| 6999 |
current implementation uses hashing with open-addressing. This is |
| 7000 |
space efficient and provides constant-time access. Hash tables are |
| 7001 |
automatically resized to maintain the load within specified bounds. |
| 7002 |
The load is the number of active entries (the length of the table) |
| 7003 |
divided by the total number of entries in the hash table. |
| 7004 |
</p> |
| 7005 |
<p>Tables are parameterized with a key comparison procedure. By default |
| 7006 |
the <code>equal?</code> procedure is used, but <code>eq?</code>, <code>eqv?</code>, |
| 7007 |
<code>string=?</code>, <code>string-ci=?</code>, or a user defined procedure can |
| 7008 |
also be used. To support arbitrary key comparison procedures, tables |
| 7009 |
are also parameterized with a hashing procedure accepting a key as its |
| 7010 |
single parameter and returning a fixnum result. The hashing procedure |
| 7011 |
<var>hash</var> must be consistent with the key comparison procedure |
| 7012 |
<var>test</var>, that is, for any two keys <var>k1</var> and <var>k2</var> in the |
| 7013 |
table, <code>(<var>test</var> <var>k1</var> <var>k2</var>)</code> implies <code>(= |
| 7014 |
(<var>hash</var> <var>k1</var>) (<var>hash</var> <var>k2</var>))</code>. A default hashing |
| 7015 |
procedure consistent with the key comparison procedure is provided by |
| 7016 |
the system. The default hashing procedure generally gives good |
| 7017 |
performance when the key comparison procedure is <code>eq?</code>, |
| 7018 |
<code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, and <code>string-ci=?</code>. |
| 7019 |
However, for user defined key comparison procedures, the default |
| 7020 |
hashing procedure always returns 0. This degrades the performance of |
| 7021 |
the table to a linear search. |
| 7022 |
</p> |
| 7023 |
<p>Tables can be compared for equality using the <code>equal?</code> procedure. |
| 7024 |
Two tables <code><var>X</var></code> and <code><var>Y</var></code> are considered equal by |
| 7025 |
<code>equal?</code> when they have the same weakness attributes, the same |
| 7026 |
key comparison procedure, the same hashing procedure, the same length, |
| 7027 |
and for all the keys <code><var>k</var></code> in <code><var>X</var></code>, <code>(equal? |
| 7028 |
(table-ref <var>X</var> <var>k</var>) (table-ref <var>Y</var> <var>k</var>))</code>. |
| 7029 |
</p> |
| 7030 |
<a name="Definition_of_make-table"></a><a name="Procedure_make-table"></a><a name="index-make_002dtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-table">make-table</a></b></code><i> <span class="roman">[</span><code>size:</code> <var>size</var><span class="roman">]</span> <span class="roman">[</span><code>init:</code> <var>init</var><span class="roman">]</span> <span class="roman">[</span><code>weak-keys:</code> <var>weak-keys</var><span class="roman">]</span> <span class="roman">[</span><code>weak-values:</code> <var>weak-values</var><span class="roman">]</span> <span class="roman">[</span><code>test:</code> <var>test</var><span class="roman">]</span> <span class="roman">[</span><code>hash:</code> <var>hash</var><span class="roman">]</span> <span class="roman">[</span><code>min-load:</code> <var>min-load</var><span class="roman">]</span> <span class="roman">[</span><code>max-load:</code> <var>max-load</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7031 |
|
| 7032 |
<p>The procedure <code>make-table</code> returns a new table. The optional keyword |
| 7033 |
parameters specify various parameters of the table. |
| 7034 |
</p> |
| 7035 |
<p>The <var>size</var> parameter is a nonnegative exact integer indicating |
| 7036 |
the expected length of the table. The system uses <var>size</var> to |
| 7037 |
choose an appropriate initial size of the hash table so that it does not |
| 7038 |
need to be resized too often. |
| 7039 |
</p> |
| 7040 |
<p>The <var>init</var> parameter indicates a value that is associated to keys |
| 7041 |
that are not in the table. When <var>init</var> is not specified, no value |
| 7042 |
is associated to keys that are not in the table. |
| 7043 |
</p> |
| 7044 |
<p>The <var>weak-keys</var> and <var>weak-values</var> parameters are extended |
| 7045 |
booleans indicating respectively whether the keys and values are |
| 7046 |
table-weak references (true) or strong references (false). By default |
| 7047 |
the keys and values are strong references. |
| 7048 |
</p> |
| 7049 |
<p>The <var>test</var> parameter indicates the key comparison procedure. The |
| 7050 |
default key comparison procedure is <code>equal?</code>. The key comparison |
| 7051 |
procedures <code>eq?</code>, <code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, |
| 7052 |
and <code>string-ci=?</code> are special because the system will use a |
| 7053 |
reasonably good hash procedure when none is specified. |
| 7054 |
</p> |
| 7055 |
<p>The <var>hash</var> parameter indicates the hash procedure. This procedure |
| 7056 |
must accept a single key parameter, return a fixnum, and be consistent |
| 7057 |
with the key comparison procedure. When <var>hash</var> is not specified, a |
| 7058 |
default hash procedure is used. The default hash procedure is |
| 7059 |
reasonably good when the key comparison procedure is <code>eq?</code>, |
| 7060 |
<code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, or <code>string-ci=?</code>. |
| 7061 |
</p> |
| 7062 |
<p>The <var>min-load</var> and <var>max-load</var> parameters are real numbers that |
| 7063 |
indicate the minimum and maximum load of the table respectively. The |
| 7064 |
table is resized when adding or deleting a key/value binding would |
| 7065 |
bring the table’s load outside of this range. The <var>min-load</var> |
| 7066 |
parameter must be no less than 0.05 and the <var>max-load</var> parameter |
| 7067 |
must be no greater than 0.95. Moreover the difference between |
| 7068 |
<var>min-load</var> and <var>max-load</var> must be at least 0.20. When |
| 7069 |
<var>min-load</var> is not specified, the value 0.45 is used. When |
| 7070 |
<var>max-load</var> is not specified, the value 0.90 is used. |
| 7071 |
</p> |
| 7072 |
<p>For example: |
| 7073 |
</p> |
| 7074 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b> |
| 7075 |
> <b>(table? t)</b> |
| 7076 |
#t |
| 7077 |
> <b>(table-length t)</b> |
| 7078 |
0 |
| 7079 |
> <b>(table-set! t (list 1 2) 3)</b> |
| 7080 |
> <b>(table-set! t (list 4 5) 6)</b> |
| 7081 |
> <b>(table-ref t (list 1 2))</b> |
| 7082 |
3 |
| 7083 |
> <b>(table-length t)</b> |
| 7084 |
2 |
| 7085 |
</pre></td></tr></table> |
| 7086 |
|
| 7087 |
|
| 7088 |
|
| 7089 |
<a name="Definition_of_table?"></a><a name="Procedure_table?"></a><a name="index-table_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table?">table?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7090 |
|
| 7091 |
<p>The procedure <code>table?</code> returns <code>#t</code> when <var>obj</var> is a |
| 7092 |
table and <code>#f</code> otherwise. |
| 7093 |
</p> |
| 7094 |
<p>For example: |
| 7095 |
</p> |
| 7096 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(table? (make-table))</b> |
| 7097 |
#t |
| 7098 |
> <b>(table? 123)</b> |
| 7099 |
#f |
| 7100 |
</pre></td></tr></table> |
| 7101 |
|
| 7102 |
|
| 7103 |
|
| 7104 |
<a name="Definition_of_table-length"></a><a name="Procedure_table-length"></a><a name="index-table_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-length">table-length</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7105 |
|
| 7106 |
<p>The procedure <code>table-length</code> returns the number of key/value |
| 7107 |
bindings contained in the table <var>table</var>. |
| 7108 |
</p> |
| 7109 |
<p>For example: |
| 7110 |
</p> |
| 7111 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table weak-keys: #t))</b> |
| 7112 |
> <b>(define x (list 1 2))</b> |
| 7113 |
> <b>(define y (list 3 4))</b> |
| 7114 |
> <b>(table-set! t x 111)</b> |
| 7115 |
> <b>(table-set! t y 222)</b> |
| 7116 |
> <b>(table-length t)</b> |
| 7117 |
2 |
| 7118 |
> <b>(table-set! t x)</b> |
| 7119 |
> <b>(table-length t)</b> |
| 7120 |
1 |
| 7121 |
> <b>(##gc)</b> |
| 7122 |
> <b>(table-length t)</b> |
| 7123 |
1 |
| 7124 |
> <b>(set! y #f)</b> |
| 7125 |
> <b>(##gc)</b> |
| 7126 |
> <b>(table-length t)</b> |
| 7127 |
0 |
| 7128 |
</pre></td></tr></table> |
| 7129 |
|
| 7130 |
|
| 7131 |
|
| 7132 |
<a name="Definition_of_table-ref"></a><a name="Procedure_table-ref"></a><a name="index-table_002dref"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-ref">table-ref</a></b></code><i> <var>table</var> <var>key</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7133 |
|
| 7134 |
<p>The procedure <code>table-ref</code> returns the value bound to the object |
| 7135 |
<var>key</var> in the table <var>table</var>. When <var>key</var> is not bound and |
| 7136 |
<var>default</var> is specified, <var>default</var> is returned. When |
| 7137 |
<var>default</var> is not specified but an <var>init</var> parameter was |
| 7138 |
specified when <var>table</var> was created, <var>init</var> is returned. |
| 7139 |
Otherwise an unbound-table-key-exception object is raised. |
| 7140 |
</p> |
| 7141 |
<p>For example: |
| 7142 |
</p> |
| 7143 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (make-table init: 999))</b> |
| 7144 |
> <b>(table-set! t1 (list 1 2) 3)</b> |
| 7145 |
> <b>(table-ref t1 (list 1 2))</b> |
| 7146 |
3 |
| 7147 |
> <b>(table-ref t1 (list 4 5))</b> |
| 7148 |
999 |
| 7149 |
> <b>(table-ref t1 (list 4 5) #f)</b> |
| 7150 |
#f |
| 7151 |
> <b>(define t2 (make-table))</b> |
| 7152 |
> <b>(table-ref t2 (list 4 5))</b> |
| 7153 |
*** ERROR IN (console)@7.1 -- Unbound table key |
| 7154 |
(table-ref '#<table #2> '(4 5)) |
| 7155 |
</pre></td></tr></table> |
| 7156 |
|
| 7157 |
|
| 7158 |
|
| 7159 |
<a name="Definition_of_table-set!"></a><a name="Procedure_table-set!"></a><a name="index-table_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-set!">table-set!</a></b></code><i> <var>table</var> <var>key</var> <span class="roman">[</span><var>value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7160 |
|
| 7161 |
<p>The procedure <code>table-set!</code> binds the object <var>key</var> to |
| 7162 |
<var>value</var> in the table <var>table</var>. When <var>value</var> is not |
| 7163 |
specified, if <var>table</var> contains a binding for <var>key</var> then the |
| 7164 |
binding is removed from <var>table</var>. The procedure <code>table-set!</code> |
| 7165 |
returns an unspecified value. |
| 7166 |
</p> |
| 7167 |
<p>For example: |
| 7168 |
</p> |
| 7169 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b> |
| 7170 |
> <b>(table-set! t (list 1 2) 3)</b> |
| 7171 |
> <b>(table-set! t (list 4 5) 6)</b> |
| 7172 |
> <b>(table-set! t (list 4 5))</b> |
| 7173 |
> <b>(table-set! t (list 7 8))</b> |
| 7174 |
> <b>(table-ref t (list 1 2))</b> |
| 7175 |
3 |
| 7176 |
> <b>(table-ref t (list 4 5))</b> |
| 7177 |
*** ERROR IN (console)@7.1 -- Unbound table key |
| 7178 |
(table-ref '#<table #2> '(4 5)) |
| 7179 |
</pre></td></tr></table> |
| 7180 |
|
| 7181 |
|
| 7182 |
|
| 7183 |
<a name="Definition_of_table-search"></a><a name="Procedure_table-search"></a><a name="index-table_002dsearch"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-search">table-search</a></b></code><i> <var>proc</var> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7184 |
|
| 7185 |
<p>The procedure <code>table-search</code> searches the table <var>table</var> for a |
| 7186 |
key/value binding for which the two parameter procedure <var>proc</var> |
| 7187 |
returns a non false result. For each key/value binding visited by |
| 7188 |
<code>table-search</code> the procedure <var>proc</var> is called with the key as |
| 7189 |
the first parameter and the value as the second parameter. The |
| 7190 |
procedure <code>table-search</code> returns the first non false value |
| 7191 |
returned by <var>proc</var>, or <code>#f</code> if <var>proc</var> returned <code>#f</code> |
| 7192 |
for all key/value bindings in <var>table</var>. |
| 7193 |
</p> |
| 7194 |
<p>The order in which the key/value bindings are visited is unspecified |
| 7195 |
and may vary from one call of <code>table-search</code> to the next. While |
| 7196 |
a call to <code>table-search</code> is being performed on <var>table</var>, it is |
| 7197 |
an error to call any of the following procedures on <var>table</var>: |
| 7198 |
<code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>, |
| 7199 |
<code>table-for-each</code>, <code>table-copy</code>, <code>table-merge</code>, |
| 7200 |
<code>table-merge!</code>, and <code>table->list</code>. It is also an error to |
| 7201 |
compare with <code>equal?</code> (directly or indirectly with <code>member</code>, |
| 7202 |
<code>assoc</code>, <code>table-ref</code>, etc.) an object that contains |
| 7203 |
<var>table</var>. All these procedures may cause <var>table</var> to be |
| 7204 |
reordered and resized. This restriction allows a more efficient |
| 7205 |
iteration over the key/value bindings. |
| 7206 |
</p> |
| 7207 |
<p>For example: |
| 7208 |
</p> |
| 7209 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b> |
| 7210 |
> <b>(table-set! square 2 4)</b> |
| 7211 |
> <b>(table-set! square 3 9)</b> |
| 7212 |
> <b>(table-search (lambda (k v) (and (odd? k) v)) square)</b> |
| 7213 |
9 |
| 7214 |
</pre></td></tr></table> |
| 7215 |
|
| 7216 |
|
| 7217 |
|
| 7218 |
<a name="Definition_of_table-for-each"></a><a name="Procedure_table-for-each"></a><a name="index-table_002dfor_002deach"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-for-each">table-for-each</a></b></code><i> <var>proc</var> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7219 |
|
| 7220 |
<p>The procedure <code>table-for-each</code> calls the two parameter procedure |
| 7221 |
<var>proc</var> for each key/value binding in the table <var>table</var>. The |
| 7222 |
procedure <var>proc</var> is called with the key as the first parameter and |
| 7223 |
the value as the second parameter. The procedure <code>table-for-each</code> |
| 7224 |
returns an unspecified value. |
| 7225 |
</p> |
| 7226 |
<p>The order in which the key/value bindings are visited is unspecified |
| 7227 |
and may vary from one call of <code>table-for-each</code> to the next. |
| 7228 |
While a call to <code>table-for-each</code> is being performed on |
| 7229 |
<var>table</var>, it is an error to call any of the following procedures on |
| 7230 |
<var>table</var>: <code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>, |
| 7231 |
<code>table-for-each</code>, and <code>table->list</code>. It is also an error to |
| 7232 |
compare with <code>equal?</code> (directly or indirectly with <code>member</code>, |
| 7233 |
<code>assoc</code>, <code>table-ref</code>, etc.) an object that contains |
| 7234 |
<var>table</var>. All these procedures may cause <var>table</var> to be |
| 7235 |
reordered and resized. This restriction allows a more efficient |
| 7236 |
iteration over the key/value bindings. |
| 7237 |
</p> |
| 7238 |
<p>For example: |
| 7239 |
</p> |
| 7240 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b> |
| 7241 |
> <b>(table-set! square 2 4)</b> |
| 7242 |
> <b>(table-set! square 3 9)</b> |
| 7243 |
> <b>(table-for-each (lambda (k v) (write (list k v)) (newline)) square)</b> |
| 7244 |
(2 4) |
| 7245 |
(3 9) |
| 7246 |
</pre></td></tr></table> |
| 7247 |
|
| 7248 |
|
| 7249 |
|
| 7250 |
<a name="Definition_of_table-%3Elist"></a><a name="Procedure_table-%3Elist"></a><a name="index-table_002d_003elist"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-%3Elist">table->list</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7251 |
|
| 7252 |
<p>The procedure <code>table->list</code> returns an association list |
| 7253 |
containing the key/value bindings in the table <var>table</var>. Each |
| 7254 |
key/value binding yields a pair whose car field is the key and whose |
| 7255 |
cdr field is the value bound to that key. The order of the bindings |
| 7256 |
in the list is unspecified. |
| 7257 |
</p> |
| 7258 |
<p>For example: |
| 7259 |
</p> |
| 7260 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define square (make-table))</b> |
| 7261 |
> <b>(table-set! square 2 4)</b> |
| 7262 |
> <b>(table-set! square 3 9)</b> |
| 7263 |
> <b>(table->list square)</b> |
| 7264 |
((3 . 9) (2 . 4)) |
| 7265 |
</pre></td></tr></table> |
| 7266 |
|
| 7267 |
|
| 7268 |
|
| 7269 |
<a name="Definition_of_list-%3Etable"></a><a name="Procedure_list-%3Etable"></a><a name="index-list_002d_003etable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_list-%3Etable">list->table</a></b></code><i> <var>list</var> <span class="roman">[</span><code>size:</code> <var>size</var><span class="roman">]</span> <span class="roman">[</span><code>init:</code> <var>init</var><span class="roman">]</span> <span class="roman">[</span><code>weak-keys:</code> <var>weak-keys</var><span class="roman">]</span> <span class="roman">[</span><code>weak-values:</code> <var>weak-values</var><span class="roman">]</span> <span class="roman">[</span><code>test:</code> <var>test</var><span class="roman">]</span> <span class="roman">[</span><code>hash:</code> <var>hash</var><span class="roman">]</span> <span class="roman">[</span><code>min-load:</code> <var>min-load</var><span class="roman">]</span> <span class="roman">[</span><code>max-load:</code> <var>max-load</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7270 |
|
| 7271 |
<p>The procedure <code>list->table</code> returns a new table containing the |
| 7272 |
key/value bindings in the association list <var>list</var>. The optional |
| 7273 |
keyword parameters specify various parameters of the table and have |
| 7274 |
the same meaning as for the <code>make-table</code> procedure. |
| 7275 |
</p> |
| 7276 |
<p>Each element of <var>list</var> is a pair whose car field is a key and |
| 7277 |
whose cdr field is the value bound to that key. If a key appears more |
| 7278 |
than once in <var>list</var> (tested using the table’s key comparison |
| 7279 |
procedure) it is the first key/value binding in <var>list</var> that has |
| 7280 |
precedence. |
| 7281 |
</p> |
| 7282 |
<p>For example: |
| 7283 |
</p> |
| 7284 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (list->table '((b . 2) (a . 1) (c . 3) (a . 4))))</b> |
| 7285 |
> <b>(table->list t)</b> |
| 7286 |
((a . 1) (b . 2) (c . 3)) |
| 7287 |
</pre></td></tr></table> |
| 7288 |
|
| 7289 |
|
| 7290 |
|
| 7291 |
<a name="Definition_of_unbound-table-key-exception?"></a><a name="Procedure_unbound-table-key-exception?"></a><a name="index-unbound_002dtable_002dkey_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception?">unbound-table-key-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7292 |
<a name="Definition_of_unbound-table-key-exception-procedure"></a><a name="Procedure_unbound-table-key-exception-procedure"></a><a name="index-unbound_002dtable_002dkey_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception-procedure">unbound-table-key-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7293 |
<a name="Definition_of_unbound-table-key-exception-arguments"></a><a name="Procedure_unbound-table-key-exception-arguments"></a><a name="index-unbound_002dtable_002dkey_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-table-key-exception-arguments">unbound-table-key-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7294 |
|
| 7295 |
<p>Unbound-table-key-exception objects are raised by the procedure |
| 7296 |
<code>table-ref</code> when the key does not have a binding in the table. |
| 7297 |
The parameter <var>exc</var> must be an unbound-table-key-exception object. |
| 7298 |
</p> |
| 7299 |
<p>The procedure <code>unbound-table-key-exception?</code> returns |
| 7300 |
<code>#t</code> when <var>obj</var> is a unbound-table-key-exception |
| 7301 |
object and <code>#f</code> otherwise. |
| 7302 |
</p> |
| 7303 |
<p>The procedure <code>unbound-table-key-exception-procedure</code> |
| 7304 |
returns the procedure that raised <var>exc</var>. |
| 7305 |
</p> |
| 7306 |
<p>The procedure <code>unbound-table-key-exception-arguments</code> |
| 7307 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 7308 |
</p> |
| 7309 |
<p>For example: |
| 7310 |
</p> |
| 7311 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (make-table))</b> |
| 7312 |
> <b>(define (handler exc) |
| 7313 |
(if (unbound-table-key-exception? exc) |
| 7314 |
(list (unbound-table-key-exception-procedure exc) |
| 7315 |
(unbound-table-key-exception-arguments exc)) |
| 7316 |
'not-unbound-table-key-exception))</b> |
| 7317 |
> <b>(with-exception-catcher |
| 7318 |
handler |
| 7319 |
(lambda () (table-ref t '(1 2))))</b> |
| 7320 |
(#<procedure #2 table-ref> (#<table #3> (1 2))) |
| 7321 |
</pre></td></tr></table> |
| 7322 |
|
| 7323 |
|
| 7324 |
|
| 7325 |
<a name="Definition_of_table-copy"></a><a name="Procedure_table-copy"></a><a name="index-table_002dcopy"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-copy">table-copy</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7326 |
|
| 7327 |
<p>The procedure <code>table-copy</code> returns a new table containing the |
| 7328 |
same key/value bindings as <var>table</var> and the same table parameters |
| 7329 |
(i.e. hash procedure, key comparison procedure, key and value |
| 7330 |
weakness, etc). |
| 7331 |
</p> |
| 7332 |
<p>For example: |
| 7333 |
</p> |
| 7334 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t (list->table '((b . 2) (a . 1) (c . 3))))</b> |
| 7335 |
> <b>(define x (table-copy t))</b> |
| 7336 |
> <b>(table-set! t 'b 99)</b> |
| 7337 |
> <b>(table->list t)</b> |
| 7338 |
((a . 1) (b . 99) (c . 3)) |
| 7339 |
> <b>(table->list x)</b> |
| 7340 |
((a . 1) (b . 2) (c . 3)) |
| 7341 |
</pre></td></tr></table> |
| 7342 |
|
| 7343 |
|
| 7344 |
|
| 7345 |
<a name="Definition_of_table-merge!"></a><a name="Procedure_table-merge!"></a><a name="index-table_002dmerge_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-merge!">table-merge!</a></b></code><i> <var>table1</var> <var>table2</var> <span class="roman">[</span><var>table2-takes-precedence?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7346 |
|
| 7347 |
<p>The procedure <code>table-merge!</code> returns <var>table1</var> after the |
| 7348 |
key/value bindings contained in <var>table2</var> have been added to it. |
| 7349 |
When a key exists both in <var>table1</var> and <var>table2</var>, then the |
| 7350 |
parameter <var>table2-takes-precedence?</var> indicates which binding will |
| 7351 |
be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is |
| 7352 |
false, and the one in <var>table2</var> otherwise). If |
| 7353 |
<var>table2-takes-precedence?</var> is not specified the binding in |
| 7354 |
<var>table1</var> is kept. |
| 7355 |
</p> |
| 7356 |
<p>For example: |
| 7357 |
</p> |
| 7358 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b> |
| 7359 |
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b> |
| 7360 |
> <b>(table->list (table-merge! t1 t2))</b> |
| 7361 |
((a . 1) (b . 2) (c . 3) (z . 6)) |
| 7362 |
> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b> |
| 7363 |
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b> |
| 7364 |
> <b>(table->list (table-merge! t1 t2 #t))</b> |
| 7365 |
((a . 4) (b . 5) (c . 3) (z . 6)) |
| 7366 |
</pre></td></tr></table> |
| 7367 |
|
| 7368 |
|
| 7369 |
|
| 7370 |
<a name="Definition_of_table-merge"></a><a name="Procedure_table-merge"></a><a name="index-table_002dmerge"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_table-merge">table-merge</a></b></code><i> <var>table1</var> <var>table2</var> <span class="roman">[</span><var>table2-takes-precedence?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7371 |
|
| 7372 |
<p>The procedure <code>table-merge</code> returns a copy of <var>table1</var> |
| 7373 |
(created with <code>table-copy</code>) to which the key/value bindings |
| 7374 |
contained in <var>table2</var> have been added using <code>table-merge!</code>. |
| 7375 |
When a key exists both in <var>table1</var> and <var>table2</var>, then the |
| 7376 |
parameter <var>table2-takes-precedence?</var> indicates which binding will |
| 7377 |
be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is |
| 7378 |
false, and the one in <var>table2</var> otherwise). If |
| 7379 |
<var>table2-takes-precedence?</var> is not specified the binding in |
| 7380 |
<var>table1</var> is kept. |
| 7381 |
</p> |
| 7382 |
<p>For example: |
| 7383 |
</p> |
| 7384 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define t1 (list->table '((a . 1) (b . 2) (c . 3))))</b> |
| 7385 |
> <b>(define t2 (list->table '((a . 4) (b . 5) (z . 6))))</b> |
| 7386 |
> <b>(table->list (table-merge t1 t2))</b> |
| 7387 |
((a . 1) (b . 2) (c . 3) (z . 6)) |
| 7388 |
> <b>(table->list (table-merge t1 t2 #t))</b> |
| 7389 |
((a . 4) (b . 5) (c . 3) (z . 6)) |
| 7390 |
</pre></td></tr></table> |
| 7391 |
|
| 7392 |
|
| 7393 |
|
| 7394 |
<a name="Records"></a><hr size="6"><br/><br/><br/> |
| 7395 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7396 |
<tr><td valign="middle" align="left"><a href="#Tables" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7397 |
<td valign="middle" align="left"><a href="#Threads" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7398 |
<td valign="middle" align="left"> </td> |
| 7399 |
<td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7400 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7401 |
<td valign="middle" align="left"><a href="#Threads" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7402 |
<td valign="middle" align="left"> </td> |
| 7403 |
<td valign="middle" align="left"> </td> |
| 7404 |
<td valign="middle" align="left"> </td> |
| 7405 |
<td valign="middle" align="left"> </td> |
| 7406 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7407 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7408 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7409 |
</tr></table> |
| 7410 |
<a name="Records-1"></a> |
| 7411 |
<h1 class="chapter">12. Records</h1> |
| 7412 |
|
| 7413 |
<a name="Definition_of_define-structure"></a><a name="Special_form_define-structure"></a><a name="index-define_002dstructure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_define-structure">define-structure</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>field</i></span>…</i><code>)</code></td><td align="right">special form</td></tr></table> |
| 7414 |
|
| 7415 |
<p>Record data types similar to Pascal records and C <code>struct</code> |
| 7416 |
types can be defined using the <code>define-structure</code> special form. |
| 7417 |
The identifier <i>name</i> specifies the name of the new data type. The |
| 7418 |
structure name is followed by <var>k</var> identifiers naming each field of |
| 7419 |
the record. The <code>define-structure</code> expands into a set of definitions |
| 7420 |
of the following procedures: |
| 7421 |
</p> |
| 7422 |
<ul> |
| 7423 |
<li> |
| 7424 |
‘<tt>make-</tt><i>name</i>’ – A <var>k</var> argument procedure which constructs |
| 7425 |
a new record from the value of its <var>k</var> fields. |
| 7426 |
|
| 7427 |
</li><li> |
| 7428 |
‘<i>name</i><tt>?</tt>’ – A procedure which tests if its single argument |
| 7429 |
is of the given record type. |
| 7430 |
|
| 7431 |
</li><li> |
| 7432 |
‘<i>name</i><tt>-</tt><i>field</i>’ – For each field, a procedure taking |
| 7433 |
as its single argument a value of the given record type and returning |
| 7434 |
the content of the corresponding field of the record. |
| 7435 |
|
| 7436 |
</li><li> |
| 7437 |
‘<i>name</i><tt>-</tt><i>field</i><tt>-set!</tt>’ – For each field, a two |
| 7438 |
argument procedure taking as its first argument a value of the given |
| 7439 |
record type. The second argument gets assigned to the corresponding |
| 7440 |
field of the record and the void object is returned. |
| 7441 |
|
| 7442 |
</li></ul> |
| 7443 |
|
| 7444 |
<p>Record data types have a printed representation that includes the name |
| 7445 |
of the type and the name and value of each field. Record data types |
| 7446 |
can not be read by the <code>read</code> procedure. |
| 7447 |
</p> |
| 7448 |
<p>For example: |
| 7449 |
</p> |
| 7450 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define-structure point x y color)</b> |
| 7451 |
> <b>(define p (make-point 3 5 'red))</b> |
| 7452 |
> <b>p</b> |
| 7453 |
#<point #2 x: 3 y: 5 color: red> |
| 7454 |
> <b>(point-x p)</b> |
| 7455 |
3 |
| 7456 |
> <b>(point-color p)</b> |
| 7457 |
red |
| 7458 |
> <b>(point-color-set! p 'black)</b> |
| 7459 |
> <b>p</b> |
| 7460 |
#<point #2 x: 3 y: 5 color: black> |
| 7461 |
</pre></td></tr></table> |
| 7462 |
|
| 7463 |
|
| 7464 |
|
| 7465 |
<a name="Threads"></a><hr size="6"><br/><br/><br/> |
| 7466 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7467 |
<tr><td valign="middle" align="left"><a href="#Records" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7468 |
<td valign="middle" align="left"><a href="#Introduction" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7469 |
<td valign="middle" align="left"> </td> |
| 7470 |
<td valign="middle" align="left"><a href="#Records" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7471 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7472 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7473 |
<td valign="middle" align="left"> </td> |
| 7474 |
<td valign="middle" align="left"> </td> |
| 7475 |
<td valign="middle" align="left"> </td> |
| 7476 |
<td valign="middle" align="left"> </td> |
| 7477 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7478 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7479 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7480 |
</tr></table> |
| 7481 |
<a name="Threads-1"></a> |
| 7482 |
<h1 class="chapter">13. Threads</h1> |
| 7483 |
<a name="index-threads"></a> |
| 7484 |
|
| 7485 |
<p>Gambit supports the execution of multiple Scheme threads. These |
| 7486 |
threads are managed entirely by Gambit’s runtime and are not related |
| 7487 |
to the host operating system’s threads. Gambit’s runtime does not |
| 7488 |
currently take advantage of multiprocessors (i.e. at most one thread is |
| 7489 |
running). |
| 7490 |
</p> |
| 7491 |
<table class="menu" border="0" cellspacing="0"> |
| 7492 |
<tr><td align="left" valign="top"><a href="#Introduction">13.1 Introduction</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7493 |
<tr><td align="left" valign="top"><a href="#Thread-objects">13.2 Thread objects</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7494 |
<tr><td align="left" valign="top"><a href="#Mutex-objects">13.3 Mutex objects</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7495 |
<tr><td align="left" valign="top"><a href="#Condition-variable-objects">13.4 Condition variable objects</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7496 |
<tr><td align="left" valign="top"><a href="#Fairness">13.5 Fairness</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7497 |
<tr><td align="left" valign="top"><a href="#Memory-coherency">13.6 Memory coherency</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7498 |
<tr><td align="left" valign="top"><a href="#Timeouts">13.7 Timeouts</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7499 |
<tr><td align="left" valign="top"><a href="#Primordial-thread">13.8 Primordial thread</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7500 |
<tr><td align="left" valign="top"><a href="#Procedures">13.9 Procedures</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 7501 |
</table> |
| 7502 |
|
| 7503 |
<a name="Introduction"></a><hr size="6"><br/><br/><br/> |
| 7504 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7505 |
<tr><td valign="middle" align="left"><a href="#Threads" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7506 |
<td valign="middle" align="left"><a href="#Thread-objects" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7507 |
<td valign="middle" align="left"> </td> |
| 7508 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7509 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7510 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7511 |
<td valign="middle" align="left"> </td> |
| 7512 |
<td valign="middle" align="left"> </td> |
| 7513 |
<td valign="middle" align="left"> </td> |
| 7514 |
<td valign="middle" align="left"> </td> |
| 7515 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7516 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7517 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7518 |
</tr></table> |
| 7519 |
<a name="Introduction-1"></a> |
| 7520 |
<h2 class="section">13.1 Introduction</h2> |
| 7521 |
|
| 7522 |
<p>Multithreading is a paradigm that is well suited for building complex |
| 7523 |
systems such as: servers, GUIs, and high-level operating systems. |
| 7524 |
Gambit’s thread system offers mechanisms for creating threads of |
| 7525 |
execution and for synchronizing them. The thread system also supports |
| 7526 |
features which are useful in a real-time context, such as priorities, |
| 7527 |
priority inheritance and timeouts. |
| 7528 |
</p> |
| 7529 |
<p>The thread system provides the following data types: |
| 7530 |
</p> |
| 7531 |
<ul> |
| 7532 |
<li> |
| 7533 |
Thread (a virtual processor which shares object space with all other |
| 7534 |
threads) |
| 7535 |
|
| 7536 |
</li><li> |
| 7537 |
Mutex (a mutual exclusion device, also known as a lock and binary |
| 7538 |
semaphore) |
| 7539 |
|
| 7540 |
</li><li> |
| 7541 |
Condition variable (a set of blocked threads) |
| 7542 |
|
| 7543 |
</li></ul> |
| 7544 |
|
| 7545 |
<a name="Thread-objects"></a><hr size="6"><br/><br/><br/> |
| 7546 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7547 |
<tr><td valign="middle" align="left"><a href="#Introduction" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7548 |
<td valign="middle" align="left"><a href="#Mutex-objects" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7549 |
<td valign="middle" align="left"> </td> |
| 7550 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7551 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7552 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7553 |
<td valign="middle" align="left"> </td> |
| 7554 |
<td valign="middle" align="left"> </td> |
| 7555 |
<td valign="middle" align="left"> </td> |
| 7556 |
<td valign="middle" align="left"> </td> |
| 7557 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7558 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7559 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7560 |
</tr></table> |
| 7561 |
<a name="Thread-objects-1"></a> |
| 7562 |
<h2 class="section">13.2 Thread objects</h2> |
| 7563 |
|
| 7564 |
<p>A <em>running thread</em> is a thread that is currently executing. A |
| 7565 |
<em>runnable thread</em> is a thread that is ready to execute or running. |
| 7566 |
A thread is <em>blocked</em> if it is waiting for a mutex to become |
| 7567 |
unlocked, an I/O operation to become possible, the end of a “sleep” |
| 7568 |
period, etc. A <em>new thread</em> is a thread that has been allocated |
| 7569 |
but has not yet been initialized. An <em>initialized thread</em> is a |
| 7570 |
thread that can be made runnable. A new thread becomes runnable when |
| 7571 |
it is started by calling <code>thread-start!</code>. A <em>terminated |
| 7572 |
thread</em> is a thread that can no longer become runnable (but |
| 7573 |
<em>deadlocked threads</em> are not considered terminated). The only |
| 7574 |
valid transitions between the thread states are from new to |
| 7575 |
initialized, from initialized to runnable, between runnable and |
| 7576 |
blocked, and from any state except new to terminated as indicated in |
| 7577 |
the following diagram: |
| 7578 |
</p> |
| 7579 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> <b>unblock</b> |
| 7580 |
<b>start</b> <------- |
| 7581 |
NEW -------> INITIALIZED -------> RUNNABLE -------> BLOCKED |
| 7582 |
\ | <b>block</b> / |
| 7583 |
\ v / |
| 7584 |
+-----> TERMINATED <----+ |
| 7585 |
</pre></td></tr></table> |
| 7586 |
|
| 7587 |
<p>Each thread has a <em>base priority</em>, which is a real number (where a |
| 7588 |
higher numerical value means a higher priority), a <em>priority boost</em>, |
| 7589 |
which is a nonnegative real number representing the priority increase |
| 7590 |
applied to a thread when it blocks, and a <em>quantum</em>, which is a |
| 7591 |
nonnegative real number representing a duration in seconds. |
| 7592 |
</p> |
| 7593 |
<p>Each thread has a <em>specific field</em> which can be used in an |
| 7594 |
application specific way to associate data with the thread (some thread |
| 7595 |
systems call this “thread local storage”). |
| 7596 |
</p> |
| 7597 |
<p>Each thread has a <em>mailbox</em> which is used for inter-thread |
| 7598 |
communication. |
| 7599 |
</p> |
| 7600 |
<a name="Mutex-objects"></a><hr size="6"><br/><br/><br/> |
| 7601 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7602 |
<tr><td valign="middle" align="left"><a href="#Thread-objects" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7603 |
<td valign="middle" align="left"><a href="#Condition-variable-objects" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7604 |
<td valign="middle" align="left"> </td> |
| 7605 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7606 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7607 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7608 |
<td valign="middle" align="left"> </td> |
| 7609 |
<td valign="middle" align="left"> </td> |
| 7610 |
<td valign="middle" align="left"> </td> |
| 7611 |
<td valign="middle" align="left"> </td> |
| 7612 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7613 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7614 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7615 |
</tr></table> |
| 7616 |
<a name="Mutex-objects-1"></a> |
| 7617 |
<h2 class="section">13.3 Mutex objects</h2> |
| 7618 |
|
| 7619 |
<p>A mutex can be in one of four states: <em>locked</em> (either <em>owned</em> |
| 7620 |
or <em>not owned</em>) and <em>unlocked</em> (either <em>abandoned</em> or |
| 7621 |
<em>not abandoned</em>). |
| 7622 |
</p> |
| 7623 |
<p>An attempt to lock a mutex only succeeds if the mutex is in an unlocked |
| 7624 |
state, otherwise the current thread will wait. A mutex in the |
| 7625 |
locked/owned state has an associated <em>owner thread</em>, which by |
| 7626 |
convention is the thread that is responsible for unlocking the mutex |
| 7627 |
(this case is typical of critical sections implemented as “lock mutex, |
| 7628 |
perform operation, unlock mutex”). A mutex in the locked/not-owned |
| 7629 |
state is not linked to a particular thread. |
| 7630 |
</p> |
| 7631 |
<p>A mutex becomes locked when a thread locks it using the |
| 7632 |
‘<samp>mutex-lock!</samp>’ primitive. A mutex becomes unlocked/abandoned when |
| 7633 |
the owner of a locked/owned mutex terminates. A mutex becomes |
| 7634 |
unlocked/not-abandoned when a thread unlocks it using the |
| 7635 |
‘<samp>mutex-unlock!</samp>’ primitive. |
| 7636 |
</p> |
| 7637 |
<p>The mutex primitives do not implement <em>recursive mutex semantics</em>. |
| 7638 |
An attempt to lock a mutex that is locked implies that the current |
| 7639 |
thread waits even if the mutex is owned by the current thread (this can |
| 7640 |
lead to a deadlock if no other thread unlocks the mutex). |
| 7641 |
</p> |
| 7642 |
<p>Each mutex has a <em>specific field</em> which can be used in an |
| 7643 |
application specific way to associate data with the mutex. |
| 7644 |
</p> |
| 7645 |
<a name="Condition-variable-objects"></a><hr size="6"><br/><br/><br/> |
| 7646 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7647 |
<tr><td valign="middle" align="left"><a href="#Mutex-objects" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7648 |
<td valign="middle" align="left"><a href="#Fairness" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7649 |
<td valign="middle" align="left"> </td> |
| 7650 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7651 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7652 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7653 |
<td valign="middle" align="left"> </td> |
| 7654 |
<td valign="middle" align="left"> </td> |
| 7655 |
<td valign="middle" align="left"> </td> |
| 7656 |
<td valign="middle" align="left"> </td> |
| 7657 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7658 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7659 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7660 |
</tr></table> |
| 7661 |
<a name="Condition-variable-objects-1"></a> |
| 7662 |
<h2 class="section">13.4 Condition variable objects</h2> |
| 7663 |
|
| 7664 |
<p>A condition variable represents a set of blocked threads. These blocked |
| 7665 |
threads are waiting for a certain condition to become true. When a |
| 7666 |
thread modifies some program state that might make the condition true, |
| 7667 |
the thread unblocks some number of threads (one or all depending on the |
| 7668 |
primitive used) so they can check if the condition is now true. This |
| 7669 |
allows complex forms of interthread synchronization to be expressed more |
| 7670 |
conveniently than with mutexes alone. |
| 7671 |
</p> |
| 7672 |
<p>Each condition variable has a <em>specific field</em> which can be used in |
| 7673 |
an application specific way to associate data with the condition |
| 7674 |
variable. |
| 7675 |
</p> |
| 7676 |
<a name="Fairness"></a><hr size="6"><br/><br/><br/> |
| 7677 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7678 |
<tr><td valign="middle" align="left"><a href="#Condition-variable-objects" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7679 |
<td valign="middle" align="left"><a href="#Memory-coherency" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7680 |
<td valign="middle" align="left"> </td> |
| 7681 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7682 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7683 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7684 |
<td valign="middle" align="left"> </td> |
| 7685 |
<td valign="middle" align="left"> </td> |
| 7686 |
<td valign="middle" align="left"> </td> |
| 7687 |
<td valign="middle" align="left"> </td> |
| 7688 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7689 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7690 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7691 |
</tr></table> |
| 7692 |
<a name="Fairness-1"></a> |
| 7693 |
<h2 class="section">13.5 Fairness</h2> |
| 7694 |
|
| 7695 |
<p>In various situations the scheduler must select one thread from a set of |
| 7696 |
threads (e.g. which thread to run when a running thread blocks or |
| 7697 |
expires its quantum, which thread to unblock when a mutex becomes |
| 7698 |
unlocked or a condition variable is signaled). The constraints on the |
| 7699 |
selection process determine the scheduler’s <em>fairness</em>. The |
| 7700 |
selection depends on the order in which threads become runnable or |
| 7701 |
blocked and on the <em>priority</em> attached to the threads. |
| 7702 |
</p> |
| 7703 |
<p>The definition of fairness requires the notion of time ordering, |
| 7704 |
i.e. “event <var>A</var> occured before event <var>B</var>”. For the purpose of |
| 7705 |
establishing time ordering, the scheduler uses a clock with a discrete, |
| 7706 |
usually variable, resolution (a “tick”). Events occuring in a given |
| 7707 |
tick can be considered to be simultaneous (i.e. if event <var>A</var> occured |
| 7708 |
before event <var>B</var> in real time, then the scheduler will claim that |
| 7709 |
event <var>A</var> occured before event <var>B</var> unless both events fall |
| 7710 |
within the same tick, in which case the scheduler arbitrarily chooses a |
| 7711 |
time ordering). |
| 7712 |
</p> |
| 7713 |
<p>Each thread <var>T</var> has three priorities which affect fairness; the |
| 7714 |
<em>base priority</em>, the <em>boosted priority</em>, and the <em>effective |
| 7715 |
priority</em>. |
| 7716 |
</p> |
| 7717 |
<ul> |
| 7718 |
<li> |
| 7719 |
The <em>base priority</em> is the value contained in <var>T</var>’s <em>base |
| 7720 |
priority</em> field (which is set with the ‘<samp>thread-base-priority-set!</samp>’ |
| 7721 |
primitive). |
| 7722 |
|
| 7723 |
</li><li> |
| 7724 |
<var>T</var>’s <em>boosted flag</em> field contains a boolean that affects |
| 7725 |
<var>T</var>’s <em>boosted priority</em>. When the boosted flag field is false, |
| 7726 |
the boosted priority is equal to the base priority, otherwise the |
| 7727 |
boosted priority is equal to the base priority plus the value contained |
| 7728 |
in <var>T</var>’s <em>priority boost</em> field (which is set with the |
| 7729 |
‘<samp>thread-priority-boost-set!</samp>’ primitive). The boosted flag field is |
| 7730 |
set to false when a thread is created, when its quantum expires, and |
| 7731 |
when <em>thread-yield!</em> is called. The boosted flag field is set to |
| 7732 |
true when a thread blocks. By carefully choosing the base priority and |
| 7733 |
priority boost, relatively to the other threads, it is possible to set |
| 7734 |
up an interactive thread so that it has good I/O response time without |
| 7735 |
being a CPU hog when it performs long computations. |
| 7736 |
|
| 7737 |
</li><li> |
| 7738 |
The <em>effective priority</em> is equal to the maximum of <var>T</var>’s |
| 7739 |
boosted priority and the effective priority of all the threads that are |
| 7740 |
blocked on a mutex owned by <var>T</var>. This <em>priority inheritance</em> |
| 7741 |
avoids priority inversion problems that would prevent a high priority |
| 7742 |
thread blocked at the entry of a critical section to progress because a |
| 7743 |
low priority thread inside the critical section is preempted for an |
| 7744 |
arbitrary long time by a medium priority thread. |
| 7745 |
|
| 7746 |
</li></ul> |
| 7747 |
|
| 7748 |
<p>Let <var>P</var>(<var>T</var>) be the effective priority of thread <var>T</var> and |
| 7749 |
let <var>R</var>(<var>T</var>) be the most recent time when one of the following |
| 7750 |
events occurred for thread <var>T</var>, thus making it runnable: <var>T</var> |
| 7751 |
was started by calling ‘<samp>thread-start!</samp>’, <var>T</var> called |
| 7752 |
‘<samp>thread-yield!</samp>’, <var>T</var> expired its quantum, or <var>T</var> became |
| 7753 |
unblocked. Let the relation <var>NL</var>(<var>T1</var>,<var>T2</var>), “<var>T1</var> |
| 7754 |
no later than <var>T2</var>”, be true if |
| 7755 |
<var>P</var>(<var>T1</var>)<<var>P</var>(<var>T2</var>) or |
| 7756 |
<var>P</var>(<var>T1</var>)=<var>P</var>(<var>T2</var>) and |
| 7757 |
<var>R</var>(<var>T1</var>)><var>R</var>(<var>T2</var>), and false otherwise. The |
| 7758 |
scheduler will schedule the execution of threads in such a way that |
| 7759 |
whenever there is at least one runnable thread, 1) within a finite |
| 7760 |
time at least one thread will be running, and 2) there is never a pair |
| 7761 |
of runnable threads <var>T1</var> and <var>T2</var> for which |
| 7762 |
<var>NL</var>(<var>T1</var>,<var>T2</var>) is true and <var>T1</var> is not running and |
| 7763 |
<var>T2</var> is running. |
| 7764 |
</p> |
| 7765 |
<p>A thread <var>T</var> expires its quantum when an amount of time equal to |
| 7766 |
<var>T</var>’s quantum has elapsed since <var>T</var> entered the running state |
| 7767 |
and <var>T</var> did not block, terminate or call ‘<samp>thread-yield!</samp>’. |
| 7768 |
At that point <var>T</var> exits the running state to allow other threads to |
| 7769 |
run. A thread’s quantum is thus an indication of the rate of progress |
| 7770 |
of the thread relative to the other threads of the same priority. |
| 7771 |
Moreover, the resolution of the timer measuring the running time may |
| 7772 |
cause a certain deviation from the quantum, so a thread’s quantum should |
| 7773 |
only be viewed as an approximation of the time it can run before |
| 7774 |
yielding to another thread. |
| 7775 |
</p> |
| 7776 |
<p>Threads blocked on a given mutex or condition variable will unblock in |
| 7777 |
an order which is consistent with decreasing priority and increasing |
| 7778 |
blocking time (i.e. the highest priority thread unblocks first, and |
| 7779 |
among equal priority threads the one that blocked first unblocks first). |
| 7780 |
</p> |
| 7781 |
<a name="Memory-coherency"></a><hr size="6"><br/><br/><br/> |
| 7782 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7783 |
<tr><td valign="middle" align="left"><a href="#Fairness" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7784 |
<td valign="middle" align="left"><a href="#Timeouts" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7785 |
<td valign="middle" align="left"> </td> |
| 7786 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7787 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7788 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7789 |
<td valign="middle" align="left"> </td> |
| 7790 |
<td valign="middle" align="left"> </td> |
| 7791 |
<td valign="middle" align="left"> </td> |
| 7792 |
<td valign="middle" align="left"> </td> |
| 7793 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7794 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7795 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7796 |
</tr></table> |
| 7797 |
<a name="Memory-coherency-1"></a> |
| 7798 |
<h2 class="section">13.6 Memory coherency</h2> |
| 7799 |
|
| 7800 |
<p>Read and write operations on the store (such as reading and writing a |
| 7801 |
variable, an element of a vector or a string) are not atomic. It is |
| 7802 |
an error for a thread to write a location in the store while some |
| 7803 |
other thread reads or writes that same location. It is the |
| 7804 |
responsibility of the application to avoid write/read and write/write |
| 7805 |
races through appropriate uses of the synchronization primitives. |
| 7806 |
</p> |
| 7807 |
<p>Concurrent reads and writes to ports are allowed. It is the |
| 7808 |
responsibility of the implementation to serialize accesses to a given |
| 7809 |
port using the appropriate synchronization primitives. |
| 7810 |
</p> |
| 7811 |
<a name="Timeouts"></a><hr size="6"><br/><br/><br/> |
| 7812 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7813 |
<tr><td valign="middle" align="left"><a href="#Memory-coherency" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7814 |
<td valign="middle" align="left"><a href="#Primordial-thread" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7815 |
<td valign="middle" align="left"> </td> |
| 7816 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7817 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7818 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7819 |
<td valign="middle" align="left"> </td> |
| 7820 |
<td valign="middle" align="left"> </td> |
| 7821 |
<td valign="middle" align="left"> </td> |
| 7822 |
<td valign="middle" align="left"> </td> |
| 7823 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7824 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7825 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7826 |
</tr></table> |
| 7827 |
<a name="Timeouts-1"></a> |
| 7828 |
<h2 class="section">13.7 Timeouts</h2> |
| 7829 |
|
| 7830 |
<p>All synchronization primitives which take a timeout parameter accept |
| 7831 |
three types of values as a timeout, with the following meaning: |
| 7832 |
</p> |
| 7833 |
<ul> |
| 7834 |
<li> |
| 7835 |
a time object represents an absolute point in time |
| 7836 |
|
| 7837 |
</li><li> |
| 7838 |
an exact or inexact real number represents a relative time in |
| 7839 |
seconds from the moment the primitive was called |
| 7840 |
|
| 7841 |
</li><li> |
| 7842 |
‘<samp>#f</samp>’ means that there is no timeout |
| 7843 |
|
| 7844 |
</li></ul> |
| 7845 |
|
| 7846 |
<p>When a timeout denotes the current time or a time in the past, the |
| 7847 |
synchronization primitive claims that the timeout has been reached |
| 7848 |
only after the other synchronization conditions have been checked. |
| 7849 |
Moreover the thread remains running (it does not enter the blocked |
| 7850 |
state). For example, <code>(mutex-lock! m 0)</code> will lock mutex |
| 7851 |
<code>m</code> and return ‘<samp>#t</samp>’ if <code>m</code> is |
| 7852 |
currently unlocked, otherwise ‘<samp>#f</samp>’ is returned because the |
| 7853 |
timeout is reached. |
| 7854 |
</p> |
| 7855 |
<a name="Primordial-thread"></a><hr size="6"><br/><br/><br/> |
| 7856 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7857 |
<tr><td valign="middle" align="left"><a href="#Timeouts" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7858 |
<td valign="middle" align="left"><a href="#Procedures" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7859 |
<td valign="middle" align="left"> </td> |
| 7860 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7861 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7862 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7863 |
<td valign="middle" align="left"> </td> |
| 7864 |
<td valign="middle" align="left"> </td> |
| 7865 |
<td valign="middle" align="left"> </td> |
| 7866 |
<td valign="middle" align="left"> </td> |
| 7867 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7868 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7869 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7870 |
</tr></table> |
| 7871 |
<a name="Primordial-thread-1"></a> |
| 7872 |
<h2 class="section">13.8 Primordial thread</h2> |
| 7873 |
|
| 7874 |
<p>The execution of a program is initially under the control of a single |
| 7875 |
thread known as the <em>primordial thread</em>. The primordial thread has an |
| 7876 |
unspecified |
| 7877 |
base priority, priority boost, boosted flag, quantum, |
| 7878 |
name, specific field, dynamic environment, ‘<samp>dynamic-wind</samp>’ |
| 7879 |
stack, and exception-handler. All threads are terminated when the |
| 7880 |
primordial thread terminates (normally or not). |
| 7881 |
</p> |
| 7882 |
<a name="Procedures"></a><hr size="6"><br/><br/><br/> |
| 7883 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 7884 |
<tr><td valign="middle" align="left"><a href="#Primordial-thread" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 7885 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 7886 |
<td valign="middle" align="left"> </td> |
| 7887 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 7888 |
<td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 7889 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 7890 |
<td valign="middle" align="left"> </td> |
| 7891 |
<td valign="middle" align="left"> </td> |
| 7892 |
<td valign="middle" align="left"> </td> |
| 7893 |
<td valign="middle" align="left"> </td> |
| 7894 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 7895 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 7896 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 7897 |
</tr></table> |
| 7898 |
<a name="Procedures-1"></a> |
| 7899 |
<h2 class="section">13.9 Procedures</h2> |
| 7900 |
|
| 7901 |
<a name="Definition_of_current-thread"></a><a name="Procedure_current-thread"></a><a name="index-current_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-thread">current-thread</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7902 |
|
| 7903 |
<p>This procedure returns the current thread. For example: |
| 7904 |
</p> |
| 7905 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-thread)</b> |
| 7906 |
#<thread #1 primordial> |
| 7907 |
> <b>(eq? (current-thread) (current-thread))</b> |
| 7908 |
#t |
| 7909 |
</pre></td></tr></table> |
| 7910 |
|
| 7911 |
|
| 7912 |
|
| 7913 |
<a name="Definition_of_thread?"></a><a name="Procedure_thread?"></a><a name="index-thread_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread?">thread?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7914 |
|
| 7915 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a thread object and |
| 7916 |
<code>#f</code> otherwise. |
| 7917 |
</p> |
| 7918 |
<p>For example: |
| 7919 |
</p> |
| 7920 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread? (current-thread))</b> |
| 7921 |
#t |
| 7922 |
> <b>(thread? 'foo)</b> |
| 7923 |
#f |
| 7924 |
</pre></td></tr></table> |
| 7925 |
|
| 7926 |
|
| 7927 |
|
| 7928 |
<a name="Definition_of_make-thread"></a><a name="Procedure_make-thread"></a><a name="index-make_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-thread">make-thread</a></b></code><i> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7929 |
<a name="Definition_of_make-root-thread"></a><a name="Procedure_make-root-thread"></a><a name="index-make_002droot_002dthread"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-root-thread">make-root-thread</a></b></code><i> <var>thunk</var> <span class="roman">[</span><var>name</var> <span class="roman">[</span><var>thread-group</var> <span class="roman">[</span><var>input-port</var> <span class="roman">[</span><var>output-port</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7930 |
|
| 7931 |
<p>The <code>make-thread</code> procedure creates and returns an initialized |
| 7932 |
thread. This thread is not automatically made runnable (the procedure |
| 7933 |
<code>thread-start!</code> must be used for this). A thread has the |
| 7934 |
following fields: base priority, priority boost, boosted flag, |
| 7935 |
quantum, name, specific, end-result, end-exception, and a list of |
| 7936 |
locked/owned mutexes it owns. The thread’s execution consists of a |
| 7937 |
call to <var>thunk</var> with the <em>initial continuation</em>. This |
| 7938 |
continuation causes the (then) current thread to store the result in |
| 7939 |
its end-result field, abandon all mutexes it owns, and finally |
| 7940 |
terminate. The ‘<samp>dynamic-wind</samp>’ stack of the initial continuation |
| 7941 |
is empty. The optional <var>name</var> is an arbitrary Scheme object which |
| 7942 |
identifies the thread (useful for debugging); it defaults to an |
| 7943 |
unspecified value. The specific field is set to an unspecified value. |
| 7944 |
The optional <var>thread-group</var> indicates which thread group this |
| 7945 |
thread belongs to; it defaults to the thread group of the current |
| 7946 |
thread. The base priority, priority boost, and quantum of the thread |
| 7947 |
are set to the same value as the current thread and the boosted flag |
| 7948 |
is set to false. The thread’s mailbox is initially empty. The thread |
| 7949 |
inherits the dynamic environment from the current thread. Moreover, in |
| 7950 |
this dynamic environment the exception-handler is bound to the |
| 7951 |
<em>initial exception-handler</em> which is a unary procedure which |
| 7952 |
causes the (then) current thread to store in its end-exception field |
| 7953 |
an uncaught-exception object whose “reason” is the argument of the |
| 7954 |
handler, abandon all mutexes it owns, and finally terminate. |
| 7955 |
</p> |
| 7956 |
<p>The <code>make-root-thread</code> procedure behaves like the |
| 7957 |
<code>make-thread</code> procedure except the created thread does not |
| 7958 |
inherit the dynamic environment from the current thread and the base |
| 7959 |
priority is set to 0, the priority boost is set to 1.0e-6, and the |
| 7960 |
quantum is set to 0.02. The dynamic environment of the thread has the |
| 7961 |
global bindings of the parameter objects, except |
| 7962 |
<code>current-input-port</code> which is bound to <var>input-port</var>, |
| 7963 |
<code>current-output-port</code> which is bound to <var>output-port</var>, and |
| 7964 |
<code>current-directory</code> which is bound to the initial current working |
| 7965 |
directory of the current process. If <var>input-port</var> is not |
| 7966 |
specified it defaults to a port corresponding to the standard input |
| 7967 |
(‘<samp>stdin</samp>’). If <var>output-port</var> is not specified it defaults to |
| 7968 |
a port corresponding to the standard output (‘<samp>stdout</samp>’). |
| 7969 |
</p> |
| 7970 |
<p>For example: |
| 7971 |
</p> |
| 7972 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-thread (lambda () (write 'hello)))</b> |
| 7973 |
#<thread #2> |
| 7974 |
> <b>(make-root-thread (lambda () (write 'world)) 'a-name)</b> |
| 7975 |
#<thread #3 a-name> |
| 7976 |
</pre></td></tr></table> |
| 7977 |
|
| 7978 |
|
| 7979 |
|
| 7980 |
<a name="Definition_of_thread-name"></a><a name="Procedure_thread-name"></a><a name="index-thread_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-name">thread-name</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7981 |
|
| 7982 |
<p>This procedure returns the name of the <var>thread</var>. For example: |
| 7983 |
</p> |
| 7984 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-name (make-thread (lambda () #f) 'foo))</b> |
| 7985 |
foo |
| 7986 |
</pre></td></tr></table> |
| 7987 |
|
| 7988 |
|
| 7989 |
|
| 7990 |
<a name="Definition_of_thread-specific"></a><a name="Procedure_thread-specific"></a><a name="index-thread_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-specific">thread-specific</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7991 |
<a name="Definition_of_thread-specific-set!"></a><a name="Procedure_thread-specific-set!"></a><a name="index-thread_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-specific-set!">thread-specific-set!</a></b></code><i> <var>thread</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 7992 |
|
| 7993 |
<p>The <code>thread-specific</code> procedure returns the content of the |
| 7994 |
<var>thread</var>’s specific field. |
| 7995 |
</p> |
| 7996 |
<p>The <code>thread-specific-set!</code> procedure stores <var>obj</var> into the |
| 7997 |
<var>thread</var>’s specific field and returns an unspecified value. |
| 7998 |
</p> |
| 7999 |
<p>For example: |
| 8000 |
</p> |
| 8001 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-specific-set! (current-thread) "hello")</b> |
| 8002 |
> <b>(thread-specific (current-thread))</b> |
| 8003 |
"hello" |
| 8004 |
</pre></td></tr></table> |
| 8005 |
|
| 8006 |
|
| 8007 |
|
| 8008 |
<a name="Definition_of_thread-base-priority"></a><a name="Procedure_thread-base-priority"></a><a name="index-thread_002dbase_002dpriority"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-base-priority">thread-base-priority</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8009 |
<a name="Definition_of_thread-base-priority-set!"></a><a name="Procedure_thread-base-priority-set!"></a><a name="index-thread_002dbase_002dpriority_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-base-priority-set!">thread-base-priority-set!</a></b></code><i> <var>thread</var> <var>priority</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8010 |
|
| 8011 |
<p>The procedure <code>thread-base-priority</code> returns a real number which |
| 8012 |
corresponds to the base priority of the <var>thread</var>. |
| 8013 |
</p> |
| 8014 |
<p>The procedure <code>thread-base-priority-set!</code> changes the base |
| 8015 |
priority of the <var>thread</var> to <var>priority</var> and returns an |
| 8016 |
unspecified value. The <var>priority</var> must be a real number. |
| 8017 |
</p> |
| 8018 |
<p>For example: |
| 8019 |
</p> |
| 8020 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-base-priority-set! (current-thread) 12.3)</b> |
| 8021 |
> <b>(thread-base-priority (current-thread))</b> |
| 8022 |
12.3 |
| 8023 |
</pre></td></tr></table> |
| 8024 |
|
| 8025 |
|
| 8026 |
|
| 8027 |
<a name="Definition_of_thread-priority-boost"></a><a name="Procedure_thread-priority-boost"></a><a name="index-thread_002dpriority_002dboost"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-priority-boost">thread-priority-boost</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8028 |
<a name="Definition_of_thread-priority-boost-set!"></a><a name="Procedure_thread-priority-boost-set!"></a><a name="index-thread_002dpriority_002dboost_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-priority-boost-set!">thread-priority-boost-set!</a></b></code><i> <var>thread</var> <var>priority-boost</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8029 |
|
| 8030 |
<p>The procedure <code>thread-priority-boost</code> returns a real number which |
| 8031 |
corresponds to the priority boost of the <var>thread</var>. |
| 8032 |
</p> |
| 8033 |
<p>The procedure <code>thread-priority-boost-set!</code> changes the priority |
| 8034 |
boost of the <var>thread</var> to <var>priority-boost</var> and returns an |
| 8035 |
unspecified value. The <var>priority-boost</var> must be a nonnegative |
| 8036 |
real. |
| 8037 |
</p> |
| 8038 |
<p>For example: |
| 8039 |
</p> |
| 8040 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-priority-boost-set! (current-thread) 2.5)</b> |
| 8041 |
> <b>(thread-priority-boost (current-thread))</b> |
| 8042 |
2.5 |
| 8043 |
</pre></td></tr></table> |
| 8044 |
|
| 8045 |
|
| 8046 |
|
| 8047 |
<a name="Definition_of_thread-quantum"></a><a name="Procedure_thread-quantum"></a><a name="index-thread_002dquantum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-quantum">thread-quantum</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8048 |
<a name="Definition_of_thread-quantum-set!"></a><a name="Procedure_thread-quantum-set!"></a><a name="index-thread_002dquantum_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-quantum-set!">thread-quantum-set!</a></b></code><i> <var>thread</var> <var>quantum</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8049 |
|
| 8050 |
<p>The procedure <code>thread-quantum</code> returns a real number which |
| 8051 |
corresponds to the quantum of the <var>thread</var>. |
| 8052 |
</p> |
| 8053 |
<p>The procedure <code>thread-quantum-set!</code> changes the quantum of the |
| 8054 |
<var>thread</var> to <var>quantum</var> and returns an unspecified value. The |
| 8055 |
<var>quantum</var> must be a nonnegative real. A value of zero selects the |
| 8056 |
smallest quantum supported by the implementation. |
| 8057 |
</p> |
| 8058 |
<p>For example: |
| 8059 |
</p> |
| 8060 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-quantum-set! (current-thread) 1.5)</b> |
| 8061 |
> <b>(thread-quantum (current-thread))</b> |
| 8062 |
1.5 |
| 8063 |
> <b>(thread-quantum-set! (current-thread) 0)</b> |
| 8064 |
> <b>(thread-quantum (current-thread))</b> |
| 8065 |
0. |
| 8066 |
</pre></td></tr></table> |
| 8067 |
|
| 8068 |
|
| 8069 |
|
| 8070 |
<a name="Definition_of_thread-start!"></a><a name="Procedure_thread-start!"></a><a name="index-thread_002dstart_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-start!">thread-start!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8071 |
|
| 8072 |
<p>This procedure makes <var>thread</var> runnable and returns the |
| 8073 |
<var>thread</var>. The <var>thread</var> must be an initialized thread. |
| 8074 |
</p> |
| 8075 |
<p>For example: |
| 8076 |
</p> |
| 8077 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((t (thread-start! (make-thread (lambda () (write 'a)))))) |
| 8078 |
(write 'b) |
| 8079 |
(thread-join! t))</b> |
| 8080 |
ab> <span class="roman"><i>or</i></span> ba> |
| 8081 |
</pre></td></tr></table> |
| 8082 |
|
| 8083 |
<p>NOTE: It is useful to separate thread creation and thread activation |
| 8084 |
to avoid the race condition that would occur if the created thread |
| 8085 |
tries to examine a table in which the current thread stores the |
| 8086 |
created thread. See the last example of the <code>thread-terminate!</code> |
| 8087 |
procedure which contains mutually recursive threads. |
| 8088 |
</p> |
| 8089 |
|
| 8090 |
|
| 8091 |
<a name="Definition_of_thread-yield!"></a><a name="Procedure_thread-yield!"></a><a name="index-thread_002dyield_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-yield!">thread-yield!</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8092 |
|
| 8093 |
<p>This procedure causes the current thread to exit the running state as |
| 8094 |
if its quantum had expired and returns an unspecified value. |
| 8095 |
</p> |
| 8096 |
<p>For example: |
| 8097 |
</p> |
| 8098 |
<table><tr><td> </td><td><pre class="smallexample"><b></b><span class="roman"><i>; a busy loop that avoids being too wasteful of the CPU</i></span> |
| 8099 |
|
| 8100 |
(let loop () |
| 8101 |
(if (mutex-lock! m 0) <span class="roman"><i>; try to lock m but don't block</i></span> |
| 8102 |
(begin |
| 8103 |
(display "locked mutex m") |
| 8104 |
(mutex-unlock! m)) |
| 8105 |
(begin |
| 8106 |
(do-something-else) |
| 8107 |
(thread-yield!) <span class="roman"><i>; relinquish rest of quantum</i></span> |
| 8108 |
(loop)))) |
| 8109 |
</pre></td></tr></table> |
| 8110 |
|
| 8111 |
|
| 8112 |
|
| 8113 |
<a name="Definition_of_thread-sleep!"></a><a name="Procedure_thread-sleep!"></a><a name="index-thread_002dsleep_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-sleep!">thread-sleep!</a></b></code><i> <var>timeout</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8114 |
|
| 8115 |
<p>This procedure causes the current thread to wait until the timeout is |
| 8116 |
reached and returns an unspecified value. This blocks the thread only |
| 8117 |
if <var>timeout</var> represents a point in the future. It is an error for |
| 8118 |
<var>timeout</var> to be ‘<samp>#f</samp>’. |
| 8119 |
</p> |
| 8120 |
<p>For example: |
| 8121 |
</p> |
| 8122 |
<table><tr><td> </td><td><pre class="smallexample"><b></b><span class="roman"><i>; a clock with a gradual drift:</i></span> |
| 8123 |
|
| 8124 |
(let loop ((x 1)) |
| 8125 |
(thread-sleep! 1) |
| 8126 |
(write x) |
| 8127 |
(loop (+ x 1))) |
| 8128 |
|
| 8129 |
<span class="roman"><i>; a clock with no drift:</i></span> |
| 8130 |
|
| 8131 |
(let ((start (time->seconds (current-time))) |
| 8132 |
(let loop ((x 1)) |
| 8133 |
(thread-sleep! (seconds->time (+ x start))) |
| 8134 |
(write x) |
| 8135 |
(loop (+ x 1)))) |
| 8136 |
</pre></td></tr></table> |
| 8137 |
|
| 8138 |
|
| 8139 |
|
| 8140 |
<a name="Definition_of_thread-terminate!"></a><a name="Procedure_thread-terminate!"></a><a name="index-thread_002dterminate_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-terminate!">thread-terminate!</a></b></code><i> <var>thread</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8141 |
|
| 8142 |
<p>This procedure causes an abnormal termination of the <var>thread</var>. If |
| 8143 |
the <var>thread</var> is not already terminated, all mutexes owned by the |
| 8144 |
<var>thread</var> become unlocked/abandoned and a |
| 8145 |
terminated-thread-exception object is stored in the <var>thread</var>’s |
| 8146 |
end-exception field. If <var>thread</var> is the current thread, |
| 8147 |
<code>thread-terminate!</code> does not return. Otherwise |
| 8148 |
<code>thread-terminate!</code> returns an unspecified value; the termination |
| 8149 |
of the <var>thread</var> will occur at some point between the calling of |
| 8150 |
<code>thread-terminate!</code> and a finite time in the future (an explicit |
| 8151 |
thread synchronization is needed to detect termination, see |
| 8152 |
<code>thread-join!</code>). |
| 8153 |
</p> |
| 8154 |
<p>For example: |
| 8155 |
</p> |
| 8156 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (amb thunk1 thunk2) |
| 8157 |
(let ((result #f) |
| 8158 |
(result-mutex (make-mutex)) |
| 8159 |
(done-mutex (make-mutex))) |
| 8160 |
(letrec ((child1 |
| 8161 |
(make-thread |
| 8162 |
(lambda () |
| 8163 |
(let ((x (thunk1))) |
| 8164 |
(mutex-lock! result-mutex #f #f) |
| 8165 |
(set! result x) |
| 8166 |
(thread-terminate! child2) |
| 8167 |
(mutex-unlock! done-mutex))))) |
| 8168 |
(child2 |
| 8169 |
(make-thread |
| 8170 |
(lambda () |
| 8171 |
(let ((x (thunk2))) |
| 8172 |
(mutex-lock! result-mutex #f #f) |
| 8173 |
(set! result x) |
| 8174 |
(thread-terminate! child1) |
| 8175 |
(mutex-unlock! done-mutex)))))) |
| 8176 |
(mutex-lock! done-mutex #f #f) |
| 8177 |
(thread-start! child1) |
| 8178 |
(thread-start! child2) |
| 8179 |
(mutex-lock! done-mutex #f #f) |
| 8180 |
result))) |
| 8181 |
</pre></td></tr></table> |
| 8182 |
|
| 8183 |
<p>NOTE: This operation must be used carefully because it terminates a |
| 8184 |
thread abruptly and it is impossible for that thread to perform any |
| 8185 |
kind of cleanup. This may be a problem if the thread is in the middle |
| 8186 |
of a critical section where some structure has been put in an |
| 8187 |
inconsistent state. However, another thread attempting to enter this |
| 8188 |
critical section will raise an abandoned-mutex-exception object |
| 8189 |
because the mutex is unlocked/abandoned. This helps avoid observing |
| 8190 |
an inconsistent state. Clean termination can be obtained by polling, |
| 8191 |
as shown in the example below. |
| 8192 |
</p> |
| 8193 |
<p>For example: |
| 8194 |
</p> |
| 8195 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (spawn thunk) |
| 8196 |
(let ((t (make-thread thunk))) |
| 8197 |
(thread-specific-set! t #t) |
| 8198 |
(thread-start! t) |
| 8199 |
t)) |
| 8200 |
|
| 8201 |
(define (stop! thread) |
| 8202 |
(thread-specific-set! thread #f) |
| 8203 |
(thread-join! thread)) |
| 8204 |
|
| 8205 |
(define (keep-going?) |
| 8206 |
(thread-specific (current-thread))) |
| 8207 |
|
| 8208 |
(define count! |
| 8209 |
(let ((m (make-mutex)) |
| 8210 |
(i 0)) |
| 8211 |
(lambda () |
| 8212 |
(mutex-lock! m) |
| 8213 |
(let ((x (+ i 1))) |
| 8214 |
(set! i x) |
| 8215 |
(mutex-unlock! m) |
| 8216 |
x)))) |
| 8217 |
|
| 8218 |
(define (increment-forever!) |
| 8219 |
(let loop () (count!) (if (keep-going?) (loop)))) |
| 8220 |
|
| 8221 |
(let ((t1 (spawn increment-forever!)) |
| 8222 |
(t2 (spawn increment-forever!))) |
| 8223 |
(thread-sleep! 1) |
| 8224 |
(stop! t1) |
| 8225 |
(stop! t2) |
| 8226 |
(count!)) ==> 377290 |
| 8227 |
</pre></td></tr></table> |
| 8228 |
|
| 8229 |
|
| 8230 |
|
| 8231 |
<a name="Definition_of_thread-join!"></a><a name="Procedure_thread-join!"></a><a name="index-thread_002djoin_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-join!">thread-join!</a></b></code><i> thread <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>timeout-val</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8232 |
|
| 8233 |
<p>This procedure causes the current thread to wait until the |
| 8234 |
<var>thread</var> terminates (normally or not) or until the timeout is |
| 8235 |
reached if <var>timeout</var> is supplied. If the timeout is reached, |
| 8236 |
<var>thread-join!</var> returns <var>timeout-val</var> if it is supplied, |
| 8237 |
otherwise a join-timeout-exception object is raised. If the |
| 8238 |
<var>thread</var> terminated normally, the content of the end-result field |
| 8239 |
is returned, otherwise the content of the end-exception field is |
| 8240 |
raised. |
| 8241 |
</p> |
| 8242 |
<p>For example: |
| 8243 |
</p> |
| 8244 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(let ((t (thread-start! (make-thread (lambda () (expt 2 100)))))) |
| 8245 |
(do-something-else) |
| 8246 |
(thread-join! t)) ==> 1267650600228229401496703205376 |
| 8247 |
|
| 8248 |
(let ((t (thread-start! (make-thread (lambda () (raise 123)))))) |
| 8249 |
(do-something-else) |
| 8250 |
(with-exception-handler |
| 8251 |
(lambda (exc) |
| 8252 |
(if (uncaught-exception? exc) |
| 8253 |
(* 10 (uncaught-exception-reason exc)) |
| 8254 |
99999)) |
| 8255 |
(lambda () |
| 8256 |
(+ 1 (thread-join! t))))) ==> 1231 |
| 8257 |
|
| 8258 |
(define thread-alive? |
| 8259 |
(let ((unique (list 'unique))) |
| 8260 |
(lambda (thread) |
| 8261 |
; Note: this procedure raises an exception if |
| 8262 |
; the thread terminated abnormally. |
| 8263 |
(eq? (thread-join! thread 0 unique) unique)))) |
| 8264 |
|
| 8265 |
(define (wait-for-termination! thread) |
| 8266 |
(let ((eh (current-exception-handler))) |
| 8267 |
(with-exception-handler |
| 8268 |
(lambda (exc) |
| 8269 |
(if (not (or (terminated-thread-exception? exc) |
| 8270 |
(uncaught-exception? exc))) |
| 8271 |
(eh exc))) ; unexpected exceptions are handled by eh |
| 8272 |
(lambda () |
| 8273 |
; The following call to thread-join! will wait until the |
| 8274 |
; thread terminates. If the thread terminated normally |
| 8275 |
; thread-join! will return normally. If the thread |
| 8276 |
; terminated abnormally then one of these two exception |
| 8277 |
; objects is raised by thread-join!: |
| 8278 |
; - terminated-thread-exception object |
| 8279 |
; - uncaught-exception object |
| 8280 |
(thread-join! thread) |
| 8281 |
#f)))) ; ignore result of thread-join! |
| 8282 |
</pre></td></tr></table> |
| 8283 |
|
| 8284 |
|
| 8285 |
|
| 8286 |
<a name="Definition_of_thread-send"></a><a name="Procedure_thread-send"></a><a name="index-thread_002dsend"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-send">thread-send</a></b></code><i> <var>thread</var> <var>msg</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8287 |
|
| 8288 |
<p>Each thread has a mailbox which stores messages delivered to the |
| 8289 |
thread in the order delivered. |
| 8290 |
</p> |
| 8291 |
<p>The procedure <code>thread-send</code> adds the message <var>msg</var> at the end |
| 8292 |
of the mailbox of thread <var>thread</var> and returns an unspecified |
| 8293 |
value. |
| 8294 |
</p> |
| 8295 |
<p>For example: |
| 8296 |
</p> |
| 8297 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-send (current-thread) 111)</b> |
| 8298 |
> <b>(thread-send (current-thread) 222)</b> |
| 8299 |
> <b>(thread-receive)</b> |
| 8300 |
111 |
| 8301 |
> <b>(thread-receive)</b> |
| 8302 |
222 |
| 8303 |
</pre></td></tr></table> |
| 8304 |
|
| 8305 |
|
| 8306 |
|
| 8307 |
<a name="Definition_of_thread-receive"></a><a name="Procedure_thread-receive"></a><a name="index-thread_002dreceive"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-receive">thread-receive</a></b></code><i> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>default</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8308 |
<a name="Definition_of_thread-mailbox-next"></a><a name="Procedure_thread-mailbox-next"></a><a name="index-thread_002dmailbox_002dnext"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-mailbox-next">thread-mailbox-next</a></b></code><i> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>default</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8309 |
<a name="Definition_of_thread-mailbox-rewind"></a><a name="Procedure_thread-mailbox-rewind"></a><a name="index-thread_002dmailbox_002drewind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-mailbox-rewind">thread-mailbox-rewind</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8310 |
<a name="Definition_of_thread-mailbox-extract-and-rewind"></a><a name="Procedure_thread-mailbox-extract-and-rewind"></a><a name="index-thread_002dmailbox_002dextract_002dand_002drewind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_thread-mailbox-extract-and-rewind">thread-mailbox-extract-and-rewind</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8311 |
|
| 8312 |
<p>To allow a thread to examine the messages in its mailbox without |
| 8313 |
removing them from the mailbox, each thread has a <em>mailbox cursor</em> |
| 8314 |
which normally points to the last message accessed in the mailbox. |
| 8315 |
When a mailbox cursor is rewound using the procedure |
| 8316 |
<code>thread-mailbox-rewind</code> or |
| 8317 |
<code>thread-mailbox-extract-and-rewind</code> or <code>thread-receive</code>, the |
| 8318 |
cursor does not point to a message, but the next call to |
| 8319 |
<code>thread-receive</code> and <code>thread-mailbox-next</code> will set the |
| 8320 |
cursor to the oldest message in the mailbox. |
| 8321 |
</p> |
| 8322 |
<p>The procedure <code>thread-receive</code> advances the mailbox cursor of the |
| 8323 |
current thread to the next message, removes that message from the |
| 8324 |
mailbox, rewinds the mailbox cursor, and returns the message. When |
| 8325 |
<var>timeout</var> is not specified, the current thread will wait until a |
| 8326 |
message is available in the mailbox. When <var>timeout</var> is specified |
| 8327 |
and <var>default</var> is not specified, a |
| 8328 |
mailbox-receive-timeout-exception object is raised if the timeout is |
| 8329 |
reached before a message is available. When <var>timeout</var> is |
| 8330 |
specified and <var>default</var> is specified, <var>default</var> is returned if |
| 8331 |
the timeout is reached before a message is available. |
| 8332 |
</p> |
| 8333 |
<p>The procedure <code>thread-mailbox-next</code> behaves like |
| 8334 |
<code>thread-receive</code> except that the message remains in the mailbox |
| 8335 |
and the mailbox cursor is not rewound. |
| 8336 |
</p> |
| 8337 |
<p>The procedures <code>thread-mailbox-rewind</code> or |
| 8338 |
<code>thread-mailbox-extract-and-rewind</code> rewind the mailbox cursor of |
| 8339 |
the current thread so that the next call to <code>thread-mailbox-next</code> |
| 8340 |
and <code>thread-receive</code> will access the oldest message in the |
| 8341 |
mailbox. Additionally the procedure |
| 8342 |
<code>thread-mailbox-extract-and-rewind</code> will remove from the mailbox |
| 8343 |
the message most recently accessed by a call to |
| 8344 |
<code>thread-mailbox-next</code>. When <code>thread-mailbox-next</code> has not |
| 8345 |
been called since the last call to <code>thread-receive</code> or |
| 8346 |
<code>thread-mailbox-rewind</code> or |
| 8347 |
<code>thread-mailbox-extract-and-rewind</code>, a call to |
| 8348 |
<code>thread-mailbox-extract-and-rewind</code> only resets the mailbox |
| 8349 |
cursor (no message is removed). |
| 8350 |
</p> |
| 8351 |
<p>For example: |
| 8352 |
</p> |
| 8353 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(thread-send (current-thread) 111)</b> |
| 8354 |
> <b>(thread-receive 1 999)</b> |
| 8355 |
111 |
| 8356 |
> <b>(thread-send (current-thread) 222)</b> |
| 8357 |
> <b>(thread-send (current-thread) 333)</b> |
| 8358 |
> <b>(thread-mailbox-next 1 999)</b> |
| 8359 |
222 |
| 8360 |
> <b>(thread-mailbox-next 1 999)</b> |
| 8361 |
333 |
| 8362 |
> <b>(thread-mailbox-next 1 999)</b> |
| 8363 |
999 |
| 8364 |
> <b>(thread-mailbox-extract-and-rewind)</b> |
| 8365 |
> <b>(thread-receive 1 999)</b> |
| 8366 |
222 |
| 8367 |
> <b>(thread-receive 1 999)</b> |
| 8368 |
999 |
| 8369 |
</pre></td></tr></table> |
| 8370 |
|
| 8371 |
|
| 8372 |
|
| 8373 |
<a name="Definition_of_mailbox-receive-timeout-exception?"></a><a name="Procedure_mailbox-receive-timeout-exception?"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception?">mailbox-receive-timeout-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8374 |
<a name="Definition_of_mailbox-receive-timeout-exception-procedure"></a><a name="Procedure_mailbox-receive-timeout-exception-procedure"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception-procedure">mailbox-receive-timeout-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8375 |
<a name="Definition_of_mailbox-receive-timeout-exception-arguments"></a><a name="Procedure_mailbox-receive-timeout-exception-arguments"></a><a name="index-mailbox_002dreceive_002dtimeout_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mailbox-receive-timeout-exception-arguments">mailbox-receive-timeout-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8376 |
|
| 8377 |
<p>Mailbox-receive-timeout-exception objects are raised by the procedures |
| 8378 |
<code>thread-receive</code> and <code>thread-mailbox-next</code> when a timeout |
| 8379 |
expires before a message is available and no default value is |
| 8380 |
specified. The parameter <var>exc</var> must be a |
| 8381 |
mailbox-receive-timeout-exception object. |
| 8382 |
</p> |
| 8383 |
<p>The procedure <code>mailbox-receive-timeout-exception?</code> returns |
| 8384 |
<code>#t</code> when <var>obj</var> is a mailbox-receive-timeout-exception |
| 8385 |
object and <code>#f</code> otherwise. |
| 8386 |
</p> |
| 8387 |
<p>The procedure <code>mailbox-receive-timeout-exception-procedure</code> |
| 8388 |
returns the procedure that raised <var>exc</var>. |
| 8389 |
</p> |
| 8390 |
<p>The procedure <code>mailbox-receive-timeout-exception-arguments</code> |
| 8391 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 8392 |
</p> |
| 8393 |
<p>For example: |
| 8394 |
</p> |
| 8395 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 8396 |
(if (mailbox-receive-timeout-exception? exc) |
| 8397 |
(list (mailbox-receive-timeout-exception-procedure exc) |
| 8398 |
(mailbox-receive-timeout-exception-arguments exc)) |
| 8399 |
'not-mailbox-receive-timeout-exception))</b> |
| 8400 |
> <b>(with-exception-catcher |
| 8401 |
handler |
| 8402 |
(lambda () (thread-receive 1)))</b> |
| 8403 |
(#<procedure #2 thread-receive> (1)) |
| 8404 |
</pre></td></tr></table> |
| 8405 |
|
| 8406 |
|
| 8407 |
|
| 8408 |
<a name="Definition_of_mutex?"></a><a name="Procedure_mutex?"></a><a name="index-mutex_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex?">mutex?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8409 |
|
| 8410 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a mutex object and |
| 8411 |
<code>#f</code> otherwise. |
| 8412 |
</p> |
| 8413 |
<p>For example: |
| 8414 |
</p> |
| 8415 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(mutex? (make-mutex))</b> |
| 8416 |
#t |
| 8417 |
> <b>(mutex? 'foo)</b> |
| 8418 |
#f |
| 8419 |
</pre></td></tr></table> |
| 8420 |
|
| 8421 |
|
| 8422 |
|
| 8423 |
<a name="Definition_of_make-mutex"></a><a name="Procedure_make-mutex"></a><a name="index-make_002dmutex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-mutex">make-mutex</a></b></code><i> <span class="roman">[</span><var>name</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8424 |
|
| 8425 |
<p>This procedure returns a new mutex in the unlocked/not-abandoned |
| 8426 |
state. The optional <var>name</var> is an arbitrary Scheme object which |
| 8427 |
identifies the mutex (useful for debugging); it defaults to an |
| 8428 |
unspecified value. The mutex’s specific field is set to an |
| 8429 |
unspecified value. |
| 8430 |
</p> |
| 8431 |
<p>For example: |
| 8432 |
</p> |
| 8433 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-mutex)</b> |
| 8434 |
#<mutex #2> |
| 8435 |
> <b>(make-mutex 'foo)</b> |
| 8436 |
#<mutex #3 foo> |
| 8437 |
</pre></td></tr></table> |
| 8438 |
|
| 8439 |
|
| 8440 |
|
| 8441 |
<a name="Definition_of_mutex-name"></a><a name="Procedure_mutex-name"></a><a name="index-mutex_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-name">mutex-name</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8442 |
|
| 8443 |
<p>Returns the name of the <var>mutex</var>. For example: |
| 8444 |
</p> |
| 8445 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(mutex-name (make-mutex 'foo))</b> |
| 8446 |
foo |
| 8447 |
</pre></td></tr></table> |
| 8448 |
|
| 8449 |
|
| 8450 |
|
| 8451 |
<a name="Definition_of_mutex-specific"></a><a name="Procedure_mutex-specific"></a><a name="index-mutex_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-specific">mutex-specific</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8452 |
<a name="Definition_of_mutex-specific-set!"></a><a name="Procedure_mutex-specific-set!"></a><a name="index-mutex_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-specific-set!">mutex-specific-set!</a></b></code><i> <var>mutex</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8453 |
|
| 8454 |
<p>The <code>mutex-specific</code> procedure returns the content of the |
| 8455 |
<var>mutex</var>’s specific field. |
| 8456 |
</p> |
| 8457 |
<p>The <code>mutex-specific-set!</code> procedure stores <var>obj</var> into the |
| 8458 |
<var>mutex</var>’s specific field and returns an unspecified value. |
| 8459 |
</p> |
| 8460 |
<p>For example: |
| 8461 |
</p> |
| 8462 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define m (make-mutex))</b> |
| 8463 |
> <b>(mutex-specific-set! m "hello")</b> |
| 8464 |
> <b>(mutex-specific m)</b> |
| 8465 |
"hello" |
| 8466 |
> <b>(define (mutex-lock-recursively! mutex) |
| 8467 |
(if (eq? (mutex-state mutex) (current-thread)) |
| 8468 |
(let ((n (mutex-specific mutex))) |
| 8469 |
(mutex-specific-set! mutex (+ n 1))) |
| 8470 |
(begin |
| 8471 |
(mutex-lock! mutex) |
| 8472 |
(mutex-specific-set! mutex 0))))</b> |
| 8473 |
> <b>(define (mutex-unlock-recursively! mutex) |
| 8474 |
(let ((n (mutex-specific mutex))) |
| 8475 |
(if (= n 0) |
| 8476 |
(mutex-unlock! mutex) |
| 8477 |
(mutex-specific-set! mutex (- n 1)))))</b> |
| 8478 |
> <b>(mutex-lock-recursively! m)</b> |
| 8479 |
> <b>(mutex-lock-recursively! m)</b> |
| 8480 |
> <b>(mutex-lock-recursively! m)</b> |
| 8481 |
> <b>(mutex-specific m)</b> |
| 8482 |
2 |
| 8483 |
</pre></td></tr></table> |
| 8484 |
|
| 8485 |
|
| 8486 |
|
| 8487 |
<a name="Definition_of_mutex-state"></a><a name="Procedure_mutex-state"></a><a name="index-mutex_002dstate"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-state">mutex-state</a></b></code><i> <var>mutex</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8488 |
|
| 8489 |
<p>Thos procedure returns information about the state of the <var>mutex</var>. |
| 8490 |
The possible results are: |
| 8491 |
</p> |
| 8492 |
<ul> |
| 8493 |
<li> thread <var>T</var>: |
| 8494 |
the <var>mutex</var> is in the locked/owned state |
| 8495 |
and thread <var>T</var> is the owner of the <var>mutex</var> |
| 8496 |
|
| 8497 |
</li><li> symbol <code>not-owned</code>: |
| 8498 |
the <var>mutex</var> is in the locked/not-owned state |
| 8499 |
|
| 8500 |
</li><li> symbol <code>abandoned</code>: |
| 8501 |
the <var>mutex</var> is in the unlocked/abandoned |
| 8502 |
state |
| 8503 |
|
| 8504 |
</li><li> symbol <code>not-abandoned</code>: |
| 8505 |
the <var>mutex</var> is in the unlocked/not-abandoned |
| 8506 |
state |
| 8507 |
|
| 8508 |
</li></ul> |
| 8509 |
|
| 8510 |
<p>For example: |
| 8511 |
</p> |
| 8512 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(mutex-state (make-mutex)) ==> not-abandoned |
| 8513 |
|
| 8514 |
(define (thread-alive? thread) |
| 8515 |
(let ((mutex (make-mutex))) |
| 8516 |
(mutex-lock! mutex #f thread) |
| 8517 |
(let ((state (mutex-state mutex))) |
| 8518 |
(mutex-unlock! mutex) ; avoid space leak |
| 8519 |
(eq? state thread)))) |
| 8520 |
</pre></td></tr></table> |
| 8521 |
|
| 8522 |
|
| 8523 |
|
| 8524 |
<a name="Definition_of_mutex-lock!"></a><a name="Procedure_mutex-lock!"></a><a name="index-mutex_002dlock_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-lock!">mutex-lock!</a></b></code><i> <var>mutex</var> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>thread</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8525 |
|
| 8526 |
<p>This procedure locks <var>mutex</var>. If the <var>mutex</var> is currently |
| 8527 |
locked, the current thread waits until the <var>mutex</var> is unlocked, or |
| 8528 |
until the timeout is reached if <var>timeout</var> is supplied. If the |
| 8529 |
timeout is reached, <code>mutex-lock!</code> returns ‘<samp>#f</samp>’. Otherwise, |
| 8530 |
the state of the <var>mutex</var> is changed as follows: |
| 8531 |
</p> |
| 8532 |
<ul> |
| 8533 |
<li> if <var>thread</var> is ‘<samp>#f</samp>’ the |
| 8534 |
<var>mutex</var> becomes locked/not-owned, |
| 8535 |
|
| 8536 |
</li><li> otherwise, let <var>T</var> be <var>thread</var> (or the |
| 8537 |
current thread if <var>thread</var> is not |
| 8538 |
supplied), |
| 8539 |
|
| 8540 |
<ul> |
| 8541 |
<li> if <var>T</var> is terminated the <var>mutex</var> |
| 8542 |
becomes unlocked/abandoned, |
| 8543 |
|
| 8544 |
</li><li> otherwise <var>mutex</var> becomes locked/owned |
| 8545 |
with <var>T</var> as the owner. |
| 8546 |
|
| 8547 |
</li></ul> |
| 8548 |
|
| 8549 |
</li></ul> |
| 8550 |
|
| 8551 |
<p>After changing the state of the <var>mutex</var>, an |
| 8552 |
abandoned-mutex-exception object is raised if the <var>mutex</var> was |
| 8553 |
unlocked/abandoned before the state change, otherwise |
| 8554 |
<code>mutex-lock!</code> returns ‘<samp>#t</samp>’. It is not an error if the |
| 8555 |
<var>mutex</var> is owned by the current thread (but the current thread |
| 8556 |
will have to wait). |
| 8557 |
</p> |
| 8558 |
<p>For example: |
| 8559 |
</p> |
| 8560 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this |
| 8561 |
; implementation does not behave well in the presence of forced |
| 8562 |
; thread terminations using thread-terminate! (deadlock can occur |
| 8563 |
; if a thread is terminated in the middle of a put! or get! operation) |
| 8564 |
|
| 8565 |
(define (make-empty-mailbox) |
| 8566 |
(let ((put-mutex (make-mutex)) ; allow put! operation |
| 8567 |
(get-mutex (make-mutex)) |
| 8568 |
(cell #f)) |
| 8569 |
|
| 8570 |
(define (put! obj) |
| 8571 |
(mutex-lock! put-mutex #f #f) ; prevent put! operation |
| 8572 |
(set! cell obj) |
| 8573 |
(mutex-unlock! get-mutex)) ; allow get! operation |
| 8574 |
|
| 8575 |
(define (get!) |
| 8576 |
(mutex-lock! get-mutex #f #f) ; wait until object in mailbox |
| 8577 |
(let ((result cell)) |
| 8578 |
(set! cell #f) ; prevent space leaks |
| 8579 |
(mutex-unlock! put-mutex) ; allow put! operation |
| 8580 |
result)) |
| 8581 |
|
| 8582 |
(mutex-lock! get-mutex #f #f) ; prevent get! operation |
| 8583 |
|
| 8584 |
(lambda (msg) |
| 8585 |
(case msg |
| 8586 |
((put!) put!) |
| 8587 |
((get!) get!) |
| 8588 |
(else (error "unknown message")))))) |
| 8589 |
|
| 8590 |
(define (mailbox-put! m obj) ((m 'put!) obj)) |
| 8591 |
(define (mailbox-get! m) ((m 'get!))) |
| 8592 |
|
| 8593 |
; an alternate implementation of thread-sleep! |
| 8594 |
|
| 8595 |
(define (sleep! timeout) |
| 8596 |
(let ((m (make-mutex))) |
| 8597 |
(mutex-lock! m #f #f) |
| 8598 |
(mutex-lock! m timeout #f))) |
| 8599 |
|
| 8600 |
; a procedure that waits for one of two mutexes to unlock |
| 8601 |
|
| 8602 |
(define (lock-one-of! mutex1 mutex2) |
| 8603 |
; this procedure assumes that neither mutex1 or mutex2 |
| 8604 |
; are owned by the current thread |
| 8605 |
(let ((ct (current-thread)) |
| 8606 |
(done-mutex (make-mutex))) |
| 8607 |
(mutex-lock! done-mutex #f #f) |
| 8608 |
(let ((t1 (thread-start! |
| 8609 |
(make-thread |
| 8610 |
(lambda () |
| 8611 |
(mutex-lock! mutex1 #f ct) |
| 8612 |
(mutex-unlock! done-mutex))))) |
| 8613 |
(t2 (thread-start! |
| 8614 |
(make-thread |
| 8615 |
(lambda () |
| 8616 |
(mutex-lock! mutex2 #f ct) |
| 8617 |
(mutex-unlock! done-mutex)))))) |
| 8618 |
(mutex-lock! done-mutex #f #f) |
| 8619 |
(thread-terminate! t1) |
| 8620 |
(thread-terminate! t2) |
| 8621 |
(if (eq? (mutex-state mutex1) ct) |
| 8622 |
(begin |
| 8623 |
(if (eq? (mutex-state mutex2) ct) |
| 8624 |
(mutex-unlock! mutex2)) ; don't lock both |
| 8625 |
mutex1) |
| 8626 |
mutex2)))) |
| 8627 |
</pre></td></tr></table> |
| 8628 |
|
| 8629 |
|
| 8630 |
|
| 8631 |
<a name="Definition_of_mutex-unlock!"></a><a name="Procedure_mutex-unlock!"></a><a name="index-mutex_002dunlock_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_mutex-unlock!">mutex-unlock!</a></b></code><i> <var>mutex</var> <span class="roman">[</span><var>condition-variable</var> <span class="roman">[</span><var>timeout</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8632 |
|
| 8633 |
<p>This procedure unlocks the <var>mutex</var> by making it |
| 8634 |
unlocked/not-abandoned. It is not an error to unlock an unlocked |
| 8635 |
mutex and a mutex that is owned by any thread. If |
| 8636 |
<var>condition-variable</var> is supplied, the current thread is blocked |
| 8637 |
and added to the <var>condition-variable</var> before unlocking |
| 8638 |
<var>mutex</var>; the thread can unblock at any time but no later than when |
| 8639 |
an appropriate call to <code>condition-variable-signal!</code> or |
| 8640 |
<code>condition-variable-broadcast!</code> is performed (see below), and no |
| 8641 |
later than the timeout (if <var>timeout</var> is supplied). If there are |
| 8642 |
threads waiting to lock this <var>mutex</var>, the scheduler selects a |
| 8643 |
thread, the mutex becomes locked/owned or locked/not-owned, and the |
| 8644 |
thread is unblocked. <code>mutex-unlock!</code> returns ‘<samp>#f</samp>’ when the |
| 8645 |
timeout is reached, otherwise it returns ‘<samp>#t</samp>’. |
| 8646 |
</p> |
| 8647 |
<p>NOTE: The reason the thread can unblock at any time (when |
| 8648 |
<var>condition-variable</var> is supplied) is that the scheduler, when it |
| 8649 |
detects a serious problem such as a deadlock, must interrupt one of |
| 8650 |
the blocked threads (such as the primordial thread) so that it can |
| 8651 |
perform some appropriate action. After a thread blocked on a |
| 8652 |
condition-variable has handled such an interrupt it would be wrong for |
| 8653 |
the scheduler to return the thread to the blocked state, because any |
| 8654 |
calls to <code>condition-variable-broadcast!</code> during the interrupt |
| 8655 |
will have gone unnoticed. It is necessary for the thread to remain |
| 8656 |
runnable and return from the call to <code>mutex-unlock!</code> with a |
| 8657 |
result of ‘<samp>#t</samp>’. |
| 8658 |
</p> |
| 8659 |
<p>NOTE: <code>mutex-unlock!</code> is related to the “wait” operation on |
| 8660 |
condition variables available in other thread systems. The main |
| 8661 |
difference is that “wait” automatically locks <var>mutex</var> just |
| 8662 |
after the thread is unblocked. This operation is not performed by |
| 8663 |
<code>mutex-unlock!</code> and so must be done by an explicit call to |
| 8664 |
<code>mutex-lock!</code>. This has the advantages that a different timeout |
| 8665 |
and exception-handler can be specified on the <code>mutex-lock!</code> and |
| 8666 |
<code>mutex-unlock!</code> and the location of all the mutex operations is |
| 8667 |
clearly apparent. |
| 8668 |
</p> |
| 8669 |
<p>For example: |
| 8670 |
</p> |
| 8671 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(let loop () |
| 8672 |
(mutex-lock! m) |
| 8673 |
(if (condition-is-true?) |
| 8674 |
(begin |
| 8675 |
(do-something-when-condition-is-true) |
| 8676 |
(mutex-unlock! m)) |
| 8677 |
(begin |
| 8678 |
(mutex-unlock! m cv) |
| 8679 |
(loop)))) |
| 8680 |
</pre></td></tr></table> |
| 8681 |
|
| 8682 |
|
| 8683 |
|
| 8684 |
<a name="Definition_of_condition-variable?"></a><a name="Procedure_condition-variable?"></a><a name="index-condition_002dvariable_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable?">condition-variable?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8685 |
|
| 8686 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a |
| 8687 |
condition-variable object and <code>#f</code> otherwise. |
| 8688 |
</p> |
| 8689 |
<p>For example: |
| 8690 |
</p> |
| 8691 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(condition-variable? (make-condition-variable))</b> |
| 8692 |
#t |
| 8693 |
> <b>(condition-variable? 'foo)</b> |
| 8694 |
#f |
| 8695 |
</pre></td></tr></table> |
| 8696 |
|
| 8697 |
|
| 8698 |
|
| 8699 |
<a name="Definition_of_make-condition-variable"></a><a name="Procedure_make-condition-variable"></a><a name="index-make_002dcondition_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-condition-variable">make-condition-variable</a></b></code><i> <span class="roman">[</span><var>name</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8700 |
|
| 8701 |
<p>This procedure returns a new empty condition variable. The optional |
| 8702 |
<var>name</var> is an arbitrary Scheme object which identifies the |
| 8703 |
condition variable (useful for debugging); it defaults to an |
| 8704 |
unspecified value. The condition variable’s specific field is set to |
| 8705 |
an unspecified value. |
| 8706 |
</p> |
| 8707 |
<p>For example: |
| 8708 |
</p> |
| 8709 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(make-condition-variable)</b> |
| 8710 |
#<condition-variable #2> |
| 8711 |
</pre></td></tr></table> |
| 8712 |
|
| 8713 |
|
| 8714 |
|
| 8715 |
<a name="Definition_of_condition-variable-name"></a><a name="Procedure_condition-variable-name"></a><a name="index-condition_002dvariable_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable-name">condition-variable-name</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8716 |
|
| 8717 |
<p>This procedure returns the name of the <var>condition-variable</var>. For |
| 8718 |
example: |
| 8719 |
</p> |
| 8720 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(condition-variable-name (make-condition-variable 'foo))</b> |
| 8721 |
foo |
| 8722 |
</pre></td></tr></table> |
| 8723 |
|
| 8724 |
|
| 8725 |
|
| 8726 |
<a name="Definition_of_condition-variable-specific"></a><a name="Procedure_condition-variable-specific"></a><a name="index-condition_002dvariable_002dspecific"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable-specific">condition-variable-specific</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8727 |
<a name="Definition_of_condition-variable-specific-set!"></a><a name="Procedure_condition-variable-specific-set!"></a><a name="index-condition_002dvariable_002dspecific_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable-specific-set!">condition-variable-specific-set!</a></b></code><i> <var>condition-variable</var> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8728 |
|
| 8729 |
<p>The <code>condition-variable-specific</code> procedure returns the content |
| 8730 |
of the <var>condition-variable</var>’s specific field. |
| 8731 |
</p> |
| 8732 |
<p>The <code>condition-variable-specific-set!</code> procedure stores <var>obj</var> |
| 8733 |
into the <var>condition-variable</var>’s specific field and returns |
| 8734 |
an unspecified value. |
| 8735 |
</p> |
| 8736 |
<p>For example: |
| 8737 |
</p> |
| 8738 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define cv (make-condition-variable))</b> |
| 8739 |
> <b>(condition-variable-specific-set! cv "hello")</b> |
| 8740 |
> <b>(condition-variable-specific cv)</b> |
| 8741 |
"hello" |
| 8742 |
</pre></td></tr></table> |
| 8743 |
|
| 8744 |
|
| 8745 |
|
| 8746 |
<a name="Definition_of_condition-variable-signal!"></a><a name="Procedure_condition-variable-signal!"></a><a name="index-condition_002dvariable_002dsignal_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable-signal!">condition-variable-signal!</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8747 |
|
| 8748 |
<p>This procedure unblocks a thread blocked on the |
| 8749 |
<var>condition-variable</var> (if there is at least one) and returns an |
| 8750 |
unspecified value. |
| 8751 |
</p> |
| 8752 |
<p>For example: |
| 8753 |
</p> |
| 8754 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this |
| 8755 |
; implementation behaves gracefully when threads are forcibly |
| 8756 |
; terminated using thread-terminate! (an abandoned-mutex-exception |
| 8757 |
; object will be raised when a put! or get! operation is attempted |
| 8758 |
; after a thread is terminated in the middle of a put! or get! |
| 8759 |
; operation) |
| 8760 |
|
| 8761 |
(define (make-empty-mailbox) |
| 8762 |
(let ((mutex (make-mutex)) |
| 8763 |
(put-condvar (make-condition-variable)) |
| 8764 |
(get-condvar (make-condition-variable)) |
| 8765 |
(full? #f) |
| 8766 |
(cell #f)) |
| 8767 |
|
| 8768 |
(define (put! obj) |
| 8769 |
(mutex-lock! mutex) |
| 8770 |
(if full? |
| 8771 |
(begin |
| 8772 |
(mutex-unlock! mutex put-condvar) |
| 8773 |
(put! obj)) |
| 8774 |
(begin |
| 8775 |
(set! cell obj) |
| 8776 |
(set! full? #t) |
| 8777 |
(condition-variable-signal! get-condvar) |
| 8778 |
(mutex-unlock! mutex)))) |
| 8779 |
|
| 8780 |
(define (get!) |
| 8781 |
(mutex-lock! mutex) |
| 8782 |
(if (not full?) |
| 8783 |
(begin |
| 8784 |
(mutex-unlock! mutex get-condvar) |
| 8785 |
(get!)) |
| 8786 |
(let ((result cell)) |
| 8787 |
(set! cell #f) ; avoid space leaks |
| 8788 |
(set! full? #f) |
| 8789 |
(condition-variable-signal! put-condvar) |
| 8790 |
(mutex-unlock! mutex) |
| 8791 |
result))) |
| 8792 |
|
| 8793 |
(lambda (msg) |
| 8794 |
(case msg |
| 8795 |
((put!) put!) |
| 8796 |
((get!) get!) |
| 8797 |
(else (error "unknown message")))))) |
| 8798 |
|
| 8799 |
(define (mailbox-put! m obj) ((m 'put!) obj)) |
| 8800 |
(define (mailbox-get! m) ((m 'get!))) |
| 8801 |
</pre></td></tr></table> |
| 8802 |
|
| 8803 |
|
| 8804 |
|
| 8805 |
<a name="Definition_of_condition-variable-broadcast!"></a><a name="Procedure_condition-variable-broadcast!"></a><a name="index-condition_002dvariable_002dbroadcast_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_condition-variable-broadcast!">condition-variable-broadcast!</a></b></code><i> <var>condition-variable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8806 |
|
| 8807 |
<p>This procedure unblocks all the thread blocked on the |
| 8808 |
<var>condition-variable</var> and returns an unspecified value. |
| 8809 |
</p> |
| 8810 |
<p>For example: |
| 8811 |
</p> |
| 8812 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define (make-semaphore n) |
| 8813 |
(vector n (make-mutex) (make-condition-variable))) |
| 8814 |
|
| 8815 |
(define (semaphore-wait! sema) |
| 8816 |
(mutex-lock! (vector-ref sema 1)) |
| 8817 |
(let ((n (vector-ref sema 0))) |
| 8818 |
(if (> n 0) |
| 8819 |
(begin |
| 8820 |
(vector-set! sema 0 (- n 1)) |
| 8821 |
(mutex-unlock! (vector-ref sema 1))) |
| 8822 |
(begin |
| 8823 |
(mutex-unlock! (vector-ref sema 1) (vector-ref sema 2)) |
| 8824 |
(semaphore-wait! sema)))) |
| 8825 |
|
| 8826 |
(define (semaphore-signal-by! sema increment) |
| 8827 |
(mutex-lock! (vector-ref sema 1)) |
| 8828 |
(let ((n (+ (vector-ref sema 0) increment))) |
| 8829 |
(vector-set! sema 0 n) |
| 8830 |
(if (> n 0) |
| 8831 |
(condition-variable-broadcast! (vector-ref sema 2))) |
| 8832 |
(mutex-unlock! (vector-ref sema 1)))) |
| 8833 |
</pre></td></tr></table> |
| 8834 |
|
| 8835 |
|
| 8836 |
|
| 8837 |
<a name="Dynamic-environment"></a><hr size="6"><br/><br/><br/> |
| 8838 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 8839 |
<tr><td valign="middle" align="left"><a href="#Procedures" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 8840 |
<td valign="middle" align="left"><a href="#Exceptions" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 8841 |
<td valign="middle" align="left"> </td> |
| 8842 |
<td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 8843 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 8844 |
<td valign="middle" align="left"><a href="#Exceptions" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 8845 |
<td valign="middle" align="left"> </td> |
| 8846 |
<td valign="middle" align="left"> </td> |
| 8847 |
<td valign="middle" align="left"> </td> |
| 8848 |
<td valign="middle" align="left"> </td> |
| 8849 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 8850 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 8851 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 8852 |
</tr></table> |
| 8853 |
<a name="Dynamic-environment-1"></a> |
| 8854 |
<h1 class="chapter">14. Dynamic environment</h1> |
| 8855 |
|
| 8856 |
<p>The <em>dynamic environment</em> is the structure which allows the system |
| 8857 |
to find the value returned by the standard procedures |
| 8858 |
<code>current-input-port</code> and <code>current-output-port</code>. The |
| 8859 |
standard procedures <code>with-input-from-file</code> and |
| 8860 |
<code>with-output-to-file</code> extend the dynamic environment to produce a |
| 8861 |
new dynamic environment which is in effect for the dynamic extent of |
| 8862 |
the call to the thunk passed as their last argument. These procedures |
| 8863 |
are essentially special purpose dynamic binding operations on hidden |
| 8864 |
dynamic variables (one for <code>current-input-port</code> and one for |
| 8865 |
<code>current-output-port</code>). Gambit generalizes this dynamic binding |
| 8866 |
mechanism to allow the user to introduce new dynamic variables, called |
| 8867 |
<em>parameter objects</em>, and dynamically bind them. The parameter |
| 8868 |
objects implemented by Gambit are compatible with the specification of |
| 8869 |
the “Parameter objects SRFI” (SRFI 39). |
| 8870 |
</p> |
| 8871 |
<p>One important issue is the relationship between the dynamic |
| 8872 |
environments of the parent and child threads when a thread is created. |
| 8873 |
Each thread has its own dynamic environment that is accessed when |
| 8874 |
looking up the value bound to a parameter object by that thread. When |
| 8875 |
a thread’s dynamic environment is extended it does not affect the |
| 8876 |
dynamic environment of other threads. When a thread is created it is |
| 8877 |
given a dynamic environment whose bindings are inherited from the |
| 8878 |
parent thread. In this inherited dynamic environment the parameter |
| 8879 |
objects are bound to the same cells as the parent’s dynamic |
| 8880 |
environment (in other words an assignment of a new value to a |
| 8881 |
parameter object is visible in the other thread). |
| 8882 |
</p> |
| 8883 |
<p>Another important issue is the interaction between the |
| 8884 |
<code>dynamic-wind</code> procedure and dynamic environments. When a thread |
| 8885 |
creates a continuation, the thread’s dynamic environment and the |
| 8886 |
‘<samp>dynamic-wind</samp>’ stack are saved within the continuation (an |
| 8887 |
alternate but equivalent point of view is that the ‘<samp>dynamic-wind</samp>’ |
| 8888 |
stack is part of the dynamic environment). When this continuation is |
| 8889 |
invoked the required ‘<samp>dynamic-wind</samp>’ before and after thunks are |
| 8890 |
called and the saved dynamic environment is reinstated as the dynamic |
| 8891 |
environment of the current thread. During the call to each required |
| 8892 |
‘<samp>dynamic-wind</samp>’ before and after thunk, the dynamic environment |
| 8893 |
and the ‘<samp>dynamic-wind</samp>’ stack in effect when the corresponding |
| 8894 |
‘<samp>dynamic-wind</samp>’ was executed are reinstated. Note that this |
| 8895 |
specification precisely defines the semantics of calling |
| 8896 |
‘<samp>call-with-current-continuation</samp>’ or invoking a continuation |
| 8897 |
within a before or after thunk. The semantics are well defined even |
| 8898 |
when a continuation created by another thread is invoked. Below is an |
| 8899 |
example exercising the subtleties of this semantics. |
| 8900 |
</p> |
| 8901 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(with-output-to-file |
| 8902 |
"foo" |
| 8903 |
(lambda () |
| 8904 |
(let ((k (call-with-current-continuation |
| 8905 |
(lambda (exit) |
| 8906 |
(with-output-to-file |
| 8907 |
"bar" |
| 8908 |
(lambda () |
| 8909 |
(dynamic-wind |
| 8910 |
(lambda () |
| 8911 |
(write '(b1)) |
| 8912 |
(force-output)) |
| 8913 |
(lambda () |
| 8914 |
(let ((x (call-with-current-continuation |
| 8915 |
(lambda (cont) (exit cont))))) |
| 8916 |
(write '(t1)) |
| 8917 |
(force-output) |
| 8918 |
x)) |
| 8919 |
(lambda () |
| 8920 |
(write '(a1)) |
| 8921 |
(force-output))))))))) |
| 8922 |
(if k |
| 8923 |
(dynamic-wind |
| 8924 |
(lambda () |
| 8925 |
(write '(b2)) |
| 8926 |
(force-output)) |
| 8927 |
(lambda () |
| 8928 |
(with-output-to-file |
| 8929 |
"baz" |
| 8930 |
(lambda () |
| 8931 |
(write '(t2)) |
| 8932 |
(force-output) |
| 8933 |
; go back inside (with-output-to-file "bar" ...) |
| 8934 |
(k #f)))) |
| 8935 |
(lambda () |
| 8936 |
(write '(a2)) |
| 8937 |
(force-output))))))) |
| 8938 |
</pre></td></tr></table> |
| 8939 |
|
| 8940 |
<p>The following actions will occur when this code is executed: |
| 8941 |
<code>(b1)(a1)</code> is written to “bar”, <code>(b2)</code> is then written to |
| 8942 |
“foo”, <code>(t2)</code> is then written to “baz”, <code>(a2)</code> is then |
| 8943 |
written to “foo”, and finally <code>(b1)(t1)(a1)</code> is written to |
| 8944 |
“bar”. |
| 8945 |
</p> |
| 8946 |
<a name="Definition_of_make-parameter"></a><a name="Procedure_make-parameter"></a><a name="index-make_002dparameter"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_make-parameter">make-parameter</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>filter</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 8947 |
|
| 8948 |
<p>The dynamic environment is composed of two parts: the <em>local |
| 8949 |
dynamic environment</em> and the <em>global dynamic environment</em>. There |
| 8950 |
is a single global dynamic environment, and it is used to lookup |
| 8951 |
parameter objects that can’t be found in the local dynamic |
| 8952 |
environment. |
| 8953 |
</p> |
| 8954 |
<p>The <code>make-parameter</code> procedure returns a new <em>parameter |
| 8955 |
object</em>. The <var>filter</var> argument is a one argument conversion |
| 8956 |
procedure. If it is not specified, <var>filter</var> defaults to the |
| 8957 |
identity function. |
| 8958 |
</p> |
| 8959 |
<p>The global dynamic environment is updated to associate the parameter |
| 8960 |
object to a new cell. The initial content of the cell is the result |
| 8961 |
of applying the conversion procedure to <var>obj</var>. |
| 8962 |
</p> |
| 8963 |
<p>A parameter object is a procedure which accepts zero or one argument. |
| 8964 |
The cell bound to a particular parameter object in the dynamic |
| 8965 |
environment is accessed by calling the parameter object. When no |
| 8966 |
argument is passed, the content of the cell is returned. When one |
| 8967 |
argument is passed the content of the cell is updated with the result |
| 8968 |
of applying the parameter object’s conversion procedure to the |
| 8969 |
argument. Note that the conversion procedure can be used for |
| 8970 |
guaranteeing the type of the parameter object’s binding and/or to |
| 8971 |
perform some conversion of the value. |
| 8972 |
</p> |
| 8973 |
<p>For example: |
| 8974 |
</p> |
| 8975 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define radix (make-parameter 10))</b> |
| 8976 |
> <b>(radix)</b> |
| 8977 |
10 |
| 8978 |
> <b>(radix 2)</b> |
| 8979 |
> <b>(radix)</b> |
| 8980 |
2 |
| 8981 |
> <b>(define prompt |
| 8982 |
(make-parameter |
| 8983 |
123 |
| 8984 |
(lambda (x) |
| 8985 |
(if (string? x) |
| 8986 |
x |
| 8987 |
(object->string x)))))</b> |
| 8988 |
> <b>(prompt)</b> |
| 8989 |
"123" |
| 8990 |
> <b>(prompt "$")</b> |
| 8991 |
> <b>(prompt)</b> |
| 8992 |
"$" |
| 8993 |
> <b>(define write-shared |
| 8994 |
(make-parameter |
| 8995 |
#f |
| 8996 |
(lambda (x) |
| 8997 |
(if (boolean? x) |
| 8998 |
x |
| 8999 |
(error "only booleans are accepted by write-shared")))))</b> |
| 9000 |
> <b>(write-shared 123)</b> |
| 9001 |
*** ERROR IN ##make-parameter -- only booleans are accepted by write-shared |
| 9002 |
</pre></td></tr></table> |
| 9003 |
|
| 9004 |
|
| 9005 |
|
| 9006 |
<a name="Definition_of_parameterize"></a><a name="Special_form_parameterize"></a><a name="index-parameterize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_parameterize">parameterize</a></b></code><i> ((<span class="roman"><i>procedure</i></span> <span class="roman"><i>value</i></span>)…) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 9007 |
|
| 9008 |
<p>The <code>parameterize</code> form, evaluates all <i>procedure</i> and |
| 9009 |
<i>value</i> expressions in an unspecified order. All the |
| 9010 |
<i>procedure</i> expressions must evaluate to procedures, either parameter |
| 9011 |
objects or procedures accepting zero and one argument. Then, |
| 9012 |
for each procedure <i>p</i> and in an unspecified order: |
| 9013 |
</p> |
| 9014 |
<ul> |
| 9015 |
<li> |
| 9016 |
If <i>p</i> is a parameter object a new cell is created, initialized, and |
| 9017 |
bound to the parameter object in the local dynamic environment. The |
| 9018 |
value contained in the cell is the result of applying the parameter |
| 9019 |
object’s conversion procedure to <i>value</i>. The resulting dynamic |
| 9020 |
environment is then used for processing the remaining bindings (or the |
| 9021 |
evaluation of <i>body</i> if there are no other bindings). |
| 9022 |
|
| 9023 |
</li><li> |
| 9024 |
Otherwise <i>p</i> will be used according to the following protocol: we |
| 9025 |
say that the call <code>(<span class="roman"><i>p</i></span>)</code> “gets <i>p</i>’s value” and that |
| 9026 |
the call <code>(<span class="roman"><i>p</i></span> <span class="roman"><i>x</i></span>)</code> “sets <i>p</i>’s value to <i>x</i>”. |
| 9027 |
First, the <code>parameterize</code> form gets <i>p</i>’s value and saves it in |
| 9028 |
a local variable. It then sets <i>p</i>’s value to <i>value</i>. It then |
| 9029 |
processes the remaining bindings (or evaluates <i>body</i> if there are |
| 9030 |
no other bindings). Then it sets <i>p</i>’s value to the saved value. |
| 9031 |
These steps are performed in a <code>dynamic-wind</code> so that it is |
| 9032 |
possible to use continuations to jump into and out of the body |
| 9033 |
(i.e. the <code>dynamic-wind</code>’s before thunk sets <i>p</i>’s value to |
| 9034 |
<i>value</i> and the after thunk sets <i>p</i>’s value to the saved value). |
| 9035 |
|
| 9036 |
</li></ul> |
| 9037 |
|
| 9038 |
<p>The result(s) of the <code>parameterize</code> form are the result(s) of the |
| 9039 |
<i>body</i>. |
| 9040 |
</p> |
| 9041 |
<p>Note that using procedures instead of parameter objects may lead to |
| 9042 |
unexpected results in multithreaded programs because the before and |
| 9043 |
after thunks of the <code>dynamic-wind</code> are not called when control |
| 9044 |
switches between threads. |
| 9045 |
</p> |
| 9046 |
<p>For example: |
| 9047 |
</p> |
| 9048 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define radix (make-parameter 2))</b> |
| 9049 |
> <b>(define prompt |
| 9050 |
(make-parameter |
| 9051 |
123 |
| 9052 |
(lambda (x) |
| 9053 |
(if (string? x) |
| 9054 |
x |
| 9055 |
(object->string x)))))</b> |
| 9056 |
> <b>(radix)</b> |
| 9057 |
2 |
| 9058 |
> <b>(parameterize ((radix 16)) (radix))</b> |
| 9059 |
16 |
| 9060 |
> <b>(radix)</b> |
| 9061 |
2 |
| 9062 |
> <b>(define (f n) (number->string n (radix)))</b> |
| 9063 |
> <b>(f 10)</b> |
| 9064 |
"1010" |
| 9065 |
> <b>(parameterize ((radix 8)) (f 10))</b> |
| 9066 |
"12" |
| 9067 |
> <b>(parameterize ((radix 8) (prompt (f 10))) (prompt))</b> |
| 9068 |
"1010" |
| 9069 |
> <b>(define p |
| 9070 |
(let ((x 1)) |
| 9071 |
(lambda args |
| 9072 |
(if (null? args) x (set! x (car args))))))</b> |
| 9073 |
> <b>(let* ((a (p)) |
| 9074 |
(b (parameterize ((p 2)) (list (p)))) |
| 9075 |
(c (p))) |
| 9076 |
(list a b c))</b> |
| 9077 |
(1 (2) 1) |
| 9078 |
</pre></td></tr></table> |
| 9079 |
|
| 9080 |
|
| 9081 |
|
| 9082 |
<a name="Exceptions"></a><hr size="6"><br/><br/><br/> |
| 9083 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9084 |
<tr><td valign="middle" align="left"><a href="#Dynamic-environment" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9085 |
<td valign="middle" align="left"><a href="#Exception_002dhandling" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9086 |
<td valign="middle" align="left"> </td> |
| 9087 |
<td valign="middle" align="left"><a href="#Dynamic-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9088 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9089 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9090 |
<td valign="middle" align="left"> </td> |
| 9091 |
<td valign="middle" align="left"> </td> |
| 9092 |
<td valign="middle" align="left"> </td> |
| 9093 |
<td valign="middle" align="left"> </td> |
| 9094 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9095 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9096 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9097 |
</tr></table> |
| 9098 |
<a name="Exceptions-1"></a> |
| 9099 |
<h1 class="chapter">15. Exceptions</h1> |
| 9100 |
|
| 9101 |
<table class="menu" border="0" cellspacing="0"> |
| 9102 |
<tr><td align="left" valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9103 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9104 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9105 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9106 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9107 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9108 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9109 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9110 |
<tr><td align="left" valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9111 |
<tr><td align="left" valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 9112 |
</table> |
| 9113 |
|
| 9114 |
<a name="Exception_002dhandling"></a><hr size="6"><br/><br/><br/> |
| 9115 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9116 |
<tr><td valign="middle" align="left"><a href="#Exceptions" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9117 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-memory-management" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9118 |
<td valign="middle" align="left"> </td> |
| 9119 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9120 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9121 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9122 |
<td valign="middle" align="left"> </td> |
| 9123 |
<td valign="middle" align="left"> </td> |
| 9124 |
<td valign="middle" align="left"> </td> |
| 9125 |
<td valign="middle" align="left"> </td> |
| 9126 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9127 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9128 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9129 |
</tr></table> |
| 9130 |
<a name="Exception_002dhandling-1"></a> |
| 9131 |
<h2 class="section">15.1 Exception-handling</h2> |
| 9132 |
|
| 9133 |
<p>Gambit’s exception-handling model is inspired from the withdrawn |
| 9134 |
“Exception Handling SRFI” (SRFI 12), the “Multithreading support |
| 9135 |
SRFI” (SRFI 18), and the “Exception Handling for Programs SRFI” |
| 9136 |
(SRFI 34). The two fundamental operations are the dynamic binding of |
| 9137 |
an exception handler (i.e. the procedure |
| 9138 |
<code>with-exception-handler</code>) and the invocation of the exception |
| 9139 |
handler (i.e. the procedure <code>raise</code>). |
| 9140 |
</p> |
| 9141 |
<p>All predefined procedures which check for errors (including type |
| 9142 |
errors, memory allocation errors, host operating-system errors, etc) |
| 9143 |
report these errors using the exception-handling system (i.e. they |
| 9144 |
“raise” an exception that can be handled in a user-defined exception |
| 9145 |
handler). When an exception is raised and the exception is not |
| 9146 |
handled by a user-defined exception handler, the predefined exception |
| 9147 |
handler will display an error message (if the primordial thread raised |
| 9148 |
the exception) or the thread will silently terminate with no error |
| 9149 |
message (if it is not the primordial thread that raised the |
| 9150 |
exception). This default behavior can be changed through the |
| 9151 |
‘<samp>-:d</samp>’ runtime option (see section <a href="#Runtime-options">Runtime options</a>). |
| 9152 |
</p> |
| 9153 |
<p>Predefined procedures normally raise exceptions by performing a |
| 9154 |
tail-call to the exception handler (the exceptions are “complex” |
| 9155 |
procedures such as <code>eval</code>, <code>compile-file</code>, <code>read</code>, |
| 9156 |
<code>write</code>, etc). This means that the continuation of the exception |
| 9157 |
handler and of the REPL that may be started due to this is normally |
| 9158 |
the continuation of the predefined procedure that raised the |
| 9159 |
exception. By exiting the REPL with the <code>,(c <var>expression</var>)</code> |
| 9160 |
command it is thus possible to resume the program as though the call |
| 9161 |
to the predefined procedure returned the value of <var>expression</var>. |
| 9162 |
For example: |
| 9163 |
</p> |
| 9164 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f x) (+ (car x) 1))</b> |
| 9165 |
> <b>(f 2) <span class="roman"><i>; typo... we meant to say (f '(2))</i></span></b> |
| 9166 |
*** ERROR IN f, (console)@1.18 -- (Argument 1) PAIR expected |
| 9167 |
(car 2) |
| 9168 |
1> <b>,(c 2)</b> |
| 9169 |
3 |
| 9170 |
</pre></td></tr></table> |
| 9171 |
|
| 9172 |
<a name="Definition_of_current-exception-handler"></a><a name="Procedure_current-exception-handler"></a><a name="index-current_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-exception-handler">current-exception-handler</a></b></code><i> <span class="roman">[</span><var>new-exception-handler</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9173 |
|
| 9174 |
<a name="index-current-exception_002dhandler"></a> |
| 9175 |
<p>The parameter object <code>current-exception-handler</code> is bound to the |
| 9176 |
current exception-handler. Calling this procedure with no argument |
| 9177 |
returns the current exception-handler and calling this procedure with |
| 9178 |
one argument sets the current exception-handler to |
| 9179 |
<var>new-exception-handler</var>. |
| 9180 |
</p> |
| 9181 |
<p>For example: |
| 9182 |
</p> |
| 9183 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-exception-handler)</b> |
| 9184 |
#<procedure #2 primordial-exception-handler> |
| 9185 |
> <b>(current-exception-handler (lambda (exc) (pp exc) 999))</b> |
| 9186 |
> <b>(/ 1 0)</b> |
| 9187 |
#<divide-by-zero-exception #3> |
| 9188 |
999 |
| 9189 |
</pre></td></tr></table> |
| 9190 |
|
| 9191 |
|
| 9192 |
|
| 9193 |
<a name="Definition_of_with-exception-handler"></a><a name="Procedure_with-exception-handler"></a><a name="index-with_002dexception_002dhandler"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-exception-handler">with-exception-handler</a></b></code><i> <var>handler</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9194 |
|
| 9195 |
<p>Returns the result(s) of calling <var>thunk</var> with no arguments. The |
| 9196 |
<var>handler</var>, which must be a procedure, is installed as the current |
| 9197 |
exception-handler in the dynamic environment in effect during the call |
| 9198 |
to <var>thunk</var>. Note that the dynamic environment in effect during |
| 9199 |
the call to <var>handler</var> has <var>handler</var> as the exception-handler. |
| 9200 |
Consequently, an exception raised during the call to <var>handler</var> may |
| 9201 |
lead to an infinite loop. |
| 9202 |
</p> |
| 9203 |
<p>For example: |
| 9204 |
</p> |
| 9205 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-handler |
| 9206 |
(lambda (e) (write e) 5) |
| 9207 |
(lambda () (+ 1 (* 2 3) 4)))</b> |
| 9208 |
11 |
| 9209 |
> <b>(with-exception-handler |
| 9210 |
(lambda (e) (write e) 5) |
| 9211 |
(lambda () (+ 1 (* 'foo 3) 4)))</b> |
| 9212 |
#<type-exception #2>10 |
| 9213 |
> <b>(with-exception-handler |
| 9214 |
(lambda (e) (write e 9)) |
| 9215 |
(lambda () (+ 1 (* 'foo 3) 4)))</b> |
| 9216 |
<var>infinite loop</var> |
| 9217 |
</pre></td></tr></table> |
| 9218 |
|
| 9219 |
|
| 9220 |
|
| 9221 |
<a name="Definition_of_with-exception-catcher"></a><a name="Procedure_with-exception-catcher"></a><a name="index-with_002dexception_002dcatcher"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-exception-catcher">with-exception-catcher</a></b></code><i> <var>handler</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9222 |
|
| 9223 |
<p>Returns the result(s) of calling <var>thunk</var> with no arguments. A new |
| 9224 |
exception-handler is installed as the current exception-handler in the |
| 9225 |
dynamic environment in effect during the call to <var>thunk</var>. This |
| 9226 |
new exception-handler will call the <var>handler</var>, which must be a |
| 9227 |
procedure, with the exception object as an argument and with the same |
| 9228 |
continuation as the call to <code>with-exception-catcher</code>. This |
| 9229 |
implies that the dynamic environment in effect during the call to |
| 9230 |
<var>handler</var> is the same as the one in effect at the call to |
| 9231 |
<code>with-exception-catcher</code>. Consequently, an exception raised |
| 9232 |
during the call to <var>handler</var> will not lead to an infinite loop. |
| 9233 |
</p> |
| 9234 |
<p>For example: |
| 9235 |
</p> |
| 9236 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-catcher |
| 9237 |
(lambda (e) (write e) 5) |
| 9238 |
(lambda () (+ 1 (* 2 3) 4)))</b> |
| 9239 |
11 |
| 9240 |
> <b>(with-exception-catcher |
| 9241 |
(lambda (e) (write e) 5) |
| 9242 |
(lambda () (+ 1 (* 'foo 3) 4)))</b> |
| 9243 |
#<type-exception #2>5 |
| 9244 |
> <b>(with-exception-catcher |
| 9245 |
(lambda (e) (write e 9)) |
| 9246 |
(lambda () (+ 1 (* 'foo 3) 4)))</b> |
| 9247 |
*** ERROR IN (console)@7.1 -- (Argument 2) OUTPUT PORT expected |
| 9248 |
(write '#<type-exception #3> 9) |
| 9249 |
</pre></td></tr></table> |
| 9250 |
|
| 9251 |
|
| 9252 |
|
| 9253 |
<a name="Definition_of_raise"></a><a name="Procedure_raise"></a><a name="index-raise"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_raise">raise</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9254 |
|
| 9255 |
<p>This procedure tail-calls the current exception-handler with <var>obj</var> |
| 9256 |
as the sole argument. If the exception-handler returns, the |
| 9257 |
continuation of the call to <code>raise</code> is invoked. |
| 9258 |
</p> |
| 9259 |
<p>For example: |
| 9260 |
</p> |
| 9261 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-exception-handler |
| 9262 |
(lambda (exc) |
| 9263 |
(pp exc) |
| 9264 |
100) |
| 9265 |
(lambda () |
| 9266 |
(+ 1 (raise "hello"))))</b> |
| 9267 |
"hello" |
| 9268 |
101 |
| 9269 |
</pre></td></tr></table> |
| 9270 |
|
| 9271 |
|
| 9272 |
|
| 9273 |
<a name="Definition_of_abort"></a><a name="Procedure_abort"></a><a name="index-abort"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_abort">abort</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9274 |
<a name="Definition_of_noncontinuable-exception?"></a><a name="Procedure_noncontinuable-exception?"></a><a name="index-noncontinuable_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_noncontinuable-exception?">noncontinuable-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9275 |
<a name="Definition_of_noncontinuable-exception-reason"></a><a name="Procedure_noncontinuable-exception-reason"></a><a name="index-noncontinuable_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_noncontinuable-exception-reason">noncontinuable-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9276 |
|
| 9277 |
<p>The procedure <code>abort</code> calls the current exception-handler with |
| 9278 |
<var>obj</var> as the sole argument. If the exception-handler returns, the |
| 9279 |
procedure <code>abort</code> will be tail-called with a |
| 9280 |
noncontinuable-exception object, whose reason field is <var>obj</var>, as |
| 9281 |
sole argument. |
| 9282 |
</p> |
| 9283 |
<p>Noncontinuable-exception objects are raised by the <code>abort</code> |
| 9284 |
procedure when the exception-handler returns. The parameter <var>exc</var> |
| 9285 |
must be a noncontinuable-exception object. |
| 9286 |
</p> |
| 9287 |
<p>The procedure <code>noncontinuable-exception?</code> returns |
| 9288 |
<code>#t</code> when <var>obj</var> is a noncontinuable-exception |
| 9289 |
object and <code>#f</code> otherwise. |
| 9290 |
</p> |
| 9291 |
<p>The procedure <code>noncontinuable-exception-reason</code> returns the |
| 9292 |
argument of the call to <code>abort</code> that raised <var>exc</var>. |
| 9293 |
</p> |
| 9294 |
<p>For example: |
| 9295 |
</p> |
| 9296 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-current-continuation |
| 9297 |
(lambda (k) |
| 9298 |
(with-exception-handler |
| 9299 |
(lambda (exc) |
| 9300 |
(pp exc) |
| 9301 |
(if (noncontinuable-exception? exc) |
| 9302 |
(k (list (noncontinuable-exception-reason exc))) |
| 9303 |
100)) |
| 9304 |
(lambda () |
| 9305 |
(+ 1 (abort "hello"))))))</b> |
| 9306 |
"hello" |
| 9307 |
#<noncontinuable-exception #2> |
| 9308 |
("hello") |
| 9309 |
</pre></td></tr></table> |
| 9310 |
|
| 9311 |
|
| 9312 |
|
| 9313 |
<a name="Exception-objects-related-to-memory-management"></a><hr size="6"><br/><br/><br/> |
| 9314 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9315 |
<tr><td valign="middle" align="left"><a href="#Exception_002dhandling" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9316 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-the-host-environment" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9317 |
<td valign="middle" align="left"> </td> |
| 9318 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9319 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9320 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9321 |
<td valign="middle" align="left"> </td> |
| 9322 |
<td valign="middle" align="left"> </td> |
| 9323 |
<td valign="middle" align="left"> </td> |
| 9324 |
<td valign="middle" align="left"> </td> |
| 9325 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9326 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9327 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9328 |
</tr></table> |
| 9329 |
<a name="Exception-objects-related-to-memory-management-1"></a> |
| 9330 |
<h2 class="section">15.2 Exception objects related to memory management</h2> |
| 9331 |
|
| 9332 |
<a name="Definition_of_heap-overflow-exception?"></a><a name="Procedure_heap-overflow-exception?"></a><a name="index-heap_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_heap-overflow-exception?">heap-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9333 |
|
| 9334 |
<p>Heap-overflow-exception objects are raised when the allocation of an |
| 9335 |
object would cause the heap to use more memory space than is available. |
| 9336 |
</p> |
| 9337 |
<p>The procedure <code>heap-overflow-exception?</code> returns |
| 9338 |
<code>#t</code> when <var>obj</var> is a heap-overflow-exception |
| 9339 |
object and <code>#f</code> otherwise. |
| 9340 |
</p> |
| 9341 |
<p>For example: |
| 9342 |
</p> |
| 9343 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9344 |
(if (heap-overflow-exception? exc) |
| 9345 |
exc |
| 9346 |
'not-heap-overflow-exception))</b> |
| 9347 |
> <b>(with-exception-catcher |
| 9348 |
handler |
| 9349 |
(lambda () |
| 9350 |
(define (f x) (f (cons 1 x))) |
| 9351 |
(f '())))</b> |
| 9352 |
#<heap-overflow-exception #2> |
| 9353 |
</pre></td></tr></table> |
| 9354 |
|
| 9355 |
|
| 9356 |
|
| 9357 |
<a name="Definition_of_stack-overflow-exception?"></a><a name="Procedure_stack-overflow-exception?"></a><a name="index-stack_002doverflow_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_stack-overflow-exception?">stack-overflow-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9358 |
|
| 9359 |
<p>Stack-overflow-exception objects are raised when the allocation of a |
| 9360 |
continuation frame would cause the heap to use more memory space than |
| 9361 |
is available. |
| 9362 |
</p> |
| 9363 |
<p>The procedure <code>stack-overflow-exception?</code> returns |
| 9364 |
<code>#t</code> when <var>obj</var> is a stack-overflow-exception |
| 9365 |
object and <code>#f</code> otherwise. |
| 9366 |
</p> |
| 9367 |
<p>For example: |
| 9368 |
</p> |
| 9369 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9370 |
(if (stack-overflow-exception? exc) |
| 9371 |
exc |
| 9372 |
'not-stack-overflow-exception))</b> |
| 9373 |
> <b>(with-exception-catcher |
| 9374 |
handler |
| 9375 |
(lambda () |
| 9376 |
(define (f) (+ 1 (f))) |
| 9377 |
(f)))</b> |
| 9378 |
#<stack-overflow-exception #2> |
| 9379 |
</pre></td></tr></table> |
| 9380 |
|
| 9381 |
|
| 9382 |
|
| 9383 |
<a name="Exception-objects-related-to-the-host-environment"></a><hr size="6"><br/><br/><br/> |
| 9384 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9385 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-memory-management" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9386 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-threads" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9387 |
<td valign="middle" align="left"> </td> |
| 9388 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9389 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9390 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9391 |
<td valign="middle" align="left"> </td> |
| 9392 |
<td valign="middle" align="left"> </td> |
| 9393 |
<td valign="middle" align="left"> </td> |
| 9394 |
<td valign="middle" align="left"> </td> |
| 9395 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9396 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9397 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9398 |
</tr></table> |
| 9399 |
<a name="Exception-objects-related-to-the-host-environment-1"></a> |
| 9400 |
<h2 class="section">15.3 Exception objects related to the host environment</h2> |
| 9401 |
|
| 9402 |
<a name="Definition_of_os-exception?"></a><a name="Procedure_os-exception?"></a><a name="index-os_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_os-exception?">os-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9403 |
<a name="Definition_of_os-exception-procedure"></a><a name="Procedure_os-exception-procedure"></a><a name="index-os_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_os-exception-procedure">os-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9404 |
<a name="Definition_of_os-exception-arguments"></a><a name="Procedure_os-exception-arguments"></a><a name="index-os_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_os-exception-arguments">os-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9405 |
<a name="Definition_of_os-exception-code"></a><a name="Procedure_os-exception-code"></a><a name="index-os_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_os-exception-code">os-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9406 |
<a name="Definition_of_os-exception-message"></a><a name="Procedure_os-exception-message"></a><a name="index-os_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_os-exception-message">os-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9407 |
|
| 9408 |
<p>Os-exception objects are raised by procedures which access the host |
| 9409 |
operating-system’s services when the requested operation fails. The |
| 9410 |
parameter <var>exc</var> must be a os-exception object. |
| 9411 |
</p> |
| 9412 |
<p>The procedure <code>os-exception?</code> returns |
| 9413 |
<code>#t</code> when <var>obj</var> is a os-exception |
| 9414 |
object and <code>#f</code> otherwise. |
| 9415 |
</p> |
| 9416 |
<p>The procedure <code>os-exception-procedure</code> |
| 9417 |
returns the procedure that raised <var>exc</var>. |
| 9418 |
</p> |
| 9419 |
<p>The procedure <code>os-exception-arguments</code> |
| 9420 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9421 |
</p> |
| 9422 |
<p>The procedure <code>os-exception-code</code> returns an exact integer error |
| 9423 |
code that can be converted to a string by the <code>err-code->string</code> |
| 9424 |
procedure. Note that the error code is operating-system dependent. |
| 9425 |
</p> |
| 9426 |
<p>The procedure <code>os-exception-message</code> returns |
| 9427 |
<code>#f</code> or a string giving details of the exception in a |
| 9428 |
human-readable form. |
| 9429 |
</p> |
| 9430 |
<p>For example: |
| 9431 |
</p> |
| 9432 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9433 |
(if (os-exception? exc) |
| 9434 |
(list (os-exception-procedure exc) |
| 9435 |
(os-exception-arguments exc) |
| 9436 |
(err-code->string (os-exception-code exc)) |
| 9437 |
(os-exception-message exc)) |
| 9438 |
'not-os-exception))</b> |
| 9439 |
> <b>(with-exception-catcher |
| 9440 |
handler |
| 9441 |
(lambda () (host-info "x.y.z")))</b> |
| 9442 |
(#<procedure #2 host-info> ("x.y.z") "Unknown host" #f) |
| 9443 |
</pre></td></tr></table> |
| 9444 |
|
| 9445 |
|
| 9446 |
|
| 9447 |
<a name="Definition_of_no-such-file-or-directory-exception?"></a><a name="Procedure_no-such-file-or-directory-exception?"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception?">no-such-file-or-directory-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9448 |
<a name="Definition_of_no-such-file-or-directory-exception-procedure"></a><a name="Procedure_no-such-file-or-directory-exception-procedure"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception-procedure">no-such-file-or-directory-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9449 |
<a name="Definition_of_no-such-file-or-directory-exception-arguments"></a><a name="Procedure_no-such-file-or-directory-exception-arguments"></a><a name="index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_no-such-file-or-directory-exception-arguments">no-such-file-or-directory-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9450 |
|
| 9451 |
<p>No-such-file-or-directory-exception objects are raised by procedures |
| 9452 |
which access the filesystem (such as <code>open-input-file</code> and |
| 9453 |
<code>directory-files</code>) when the path specified can’t be found on the |
| 9454 |
filesystem. The parameter <var>exc</var> must be a |
| 9455 |
no-such-file-or-directory-exception object. |
| 9456 |
</p> |
| 9457 |
<p>The procedure <code>no-such-file-or-directory-exception?</code> returns |
| 9458 |
<code>#t</code> when <var>obj</var> is a no-such-file-or-directory-exception |
| 9459 |
object and <code>#f</code> otherwise. |
| 9460 |
</p> |
| 9461 |
<p>The procedure <code>no-such-file-or-directory-exception-procedure</code> |
| 9462 |
returns the procedure that raised <var>exc</var>. |
| 9463 |
</p> |
| 9464 |
<p>The procedure <code>no-such-file-or-directory-exception-arguments</code> |
| 9465 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9466 |
</p> |
| 9467 |
<p>For example: |
| 9468 |
</p> |
| 9469 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9470 |
(if (no-such-file-or-directory-exception? exc) |
| 9471 |
(list (no-such-file-or-directory-exception-procedure exc) |
| 9472 |
(no-such-file-or-directory-exception-arguments exc)) |
| 9473 |
'not-no-such-file-or-directory-exception))</b> |
| 9474 |
> <b>(with-exception-catcher |
| 9475 |
handler |
| 9476 |
(lambda () (with-input-from-file "nofile" read)))</b> |
| 9477 |
(#<procedure #2 with-input-from-file> ("nofile" #<procedure #3 read>)) |
| 9478 |
</pre></td></tr></table> |
| 9479 |
|
| 9480 |
|
| 9481 |
|
| 9482 |
<a name="Definition_of_unbound-os-environment-variable-exception?"></a><a name="Procedure_unbound-os-environment-variable-exception?"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception?">unbound-os-environment-variable-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9483 |
<a name="Definition_of_unbound-os-environment-variable-exception-procedure"></a><a name="Procedure_unbound-os-environment-variable-exception-procedure"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception-procedure">unbound-os-environment-variable-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9484 |
<a name="Definition_of_unbound-os-environment-variable-exception-arguments"></a><a name="Procedure_unbound-os-environment-variable-exception-arguments"></a><a name="index-unbound_002dos_002denvironment_002dvariable_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-os-environment-variable-exception-arguments">unbound-os-environment-variable-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9485 |
|
| 9486 |
<p>Unbound-os-environment-variable-exception objects are raised when an |
| 9487 |
unbound operating-system environment variable is accessed by the |
| 9488 |
procedures <code>getenv</code> and <code>setenv</code>. The parameter <var>exc</var> |
| 9489 |
must be an unbound-os-environment-variable-exception object. |
| 9490 |
</p> |
| 9491 |
<p>The procedure <code>unbound-os-environment-variable-exception?</code> returns |
| 9492 |
<code>#t</code> when <var>obj</var> is an unbound-os-environment-variable-exception |
| 9493 |
object and <code>#f</code> otherwise. |
| 9494 |
</p> |
| 9495 |
<p>The procedure <code>unbound-os-environment-variable-exception-procedure</code> |
| 9496 |
returns the procedure that raised <var>exc</var>. |
| 9497 |
</p> |
| 9498 |
<p>The procedure <code>unbound-os-environment-variable-exception-arguments</code> |
| 9499 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9500 |
</p> |
| 9501 |
<p>For example: |
| 9502 |
</p> |
| 9503 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9504 |
(if (unbound-os-environment-variable-exception? exc) |
| 9505 |
(list (unbound-os-environment-variable-exception-procedure exc) |
| 9506 |
(unbound-os-environment-variable-exception-arguments exc)) |
| 9507 |
'not-unbound-os-environment-variable-exception))</b> |
| 9508 |
> <b>(with-exception-catcher |
| 9509 |
handler |
| 9510 |
(lambda () (getenv "DOES_NOT_EXIST")))</b> |
| 9511 |
(#<procedure #2 getenv> ("DOES_NOT_EXIST")) |
| 9512 |
</pre></td></tr></table> |
| 9513 |
|
| 9514 |
|
| 9515 |
|
| 9516 |
<a name="Exception-objects-related-to-threads"></a><hr size="6"><br/><br/><br/> |
| 9517 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9518 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-the-host-environment" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9519 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-C_002dinterface" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9520 |
<td valign="middle" align="left"> </td> |
| 9521 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9522 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9523 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9524 |
<td valign="middle" align="left"> </td> |
| 9525 |
<td valign="middle" align="left"> </td> |
| 9526 |
<td valign="middle" align="left"> </td> |
| 9527 |
<td valign="middle" align="left"> </td> |
| 9528 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9529 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9530 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9531 |
</tr></table> |
| 9532 |
<a name="Exception-objects-related-to-threads-1"></a> |
| 9533 |
<h2 class="section">15.4 Exception objects related to threads</h2> |
| 9534 |
|
| 9535 |
<a name="Definition_of_scheduler-exception?"></a><a name="Procedure_scheduler-exception?"></a><a name="index-scheduler_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_scheduler-exception?">scheduler-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9536 |
<a name="Definition_of_scheduler-exception-reason"></a><a name="Procedure_scheduler-exception-reason"></a><a name="index-scheduler_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_scheduler-exception-reason">scheduler-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9537 |
|
| 9538 |
<p>Scheduler-exception objects are raised by the scheduler when some |
| 9539 |
operation requested from the host operating system failed |
| 9540 |
(e.g. checking the status of the devices in order to wake up threads |
| 9541 |
waiting to perform I/O on these devices). The parameter <var>exc</var> |
| 9542 |
must be a scheduler-exception object. |
| 9543 |
</p> |
| 9544 |
<p>The procedure <code>scheduler-exception?</code> returns |
| 9545 |
<code>#t</code> when <var>obj</var> is a scheduler-exception |
| 9546 |
object and <code>#f</code> otherwise. |
| 9547 |
</p> |
| 9548 |
<p>The procedure <code>scheduler-exception-reason</code> returns the |
| 9549 |
os-exception object that describes the failure detected by the |
| 9550 |
scheduler. |
| 9551 |
</p> |
| 9552 |
|
| 9553 |
|
| 9554 |
<a name="Definition_of_deadlock-exception?"></a><a name="Procedure_deadlock-exception?"></a><a name="index-deadlock_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_deadlock-exception?">deadlock-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9555 |
|
| 9556 |
<p>Deadlock-exception objects are raised when the scheduler discovers |
| 9557 |
that all threads are blocked and can make no further progress. In |
| 9558 |
that case the scheduler unblocks the primordial-thread and forces it |
| 9559 |
to raise a deadlock-exception object. |
| 9560 |
</p> |
| 9561 |
<p>The procedure <code>deadlock-exception?</code> returns <code>#t</code> when |
| 9562 |
<var>obj</var> is a deadlock-exception object and <code>#f</code> otherwise. |
| 9563 |
</p> |
| 9564 |
<p>For example: |
| 9565 |
</p> |
| 9566 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9567 |
(if (deadlock-exception? exc) |
| 9568 |
exc |
| 9569 |
'not-deadlock-exception))</b> |
| 9570 |
> <b>(with-exception-catcher |
| 9571 |
handler |
| 9572 |
(lambda () (read (open-vector))))</b> |
| 9573 |
#<deadlock-exception #2> |
| 9574 |
</pre></td></tr></table> |
| 9575 |
|
| 9576 |
|
| 9577 |
|
| 9578 |
<a name="Definition_of_abandoned-mutex-exception?"></a><a name="Procedure_abandoned-mutex-exception?"></a><a name="index-abandoned_002dmutex_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_abandoned-mutex-exception?">abandoned-mutex-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9579 |
|
| 9580 |
<p>Abandoned-mutex-exception objects are raised when the current thread |
| 9581 |
locks a mutex that was owned by a thread which terminated (see |
| 9582 |
<code>mutex-lock!</code>). |
| 9583 |
</p> |
| 9584 |
<p>The procedure <code>abandoned-mutex-exception?</code> returns |
| 9585 |
<code>#t</code> when <var>obj</var> is a abandoned-mutex-exception |
| 9586 |
object and <code>#f</code> otherwise. |
| 9587 |
</p> |
| 9588 |
<p>For example: |
| 9589 |
</p> |
| 9590 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9591 |
(if (abandoned-mutex-exception? exc) |
| 9592 |
exc |
| 9593 |
'not-abandoned-mutex-exception))</b> |
| 9594 |
> <b>(with-exception-catcher |
| 9595 |
handler |
| 9596 |
(lambda () |
| 9597 |
(let ((m (make-mutex))) |
| 9598 |
(thread-join! |
| 9599 |
(thread-start! |
| 9600 |
(make-thread |
| 9601 |
(lambda () (mutex-lock! m))))) |
| 9602 |
(mutex-lock! m))))</b> |
| 9603 |
#<abandoned-mutex-exception #2> |
| 9604 |
</pre></td></tr></table> |
| 9605 |
|
| 9606 |
|
| 9607 |
|
| 9608 |
<a name="Definition_of_join-timeout-exception?"></a><a name="Procedure_join-timeout-exception?"></a><a name="index-join_002dtimeout_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_join-timeout-exception?">join-timeout-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9609 |
<a name="Definition_of_join-timeout-exception-procedure"></a><a name="Procedure_join-timeout-exception-procedure"></a><a name="index-join_002dtimeout_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_join-timeout-exception-procedure">join-timeout-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9610 |
<a name="Definition_of_join-timeout-exception-arguments"></a><a name="Procedure_join-timeout-exception-arguments"></a><a name="index-join_002dtimeout_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_join-timeout-exception-arguments">join-timeout-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9611 |
|
| 9612 |
<p>Join-timeout-exception objects are raised when a call to the |
| 9613 |
<code>thread-join!</code> procedure reaches its timeout before the target |
| 9614 |
thread terminates and a timeout-value parameter is not specified. The |
| 9615 |
parameter <var>exc</var> must be a join-timeout-exception object. |
| 9616 |
</p> |
| 9617 |
<p>The procedure <code>join-timeout-exception?</code> returns |
| 9618 |
<code>#t</code> when <var>obj</var> is a join-timeout-exception |
| 9619 |
object and <code>#f</code> otherwise. |
| 9620 |
</p> |
| 9621 |
<p>The procedure <code>join-timeout-exception-procedure</code> |
| 9622 |
returns the procedure that raised <var>exc</var>. |
| 9623 |
</p> |
| 9624 |
<p>The procedure <code>join-timeout-exception-arguments</code> |
| 9625 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9626 |
</p> |
| 9627 |
<p>For example: |
| 9628 |
</p> |
| 9629 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9630 |
(if (join-timeout-exception? exc) |
| 9631 |
(list (join-timeout-exception-procedure exc) |
| 9632 |
(join-timeout-exception-arguments exc)) |
| 9633 |
'not-join-timeout-exception))</b> |
| 9634 |
> <b>(with-exception-catcher |
| 9635 |
handler |
| 9636 |
(lambda () |
| 9637 |
(thread-join! |
| 9638 |
(thread-start! |
| 9639 |
(make-thread |
| 9640 |
(lambda () (thread-sleep! 10)))) |
| 9641 |
5)))</b> |
| 9642 |
(#<procedure #2 thread-join!> (#<thread #3> 5)) |
| 9643 |
</pre></td></tr></table> |
| 9644 |
|
| 9645 |
|
| 9646 |
|
| 9647 |
<a name="Definition_of_started-thread-exception?"></a><a name="Procedure_started-thread-exception?"></a><a name="index-started_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_started-thread-exception?">started-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9648 |
<a name="Definition_of_started-thread-exception-procedure"></a><a name="Procedure_started-thread-exception-procedure"></a><a name="index-started_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_started-thread-exception-procedure">started-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9649 |
<a name="Definition_of_started-thread-exception-arguments"></a><a name="Procedure_started-thread-exception-arguments"></a><a name="index-started_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_started-thread-exception-arguments">started-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9650 |
|
| 9651 |
<p>Started-thread-exception objects are raised when the target thread of |
| 9652 |
a call to the procedure <code>thread-start!</code> is already started. The |
| 9653 |
parameter <var>exc</var> must be a started-thread-exception object. |
| 9654 |
</p> |
| 9655 |
<p>The procedure <code>started-thread-exception?</code> returns |
| 9656 |
<code>#t</code> when <var>obj</var> is a started-thread-exception |
| 9657 |
object and <code>#f</code> otherwise. |
| 9658 |
</p> |
| 9659 |
<p>The procedure <code>started-thread-exception-procedure</code> |
| 9660 |
returns the procedure that raised <var>exc</var>. |
| 9661 |
</p> |
| 9662 |
<p>The procedure <code>started-thread-exception-arguments</code> |
| 9663 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9664 |
</p> |
| 9665 |
<p>For example: |
| 9666 |
</p> |
| 9667 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9668 |
(if (started-thread-exception? exc) |
| 9669 |
(list (started-thread-exception-procedure exc) |
| 9670 |
(started-thread-exception-arguments exc)) |
| 9671 |
'not-started-thread-exception))</b> |
| 9672 |
> <b>(with-exception-catcher |
| 9673 |
handler |
| 9674 |
(lambda () |
| 9675 |
(let ((t (make-thread (lambda () (expt 2 1000))))) |
| 9676 |
(thread-start! t) |
| 9677 |
(thread-start! t))))</b> |
| 9678 |
(#<procedure #2 thread-start!> (#<thread #3>)) |
| 9679 |
</pre></td></tr></table> |
| 9680 |
|
| 9681 |
|
| 9682 |
|
| 9683 |
<a name="Definition_of_terminated-thread-exception?"></a><a name="Procedure_terminated-thread-exception?"></a><a name="index-terminated_002dthread_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception?">terminated-thread-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9684 |
<a name="Definition_of_terminated-thread-exception-procedure"></a><a name="Procedure_terminated-thread-exception-procedure"></a><a name="index-terminated_002dthread_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception-procedure">terminated-thread-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9685 |
<a name="Definition_of_terminated-thread-exception-arguments"></a><a name="Procedure_terminated-thread-exception-arguments"></a><a name="index-terminated_002dthread_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_terminated-thread-exception-arguments">terminated-thread-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9686 |
|
| 9687 |
<p>Terminated-thread-exception objects are raised when the |
| 9688 |
<code>thread-join!</code> procedure is called and the target thread has |
| 9689 |
terminated as a result of a call to the <code>thread-terminate!</code> |
| 9690 |
procedure. The parameter <var>exc</var> must be a |
| 9691 |
terminated-thread-exception object. |
| 9692 |
</p> |
| 9693 |
<p>The procedure <code>terminated-thread-exception?</code> returns |
| 9694 |
<code>#t</code> when <var>obj</var> is a terminated-thread-exception |
| 9695 |
object and <code>#f</code> otherwise. |
| 9696 |
</p> |
| 9697 |
<p>The procedure <code>terminated-thread-exception-procedure</code> |
| 9698 |
returns the procedure that raised <var>exc</var>. |
| 9699 |
</p> |
| 9700 |
<p>The procedure <code>terminated-thread-exception-arguments</code> |
| 9701 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9702 |
</p> |
| 9703 |
<p>For example: |
| 9704 |
</p> |
| 9705 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9706 |
(if (terminated-thread-exception? exc) |
| 9707 |
(list (terminated-thread-exception-procedure exc) |
| 9708 |
(terminated-thread-exception-arguments exc)) |
| 9709 |
'not-terminated-thread-exception))</b> |
| 9710 |
> <b>(with-exception-catcher |
| 9711 |
handler |
| 9712 |
(lambda () |
| 9713 |
(thread-join! |
| 9714 |
(thread-start! |
| 9715 |
(make-thread |
| 9716 |
(lambda () (thread-terminate! (current-thread))))))))</b> |
| 9717 |
(#<procedure #2 thread-join!> (#<thread #3>)) |
| 9718 |
</pre></td></tr></table> |
| 9719 |
|
| 9720 |
|
| 9721 |
|
| 9722 |
<a name="Definition_of_uncaught-exception?"></a><a name="Procedure_uncaught-exception?"></a><a name="index-uncaught_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uncaught-exception?">uncaught-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9723 |
<a name="Definition_of_uncaught-exception-procedure"></a><a name="Procedure_uncaught-exception-procedure"></a><a name="index-uncaught_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uncaught-exception-procedure">uncaught-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9724 |
<a name="Definition_of_uncaught-exception-arguments"></a><a name="Procedure_uncaught-exception-arguments"></a><a name="index-uncaught_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uncaught-exception-arguments">uncaught-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9725 |
<a name="Definition_of_uncaught-exception-reason"></a><a name="Procedure_uncaught-exception-reason"></a><a name="index-uncaught_002dexception_002dreason"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_uncaught-exception-reason">uncaught-exception-reason</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9726 |
|
| 9727 |
<p>Uncaught-exception objects are raised when an object is raised in a |
| 9728 |
thread and that thread does not handle it (i.e. the thread terminated |
| 9729 |
because it did not catch an exception it raised). The parameter |
| 9730 |
<var>exc</var> must be an uncaught-exception object. |
| 9731 |
</p> |
| 9732 |
<p>The procedure <code>uncaught-exception?</code> returns |
| 9733 |
<code>#t</code> when <var>obj</var> is an uncaught-exception |
| 9734 |
object and <code>#f</code> otherwise. |
| 9735 |
</p> |
| 9736 |
<p>The procedure <code>uncaught-exception-procedure</code> |
| 9737 |
returns the procedure that raised <var>exc</var>. |
| 9738 |
</p> |
| 9739 |
<p>The procedure <code>uncaught-exception-arguments</code> |
| 9740 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 9741 |
</p> |
| 9742 |
<p>The procedure <code>uncaught-exception-reason</code> returns the object that |
| 9743 |
was raised by the thread and not handled by that thread. |
| 9744 |
</p> |
| 9745 |
<p>For example: |
| 9746 |
</p> |
| 9747 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 9748 |
(if (uncaught-exception? exc) |
| 9749 |
(list (uncaught-exception-procedure exc) |
| 9750 |
(uncaught-exception-arguments exc) |
| 9751 |
(uncaught-exception-reason exc)) |
| 9752 |
'not-uncaught-exception))</b> |
| 9753 |
> <b>(with-exception-catcher |
| 9754 |
handler |
| 9755 |
(lambda () |
| 9756 |
(thread-join! |
| 9757 |
(thread-start! |
| 9758 |
(make-thread |
| 9759 |
(lambda () (open-input-file "data" 99)))))))</b> |
| 9760 |
(#<procedure #2 thread-join!> |
| 9761 |
(#<thread #3>) |
| 9762 |
#<wrong-number-of-arguments-exception #4>) |
| 9763 |
</pre></td></tr></table> |
| 9764 |
|
| 9765 |
|
| 9766 |
|
| 9767 |
<a name="Exception-objects-related-to-C_002dinterface"></a><hr size="6"><br/><br/><br/> |
| 9768 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9769 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-threads" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9770 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-the-reader" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9771 |
<td valign="middle" align="left"> </td> |
| 9772 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9773 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9774 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9775 |
<td valign="middle" align="left"> </td> |
| 9776 |
<td valign="middle" align="left"> </td> |
| 9777 |
<td valign="middle" align="left"> </td> |
| 9778 |
<td valign="middle" align="left"> </td> |
| 9779 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9780 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9781 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9782 |
</tr></table> |
| 9783 |
<a name="Exception-objects-related-to-C_002dinterface-1"></a> |
| 9784 |
<h2 class="section">15.5 Exception objects related to C-interface</h2> |
| 9785 |
|
| 9786 |
<a name="Definition_of_cfun-conversion-exception?"></a><a name="Procedure_cfun-conversion-exception?"></a><a name="index-cfun_002dconversion_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception?">cfun-conversion-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9787 |
<a name="Definition_of_cfun-conversion-exception-procedure"></a><a name="Procedure_cfun-conversion-exception-procedure"></a><a name="index-cfun_002dconversion_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-procedure">cfun-conversion-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9788 |
<a name="Definition_of_cfun-conversion-exception-arguments"></a><a name="Procedure_cfun-conversion-exception-arguments"></a><a name="index-cfun_002dconversion_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-arguments">cfun-conversion-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9789 |
<a name="Definition_of_cfun-conversion-exception-code"></a><a name="Procedure_cfun-conversion-exception-code"></a><a name="index-cfun_002dconversion_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-code">cfun-conversion-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9790 |
<a name="Definition_of_cfun-conversion-exception-message"></a><a name="Procedure_cfun-conversion-exception-message"></a><a name="index-cfun_002dconversion_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cfun-conversion-exception-message">cfun-conversion-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9791 |
|
| 9792 |
<p>Cfun-conversion-exception objects are raised by the C-interface when |
| 9793 |
converting between the Scheme representation and the C representation |
| 9794 |
of a value during a call from Scheme to C. The parameter <var>exc</var> |
| 9795 |
must be a cfun-conversion-exception object. |
| 9796 |
</p> |
| 9797 |
<p>The procedure <code>cfun-conversion-exception?</code> returns <code>#t</code> when |
| 9798 |
<var>obj</var> is a cfun-conversion-exception object and <code>#f</code> |
| 9799 |
otherwise. |
| 9800 |
</p> |
| 9801 |
<p>The procedure <code>cfun-conversion-exception-procedure</code> returns the |
| 9802 |
procedure that raised <var>exc</var>. |
| 9803 |
</p> |
| 9804 |
<p>The procedure <code>cfun-conversion-exception-arguments</code> returns the |
| 9805 |
list of arguments of the procedure that raised <var>exc</var>. |
| 9806 |
</p> |
| 9807 |
<p>The procedure <code>cfun-conversion-exception-code</code> returns an exact |
| 9808 |
integer error code that can be converted to a string by the |
| 9809 |
<code>err-code->string</code> procedure. |
| 9810 |
</p> |
| 9811 |
<p>The procedure <code>cfun-conversion-exception-message</code> returns |
| 9812 |
<code>#f</code> or a string giving details of the exception in a |
| 9813 |
human-readable form. |
| 9814 |
</p> |
| 9815 |
<p>For example: |
| 9816 |
</p> |
| 9817 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test1.scm</b> |
| 9818 |
(define weird |
| 9819 |
(c-lambda (char-string) nonnull-char-string |
| 9820 |
"___result = ___arg1;")) |
| 9821 |
$ <b>gsc test1.scm</b> |
| 9822 |
$ <b>gsi</b> |
| 9823 |
Gambit v4.7.3 |
| 9824 |
|
| 9825 |
> <b>(load "test1")</b> |
| 9826 |
"/Users/feeley/gambit/doc/test1.o1" |
| 9827 |
> <b>(weird "hello")</b> |
| 9828 |
"hello" |
| 9829 |
> <b>(define (handler exc) |
| 9830 |
(if (cfun-conversion-exception? exc) |
| 9831 |
(list (cfun-conversion-exception-procedure exc) |
| 9832 |
(cfun-conversion-exception-arguments exc) |
| 9833 |
(err-code->string (cfun-conversion-exception-code exc)) |
| 9834 |
(cfun-conversion-exception-message exc)) |
| 9835 |
'not-cfun-conversion-exception))</b> |
| 9836 |
> <b>(with-exception-catcher |
| 9837 |
handler |
| 9838 |
(lambda () (weird 'not-a-string)))</b> |
| 9839 |
(#<procedure #2 weird> |
| 9840 |
(not-a-string) |
| 9841 |
"(Argument 1) Can't convert to C char-string" |
| 9842 |
#f) |
| 9843 |
> <b>(with-exception-catcher |
| 9844 |
handler |
| 9845 |
(lambda () (weird #f)))</b> |
| 9846 |
(#<procedure #2 weird> |
| 9847 |
(#f) |
| 9848 |
"Can't convert result from C nonnull-char-string" |
| 9849 |
#f) |
| 9850 |
</pre></td></tr></table> |
| 9851 |
|
| 9852 |
|
| 9853 |
|
| 9854 |
<a name="Definition_of_sfun-conversion-exception?"></a><a name="Procedure_sfun-conversion-exception?"></a><a name="index-sfun_002dconversion_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception?">sfun-conversion-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9855 |
<a name="Definition_of_sfun-conversion-exception-procedure"></a><a name="Procedure_sfun-conversion-exception-procedure"></a><a name="index-sfun_002dconversion_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-procedure">sfun-conversion-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9856 |
<a name="Definition_of_sfun-conversion-exception-arguments"></a><a name="Procedure_sfun-conversion-exception-arguments"></a><a name="index-sfun_002dconversion_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-arguments">sfun-conversion-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9857 |
<a name="Definition_of_sfun-conversion-exception-code"></a><a name="Procedure_sfun-conversion-exception-code"></a><a name="index-sfun_002dconversion_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-code">sfun-conversion-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9858 |
<a name="Definition_of_sfun-conversion-exception-message"></a><a name="Procedure_sfun-conversion-exception-message"></a><a name="index-sfun_002dconversion_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_sfun-conversion-exception-message">sfun-conversion-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9859 |
|
| 9860 |
<p>Sfun-conversion-exception objects are raised by the C-interface when |
| 9861 |
converting between the Scheme representation and the C representation |
| 9862 |
of a value during a call from C to Scheme. The parameter <var>exc</var> |
| 9863 |
must be a sfun-conversion-exception object. |
| 9864 |
</p> |
| 9865 |
<p>The procedure <code>sfun-conversion-exception?</code> returns <code>#t</code> when |
| 9866 |
<var>obj</var> is a sfun-conversion-exception object and <code>#f</code> |
| 9867 |
otherwise. |
| 9868 |
</p> |
| 9869 |
<p>The procedure <code>sfun-conversion-exception-procedure</code> returns the |
| 9870 |
procedure that raised <var>exc</var>. |
| 9871 |
</p> |
| 9872 |
<p>The procedure <code>sfun-conversion-exception-arguments</code> returns the |
| 9873 |
list of arguments of the procedure that raised <var>exc</var>. |
| 9874 |
</p> |
| 9875 |
<p>The procedure <code>sfun-conversion-exception-code</code> returns an exact |
| 9876 |
integer error code that can be converted to a string by the |
| 9877 |
<code>err-code->string</code> procedure. |
| 9878 |
</p> |
| 9879 |
<p>The procedure <code>sfun-conversion-exception-message</code> returns |
| 9880 |
<code>#f</code> or a string giving details of the exception in a |
| 9881 |
human-readable form. |
| 9882 |
</p> |
| 9883 |
<p>For example: |
| 9884 |
</p> |
| 9885 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test2.scm</b> |
| 9886 |
(c-define (f str) (nonnull-char-string) int "f" "" |
| 9887 |
(string->number str)) |
| 9888 |
(define t1 (c-lambda () int "___result = f (\"123\");")) |
| 9889 |
(define t2 (c-lambda () int "___result = f (0);")) |
| 9890 |
(define t3 (c-lambda () int "___result = f (\"1.5\");")) |
| 9891 |
$ <b>gsc test2.scm</b> |
| 9892 |
$ <b>gsi</b> |
| 9893 |
Gambit v4.7.3 |
| 9894 |
|
| 9895 |
> <b>(load "test2")</b> |
| 9896 |
"/u/feeley/test2.o1" |
| 9897 |
> <b>(t1)</b> |
| 9898 |
123 |
| 9899 |
> <b>(define (handler exc) |
| 9900 |
(if (sfun-conversion-exception? exc) |
| 9901 |
(list (sfun-conversion-exception-procedure exc) |
| 9902 |
(sfun-conversion-exception-arguments exc) |
| 9903 |
(err-code->string (sfun-conversion-exception-code exc)) |
| 9904 |
(sfun-conversion-exception-message exc)) |
| 9905 |
'not-sfun-conversion-exception))</b> |
| 9906 |
> <b>(with-exception-catcher handler t2)</b> |
| 9907 |
(#<procedure #2 f> |
| 9908 |
() |
| 9909 |
"(Argument 1) Can't convert from C nonnull-char-string" |
| 9910 |
#f) |
| 9911 |
> <b>(with-exception-catcher handler t3)</b> |
| 9912 |
(#<procedure #2 f> () "Can't convert result to C int" #f) |
| 9913 |
</pre></td></tr></table> |
| 9914 |
|
| 9915 |
|
| 9916 |
|
| 9917 |
<a name="Definition_of_multiple-c-return-exception?"></a><a name="Procedure_multiple-c-return-exception?"></a><a name="index-multiple_002dc_002dreturn_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_multiple-c-return-exception?">multiple-c-return-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9918 |
|
| 9919 |
<p>Multiple-c-return-exception objects are raised by the C-interface when |
| 9920 |
a C to Scheme procedure call returns and that call’s stack frame is no |
| 9921 |
longer on the C stack because the call has already returned, or has |
| 9922 |
been removed from the C stack by a <code>longjump</code>. |
| 9923 |
</p> |
| 9924 |
<p>The procedure <code>multiple-c-return-exception?</code> returns <code>#t</code> |
| 9925 |
when <var>obj</var> is a multiple-c-return-exception object and <code>#f</code> |
| 9926 |
otherwise. |
| 9927 |
</p> |
| 9928 |
<p>For example: |
| 9929 |
</p> |
| 9930 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>cat test3.scm</b> |
| 9931 |
(c-define (f str) (char-string) scheme-object "f" "" |
| 9932 |
(pp (list 'entry 'str= str)) |
| 9933 |
(let ((k (call-with-current-continuation (lambda (k) k)))) |
| 9934 |
(pp (list 'exit 'k= k)) |
| 9935 |
k)) |
| 9936 |
(define scheme-to-c-to-scheme-and-back |
| 9937 |
(c-lambda (char-string) scheme-object |
| 9938 |
"___result = f (___arg1);")) |
| 9939 |
$ <b>gsc test3.scm</b> |
| 9940 |
$ <b>gsi</b> |
| 9941 |
Gambit v4.7.3 |
| 9942 |
|
| 9943 |
> <b>(load "test3")</b> |
| 9944 |
"/Users/feeley/gambit/doc/test3.o1" |
| 9945 |
> <b>(define (handler exc) |
| 9946 |
(if (multiple-c-return-exception? exc) |
| 9947 |
exc |
| 9948 |
'not-multiple-c-return-exception))</b> |
| 9949 |
> <b>(with-exception-catcher |
| 9950 |
handler |
| 9951 |
(lambda () |
| 9952 |
(let ((c (scheme-to-c-to-scheme-and-back "hello"))) |
| 9953 |
(pp c) |
| 9954 |
(c 999))))</b> |
| 9955 |
(entry str= "hello") |
| 9956 |
(exit k= #<procedure #2>) |
| 9957 |
#<procedure #2> |
| 9958 |
(exit k= 999) |
| 9959 |
#<multiple-c-return-exception #3> |
| 9960 |
</pre></td></tr></table> |
| 9961 |
|
| 9962 |
|
| 9963 |
|
| 9964 |
<a name="Exception-objects-related-to-the-reader"></a><hr size="6"><br/><br/><br/> |
| 9965 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 9966 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-C_002dinterface" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 9967 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-evaluation-and-compilation" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 9968 |
<td valign="middle" align="left"> </td> |
| 9969 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 9970 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 9971 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 9972 |
<td valign="middle" align="left"> </td> |
| 9973 |
<td valign="middle" align="left"> </td> |
| 9974 |
<td valign="middle" align="left"> </td> |
| 9975 |
<td valign="middle" align="left"> </td> |
| 9976 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 9977 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 9978 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 9979 |
</tr></table> |
| 9980 |
<a name="Exception-objects-related-to-the-reader-1"></a> |
| 9981 |
<h2 class="section">15.6 Exception objects related to the reader</h2> |
| 9982 |
|
| 9983 |
<a name="Definition_of_datum-parsing-exception?"></a><a name="Procedure_datum-parsing-exception?"></a><a name="index-datum_002dparsing_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception?">datum-parsing-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9984 |
<a name="Definition_of_datum-parsing-exception-kind"></a><a name="Procedure_datum-parsing-exception-kind"></a><a name="index-datum_002dparsing_002dexception_002dkind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-kind">datum-parsing-exception-kind</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9985 |
<a name="Definition_of_datum-parsing-exception-parameters"></a><a name="Procedure_datum-parsing-exception-parameters"></a><a name="index-datum_002dparsing_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-parameters">datum-parsing-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9986 |
<a name="Definition_of_datum-parsing-exception-readenv"></a><a name="Procedure_datum-parsing-exception-readenv"></a><a name="index-datum_002dparsing_002dexception_002dreadenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_datum-parsing-exception-readenv">datum-parsing-exception-readenv</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 9987 |
|
| 9988 |
<p>Datum-parsing-exception objects are raised by the reader (i.e. the |
| 9989 |
<code>read</code> procedure) when the input does not conform to the grammar |
| 9990 |
for datum. The parameter <var>exc</var> must be a datum-parsing-exception |
| 9991 |
object. |
| 9992 |
</p> |
| 9993 |
<p>The procedure <code>datum-parsing-exception?</code> returns <code>#t</code> when |
| 9994 |
<var>obj</var> is a datum-parsing-exception object and <code>#f</code> |
| 9995 |
otherwise. |
| 9996 |
</p> |
| 9997 |
<p>The procedure <code>datum-parsing-exception-kind</code> returns a symbol |
| 9998 |
denoting the kind of parsing error that was encountered by the |
| 9999 |
reader when it raised <var>exc</var>. Here is a table of the possible |
| 10000 |
return values: |
| 10001 |
</p> |
| 10002 |
<table> |
| 10003 |
<tr><td width="50%"><code>datum-or-eof-expected</code></td><td width="50%">Datum or EOF expected</td></tr> |
| 10004 |
<tr><td width="50%"><code>datum-expected</code></td><td width="50%">Datum expected</td></tr> |
| 10005 |
<tr><td width="50%"><code>improperly-placed-dot</code></td><td width="50%">Improperly placed dot</td></tr> |
| 10006 |
<tr><td width="50%"><code>incomplete-form-eof-reached</code></td><td width="50%">Incomplete form, EOF reached</td></tr> |
| 10007 |
<tr><td width="50%"><code>incomplete-form</code></td><td width="50%">Incomplete form</td></tr> |
| 10008 |
<tr><td width="50%"><code>character-out-of-range</code></td><td width="50%">Character out of range</td></tr> |
| 10009 |
<tr><td width="50%"><code>invalid-character-name</code></td><td width="50%">Invalid ’#\’ name</td></tr> |
| 10010 |
<tr><td width="50%"><code>illegal-character</code></td><td width="50%">Illegal character</td></tr> |
| 10011 |
<tr><td width="50%"><code>s8-expected</code></td><td width="50%">Signed 8 bit exact integer expected</td></tr> |
| 10012 |
<tr><td width="50%"><code>u8-expected</code></td><td width="50%">Unsigned 8 bit exact integer expected</td></tr> |
| 10013 |
<tr><td width="50%"><code>s16-expected</code></td><td width="50%">Signed 16 bit exact integer expected</td></tr> |
| 10014 |
<tr><td width="50%"><code>u16-expected</code></td><td width="50%">Unsigned 16 bit exact integer expected</td></tr> |
| 10015 |
<tr><td width="50%"><code>s32-expected</code></td><td width="50%">Signed 32 bit exact integer expected</td></tr> |
| 10016 |
<tr><td width="50%"><code>u32-expected</code></td><td width="50%">Unsigned 32 bit exact integer expected</td></tr> |
| 10017 |
<tr><td width="50%"><code>s64-expected</code></td><td width="50%">Signed 64 bit exact integer expected</td></tr> |
| 10018 |
<tr><td width="50%"><code>u64-expected</code></td><td width="50%">Unsigned 64 bit exact integer expected</td></tr> |
| 10019 |
<tr><td width="50%"><code>inexact-real-expected</code></td><td width="50%">Inexact real expected</td></tr> |
| 10020 |
<tr><td width="50%"><code>invalid-hex-escape</code></td><td width="50%">Invalid hexadecimal escape</td></tr> |
| 10021 |
<tr><td width="50%"><code>invalid-escaped-character</code></td><td width="50%">Invalid escaped character</td></tr> |
| 10022 |
<tr><td width="50%"><code>open-paren-expected</code></td><td width="50%">’(’ expected</td></tr> |
| 10023 |
<tr><td width="50%"><code>invalid-token</code></td><td width="50%">Invalid token</td></tr> |
| 10024 |
<tr><td width="50%"><code>invalid-sharp-bang-name</code></td><td width="50%">Invalid ’#!’ name</td></tr> |
| 10025 |
<tr><td width="50%"><code>duplicate-label-definition</code></td><td width="50%">Duplicate definition for label</td></tr> |
| 10026 |
<tr><td width="50%"><code>missing-label-definition</code></td><td width="50%">Missing definition for label</td></tr> |
| 10027 |
<tr><td width="50%"><code>illegal-label-definition</code></td><td width="50%">Illegal definition of label</td></tr> |
| 10028 |
<tr><td width="50%"><code>invalid-infix-syntax-character</code></td><td width="50%">Invalid infix syntax character</td></tr> |
| 10029 |
<tr><td width="50%"><code>invalid-infix-syntax-number</code></td><td width="50%">Invalid infix syntax number</td></tr> |
| 10030 |
<tr><td width="50%"><code>invalid-infix-syntax</code></td><td width="50%">Invalid infix syntax</td></tr> |
| 10031 |
</table> |
| 10032 |
|
| 10033 |
<p>The procedure <code>datum-parsing-exception-parameters</code> returns a list |
| 10034 |
of the parameters associated with the parsing error that was |
| 10035 |
encountered by the reader when it raised <var>exc</var>. |
| 10036 |
</p> |
| 10037 |
<p>For example: |
| 10038 |
</p> |
| 10039 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10040 |
(if (datum-parsing-exception? exc) |
| 10041 |
(list (datum-parsing-exception-kind exc) |
| 10042 |
(datum-parsing-exception-parameters exc)) |
| 10043 |
'not-datum-parsing-exception))</b> |
| 10044 |
> <b>(with-exception-catcher |
| 10045 |
handler |
| 10046 |
(lambda () |
| 10047 |
(with-input-from-string "(s #\\pace)" read)))</b> |
| 10048 |
(invalid-character-name ("pace")) |
| 10049 |
</pre></td></tr></table> |
| 10050 |
|
| 10051 |
|
| 10052 |
|
| 10053 |
<a name="Exception-objects-related-to-evaluation-and-compilation"></a><hr size="6"><br/><br/><br/> |
| 10054 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10055 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-the-reader" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10056 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-type-checking" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10057 |
<td valign="middle" align="left"> </td> |
| 10058 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10059 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10060 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10061 |
<td valign="middle" align="left"> </td> |
| 10062 |
<td valign="middle" align="left"> </td> |
| 10063 |
<td valign="middle" align="left"> </td> |
| 10064 |
<td valign="middle" align="left"> </td> |
| 10065 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10066 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10067 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10068 |
</tr></table> |
| 10069 |
<a name="Exception-objects-related-to-evaluation-and-compilation-1"></a> |
| 10070 |
<h2 class="section">15.7 Exception objects related to evaluation and compilation</h2> |
| 10071 |
|
| 10072 |
<a name="Definition_of_expression-parsing-exception?"></a><a name="Procedure_expression-parsing-exception?"></a><a name="index-expression_002dparsing_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception?">expression-parsing-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10073 |
<a name="Definition_of_expression-parsing-exception-kind"></a><a name="Procedure_expression-parsing-exception-kind"></a><a name="index-expression_002dparsing_002dexception_002dkind"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-kind">expression-parsing-exception-kind</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10074 |
<a name="Definition_of_expression-parsing-exception-parameters"></a><a name="Procedure_expression-parsing-exception-parameters"></a><a name="index-expression_002dparsing_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-parameters">expression-parsing-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10075 |
<a name="Definition_of_expression-parsing-exception-source"></a><a name="Procedure_expression-parsing-exception-source"></a><a name="index-expression_002dparsing_002dexception_002dsource"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_expression-parsing-exception-source">expression-parsing-exception-source</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10076 |
|
| 10077 |
<p>Expression-parsing-exception objects are raised by the evaluator and |
| 10078 |
compiler (i.e. the procedures <code>eval</code>, <code>compile-file</code>, etc) |
| 10079 |
when the input does not conform to the grammar for expression. The |
| 10080 |
parameter <var>exc</var> must be a expression-parsing-exception object. |
| 10081 |
</p> |
| 10082 |
<p>The procedure <code>expression-parsing-exception?</code> returns <code>#t</code> when |
| 10083 |
<var>obj</var> is a expression-parsing-exception object and <code>#f</code> |
| 10084 |
otherwise. |
| 10085 |
</p> |
| 10086 |
<p>The procedure <code>expression-parsing-exception-kind</code> returns a |
| 10087 |
symbol denoting the kind of parsing error that was encountered by the |
| 10088 |
evaluator or compiler when it raised <var>exc</var>. Here is a table of |
| 10089 |
the possible return values: |
| 10090 |
</p> |
| 10091 |
<table> |
| 10092 |
<tr><td width="50%"><code>id-expected</code></td><td width="50%">Identifier expected</td></tr> |
| 10093 |
<tr><td width="50%"><code>ill-formed-namespace</code></td><td width="50%">Ill-formed namespace</td></tr> |
| 10094 |
<tr><td width="50%"><code>ill-formed-namespace-prefix</code></td><td width="50%">Ill-formed namespace prefix</td></tr> |
| 10095 |
<tr><td width="50%"><code>namespace-prefix-must-be-string</code></td><td width="50%">Namespace prefix must be a string</td></tr> |
| 10096 |
<tr><td width="50%"><code>macro-used-as-variable</code></td><td width="50%">Macro name can’t be used as a variable</td></tr> |
| 10097 |
<tr><td width="50%"><code>variable-is-immutable</code></td><td width="50%">Variable is immutable</td></tr> |
| 10098 |
<tr><td width="50%"><code>ill-formed-macro-transformer</code></td><td width="50%">Macro transformer must be a lambda expression</td></tr> |
| 10099 |
<tr><td width="50%"><code>reserved-used-as-variable</code></td><td width="50%">Reserved identifier can’t be used as a variable</td></tr> |
| 10100 |
<tr><td width="50%"><code>ill-formed-special-form</code></td><td width="50%">Ill-formed special form</td></tr> |
| 10101 |
<tr><td width="50%"><code>cannot-open-file</code></td><td width="50%">Can’t open file</td></tr> |
| 10102 |
<tr><td width="50%"><code>filename-expected</code></td><td width="50%">Filename expected</td></tr> |
| 10103 |
<tr><td width="50%"><code>ill-placed-define</code></td><td width="50%">Ill-placed ’define’</td></tr> |
| 10104 |
<tr><td width="50%"><code>ill-placed-**include</code></td><td width="50%">Ill-placed ’##include’</td></tr> |
| 10105 |
<tr><td width="50%"><code>ill-placed-**define-macro</code></td><td width="50%">Ill-placed ’##define-macro’</td></tr> |
| 10106 |
<tr><td width="50%"><code>ill-placed-**declare</code></td><td width="50%">Ill-placed ’##declare’</td></tr> |
| 10107 |
<tr><td width="50%"><code>ill-placed-**namespace</code></td><td width="50%">Ill-placed ’##namespace’</td></tr> |
| 10108 |
<tr><td width="50%"><code>ill-formed-expression</code></td><td width="50%">Ill-formed expression</td></tr> |
| 10109 |
<tr><td width="50%"><code>unsupported-special-form</code></td><td width="50%">Interpreter does not support</td></tr> |
| 10110 |
<tr><td width="50%"><code>ill-placed-unquote</code></td><td width="50%">Ill-placed ’unquote’</td></tr> |
| 10111 |
<tr><td width="50%"><code>ill-placed-unquote-splicing</code></td><td width="50%">Ill-placed ’unquote-splicing’</td></tr> |
| 10112 |
<tr><td width="50%"><code>parameter-must-be-id</code></td><td width="50%">Parameter must be an identifier</td></tr> |
| 10113 |
<tr><td width="50%"><code>parameter-must-be-id-or-default</code></td><td width="50%">Parameter must be an identifier or default binding</td></tr> |
| 10114 |
<tr><td width="50%"><code>duplicate-parameter</code></td><td width="50%">Duplicate parameter in parameter list</td></tr> |
| 10115 |
<tr><td width="50%"><code>ill-placed-dotted-rest-parameter</code></td><td width="50%">Ill-placed dotted rest parameter</td></tr> |
| 10116 |
<tr><td width="50%"><code>parameter-expected-after-rest</code></td><td width="50%">#!rest must be followed by a parameter</td></tr> |
| 10117 |
<tr><td width="50%"><code>ill-formed-default</code></td><td width="50%">Ill-formed default binding</td></tr> |
| 10118 |
<tr><td width="50%"><code>ill-placed-optional</code></td><td width="50%">Ill-placed #!optional</td></tr> |
| 10119 |
<tr><td width="50%"><code>ill-placed-rest</code></td><td width="50%">Ill-placed #!rest</td></tr> |
| 10120 |
<tr><td width="50%"><code>ill-placed-key</code></td><td width="50%">Ill-placed #!key</td></tr> |
| 10121 |
<tr><td width="50%"><code>key-expected-after-rest</code></td><td width="50%">#!key expected after rest parameter</td></tr> |
| 10122 |
<tr><td width="50%"><code>ill-placed-default</code></td><td width="50%">Ill-placed default binding</td></tr> |
| 10123 |
<tr><td width="50%"><code>duplicate-variable-definition</code></td><td width="50%">Duplicate definition of a variable</td></tr> |
| 10124 |
<tr><td width="50%"><code>empty-body</code></td><td width="50%">Body must contain at least one expression</td></tr> |
| 10125 |
<tr><td width="50%"><code>variable-must-be-id</code></td><td width="50%">Defined variable must be an identifier</td></tr> |
| 10126 |
<tr><td width="50%"><code>else-clause-not-last</code></td><td width="50%">Else clause must be last</td></tr> |
| 10127 |
<tr><td width="50%"><code>ill-formed-selector-list</code></td><td width="50%">Ill-formed selector list</td></tr> |
| 10128 |
<tr><td width="50%"><code>duplicate-variable-binding</code></td><td width="50%">Duplicate variable in bindings</td></tr> |
| 10129 |
<tr><td width="50%"><code>ill-formed-binding-list</code></td><td width="50%">Ill-formed binding list</td></tr> |
| 10130 |
<tr><td width="50%"><code>ill-formed-call</code></td><td width="50%">Ill-formed procedure call</td></tr> |
| 10131 |
<tr><td width="50%"><code>ill-formed-cond-expand</code></td><td width="50%">Ill-formed ’cond-expand’</td></tr> |
| 10132 |
<tr><td width="50%"><code>unfulfilled-cond-expand</code></td><td width="50%">Unfulfilled ’cond-expand’</td></tr> |
| 10133 |
</table> |
| 10134 |
|
| 10135 |
<p>The procedure <code>expression-parsing-exception-parameters</code> returns a list |
| 10136 |
of the parameters associated with the parsing error that was |
| 10137 |
encountered by the evaluator or compiler when it raised <var>exc</var>. |
| 10138 |
</p> |
| 10139 |
<p>For example: |
| 10140 |
</p> |
| 10141 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10142 |
(if (expression-parsing-exception? exc) |
| 10143 |
(list (expression-parsing-exception-kind exc) |
| 10144 |
(expression-parsing-exception-parameters exc)) |
| 10145 |
'not-expression-parsing-exception))</b> |
| 10146 |
> <b>(with-exception-catcher |
| 10147 |
handler |
| 10148 |
(lambda () |
| 10149 |
(eval '(+ do 1))))</b> |
| 10150 |
(reserved-used-as-variable (do)) |
| 10151 |
</pre></td></tr></table> |
| 10152 |
|
| 10153 |
|
| 10154 |
|
| 10155 |
<a name="Definition_of_unbound-global-exception?"></a><a name="Procedure_unbound-global-exception?"></a><a name="index-unbound_002dglobal_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-global-exception?">unbound-global-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10156 |
<a name="Definition_of_unbound-global-exception-variable"></a><a name="Procedure_unbound-global-exception-variable"></a><a name="index-unbound_002dglobal_002dexception_002dvariable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-variable">unbound-global-exception-variable</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10157 |
<a name="Definition_of_unbound-global-exception-code"></a><a name="Procedure_unbound-global-exception-code"></a><a name="index-unbound_002dglobal_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-code">unbound-global-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10158 |
<a name="Definition_of_unbound-global-exception-rte"></a><a name="Procedure_unbound-global-exception-rte"></a><a name="index-unbound_002dglobal_002dexception_002drte"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unbound-global-exception-rte">unbound-global-exception-rte</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10159 |
|
| 10160 |
<p>Unbound-global-exception objects are raised when an unbound global |
| 10161 |
variable is accessed. The parameter <var>exc</var> must be an |
| 10162 |
unbound-global-exception object. |
| 10163 |
</p> |
| 10164 |
<p>The procedure <code>unbound-global-exception?</code> returns |
| 10165 |
<code>#t</code> when <var>obj</var> is an unbound-global-exception |
| 10166 |
object and <code>#f</code> otherwise. |
| 10167 |
</p> |
| 10168 |
<p>The procedure <code>unbound-global-exception-variable</code> returns a |
| 10169 |
symbol identifying the unbound global variable. |
| 10170 |
</p> |
| 10171 |
<p>For example: |
| 10172 |
</p> |
| 10173 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10174 |
(if (unbound-global-exception? exc) |
| 10175 |
(list 'variable= (unbound-global-exception-variable exc)) |
| 10176 |
'not-unbound-global-exception))</b> |
| 10177 |
> <b>(with-exception-catcher |
| 10178 |
handler |
| 10179 |
(lambda () foo))</b> |
| 10180 |
(variable= foo) |
| 10181 |
</pre></td></tr></table> |
| 10182 |
|
| 10183 |
|
| 10184 |
|
| 10185 |
<a name="Exception-objects-related-to-type-checking"></a><hr size="6"><br/><br/><br/> |
| 10186 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10187 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-evaluation-and-compilation" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10188 |
<td valign="middle" align="left"><a href="#Exception-objects-related-to-procedure-call" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10189 |
<td valign="middle" align="left"> </td> |
| 10190 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10191 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10192 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10193 |
<td valign="middle" align="left"> </td> |
| 10194 |
<td valign="middle" align="left"> </td> |
| 10195 |
<td valign="middle" align="left"> </td> |
| 10196 |
<td valign="middle" align="left"> </td> |
| 10197 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10198 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10199 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10200 |
</tr></table> |
| 10201 |
<a name="Exception-objects-related-to-type-checking-1"></a> |
| 10202 |
<h2 class="section">15.8 Exception objects related to type checking</h2> |
| 10203 |
|
| 10204 |
<a name="Definition_of_type-exception?"></a><a name="Procedure_type-exception?"></a><a name="index-type_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_type-exception?">type-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10205 |
<a name="Definition_of_type-exception-procedure"></a><a name="Procedure_type-exception-procedure"></a><a name="index-type_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_type-exception-procedure">type-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10206 |
<a name="Definition_of_type-exception-arguments"></a><a name="Procedure_type-exception-arguments"></a><a name="index-type_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_type-exception-arguments">type-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10207 |
<a name="Definition_of_type-exception-arg-num"></a><a name="Procedure_type-exception-arg-num"></a><a name="index-type_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_type-exception-arg-num">type-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10208 |
<a name="Definition_of_type-exception-type-id"></a><a name="Procedure_type-exception-type-id"></a><a name="index-type_002dexception_002dtype_002did"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_type-exception-type-id">type-exception-type-id</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10209 |
|
| 10210 |
<p>Type-exception objects are raised when a primitive procedure is called |
| 10211 |
with an argument of incorrect type (i.e. when a run time type-check |
| 10212 |
fails). The parameter <var>exc</var> must be a type-exception object. |
| 10213 |
</p> |
| 10214 |
<p>The procedure <code>type-exception?</code> returns |
| 10215 |
<code>#t</code> when <var>obj</var> is a type-exception |
| 10216 |
object and <code>#f</code> otherwise. |
| 10217 |
</p> |
| 10218 |
<p>The procedure <code>type-exception-procedure</code> |
| 10219 |
returns the procedure that raised <var>exc</var>. |
| 10220 |
</p> |
| 10221 |
<p>The procedure <code>type-exception-arguments</code> |
| 10222 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10223 |
</p> |
| 10224 |
<p>The procedure <code>type-exception-arg-num</code> returns the position of the |
| 10225 |
argument whose type is incorrect. Position 1 is the first argument. |
| 10226 |
</p> |
| 10227 |
<p>The procedure <code>type-exception-type-id</code> returns an identifier of |
| 10228 |
the type expected. The type-id can be a symbol, such as <code>number</code> |
| 10229 |
and <code>string-or-nonnegative-fixnum</code>, or a record type descriptor. |
| 10230 |
</p> |
| 10231 |
<p>For example: |
| 10232 |
</p> |
| 10233 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10234 |
(if (type-exception? exc) |
| 10235 |
(list (type-exception-procedure exc) |
| 10236 |
(type-exception-arguments exc) |
| 10237 |
(type-exception-arg-num exc) |
| 10238 |
(type-exception-type-id exc)) |
| 10239 |
'not-type-exception))</b> |
| 10240 |
> <b>(with-exception-catcher |
| 10241 |
handler |
| 10242 |
(lambda () (vector-ref '#(a b c) 'foo)))</b> |
| 10243 |
(#<procedure #2 vector-ref> (#(a b c) foo) 2 exact-integer) |
| 10244 |
> <b>(with-exception-catcher |
| 10245 |
handler |
| 10246 |
(lambda () (time->seconds 'foo)))</b> |
| 10247 |
(#<procedure #3 time->seconds> (foo) 1 #<type #4 time>) |
| 10248 |
</pre></td></tr></table> |
| 10249 |
|
| 10250 |
|
| 10251 |
|
| 10252 |
<a name="Definition_of_range-exception?"></a><a name="Procedure_range-exception?"></a><a name="index-range_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_range-exception?">range-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10253 |
<a name="Definition_of_range-exception-procedure"></a><a name="Procedure_range-exception-procedure"></a><a name="index-range_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_range-exception-procedure">range-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10254 |
<a name="Definition_of_range-exception-arguments"></a><a name="Procedure_range-exception-arguments"></a><a name="index-range_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_range-exception-arguments">range-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10255 |
<a name="Definition_of_range-exception-arg-num"></a><a name="Procedure_range-exception-arg-num"></a><a name="index-range_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_range-exception-arg-num">range-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10256 |
|
| 10257 |
<p>Range-exception objects are raised when a numeric parameter is not in |
| 10258 |
the allowed range. The parameter <var>exc</var> must be a range-exception |
| 10259 |
object. |
| 10260 |
</p> |
| 10261 |
<p>The procedure <code>range-exception?</code> returns <code>#t</code> when <var>obj</var> |
| 10262 |
is a range-exception object and <code>#f</code> otherwise. |
| 10263 |
</p> |
| 10264 |
<p>The procedure <code>range-exception-procedure</code> |
| 10265 |
returns the procedure that raised <var>exc</var>. |
| 10266 |
</p> |
| 10267 |
<p>The procedure <code>range-exception-arguments</code> |
| 10268 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10269 |
</p> |
| 10270 |
<p>The procedure <code>range-exception-arg-num</code> returns the position of |
| 10271 |
the argument which is not in the allowed range. Position 1 is the |
| 10272 |
first argument. |
| 10273 |
</p> |
| 10274 |
<p>For example: |
| 10275 |
</p> |
| 10276 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10277 |
(if (range-exception? exc) |
| 10278 |
(list (range-exception-procedure exc) |
| 10279 |
(range-exception-arguments exc) |
| 10280 |
(range-exception-arg-num exc)) |
| 10281 |
'not-range-exception))</b> |
| 10282 |
> <b>(with-exception-catcher |
| 10283 |
handler |
| 10284 |
(lambda () (string-ref "abcde" 10)))</b> |
| 10285 |
(#<procedure #2 string-ref> ("abcde" 10) 2) |
| 10286 |
</pre></td></tr></table> |
| 10287 |
|
| 10288 |
|
| 10289 |
|
| 10290 |
<a name="Definition_of_divide-by-zero-exception?"></a><a name="Procedure_divide-by-zero-exception?"></a><a name="index-divide_002dby_002dzero_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception?">divide-by-zero-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10291 |
<a name="Definition_of_divide-by-zero-exception-procedure"></a><a name="Procedure_divide-by-zero-exception-procedure"></a><a name="index-divide_002dby_002dzero_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception-procedure">divide-by-zero-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10292 |
<a name="Definition_of_divide-by-zero-exception-arguments"></a><a name="Procedure_divide-by-zero-exception-arguments"></a><a name="index-divide_002dby_002dzero_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_divide-by-zero-exception-arguments">divide-by-zero-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10293 |
|
| 10294 |
<p>Divide-by-zero-exception objects are raised when a division by zero is |
| 10295 |
attempted. The parameter <var>exc</var> must be a divide-by-zero-exception |
| 10296 |
object. |
| 10297 |
</p> |
| 10298 |
<p>The procedure <code>divide-by-zero-exception?</code> returns |
| 10299 |
<code>#t</code> when <var>obj</var> is a divide-by-zero-exception |
| 10300 |
object and <code>#f</code> otherwise. |
| 10301 |
</p> |
| 10302 |
<p>The procedure <code>divide-by-zero-exception-procedure</code> |
| 10303 |
returns the procedure that raised <var>exc</var>. |
| 10304 |
</p> |
| 10305 |
<p>The procedure <code>divide-by-zero-exception-arguments</code> |
| 10306 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10307 |
</p> |
| 10308 |
<p>For example: |
| 10309 |
</p> |
| 10310 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10311 |
(if (divide-by-zero-exception? exc) |
| 10312 |
(list (divide-by-zero-exception-procedure exc) |
| 10313 |
(divide-by-zero-exception-arguments exc)) |
| 10314 |
'not-divide-by-zero-exception))</b> |
| 10315 |
> <b>(with-exception-catcher |
| 10316 |
handler |
| 10317 |
(lambda () (/ 5 0 7)))</b> |
| 10318 |
(#<procedure #2 /> (5 0 7)) |
| 10319 |
</pre></td></tr></table> |
| 10320 |
|
| 10321 |
|
| 10322 |
|
| 10323 |
<a name="Definition_of_improper-length-list-exception?"></a><a name="Procedure_improper-length-list-exception?"></a><a name="index-improper_002dlength_002dlist_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception?">improper-length-list-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10324 |
<a name="Definition_of_improper-length-list-exception-procedure"></a><a name="Procedure_improper-length-list-exception-procedure"></a><a name="index-improper_002dlength_002dlist_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-procedure">improper-length-list-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10325 |
<a name="Definition_of_improper-length-list-exception-arguments"></a><a name="Procedure_improper-length-list-exception-arguments"></a><a name="index-improper_002dlength_002dlist_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-arguments">improper-length-list-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10326 |
<a name="Definition_of_improper-length-list-exception-arg-num"></a><a name="Procedure_improper-length-list-exception-arg-num"></a><a name="index-improper_002dlength_002dlist_002dexception_002darg_002dnum"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_improper-length-list-exception-arg-num">improper-length-list-exception-arg-num</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10327 |
|
| 10328 |
<p>Improper-length-list-exception objects are raised by the <code>map</code> |
| 10329 |
and <code>for-each</code> procedures when they are called with two or more |
| 10330 |
list arguments and the lists are not of the same length. The |
| 10331 |
parameter <var>exc</var> must be an improper-length-list-exception object. |
| 10332 |
</p> |
| 10333 |
<p>The procedure <code>improper-length-list-exception?</code> returns |
| 10334 |
<code>#t</code> when <var>obj</var> is an improper-length-list-exception |
| 10335 |
object and <code>#f</code> otherwise. |
| 10336 |
</p> |
| 10337 |
<p>The procedure <code>improper-length-list-exception-procedure</code> |
| 10338 |
returns the procedure that raised <var>exc</var>. |
| 10339 |
</p> |
| 10340 |
<p>The procedure <code>improper-length-list-exception-arguments</code> |
| 10341 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10342 |
</p> |
| 10343 |
<p>The procedure <code>improper-length-list-exception-arg-num</code> returns |
| 10344 |
the position of the argument whose length is the shortest. Position 1 |
| 10345 |
is the first argument. |
| 10346 |
</p> |
| 10347 |
<p>For example: |
| 10348 |
</p> |
| 10349 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10350 |
(if (improper-length-list-exception? exc) |
| 10351 |
(list (improper-length-list-exception-procedure exc) |
| 10352 |
(improper-length-list-exception-arguments exc) |
| 10353 |
(improper-length-list-exception-arg-num exc)) |
| 10354 |
'not-improper-length-list-exception))</b> |
| 10355 |
> <b>(with-exception-catcher |
| 10356 |
handler |
| 10357 |
(lambda () (map + '(1 2) '(3) '(4 5))))</b> |
| 10358 |
(#<procedure #2 map> (#<procedure #3 +> (1 2) (3) (4 5)) 3) |
| 10359 |
</pre></td></tr></table> |
| 10360 |
|
| 10361 |
|
| 10362 |
|
| 10363 |
<a name="Exception-objects-related-to-procedure-call"></a><hr size="6"><br/><br/><br/> |
| 10364 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10365 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-type-checking" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10366 |
<td valign="middle" align="left"><a href="#Other-exception-objects" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10367 |
<td valign="middle" align="left"> </td> |
| 10368 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10369 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10370 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10371 |
<td valign="middle" align="left"> </td> |
| 10372 |
<td valign="middle" align="left"> </td> |
| 10373 |
<td valign="middle" align="left"> </td> |
| 10374 |
<td valign="middle" align="left"> </td> |
| 10375 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10376 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10377 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10378 |
</tr></table> |
| 10379 |
<a name="Exception-objects-related-to-procedure-call-1"></a> |
| 10380 |
<h2 class="section">15.9 Exception objects related to procedure call</h2> |
| 10381 |
|
| 10382 |
<a name="Definition_of_wrong-number-of-arguments-exception?"></a><a name="Procedure_wrong-number-of-arguments-exception?"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception?">wrong-number-of-arguments-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10383 |
<a name="Definition_of_wrong-number-of-arguments-exception-procedure"></a><a name="Procedure_wrong-number-of-arguments-exception-procedure"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception-procedure">wrong-number-of-arguments-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10384 |
<a name="Definition_of_wrong-number-of-arguments-exception-arguments"></a><a name="Procedure_wrong-number-of-arguments-exception-arguments"></a><a name="index-wrong_002dnumber_002dof_002darguments_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_wrong-number-of-arguments-exception-arguments">wrong-number-of-arguments-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10385 |
|
| 10386 |
<p>Wrong-number-of-arguments-exception objects are raised when a |
| 10387 |
procedure is called with the wrong number of arguments. The parameter |
| 10388 |
<var>exc</var> must be a wrong-number-of-arguments-exception object. |
| 10389 |
</p> |
| 10390 |
<p>The procedure <code>wrong-number-of-arguments-exception?</code> returns |
| 10391 |
<code>#t</code> when <var>obj</var> is a wrong-number-of-arguments-exception |
| 10392 |
object and <code>#f</code> otherwise. |
| 10393 |
</p> |
| 10394 |
<p>The procedure <code>wrong-number-of-arguments-exception-procedure</code> |
| 10395 |
returns the procedure that raised <var>exc</var>. |
| 10396 |
</p> |
| 10397 |
<p>The procedure <code>wrong-number-of-arguments-exception-arguments</code> |
| 10398 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10399 |
</p> |
| 10400 |
<p>For example: |
| 10401 |
</p> |
| 10402 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10403 |
(if (wrong-number-of-arguments-exception? exc) |
| 10404 |
(list (wrong-number-of-arguments-exception-procedure exc) |
| 10405 |
(wrong-number-of-arguments-exception-arguments exc)) |
| 10406 |
'not-wrong-number-of-arguments-exception))</b> |
| 10407 |
> <b>(with-exception-catcher |
| 10408 |
handler |
| 10409 |
(lambda () (open-input-file "data" 99)))</b> |
| 10410 |
(#<procedure #2 open-input-file> ("data" 99)) |
| 10411 |
</pre></td></tr></table> |
| 10412 |
|
| 10413 |
|
| 10414 |
|
| 10415 |
<a name="Definition_of_number-of-arguments-limit-exception?"></a><a name="Procedure_number-of-arguments-limit-exception?"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception?">number-of-arguments-limit-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10416 |
<a name="Definition_of_number-of-arguments-limit-exception-procedure"></a><a name="Procedure_number-of-arguments-limit-exception-procedure"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception-procedure">number-of-arguments-limit-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10417 |
<a name="Definition_of_number-of-arguments-limit-exception-arguments"></a><a name="Procedure_number-of-arguments-limit-exception-arguments"></a><a name="index-number_002dof_002darguments_002dlimit_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_number-of-arguments-limit-exception-arguments">number-of-arguments-limit-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10418 |
|
| 10419 |
<p>Number-of-arguments-limit-exception objects are raised by the |
| 10420 |
<code>apply</code> procedure when the procedure being called is passed more |
| 10421 |
than 8192 arguments. The parameter <var>exc</var> must be a |
| 10422 |
number-of-arguments-limit-exception object. |
| 10423 |
</p> |
| 10424 |
<p>The procedure <code>number-of-arguments-limit-exception?</code> returns |
| 10425 |
<code>#t</code> when <var>obj</var> is a number-of-arguments-limit-exception |
| 10426 |
object and <code>#f</code> otherwise. |
| 10427 |
</p> |
| 10428 |
<p>The procedure <code>number-of-arguments-limit-exception-procedure</code> |
| 10429 |
returns the target procedure of the call to <code>apply</code> that raised |
| 10430 |
<var>exc</var>. |
| 10431 |
</p> |
| 10432 |
<p>The procedure <code>number-of-arguments-limit-exception-arguments</code> |
| 10433 |
returns the list of arguments of the target procedure of the call to |
| 10434 |
<code>apply</code> that raised <var>exc</var>. |
| 10435 |
</p> |
| 10436 |
<p>For example: |
| 10437 |
</p> |
| 10438 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (iota n) (if (= n 0) '() (cons n (iota (- n 1)))))</b> |
| 10439 |
> <b>(define (handler exc) |
| 10440 |
(if (number-of-arguments-limit-exception? exc) |
| 10441 |
(list (number-of-arguments-limit-exception-procedure exc) |
| 10442 |
(length (number-of-arguments-limit-exception-arguments exc))) |
| 10443 |
'not-number-of-arguments-limit-exception))</b> |
| 10444 |
> <b>(with-exception-catcher |
| 10445 |
handler |
| 10446 |
(lambda () (apply + 1 2 3 (iota 8190))))</b> |
| 10447 |
(#<procedure #2 +> 8193) |
| 10448 |
</pre></td></tr></table> |
| 10449 |
|
| 10450 |
|
| 10451 |
|
| 10452 |
<a name="Definition_of_nonprocedure-operator-exception?"></a><a name="Procedure_nonprocedure-operator-exception?"></a><a name="index-nonprocedure_002doperator_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception?">nonprocedure-operator-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10453 |
<a name="Definition_of_nonprocedure-operator-exception-operator"></a><a name="Procedure_nonprocedure-operator-exception-operator"></a><a name="index-nonprocedure_002doperator_002dexception_002doperator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-operator">nonprocedure-operator-exception-operator</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10454 |
<a name="Definition_of_nonprocedure-operator-exception-arguments"></a><a name="Procedure_nonprocedure-operator-exception-arguments"></a><a name="index-nonprocedure_002doperator_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-arguments">nonprocedure-operator-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10455 |
<a name="Definition_of_nonprocedure-operator-exception-code"></a><a name="Procedure_nonprocedure-operator-exception-code"></a><a name="index-nonprocedure_002doperator_002dexception_002dcode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-code">nonprocedure-operator-exception-code</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10456 |
<a name="Definition_of_nonprocedure-operator-exception-rte"></a><a name="Procedure_nonprocedure-operator-exception-rte"></a><a name="index-nonprocedure_002doperator_002dexception_002drte"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_nonprocedure-operator-exception-rte">nonprocedure-operator-exception-rte</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10457 |
|
| 10458 |
<p>Nonprocedure-operator-exception objects are raised when a procedure |
| 10459 |
call is executed and the operator position is not a procedure. The |
| 10460 |
parameter <var>exc</var> must be an nonprocedure-operator-exception object. |
| 10461 |
</p> |
| 10462 |
<p>The procedure <code>nonprocedure-operator-exception?</code> returns |
| 10463 |
<code>#t</code> when <var>obj</var> is an nonprocedure-operator-exception |
| 10464 |
object and <code>#f</code> otherwise. |
| 10465 |
</p> |
| 10466 |
<p>The procedure <code>nonprocedure-operator-exception-operator</code> returns |
| 10467 |
the value in operator position of the procedure call that raised |
| 10468 |
<var>exc</var>. |
| 10469 |
</p> |
| 10470 |
<p>The procedure <code>nonprocedure-operator-exception-arguments</code> returns |
| 10471 |
the list of arguments of the procedure call that raised <var>exc</var>. |
| 10472 |
</p> |
| 10473 |
<p>For example: |
| 10474 |
</p> |
| 10475 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10476 |
(if (nonprocedure-operator-exception? exc) |
| 10477 |
(list (nonprocedure-operator-exception-operator exc) |
| 10478 |
(nonprocedure-operator-exception-arguments exc)) |
| 10479 |
'not-nonprocedure-operator-exception))</b> |
| 10480 |
> <b>(with-exception-catcher |
| 10481 |
handler |
| 10482 |
(lambda () (11 22 33)))</b> |
| 10483 |
(11 (22 33)) |
| 10484 |
</pre></td></tr></table> |
| 10485 |
|
| 10486 |
|
| 10487 |
|
| 10488 |
<a name="Definition_of_unknown-keyword-argument-exception?"></a><a name="Procedure_unknown-keyword-argument-exception?"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception?">unknown-keyword-argument-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10489 |
<a name="Definition_of_unknown-keyword-argument-exception-procedure"></a><a name="Procedure_unknown-keyword-argument-exception-procedure"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception-procedure">unknown-keyword-argument-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10490 |
<a name="Definition_of_unknown-keyword-argument-exception-arguments"></a><a name="Procedure_unknown-keyword-argument-exception-arguments"></a><a name="index-unknown_002dkeyword_002dargument_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unknown-keyword-argument-exception-arguments">unknown-keyword-argument-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10491 |
|
| 10492 |
<p>Unknown-keyword-argument-exception objects are raised when a procedure |
| 10493 |
accepting keyword arguments is called and one of the keywords supplied |
| 10494 |
is not among those that are expected. The parameter <var>exc</var> must be |
| 10495 |
an unknown-keyword-argument-exception object. |
| 10496 |
</p> |
| 10497 |
<p>The procedure <code>unknown-keyword-argument-exception?</code> returns |
| 10498 |
<code>#t</code> when <var>obj</var> is an unknown-keyword-argument-exception |
| 10499 |
object and <code>#f</code> otherwise. |
| 10500 |
</p> |
| 10501 |
<p>The procedure <code>unknown-keyword-argument-exception-procedure</code> |
| 10502 |
returns the procedure that raised <var>exc</var>. |
| 10503 |
</p> |
| 10504 |
<p>The procedure <code>unknown-keyword-argument-exception-arguments</code> |
| 10505 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10506 |
</p> |
| 10507 |
<p>For example: |
| 10508 |
</p> |
| 10509 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10510 |
(if (unknown-keyword-argument-exception? exc) |
| 10511 |
(list (unknown-keyword-argument-exception-procedure exc) |
| 10512 |
(unknown-keyword-argument-exception-arguments exc)) |
| 10513 |
'not-unknown-keyword-argument-exception))</b> |
| 10514 |
> <b>(with-exception-catcher |
| 10515 |
handler |
| 10516 |
(lambda () ((lambda (#!key (foo 5)) foo) bar: 11)))</b> |
| 10517 |
(#<procedure #2> (bar: 11)) |
| 10518 |
</pre></td></tr></table> |
| 10519 |
|
| 10520 |
|
| 10521 |
|
| 10522 |
<a name="Definition_of_keyword-expected-exception?"></a><a name="Procedure_keyword-expected-exception?"></a><a name="index-keyword_002dexpected_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception?">keyword-expected-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10523 |
<a name="Definition_of_keyword-expected-exception-procedure"></a><a name="Procedure_keyword-expected-exception-procedure"></a><a name="index-keyword_002dexpected_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception-procedure">keyword-expected-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10524 |
<a name="Definition_of_keyword-expected-exception-arguments"></a><a name="Procedure_keyword-expected-exception-arguments"></a><a name="index-keyword_002dexpected_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_keyword-expected-exception-arguments">keyword-expected-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10525 |
|
| 10526 |
<p>Keyword-expected-exception objects are raised when a procedure |
| 10527 |
accepting keyword arguments is called and a nonkeyword was supplied |
| 10528 |
where a keyword was expected. The parameter <var>exc</var> must be an |
| 10529 |
keyword-expected-exception object. |
| 10530 |
</p> |
| 10531 |
<p>The procedure <code>keyword-expected-exception?</code> returns |
| 10532 |
<code>#t</code> when <var>obj</var> is an keyword-expected-exception |
| 10533 |
object and <code>#f</code> otherwise. |
| 10534 |
</p> |
| 10535 |
<p>The procedure <code>keyword-expected-exception-procedure</code> |
| 10536 |
returns the procedure that raised <var>exc</var>. |
| 10537 |
</p> |
| 10538 |
<p>The procedure <code>keyword-expected-exception-arguments</code> |
| 10539 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 10540 |
</p> |
| 10541 |
<p>For example: |
| 10542 |
</p> |
| 10543 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10544 |
(if (keyword-expected-exception? exc) |
| 10545 |
(list (keyword-expected-exception-procedure exc) |
| 10546 |
(keyword-expected-exception-arguments exc)) |
| 10547 |
'not-keyword-expected-exception))</b> |
| 10548 |
> <b>(with-exception-catcher |
| 10549 |
handler |
| 10550 |
(lambda () ((lambda (#!key (foo 5)) foo) 11 22)))</b> |
| 10551 |
(#<procedure #2> (11 22)) |
| 10552 |
</pre></td></tr></table> |
| 10553 |
|
| 10554 |
|
| 10555 |
|
| 10556 |
<a name="Other-exception-objects"></a><hr size="6"><br/><br/><br/> |
| 10557 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10558 |
<tr><td valign="middle" align="left"><a href="#Exception-objects-related-to-procedure-call" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10559 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10560 |
<td valign="middle" align="left"> </td> |
| 10561 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10562 |
<td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10563 |
<td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10564 |
<td valign="middle" align="left"> </td> |
| 10565 |
<td valign="middle" align="left"> </td> |
| 10566 |
<td valign="middle" align="left"> </td> |
| 10567 |
<td valign="middle" align="left"> </td> |
| 10568 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10569 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10570 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10571 |
</tr></table> |
| 10572 |
<a name="Other-exception-objects-1"></a> |
| 10573 |
<h2 class="section">15.10 Other exception objects</h2> |
| 10574 |
|
| 10575 |
<a name="Definition_of_error-exception?"></a><a name="Procedure_error-exception?"></a><a name="index-error_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_error-exception?">error-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10576 |
<a name="Definition_of_error-exception-message"></a><a name="Procedure_error-exception-message"></a><a name="index-error_002dexception_002dmessage"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_error-exception-message">error-exception-message</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10577 |
<a name="Definition_of_error-exception-parameters"></a><a name="Procedure_error-exception-parameters"></a><a name="index-error_002dexception_002dparameters"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_error-exception-parameters">error-exception-parameters</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10578 |
<a name="Definition_of_error"></a><a name="Procedure_error"></a><a name="index-error"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_error">error</a></b></code><i> <var>message</var> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10579 |
|
| 10580 |
<p>Error-exception objects are raised when the <code>error</code> procedure is |
| 10581 |
called. The parameter <var>exc</var> must be an error-exception |
| 10582 |
object. |
| 10583 |
</p> |
| 10584 |
<p>The procedure <code>error-exception?</code> returns |
| 10585 |
<code>#t</code> when <var>obj</var> is an error-exception |
| 10586 |
object and <code>#f</code> otherwise. |
| 10587 |
</p> |
| 10588 |
<p>The procedure <code>error-exception-message</code> returns the first |
| 10589 |
argument of the call to <code>error</code> that raised <var>exc</var>. |
| 10590 |
</p> |
| 10591 |
<p>The procedure <code>error-exception-parameters</code> returns the list of |
| 10592 |
arguments, starting with the second argument, of the call to |
| 10593 |
<code>error</code> that raised <var>exc</var>. |
| 10594 |
</p> |
| 10595 |
<p>The <code>error</code> procedure raises an error-exception object whose |
| 10596 |
message field is <var>message</var> and parameters field is the list of |
| 10597 |
values <var>obj</var>…. |
| 10598 |
</p> |
| 10599 |
<p>For example: |
| 10600 |
</p> |
| 10601 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 10602 |
(if (error-exception? exc) |
| 10603 |
(list (error-exception-message exc) |
| 10604 |
(error-exception-parameters exc)) |
| 10605 |
'not-error-exception))</b> |
| 10606 |
> <b>(with-exception-catcher |
| 10607 |
handler |
| 10608 |
(lambda () (error "unexpected object:" 123)))</b> |
| 10609 |
("unexpected object:" (123)) |
| 10610 |
</pre></td></tr></table> |
| 10611 |
|
| 10612 |
|
| 10613 |
|
| 10614 |
<a name="Host-environment"></a><hr size="6"><br/><br/><br/> |
| 10615 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10616 |
<tr><td valign="middle" align="left"><a href="#Other-exception-objects" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10617 |
<td valign="middle" align="left"><a href="#Handling-of-file-names" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10618 |
<td valign="middle" align="left"> </td> |
| 10619 |
<td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10620 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10621 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10622 |
<td valign="middle" align="left"> </td> |
| 10623 |
<td valign="middle" align="left"> </td> |
| 10624 |
<td valign="middle" align="left"> </td> |
| 10625 |
<td valign="middle" align="left"> </td> |
| 10626 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10627 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10628 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10629 |
</tr></table> |
| 10630 |
<a name="Host-environment-1"></a> |
| 10631 |
<h1 class="chapter">16. Host environment</h1> |
| 10632 |
|
| 10633 |
<p>The host environment is the set of resources, such as the filesystem, |
| 10634 |
network and processes, that are managed by the operating system within |
| 10635 |
which the Scheme program is executing. This chapter specifies how the |
| 10636 |
host environment can be accessed from within the Scheme program. |
| 10637 |
</p> |
| 10638 |
<p>In this chapter we say that the Scheme program being executed is a |
| 10639 |
process, even though the concept of process does not exist in some |
| 10640 |
operating systems supported by Gambit (e.g. MSDOS). |
| 10641 |
</p> |
| 10642 |
<table class="menu" border="0" cellspacing="0"> |
| 10643 |
<tr><td align="left" valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10644 |
<tr><td align="left" valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10645 |
<tr><td align="left" valign="top"><a href="#Shell-command-execution">16.3 Shell command execution</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10646 |
<tr><td align="left" valign="top"><a href="#Process-termination">16.4 Process termination</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10647 |
<tr><td align="left" valign="top"><a href="#Command-line-arguments">16.5 Command line arguments</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10648 |
<tr><td align="left" valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10649 |
<tr><td align="left" valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10650 |
<tr><td align="left" valign="top"><a href="#File-information">16.8 File information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10651 |
<tr><td align="left" valign="top"><a href="#Group-information">16.9 Group information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10652 |
<tr><td align="left" valign="top"><a href="#User-information">16.10 User information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10653 |
<tr><td align="left" valign="top"><a href="#Host-information">16.11 Host information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10654 |
<tr><td align="left" valign="top"><a href="#Service-information">16.12 Service information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10655 |
<tr><td align="left" valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10656 |
<tr><td align="left" valign="top"><a href="#Network-information">16.14 Network information</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 10657 |
</table> |
| 10658 |
|
| 10659 |
<a name="Handling-of-file-names"></a><hr size="6"><br/><br/><br/> |
| 10660 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10661 |
<tr><td valign="middle" align="left"><a href="#Host-environment" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10662 |
<td valign="middle" align="left"><a href="#Filesystem-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10663 |
<td valign="middle" align="left"> </td> |
| 10664 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10665 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10666 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10667 |
<td valign="middle" align="left"> </td> |
| 10668 |
<td valign="middle" align="left"> </td> |
| 10669 |
<td valign="middle" align="left"> </td> |
| 10670 |
<td valign="middle" align="left"> </td> |
| 10671 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10672 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10673 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10674 |
</tr></table> |
| 10675 |
<a name="Handling-of-file-names-1"></a> |
| 10676 |
<h2 class="section">16.1 Handling of file names</h2> |
| 10677 |
<a name="index-file-names"></a> |
| 10678 |
<a name="index-current-working-directory"></a> |
| 10679 |
<a name="index-absolute-path"></a> |
| 10680 |
<a name="index-relative-path"></a> |
| 10681 |
<a name="index-home-directory"></a> |
| 10682 |
<a name="index-central-installation-directory"></a> |
| 10683 |
<a name="index-installation-directories"></a> |
| 10684 |
|
| 10685 |
<p>Gambit uses a naming convention for files that is compatible with |
| 10686 |
the one used by the host environment but extended to allow |
| 10687 |
referring to the <em>home directory</em> of the current user or some |
| 10688 |
specific user and the <em>installation directories</em>. |
| 10689 |
</p> |
| 10690 |
<p>A <em>path</em> is a string that denotes a file, for example |
| 10691 |
<code>"src/readme.txt"</code>. Each component of a path is separated by a |
| 10692 |
‘<samp>/</samp>’ under UNIX and Mac OS X and by a ‘<samp>/</samp>’ or ‘<samp>\</samp>’ under |
| 10693 |
MSDOS and Microsoft Windows. A leading separator indicates an |
| 10694 |
absolute path under UNIX, Mac OS X, MSDOS and Microsoft Windows. A |
| 10695 |
path which does not contain a path separator is relative to the |
| 10696 |
<em>current working directory</em> on all operating systems. A volume |
| 10697 |
specifier such as ‘<samp>C:</samp>’ may prefix a file name under MSDOS and |
| 10698 |
Microsoft Windows. |
| 10699 |
</p> |
| 10700 |
<a name="index-_007e_007e"></a> |
| 10701 |
<p>A path which starts with the characters ‘<samp>~~</samp>’ denotes a file in an |
| 10702 |
installation directory. If nothing follows the ‘<samp>~~</samp>’ then the |
| 10703 |
directory denoted is the central installation directory. Otherwise |
| 10704 |
what follows the ‘<samp>~~</samp>’ is the name of the installation directory, |
| 10705 |
for example ‘<samp>~~lib</samp>’ denotes the ‘<samp>lib</samp>’ installation |
| 10706 |
directory. Note that the location of the installation directories may |
| 10707 |
be overridden by using the ‘<samp>-:=<var>DIRECTORY</var></samp>’ and |
| 10708 |
‘<samp>-:~~<var>DIR</var>=<var>DIRECTORY</var></samp>’ runtime options or by defining |
| 10709 |
the ‘<samp>GAMBCOPT</samp>’ environment variable. |
| 10710 |
</p> |
| 10711 |
<a name="index-_007e"></a> |
| 10712 |
<p>A path which starts with the character ‘<samp>~</samp>’ not followed by |
| 10713 |
‘<samp>~</samp>’ denotes a file in the user’s home directory. The user’s home |
| 10714 |
directory is contained in the ‘<samp>HOME</samp>’ environment variable under |
| 10715 |
UNIX, Mac OS X, MSDOS and Microsoft Windows. Under MSDOS and |
| 10716 |
Microsoft Windows, if the ‘<samp>HOME</samp>’ environment variable is not |
| 10717 |
defined, the environment variables ‘<samp>HOMEDRIVE</samp>’ and |
| 10718 |
‘<samp>HOMEPATH</samp>’ are concatenated if they are defined. If this fails |
| 10719 |
to yield a home directory, the central installation directory is used |
| 10720 |
instead. |
| 10721 |
</p> |
| 10722 |
<a name="index-_007eusername"></a> |
| 10723 |
<p>A path which starts with the characters ‘<samp>~<var>username</var></samp>’ |
| 10724 |
denotes a file in the home directory of the given user. Under UNIX |
| 10725 |
and Mac OS X this is found using the password file. There is no |
| 10726 |
equivalent under MSDOS and Microsoft Windows. |
| 10727 |
</p> |
| 10728 |
<a name="Definition_of_current-directory"></a><a name="Procedure_current-directory"></a><a name="index-current_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-directory">current-directory</a></b></code><i> <span class="roman">[</span><var>new-current-directory</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10729 |
|
| 10730 |
<a name="index-current-working-directory-1"></a> |
| 10731 |
<p>The parameter object <code>current-directory</code> is bound to the current |
| 10732 |
working directory. Calling this procedure with no argument returns |
| 10733 |
the absolute <em>normalized path</em> of the directory and calling this |
| 10734 |
procedure with one argument sets the directory to |
| 10735 |
<var>new-current-directory</var>. The initial binding of this parameter |
| 10736 |
object is the current working directory of the current process. The |
| 10737 |
path returned by <code>current-directory</code> always contains a trailing |
| 10738 |
directory separator. Modifications of the parameter object do not |
| 10739 |
change the current working directory of the current process (i.e. |
| 10740 |
that is accessible with the UNIX <code>getcwd()</code> function and the |
| 10741 |
Microsoft Windows <code>GetCurrentDirectory</code> function). It is an |
| 10742 |
error to mutate the string returned by <code>current-directory</code>. |
| 10743 |
</p> |
| 10744 |
<p>For example under UNIX: |
| 10745 |
</p> |
| 10746 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-directory)</b> |
| 10747 |
"/Users/feeley/gambit/doc/" |
| 10748 |
> <b>(current-directory "..")</b> |
| 10749 |
> <b>(current-directory)</b> |
| 10750 |
"/Users/feeley/gambit/" |
| 10751 |
> <b>(path-expand "foo" "~~")</b> |
| 10752 |
"/usr/local/Gambit-C/foo" |
| 10753 |
> <b>(parameterize ((current-directory "~~")) (path-expand "foo"))</b> |
| 10754 |
"/usr/local/Gambit-C/foo" |
| 10755 |
</pre></td></tr></table> |
| 10756 |
|
| 10757 |
|
| 10758 |
|
| 10759 |
<a name="Definition_of_path-expand"></a><a name="Procedure_path-expand"></a><a name="index-path_002dexpand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-expand">path-expand</a></b></code><i> <var>path</var> <span class="roman">[</span><var>origin-directory</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10760 |
|
| 10761 |
<a name="index-absolute-path-1"></a> |
| 10762 |
<a name="index-relative-path-1"></a> |
| 10763 |
<p>The procedure <code>path-expand</code> takes the path of a file or directory |
| 10764 |
and returns an expanded path, which is an absolute path when |
| 10765 |
<var>path</var> or <var>origin-directory</var> are absolute paths. |
| 10766 |
The optional <var>origin-directory</var> parameter, which defaults |
| 10767 |
to the current working directory, is the directory used to resolve |
| 10768 |
relative paths. Components of the paths <var>path</var> and |
| 10769 |
<var>origin-directory</var> need not exist. |
| 10770 |
</p> |
| 10771 |
<p>For example under UNIX: |
| 10772 |
</p> |
| 10773 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-expand "foo")</b> |
| 10774 |
"/Users/feeley/gambit/doc/foo" |
| 10775 |
> <b>(path-expand "~/foo")</b> |
| 10776 |
"/Users/feeley/foo" |
| 10777 |
> <b>(path-expand "~~lib/foo")</b> |
| 10778 |
"/usr/local/Gambit-C/lib/foo" |
| 10779 |
> <b>(path-expand "../foo")</b> |
| 10780 |
"/Users/feeley/gambit/doc/../foo" |
| 10781 |
> <b>(path-expand "foo" "")</b> |
| 10782 |
"foo" |
| 10783 |
> <b>(path-expand "foo" "/tmp")</b> |
| 10784 |
"/tmp/foo" |
| 10785 |
> <b>(path-expand "this/file/does/not/exist")</b> |
| 10786 |
"/Users/feeley/gambit/doc/this/file/does/not/exist" |
| 10787 |
> <b>(path-expand "")</b> |
| 10788 |
"/Users/feeley/gambit/doc/" |
| 10789 |
</pre></td></tr></table> |
| 10790 |
|
| 10791 |
|
| 10792 |
|
| 10793 |
<a name="Definition_of_path-normalize"></a><a name="Procedure_path-normalize"></a><a name="index-path_002dnormalize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-normalize">path-normalize</a></b></code><i> <var>path</var> <span class="roman">[</span><var>allow-relative?</var> <span class="roman">[</span><var>origin-directory</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10794 |
|
| 10795 |
<a name="index-normalized-path"></a> |
| 10796 |
<p>The procedure <code>path-normalize</code> takes a path of a file or |
| 10797 |
directory and returns its normalized path. The optional |
| 10798 |
<var>origin-directory</var> parameter, which defaults to the current |
| 10799 |
working directory, is the directory used to resolve relative paths. |
| 10800 |
All components of the paths <var>path</var> and |
| 10801 |
<var>origin-directory</var> must exist, except possibly the last |
| 10802 |
component of <var>path</var>. A normalized path is a path |
| 10803 |
containing no redundant parts and which is consistent with the current |
| 10804 |
structure of the filesystem. A normalized path of a directory will |
| 10805 |
always end with a path separator (i.e. ‘<samp>/</samp>’, ‘<samp>\</samp>’, or ‘<samp>:</samp>’ |
| 10806 |
depending on the operating system). The optional |
| 10807 |
<var>allow-relative?</var> parameter, which defaults to <code>#f</code>, |
| 10808 |
indicates if the path returned can be expressed relatively to |
| 10809 |
<var>origin-directory</var>: a <code>#f</code> requests an absolute path, |
| 10810 |
the symbol <code>shortest</code> requests the shortest of the absolute and |
| 10811 |
relative paths, and any other value requests the relative path. The |
| 10812 |
shortest path is useful for interaction with the user because short |
| 10813 |
relative paths are typically easier to read than long absolute paths. |
| 10814 |
</p> |
| 10815 |
<p>For example under UNIX: |
| 10816 |
</p> |
| 10817 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-expand "../foo")</b> |
| 10818 |
"/Users/feeley/gambit/doc/../foo" |
| 10819 |
> <b>(path-normalize "../foo")</b> |
| 10820 |
"/Users/feeley/gambit/foo" |
| 10821 |
> <b>(path-normalize "this/file/does/not/exist")</b> |
| 10822 |
*** ERROR IN (console)@3.1 -- No such file or directory |
| 10823 |
(path-normalize "this/file/does/not/exist") |
| 10824 |
</pre></td></tr></table> |
| 10825 |
|
| 10826 |
|
| 10827 |
|
| 10828 |
<a name="Definition_of_path-extension"></a><a name="Procedure_path-extension"></a><a name="index-path_002dextension"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-extension">path-extension</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10829 |
<a name="Definition_of_path-strip-extension"></a><a name="Procedure_path-strip-extension"></a><a name="index-path_002dstrip_002dextension"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-strip-extension">path-strip-extension</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10830 |
<a name="Definition_of_path-directory"></a><a name="Procedure_path-directory"></a><a name="index-path_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-directory">path-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10831 |
<a name="Definition_of_path-strip-directory"></a><a name="Procedure_path-strip-directory"></a><a name="index-path_002dstrip_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-strip-directory">path-strip-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10832 |
<a name="Definition_of_path-strip-trailing-directory-separator"></a><a name="Procedure_path-strip-trailing-directory-separator"></a><a name="index-path_002dstrip_002dtrailing_002ddirectory_002dseparator"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-strip-trailing-directory-separator">path-strip-trailing-directory-separator</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10833 |
<a name="Definition_of_path-volume"></a><a name="Procedure_path-volume"></a><a name="index-path_002dvolume"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-volume">path-volume</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10834 |
<a name="Definition_of_path-strip-volume"></a><a name="Procedure_path-strip-volume"></a><a name="index-path_002dstrip_002dvolume"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_path-strip-volume">path-strip-volume</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10835 |
|
| 10836 |
<p>These procedures extract various parts of a path, which need not be a |
| 10837 |
normalized path. The procedure <code>path-extension</code> returns the file |
| 10838 |
extension (including the period) or the empty string if there is no |
| 10839 |
extension. The procedure <code>path-strip-extension</code> returns the path |
| 10840 |
with the extension stripped off. The procedure <code>path-directory</code> |
| 10841 |
returns the file’s directory (including the last path separator) or |
| 10842 |
the empty string if no directory is specified in the path. The |
| 10843 |
procedure <code>path-strip-directory</code> returns the path with the |
| 10844 |
directory stripped off. The procedure |
| 10845 |
<code>path-strip-trailing-directory-separator</code> returns the path with |
| 10846 |
the directory separator stripped off if one is at the end of the path. |
| 10847 |
The procedure <code>path-volume</code> returns the file’s volume (including |
| 10848 |
the last path separator) or the empty string if no volume is specified |
| 10849 |
in the path. The procedure <code>path-strip-volume</code> returns the path |
| 10850 |
with the volume stripped off. |
| 10851 |
</p> |
| 10852 |
<p>For example under UNIX: |
| 10853 |
</p> |
| 10854 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(path-extension "/tmp/foo")</b> |
| 10855 |
"" |
| 10856 |
> <b>(path-extension "/tmp/foo.txt")</b> |
| 10857 |
".txt" |
| 10858 |
> <b>(path-strip-extension "/tmp/foo.txt")</b> |
| 10859 |
"/tmp/foo" |
| 10860 |
> <b>(path-directory "/tmp/foo.txt")</b> |
| 10861 |
"/tmp/" |
| 10862 |
> <b>(path-strip-directory "/tmp/foo.txt")</b> |
| 10863 |
"foo.txt" |
| 10864 |
> <b>(path-strip-trailing-directory-separator "/usr/local/bin/")</b> |
| 10865 |
"/usr/local/bin" |
| 10866 |
> <b>(path-strip-trailing-directory-separator "/usr/local/bin")</b> |
| 10867 |
"/usr/local/bin" |
| 10868 |
> <b>(path-volume "/tmp/foo.txt")</b> |
| 10869 |
"" |
| 10870 |
> <b>(path-volume "C:/tmp/foo.txt")</b> |
| 10871 |
"" <span class="roman"><i>; result is</i></span> "C:" <span class="roman"><i>under Microsoft Windows</i></span> |
| 10872 |
> <b>(path-strip-volume "C:/tmp/foo.txt")</b> |
| 10873 |
"C:/tmp/foo.txt" <span class="roman"><i>; result is</i></span> "/tmp/foo.txt" <span class="roman"><i>under Microsoft Windows</i></span> |
| 10874 |
</pre></td></tr></table> |
| 10875 |
|
| 10876 |
|
| 10877 |
|
| 10878 |
<a name="Filesystem-operations"></a><hr size="6"><br/><br/><br/> |
| 10879 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 10880 |
<tr><td valign="middle" align="left"><a href="#Handling-of-file-names" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 10881 |
<td valign="middle" align="left"><a href="#Shell-command-execution" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 10882 |
<td valign="middle" align="left"> </td> |
| 10883 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 10884 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 10885 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 10886 |
<td valign="middle" align="left"> </td> |
| 10887 |
<td valign="middle" align="left"> </td> |
| 10888 |
<td valign="middle" align="left"> </td> |
| 10889 |
<td valign="middle" align="left"> </td> |
| 10890 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 10891 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 10892 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 10893 |
</tr></table> |
| 10894 |
<a name="Filesystem-operations-1"></a> |
| 10895 |
<h2 class="section">16.2 Filesystem operations</h2> |
| 10896 |
|
| 10897 |
<a name="Definition_of_create-directory"></a><a name="Procedure_create-directory"></a><a name="index-create_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_create-directory">create-directory</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10898 |
|
| 10899 |
<p>This procedure creates a directory. The argument |
| 10900 |
<var>path-or-settings</var> is either a string denoting a filesystem path |
| 10901 |
or a list of port settings which must contain a <code>path:</code> setting. |
| 10902 |
Here are the settings allowed: |
| 10903 |
</p> |
| 10904 |
<ul> |
| 10905 |
<li> |
| 10906 |
<code>path:</code> <var>string</var> |
| 10907 |
|
| 10908 |
<p>This setting indicates the location of the directory to create in the |
| 10909 |
filesystem. There is no default value for this setting. |
| 10910 |
</p> |
| 10911 |
</li><li> |
| 10912 |
<code>permissions:</code> <var>12-bit-exact-integer</var> |
| 10913 |
|
| 10914 |
<p>This setting controls the UNIX permissions that will be attached to |
| 10915 |
the file if it is created. The default value of this setting is |
| 10916 |
<code>#o777</code>. |
| 10917 |
</p> |
| 10918 |
</li></ul> |
| 10919 |
|
| 10920 |
<p>For example: |
| 10921 |
</p> |
| 10922 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(create-directory "newdir")</b> |
| 10923 |
> <b>(create-directory "newdir")</b> |
| 10924 |
*** ERROR IN (console)@2.1 -- File exists |
| 10925 |
(create-directory "newdir") |
| 10926 |
</pre></td></tr></table> |
| 10927 |
|
| 10928 |
|
| 10929 |
|
| 10930 |
<a name="Definition_of_create-fifo"></a><a name="Procedure_create-fifo"></a><a name="index-create_002dfifo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_create-fifo">create-fifo</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10931 |
|
| 10932 |
<p>This procedure creates a FIFO. The argument <var>path-or-settings</var> is |
| 10933 |
either a string denoting a filesystem path or a list of port settings |
| 10934 |
which must contain a <code>path:</code> setting. Here are the settings |
| 10935 |
allowed: |
| 10936 |
</p> |
| 10937 |
<ul> |
| 10938 |
<li> |
| 10939 |
<code>path:</code> <var>string</var> |
| 10940 |
|
| 10941 |
<p>This setting indicates the location of the FIFO to create in the |
| 10942 |
filesystem. There is no default value for this setting. |
| 10943 |
</p> |
| 10944 |
</li><li> |
| 10945 |
<code>permissions:</code> <var>12-bit-exact-integer</var> |
| 10946 |
|
| 10947 |
<p>This setting controls the UNIX permissions that will be attached to |
| 10948 |
the file if it is created. The default value of this setting is |
| 10949 |
<code>#o666</code>. |
| 10950 |
</p> |
| 10951 |
</li></ul> |
| 10952 |
|
| 10953 |
<p>For example: |
| 10954 |
</p> |
| 10955 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(create-fifo "fifo")</b> |
| 10956 |
> <b>(define a (open-input-file "fifo"))</b> |
| 10957 |
> <b>(define b (open-output-file "fifo"))</b> |
| 10958 |
> <b>(display "1 22 333" b)</b> |
| 10959 |
> <b>(force-output b)</b> |
| 10960 |
> <b>(read a)</b> |
| 10961 |
1 |
| 10962 |
> <b>(read a)</b> |
| 10963 |
22 |
| 10964 |
</pre></td></tr></table> |
| 10965 |
|
| 10966 |
|
| 10967 |
|
| 10968 |
<a name="Definition_of_create-link"></a><a name="Procedure_create-link"></a><a name="index-create_002dlink"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_create-link">create-link</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10969 |
|
| 10970 |
<p>This procedure creates a hard link between <var>source-path</var> and |
| 10971 |
<var>destination-path</var>. The argument <var>source-path</var> must be a |
| 10972 |
string denoting the path of an existing file. The argument |
| 10973 |
<var>destination-path</var> must be a string denoting the path of the link |
| 10974 |
to create. |
| 10975 |
</p> |
| 10976 |
|
| 10977 |
|
| 10978 |
<a name="Definition_of_create-symbolic-link"></a><a name="Procedure_create-symbolic-link"></a><a name="index-create_002dsymbolic_002dlink"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_create-symbolic-link">create-symbolic-link</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10979 |
|
| 10980 |
<p>This procedure creates a symbolic link between <var>source-path</var> and |
| 10981 |
<var>destination-path</var>. The argument <var>source-path</var> must be a |
| 10982 |
string denoting the path of an existing file. The argument |
| 10983 |
<var>destination-path</var> must be a string denoting the path of the |
| 10984 |
symbolic link to create. |
| 10985 |
</p> |
| 10986 |
|
| 10987 |
|
| 10988 |
<a name="Definition_of_rename-file"></a><a name="Procedure_rename-file"></a><a name="index-rename_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_rename-file">rename-file</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10989 |
|
| 10990 |
<p>This procedure renames the file <var>source-path</var> to |
| 10991 |
<var>destination-path</var>. The argument <var>source-path</var> must be a |
| 10992 |
string denoting the path of an existing file. The argument |
| 10993 |
<var>destination-path</var> must be a string denoting the new path of the |
| 10994 |
file. |
| 10995 |
</p> |
| 10996 |
|
| 10997 |
|
| 10998 |
<a name="Definition_of_copy-file"></a><a name="Procedure_copy-file"></a><a name="index-copy_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_copy-file">copy-file</a></b></code><i> <var>source-path</var> <var>destination-path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 10999 |
|
| 11000 |
<p>This procedure copies the file <var>source-path</var> to |
| 11001 |
<var>destination-path</var>. The argument <var>source-path</var> must be a |
| 11002 |
string denoting the path of an existing file. The argument |
| 11003 |
<var>destination-path</var> must be a string denoting the path of the |
| 11004 |
file to create. |
| 11005 |
</p> |
| 11006 |
|
| 11007 |
|
| 11008 |
<a name="Definition_of_delete-file"></a><a name="Procedure_delete-file"></a><a name="index-delete_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_delete-file">delete-file</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11009 |
|
| 11010 |
<p>This procedure deletes the file <var>path</var>. The argument <var>path</var> |
| 11011 |
must be a string denoting the path of an existing file. |
| 11012 |
</p> |
| 11013 |
|
| 11014 |
|
| 11015 |
<a name="Definition_of_delete-directory"></a><a name="Procedure_delete-directory"></a><a name="index-delete_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_delete-directory">delete-directory</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11016 |
|
| 11017 |
<p>This procedure deletes the directory <var>path</var>. The argument |
| 11018 |
<var>path</var> must be a string denoting the path of an existing |
| 11019 |
directory. |
| 11020 |
</p> |
| 11021 |
|
| 11022 |
|
| 11023 |
<a name="Definition_of_directory-files"></a><a name="Procedure_directory-files"></a><a name="index-directory_002dfiles"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_directory-files">directory-files</a></b></code><i> <span class="roman">[</span><var>path-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11024 |
|
| 11025 |
<p>This procedure returns the list of the files in a directory. The |
| 11026 |
argument <var>path-or-settings</var> is either a string denoting a |
| 11027 |
filesystem path to a directory or a list of settings which must |
| 11028 |
contain a <code>path:</code> setting. If it is not specified, |
| 11029 |
<var>path-or-settings</var> defaults to the current directory (the value |
| 11030 |
bound to the <code>current-directory</code> parameter object). Here are the |
| 11031 |
settings allowed: |
| 11032 |
</p> |
| 11033 |
<ul> |
| 11034 |
<li> |
| 11035 |
<code>path:</code> <var>string</var> |
| 11036 |
|
| 11037 |
<p>This setting indicates the location of the directory in the filesystem. |
| 11038 |
There is no default value for this setting. |
| 11039 |
</p> |
| 11040 |
</li><li> |
| 11041 |
<code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> ) |
| 11042 |
|
| 11043 |
<p>This setting controls whether hidden-files will be returned. Under |
| 11044 |
UNIX and Mac OS X hidden-files are those that start with a period |
| 11045 |
(such as ‘<samp>.</samp>’, ‘<samp>..</samp>’, and ‘<samp>.profile</samp>’). Under Microsoft |
| 11046 |
Windows hidden files are the ‘<samp>.</samp>’ and ‘<samp>..</samp>’ entries and the |
| 11047 |
files whose “hidden file” attribute is set. A setting of <code>#f</code> |
| 11048 |
will enumerate all the files. A setting of <code>#t</code> will only |
| 11049 |
enumerate the files that are not hidden. A setting of |
| 11050 |
<code>dot-and-dot-dot</code> will enumerate all the files except for the |
| 11051 |
‘<samp>.</samp>’ and ‘<samp>..</samp>’ hidden files. The default value of this |
| 11052 |
setting is <code>#t</code>. |
| 11053 |
</p> |
| 11054 |
</li></ul> |
| 11055 |
|
| 11056 |
<p>For example: |
| 11057 |
</p> |
| 11058 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(directory-files)</b> |
| 11059 |
("complex" "README" "simple") |
| 11060 |
> <b>(directory-files "../include")</b> |
| 11061 |
("config.h" "config.h.in" "gambit.h" "makefile" "makefile.in") |
| 11062 |
> <b>(directory-files (list path: "../include" ignore-hidden: #f))</b> |
| 11063 |
("." ".." "config.h" "config.h.in" "gambit.h" "makefile" "makefile.in") |
| 11064 |
</pre></td></tr></table> |
| 11065 |
|
| 11066 |
|
| 11067 |
|
| 11068 |
<a name="Shell-command-execution"></a><hr size="6"><br/><br/><br/> |
| 11069 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11070 |
<tr><td valign="middle" align="left"><a href="#Filesystem-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11071 |
<td valign="middle" align="left"><a href="#Process-termination" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11072 |
<td valign="middle" align="left"> </td> |
| 11073 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11074 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11075 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11076 |
<td valign="middle" align="left"> </td> |
| 11077 |
<td valign="middle" align="left"> </td> |
| 11078 |
<td valign="middle" align="left"> </td> |
| 11079 |
<td valign="middle" align="left"> </td> |
| 11080 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11081 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11082 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11083 |
</tr></table> |
| 11084 |
<a name="Shell-command-execution-1"></a> |
| 11085 |
<h2 class="section">16.3 Shell command execution</h2> |
| 11086 |
|
| 11087 |
<a name="Definition_of_shell-command"></a><a name="Procedure_shell-command"></a><a name="index-shell_002dcommand"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_shell-command">shell-command</a></b></code><i> <var>command</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11088 |
|
| 11089 |
<p>The procedure <code>shell-command</code> calls up the shell to execute |
| 11090 |
<var>command</var> which must be a string. This procedure returns |
| 11091 |
the exit status of the shell in the form that the C library’s |
| 11092 |
<code>system</code> routine returns. |
| 11093 |
</p> |
| 11094 |
<p>For example under UNIX: |
| 11095 |
</p> |
| 11096 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(shell-command "ls -sk f*.scm")</b> |
| 11097 |
4 fact.scm 4 fib.scm |
| 11098 |
0 |
| 11099 |
</pre></td></tr></table> |
| 11100 |
|
| 11101 |
|
| 11102 |
|
| 11103 |
<a name="Process-termination"></a><hr size="6"><br/><br/><br/> |
| 11104 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11105 |
<tr><td valign="middle" align="left"><a href="#Shell-command-execution" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11106 |
<td valign="middle" align="left"><a href="#Command-line-arguments" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11107 |
<td valign="middle" align="left"> </td> |
| 11108 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11109 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11110 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11111 |
<td valign="middle" align="left"> </td> |
| 11112 |
<td valign="middle" align="left"> </td> |
| 11113 |
<td valign="middle" align="left"> </td> |
| 11114 |
<td valign="middle" align="left"> </td> |
| 11115 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11116 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11117 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11118 |
</tr></table> |
| 11119 |
<a name="Process-termination-1"></a> |
| 11120 |
<h2 class="section">16.4 Process termination</h2> |
| 11121 |
|
| 11122 |
<a name="Definition_of_exit"></a><a name="Procedure_exit"></a><a name="index-exit"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_exit">exit</a></b></code><i> <span class="roman">[</span><var>status</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11123 |
|
| 11124 |
<p>The procedure <code>exit</code> causes the process to terminate with the |
| 11125 |
status <var>status</var> which must be an exact integer in the range 0 to |
| 11126 |
255. If it is not specified, <var>status</var> defaults to 0. |
| 11127 |
</p> |
| 11128 |
<p>For example under UNIX: |
| 11129 |
</p> |
| 11130 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi</b> |
| 11131 |
Gambit v4.7.3 |
| 11132 |
|
| 11133 |
> <b>(exit 42)</b> |
| 11134 |
$ <b>echo $?</b> |
| 11135 |
42 |
| 11136 |
</pre></td></tr></table> |
| 11137 |
|
| 11138 |
|
| 11139 |
|
| 11140 |
<a name="Command-line-arguments"></a><hr size="6"><br/><br/><br/> |
| 11141 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11142 |
<tr><td valign="middle" align="left"><a href="#Process-termination" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11143 |
<td valign="middle" align="left"><a href="#Environment-variables" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11144 |
<td valign="middle" align="left"> </td> |
| 11145 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11146 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11147 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11148 |
<td valign="middle" align="left"> </td> |
| 11149 |
<td valign="middle" align="left"> </td> |
| 11150 |
<td valign="middle" align="left"> </td> |
| 11151 |
<td valign="middle" align="left"> </td> |
| 11152 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11153 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11154 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11155 |
</tr></table> |
| 11156 |
<a name="Command-line-arguments-1"></a> |
| 11157 |
<h2 class="section">16.5 Command line arguments</h2> |
| 11158 |
|
| 11159 |
<a name="Definition_of_command-line"></a><a name="Procedure_command-line"></a><a name="index-command_002dline-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_command-line">command-line</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11160 |
|
| 11161 |
<p>This procedure returns a list of strings corresponding to the command |
| 11162 |
line arguments, including the program file name as the first element |
| 11163 |
of the list. When the interpreter executes a Scheme script, the list |
| 11164 |
returned by <code>command-line</code> contains the script’s absolute path |
| 11165 |
followed by the remaining command line arguments. |
| 11166 |
</p> |
| 11167 |
<p>For example under UNIX: |
| 11168 |
</p> |
| 11169 |
<table><tr><td> </td><td><pre class="smallexample">$ <b>gsi -:d -e "(pretty-print (command-line))"</b> |
| 11170 |
("gsi" "-e" "(pretty-print (command-line))") |
| 11171 |
$ <b>cat foo</b> |
| 11172 |
#!/usr/local/Gambit-C/bin/gsi-script |
| 11173 |
(pretty-print (command-line)) |
| 11174 |
$ <b>./foo 1 2 "3 4"</b> |
| 11175 |
("/u/feeley/./foo" "1" "2" "3 4") |
| 11176 |
</pre></td></tr></table> |
| 11177 |
|
| 11178 |
|
| 11179 |
|
| 11180 |
<a name="Environment-variables"></a><hr size="6"><br/><br/><br/> |
| 11181 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11182 |
<tr><td valign="middle" align="left"><a href="#Command-line-arguments" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11183 |
<td valign="middle" align="left"><a href="#Measuring-time" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11184 |
<td valign="middle" align="left"> </td> |
| 11185 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11186 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11187 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11188 |
<td valign="middle" align="left"> </td> |
| 11189 |
<td valign="middle" align="left"> </td> |
| 11190 |
<td valign="middle" align="left"> </td> |
| 11191 |
<td valign="middle" align="left"> </td> |
| 11192 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11193 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11194 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11195 |
</tr></table> |
| 11196 |
<a name="Environment-variables-1"></a> |
| 11197 |
<h2 class="section">16.6 Environment variables</h2> |
| 11198 |
|
| 11199 |
<a name="Definition_of_getenv"></a><a name="Procedure_getenv"></a><a name="index-getenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_getenv">getenv</a></b></code><i> <var>name</var> <span class="roman">[</span><var>default</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11200 |
<a name="Definition_of_setenv"></a><a name="Procedure_setenv"></a><a name="index-setenv"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_setenv">setenv</a></b></code><i> <var>name</var> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11201 |
|
| 11202 |
<p>The procedure <code>getenv</code> returns the value of the environment |
| 11203 |
variable <var>name</var> of the current process. Variable names are |
| 11204 |
denoted with strings. A string is returned if the environment |
| 11205 |
variable is bound, otherwise <var>default</var> is returned if it is |
| 11206 |
specified, otherwise an exception is raised. |
| 11207 |
</p> |
| 11208 |
<p>The procedure <code>setenv</code> changes the binding of the environment |
| 11209 |
variable <var>name</var> to <var>new-value</var> which must be a string. |
| 11210 |
If <var>new-value</var> is not specified the binding is removed. |
| 11211 |
</p> |
| 11212 |
<p>For example under UNIX: |
| 11213 |
</p> |
| 11214 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(getenv "HOME")</b> |
| 11215 |
"/Users/feeley" |
| 11216 |
> <b>(getenv "DOES_NOT_EXIST" #f)</b> |
| 11217 |
#f |
| 11218 |
> <b>(setenv "DOES_NOT_EXIST" "it does now")</b> |
| 11219 |
> <b>(getenv "DOES_NOT_EXIST" #f)</b> |
| 11220 |
"it does now" |
| 11221 |
> <b>(setenv "DOES_NOT_EXIST")</b> |
| 11222 |
> <b>(getenv "DOES_NOT_EXIST" #f)</b> |
| 11223 |
#f |
| 11224 |
> <b>(getenv "DOES_NOT_EXIST")</b> |
| 11225 |
*** ERROR IN (console)@7.1 -- Unbound OS environment variable |
| 11226 |
(getenv "DOES_NOT_EXIST") |
| 11227 |
</pre></td></tr></table> |
| 11228 |
|
| 11229 |
|
| 11230 |
|
| 11231 |
<a name="Measuring-time"></a><hr size="6"><br/><br/><br/> |
| 11232 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11233 |
<tr><td valign="middle" align="left"><a href="#Environment-variables" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11234 |
<td valign="middle" align="left"><a href="#File-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11235 |
<td valign="middle" align="left"> </td> |
| 11236 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11237 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11238 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11239 |
<td valign="middle" align="left"> </td> |
| 11240 |
<td valign="middle" align="left"> </td> |
| 11241 |
<td valign="middle" align="left"> </td> |
| 11242 |
<td valign="middle" align="left"> </td> |
| 11243 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11244 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11245 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11246 |
</tr></table> |
| 11247 |
<a name="Measuring-time-1"></a> |
| 11248 |
<h2 class="section">16.7 Measuring time</h2> |
| 11249 |
|
| 11250 |
<p>Procedures are available for measuring real time (aka “wall” time) |
| 11251 |
and cpu time (the amount of time the cpu has been executing the |
| 11252 |
process). The resolution of the real time and cpu time clock is |
| 11253 |
operating system dependent. Typically the resolution of the cpu time |
| 11254 |
clock is rather coarse (measured in “ticks” of 1/60th or 1/100th of |
| 11255 |
a second). Real time is internally computed relative to some |
| 11256 |
arbitrary point in time using floating point numbers, which means that |
| 11257 |
there is a gradual loss of resolution as time elapses. Moreover, some |
| 11258 |
operating systems report time in number of ticks using a 32 bit |
| 11259 |
integer so the value returned by the time related procedures may |
| 11260 |
wraparound much before any significant loss of resolution occurs (for |
| 11261 |
example 2.7 years if ticks are 1/50th of a second). |
| 11262 |
</p> |
| 11263 |
<a name="Definition_of_current-time"></a><a name="Procedure_current-time"></a><a name="index-current_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-time">current-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11264 |
<a name="Definition_of_time?"></a><a name="Procedure_time?"></a><a name="index-time_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_time?">time?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11265 |
<a name="Definition_of_time-%3Eseconds"></a><a name="Procedure_time-%3Eseconds"></a><a name="index-time_002d_003eseconds"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_time-%3Eseconds">time->seconds</a></b></code><i> <var>time</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11266 |
<a name="Definition_of_seconds-%3Etime"></a><a name="Procedure_seconds-%3Etime"></a><a name="index-seconds_002d_003etime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_seconds-%3Etime">seconds->time</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11267 |
|
| 11268 |
<p>The procedure <code>current-time</code> returns a <em>time object</em> |
| 11269 |
representing the current point in real time. |
| 11270 |
</p> |
| 11271 |
<p>The procedure <code>time?</code> returns <code>#t</code> when <var>obj</var> is a time |
| 11272 |
object and <code>#f</code> otherwise. |
| 11273 |
</p> |
| 11274 |
<p>The procedure <code>time->seconds</code> converts the time object <var>time</var> |
| 11275 |
into an inexact real number representing the number of seconds elapsed |
| 11276 |
since the “epoch” (which is 00:00:00 Coordinated Universal Time |
| 11277 |
01-01-1970). |
| 11278 |
</p> |
| 11279 |
<p>The procedure <code>seconds->time</code> converts the real number <var>x</var> |
| 11280 |
representing the number of seconds elapsed since the “epoch” into a |
| 11281 |
time object. |
| 11282 |
</p> |
| 11283 |
<p>For example: |
| 11284 |
</p> |
| 11285 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(current-time)</b> |
| 11286 |
#<time #2> |
| 11287 |
> <b>(time? (current-time))</b> |
| 11288 |
#t |
| 11289 |
> <b>(time? 123)</b> |
| 11290 |
#f |
| 11291 |
> <b>(time->seconds (current-time))</b> |
| 11292 |
1083118758.63973 |
| 11293 |
> <b>(time->seconds (current-time))</b> |
| 11294 |
1083118759.909163 |
| 11295 |
> <b>(seconds->time (+ 10 (time->seconds (current-time))</b> |
| 11296 |
#<time #3> <span class="roman"><i>; a time object representing 10 seconds in the future</i></span> |
| 11297 |
</pre></td></tr></table> |
| 11298 |
|
| 11299 |
|
| 11300 |
|
| 11301 |
<a name="Definition_of_process-times"></a><a name="Procedure_process-times"></a><a name="index-process_002dtimes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_process-times">process-times</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11302 |
<a name="Definition_of_cpu-time"></a><a name="Procedure_cpu-time"></a><a name="index-cpu_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_cpu-time">cpu-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11303 |
<a name="Definition_of_real-time"></a><a name="Procedure_real-time"></a><a name="index-real_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_real-time">real-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11304 |
|
| 11305 |
<p>The procedure <code>process-times</code> returns a three element f64vector |
| 11306 |
containing the cpu time that has been used by the program and the real |
| 11307 |
time that has elapsed since it was started. The first element |
| 11308 |
corresponds to “user” time in seconds, the second element |
| 11309 |
corresponds to “system” time in seconds and the third element is the |
| 11310 |
elapsed real time in seconds. On operating systems that can’t |
| 11311 |
differentiate user and system time, the system time is zero. On |
| 11312 |
operating systems that can’t measure cpu time, the user time is equal |
| 11313 |
to the elapsed real time and the system time is zero. |
| 11314 |
</p> |
| 11315 |
<p>The procedure <code>cpu-time</code> returns the cpu time in seconds that has |
| 11316 |
been used by the program (user time plus system time). |
| 11317 |
</p> |
| 11318 |
<p>The procedure <code>real-time</code> returns the real time that has elapsed |
| 11319 |
since the program was started. |
| 11320 |
</p> |
| 11321 |
<p>For example: |
| 11322 |
</p> |
| 11323 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(process-times)</b> |
| 11324 |
#f64(.02794 .021754 .159926176071167) |
| 11325 |
> <b>(cpu-time)</b> |
| 11326 |
.051223 |
| 11327 |
> <b>(real-time)</b> |
| 11328 |
.40660619735717773 |
| 11329 |
</pre></td></tr></table> |
| 11330 |
|
| 11331 |
|
| 11332 |
|
| 11333 |
<a name="Definition_of_time"></a><a name="Special_form_time"></a><a name="index-time"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_time">time</a></b></code><i> <span class="roman"><i>expr</i></span> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 11334 |
|
| 11335 |
<p>The <code>time</code> special form evaluates <i>expr</i> and returns the |
| 11336 |
result. As a side effect it displays a message on the port <var>port</var> |
| 11337 |
which indicates various statistics about the evaluation of <i>expr</i> |
| 11338 |
including how long the evaluation took (in real time and cpu time), |
| 11339 |
how much time was spent in the garbage collector, how much memory was |
| 11340 |
allocated during the evaluation and how many minor and major page |
| 11341 |
faults occured (0 is reported if not running under UNIX). If it is |
| 11342 |
not specified, <var>port</var> defaults to the interaction channel |
| 11343 |
(i.e. the output will appear at the REPL). |
| 11344 |
</p> |
| 11345 |
<p>For example: |
| 11346 |
</p> |
| 11347 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (f x) |
| 11348 |
(let loop ((x x) (lst '())) |
| 11349 |
(if (= x 0) |
| 11350 |
lst |
| 11351 |
(loop (- x 1) (cons x lst)))))</b> |
| 11352 |
> <b>(length (time (f 100000)))</b> |
| 11353 |
(time (f 100000)) |
| 11354 |
683 ms real time |
| 11355 |
558 ms cpu time (535 user, 23 system) |
| 11356 |
8 collections accounting for 102 ms real time (70 user, 5 system) |
| 11357 |
6400160 bytes allocated |
| 11358 |
no minor faults |
| 11359 |
no major faults |
| 11360 |
100000 |
| 11361 |
</pre></td></tr></table> |
| 11362 |
|
| 11363 |
|
| 11364 |
|
| 11365 |
<a name="File-information"></a><hr size="6"><br/><br/><br/> |
| 11366 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11367 |
<tr><td valign="middle" align="left"><a href="#Measuring-time" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11368 |
<td valign="middle" align="left"><a href="#Group-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11369 |
<td valign="middle" align="left"> </td> |
| 11370 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11371 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11372 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11373 |
<td valign="middle" align="left"> </td> |
| 11374 |
<td valign="middle" align="left"> </td> |
| 11375 |
<td valign="middle" align="left"> </td> |
| 11376 |
<td valign="middle" align="left"> </td> |
| 11377 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11378 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11379 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11380 |
</tr></table> |
| 11381 |
<a name="File-information-1"></a> |
| 11382 |
<h2 class="section">16.8 File information</h2> |
| 11383 |
|
| 11384 |
<a name="Definition_of_file-exists?"></a><a name="Procedure_file-exists?"></a><a name="index-file_002dexists_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-exists?">file-exists?</a></b></code><i> <var>path</var> <span class="roman">[</span><var>chase?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11385 |
|
| 11386 |
<p>The <var>path</var> argument must be a string. This procedure returns |
| 11387 |
<code>#t</code> when a file by that name exists, and returns <code>#f</code> |
| 11388 |
otherwise. |
| 11389 |
</p> |
| 11390 |
<p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be |
| 11391 |
chased, in other words if <var>path</var> refers to a symbolic link, |
| 11392 |
<code>file-exists?</code> will return <code>#t</code> whether or not it points to |
| 11393 |
an existing file. |
| 11394 |
</p> |
| 11395 |
<p>For example: |
| 11396 |
</p> |
| 11397 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-exists? "nofile")</b> |
| 11398 |
#f |
| 11399 |
</pre></td></tr></table> |
| 11400 |
|
| 11401 |
|
| 11402 |
|
| 11403 |
<a name="Definition_of_file-info"></a><a name="Procedure_file-info"></a><a name="index-file_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info">file-info</a></b></code><i> <var>path</var> <span class="roman">[</span><var>chase?</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11404 |
|
| 11405 |
<p>This procedure accesses the filesystem to get information about the |
| 11406 |
file whose location is given by the string <var>path</var>. A |
| 11407 |
file-information record is returned that contains the file’s type, the |
| 11408 |
device number, the inode number, the mode (permission bits), the |
| 11409 |
number of links, the file’s user id, the file’s group id, the file’s |
| 11410 |
size in bytes, the times of last-access, last-modification and |
| 11411 |
last-change, the attributes, and the creation time. |
| 11412 |
</p> |
| 11413 |
<p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be |
| 11414 |
chased, in other words if <var>path</var> refers to a symbolic link the |
| 11415 |
<code>file-info</code> procedure will return information about the link |
| 11416 |
rather than the file it links to. |
| 11417 |
</p> |
| 11418 |
<p>For example: |
| 11419 |
</p> |
| 11420 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info "/dev/tty")</b> |
| 11421 |
#<file-info #2 |
| 11422 |
type: character-special |
| 11423 |
device: 19513156 |
| 11424 |
inode: 20728196 |
| 11425 |
mode: 438 |
| 11426 |
number-of-links: 1 |
| 11427 |
owner: 0 |
| 11428 |
group: 0 |
| 11429 |
size: 0 |
| 11430 |
last-access-time: #<time #3> |
| 11431 |
last-modification-time: #<time #4> |
| 11432 |
last-change-time: #<time #5> |
| 11433 |
attributes: 128 |
| 11434 |
creation-time: #<time #6>> |
| 11435 |
</pre></td></tr></table> |
| 11436 |
|
| 11437 |
|
| 11438 |
|
| 11439 |
<a name="Definition_of_file-info?"></a><a name="Procedure_file-info?"></a><a name="index-file_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info?">file-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11440 |
|
| 11441 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a file-information |
| 11442 |
record and <code>#f</code> otherwise. |
| 11443 |
</p> |
| 11444 |
<p>For example: |
| 11445 |
</p> |
| 11446 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info? (file-info "/dev/tty"))</b> |
| 11447 |
#t |
| 11448 |
> <b>(file-info? 123)</b> |
| 11449 |
#f |
| 11450 |
</pre></td></tr></table> |
| 11451 |
|
| 11452 |
|
| 11453 |
|
| 11454 |
<a name="Definition_of_file-info-type"></a><a name="Procedure_file-info-type"></a><a name="index-file_002dinfo_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-type">file-info-type</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11455 |
|
| 11456 |
<p>Returns the type field of the file-information record |
| 11457 |
<var>file-info</var>. The type is denoted by a symbol. |
| 11458 |
The following types are possible: |
| 11459 |
</p> |
| 11460 |
<dl compact="compact"> |
| 11461 |
<dt> <code>regular</code></dt> |
| 11462 |
<dd><p>Regular file |
| 11463 |
</p></dd> |
| 11464 |
<dt> <code>directory</code></dt> |
| 11465 |
<dd><p>Directory |
| 11466 |
</p></dd> |
| 11467 |
<dt> <code>character-special</code></dt> |
| 11468 |
<dd><p>Character special device |
| 11469 |
</p></dd> |
| 11470 |
<dt> <code>block-special</code></dt> |
| 11471 |
<dd><p>Block special device |
| 11472 |
</p></dd> |
| 11473 |
<dt> <code>fifo</code></dt> |
| 11474 |
<dd><p>FIFO |
| 11475 |
</p></dd> |
| 11476 |
<dt> <code>symbolic-link</code></dt> |
| 11477 |
<dd><p>Symbolic link |
| 11478 |
</p></dd> |
| 11479 |
<dt> <code>socket</code></dt> |
| 11480 |
<dd><p>Socket |
| 11481 |
</p></dd> |
| 11482 |
<dt> <code>unknown</code></dt> |
| 11483 |
<dd><p>File is of an unknown type |
| 11484 |
</p></dd> |
| 11485 |
</dl> |
| 11486 |
|
| 11487 |
<p>For example: |
| 11488 |
</p> |
| 11489 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-type (file-info "/dev/tty"))</b> |
| 11490 |
character-special |
| 11491 |
> <b>(file-info-type (file-info "/dev"))</b> |
| 11492 |
directory |
| 11493 |
</pre></td></tr></table> |
| 11494 |
|
| 11495 |
|
| 11496 |
|
| 11497 |
<a name="Definition_of_file-info-device"></a><a name="Procedure_file-info-device"></a><a name="index-file_002dinfo_002ddevice"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-device">file-info-device</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11498 |
|
| 11499 |
<p>Returns the device field of the file-information record |
| 11500 |
<var>file-info</var>. |
| 11501 |
</p> |
| 11502 |
<p>For example: |
| 11503 |
</p> |
| 11504 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-device (file-info "/dev/tty"))</b> |
| 11505 |
19513156 |
| 11506 |
</pre></td></tr></table> |
| 11507 |
|
| 11508 |
|
| 11509 |
|
| 11510 |
<a name="Definition_of_file-info-inode"></a><a name="Procedure_file-info-inode"></a><a name="index-file_002dinfo_002dinode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-inode">file-info-inode</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11511 |
|
| 11512 |
<p>Returns the inode field of the file-information record |
| 11513 |
<var>file-info</var>. |
| 11514 |
</p> |
| 11515 |
<p>For example: |
| 11516 |
</p> |
| 11517 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-inode (file-info "/dev/tty"))</b> |
| 11518 |
20728196 |
| 11519 |
</pre></td></tr></table> |
| 11520 |
|
| 11521 |
|
| 11522 |
|
| 11523 |
<a name="Definition_of_file-info-mode"></a><a name="Procedure_file-info-mode"></a><a name="index-file_002dinfo_002dmode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-mode">file-info-mode</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11524 |
|
| 11525 |
<p>Returns the mode field of the file-information record |
| 11526 |
<var>file-info</var>. |
| 11527 |
</p> |
| 11528 |
<p>For example: |
| 11529 |
</p> |
| 11530 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-mode (file-info "/dev/tty"))</b> |
| 11531 |
438 |
| 11532 |
</pre></td></tr></table> |
| 11533 |
|
| 11534 |
|
| 11535 |
|
| 11536 |
<a name="Definition_of_file-info-number-of-links"></a><a name="Procedure_file-info-number-of-links"></a><a name="index-file_002dinfo_002dnumber_002dof_002dlinks"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-number-of-links">file-info-number-of-links</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11537 |
|
| 11538 |
<p>Returns the number-of-links field of the file-information record |
| 11539 |
<var>file-info</var>. |
| 11540 |
</p> |
| 11541 |
<p>For example: |
| 11542 |
</p> |
| 11543 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-number-of-links (file-info "/dev/tty"))</b> |
| 11544 |
1 |
| 11545 |
</pre></td></tr></table> |
| 11546 |
|
| 11547 |
|
| 11548 |
|
| 11549 |
<a name="Definition_of_file-info-owner"></a><a name="Procedure_file-info-owner"></a><a name="index-file_002dinfo_002downer"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-owner">file-info-owner</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11550 |
|
| 11551 |
<p>Returns the owner field of the file-information record |
| 11552 |
<var>file-info</var>. |
| 11553 |
</p> |
| 11554 |
<p>For example: |
| 11555 |
</p> |
| 11556 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-owner (file-info "/dev/tty"))</b> |
| 11557 |
0 |
| 11558 |
</pre></td></tr></table> |
| 11559 |
|
| 11560 |
|
| 11561 |
|
| 11562 |
<a name="Definition_of_file-info-group"></a><a name="Procedure_file-info-group"></a><a name="index-file_002dinfo_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-group">file-info-group</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11563 |
|
| 11564 |
<p>Returns the group field of the file-information record |
| 11565 |
<var>file-info</var>. |
| 11566 |
</p> |
| 11567 |
<p>For example: |
| 11568 |
</p> |
| 11569 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-group (file-info "/dev/tty"))</b> |
| 11570 |
0 |
| 11571 |
</pre></td></tr></table> |
| 11572 |
|
| 11573 |
|
| 11574 |
|
| 11575 |
<a name="Definition_of_file-info-size"></a><a name="Procedure_file-info-size"></a><a name="index-file_002dinfo_002dsize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-size">file-info-size</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11576 |
|
| 11577 |
<p>Returns the size field of the file-information record |
| 11578 |
<var>file-info</var>. |
| 11579 |
</p> |
| 11580 |
<p>For example: |
| 11581 |
</p> |
| 11582 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-size (file-info "/dev/tty"))</b> |
| 11583 |
0 |
| 11584 |
</pre></td></tr></table> |
| 11585 |
|
| 11586 |
|
| 11587 |
|
| 11588 |
<a name="Definition_of_file-info-last-access-time"></a><a name="Procedure_file-info-last-access-time"></a><a name="index-file_002dinfo_002dlast_002daccess_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-last-access-time">file-info-last-access-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11589 |
|
| 11590 |
<p>Returns the last-access-time field of the file-information record |
| 11591 |
<var>file-info</var>. |
| 11592 |
</p> |
| 11593 |
<p>For example: |
| 11594 |
</p> |
| 11595 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-access-time (file-info "/dev/tty"))</b> |
| 11596 |
#<time #2> |
| 11597 |
</pre></td></tr></table> |
| 11598 |
|
| 11599 |
|
| 11600 |
|
| 11601 |
<a name="Definition_of_file-info-last-modification-time"></a><a name="Procedure_file-info-last-modification-time"></a><a name="index-file_002dinfo_002dlast_002dmodification_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-last-modification-time">file-info-last-modification-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11602 |
|
| 11603 |
<p>Returns the last-modification-time field of the file-information record |
| 11604 |
<var>file-info</var>. |
| 11605 |
</p> |
| 11606 |
<p>For example: |
| 11607 |
</p> |
| 11608 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-modification-time (file-info "/dev/tty"))</b> |
| 11609 |
#<time #2> |
| 11610 |
</pre></td></tr></table> |
| 11611 |
|
| 11612 |
|
| 11613 |
|
| 11614 |
<a name="Definition_of_file-info-last-change-time"></a><a name="Procedure_file-info-last-change-time"></a><a name="index-file_002dinfo_002dlast_002dchange_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-last-change-time">file-info-last-change-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11615 |
|
| 11616 |
<p>Returns the last-change-time field of the file-information record |
| 11617 |
<var>file-info</var>. |
| 11618 |
</p> |
| 11619 |
<p>For example: |
| 11620 |
</p> |
| 11621 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-last-change-time (file-info "/dev/tty"))</b> |
| 11622 |
#<time #2> |
| 11623 |
</pre></td></tr></table> |
| 11624 |
|
| 11625 |
|
| 11626 |
|
| 11627 |
<a name="Definition_of_file-info-attributes"></a><a name="Procedure_file-info-attributes"></a><a name="index-file_002dinfo_002dattributes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-attributes">file-info-attributes</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11628 |
|
| 11629 |
<p>Returns the attributes field of the file-information record |
| 11630 |
<var>file-info</var>. |
| 11631 |
</p> |
| 11632 |
<p>For example: |
| 11633 |
</p> |
| 11634 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-attributes (file-info "/dev/tty"))</b> |
| 11635 |
128 |
| 11636 |
</pre></td></tr></table> |
| 11637 |
|
| 11638 |
|
| 11639 |
|
| 11640 |
<a name="Definition_of_file-info-creation-time"></a><a name="Procedure_file-info-creation-time"></a><a name="index-file_002dinfo_002dcreation_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-info-creation-time">file-info-creation-time</a></b></code><i> <var>file-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11641 |
|
| 11642 |
<p>Returns the creation-time field of the file-information record |
| 11643 |
<var>file-info</var>. |
| 11644 |
</p> |
| 11645 |
<p>For example: |
| 11646 |
</p> |
| 11647 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(file-info-creation-time (file-info "/dev/tty"))</b> |
| 11648 |
#<time #2> |
| 11649 |
</pre></td></tr></table> |
| 11650 |
|
| 11651 |
|
| 11652 |
|
| 11653 |
<a name="Definition_of_file-type"></a><a name="Procedure_file-type"></a><a name="index-file_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-type">file-type</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11654 |
<a name="Definition_of_file-device"></a><a name="Procedure_file-device"></a><a name="index-file_002ddevice"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-device">file-device</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11655 |
<a name="Definition_of_file-inode"></a><a name="Procedure_file-inode"></a><a name="index-file_002dinode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-inode">file-inode</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11656 |
<a name="Definition_of_file-mode"></a><a name="Procedure_file-mode"></a><a name="index-file_002dmode"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-mode">file-mode</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11657 |
<a name="Definition_of_file-number-of-links"></a><a name="Procedure_file-number-of-links"></a><a name="index-file_002dnumber_002dof_002dlinks"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-number-of-links">file-number-of-links</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11658 |
<a name="Definition_of_file-owner"></a><a name="Procedure_file-owner"></a><a name="index-file_002downer"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-owner">file-owner</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11659 |
<a name="Definition_of_file-group"></a><a name="Procedure_file-group"></a><a name="index-file_002dgroup"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-group">file-group</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11660 |
<a name="Definition_of_file-size"></a><a name="Procedure_file-size"></a><a name="index-file_002dsize"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-size">file-size</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11661 |
<a name="Definition_of_file-last-access-time"></a><a name="Procedure_file-last-access-time"></a><a name="index-file_002dlast_002daccess_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-last-access-time">file-last-access-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11662 |
<a name="Definition_of_file-last-modification-time"></a><a name="Procedure_file-last-modification-time"></a><a name="index-file_002dlast_002dmodification_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-last-modification-time">file-last-modification-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11663 |
<a name="Definition_of_file-last-change-time"></a><a name="Procedure_file-last-change-time"></a><a name="index-file_002dlast_002dchange_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-last-change-time">file-last-change-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11664 |
<a name="Definition_of_file-attributes"></a><a name="Procedure_file-attributes"></a><a name="index-file_002dattributes"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-attributes">file-attributes</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11665 |
<a name="Definition_of_file-creation-time"></a><a name="Procedure_file-creation-time"></a><a name="index-file_002dcreation_002dtime"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_file-creation-time">file-creation-time</a></b></code><i> <var>path</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11666 |
|
| 11667 |
<p>These procedures combine a call to the <code>file-info</code> procedure and |
| 11668 |
a call to a file-information record field accessor. For instance |
| 11669 |
<code>(file-type <var>path</var>)</code> is equivalent to <code>(file-info-type |
| 11670 |
(file-info <var>path</var>))</code>. |
| 11671 |
</p> |
| 11672 |
|
| 11673 |
|
| 11674 |
<a name="Group-information"></a><hr size="6"><br/><br/><br/> |
| 11675 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11676 |
<tr><td valign="middle" align="left"><a href="#File-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11677 |
<td valign="middle" align="left"><a href="#User-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11678 |
<td valign="middle" align="left"> </td> |
| 11679 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11680 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11681 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11682 |
<td valign="middle" align="left"> </td> |
| 11683 |
<td valign="middle" align="left"> </td> |
| 11684 |
<td valign="middle" align="left"> </td> |
| 11685 |
<td valign="middle" align="left"> </td> |
| 11686 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11687 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11688 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11689 |
</tr></table> |
| 11690 |
<a name="Group-information-1"></a> |
| 11691 |
<h2 class="section">16.9 Group information</h2> |
| 11692 |
|
| 11693 |
<a name="Definition_of_group-info"></a><a name="Procedure_group-info"></a><a name="index-group_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_group-info">group-info</a></b></code><i> <var>group-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11694 |
|
| 11695 |
<p>This procedure accesses the group database to get information about the |
| 11696 |
group identified by <var>group-name-or-id</var>, which is the group’s symbolic |
| 11697 |
name (string) or the group’s GID (exact integer). A group-information |
| 11698 |
record is returned that contains the group’s symbolic name, the group’s |
| 11699 |
id (GID), and the group’s members (list of symbolic user names). |
| 11700 |
</p> |
| 11701 |
<p>For example: |
| 11702 |
</p> |
| 11703 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info "staff")</b> |
| 11704 |
#<group-info #2 name: "staff" gid: 20 members: ("root")> |
| 11705 |
> <b>(group-info 29)</b> |
| 11706 |
#<group-info #3 |
| 11707 |
name: "certusers" |
| 11708 |
gid: 29 |
| 11709 |
members: ("root" "jabber" "postfix" "cyrusimap")> |
| 11710 |
> <b>(group-info 5000)</b> |
| 11711 |
*** ERROR IN (console)@3.1 -- Resource temporarily unavailable |
| 11712 |
(group-info 5000) |
| 11713 |
</pre></td></tr></table> |
| 11714 |
|
| 11715 |
|
| 11716 |
|
| 11717 |
<a name="Definition_of_group-info?"></a><a name="Procedure_group-info?"></a><a name="index-group_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_group-info?">group-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11718 |
|
| 11719 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a group-information |
| 11720 |
record and <code>#f</code> otherwise. |
| 11721 |
</p> |
| 11722 |
<p>For example: |
| 11723 |
</p> |
| 11724 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info? (group-info "daemon"))</b> |
| 11725 |
#t |
| 11726 |
> <b>(group-info? 123)</b> |
| 11727 |
#f |
| 11728 |
</pre></td></tr></table> |
| 11729 |
|
| 11730 |
|
| 11731 |
|
| 11732 |
<a name="Definition_of_group-info-name"></a><a name="Procedure_group-info-name"></a><a name="index-group_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_group-info-name">group-info-name</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11733 |
|
| 11734 |
<p>Returns the symbolic name field of the group-information record |
| 11735 |
<var>group-info</var>. |
| 11736 |
</p> |
| 11737 |
<p>For example: |
| 11738 |
</p> |
| 11739 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-name (group-info 29))</b> |
| 11740 |
"certusers" |
| 11741 |
</pre></td></tr></table> |
| 11742 |
|
| 11743 |
|
| 11744 |
|
| 11745 |
<a name="Definition_of_group-info-gid"></a><a name="Procedure_group-info-gid"></a><a name="index-group_002dinfo_002dgid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_group-info-gid">group-info-gid</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11746 |
|
| 11747 |
<p>Returns the group id field of the group-information record |
| 11748 |
<var>group-info</var>. |
| 11749 |
</p> |
| 11750 |
<p>For example: |
| 11751 |
</p> |
| 11752 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-gid (group-info "staff"))</b> |
| 11753 |
20 |
| 11754 |
</pre></td></tr></table> |
| 11755 |
|
| 11756 |
|
| 11757 |
|
| 11758 |
<a name="Definition_of_group-info-members"></a><a name="Procedure_group-info-members"></a><a name="index-group_002dinfo_002dmembers"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_group-info-members">group-info-members</a></b></code><i> <var>group-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11759 |
|
| 11760 |
<p>Returns the members field of the group-information record |
| 11761 |
<var>group-info</var>. |
| 11762 |
</p> |
| 11763 |
<p>For example: |
| 11764 |
</p> |
| 11765 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(group-info-members (group-info "staff"))</b> |
| 11766 |
("root") |
| 11767 |
</pre></td></tr></table> |
| 11768 |
|
| 11769 |
|
| 11770 |
|
| 11771 |
<a name="User-information"></a><hr size="6"><br/><br/><br/> |
| 11772 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11773 |
<tr><td valign="middle" align="left"><a href="#Group-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11774 |
<td valign="middle" align="left"><a href="#Host-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11775 |
<td valign="middle" align="left"> </td> |
| 11776 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11777 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11778 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11779 |
<td valign="middle" align="left"> </td> |
| 11780 |
<td valign="middle" align="left"> </td> |
| 11781 |
<td valign="middle" align="left"> </td> |
| 11782 |
<td valign="middle" align="left"> </td> |
| 11783 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11784 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11785 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11786 |
</tr></table> |
| 11787 |
<a name="User-information-1"></a> |
| 11788 |
<h2 class="section">16.10 User information</h2> |
| 11789 |
|
| 11790 |
<a name="Definition_of_user-name"></a><a name="Procedure_user-name"></a><a name="index-user_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-name">user-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11791 |
|
| 11792 |
<p>This procedure returns the user’s name as a string. |
| 11793 |
</p> |
| 11794 |
<p>For example: |
| 11795 |
</p> |
| 11796 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-name)</b> |
| 11797 |
"feeley" |
| 11798 |
</pre></td></tr></table> |
| 11799 |
|
| 11800 |
|
| 11801 |
|
| 11802 |
<a name="Definition_of_user-info"></a><a name="Procedure_user-info"></a><a name="index-user_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info">user-info</a></b></code><i> <var>user-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11803 |
|
| 11804 |
<p>This procedure accesses the user database to get information about the |
| 11805 |
user identified by <var>user-name-or-id</var>, which is the user’s symbolic |
| 11806 |
name (string) or the user’s UID (exact integer). A user-information |
| 11807 |
record is returned that contains the user’s symbolic name, the user’s |
| 11808 |
id (UID), the user’s group id (GID), the path to the user’s home |
| 11809 |
directory, and the user’s login shell. |
| 11810 |
</p> |
| 11811 |
<p>For example: |
| 11812 |
</p> |
| 11813 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info "feeley")</b> |
| 11814 |
#<user-info #2 |
| 11815 |
name: "feeley" |
| 11816 |
uid: 506 |
| 11817 |
gid: 506 |
| 11818 |
home: "/Users/feeley" |
| 11819 |
shell: "/bin/bash"> |
| 11820 |
> <b>(user-info 0)</b> |
| 11821 |
#<user-info #3 name: "root" uid: 0 gid: 0 home: "/var/root" shell: "/bin/sh"> |
| 11822 |
> <b>(user-info 5000)</b> |
| 11823 |
*** ERROR IN (console)@3.1 -- Resource temporarily unavailable |
| 11824 |
(user-info 5000) |
| 11825 |
</pre></td></tr></table> |
| 11826 |
|
| 11827 |
|
| 11828 |
|
| 11829 |
<a name="Definition_of_user-info?"></a><a name="Procedure_user-info?"></a><a name="index-user_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info?">user-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11830 |
|
| 11831 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a user-information |
| 11832 |
record and <code>#f</code> otherwise. |
| 11833 |
</p> |
| 11834 |
<p>For example: |
| 11835 |
</p> |
| 11836 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info? (user-info "feeley"))</b> |
| 11837 |
#t |
| 11838 |
> <b>(user-info? 123)</b> |
| 11839 |
#f |
| 11840 |
</pre></td></tr></table> |
| 11841 |
|
| 11842 |
|
| 11843 |
|
| 11844 |
<a name="Definition_of_user-info-name"></a><a name="Procedure_user-info-name"></a><a name="index-user_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info-name">user-info-name</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11845 |
|
| 11846 |
<p>Returns the symbolic name field of the user-information record |
| 11847 |
<var>user-info</var>. |
| 11848 |
</p> |
| 11849 |
<p>For example: |
| 11850 |
</p> |
| 11851 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-name (user-info 0))</b> |
| 11852 |
"root" |
| 11853 |
</pre></td></tr></table> |
| 11854 |
|
| 11855 |
|
| 11856 |
|
| 11857 |
<a name="Definition_of_user-info-uid"></a><a name="Procedure_user-info-uid"></a><a name="index-user_002dinfo_002duid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info-uid">user-info-uid</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11858 |
|
| 11859 |
<p>Returns the user id field of the user-information record |
| 11860 |
<var>user-info</var>. |
| 11861 |
</p> |
| 11862 |
<p>For example: |
| 11863 |
</p> |
| 11864 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-uid (user-info "feeley"))</b> |
| 11865 |
506 |
| 11866 |
</pre></td></tr></table> |
| 11867 |
|
| 11868 |
|
| 11869 |
|
| 11870 |
<a name="Definition_of_user-info-gid"></a><a name="Procedure_user-info-gid"></a><a name="index-user_002dinfo_002dgid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info-gid">user-info-gid</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11871 |
|
| 11872 |
<p>Returns the group id field of the user-information record |
| 11873 |
<var>user-info</var>. |
| 11874 |
</p> |
| 11875 |
<p>For example: |
| 11876 |
</p> |
| 11877 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-gid (user-info "feeley"))</b> |
| 11878 |
506 |
| 11879 |
</pre></td></tr></table> |
| 11880 |
|
| 11881 |
|
| 11882 |
|
| 11883 |
<a name="Definition_of_user-info-home"></a><a name="Procedure_user-info-home"></a><a name="index-user_002dinfo_002dhome"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info-home">user-info-home</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11884 |
|
| 11885 |
<p>Returns the home directory field of the user-information record |
| 11886 |
<var>user-info</var>. |
| 11887 |
</p> |
| 11888 |
<p>For example: |
| 11889 |
</p> |
| 11890 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-home (user-info 0))</b> |
| 11891 |
"/var/root" |
| 11892 |
</pre></td></tr></table> |
| 11893 |
|
| 11894 |
|
| 11895 |
|
| 11896 |
<a name="Definition_of_user-info-shell"></a><a name="Procedure_user-info-shell"></a><a name="index-user_002dinfo_002dshell"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_user-info-shell">user-info-shell</a></b></code><i> <var>user-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11897 |
|
| 11898 |
<p>Returns the shell field of the user-information record |
| 11899 |
<var>user-info</var>. |
| 11900 |
</p> |
| 11901 |
<p>For example: |
| 11902 |
</p> |
| 11903 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(user-info-shell (user-info 0))</b> |
| 11904 |
"/bin/sh" |
| 11905 |
</pre></td></tr></table> |
| 11906 |
|
| 11907 |
|
| 11908 |
|
| 11909 |
<a name="Host-information"></a><hr size="6"><br/><br/><br/> |
| 11910 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 11911 |
<tr><td valign="middle" align="left"><a href="#User-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 11912 |
<td valign="middle" align="left"><a href="#Service-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 11913 |
<td valign="middle" align="left"> </td> |
| 11914 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 11915 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 11916 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 11917 |
<td valign="middle" align="left"> </td> |
| 11918 |
<td valign="middle" align="left"> </td> |
| 11919 |
<td valign="middle" align="left"> </td> |
| 11920 |
<td valign="middle" align="left"> </td> |
| 11921 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 11922 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 11923 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 11924 |
</tr></table> |
| 11925 |
<a name="Host-information-1"></a> |
| 11926 |
<h2 class="section">16.11 Host information</h2> |
| 11927 |
|
| 11928 |
<a name="Definition_of_host-name"></a><a name="Procedure_host-name"></a><a name="index-host_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-name">host-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11929 |
|
| 11930 |
<p>This procedure returns the machine’s host name as a string. |
| 11931 |
</p> |
| 11932 |
<p>For example: |
| 11933 |
</p> |
| 11934 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-name)</b> |
| 11935 |
"mega.iro.umontreal.ca" |
| 11936 |
</pre></td></tr></table> |
| 11937 |
|
| 11938 |
|
| 11939 |
|
| 11940 |
<a name="Definition_of_host-info"></a><a name="Procedure_host-info"></a><a name="index-host_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-info">host-info</a></b></code><i> <var>host-name</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11941 |
|
| 11942 |
<p>This procedure accesses the internet host database to get information |
| 11943 |
about the machine whose name is denoted by the string <var>host-name</var>. |
| 11944 |
A host-information record is returned that contains the official name |
| 11945 |
of the machine, a list of aliases (alternative names), and a non-empty |
| 11946 |
list of IP addresses for this machine. An exception is raised when |
| 11947 |
<var>host-name</var> does not appear in the database. |
| 11948 |
</p> |
| 11949 |
<p>For example: |
| 11950 |
</p> |
| 11951 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info "www.google.com")</b> |
| 11952 |
#<host-info #2 |
| 11953 |
name: "www.l.google.com" |
| 11954 |
aliases: ("www.google.com") |
| 11955 |
addresses: (#u8(66 249 85 99) #u8(66 249 85 104))> |
| 11956 |
> <b>(host-info "unknown.domain")</b> |
| 11957 |
*** ERROR IN (console)@2.1 -- Unknown host |
| 11958 |
(host-info "unknown.domain") |
| 11959 |
</pre></td></tr></table> |
| 11960 |
|
| 11961 |
|
| 11962 |
|
| 11963 |
<a name="Definition_of_host-info?"></a><a name="Procedure_host-info?"></a><a name="index-host_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-info?">host-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11964 |
|
| 11965 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a host-information |
| 11966 |
record and <code>#f</code> otherwise. |
| 11967 |
</p> |
| 11968 |
<p>For example: |
| 11969 |
</p> |
| 11970 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info? (host-info "www.google.com"))</b> |
| 11971 |
#t |
| 11972 |
> <b>(host-info? 123)</b> |
| 11973 |
#f |
| 11974 |
</pre></td></tr></table> |
| 11975 |
|
| 11976 |
|
| 11977 |
|
| 11978 |
<a name="Definition_of_host-info-name"></a><a name="Procedure_host-info-name"></a><a name="index-host_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-info-name">host-info-name</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11979 |
|
| 11980 |
<p>Returns the official name field of the host-information record |
| 11981 |
<var>host-info</var>. |
| 11982 |
</p> |
| 11983 |
<p>For example: |
| 11984 |
</p> |
| 11985 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-name (host-info "www.google.com"))</b> |
| 11986 |
"www.l.google.com" |
| 11987 |
</pre></td></tr></table> |
| 11988 |
|
| 11989 |
|
| 11990 |
|
| 11991 |
<a name="Definition_of_host-info-aliases"></a><a name="Procedure_host-info-aliases"></a><a name="index-host_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-info-aliases">host-info-aliases</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 11992 |
|
| 11993 |
<p>Returns the aliases field of the host-information record |
| 11994 |
<var>host-info</var>. This field is a possibly empty list of strings. |
| 11995 |
</p> |
| 11996 |
<p>For example: |
| 11997 |
</p> |
| 11998 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-aliases (host-info "www.google.com"))</b> |
| 11999 |
("www.google.com") |
| 12000 |
</pre></td></tr></table> |
| 12001 |
|
| 12002 |
|
| 12003 |
|
| 12004 |
<a name="Definition_of_host-info-addresses"></a><a name="Procedure_host-info-addresses"></a><a name="index-host_002dinfo_002daddresses"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_host-info-addresses">host-info-addresses</a></b></code><i> <var>host-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12005 |
|
| 12006 |
<p>Returns the addresses field of the host-information record |
| 12007 |
<var>host-info</var>. This field is a non-empty list of u8vectors |
| 12008 |
denoting IP addresses. |
| 12009 |
</p> |
| 12010 |
<p>For example: |
| 12011 |
</p> |
| 12012 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(host-info-addresses (host-info "www.google.com"))</b> |
| 12013 |
(#u8(66 249 85 99) #u8(66 249 85 104)) |
| 12014 |
</pre></td></tr></table> |
| 12015 |
|
| 12016 |
|
| 12017 |
|
| 12018 |
<a name="Definition_of_address-infos"></a><a name="Procedure_address-infos"></a><a name="index-address_002dinfos"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-infos">address-infos</a></b></code><i> <span class="roman">[</span><code>host:</code> <var>host</var><span class="roman">]</span> <span class="roman">[</span><code>service:</code> <var>service</var><span class="roman">]</span> <span class="roman">[</span><code>family:</code> <var>family</var><span class="roman">]</span> <span class="roman">[</span><code>socket-type:</code> <var>socket-type</var><span class="roman">]</span> <span class="roman">[</span><code>protocol:</code> <var>protocol</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12019 |
|
| 12020 |
<p>This procedure is an interface to the <code>getaddrinfo</code> system call. |
| 12021 |
It accesses the internet host database to get information about the |
| 12022 |
machine whose name is denoted by the string <var>host</var> and service is |
| 12023 |
denoted by the string <var>service</var> and network address family is |
| 12024 |
<var>family</var> (<code>INET</code> or <code>INET6</code>) and network socket-type is |
| 12025 |
<var>socket-type</var> (<code>STREAM</code> or <code>DGRAM</code> or <code>RAW</code>) and |
| 12026 |
network protocol is <var>socket-type</var> (<code>TCP</code> or <code>UDP</code>). A |
| 12027 |
list of address-information records is returned. |
| 12028 |
</p> |
| 12029 |
<p>For example: |
| 12030 |
</p> |
| 12031 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(address-infos host: "ftp.at.debian.org")</b> |
| 12032 |
(#<address-info #2 |
| 12033 |
family: INET6 |
| 12034 |
socket-type: DGRAM |
| 12035 |
protocol: UDP |
| 12036 |
socket-info: |
| 12037 |
#<socket-info #3 |
| 12038 |
family: INET6 |
| 12039 |
port-number: 0 |
| 12040 |
address: #u16(8193 2136 2 1 0 0 0 16)>> |
| 12041 |
#<address-info #4 |
| 12042 |
family: INET6 |
| 12043 |
socket-type: STREAM |
| 12044 |
protocol: TCP |
| 12045 |
socket-info: |
| 12046 |
#<socket-info #5 |
| 12047 |
family: INET6 |
| 12048 |
port-number: 0 |
| 12049 |
address: #u16(8193 2136 2 1 0 0 0 16)>> |
| 12050 |
#<address-info #6 |
| 12051 |
family: INET |
| 12052 |
socket-type: DGRAM |
| 12053 |
protocol: UDP |
| 12054 |
socket-info: |
| 12055 |
#<socket-info #7 |
| 12056 |
family: INET |
| 12057 |
port-number: 0 |
| 12058 |
address: #u8(213 129 232 18)>> |
| 12059 |
#<address-info #8 |
| 12060 |
family: INET |
| 12061 |
socket-type: STREAM |
| 12062 |
protocol: TCP |
| 12063 |
socket-info: |
| 12064 |
#<socket-info #9 |
| 12065 |
family: INET |
| 12066 |
port-number: 0 |
| 12067 |
address: #u8(213 129 232 18)>>) |
| 12068 |
> <b>(address-infos host: "ftp.at.debian.org" |
| 12069 |
family: 'INET |
| 12070 |
protocol: 'TCP)</b> |
| 12071 |
(#<address-info #10 |
| 12072 |
family: INET |
| 12073 |
socket-type: STREAM |
| 12074 |
protocol: TCP |
| 12075 |
socket-info: |
| 12076 |
#<socket-info #11 |
| 12077 |
family: INET |
| 12078 |
port-number: 0 |
| 12079 |
address: #u8(213 129 232 18)>>) |
| 12080 |
> <b>(address-infos host: "unknown.domain")</b> |
| 12081 |
*** ERROR IN (console)@5.1 -- nodename nor servname provided, or not known |
| 12082 |
(address-infos host: "unknown.domain") |
| 12083 |
</pre></td></tr></table> |
| 12084 |
|
| 12085 |
|
| 12086 |
|
| 12087 |
<a name="Definition_of_address-info?"></a><a name="Procedure_address-info?"></a><a name="index-address_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-info?">address-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12088 |
|
| 12089 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is an address-information |
| 12090 |
record and <code>#f</code> otherwise. |
| 12091 |
</p> |
| 12092 |
<p>For example: |
| 12093 |
</p> |
| 12094 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info? |
| 12095 |
(address-infos host: "ftp.at.debian.org"))</b> |
| 12096 |
(#t #t #t #t) |
| 12097 |
> <b>(address-info? 123)</b> |
| 12098 |
#f |
| 12099 |
</pre></td></tr></table> |
| 12100 |
|
| 12101 |
|
| 12102 |
|
| 12103 |
<a name="Definition_of_address-info-family"></a><a name="Procedure_address-info-family"></a><a name="index-address_002dinfo_002dfamily"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-info-family">address-info-family</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12104 |
|
| 12105 |
<p>Returns the family field of the address-information record |
| 12106 |
<var>address-info</var>. |
| 12107 |
</p> |
| 12108 |
<p>For example: |
| 12109 |
</p> |
| 12110 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-family |
| 12111 |
(address-infos host: "ftp.at.debian.org"))</b> |
| 12112 |
(INET6 INET6 INET INET) |
| 12113 |
</pre></td></tr></table> |
| 12114 |
|
| 12115 |
|
| 12116 |
|
| 12117 |
<a name="Definition_of_address-info-socket-type"></a><a name="Procedure_address-info-socket-type"></a><a name="index-address_002dinfo_002dsocket_002dtype"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-info-socket-type">address-info-socket-type</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12118 |
|
| 12119 |
<p>Returns the socket-type field of the address-information record |
| 12120 |
<var>address-info</var>. |
| 12121 |
</p> |
| 12122 |
<p>For example: |
| 12123 |
</p> |
| 12124 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-socket-type |
| 12125 |
(address-infos host: "ftp.at.debian.org"))</b> |
| 12126 |
(DGRAM STREAM DGRAM STREAM) |
| 12127 |
</pre></td></tr></table> |
| 12128 |
|
| 12129 |
|
| 12130 |
|
| 12131 |
<a name="Definition_of_address-info-protocol"></a><a name="Procedure_address-info-protocol"></a><a name="index-address_002dinfo_002dprotocol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-info-protocol">address-info-protocol</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12132 |
|
| 12133 |
<p>Returns the protocol field of the address-information record |
| 12134 |
<var>address-info</var>. |
| 12135 |
</p> |
| 12136 |
<p>For example: |
| 12137 |
</p> |
| 12138 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-protocol |
| 12139 |
(address-infos host: "ftp.at.debian.org"))</b> |
| 12140 |
(UDP TCP UDP TCP) |
| 12141 |
</pre></td></tr></table> |
| 12142 |
|
| 12143 |
|
| 12144 |
|
| 12145 |
<a name="Definition_of_address-info-socket-info"></a><a name="Procedure_address-info-socket-info"></a><a name="index-address_002dinfo_002dsocket_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_address-info-socket-info">address-info-socket-info</a></b></code><i> <var>address-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12146 |
|
| 12147 |
<p>Returns the socket-info field of the address-information record |
| 12148 |
<var>address-info</var>. |
| 12149 |
</p> |
| 12150 |
<p>For example: |
| 12151 |
</p> |
| 12152 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(map address-info-socket-info |
| 12153 |
(address-infos host: "ftp.at.debian.org"))</b> |
| 12154 |
(#<socket-info #2 |
| 12155 |
family: INET6 |
| 12156 |
port-number: 0 |
| 12157 |
address: #u16(8193 2136 2 1 0 0 0 16)> |
| 12158 |
#<socket-info #3 |
| 12159 |
family: INET6 |
| 12160 |
port-number: 0 |
| 12161 |
address: #u16(8193 2136 2 1 0 0 0 16)> |
| 12162 |
#<socket-info #4 |
| 12163 |
family: INET |
| 12164 |
port-number: 0 |
| 12165 |
address: #u8(213 129 232 18)> |
| 12166 |
#<socket-info #5 |
| 12167 |
family: INET |
| 12168 |
port-number: 0 |
| 12169 |
address: #u8(213 129 232 18)>) |
| 12170 |
</pre></td></tr></table> |
| 12171 |
|
| 12172 |
|
| 12173 |
|
| 12174 |
<a name="Service-information"></a><hr size="6"><br/><br/><br/> |
| 12175 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12176 |
<tr><td valign="middle" align="left"><a href="#Host-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12177 |
<td valign="middle" align="left"><a href="#Protocol-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12178 |
<td valign="middle" align="left"> </td> |
| 12179 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12180 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12181 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12182 |
<td valign="middle" align="left"> </td> |
| 12183 |
<td valign="middle" align="left"> </td> |
| 12184 |
<td valign="middle" align="left"> </td> |
| 12185 |
<td valign="middle" align="left"> </td> |
| 12186 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12187 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12188 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12189 |
</tr></table> |
| 12190 |
<a name="Service-information-1"></a> |
| 12191 |
<h2 class="section">16.12 Service information</h2> |
| 12192 |
|
| 12193 |
<a name="Definition_of_service-info"></a><a name="Procedure_service-info"></a><a name="index-service_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info">service-info</a></b></code><i> <var>service-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12194 |
|
| 12195 |
<p>This procedure accesses the service database to get information about |
| 12196 |
the service identified by <var>service-name-or-id</var>, which is the |
| 12197 |
service’s symbolic name (string) or the service’s port number (exact |
| 12198 |
integer). A service-information record is returned that contains the |
| 12199 |
service’s symbolic name, a list of aliases (alternative names), the |
| 12200 |
port number (exact integer), and the protocol name (string). An |
| 12201 |
exception is raised when <var>service-name-or-id</var> does not appear in |
| 12202 |
the database. |
| 12203 |
</p> |
| 12204 |
<p>For example: |
| 12205 |
</p> |
| 12206 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info "http")</b> |
| 12207 |
#<service-info #2 |
| 12208 |
name: "http" |
| 12209 |
aliases: ("www" "www-http") |
| 12210 |
port-number: 80 |
| 12211 |
protocol: "udp"> |
| 12212 |
> <b>(service-info 80)</b> |
| 12213 |
#<service-info #3 |
| 12214 |
name: "http" |
| 12215 |
aliases: ("www" "www-http") |
| 12216 |
port-number: 80 |
| 12217 |
protocol: "udp"> |
| 12218 |
</pre></td></tr></table> |
| 12219 |
|
| 12220 |
|
| 12221 |
|
| 12222 |
<a name="Definition_of_service-info?"></a><a name="Procedure_service-info?"></a><a name="index-service_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info?">service-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12223 |
|
| 12224 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a service-information |
| 12225 |
record and <code>#f</code> otherwise. |
| 12226 |
</p> |
| 12227 |
<p>For example: |
| 12228 |
</p> |
| 12229 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info? (service-info "http"))</b> |
| 12230 |
#t |
| 12231 |
> <b>(service-info? 123)</b> |
| 12232 |
#f |
| 12233 |
</pre></td></tr></table> |
| 12234 |
|
| 12235 |
|
| 12236 |
|
| 12237 |
<a name="Definition_of_service-info-name"></a><a name="Procedure_service-info-name"></a><a name="index-service_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info-name">service-info-name</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12238 |
|
| 12239 |
<p>Returns the symbolic name field of the service-information record |
| 12240 |
<var>service-info</var>. |
| 12241 |
</p> |
| 12242 |
<p>For example: |
| 12243 |
</p> |
| 12244 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-name (service-info 80))</b> |
| 12245 |
"http" |
| 12246 |
</pre></td></tr></table> |
| 12247 |
|
| 12248 |
|
| 12249 |
|
| 12250 |
<a name="Definition_of_service-info-aliases"></a><a name="Procedure_service-info-aliases"></a><a name="index-service_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info-aliases">service-info-aliases</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12251 |
|
| 12252 |
<p>Returns the aliases field of the service-information record |
| 12253 |
<var>service-info</var>. This field is a possibly empty list of strings. |
| 12254 |
</p> |
| 12255 |
<p>For example: |
| 12256 |
</p> |
| 12257 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-aliases (service-info "http"))</b> |
| 12258 |
("www" "www-http") |
| 12259 |
</pre></td></tr></table> |
| 12260 |
|
| 12261 |
|
| 12262 |
|
| 12263 |
<a name="Definition_of_service-info-port-number"></a><a name="Procedure_service-info-port-number"></a><a name="index-service_002dinfo_002dport_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info-port-number">service-info-port-number</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12264 |
|
| 12265 |
<p>Returns the service port number field of the service-information |
| 12266 |
record <var>service-info</var>. |
| 12267 |
</p> |
| 12268 |
<p>For example: |
| 12269 |
</p> |
| 12270 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-port-number (service-info "http"))</b> |
| 12271 |
80 |
| 12272 |
</pre></td></tr></table> |
| 12273 |
|
| 12274 |
|
| 12275 |
|
| 12276 |
<a name="Definition_of_service-info-protocol"></a><a name="Procedure_service-info-protocol"></a><a name="index-service_002dinfo_002dprotocol"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_service-info-protocol">service-info-protocol</a></b></code><i> <var>service-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12277 |
|
| 12278 |
<p>Returns the service protocol name field of the service-information |
| 12279 |
record <var>service-info</var>. |
| 12280 |
</p> |
| 12281 |
<p>For example: |
| 12282 |
</p> |
| 12283 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(service-info-protocol (service-info "http"))</b> |
| 12284 |
"udp" |
| 12285 |
</pre></td></tr></table> |
| 12286 |
|
| 12287 |
|
| 12288 |
|
| 12289 |
<a name="Protocol-information"></a><hr size="6"><br/><br/><br/> |
| 12290 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12291 |
<tr><td valign="middle" align="left"><a href="#Service-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12292 |
<td valign="middle" align="left"><a href="#Network-information" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12293 |
<td valign="middle" align="left"> </td> |
| 12294 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12295 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12296 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12297 |
<td valign="middle" align="left"> </td> |
| 12298 |
<td valign="middle" align="left"> </td> |
| 12299 |
<td valign="middle" align="left"> </td> |
| 12300 |
<td valign="middle" align="left"> </td> |
| 12301 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12302 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12303 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12304 |
</tr></table> |
| 12305 |
<a name="Protocol-information-1"></a> |
| 12306 |
<h2 class="section">16.13 Protocol information</h2> |
| 12307 |
|
| 12308 |
<a name="Definition_of_protocol-info"></a><a name="Procedure_protocol-info"></a><a name="index-protocol_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_protocol-info">protocol-info</a></b></code><i> <var>protocol-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12309 |
|
| 12310 |
<p>This procedure accesses the protocol database to get information about |
| 12311 |
the protocol identified by <var>protocol-name-or-id</var>, which is the |
| 12312 |
protocol’s symbolic name (string) or the protocol’s number (exact |
| 12313 |
integer). A protocol-information record is returned that contains the |
| 12314 |
protocol’s symbolic name, a list of aliases (alternative names), and |
| 12315 |
the protocol number (32 bit unsigned exact integer). An exception is |
| 12316 |
raised when <var>protocol-name-or-id</var> does not appear in the database. |
| 12317 |
</p> |
| 12318 |
<p>For example: |
| 12319 |
</p> |
| 12320 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info "tcp")</b> |
| 12321 |
#<protocol-info #2 name: "tcp" aliases: ("TCP") number: 6> |
| 12322 |
> <b>(protocol-info 6)</b> |
| 12323 |
#<protocol-info #2 name: "tcp" aliases: ("TCP") number: 6> |
| 12324 |
</pre></td></tr></table> |
| 12325 |
|
| 12326 |
|
| 12327 |
|
| 12328 |
<a name="Definition_of_protocol-info?"></a><a name="Procedure_protocol-info?"></a><a name="index-protocol_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_protocol-info?">protocol-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12329 |
|
| 12330 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a protocol-information |
| 12331 |
record and <code>#f</code> otherwise. |
| 12332 |
</p> |
| 12333 |
<p>For example: |
| 12334 |
</p> |
| 12335 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info? (protocol-info "tcp"))</b> |
| 12336 |
#t |
| 12337 |
> <b>(protocol-info? 123)</b> |
| 12338 |
#f |
| 12339 |
</pre></td></tr></table> |
| 12340 |
|
| 12341 |
|
| 12342 |
|
| 12343 |
<a name="Definition_of_protocol-info-name"></a><a name="Procedure_protocol-info-name"></a><a name="index-protocol_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_protocol-info-name">protocol-info-name</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12344 |
|
| 12345 |
<p>Returns the symbolic name field of the protocol-information record |
| 12346 |
<var>protocol-info</var>. |
| 12347 |
</p> |
| 12348 |
<p>For example: |
| 12349 |
</p> |
| 12350 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-name (protocol-info 6))</b> |
| 12351 |
"tcp" |
| 12352 |
</pre></td></tr></table> |
| 12353 |
|
| 12354 |
|
| 12355 |
|
| 12356 |
<a name="Definition_of_protocol-info-aliases"></a><a name="Procedure_protocol-info-aliases"></a><a name="index-protocol_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_protocol-info-aliases">protocol-info-aliases</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12357 |
|
| 12358 |
<p>Returns the aliases field of the protocol-information record |
| 12359 |
<var>protocol-info</var>. This field is a possibly empty list of strings. |
| 12360 |
</p> |
| 12361 |
<p>For example: |
| 12362 |
</p> |
| 12363 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-aliases (protocol-info "tcp"))</b> |
| 12364 |
("TCP") |
| 12365 |
</pre></td></tr></table> |
| 12366 |
|
| 12367 |
|
| 12368 |
|
| 12369 |
<a name="Definition_of_protocol-info-number"></a><a name="Procedure_protocol-info-number"></a><a name="index-protocol_002dinfo_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_protocol-info-number">protocol-info-number</a></b></code><i> <var>protocol-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12370 |
|
| 12371 |
<p>Returns the protocol number field of the protocol-information record |
| 12372 |
<var>protocol-info</var>. |
| 12373 |
</p> |
| 12374 |
<p>For example: |
| 12375 |
</p> |
| 12376 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(protocol-info-number (protocol-info "tcp"))</b> |
| 12377 |
6 |
| 12378 |
</pre></td></tr></table> |
| 12379 |
|
| 12380 |
|
| 12381 |
|
| 12382 |
<a name="Network-information"></a><hr size="6"><br/><br/><br/> |
| 12383 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12384 |
<tr><td valign="middle" align="left"><a href="#Protocol-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12385 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12386 |
<td valign="middle" align="left"> </td> |
| 12387 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12388 |
<td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12389 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12390 |
<td valign="middle" align="left"> </td> |
| 12391 |
<td valign="middle" align="left"> </td> |
| 12392 |
<td valign="middle" align="left"> </td> |
| 12393 |
<td valign="middle" align="left"> </td> |
| 12394 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12395 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12396 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12397 |
</tr></table> |
| 12398 |
<a name="Network-information-1"></a> |
| 12399 |
<h2 class="section">16.14 Network information</h2> |
| 12400 |
|
| 12401 |
<a name="Definition_of_network-info"></a><a name="Procedure_network-info"></a><a name="index-network_002dinfo"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_network-info">network-info</a></b></code><i> <var>network-name-or-id</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12402 |
|
| 12403 |
<p>This procedure accesses the network database to get information about |
| 12404 |
the network identified by <var>network-name-or-id</var>, which is the |
| 12405 |
network’s symbolic name (string) or the network’s number (exact |
| 12406 |
integer). A network-information record is returned that contains the |
| 12407 |
network’s symbolic name, a list of aliases (alternative names), and |
| 12408 |
the network number (32 bit unsigned exact integer). An exception is |
| 12409 |
raised when <var>network-name-or-id</var> does not appear in the database. |
| 12410 |
</p> |
| 12411 |
<p>For example: |
| 12412 |
</p> |
| 12413 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info "loopback")</b> |
| 12414 |
#<network-info #2 |
| 12415 |
name: "loopback" |
| 12416 |
aliases: ("loopback-net") |
| 12417 |
number: 127> |
| 12418 |
> <b>(network-info 127)</b> |
| 12419 |
#<network-info #3 |
| 12420 |
name: "loopback" |
| 12421 |
aliases: ("loopback-net") |
| 12422 |
number: 127> |
| 12423 |
</pre></td></tr></table> |
| 12424 |
|
| 12425 |
|
| 12426 |
|
| 12427 |
<a name="Definition_of_network-info?"></a><a name="Procedure_network-info?"></a><a name="index-network_002dinfo_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_network-info?">network-info?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12428 |
|
| 12429 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a network-information |
| 12430 |
record and <code>#f</code> otherwise. |
| 12431 |
</p> |
| 12432 |
<p>For example: |
| 12433 |
</p> |
| 12434 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info? (network-info "loopback"))</b> |
| 12435 |
#t |
| 12436 |
> <b>(network-info? 123)</b> |
| 12437 |
#f |
| 12438 |
</pre></td></tr></table> |
| 12439 |
|
| 12440 |
|
| 12441 |
|
| 12442 |
<a name="Definition_of_network-info-name"></a><a name="Procedure_network-info-name"></a><a name="index-network_002dinfo_002dname"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_network-info-name">network-info-name</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12443 |
|
| 12444 |
<p>Returns the symbolic name field of the network-information record |
| 12445 |
<var>network-info</var>. |
| 12446 |
</p> |
| 12447 |
<p>For example: |
| 12448 |
</p> |
| 12449 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-name (network-info 127))</b> |
| 12450 |
"loopback" |
| 12451 |
</pre></td></tr></table> |
| 12452 |
|
| 12453 |
|
| 12454 |
|
| 12455 |
<a name="Definition_of_network-info-aliases"></a><a name="Procedure_network-info-aliases"></a><a name="index-network_002dinfo_002daliases"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_network-info-aliases">network-info-aliases</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12456 |
|
| 12457 |
<p>Returns the aliases field of the network-information record |
| 12458 |
<var>network-info</var>. This field is a possibly empty list of strings. |
| 12459 |
</p> |
| 12460 |
<p>For example: |
| 12461 |
</p> |
| 12462 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-aliases (network-info "loopback"))</b> |
| 12463 |
("loopback-net") |
| 12464 |
</pre></td></tr></table> |
| 12465 |
|
| 12466 |
|
| 12467 |
|
| 12468 |
<a name="Definition_of_network-info-number"></a><a name="Procedure_network-info-number"></a><a name="index-network_002dinfo_002dnumber"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_network-info-number">network-info-number</a></b></code><i> <var>network-info</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12469 |
|
| 12470 |
<p>Returns the network number field of the network-information record |
| 12471 |
<var>network-info</var>. |
| 12472 |
</p> |
| 12473 |
<p>For example: |
| 12474 |
</p> |
| 12475 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(network-info-number (network-info "loopback"))</b> |
| 12476 |
127 |
| 12477 |
</pre></td></tr></table> |
| 12478 |
|
| 12479 |
|
| 12480 |
|
| 12481 |
<a name="I_002fO-and-ports"></a><hr size="6"><br/><br/><br/> |
| 12482 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12483 |
<tr><td valign="middle" align="left"><a href="#Network-information" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12484 |
<td valign="middle" align="left"><a href="#Unidirectional-and-bidirectional-ports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12485 |
<td valign="middle" align="left"> </td> |
| 12486 |
<td valign="middle" align="left"><a href="#Host-environment" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12487 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12488 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12489 |
<td valign="middle" align="left"> </td> |
| 12490 |
<td valign="middle" align="left"> </td> |
| 12491 |
<td valign="middle" align="left"> </td> |
| 12492 |
<td valign="middle" align="left"> </td> |
| 12493 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12494 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12495 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12496 |
</tr></table> |
| 12497 |
<a name="I_002fO-and-ports-1"></a> |
| 12498 |
<h1 class="chapter">17. I/O and ports</h1> |
| 12499 |
|
| 12500 |
<table class="menu" border="0" cellspacing="0"> |
| 12501 |
<tr><td align="left" valign="top"><a href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12502 |
<tr><td align="left" valign="top"><a href="#Port-classes">17.2 Port classes</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12503 |
<tr><td align="left" valign="top"><a href="#Port-settings">17.3 Port settings</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12504 |
<tr><td align="left" valign="top"><a href="#Object_002dports">17.4 Object-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12505 |
<tr><td align="left" valign="top"><a href="#Character_002dports">17.5 Character-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12506 |
<tr><td align="left" valign="top"><a href="#Byte_002dports">17.6 Byte-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12507 |
<tr><td align="left" valign="top"><a href="#Device_002dports">17.7 Device-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12508 |
<tr><td align="left" valign="top"><a href="#Directory_002dports">17.8 Directory-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12509 |
<tr><td align="left" valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12510 |
<tr><td align="left" valign="top"><a href="#String_002dports">17.10 String-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12511 |
<tr><td align="left" valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12512 |
<tr><td align="left" valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12513 |
</table> |
| 12514 |
|
| 12515 |
<a name="Unidirectional-and-bidirectional-ports"></a><hr size="6"><br/><br/><br/> |
| 12516 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12517 |
<tr><td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12518 |
<td valign="middle" align="left"><a href="#Port-classes" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12519 |
<td valign="middle" align="left"> </td> |
| 12520 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12521 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12522 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12523 |
<td valign="middle" align="left"> </td> |
| 12524 |
<td valign="middle" align="left"> </td> |
| 12525 |
<td valign="middle" align="left"> </td> |
| 12526 |
<td valign="middle" align="left"> </td> |
| 12527 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12528 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12529 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12530 |
</tr></table> |
| 12531 |
<a name="Unidirectional-and-bidirectional-ports-1"></a> |
| 12532 |
<h2 class="section">17.1 Unidirectional and bidirectional ports</h2> |
| 12533 |
|
| 12534 |
<p>Unidirectional ports allow communication between a producer of |
| 12535 |
information and a consumer. An input-port’s producer is typically a |
| 12536 |
resource managed by the operating system (such as a file, a process or |
| 12537 |
a network connection) and the consumer is the Scheme program. The |
| 12538 |
roles are reversed for an output-port. |
| 12539 |
</p> |
| 12540 |
<p>Associated with each port are settings that affect I/O operations on |
| 12541 |
that port (encoding of characters to bytes, end-of-line encoding, type |
| 12542 |
of buffering, etc). Port settings are specified when the port is |
| 12543 |
created. Some port settings can be changed after a port is created. |
| 12544 |
</p> |
| 12545 |
<p>Bidirectional ports, also called input-output-ports, allow |
| 12546 |
communication in both directions. They are best viewed as an object |
| 12547 |
that groups two separate unidirectional ports (one in each direction). |
| 12548 |
Each direction has its own port settings and can be closed |
| 12549 |
independently from the other direction. |
| 12550 |
</p> |
| 12551 |
<a name="Port-classes"></a><hr size="6"><br/><br/><br/> |
| 12552 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12553 |
<tr><td valign="middle" align="left"><a href="#Unidirectional-and-bidirectional-ports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12554 |
<td valign="middle" align="left"><a href="#Port-settings" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12555 |
<td valign="middle" align="left"> </td> |
| 12556 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12557 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12558 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12559 |
<td valign="middle" align="left"> </td> |
| 12560 |
<td valign="middle" align="left"> </td> |
| 12561 |
<td valign="middle" align="left"> </td> |
| 12562 |
<td valign="middle" align="left"> </td> |
| 12563 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12564 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12565 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12566 |
</tr></table> |
| 12567 |
<a name="Port-classes-1"></a> |
| 12568 |
<h2 class="section">17.2 Port classes</h2> |
| 12569 |
|
| 12570 |
<p>The four classes of ports listed below form an inheritance hierarchy. |
| 12571 |
Operations possible for a certain class of port are also possible for |
| 12572 |
the subclasses. Only device-ports are connected to a device managed |
| 12573 |
by the operating system. For instance it is possible to create ports |
| 12574 |
that behave as a FIFO where the Scheme program is both the producer |
| 12575 |
and consumer of information (possibly one thread is the producer and |
| 12576 |
another thread is the consumer). |
| 12577 |
</p> |
| 12578 |
<ol> |
| 12579 |
<li> |
| 12580 |
An <em>object-port</em> (or simply a port) provides operations to read |
| 12581 |
and write Scheme data (i.e. any Scheme object) to/from the port. It |
| 12582 |
also provides operations to force output to occur, to change the way |
| 12583 |
threads block on the port, and to close the port. Note that the class |
| 12584 |
of objects for which write/read invariance is guaranteed depends on |
| 12585 |
the particular class of port. |
| 12586 |
|
| 12587 |
</li><li> |
| 12588 |
A <em>character-port</em> provides all the operations of an object-port, |
| 12589 |
and also operations to read and write individual characters to/from |
| 12590 |
the port. When a Scheme object is written to a character-port, it is |
| 12591 |
converted into the sequence of characters that corresponds to its |
| 12592 |
external-representation. When reading a Scheme object, an inverse |
| 12593 |
conversion occurs. Note that some Scheme objects do not have an |
| 12594 |
external textual representation that can be read back. |
| 12595 |
|
| 12596 |
</li><li> |
| 12597 |
A <em>byte-port</em> provides all the operations of a character-port, and |
| 12598 |
also operations to read and write individual bytes to/from the port. |
| 12599 |
When a character is written to a byte-port, some encoding of that |
| 12600 |
character into a sequence of bytes will occur (for example, |
| 12601 |
<code>#\newline</code> will be encoded as the 2 bytes CR-LF when using |
| 12602 |
ISO-8859-1 character encoding and <code>cr-lf</code> end-of-line encoding, and |
| 12603 |
a non-ASCII character will generate more than 1 byte when using UTF-8 |
| 12604 |
character encoding). When reading a character, a similar decoding |
| 12605 |
occurs. |
| 12606 |
|
| 12607 |
</li><li> |
| 12608 |
A <em>device-port</em> provides all the operations of a byte-port, and |
| 12609 |
also operations to control the operating system managed device (file, |
| 12610 |
network connection, terminal, etc) that is connected to the port. |
| 12611 |
|
| 12612 |
</li></ol> |
| 12613 |
|
| 12614 |
<a name="Port-settings"></a><hr size="6"><br/><br/><br/> |
| 12615 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12616 |
<tr><td valign="middle" align="left"><a href="#Port-classes" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12617 |
<td valign="middle" align="left"><a href="#Object_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12618 |
<td valign="middle" align="left"> </td> |
| 12619 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12620 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12621 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12622 |
<td valign="middle" align="left"> </td> |
| 12623 |
<td valign="middle" align="left"> </td> |
| 12624 |
<td valign="middle" align="left"> </td> |
| 12625 |
<td valign="middle" align="left"> </td> |
| 12626 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12627 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12628 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12629 |
</tr></table> |
| 12630 |
<a name="Port-settings-1"></a> |
| 12631 |
<h2 class="section">17.3 Port settings</h2> |
| 12632 |
|
| 12633 |
<p>Some port settings are only valid for specific port classes whereas |
| 12634 |
some others are valid for all ports. Port settings are specified when |
| 12635 |
a port is created. The settings that are not specified will default |
| 12636 |
to some reasonable values. Keyword objects are used to name the |
| 12637 |
settings to be set. As a simple example, a device-port connected to |
| 12638 |
the file <code>"foo"</code> can be created using the call |
| 12639 |
</p> |
| 12640 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(open-input-file "foo") |
| 12641 |
</pre></td></tr></table> |
| 12642 |
|
| 12643 |
<p>This will use default settings for the character encoding, buffering, |
| 12644 |
etc. If the UTF-8 character encoding is desired, then the port could |
| 12645 |
be opened using the call |
| 12646 |
</p> |
| 12647 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(open-input-file (list path: "foo" char-encoding: 'UTF-8)) |
| 12648 |
</pre></td></tr></table> |
| 12649 |
|
| 12650 |
<p>Here the argument of the procedure <code>open-input-file</code> has been |
| 12651 |
replaced by a <em>port settings list</em> which specifies the value of |
| 12652 |
each port setting that should not be set to the default value. Note |
| 12653 |
that some port settings have no useful default and it is therefore |
| 12654 |
required to specify a value for them, such as the <code>path:</code> in the |
| 12655 |
case of the file opening procedures. All port creation procedures |
| 12656 |
(i.e. named <code>open-...</code>) take a single argument that can either |
| 12657 |
be a port settings list or a value of a type that depends on the kind |
| 12658 |
of port being created (a path string for files, an IP port number for |
| 12659 |
socket servers, etc). |
| 12660 |
</p> |
| 12661 |
<a name="Object_002dports"></a><hr size="6"><br/><br/><br/> |
| 12662 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12663 |
<tr><td valign="middle" align="left"><a href="#Port-settings" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12664 |
<td valign="middle" align="left"><a href="#Object_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12665 |
<td valign="middle" align="left"> </td> |
| 12666 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12667 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12668 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12669 |
<td valign="middle" align="left"> </td> |
| 12670 |
<td valign="middle" align="left"> </td> |
| 12671 |
<td valign="middle" align="left"> </td> |
| 12672 |
<td valign="middle" align="left"> </td> |
| 12673 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12674 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12675 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12676 |
</tr></table> |
| 12677 |
<a name="Object_002dports-1"></a> |
| 12678 |
<h2 class="section">17.4 Object-ports</h2> |
| 12679 |
|
| 12680 |
<table class="menu" border="0" cellspacing="0"> |
| 12681 |
<tr><td align="left" valign="top"><a href="#Object_002dport-settings">17.4.1 Object-port settings</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12682 |
<tr><td align="left" valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 12683 |
</table> |
| 12684 |
|
| 12685 |
<a name="Object_002dport-settings"></a><hr size="6"><br/><br/><br/> |
| 12686 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12687 |
<tr><td valign="middle" align="left"><a href="#Object_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12688 |
<td valign="middle" align="left"><a href="#Object_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12689 |
<td valign="middle" align="left"> </td> |
| 12690 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12691 |
<td valign="middle" align="left"><a href="#Object_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12692 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12693 |
<td valign="middle" align="left"> </td> |
| 12694 |
<td valign="middle" align="left"> </td> |
| 12695 |
<td valign="middle" align="left"> </td> |
| 12696 |
<td valign="middle" align="left"> </td> |
| 12697 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12698 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12699 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12700 |
</tr></table> |
| 12701 |
<a name="Object_002dport-settings-1"></a> |
| 12702 |
<h3 class="subsection">17.4.1 Object-port settings</h3> |
| 12703 |
|
| 12704 |
<p>The following is a list of port settings that are valid for all types |
| 12705 |
of ports. |
| 12706 |
</p> |
| 12707 |
<ul> |
| 12708 |
<li> |
| 12709 |
<code>direction:</code> ( <code>input</code> | <code>output</code> | <code>input-output</code> ) |
| 12710 |
|
| 12711 |
<p>This setting controls the direction of the port. The symbol |
| 12712 |
<code>input</code> indicates a unidirectional input-port, the symbol |
| 12713 |
<code>output</code> indicates a unidirectional output-port, and the symbol |
| 12714 |
<code>input-output</code> indicates a bidirectional port. The default |
| 12715 |
value of this setting depends on the port creation procedure. |
| 12716 |
</p> |
| 12717 |
</li><li> |
| 12718 |
<code>buffering:</code> ( <code>#f</code> | <code>#t</code> | <code>line</code> ) |
| 12719 |
|
| 12720 |
<p>This setting controls the buffering of the port. To set each |
| 12721 |
direction separately the keywords <code>input-buffering:</code> and |
| 12722 |
<code>output-buffering:</code> must be used instead of <code>buffering:</code>. |
| 12723 |
The value <code>#f</code> selects unbuffered I/O, the value <code>#t</code> |
| 12724 |
selects fully buffered I/O, and the symbol <code>line</code> selects line |
| 12725 |
buffered I/O (the output buffer is drained when a <code>#\newline</code> |
| 12726 |
character is written). Line buffered I/O only applies to |
| 12727 |
character-ports. The default value of this setting is operating |
| 12728 |
system dependent except consoles which are unbuffered. |
| 12729 |
</p> |
| 12730 |
</li></ul> |
| 12731 |
|
| 12732 |
<a name="Object_002dport-operations"></a><hr size="6"><br/><br/><br/> |
| 12733 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12734 |
<tr><td valign="middle" align="left"><a href="#Object_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12735 |
<td valign="middle" align="left"><a href="#Character_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12736 |
<td valign="middle" align="left"> </td> |
| 12737 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12738 |
<td valign="middle" align="left"><a href="#Object_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12739 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12740 |
<td valign="middle" align="left"> </td> |
| 12741 |
<td valign="middle" align="left"> </td> |
| 12742 |
<td valign="middle" align="left"> </td> |
| 12743 |
<td valign="middle" align="left"> </td> |
| 12744 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12745 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12746 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12747 |
</tr></table> |
| 12748 |
<a name="Object_002dport-operations-1"></a> |
| 12749 |
<h3 class="subsection">17.4.2 Object-port operations</h3> |
| 12750 |
|
| 12751 |
<a name="Definition_of_input-port?"></a><a name="Procedure_input-port?"></a><a name="index-input_002dport_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port?">input-port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12752 |
<a name="Definition_of_output-port?"></a><a name="Procedure_output-port?"></a><a name="index-output_002dport_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port?">output-port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12753 |
<a name="Definition_of_port?"></a><a name="Procedure_port?"></a><a name="index-port_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_port?">port?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12754 |
|
| 12755 |
<p>The procedure <code>input-port?</code> returns <code>#t</code> when <var>obj</var> is a |
| 12756 |
unidirectional input-port or a bidirectional port and <code>#f</code> |
| 12757 |
otherwise. |
| 12758 |
</p> |
| 12759 |
<p>The procedure <code>output-port?</code> returns <code>#t</code> when <var>obj</var> is a |
| 12760 |
unidirectional output-port or a bidirectional port and <code>#f</code> |
| 12761 |
otherwise. |
| 12762 |
</p> |
| 12763 |
<p>The procedure <code>port?</code> returns <code>#t</code> when <var>obj</var> is a port |
| 12764 |
(either unidirectional or bidirectional) and <code>#f</code> otherwise. |
| 12765 |
</p> |
| 12766 |
<p>For example: |
| 12767 |
</p> |
| 12768 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port? (current-input-port))</b> |
| 12769 |
#t |
| 12770 |
> <b>(call-with-input-string "some text" output-port?)</b> |
| 12771 |
#f |
| 12772 |
> <b>(port? (current-output-port))</b> |
| 12773 |
#t |
| 12774 |
</pre></td></tr></table> |
| 12775 |
|
| 12776 |
|
| 12777 |
|
| 12778 |
<a name="Definition_of_read"></a><a name="Procedure_read"></a><a name="index-read"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read">read</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12779 |
|
| 12780 |
<p>This procedure reads and returns the next Scheme datum from the |
| 12781 |
input-port <var>port</var>. The end-of-file object is returned when the |
| 12782 |
end of the stream is reached. If it is not specified, <var>port</var> |
| 12783 |
defaults to the current input-port. |
| 12784 |
</p> |
| 12785 |
<p>For example: |
| 12786 |
</p> |
| 12787 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string "some text" read)</b> |
| 12788 |
some |
| 12789 |
> <b>(call-with-input-string "" read)</b> |
| 12790 |
#!eof |
| 12791 |
</pre></td></tr></table> |
| 12792 |
|
| 12793 |
|
| 12794 |
|
| 12795 |
<a name="Definition_of_read-all"></a><a name="Procedure_read-all"></a><a name="index-read_002dall"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-all">read-all</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>reader</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12796 |
|
| 12797 |
<p>This procedure repeatedly calls the procedure <var>reader</var> with |
| 12798 |
<var>port</var> as the sole argument and accumulates a list of each value |
| 12799 |
returned up to the end-of-file object. The procedure <code>read-all</code> |
| 12800 |
returns the accumulated list without the end-of-file object. If it is |
| 12801 |
not specified, <var>port</var> defaults to the current input-port. If it |
| 12802 |
is not specified, <var>reader</var> defaults to the procedure <code>read</code>. |
| 12803 |
</p> |
| 12804 |
<p>For example: |
| 12805 |
</p> |
| 12806 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string "3,2,1\ngo!" read-all)</b> |
| 12807 |
(3 ,2 ,1 go!) |
| 12808 |
> <b>(call-with-input-string "3,2,1\ngo!" |
| 12809 |
(lambda (p) (read-all p read-char)))</b> |
| 12810 |
(#\3 #\, #\2 #\, #\1 #\newline #\g #\o #\!) |
| 12811 |
> <b>(call-with-input-string "3,2,1\ngo!" |
| 12812 |
(lambda (p) (read-all p read-line)))</b> |
| 12813 |
("3,2,1" "go!") |
| 12814 |
</pre></td></tr></table> |
| 12815 |
|
| 12816 |
|
| 12817 |
|
| 12818 |
<a name="Definition_of_write"></a><a name="Procedure_write"></a><a name="index-write"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_write">write</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12819 |
|
| 12820 |
<p>This procedure writes the Scheme datum <var>obj</var> to the output-port |
| 12821 |
<var>port</var> and the value returned is unspecified. If it is not |
| 12822 |
specified, <var>port</var> defaults to the current output-port. |
| 12823 |
</p> |
| 12824 |
<p>For example: |
| 12825 |
</p> |
| 12826 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(write (list 'compare (list 'quote '@x) 'and (list 'unquote '@x))) </b> |
| 12827 |
(compare '@x and , @x)> |
| 12828 |
</pre></td></tr></table> |
| 12829 |
|
| 12830 |
|
| 12831 |
|
| 12832 |
<a name="Definition_of_newline"></a><a name="Procedure_newline"></a><a name="index-newline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_newline">newline</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12833 |
|
| 12834 |
<p>This procedure writes an “object separator” to the output-port |
| 12835 |
<var>port</var> and the value returned is unspecified. The separator |
| 12836 |
ensures that the next Scheme datum written with the <code>write</code> |
| 12837 |
procedure will not be confused with the latest datum that was written. |
| 12838 |
On character-ports this is done by writing the character |
| 12839 |
<code>#\newline</code>. On ports where successive objects are implicitly |
| 12840 |
distinct (such as “vector ports”) this procedure does nothing. |
| 12841 |
</p> |
| 12842 |
<p>Regardless of the class of a port <var>p</var> and assuming that the |
| 12843 |
external textual representation of the object <var>x</var> is readable, the |
| 12844 |
expression <code>(begin (write <var>x</var> <var>p</var>) (newline <var>p</var>))</code> |
| 12845 |
will write to <var>p</var> a representation of <var>x</var> that can be read |
| 12846 |
back with the procedure <code>read</code>. If it is not specified, |
| 12847 |
<var>port</var> defaults to the current output-port. |
| 12848 |
</p> |
| 12849 |
<p>For example: |
| 12850 |
</p> |
| 12851 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(begin (write 123) (newline) (write 456) (newline))</b> |
| 12852 |
123 |
| 12853 |
456 |
| 12854 |
</pre></td></tr></table> |
| 12855 |
|
| 12856 |
|
| 12857 |
|
| 12858 |
<a name="Definition_of_force-output"></a><a name="Procedure_force-output"></a><a name="index-force_002doutput"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_force-output">force-output</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>level</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12859 |
|
| 12860 |
<p>The procedure <code>force-output</code> causes the data that was written to |
| 12861 |
the output-port <var>port</var> to be moved closer to its destination |
| 12862 |
according to <var>level</var>, an exact integer in the range 0 to 2. If |
| 12863 |
<var>port</var> is not specified, the current output-port is used. If |
| 12864 |
<var>level</var> is not specified, it defaults to 0. Values of <var>level</var> |
| 12865 |
above 0 are equivalent to <var>level</var> = 0 except for device ports as |
| 12866 |
explained below. |
| 12867 |
</p> |
| 12868 |
<p>When <var>level</var> is 0, the output buffers of <var>port</var> which are |
| 12869 |
managed in the Scheme process are drained (i.e. the output operation |
| 12870 |
that was delayed due to buffering is actually performed). In the case |
| 12871 |
of a device port the data is passed to the operating system and it |
| 12872 |
becomes its responsibility to transmit the data to the device. The |
| 12873 |
operating system may implement its own buffering approach which delays |
| 12874 |
the transmission of the data to the device. |
| 12875 |
</p> |
| 12876 |
<p>When <var>level</var> is 1, in addition to the operations for <var>level</var> = |
| 12877 |
0 and if the operating system supports the functionality, the |
| 12878 |
operating system is requested to transmit the data to the device. On |
| 12879 |
UNIX this corresponds to a <code>fsync</code> system call. |
| 12880 |
</p> |
| 12881 |
<p>When <var>level</var> is 2, in addition to the operations for <var>level</var> = |
| 12882 |
1 and if the operating system supports the functionality, the |
| 12883 |
operating system is requested to wait until the device reports that |
| 12884 |
the data was saved by the device (e.g. actually written to disk in the |
| 12885 |
case of a file). This operation can take a long time on some |
| 12886 |
operating systems. On Mac OS X this corresponds to a <code>fcntl</code> |
| 12887 |
system call with operation <code>F_FULLFSYNC</code>. |
| 12888 |
</p> |
| 12889 |
<p>For example: |
| 12890 |
</p> |
| 12891 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client "www.iro.umontreal.ca:80"))</b> |
| 12892 |
> <b>(display "GET /\n" p)</b> |
| 12893 |
> <b>(force-output p)</b> |
| 12894 |
> <b>(read-line p)</b> |
| 12895 |
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"" |
| 12896 |
</pre></td></tr></table> |
| 12897 |
|
| 12898 |
|
| 12899 |
|
| 12900 |
<a name="Definition_of_close-input-port"></a><a name="Procedure_close-input-port"></a><a name="index-close_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_close-input-port">close-input-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12901 |
<a name="Definition_of_close-output-port"></a><a name="Procedure_close-output-port"></a><a name="index-close_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_close-output-port">close-output-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12902 |
<a name="Definition_of_close-port"></a><a name="Procedure_close-port"></a><a name="index-close_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_close-port">close-port</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12903 |
|
| 12904 |
<p>The <var>port</var> argument of these procedures must be a unidirectional |
| 12905 |
or a bidirectional port. For all three procedures the value returned |
| 12906 |
is unspecified. |
| 12907 |
</p> |
| 12908 |
<p>The procedure <code>close-input-port</code> closes the input-port side of |
| 12909 |
<var>port</var>, which must not be a unidirectional output-port. |
| 12910 |
</p> |
| 12911 |
<p>The procedure <code>close-output-port</code> closes the output-port side of |
| 12912 |
<var>port</var>, which must not be a unidirectional input-port. The ouput |
| 12913 |
buffers are drained before <var>port</var> is closed. |
| 12914 |
</p> |
| 12915 |
<p>The procedure <code>close-port</code> closes all sides of the <var>port</var>. |
| 12916 |
Unless <var>port</var> is a unidirectional input-port, the output buffers |
| 12917 |
are drained before <var>port</var> is closed. |
| 12918 |
</p> |
| 12919 |
<p>For example: |
| 12920 |
</p> |
| 12921 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client "www.iro.umontreal.ca:80"))</b> |
| 12922 |
> <b>(display "GET /\n" p)</b> |
| 12923 |
> <b>(close-output-port p)</b> |
| 12924 |
> <b>(read-line p)</b> |
| 12925 |
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"" |
| 12926 |
</pre></td></tr></table> |
| 12927 |
|
| 12928 |
|
| 12929 |
|
| 12930 |
<a name="Definition_of_input-port-timeout-set!"></a><a name="Procedure_input-port-timeout-set!"></a><a name="index-input_002dport_002dtimeout_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-timeout-set!">input-port-timeout-set!</a></b></code><i> <var>port</var> <var>timeout</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12931 |
<a name="Definition_of_output-port-timeout-set!"></a><a name="Procedure_output-port-timeout-set!"></a><a name="index-output_002dport_002dtimeout_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-timeout-set!">output-port-timeout-set!</a></b></code><i> <var>port</var> <var>timeout</var> <span class="roman">[</span><var>thunk</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 12932 |
|
| 12933 |
<p>When a thread tries to perform an I/O operation on a port, the |
| 12934 |
requested operation may not be immediately possible and the thread |
| 12935 |
must wait. For example, the thread may be trying to read a line of |
| 12936 |
text from the console and the user has not typed anything yet, or the |
| 12937 |
thread may be trying to write to a network connection faster than the |
| 12938 |
network can handle. In such situations the thread normally blocks |
| 12939 |
until the operation becomes possible. |
| 12940 |
</p> |
| 12941 |
<p>It is sometimes necessary to guarantee that the thread will not block |
| 12942 |
too long. For this purpose, to each input-port and output-port is |
| 12943 |
attached a <em>timeout</em> and <em>timeout-thunk</em>. The timeout |
| 12944 |
indicates the point in time beyond which the thread should stop |
| 12945 |
waiting on an input and output operation respectively. When the |
| 12946 |
timeout is reached, the thread calls the port’s timeout-thunk. If the |
| 12947 |
timeout-thunk returns <code>#f</code> the thread abandons trying to perform |
| 12948 |
the operation (in the case of an input operation an end-of-file is |
| 12949 |
read and in the case of an output operation an exception is raised). |
| 12950 |
Otherwise, the thread will block again waiting for the operation to |
| 12951 |
become possible (note that if the port’s timeout has not changed the |
| 12952 |
thread will immediately call the timeout-thunk again). |
| 12953 |
</p> |
| 12954 |
<p>The procedure <code>input-port-timeout-set!</code> sets the timeout of the |
| 12955 |
input-port <var>port</var> to <var>timeout</var> and the timeout-thunk to |
| 12956 |
<var>thunk</var>. The procedure <code>output-port-timeout-set!</code> sets the |
| 12957 |
timeout of the output-port <var>port</var> to <var>timeout</var> and the |
| 12958 |
timeout-thunk to <var>thunk</var>. If it is not specified, the <var>thunk</var> |
| 12959 |
defaults to a thunk that returns <code>#f</code>. The <var>timeout</var> is |
| 12960 |
either a time object indicating an absolute point in time, or it is a |
| 12961 |
real number which indicates the number of seconds relative to the |
| 12962 |
moment the procedure is called. For both procedures the value |
| 12963 |
returned is unspecified. |
| 12964 |
</p> |
| 12965 |
<p>When a port is created the timeout is set to infinity (<code>+inf.0</code>). |
| 12966 |
This causes the thread to wait as long as needed for the operation to |
| 12967 |
become possible. Setting the timeout to a point in the past |
| 12968 |
(<code>-inf.0</code>) will cause the thread to attempt the I/O operation and |
| 12969 |
never block (i.e. the timeout-thunk is called if the operation is not |
| 12970 |
immediately possible). |
| 12971 |
</p> |
| 12972 |
<p>The following example shows how to cause the REPL to terminate |
| 12973 |
when the user does not enter an expression within the next 60 seconds. |
| 12974 |
</p> |
| 12975 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-timeout-set! (repl-input-port) 60)</b> |
| 12976 |
> |
| 12977 |
*** EOF again to exit |
| 12978 |
</pre></td></tr></table> |
| 12979 |
|
| 12980 |
|
| 12981 |
|
| 12982 |
<a name="Character_002dports"></a><hr size="6"><br/><br/><br/> |
| 12983 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 12984 |
<tr><td valign="middle" align="left"><a href="#Object_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 12985 |
<td valign="middle" align="left"><a href="#Character_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 12986 |
<td valign="middle" align="left"> </td> |
| 12987 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 12988 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 12989 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 12990 |
<td valign="middle" align="left"> </td> |
| 12991 |
<td valign="middle" align="left"> </td> |
| 12992 |
<td valign="middle" align="left"> </td> |
| 12993 |
<td valign="middle" align="left"> </td> |
| 12994 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 12995 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 12996 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 12997 |
</tr></table> |
| 12998 |
<a name="Character_002dports-1"></a> |
| 12999 |
<h2 class="section">17.5 Character-ports</h2> |
| 13000 |
|
| 13001 |
<table class="menu" border="0" cellspacing="0"> |
| 13002 |
<tr><td align="left" valign="top"><a href="#Character_002dport-settings">17.5.1 Character-port settings</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13003 |
<tr><td align="left" valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13004 |
</table> |
| 13005 |
|
| 13006 |
<a name="Character_002dport-settings"></a><hr size="6"><br/><br/><br/> |
| 13007 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13008 |
<tr><td valign="middle" align="left"><a href="#Character_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13009 |
<td valign="middle" align="left"><a href="#Character_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13010 |
<td valign="middle" align="left"> </td> |
| 13011 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13012 |
<td valign="middle" align="left"><a href="#Character_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13013 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13014 |
<td valign="middle" align="left"> </td> |
| 13015 |
<td valign="middle" align="left"> </td> |
| 13016 |
<td valign="middle" align="left"> </td> |
| 13017 |
<td valign="middle" align="left"> </td> |
| 13018 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13019 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13020 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13021 |
</tr></table> |
| 13022 |
<a name="Character_002dport-settings-1"></a> |
| 13023 |
<h3 class="subsection">17.5.1 Character-port settings</h3> |
| 13024 |
|
| 13025 |
<p>The following is a list of port settings that are valid for |
| 13026 |
character-ports. |
| 13027 |
</p> |
| 13028 |
<ul> |
| 13029 |
<li> |
| 13030 |
<code>readtable:</code> <var>readtable</var> |
| 13031 |
|
| 13032 |
<p>This setting determines the readtable attached to the character-port. |
| 13033 |
To set each direction separately the keywords <code>input-readtable:</code> |
| 13034 |
and <code>output-readtable:</code> must be used instead of |
| 13035 |
<code>readtable:</code>. Readtables control the external textual |
| 13036 |
representation of Scheme objects, that is the encoding of Scheme |
| 13037 |
objects using characters. The behavior of the <code>read</code> procedure |
| 13038 |
depends on the port’s input-readtable and the behavior of the |
| 13039 |
procedures <code>write</code>, <code>pretty-print</code>, and related procedures |
| 13040 |
is affected by the port’s output-readtable. The default value of this |
| 13041 |
setting is the value bound to the parameter object |
| 13042 |
<code>current-readtable</code>. |
| 13043 |
</p> |
| 13044 |
</li><li> |
| 13045 |
<code>output-width:</code> <var>positive-integer</var> |
| 13046 |
|
| 13047 |
<p>This setting indicates the width of the character output-port in |
| 13048 |
number of characters. This information is used by the pretty-printer. |
| 13049 |
The default value of this setting is 80. |
| 13050 |
</p> |
| 13051 |
</li></ul> |
| 13052 |
|
| 13053 |
<a name="Character_002dport-operations"></a><hr size="6"><br/><br/><br/> |
| 13054 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13055 |
<tr><td valign="middle" align="left"><a href="#Character_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13056 |
<td valign="middle" align="left"><a href="#Byte_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13057 |
<td valign="middle" align="left"> </td> |
| 13058 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13059 |
<td valign="middle" align="left"><a href="#Character_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13060 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13061 |
<td valign="middle" align="left"> </td> |
| 13062 |
<td valign="middle" align="left"> </td> |
| 13063 |
<td valign="middle" align="left"> </td> |
| 13064 |
<td valign="middle" align="left"> </td> |
| 13065 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13066 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13067 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13068 |
</tr></table> |
| 13069 |
<a name="Character_002dport-operations-1"></a> |
| 13070 |
<h3 class="subsection">17.5.2 Character-port operations</h3> |
| 13071 |
|
| 13072 |
<a name="Definition_of_input-port-line"></a><a name="Procedure_input-port-line"></a><a name="index-input_002dport_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-line">input-port-line</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13073 |
<a name="Definition_of_input-port-column"></a><a name="Procedure_input-port-column"></a><a name="index-input_002dport_002dcolumn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-column">input-port-column</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13074 |
<a name="Definition_of_output-port-line"></a><a name="Procedure_output-port-line"></a><a name="index-output_002dport_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-line">output-port-line</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13075 |
<a name="Definition_of_output-port-column"></a><a name="Procedure_output-port-column"></a><a name="index-output_002dport_002dcolumn"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-column">output-port-column</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13076 |
|
| 13077 |
<p>The current character location of a character input-port is the |
| 13078 |
location of the next character to read. The current character |
| 13079 |
location of a character output-port is the location of the next |
| 13080 |
character to write. Location is denoted by a line number (the first |
| 13081 |
line is line 1) and a column number, that is the location on the |
| 13082 |
current line (the first column is column 1). The procedures |
| 13083 |
<code>input-port-line</code> and <code>input-port-column</code> return the line |
| 13084 |
location and the column location respectively of the character |
| 13085 |
input-port <var>port</var>. The procedures <code>output-port-line</code> and |
| 13086 |
<code>output-port-column</code> return the line location and the column |
| 13087 |
location respectively of the character output-port <var>port</var>. |
| 13088 |
</p> |
| 13089 |
<p>For example: |
| 13090 |
</p> |
| 13091 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-output-string |
| 13092 |
'() |
| 13093 |
(lambda (p) |
| 13094 |
(display "abc\n123def" p) |
| 13095 |
(write (list (output-port-line p) (output-port-column p)) |
| 13096 |
p)))</b> |
| 13097 |
"abc\n123def(2 7)" |
| 13098 |
</pre></td></tr></table> |
| 13099 |
|
| 13100 |
|
| 13101 |
|
| 13102 |
<a name="Definition_of_output-port-width"></a><a name="Procedure_output-port-width"></a><a name="index-output_002dport_002dwidth"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-width">output-port-width</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13103 |
|
| 13104 |
<p>This procedure returns the width, in characters, of the character |
| 13105 |
output-port <var>port</var>. The value returned is the port’s output-width |
| 13106 |
setting. |
| 13107 |
</p> |
| 13108 |
<p>For example: |
| 13109 |
</p> |
| 13110 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-width (repl-output-port))</b> |
| 13111 |
80 |
| 13112 |
</pre></td></tr></table> |
| 13113 |
|
| 13114 |
|
| 13115 |
|
| 13116 |
<a name="Definition_of_read-char"></a><a name="Procedure_read-char"></a><a name="index-read_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-char">read-char</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13117 |
|
| 13118 |
<p>This procedure reads the character input-port <var>port</var> and returns |
| 13119 |
the character at the current character location and advances the |
| 13120 |
current character location to the next character, unless the |
| 13121 |
<var>port</var> is already at end-of-file in which case <code>read-char</code> |
| 13122 |
returns the end-of-file object. If it is not specified, <var>port</var> |
| 13123 |
defaults to the current input-port. |
| 13124 |
</p> |
| 13125 |
<p>For example: |
| 13126 |
</p> |
| 13127 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string |
| 13128 |
"some text" |
| 13129 |
(lambda (p) |
| 13130 |
(let ((a (read-char p))) (list a (read-char p)))))</b> |
| 13131 |
(#\s #\o) |
| 13132 |
> <b>(call-with-input-string "" read-char)</b> |
| 13133 |
#!eof |
| 13134 |
</pre></td></tr></table> |
| 13135 |
|
| 13136 |
|
| 13137 |
|
| 13138 |
<a name="Definition_of_peek-char"></a><a name="Procedure_peek-char"></a><a name="index-peek_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_peek-char">peek-char</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13139 |
|
| 13140 |
<p>This procedure returns the same result as <code>read-char</code> but it does |
| 13141 |
not advance the current character location of the input-port |
| 13142 |
<var>port</var>. If it is not specified, <var>port</var> defaults to the |
| 13143 |
current input-port. |
| 13144 |
</p> |
| 13145 |
<p>For example: |
| 13146 |
</p> |
| 13147 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-string |
| 13148 |
"some text" |
| 13149 |
(lambda (p) |
| 13150 |
(let ((a (peek-char p))) (list a (read-char p)))))</b> |
| 13151 |
(#\s #\s) |
| 13152 |
> <b>(call-with-input-string "" peek-char)</b> |
| 13153 |
#!eof |
| 13154 |
</pre></td></tr></table> |
| 13155 |
|
| 13156 |
|
| 13157 |
|
| 13158 |
<a name="Definition_of_write-char"></a><a name="Procedure_write-char"></a><a name="index-write_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_write-char">write-char</a></b></code><i> <var>char</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13159 |
|
| 13160 |
<p>This procedure writes the character <var>char</var> to the character |
| 13161 |
output-port <var>port</var> and advances the current character location of |
| 13162 |
that output-port. The value returned is unspecified. If it is not |
| 13163 |
specified, <var>port</var> defaults to the current output-port. |
| 13164 |
</p> |
| 13165 |
<p>For example: |
| 13166 |
</p> |
| 13167 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(write-char #\=)</b> |
| 13168 |
=> |
| 13169 |
</pre></td></tr></table> |
| 13170 |
|
| 13171 |
|
| 13172 |
|
| 13173 |
<a name="Definition_of_read-line"></a><a name="Procedure_read-line"></a><a name="index-read_002dline"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-line">read-line</a></b></code><i> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>separator</var> <span class="roman">[</span><var>include-separator?</var> <span class="roman">[</span><var>max-length</var><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13174 |
|
| 13175 |
<p>This procedure reads characters from the character input-port |
| 13176 |
<var>port</var> until a specific <var>separator</var> or the end-of-file is |
| 13177 |
encountered and returns a string containing the sequence of characters |
| 13178 |
read. If it is specified, <var>max-length</var> must be a nonnegative |
| 13179 |
exact integer and it places an upper limit on the number of characters |
| 13180 |
that are read. |
| 13181 |
</p> |
| 13182 |
<p>The <var>separator</var> is included at the end of the string only |
| 13183 |
if it was the last character read and <var>include-separator?</var> is not |
| 13184 |
<code>#f</code>. The <var>separator</var> must be a character or <code>#f</code> (in |
| 13185 |
which case all the characters until the end-of-file are read). If it |
| 13186 |
is not specified, <var>port</var> defaults to the current input-port. If |
| 13187 |
it is not specified, <var>separator</var> defaults to <code>#\newline</code>. If |
| 13188 |
it is not specified, <var>include-separator?</var> defaults to <code>#f</code>. |
| 13189 |
</p> |
| 13190 |
<p>For example: |
| 13191 |
</p> |
| 13192 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (split sep) |
| 13193 |
(lambda (str) |
| 13194 |
(call-with-input-string |
| 13195 |
str |
| 13196 |
(lambda (p) |
| 13197 |
(read-all p (lambda (p) (read-line p sep)))))))</b> |
| 13198 |
> <b>((split #\,) "a,b,c")</b> |
| 13199 |
("a" "b" "c") |
| 13200 |
> <b>(map (split #\,) |
| 13201 |
(call-with-input-string "1,2,3\n4,5" |
| 13202 |
(lambda (p) (read-all p read-line))))</b> |
| 13203 |
(("1" "2" "3") ("4" "5")) |
| 13204 |
> <b>(read-line (current-input-port) #\newline #f 2)1234</b> |
| 13205 |
"12" |
| 13206 |
> 34 |
| 13207 |
</pre></td></tr></table> |
| 13208 |
|
| 13209 |
|
| 13210 |
|
| 13211 |
<a name="Definition_of_read-substring"></a><a name="Procedure_read-substring"></a><a name="index-read_002dsubstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-substring">read-substring</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>need</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13212 |
<a name="Definition_of_write-substring"></a><a name="Procedure_write-substring"></a><a name="index-write_002dsubstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_write-substring">write-substring</a></b></code><i> <var>string</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13213 |
|
| 13214 |
<p>These procedures support bulk character I/O. The part of the string |
| 13215 |
<var>string</var> starting at index <var>start</var> and ending just before |
| 13216 |
index <var>end</var> is used as a character buffer that will be the target |
| 13217 |
of <code>read-substring</code> or the source of the <code>write-substring</code>. |
| 13218 |
The <code>read-substring</code> also accepts a <var>need</var> parameter which |
| 13219 |
must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> characters |
| 13220 |
will be transferred. The number of characters transferred, possibly |
| 13221 |
zero, is returned by these procedures. Fewer characters will be read |
| 13222 |
by <code>read-substring</code> if an end-of-file is read, or a timeout |
| 13223 |
occurs before all the requested characters are transferred and the |
| 13224 |
timeout thunk returns <code>#f</code> (see the procedure |
| 13225 |
<code>input-port-timeout-set!</code>), or <var>need</var> is specified and at |
| 13226 |
least that many characters have been read (in other words the |
| 13227 |
procedure does not block for more characters but may transfer more |
| 13228 |
characters if they are immediately available). Fewer characters will |
| 13229 |
be written by <code>write-substring</code> if a timeout occurs before all |
| 13230 |
the requested characters are transferred and the timeout thunk returns |
| 13231 |
<code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it |
| 13232 |
is not specified, <var>port</var> defaults to the current input-port and |
| 13233 |
current output-port respectively. |
| 13234 |
</p> |
| 13235 |
<p>For example: |
| 13236 |
</p> |
| 13237 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (make-string 10 #\x))</b> |
| 13238 |
> <b>(read-substring s 2 5)123456789</b> |
| 13239 |
3 |
| 13240 |
> 456789 |
| 13241 |
> <b>s</b> |
| 13242 |
"xx123xxxxx" |
| 13243 |
> <b>(read-substring s 2 10 (current-input-port) 3)abcd</b> |
| 13244 |
5 |
| 13245 |
> <b>s</b> |
| 13246 |
"xxabcd\nxxx" |
| 13247 |
</pre></td></tr></table> |
| 13248 |
|
| 13249 |
|
| 13250 |
|
| 13251 |
<a name="Definition_of_input-port-readtable"></a><a name="Procedure_input-port-readtable"></a><a name="index-input_002dport_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-readtable">input-port-readtable</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13252 |
<a name="Definition_of_output-port-readtable"></a><a name="Procedure_output-port-readtable"></a><a name="index-output_002dport_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-readtable">output-port-readtable</a></b></code><i> <var>port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13253 |
|
| 13254 |
<p>These procedures return the readtable attached to the character-port |
| 13255 |
<var>port</var>. The <var>port</var> parameter of <code>input-port-readtable</code> |
| 13256 |
must be an input-port. The <var>port</var> parameter of |
| 13257 |
<code>output-port-readtable</code> must be an output-port. |
| 13258 |
</p> |
| 13259 |
|
| 13260 |
|
| 13261 |
<a name="Definition_of_input-port-readtable-set!"></a><a name="Procedure_input-port-readtable-set!"></a><a name="index-input_002dport_002dreadtable_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-readtable-set!">input-port-readtable-set!</a></b></code><i> <var>port</var> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13262 |
<a name="Definition_of_output-port-readtable-set!"></a><a name="Procedure_output-port-readtable-set!"></a><a name="index-output_002dport_002dreadtable_002dset_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-readtable-set!">output-port-readtable-set!</a></b></code><i> <var>port</var> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13263 |
|
| 13264 |
<p>These procedures change the readtable attached to the character-port |
| 13265 |
<var>port</var> to the readtable <var>readtable</var>. The <var>port</var> parameter |
| 13266 |
of <code>input-port-readtable-set!</code> must be an input-port. The |
| 13267 |
<var>port</var> parameter of <code>output-port-readtable-set!</code> must be an |
| 13268 |
output-port. The value returned is unspecified. |
| 13269 |
</p> |
| 13270 |
|
| 13271 |
|
| 13272 |
<a name="Byte_002dports"></a><hr size="6"><br/><br/><br/> |
| 13273 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13274 |
<tr><td valign="middle" align="left"><a href="#Character_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13275 |
<td valign="middle" align="left"><a href="#Byte_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13276 |
<td valign="middle" align="left"> </td> |
| 13277 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13278 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13279 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13280 |
<td valign="middle" align="left"> </td> |
| 13281 |
<td valign="middle" align="left"> </td> |
| 13282 |
<td valign="middle" align="left"> </td> |
| 13283 |
<td valign="middle" align="left"> </td> |
| 13284 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13285 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13286 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13287 |
</tr></table> |
| 13288 |
<a name="Byte_002dports-1"></a> |
| 13289 |
<h2 class="section">17.6 Byte-ports</h2> |
| 13290 |
|
| 13291 |
<table class="menu" border="0" cellspacing="0"> |
| 13292 |
<tr><td align="left" valign="top"><a href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13293 |
<tr><td align="left" valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13294 |
</table> |
| 13295 |
|
| 13296 |
<a name="Byte_002dport-settings"></a><hr size="6"><br/><br/><br/> |
| 13297 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13298 |
<tr><td valign="middle" align="left"><a href="#Byte_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13299 |
<td valign="middle" align="left"><a href="#Byte_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13300 |
<td valign="middle" align="left"> </td> |
| 13301 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13302 |
<td valign="middle" align="left"><a href="#Byte_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13303 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13304 |
<td valign="middle" align="left"> </td> |
| 13305 |
<td valign="middle" align="left"> </td> |
| 13306 |
<td valign="middle" align="left"> </td> |
| 13307 |
<td valign="middle" align="left"> </td> |
| 13308 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13309 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13310 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13311 |
</tr></table> |
| 13312 |
<a name="Byte_002dport-settings-1"></a> |
| 13313 |
<h3 class="subsection">17.6.1 Byte-port settings</h3> |
| 13314 |
|
| 13315 |
<p>The following is a list of port settings that are valid for |
| 13316 |
byte-ports. |
| 13317 |
</p> |
| 13318 |
<ul> |
| 13319 |
<li> |
| 13320 |
<code>char-encoding:</code> <var>encoding</var> |
| 13321 |
|
| 13322 |
<p>This setting controls the character encoding of the byte-port. For |
| 13323 |
bidirectional byte-ports, the character encoding for input and output |
| 13324 |
is set. To set each direction separately the keywords |
| 13325 |
<code>input-char-encoding:</code> and <code>output-char-encoding:</code> must be |
| 13326 |
used instead of <code>char-encoding:</code>. The default value of this |
| 13327 |
setting is operating system dependent, but this can be overridden |
| 13328 |
through the runtime options (see section <a href="#Runtime-options">Runtime options</a>). The following |
| 13329 |
encodings are supported: |
| 13330 |
</p> |
| 13331 |
<dl compact="compact"> |
| 13332 |
<dt> <code>ISO-8859-1</code></dt> |
| 13333 |
<dd><p>ISO-8859-1 character encoding. Each character is encoded by a single byte. |
| 13334 |
Only Unicode characters with a code in the range 0 to 255 are allowed. |
| 13335 |
</p> |
| 13336 |
</dd> |
| 13337 |
<dt> <code>ASCII</code></dt> |
| 13338 |
<dd><p>ASCII character encoding. Each character is encoded by a single byte. |
| 13339 |
In principle only Unicode characters with a code in the range 0 to 127 |
| 13340 |
are allowed but most types of ports treat this exactly like <code>ISO-8859-1</code>. |
| 13341 |
</p> |
| 13342 |
</dd> |
| 13343 |
<dt> <code>UTF-8</code></dt> |
| 13344 |
<dd><p>UTF-8 character encoding. Each character is encoded by a sequence of one |
| 13345 |
to four bytes. The minimum length UTF-8 encoding is used. If a BOM is |
| 13346 |
needed at the beginning of the stream then it must be explicitly |
| 13347 |
written. |
| 13348 |
</p> |
| 13349 |
</dd> |
| 13350 |
<dt> <code>UTF-16</code></dt> |
| 13351 |
<dd><p>UTF-16 character encoding. Each character is encoded by one or two 16 |
| 13352 |
bit integers (2 or 4 bytes). The 16 bit integers may be encoded using |
| 13353 |
little-endian encoding or big-endian encoding. If the port is an |
| 13354 |
input-port and the first two bytes read are a BOM (“Byte Order Mark” |
| 13355 |
character with hexadecimal code FEFF) then the BOM will be discarded |
| 13356 |
and the endianness will be set accordingly, otherwise the endianness |
| 13357 |
depends on the operating system and how the Gambit runtime was |
| 13358 |
compiled. If the port is an output-port then a BOM will be output at |
| 13359 |
the beginning of the stream and the endianness depends on the |
| 13360 |
operating system and how the Gambit runtime was compiled. |
| 13361 |
</p> |
| 13362 |
</dd> |
| 13363 |
<dt> <code>UTF-16LE</code></dt> |
| 13364 |
<dd><p>UTF-16 character encoding with little-endian endianness. It is like |
| 13365 |
<code>UTF-16</code> except the endianness is set to little-endian and there is no |
| 13366 |
BOM processing. If a BOM is needed at the beginning of the stream |
| 13367 |
then it must be explicitly written. |
| 13368 |
</p> |
| 13369 |
</dd> |
| 13370 |
<dt> <code>UTF-16BE</code></dt> |
| 13371 |
<dd><p>UTF-16 character encoding with big-endian endianness. It is like |
| 13372 |
<code>UTF-16LE</code> except the endianness is set to big-endian. |
| 13373 |
</p> |
| 13374 |
</dd> |
| 13375 |
<dt> <code>UTF / UTF-fallback-ASCII / UTF-fallback-ISO-8859-1 / UTF-fallback-UTF-16 / UTF-fallback-UTF-16LE / UTF-fallback-UTF-16BE</code></dt> |
| 13376 |
<dd><p>These encodings combine the UTF-8 and UTF-16 encodings. When one of |
| 13377 |
these character encodings is used for an output port, characters will |
| 13378 |
be encoded using the UTF-8 encoding. The first character, if there is |
| 13379 |
one, is prefixed with a UTF-8 BOM (the three byte sequence EF BB BF in |
| 13380 |
hexadecimal). When one of these character encodings is used for an |
| 13381 |
input port, the character encoding depends on the first few bytes. If |
| 13382 |
the first bytes of the stream are a UTF-16LE BOM (FF FE in |
| 13383 |
hexadecimal), or a UTF-16BE BOM (FE FF in hexadecimal), or a UTF-8 BOM |
| 13384 |
(EF BB BF in hexadecimal), then the BOM is discarded and the remaining |
| 13385 |
bytes of the stream are decoded using the corresponding character |
| 13386 |
encoding. If a BOM is not present, then the stream is decoded using |
| 13387 |
the fallback encoding specified. The encoding <code>UTF</code> is a synonym |
| 13388 |
for <code>UTF-fallback-UTF-8</code>. Note that the <code>UTF</code> character |
| 13389 |
encoding for input will correctly handle streams produced using the |
| 13390 |
encodings <code>UTF</code>, <code>UTF-8</code>, <code>UTF-16</code>, <code>ASCII</code>, and |
| 13391 |
if an explicit BOM is output, the encodings <code>UTF-16LE</code>, and |
| 13392 |
<code>UTF-16BE</code>. |
| 13393 |
</p> |
| 13394 |
</dd> |
| 13395 |
<dt> <code>UCS-2</code></dt> |
| 13396 |
<dd><p>UCS-2 character encoding. Each character is encoded by a 16 bit |
| 13397 |
integer (2 bytes). The 16 bit integers may be encoded using |
| 13398 |
little-endian encoding or big-endian encoding. If the port is an |
| 13399 |
input-port and the first two bytes read are a BOM (“Byte Order Mark” |
| 13400 |
character with hexadecimal code FEFF) then the BOM will be discarded |
| 13401 |
and the endianness will be set accordingly, otherwise the endianness |
| 13402 |
depends on the operating system and how the Gambit runtime was |
| 13403 |
compiled. If the port is an output-port then a BOM will be output at |
| 13404 |
the beginning of the stream and the endianness depends on the |
| 13405 |
operating system and how the Gambit runtime was compiled. |
| 13406 |
</p> |
| 13407 |
</dd> |
| 13408 |
<dt> <code>UCS-2LE</code></dt> |
| 13409 |
<dd><p>UCS-2 character encoding with little-endian endianness. It is like |
| 13410 |
<code>UCS-2</code> except the endianness is set to little-endian and there is no |
| 13411 |
BOM processing. If a BOM is needed at the beginning of the stream |
| 13412 |
then it must be explicitly written. |
| 13413 |
</p> |
| 13414 |
</dd> |
| 13415 |
<dt> <code>UCS-2BE</code></dt> |
| 13416 |
<dd><p>UCS-2 character encoding with big-endian endianness. It is like |
| 13417 |
<code>UCS-2LE</code> except the endianness is set to big-endian. |
| 13418 |
</p> |
| 13419 |
</dd> |
| 13420 |
<dt> <code>UCS-4</code></dt> |
| 13421 |
<dd><p>UCS-4 character encoding. Each character is encoded by a 32 integer |
| 13422 |
(4 bytes). The 32 bit integers may be encoded using little-endian |
| 13423 |
encoding or big-endian encoding. If the port is an input-port and the |
| 13424 |
first four bytes read are a BOM (“Byte Order Mark” character with |
| 13425 |
hexadecimal code 0000FEFF) then the BOM will be discarded and the |
| 13426 |
endianness will be set accordingly, otherwise the endianness depends |
| 13427 |
on the operating system and how the Gambit runtime was compiled. If |
| 13428 |
the port is an output-port then a BOM will be output at the beginning |
| 13429 |
of the stream and the endianness depends on the operating system and |
| 13430 |
how the Gambit runtime was compiled. |
| 13431 |
</p> |
| 13432 |
</dd> |
| 13433 |
<dt> <code>UCS-4LE</code></dt> |
| 13434 |
<dd><p>UCS-4 character encoding with little-endian endianness. It is like |
| 13435 |
<code>UCS-4</code> except the endianness is set to little-endian and there is no |
| 13436 |
BOM processing. If a BOM is needed at the beginning of the stream |
| 13437 |
then it must be explicitly written. |
| 13438 |
</p> |
| 13439 |
</dd> |
| 13440 |
<dt> <code>UCS-4BE</code></dt> |
| 13441 |
<dd><p>UCS-4 character encoding with big-endian endianness. It is like |
| 13442 |
<code>UCS-4LE</code> except the endianness is set to big-endian. |
| 13443 |
</p> |
| 13444 |
</dd> |
| 13445 |
</dl> |
| 13446 |
|
| 13447 |
</li><li> |
| 13448 |
<code>char-encoding-errors:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13449 |
|
| 13450 |
<p>This setting controls whether illegal character encodings are silently |
| 13451 |
replaced with the Unicode character #xfffd (replacement character) or |
| 13452 |
raise an error. To set each direction separately the keywords |
| 13453 |
<code>input-char-encoding-errors:</code> and |
| 13454 |
<code>output-char-encoding-errors:</code> must be used instead of |
| 13455 |
<code>char-encoding-errors:</code>. The default value of this setting is |
| 13456 |
<code>#t</code>. |
| 13457 |
</p> |
| 13458 |
</li><li> |
| 13459 |
<code>eol-encoding:</code> <var>encoding</var> |
| 13460 |
|
| 13461 |
<p>This setting controls the end-of-line encoding of the byte-port. To |
| 13462 |
set each direction separately the keywords <code>input-eol-encoding:</code> |
| 13463 |
and <code>output-eol-encoding:</code> must be used instead of |
| 13464 |
<code>eol-encoding:</code>. The default value of this setting is operating |
| 13465 |
system dependent, but this can be overridden through the runtime |
| 13466 |
options (see section <a href="#Runtime-options">Runtime options</a>). Note that for output-ports the |
| 13467 |
end-of-line encoding is applied before the character encoding, and for |
| 13468 |
input-ports it is applied after. The following encodings are |
| 13469 |
supported: |
| 13470 |
</p> |
| 13471 |
<dl compact="compact"> |
| 13472 |
<dt> <code>lf</code></dt> |
| 13473 |
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs a |
| 13474 |
<code>#\linefeed</code> character to the stream (Unicode character code 10). |
| 13475 |
For an input-port, a <code>#\newline</code> character is read when a |
| 13476 |
<code>#\linefeed</code> character is encountered on the stream. Note that |
| 13477 |
<code>#\linefeed</code> and <code>#\newline</code> are two names for the same |
| 13478 |
character, so this end-of-line encoding is actually the identity |
| 13479 |
function. Text files created by UNIX applications typically use this |
| 13480 |
end-of-line encoding. |
| 13481 |
</p> |
| 13482 |
</dd> |
| 13483 |
<dt> <code>cr</code></dt> |
| 13484 |
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs a |
| 13485 |
<code>#\return</code> character to the stream (Unicode character code 13). |
| 13486 |
For an input-port, a <code>#\newline</code> character is read when a |
| 13487 |
<code>#\linefeed</code> character or a <code>#\return</code> character is |
| 13488 |
encountered on the stream. Text files created by Classic Mac OS |
| 13489 |
applications typically use this end-of-line encoding. |
| 13490 |
</p> |
| 13491 |
</dd> |
| 13492 |
<dt> <code>cr-lf</code></dt> |
| 13493 |
<dd><p>For an output-port, writing a <code>#\newline</code> character outputs to |
| 13494 |
the stream a <code>#\return</code> character followed by a <code>#\linefeed</code> |
| 13495 |
character. For an input-port, a <code>#\newline</code> character is read |
| 13496 |
when a <code>#\linefeed</code> character or a <code>#\return</code> character is |
| 13497 |
encountered on the stream. Moreover, if this character is immediately |
| 13498 |
followed by the opposite character (<code>#\linefeed</code> followed by |
| 13499 |
<code>#\return</code> or <code>#\return</code> followed by <code>#\linefeed</code>) then |
| 13500 |
the second character is ignored. In other words, all four possible |
| 13501 |
end-of-line encodings are read as a single <code>#\newline</code> character. |
| 13502 |
Text files created by DOS and Microsoft Windows applications typically |
| 13503 |
use this end-of-line encoding. |
| 13504 |
</p> |
| 13505 |
</dd> |
| 13506 |
</dl> |
| 13507 |
|
| 13508 |
</li></ul> |
| 13509 |
|
| 13510 |
<a name="Byte_002dport-operations"></a><hr size="6"><br/><br/><br/> |
| 13511 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13512 |
<tr><td valign="middle" align="left"><a href="#Byte_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13513 |
<td valign="middle" align="left"><a href="#Device_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13514 |
<td valign="middle" align="left"> </td> |
| 13515 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13516 |
<td valign="middle" align="left"><a href="#Byte_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13517 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13518 |
<td valign="middle" align="left"> </td> |
| 13519 |
<td valign="middle" align="left"> </td> |
| 13520 |
<td valign="middle" align="left"> </td> |
| 13521 |
<td valign="middle" align="left"> </td> |
| 13522 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13523 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13524 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13525 |
</tr></table> |
| 13526 |
<a name="Byte_002dport-operations-1"></a> |
| 13527 |
<h3 class="subsection">17.6.2 Byte-port operations</h3> |
| 13528 |
|
| 13529 |
<a name="Definition_of_read-u8"></a><a name="Procedure_read-u8"></a><a name="index-read_002du8"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-u8">read-u8</a></b></code><i> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13530 |
|
| 13531 |
<p>This procedure reads the byte input-port <var>port</var> and returns the |
| 13532 |
byte at the current byte location and advances the current byte |
| 13533 |
location to the next byte, unless the <var>port</var> is already at |
| 13534 |
end-of-file in which case <code>read-u8</code> returns the end-of-file |
| 13535 |
object. If it is not specified, <var>port</var> defaults to the current |
| 13536 |
input-port. |
| 13537 |
</p> |
| 13538 |
<p>This procedure must be called when the port’s input character buffer |
| 13539 |
is empty otherwise the character-stream and byte-stream may be out of |
| 13540 |
sync due to buffering. The input character buffer is used for bulk |
| 13541 |
decoding of encoded characters (i.e. to translate the byte-stream into |
| 13542 |
a character-stream). The input character buffer is initially empty. |
| 13543 |
It is only when characters are read that it is filled with characters |
| 13544 |
obtained by decoding the byte-stream. |
| 13545 |
</p> |
| 13546 |
<p>One way to ensure that the port’s input character buffer is empty is |
| 13547 |
to call <code>read-u8</code> strictly before any use of the port in a character |
| 13548 |
input operation (i.e. a call to the procedures <code>read</code>, |
| 13549 |
<code>read-char</code>, <code>peek-char</code>, etc). Alternatively |
| 13550 |
<code>input-port-characters-buffered</code> can be used to get the number of |
| 13551 |
characters in the port’s input character buffer, and to empty the |
| 13552 |
buffer with calls to <code>read-char</code> or <code>read-substring</code>. |
| 13553 |
</p> |
| 13554 |
<p>For example: |
| 13555 |
</p> |
| 13556 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-input-u8vector |
| 13557 |
'#u8(11 22 33 44) |
| 13558 |
(lambda (p) |
| 13559 |
(let ((a (read-u8 p))) (list a (read-u8 p)))))</b> |
| 13560 |
(11 22) |
| 13561 |
> <b>(call-with-input-u8vector '#u8() read-u8)</b> |
| 13562 |
#!eof |
| 13563 |
</pre></td></tr></table> |
| 13564 |
|
| 13565 |
|
| 13566 |
|
| 13567 |
<a name="Definition_of_write-u8"></a><a name="Procedure_write-u8"></a><a name="index-write_002du8"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_write-u8">write-u8</a></b></code><i> <var>n</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13568 |
|
| 13569 |
<p>This procedure writes the byte <var>n</var> to the byte output-port |
| 13570 |
<var>port</var> and advances the current byte location of that output-port. |
| 13571 |
The value returned is unspecified. If it is not specified, <var>port</var> |
| 13572 |
defaults to the current output-port. |
| 13573 |
</p> |
| 13574 |
<p>For example: |
| 13575 |
</p> |
| 13576 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(call-with-output-u8vector '() (lambda (p) (write-u8 33 p)))</b> |
| 13577 |
#u8(33) |
| 13578 |
</pre></td></tr></table> |
| 13579 |
|
| 13580 |
|
| 13581 |
|
| 13582 |
<a name="Definition_of_read-subu8vector"></a><a name="Procedure_read-subu8vector"></a><a name="index-read_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_read-subu8vector">read-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var> <span class="roman">[</span><var>need</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13583 |
<a name="Definition_of_write-subu8vector"></a><a name="Procedure_write-subu8vector"></a><a name="index-write_002dsubu8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_write-subu8vector">write-subu8vector</a></b></code><i> <var>u8vector</var> <var>start</var> <var>end</var> <span class="roman">[</span><var>port</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13584 |
|
| 13585 |
<p>These procedures support bulk byte I/O. The part of the u8vector |
| 13586 |
<var>u8vector</var> starting at index <var>start</var> and ending just before |
| 13587 |
index <var>end</var> is used as a byte buffer that will be the target of |
| 13588 |
<code>read-subu8vector</code> or the source of the <code>write-subu8vector</code>. |
| 13589 |
The <code>read-subu8vector</code> also accepts a <var>need</var> parameter which |
| 13590 |
must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> bytes will |
| 13591 |
be transferred. The number of bytes transferred, possibly zero, is |
| 13592 |
returned by these procedures. Fewer bytes will be read by |
| 13593 |
<code>read-subu8vector</code> if an end-of-file is read, or a timeout occurs |
| 13594 |
before all the requested bytes are transferred and the timeout thunk |
| 13595 |
returns <code>#f</code> (see the procedure <code>input-port-timeout-set!</code>), |
| 13596 |
or <var>need</var> is specified and at least that many bytes have been read |
| 13597 |
(in other words the procedure does not block for more bytes but may |
| 13598 |
transfer more bytes if they are immediately available). Fewer bytes |
| 13599 |
will be written by <code>write-subu8vector</code> if a timeout occurs before |
| 13600 |
all the requested bytes are transferred and the timeout thunk returns |
| 13601 |
<code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it |
| 13602 |
is not specified, <var>port</var> defaults to the current input-port and |
| 13603 |
current output-port respectively. |
| 13604 |
</p> |
| 13605 |
<p>The procedure <code>read-subu8vector</code> must be called before any use of |
| 13606 |
the port in a character input operation (i.e. a call to the procedures |
| 13607 |
<code>read</code>, <code>read-char</code>, <code>peek-char</code>, etc) because |
| 13608 |
otherwise the character-stream and byte-stream may be out of sync due |
| 13609 |
to the port buffering. |
| 13610 |
</p> |
| 13611 |
<p>For example: |
| 13612 |
</p> |
| 13613 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define v (make-u8vector 10))</b> |
| 13614 |
> <b>(read-subu8vector v 2 5)123456789</b> |
| 13615 |
3 |
| 13616 |
> 456789 |
| 13617 |
> <b>v</b> |
| 13618 |
#u8(0 0 49 50 51 0 0 0 0 0) |
| 13619 |
> <b>(read-subu8vector v 2 10 (current-input-port) 3)abcd</b> |
| 13620 |
5 |
| 13621 |
> <b>v</b> |
| 13622 |
#u8(0 0 97 98 99 100 10 0 0 0) |
| 13623 |
</pre></td></tr></table> |
| 13624 |
|
| 13625 |
|
| 13626 |
|
| 13627 |
<a name="Device_002dports"></a><hr size="6"><br/><br/><br/> |
| 13628 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13629 |
<tr><td valign="middle" align="left"><a href="#Byte_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13630 |
<td valign="middle" align="left"><a href="#Filesystem-devices" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13631 |
<td valign="middle" align="left"> </td> |
| 13632 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13633 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13634 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13635 |
<td valign="middle" align="left"> </td> |
| 13636 |
<td valign="middle" align="left"> </td> |
| 13637 |
<td valign="middle" align="left"> </td> |
| 13638 |
<td valign="middle" align="left"> </td> |
| 13639 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13640 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13641 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13642 |
</tr></table> |
| 13643 |
<a name="Device_002dports-1"></a> |
| 13644 |
<h2 class="section">17.7 Device-ports</h2> |
| 13645 |
|
| 13646 |
<table class="menu" border="0" cellspacing="0"> |
| 13647 |
<tr><td align="left" valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13648 |
<tr><td align="left" valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13649 |
<tr><td align="left" valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 13650 |
</table> |
| 13651 |
|
| 13652 |
<a name="Filesystem-devices"></a><hr size="6"><br/><br/><br/> |
| 13653 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13654 |
<tr><td valign="middle" align="left"><a href="#Device_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13655 |
<td valign="middle" align="left"><a href="#Process-devices" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13656 |
<td valign="middle" align="left"> </td> |
| 13657 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13658 |
<td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13659 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13660 |
<td valign="middle" align="left"> </td> |
| 13661 |
<td valign="middle" align="left"> </td> |
| 13662 |
<td valign="middle" align="left"> </td> |
| 13663 |
<td valign="middle" align="left"> </td> |
| 13664 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13665 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13666 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13667 |
</tr></table> |
| 13668 |
<a name="Filesystem-devices-1"></a> |
| 13669 |
<h3 class="subsection">17.7.1 Filesystem devices</h3> |
| 13670 |
|
| 13671 |
<a name="Definition_of_open-file"></a><a name="Procedure_open-file"></a><a name="index-open_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-file">open-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13672 |
<a name="Definition_of_open-input-file"></a><a name="Procedure_open-input-file"></a><a name="index-open_002dinput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-input-file">open-input-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13673 |
<a name="Definition_of_open-output-file"></a><a name="Procedure_open-output-file"></a><a name="index-open_002doutput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-output-file">open-output-file</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13674 |
<a name="Definition_of_call-with-input-file"></a><a name="Procedure_call-with-input-file"></a><a name="index-call_002dwith_002dinput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-input-file">call-with-input-file</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13675 |
<a name="Definition_of_call-with-output-file"></a><a name="Procedure_call-with-output-file"></a><a name="index-call_002dwith_002doutput_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-output-file">call-with-output-file</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13676 |
<a name="Definition_of_with-input-from-file"></a><a name="Procedure_with-input-from-file"></a><a name="index-with_002dinput_002dfrom_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-file">with-input-from-file</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13677 |
<a name="Definition_of_with-output-to-file"></a><a name="Procedure_with-output-to-file"></a><a name="index-with_002doutput_002dto_002dfile"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-file">with-output-to-file</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13678 |
|
| 13679 |
<p>All of these procedures create a port to interface to a byte-stream |
| 13680 |
device (such as a file, console, serial port, named pipe, etc) whose |
| 13681 |
name is given by a path of the filesystem. The <code>direction:</code> |
| 13682 |
setting will default to the value <code>input</code> for the procedures |
| 13683 |
<code>open-input-file</code>, <code>call-with-input-file</code> and |
| 13684 |
<code>with-input-from-file</code>, to the value <code>output</code> for the |
| 13685 |
procedures <code>open-output-file</code>, <code>call-with-output-file</code> and |
| 13686 |
<code>with-output-to-file</code>, and to the value <code>input-output</code> for |
| 13687 |
the procedure <code>open-file</code>. |
| 13688 |
</p> |
| 13689 |
<p>The procedures <code>open-file</code>, <code>open-input-file</code> and |
| 13690 |
<code>open-output-file</code> return the port that is created. The |
| 13691 |
procedures <code>call-with-input-file</code> and |
| 13692 |
<code>call-with-output-file</code> call the procedure <var>proc</var> with the |
| 13693 |
port as single argument, and then return the value(s) of this call |
| 13694 |
after closing the port. The procedures <code>with-input-from-file</code> |
| 13695 |
and <code>with-output-to-file</code> dynamically bind the current input-port |
| 13696 |
and current output-port respectively to the port created for the |
| 13697 |
duration of a call to the procedure <var>thunk</var> with no argument. The |
| 13698 |
value(s) of the call to <var>thunk</var> are returned after closing the |
| 13699 |
port. |
| 13700 |
</p> |
| 13701 |
<p>The first argument of these procedures is either a string denoting a |
| 13702 |
filesystem path or a list of port settings which must contain a |
| 13703 |
<code>path:</code> setting. Here are the settings allowed in addition to |
| 13704 |
the generic settings of byte-ports: |
| 13705 |
</p> |
| 13706 |
<ul> |
| 13707 |
<li> |
| 13708 |
<code>path:</code> <var>string</var> |
| 13709 |
|
| 13710 |
<p>This setting indicates the location of the file in the filesystem. |
| 13711 |
There is no default value for this setting. |
| 13712 |
</p> |
| 13713 |
</li><li> |
| 13714 |
<code>append:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13715 |
|
| 13716 |
<p>This setting controls whether output will be added to the end of the |
| 13717 |
file. This is useful for writing to log files that might be open by |
| 13718 |
more than one process. The default value of this setting is |
| 13719 |
<code>#f</code>. |
| 13720 |
</p> |
| 13721 |
</li><li> |
| 13722 |
<code>create:</code> ( <code>#f</code> | <code>#t</code> | <code>maybe</code> ) |
| 13723 |
|
| 13724 |
<p>This setting controls whether the file will be created when it is |
| 13725 |
opened. A setting of <code>#f</code> requires that the file exist |
| 13726 |
(otherwise an exception is raised). A setting of <code>#t</code> requires |
| 13727 |
that the file does not exist (otherwise an exception is raised). A |
| 13728 |
setting of <code>maybe</code> will create the file if it does not exist. |
| 13729 |
The default value of this setting is <code>maybe</code> for output-ports and |
| 13730 |
<code>#f</code> for input-ports and bidirectional ports. |
| 13731 |
</p> |
| 13732 |
</li><li> |
| 13733 |
<code>permissions:</code> <var>12-bit-exact-integer</var> |
| 13734 |
|
| 13735 |
<p>This setting controls the UNIX permissions that will be attached to |
| 13736 |
the file if it is created. The default value of this setting is |
| 13737 |
<code>#o666</code>. |
| 13738 |
</p> |
| 13739 |
</li><li> |
| 13740 |
<code>truncate:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13741 |
|
| 13742 |
<p>This setting controls whether the file will be truncated when it is |
| 13743 |
opened. For input-ports, the default value of this setting is |
| 13744 |
<code>#f</code>. For output-ports, the default value of this setting is |
| 13745 |
<code>#t</code> when the <code>append:</code> setting is <code>#f</code>, and <code>#f</code> |
| 13746 |
otherwise. |
| 13747 |
</p> |
| 13748 |
</li></ul> |
| 13749 |
|
| 13750 |
<p>For example: |
| 13751 |
</p> |
| 13752 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-output-to-file |
| 13753 |
(list path: "nofile" |
| 13754 |
create: #f) |
| 13755 |
(lambda () |
| 13756 |
(display "hello world!\n")))</b> |
| 13757 |
*** ERROR IN (console)@1.1 -- No such file or directory |
| 13758 |
(with-output-to-file '(path: "nofile" create: #f) '#<procedure #2>) |
| 13759 |
</pre></td></tr></table> |
| 13760 |
|
| 13761 |
|
| 13762 |
|
| 13763 |
<a name="Definition_of_input-port-byte-position"></a><a name="Procedure_input-port-byte-position"></a><a name="index-input_002dport_002dbyte_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_input-port-byte-position">input-port-byte-position</a></b></code><i> <var>port</var> <span class="roman">[</span><var>position</var> <span class="roman">[</span><var>whence</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13764 |
<a name="Definition_of_output-port-byte-position"></a><a name="Procedure_output-port-byte-position"></a><a name="index-output_002dport_002dbyte_002dposition"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_output-port-byte-position">output-port-byte-position</a></b></code><i> <var>port</var> <span class="roman">[</span><var>position</var> <span class="roman">[</span><var>whence</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13765 |
|
| 13766 |
<p>When called with a single argument these procedures return the byte |
| 13767 |
position where the next I/O operation would take place in the file |
| 13768 |
attached to the given <var>port</var> (relative to the beginning of the |
| 13769 |
file). When called with two or three arguments, the byte position for |
| 13770 |
subsequent I/O operations on the given <var>port</var> is changed to |
| 13771 |
<var>position</var>, which must be an exact integer. When <var>whence</var> is |
| 13772 |
omitted or is 0, the <var>position</var> is relative to the beginning of |
| 13773 |
the file. When <var>whence</var> is 1, the <var>position</var> is relative to |
| 13774 |
the current byte position of the file. When <var>whence</var> is 2, the |
| 13775 |
<var>position</var> is relative to the end of the file. The return value |
| 13776 |
is the new byte position. On most operating systems the byte position |
| 13777 |
for reading and writing of a given bidirectional port are the same. |
| 13778 |
</p> |
| 13779 |
<p>When <code>input-port-byte-position</code> is called to change the byte |
| 13780 |
position of an input-port, all input buffers will be flushed so that |
| 13781 |
the next byte read will be the one at the given position. |
| 13782 |
</p> |
| 13783 |
<p>When <code>output-port-byte-position</code> is called to change the byte |
| 13784 |
position of an output-port, there is an implicit call to |
| 13785 |
<code>force-output</code> before the position is changed. |
| 13786 |
</p> |
| 13787 |
<p>For example: |
| 13788 |
</p> |
| 13789 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p <span class="roman"><i>; p is an input-output-port</i></span> |
| 13790 |
(open-file '(path: "test" char-encoding: ISO-8859-1 create: maybe)))</b> |
| 13791 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13792 |
(0 0) |
| 13793 |
> <b>(display "abcdefghij\n" p)</b> |
| 13794 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13795 |
(0 0) |
| 13796 |
> <b>(force-output p)</b> |
| 13797 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13798 |
(11 11) |
| 13799 |
> <b>(input-port-byte-position p 2)</b> |
| 13800 |
2 |
| 13801 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13802 |
(2 2) |
| 13803 |
> <b>(peek-char p)</b> |
| 13804 |
#\c |
| 13805 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13806 |
(11 11) |
| 13807 |
> <b>(output-port-byte-position p -7 2)</b> |
| 13808 |
4 |
| 13809 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13810 |
(4 4) |
| 13811 |
> <b>(write-char #\! p)</b> |
| 13812 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13813 |
(4 4) |
| 13814 |
> <b>(force-output p)</b> |
| 13815 |
> <b>(list (input-port-byte-position p) (output-port-byte-position p))</b> |
| 13816 |
(5 5) |
| 13817 |
> <b>(input-port-byte-position p 1)</b> |
| 13818 |
1 |
| 13819 |
> <b>(read p)</b> |
| 13820 |
bcd!fghij |
| 13821 |
</pre></td></tr></table> |
| 13822 |
|
| 13823 |
|
| 13824 |
|
| 13825 |
<a name="Process-devices"></a><hr size="6"><br/><br/><br/> |
| 13826 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 13827 |
<tr><td valign="middle" align="left"><a href="#Filesystem-devices" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 13828 |
<td valign="middle" align="left"><a href="#Network-devices" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 13829 |
<td valign="middle" align="left"> </td> |
| 13830 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 13831 |
<td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 13832 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 13833 |
<td valign="middle" align="left"> </td> |
| 13834 |
<td valign="middle" align="left"> </td> |
| 13835 |
<td valign="middle" align="left"> </td> |
| 13836 |
<td valign="middle" align="left"> </td> |
| 13837 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 13838 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 13839 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 13840 |
</tr></table> |
| 13841 |
<a name="Process-devices-1"></a> |
| 13842 |
<h3 class="subsection">17.7.2 Process devices</h3> |
| 13843 |
|
| 13844 |
<a name="Definition_of_open-process"></a><a name="Procedure_open-process"></a><a name="index-open_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-process">open-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13845 |
<a name="Definition_of_open-input-process"></a><a name="Procedure_open-input-process"></a><a name="index-open_002dinput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-input-process">open-input-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13846 |
<a name="Definition_of_open-output-process"></a><a name="Procedure_open-output-process"></a><a name="index-open_002doutput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-output-process">open-output-process</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13847 |
<a name="Definition_of_call-with-input-process"></a><a name="Procedure_call-with-input-process"></a><a name="index-call_002dwith_002dinput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-input-process">call-with-input-process</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13848 |
<a name="Definition_of_call-with-output-process"></a><a name="Procedure_call-with-output-process"></a><a name="index-call_002dwith_002doutput_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-output-process">call-with-output-process</a></b></code><i> <var>path-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13849 |
<a name="Definition_of_with-input-from-process"></a><a name="Procedure_with-input-from-process"></a><a name="index-with_002dinput_002dfrom_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-process">with-input-from-process</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13850 |
<a name="Definition_of_with-output-to-process"></a><a name="Procedure_with-output-to-process"></a><a name="index-with_002doutput_002dto_002dprocess"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-process">with-output-to-process</a></b></code><i> <var>path-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13851 |
|
| 13852 |
<p>All of these procedures start a new operating system process and |
| 13853 |
create a bidirectional port which allows communication with that |
| 13854 |
process on its standard input and standard output. The |
| 13855 |
<code>direction:</code> setting will default to the value <code>input</code> for |
| 13856 |
the procedures <code>open-input-process</code>, |
| 13857 |
<code>call-with-input-process</code> and <code>with-input-from-process</code>, to |
| 13858 |
the value <code>output</code> for the procedures <code>open-output-process</code>, |
| 13859 |
<code>call-with-output-process</code> and <code>with-output-to-process</code>, and |
| 13860 |
to the value <code>input-output</code> for the procedure |
| 13861 |
<code>open-process</code>. If the <code>direction:</code> setting is |
| 13862 |
<code>input</code>, the output-port side is closed. If the |
| 13863 |
<code>direction:</code> setting is <code>output</code>, the input-port side is |
| 13864 |
closed. |
| 13865 |
</p> |
| 13866 |
<p>The procedures <code>open-process</code>, <code>open-input-process</code> and |
| 13867 |
<code>open-output-process</code> return the port that is created. The |
| 13868 |
procedures <code>call-with-input-process</code> and |
| 13869 |
<code>call-with-output-process</code> call the procedure <var>proc</var> with the |
| 13870 |
port as single argument, and then return the value(s) of this call |
| 13871 |
after closing the port and waiting for the process to terminate. The |
| 13872 |
procedures <code>with-input-from-process</code> and |
| 13873 |
<code>with-output-to-process</code> dynamically bind the current input-port |
| 13874 |
and current output-port respectively to the port created for the |
| 13875 |
duration of a call to the procedure <var>thunk</var> with no argument. The |
| 13876 |
value(s) of the call to <var>thunk</var> are returned after closing the |
| 13877 |
port and waiting for the process to terminate. |
| 13878 |
</p> |
| 13879 |
<p>The first argument of this procedure is either a string denoting a |
| 13880 |
filesystem path of an executable program or a list of port settings |
| 13881 |
which must contain a <code>path:</code> setting. Here are the settings |
| 13882 |
allowed in addition to the generic settings of byte-ports: |
| 13883 |
</p> |
| 13884 |
<ul> |
| 13885 |
<li> |
| 13886 |
<code>path:</code> <var>string</var> |
| 13887 |
|
| 13888 |
<p>This setting indicates the location of the executable program in the |
| 13889 |
filesystem. There is no default value for this setting. |
| 13890 |
</p> |
| 13891 |
</li><li> |
| 13892 |
<code>arguments:</code> <var>list-of-strings</var> |
| 13893 |
|
| 13894 |
<p>This setting indicates the string arguments that are passed to the |
| 13895 |
program. The default value of this setting is the empty list (i.e. no |
| 13896 |
arguments). |
| 13897 |
</p> |
| 13898 |
</li><li> |
| 13899 |
<code>environment:</code> <var>list-of-strings</var> |
| 13900 |
|
| 13901 |
<p>This setting indicates the set of environment variable bindings that |
| 13902 |
the process receives. Each element of the list is a string of the |
| 13903 |
form “<code><var>VAR</var>=<var>VALUE</var></code>”, where <code><var>VAR</var></code> is the |
| 13904 |
name of the variable and <code><var>VALUE</var></code> is its binding. When |
| 13905 |
<var>list-of-strings</var> is <code>#f</code>, the process inherits the |
| 13906 |
environment variable bindings of the Scheme program. The default |
| 13907 |
value of this setting is <code>#f</code>. |
| 13908 |
</p> |
| 13909 |
</li><li> |
| 13910 |
<code>directory:</code> <var>dir</var> |
| 13911 |
|
| 13912 |
<p>This setting indicates the current working directory of the process. |
| 13913 |
When <var>dir</var> is <code>#f</code>, the process uses the value of |
| 13914 |
<code>(current-directory)</code>. The default value of this setting is |
| 13915 |
<code>#f</code>. |
| 13916 |
</p> |
| 13917 |
</li><li> |
| 13918 |
<code>stdin-redirection:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13919 |
|
| 13920 |
<p>This setting indicates how the standard input of the process is |
| 13921 |
redirected. A setting of <code>#t</code> will redirect the standard input |
| 13922 |
from the process-port (i.e. what is written to the process-port will |
| 13923 |
be available on the standard input). A setting of <code>#f</code> will |
| 13924 |
leave the standard input as-is, which typically results in input |
| 13925 |
coming from the console. The default value of this setting is |
| 13926 |
<code>#t</code>. |
| 13927 |
</p> |
| 13928 |
</li><li> |
| 13929 |
<code>stdout-redirection:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13930 |
|
| 13931 |
<p>This setting indicates how the standard output of the process is |
| 13932 |
redirected. A setting of <code>#t</code> will redirect the standard output |
| 13933 |
to the process-port (i.e. all output to standard output can be read |
| 13934 |
from the process-port). A setting of <code>#f</code> will leave the |
| 13935 |
standard output as-is, which typically results in the output going to |
| 13936 |
the console. The default value of this setting is <code>#t</code>. |
| 13937 |
</p> |
| 13938 |
</li><li> |
| 13939 |
<code>stderr-redirection:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13940 |
|
| 13941 |
<p>This setting indicates how the standard error of the process is |
| 13942 |
redirected. A setting of <code>#t</code> will redirect the standard error |
| 13943 |
to the process-port (i.e. all output to standard error can be read |
| 13944 |
from the process-port). A setting of <code>#f</code> will leave the |
| 13945 |
standard error as-is, which typically results in error messages being |
| 13946 |
output to the console. The default value of this setting is |
| 13947 |
<code>#f</code>. |
| 13948 |
</p> |
| 13949 |
</li><li> |
| 13950 |
<code>pseudo-terminal:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13951 |
|
| 13952 |
<p>This setting applies to UNIX. It indicates what type of device will |
| 13953 |
be bound to the process’ standard input and standard output. A |
| 13954 |
setting of <code>#t</code> will use a pseudo-terminal device (this is a |
| 13955 |
device that behaves like a tty device even though there is no real |
| 13956 |
terminal or user directly involved). A setting of <code>#f</code> will use |
| 13957 |
a pair of pipes. The difference is important for programs which |
| 13958 |
behave differently when they are used interactively, for example |
| 13959 |
shells. The default value of this setting is <code>#f</code>. |
| 13960 |
</p> |
| 13961 |
</li><li> |
| 13962 |
<code>show-console:</code> ( <code>#f</code> | <code>#t</code> ) |
| 13963 |
|
| 13964 |
<p>This setting applies to Microsoft Windows. It controls whether the |
| 13965 |
process’ console window will be hidden or visible. The default value |
| 13966 |
of this setting is <code>#t</code> (i.e. show the console window). |
| 13967 |
</p> |
| 13968 |
</li></ul> |
| 13969 |
|
| 13970 |
<p>For example: |
| 13971 |
</p> |
| 13972 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(with-input-from-process "date" read-line)</b> |
| 13973 |
"Sun Jun 14 15:06:41 EDT 2009" |
| 13974 |
> <b>(define p (open-process (list path: "ls" |
| 13975 |
arguments: '("../examples"))))</b> |
| 13976 |
> <b>(read-line p)</b> |
| 13977 |
"README" |
| 13978 |
> <b>(read-line p)</b> |
| 13979 |
"Xlib-simple" |
| 13980 |
> <b>(close-port p)</b> |
| 13981 |
> <b>(define p (open-process "/usr/bin/dc"))</b> |
| 13982 |
> <b>(display "2 100 ^ p\n" p)</b> |
| 13983 |
> <b>(force-output p)</b> |
| 13984 |
> <b>(read-line p)</b> |
| 13985 |
"1267650600228229401496703205376" |
| 13986 |
</pre></td></tr></table> |
| 13987 |
|
| 13988 |
|
| 13989 |
|
| 13990 |
<a name="Definition_of_process-pid"></a><a name="Procedure_process-pid"></a><a name="index-process_002dpid"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_process-pid">process-pid</a></b></code><i> <var>process-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 13991 |
|
| 13992 |
<p>This procedure returns the PID (Process Identifier) of the process of |
| 13993 |
<var>process-port</var>. The PID is a small exact integer. |
| 13994 |
</p> |
| 13995 |
<p>For example: |
| 13996 |
</p> |
| 13997 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-process "sort"))) |
| 13998 |
(process-pid p))</b> |
| 13999 |
318 |
| 14000 |
</pre></td></tr></table> |
| 14001 |
|
| 14002 |
|
| 14003 |
|
| 14004 |
<a name="Definition_of_process-status"></a><a name="Procedure_process-status"></a><a name="index-process_002dstatus"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_process-status">process-status</a></b></code><i> <var>process-port</var> <span class="roman">[</span><var>timeout</var> <span class="roman">[</span><var>timeout-val</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14005 |
|
| 14006 |
<p>This procedure causes the current thread to wait until the process of |
| 14007 |
<var>process-port</var> terminates (normally or not) or until the timeout |
| 14008 |
is reached if <var>timeout</var> is supplied. If the timeout is reached, |
| 14009 |
<var>process-status</var> returns <var>timeout-val</var> if it is supplied, |
| 14010 |
otherwise an unterminated-process-exception object is raised. The |
| 14011 |
procedure returns the process exit status as encoded by the operating |
| 14012 |
system. Typically, if the process exited normally the return value is |
| 14013 |
the process exit status multiplied by 256. |
| 14014 |
</p> |
| 14015 |
<p>For example: |
| 14016 |
</p> |
| 14017 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-process "sort"))) |
| 14018 |
(for-each (lambda (x) (pretty-print x p)) |
| 14019 |
'(22 11 33)) |
| 14020 |
(close-output-port p) |
| 14021 |
(let ((r (read-all p))) |
| 14022 |
(close-input-port p) |
| 14023 |
(list (process-status p) r)))</b> |
| 14024 |
(0 (11 22 33)) |
| 14025 |
</pre></td></tr></table> |
| 14026 |
|
| 14027 |
|
| 14028 |
|
| 14029 |
<a name="Definition_of_unterminated-process-exception?"></a><a name="Procedure_unterminated-process-exception?"></a><a name="index-unterminated_002dprocess_002dexception_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception?">unterminated-process-exception?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14030 |
<a name="Definition_of_unterminated-process-exception-procedure"></a><a name="Procedure_unterminated-process-exception-procedure"></a><a name="index-unterminated_002dprocess_002dexception_002dprocedure"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception-procedure">unterminated-process-exception-procedure</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14031 |
<a name="Definition_of_unterminated-process-exception-arguments"></a><a name="Procedure_unterminated-process-exception-arguments"></a><a name="index-unterminated_002dprocess_002dexception_002darguments"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_unterminated-process-exception-arguments">unterminated-process-exception-arguments</a></b></code><i> <var>exc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14032 |
|
| 14033 |
<p>Unterminated-process-exception objects are raised when a call to the |
| 14034 |
<code>process-status</code> procedure reaches its timeout before the target |
| 14035 |
process terminates and a timeout-value parameter is not specified. |
| 14036 |
The parameter <var>exc</var> must be an unterminated-process-exception |
| 14037 |
object. |
| 14038 |
</p> |
| 14039 |
<p>The procedure <code>unterminated-process-exception?</code> returns |
| 14040 |
<code>#t</code> when <var>obj</var> is an unterminated-process-exception |
| 14041 |
object and <code>#f</code> otherwise. |
| 14042 |
</p> |
| 14043 |
<p>The procedure <code>unterminated-process-exception-procedure</code> |
| 14044 |
returns the procedure that raised <var>exc</var>. |
| 14045 |
</p> |
| 14046 |
<p>The procedure <code>unterminated-process-exception-arguments</code> |
| 14047 |
returns the list of arguments of the procedure that raised <var>exc</var>. |
| 14048 |
</p> |
| 14049 |
<p>For example: |
| 14050 |
</p> |
| 14051 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (handler exc) |
| 14052 |
(if (unterminated-process-exception? exc) |
| 14053 |
(list (unterminated-process-exception-procedure exc) |
| 14054 |
(unterminated-process-exception-arguments exc)) |
| 14055 |
'not-unterminated-process-exception))</b> |
| 14056 |
> <b>(with-exception-catcher |
| 14057 |
handler |
| 14058 |
(lambda () |
| 14059 |
(let ((p (open-process "sort"))) |
| 14060 |
(process-status p 1))))</b> |
| 14061 |
(#<procedure #2 process-status> (#<input-output-port #3 (process "sort")>)) |
| 14062 |
</pre></td></tr></table> |
| 14063 |
|
| 14064 |
|
| 14065 |
|
| 14066 |
<a name="Network-devices"></a><hr size="6"><br/><br/><br/> |
| 14067 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14068 |
<tr><td valign="middle" align="left"><a href="#Process-devices" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14069 |
<td valign="middle" align="left"><a href="#Directory_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14070 |
<td valign="middle" align="left"> </td> |
| 14071 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14072 |
<td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14073 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14074 |
<td valign="middle" align="left"> </td> |
| 14075 |
<td valign="middle" align="left"> </td> |
| 14076 |
<td valign="middle" align="left"> </td> |
| 14077 |
<td valign="middle" align="left"> </td> |
| 14078 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14079 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14080 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14081 |
</tr></table> |
| 14082 |
<a name="Network-devices-1"></a> |
| 14083 |
<h3 class="subsection">17.7.3 Network devices</h3> |
| 14084 |
|
| 14085 |
<a name="Definition_of_open-tcp-client"></a><a name="Procedure_open-tcp-client"></a><a name="index-open_002dtcp_002dclient"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-tcp-client">open-tcp-client</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14086 |
|
| 14087 |
<p>This procedure opens a network connection to a socket server and |
| 14088 |
returns a tcp-client-port (a subtype of device-port) that represents |
| 14089 |
this connection and allows communication with that server. The |
| 14090 |
default value of the <code>direction:</code> setting is <code>input-output</code>, |
| 14091 |
i.e. the Scheme program can send information to the server and receive |
| 14092 |
information from the server. The sending direction can be |
| 14093 |
“shutdown” using the <code>close-output-port</code> procedure and the |
| 14094 |
receiving direction can be “shutdown” using the |
| 14095 |
<code>close-input-port</code> procedure. The <code>close-port</code> procedure |
| 14096 |
closes both directions of the connection. |
| 14097 |
</p> |
| 14098 |
<p>The parameter of this procedure is an IP port number (16-bit nonnegative |
| 14099 |
exact integer), a string of the form <code>"<var>HOST</var>:<var>PORT</var>"</code> or |
| 14100 |
a list of port settings. When the parameter is the number <var>PORT</var> |
| 14101 |
it is handled as if it was the setting <code>port-number:</code> <var>PORT</var>. |
| 14102 |
When the parameter is the string <code>"<var>HOST</var>:<var>PORT</var>"</code> it is |
| 14103 |
handled as if it was the setting <code>server-address:</code> |
| 14104 |
<code>"<var>HOST</var>:<var>PORT</var>"</code>. |
| 14105 |
</p> |
| 14106 |
<p>Here are the settings allowed in addition to the generic settings of |
| 14107 |
byte-ports: |
| 14108 |
</p> |
| 14109 |
<ul> |
| 14110 |
<li> |
| 14111 |
<code>server-address:</code> <var>string-or-ip-address</var> |
| 14112 |
|
| 14113 |
<p>This setting indicates the internet address of the server, and |
| 14114 |
possibly the IP port number. When this parameter is not specified or |
| 14115 |
is <code>""</code>, the connection requests are sent to the loopback |
| 14116 |
interface (with IP address 127.0.0.1). The parameter can be a string |
| 14117 |
denoting a host name, which will be translated to an IP address by the |
| 14118 |
<code>host-info</code> procedure, or a 4 element u8vector which contains the |
| 14119 |
32-bit IPv4 address or an 8 element u16vector which contains the |
| 14120 |
128-bit IPv6 address. A string of the form |
| 14121 |
<code>"<var>HOST</var>:<var>PORT</var>"</code> is handled as if it was the combination |
| 14122 |
of settings <code>server-address:</code> <code>"<var>HOST</var>"</code> |
| 14123 |
<code>port-number:</code> <var>PORT</var>. |
| 14124 |
</p> |
| 14125 |
</li><li> |
| 14126 |
<code>port-number:</code> <var>16-bit-exact-integer</var> |
| 14127 |
|
| 14128 |
<p>This setting indicates the IP port number of the server to connect |
| 14129 |
to (e.g. 80 for the standard HTTP server, 23 for the standard telnet |
| 14130 |
server). There is no default value for this setting. |
| 14131 |
</p> |
| 14132 |
</li><li> |
| 14133 |
<code>keep-alive:</code> ( <code>#f</code> | <code>#t</code> ) |
| 14134 |
|
| 14135 |
<p>This setting controls the use of the “keep alive” option on the |
| 14136 |
connection. The “keep alive” option will periodically send control |
| 14137 |
packets on otherwise idle network connections to ensure that the |
| 14138 |
server host is active and reachable. The default value of this |
| 14139 |
setting is <code>#f</code>. |
| 14140 |
</p> |
| 14141 |
</li><li> |
| 14142 |
<code>coalesce:</code> ( <code>#f</code> | <code>#t</code> ) |
| 14143 |
|
| 14144 |
<p>This setting controls the use of TCP’s “Nagle algorithm” which |
| 14145 |
reduces the number of small packets by delaying their transmission and |
| 14146 |
coalescing them into larger packets. A setting of <code>#t</code> will |
| 14147 |
coalesce small packets into larger ones. A setting of <code>#f</code> will |
| 14148 |
transmit packets as soon as possible. The default value of this |
| 14149 |
setting is <code>#t</code>. Note that this setting does not affect the |
| 14150 |
buffering of the port. |
| 14151 |
</p> |
| 14152 |
</li></ul> |
| 14153 |
|
| 14154 |
<p>Below is an example of the client-side code that opens a connection to |
| 14155 |
an HTTP server on port 8080 of the loopback interface (with IP address |
| 14156 |
127.0.0.1). For the server-side code see the example for the |
| 14157 |
procedure <code>open-tcp-server</code>. |
| 14158 |
</p> |
| 14159 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-tcp-client (list port-number: 8080 |
| 14160 |
eol-encoding: 'cr-lf)))</b> |
| 14161 |
> <b>p</b> |
| 14162 |
#<input-output-port #2 (tcp-client #u8(127 0 0 1) 8080)> |
| 14163 |
> <b>(display "GET /\n" p)</b> |
| 14164 |
> <b>(force-output p)</b> |
| 14165 |
> <b>(read-line p)</b> |
| 14166 |
"<HTML>" |
| 14167 |
</pre></td></tr></table> |
| 14168 |
|
| 14169 |
|
| 14170 |
|
| 14171 |
<a name="Definition_of_open-tcp-server"></a><a name="Procedure_open-tcp-server"></a><a name="index-open_002dtcp_002dserver"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-tcp-server">open-tcp-server</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14172 |
|
| 14173 |
<p>This procedure sets up a socket to accept network connection requests |
| 14174 |
from clients and returns a tcp-server-port from which network |
| 14175 |
connections to clients are obtained. Tcp-server-ports are a direct |
| 14176 |
subtype of object-ports (i.e. they are not character-ports) and are |
| 14177 |
input-ports. Reading from a tcp-server-port with the <code>read</code> |
| 14178 |
procedure will block until a network connection request is received |
| 14179 |
from a client. The <code>read</code> procedure will then return a |
| 14180 |
tcp-client-port (a subtype of device-port) that represents this |
| 14181 |
connection and allows communication with that client. Closing a |
| 14182 |
tcp-server-port with either the <code>close-input-port</code> or |
| 14183 |
<code>close-port</code> procedures will cause the network subsystem to stop |
| 14184 |
accepting connections on that socket. |
| 14185 |
</p> |
| 14186 |
<p>The parameter of this procedure is an IP port number (16-bit nonnegative |
| 14187 |
exact integer), a string of the form <code>"<var>INTF</var>:<var>PORT</var>"</code> or |
| 14188 |
a list of port settings which must contain a <code>port-number:</code> |
| 14189 |
setting. When the parameter is the number <var>PORT</var> it is handled as |
| 14190 |
if it was the setting <code>port-number:</code> <var>PORT</var>. When the |
| 14191 |
parameter is the string <code>"<var>INTF</var>:<var>PORT</var>"</code> it is handled |
| 14192 |
as if it was the setting <code>server-address:</code> |
| 14193 |
<code>"<var>INTF</var>:<var>PORT</var>"</code>. |
| 14194 |
</p> |
| 14195 |
<p>Below is a list of the settings allowed in addition to the settings |
| 14196 |
<code>keep-alive:</code> and <code>coalesce:</code> allowed by the |
| 14197 |
<code>open-tcp-client</code> procedure and the generic settings of |
| 14198 |
byte-ports. The settings which are not listed below apply to the |
| 14199 |
tcp-client-port that is returned by <code>read</code> when a connection is |
| 14200 |
accepted and have the same meaning as if they were used in a call to |
| 14201 |
the <code>open-tcp-client</code> procedure. |
| 14202 |
</p> |
| 14203 |
<ul> |
| 14204 |
<li> |
| 14205 |
<code>server-address:</code> <var>string-or-ip-address</var> |
| 14206 |
|
| 14207 |
<p>This setting indicates the internet address of the network interface |
| 14208 |
on which connections requests are accepted, and possibly the IP port |
| 14209 |
number. When this parameter is not specified or is <code>""</code>, the |
| 14210 |
connection requests are accepted only on the loopback interface (with |
| 14211 |
IP address 127.0.0.1). When this parameter is <code>"*"</code>, the |
| 14212 |
connection requests are accepted on all network interfaces |
| 14213 |
(i.e. address INADDR_ANY). The parameter can be a string denoting a |
| 14214 |
host name, which will be translated to an IP address by the |
| 14215 |
<code>host-info</code> procedure, or a 4 element u8vector which contains the |
| 14216 |
32-bit IPv4 address or an 8 element u16vector which contains the |
| 14217 |
128-bit IPv6 address. A string of the form |
| 14218 |
<code>"<var>INTF</var>:<var>PORT</var>"</code> is handled as if it was the combination |
| 14219 |
of settings <code>server-address:</code> <code>"<var>INTF</var>"</code> |
| 14220 |
<code>port-number:</code> <var>PORT</var>. |
| 14221 |
</p> |
| 14222 |
</li><li> |
| 14223 |
<code>port-number:</code> <var>16-bit-exact-integer</var> |
| 14224 |
|
| 14225 |
<p>This setting indicates the IP port number assigned to the socket which |
| 14226 |
accepts connection requests from clients. So called “well-known |
| 14227 |
ports”, which are reserved for standard services, have a port number |
| 14228 |
below 1024 and can only be assigned to a socket by a process with |
| 14229 |
superuser priviledges (e.g. 80 for the HTTP service, 23 for the telnet |
| 14230 |
service). No special priviledges are needed to assign higher |
| 14231 |
port numbers to a socket. The special value 0 requests that a |
| 14232 |
currently unused port number be assigned to the socket (the port |
| 14233 |
number assigned can be retrieved using the procedure |
| 14234 |
<code>tcp-server-socket-info</code>). There is no default value for this |
| 14235 |
setting. |
| 14236 |
</p> |
| 14237 |
</li><li> |
| 14238 |
<code>backlog:</code> <var>positive-exact-integer</var> |
| 14239 |
|
| 14240 |
<p>This setting indicates the maximum number of connection requests that |
| 14241 |
can be waiting to be accepted by a call to <code>read</code> (technically it |
| 14242 |
is the value passed as the second argument of the UNIX <code>listen()</code> |
| 14243 |
function). The default value of this setting is 128. |
| 14244 |
</p> |
| 14245 |
</li><li> |
| 14246 |
<code>reuse-address:</code> ( <code>#f</code> | <code>#t</code> ) |
| 14247 |
|
| 14248 |
<p>This setting controls whether it is possible to assign a port number |
| 14249 |
that is currently active. Note that when a server process terminates, |
| 14250 |
the socket it was using to accept connection requests does not become |
| 14251 |
inactive immediately. Instead it remains active for a few minutes to |
| 14252 |
ensure clean termination of the connections. A setting of <code>#f</code> |
| 14253 |
will cause an exception to be raised in that case. A setting of |
| 14254 |
<code>#t</code> will allow a port number to be used even if it is active. |
| 14255 |
The default value of this setting is <code>#t</code>. |
| 14256 |
</p> |
| 14257 |
</li></ul> |
| 14258 |
|
| 14259 |
<p>Below is an example of the server-side code that accepts connections |
| 14260 |
on port 8080 of any network interface. For the client-side code see |
| 14261 |
the example for the procedure <code>open-tcp-client</code>. |
| 14262 |
</p> |
| 14263 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define s (open-tcp-server (list server-address: "*" |
| 14264 |
port-number: 8080 |
| 14265 |
eol-encoding: 'cr-lf)))</b> |
| 14266 |
> <b>(define p (read s)) <span class="roman"><i>; blocks until client connects</i></span></b> |
| 14267 |
> <b>p</b> |
| 14268 |
#<input-output-port #2 (tcp-client 8080)> |
| 14269 |
> <b>(read-line p)</b> |
| 14270 |
"GET /" |
| 14271 |
> <b>(display "<HTML>\n" p)</b> |
| 14272 |
> <b>(force-output p)</b> |
| 14273 |
</pre></td></tr></table> |
| 14274 |
|
| 14275 |
|
| 14276 |
|
| 14277 |
<a name="Definition_of_tcp-service-register!"></a><a name="Procedure_tcp-service-register!"></a><a name="index-tcp_002dservice_002dregister_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tcp-service-register!">tcp-service-register!</a></b></code><i> <var>port-number-or-address-or-settings</var> <var>thunk</var> <span class="roman">[</span><var>thread-group</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14278 |
<a name="Definition_of_tcp-service-unregister!"></a><a name="Procedure_tcp-service-unregister!"></a><a name="index-tcp_002dservice_002dunregister_0021"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_tcp-service-unregister!">tcp-service-unregister!</a></b></code><i> <var>port-number-or-address-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14279 |
|
| 14280 |
<p>The procedure <code>tcp-service-register!</code> sets up a socket to accept |
| 14281 |
network connection requests from clients and creates a “service” |
| 14282 |
thread which processes the incoming connections. The parameter |
| 14283 |
<var>port-number-or-address-or-settings</var> has the same meaning as for |
| 14284 |
the procedure <code>open-tcp-server</code>. |
| 14285 |
</p> |
| 14286 |
<p>For each connection established the service thread creates a |
| 14287 |
“handler” thread which executes a call to the procedure <var>thunk</var> |
| 14288 |
with no argument. The handler thread’s current input-port and current |
| 14289 |
output-port are both set to the tcp-client-port created for the |
| 14290 |
connection. There is no need for the <var>thunk</var> to close the |
| 14291 |
tcp-client-port, as this is done by the handler thread when the |
| 14292 |
<var>thunk</var> returns normally. |
| 14293 |
</p> |
| 14294 |
<p>The procedure <code>tcp-service-unregister!</code> terminates the service |
| 14295 |
thread which was registered by <code>tcp-service-register!</code> with the |
| 14296 |
same network interface and port number (if a service thread is still |
| 14297 |
registered). The procedure <code>tcp-service-register!</code> implicitly |
| 14298 |
calls <code>tcp-service-unregister!</code> before registering the new |
| 14299 |
service thread. |
| 14300 |
</p> |
| 14301 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(tcp-service-register! |
| 14302 |
8000 |
| 14303 |
(lambda () (display "hello\n")))</b> |
| 14304 |
> <b>(define p (open-tcp-client 8000))</b> |
| 14305 |
> <b>(read-line p)</b> |
| 14306 |
"hello" |
| 14307 |
> <b>(tcp-service-unregister! 8000)</b> |
| 14308 |
</pre></td></tr></table> |
| 14309 |
|
| 14310 |
|
| 14311 |
|
| 14312 |
<a name="Directory_002dports"></a><hr size="6"><br/><br/><br/> |
| 14313 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14314 |
<tr><td valign="middle" align="left"><a href="#Network-devices" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14315 |
<td valign="middle" align="left"><a href="#Vector_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14316 |
<td valign="middle" align="left"> </td> |
| 14317 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14318 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14319 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14320 |
<td valign="middle" align="left"> </td> |
| 14321 |
<td valign="middle" align="left"> </td> |
| 14322 |
<td valign="middle" align="left"> </td> |
| 14323 |
<td valign="middle" align="left"> </td> |
| 14324 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14325 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14326 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14327 |
</tr></table> |
| 14328 |
<a name="Directory_002dports-1"></a> |
| 14329 |
<h2 class="section">17.8 Directory-ports</h2> |
| 14330 |
|
| 14331 |
<a name="Definition_of_open-directory"></a><a name="Procedure_open-directory"></a><a name="index-open_002ddirectory"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-directory">open-directory</a></b></code><i> <var>path-or-settings</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14332 |
|
| 14333 |
<p>This procedure opens a directory of the filesystem for reading its |
| 14334 |
entries and returns a directory-port from which the entries can be |
| 14335 |
enumerated. Directory-ports are a direct subtype of object-ports |
| 14336 |
(i.e. they are not character-ports) and are input-ports. Reading from |
| 14337 |
a directory-port with the <code>read</code> procedure returns the next file |
| 14338 |
name in the directory as a string. The end-of-file object is returned |
| 14339 |
when all the file names have been enumerated. Another way to get the |
| 14340 |
list of all files in a directory is the <code>directory-files</code> |
| 14341 |
procedure which returns a list of the files in the directory. The |
| 14342 |
advantage of using directory-ports is that it allows iterating over |
| 14343 |
the files in a directory in constant space, which is interesting when |
| 14344 |
the number of files in the directory is not known in advance and may |
| 14345 |
be large. Note that the order in which the names are returned is |
| 14346 |
operating-system dependent. |
| 14347 |
</p> |
| 14348 |
<p>The parameter of this procedure is either a string denoting a |
| 14349 |
filesystem path to a directory or a list of port settings which must |
| 14350 |
contain a <code>path:</code> setting. Here are the settings allowed in |
| 14351 |
addition to the generic settings of object-ports: |
| 14352 |
</p> |
| 14353 |
<ul> |
| 14354 |
<li> |
| 14355 |
<code>path:</code> <var>string</var> |
| 14356 |
|
| 14357 |
<p>This setting indicates the location of the directory in the filesystem. |
| 14358 |
There is no default value for this setting. |
| 14359 |
</p> |
| 14360 |
</li><li> |
| 14361 |
<code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> ) |
| 14362 |
|
| 14363 |
<p>This setting controls whether hidden-files will be returned. Under |
| 14364 |
UNIX and Mac OS X hidden-files are those that start with a period |
| 14365 |
(such as ‘<samp>.</samp>’, ‘<samp>..</samp>’, and ‘<samp>.profile</samp>’). Under Microsoft |
| 14366 |
Windows hidden files are the ‘<samp>.</samp>’ and ‘<samp>..</samp>’ entries and the |
| 14367 |
files whose “hidden file” attribute is set. A setting of <code>#f</code> |
| 14368 |
will enumerate all the files. A setting of <code>#t</code> will only |
| 14369 |
enumerate the files that are not hidden. A setting of |
| 14370 |
<code>dot-and-dot-dot</code> will enumerate all the files except for the |
| 14371 |
‘<samp>.</samp>’ and ‘<samp>..</samp>’ hidden files. The default value of this |
| 14372 |
setting is <code>#t</code>. |
| 14373 |
</p> |
| 14374 |
</li></ul> |
| 14375 |
|
| 14376 |
<p>For example: |
| 14377 |
</p> |
| 14378 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(let ((p (open-directory (list path: "../examples" |
| 14379 |
ignore-hidden: #f)))) |
| 14380 |
(let loop () |
| 14381 |
(let ((fn (read p))) |
| 14382 |
(if (string? fn) |
| 14383 |
(begin |
| 14384 |
(pp (path-expand fn)) |
| 14385 |
(loop))))) |
| 14386 |
(close-input-port p))</b> |
| 14387 |
"/u/feeley/examples/." |
| 14388 |
"/u/feeley/examples/.." |
| 14389 |
"/u/feeley/examples/complex" |
| 14390 |
"/u/feeley/examples/README" |
| 14391 |
"/u/feeley/examples/simple" |
| 14392 |
> <b>(define x (open-directory "../examples"))</b> |
| 14393 |
> <b>(read-all x)</b> |
| 14394 |
("complex" "README" "simple") |
| 14395 |
</pre></td></tr></table> |
| 14396 |
|
| 14397 |
|
| 14398 |
|
| 14399 |
<a name="Vector_002dports"></a><hr size="6"><br/><br/><br/> |
| 14400 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14401 |
<tr><td valign="middle" align="left"><a href="#Directory_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14402 |
<td valign="middle" align="left"><a href="#String_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14403 |
<td valign="middle" align="left"> </td> |
| 14404 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14405 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14406 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14407 |
<td valign="middle" align="left"> </td> |
| 14408 |
<td valign="middle" align="left"> </td> |
| 14409 |
<td valign="middle" align="left"> </td> |
| 14410 |
<td valign="middle" align="left"> </td> |
| 14411 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14412 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14413 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14414 |
</tr></table> |
| 14415 |
<a name="Vector_002dports-1"></a> |
| 14416 |
<h2 class="section">17.9 Vector-ports</h2> |
| 14417 |
|
| 14418 |
<a name="Definition_of_open-vector"></a><a name="Procedure_open-vector"></a><a name="index-open_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-vector">open-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14419 |
<a name="Definition_of_open-input-vector"></a><a name="Procedure_open-input-vector"></a><a name="index-open_002dinput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-input-vector">open-input-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14420 |
<a name="Definition_of_open-output-vector"></a><a name="Procedure_open-output-vector"></a><a name="index-open_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-output-vector">open-output-vector</a></b></code><i> <span class="roman">[</span><var>vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14421 |
<a name="Definition_of_call-with-input-vector"></a><a name="Procedure_call-with-input-vector"></a><a name="index-call_002dwith_002dinput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-input-vector">call-with-input-vector</a></b></code><i> <var>vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14422 |
<a name="Definition_of_call-with-output-vector"></a><a name="Procedure_call-with-output-vector"></a><a name="index-call_002dwith_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-output-vector">call-with-output-vector</a></b></code><i> <var>vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14423 |
<a name="Definition_of_with-input-from-vector"></a><a name="Procedure_with-input-from-vector"></a><a name="index-with_002dinput_002dfrom_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-vector">with-input-from-vector</a></b></code><i> <var>vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14424 |
<a name="Definition_of_with-output-to-vector"></a><a name="Procedure_with-output-to-vector"></a><a name="index-with_002doutput_002dto_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-vector">with-output-to-vector</a></b></code><i> <var>vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14425 |
|
| 14426 |
<p>Vector-ports represent streams of Scheme objects. They are a direct |
| 14427 |
subtype of object-ports (i.e. they are not character-ports). All of |
| 14428 |
these procedures create vector-ports that are either unidirectional or |
| 14429 |
bidirectional. The <code>direction:</code> setting will default to the |
| 14430 |
value <code>input</code> for the procedures <code>open-input-vector</code>, |
| 14431 |
<code>call-with-input-vector</code> and <code>with-input-from-vector</code>, to |
| 14432 |
the value <code>output</code> for the procedures <code>open-output-vector</code>, |
| 14433 |
<code>call-with-output-vector</code> and <code>with-output-to-vector</code>, and |
| 14434 |
to the value <code>input-output</code> for the procedure <code>open-vector</code>. |
| 14435 |
Bidirectional vector-ports behave like FIFOs: data written to the port |
| 14436 |
is added to the end of the stream that is read. It is only when a |
| 14437 |
bidirectional vector-port’s output-side is closed with a call to the |
| 14438 |
<code>close-output-port</code> procedure that the stream’s end is known |
| 14439 |
(when the stream’s end is reached, reading the port returns the |
| 14440 |
end-of-file object). |
| 14441 |
</p> |
| 14442 |
<p>The procedures <code>open-vector</code>, <code>open-input-vector</code> and |
| 14443 |
<code>open-output-vector</code> return the port that is created. The |
| 14444 |
procedures <code>call-with-input-vector</code> and |
| 14445 |
<code>call-with-output-vector</code> create a vector port, call the |
| 14446 |
procedure <var>proc</var> with the port as single argument and then close |
| 14447 |
the port. The procedures <code>with-input-from-vector</code> and |
| 14448 |
<code>with-output-to-vector</code> create a vector port, dynamically bind |
| 14449 |
the current input-port and current output-port respectively to the |
| 14450 |
port created for the duration of a call to the procedure <var>thunk</var> |
| 14451 |
with no argument, and then close the port. The procedures |
| 14452 |
<code>call-with-input-vector</code> and <code>with-input-from-vector</code> return |
| 14453 |
the value returned by the procedures <var>proc</var> and <var>thunk</var> |
| 14454 |
respectively. The procedures <code>call-with-output-vector</code> and |
| 14455 |
<code>with-output-to-vector</code> return the vector accumulated in the port |
| 14456 |
(see <code>get-output-vector</code>). |
| 14457 |
</p> |
| 14458 |
<p>The first parameter of these procedures is either a vector of the |
| 14459 |
elements used to initialize the stream or a list of port settings. If |
| 14460 |
it is not specified, the parameter of the <code>open-vector</code>, |
| 14461 |
<code>open-input-vector</code>, and <code>open-output-vector</code> procedures |
| 14462 |
defaults to an empty list of port settings. Here are the settings |
| 14463 |
allowed in addition to the generic settings of object-ports: |
| 14464 |
</p> |
| 14465 |
<ul> |
| 14466 |
<li> |
| 14467 |
<code>init:</code> <var>vector</var> |
| 14468 |
|
| 14469 |
<p>This setting indicates the initial content of the stream. The default |
| 14470 |
value of this setting is an empty vector. |
| 14471 |
</p> |
| 14472 |
</li><li> |
| 14473 |
<code>permanent-close:</code> ( <code>#f</code> | <code>#t</code> ) |
| 14474 |
|
| 14475 |
<p>This setting controls whether a call to the procedures |
| 14476 |
<code>close-output-port</code> will close the output-side of a bidirectional |
| 14477 |
vector-port permanently or not. A permanently closed bidirectional |
| 14478 |
vector-port whose end-of-file has been reached on the input-side will |
| 14479 |
return the end-of-file object for all subsequent calls to the |
| 14480 |
<code>read</code> procedure. A non-permanently closed bidirectional |
| 14481 |
vector-port will return to its opened state when its end-of-file is |
| 14482 |
read. The default value of this setting is <code>#t</code>. |
| 14483 |
</p> |
| 14484 |
</li></ul> |
| 14485 |
|
| 14486 |
<p>For example: |
| 14487 |
</p> |
| 14488 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-vector))</b> |
| 14489 |
> <b>(write 1 p)</b> |
| 14490 |
> <b>(write 2 p)</b> |
| 14491 |
> <b>(write 3 p)</b> |
| 14492 |
> <b>(force-output p)</b> |
| 14493 |
> <b>(read p)</b> |
| 14494 |
1 |
| 14495 |
> <b>(read p)</b> |
| 14496 |
2 |
| 14497 |
> <b>(close-output-port p)</b> |
| 14498 |
> <b>(read p)</b> |
| 14499 |
3 |
| 14500 |
> <b>(read p)</b> |
| 14501 |
#!eof |
| 14502 |
> <b>(with-output-to-vector '() (lambda () (write 1) (write 2)))</b> |
| 14503 |
#(1 2) |
| 14504 |
</pre></td></tr></table> |
| 14505 |
|
| 14506 |
|
| 14507 |
|
| 14508 |
<a name="Definition_of_open-vector-pipe"></a><a name="Procedure_open-vector-pipe"></a><a name="index-open_002dvector_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-vector-pipe">open-vector-pipe</a></b></code><i> <span class="roman">[</span><var>vector-or-settings1</var> <span class="roman">[</span><var>vector-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14509 |
|
| 14510 |
<p>The procedure <code>open-vector-pipe</code> creates two vector-ports and |
| 14511 |
returns these two ports. The two ports are interrelated as follows: |
| 14512 |
the first port’s output-side is connected to the second port’s |
| 14513 |
input-side and the first port’s input-side is connected to the second |
| 14514 |
port’s output-side. The value <var>vector-or-settings1</var> is used to |
| 14515 |
setup the first vector-port and <var>vector-or-settings2</var> is used to |
| 14516 |
setup the second vector-port. The same settings as for |
| 14517 |
<code>open-vector</code> are allowed. The default <code>direction:</code> setting |
| 14518 |
is <code>input-output</code> (i.e. a bidirectional port is created). If it |
| 14519 |
is not specified <var>vector-or-settings1</var> defaults to the empty list. |
| 14520 |
If it is not specified <var>vector-or-settings2</var> defaults to |
| 14521 |
<var>vector-or-settings1</var> but with the <code>init:</code> setting set to the |
| 14522 |
empty vector and with the input and output settings exchanged (e.g. if |
| 14523 |
the first port is an input-port then the second port is an |
| 14524 |
output-port, if the first port’s input-side is non-buffered then the |
| 14525 |
second port’s output-side is non-buffered). |
| 14526 |
</p> |
| 14527 |
<p>For example: |
| 14528 |
</p> |
| 14529 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (server op) |
| 14530 |
(receive (c s) (open-vector-pipe) <span class="roman"><i>; client-side and server-side ports</i></span> |
| 14531 |
(thread-start! |
| 14532 |
(make-thread |
| 14533 |
(lambda () |
| 14534 |
(let loop () |
| 14535 |
(let ((request (read s))) |
| 14536 |
(if (not (eof-object? request)) |
| 14537 |
(begin |
| 14538 |
(write (op request) s) |
| 14539 |
(newline s) |
| 14540 |
(force-output s) |
| 14541 |
(loop)))))))) |
| 14542 |
c))</b> |
| 14543 |
> <b>(define a (server (lambda (x) (expt 2 x))))</b> |
| 14544 |
> <b>(define b (server (lambda (x) (expt 10 x))))</b> |
| 14545 |
> <b>(write 100 a)</b> |
| 14546 |
> <b>(write 30 b)</b> |
| 14547 |
> <b>(read a)</b> |
| 14548 |
1267650600228229401496703205376 |
| 14549 |
> <b>(read b)</b> |
| 14550 |
1000000000000000000000000000000 |
| 14551 |
</pre></td></tr></table> |
| 14552 |
|
| 14553 |
|
| 14554 |
|
| 14555 |
<a name="Definition_of_get-output-vector"></a><a name="Procedure_get-output-vector"></a><a name="index-get_002doutput_002dvector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_get-output-vector">get-output-vector</a></b></code><i> <var>vector-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14556 |
|
| 14557 |
<p>The procedure <code>get-output-vector</code> takes an output vector-port or |
| 14558 |
a bidirectional vector-port as parameter and removes all the objects |
| 14559 |
currently on the output-side, returning them in a vector. The port |
| 14560 |
remains open and subsequent output to the port and calls to the |
| 14561 |
procedure <code>get-output-vector</code> are possible. |
| 14562 |
</p> |
| 14563 |
<p>For example: |
| 14564 |
</p> |
| 14565 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-vector '#(1 2 3)))</b> |
| 14566 |
> <b>(write 4 p)</b> |
| 14567 |
> <b>(get-output-vector p)</b> |
| 14568 |
#(1 2 3 4) |
| 14569 |
> <b>(write 5 p)</b> |
| 14570 |
> <b>(write 6 p)</b> |
| 14571 |
> <b>(get-output-vector p)</b> |
| 14572 |
#(5 6) |
| 14573 |
</pre></td></tr></table> |
| 14574 |
|
| 14575 |
|
| 14576 |
|
| 14577 |
<a name="String_002dports"></a><hr size="6"><br/><br/><br/> |
| 14578 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14579 |
<tr><td valign="middle" align="left"><a href="#Vector_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14580 |
<td valign="middle" align="left"><a href="#U8vector_002dports" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14581 |
<td valign="middle" align="left"> </td> |
| 14582 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14583 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14584 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14585 |
<td valign="middle" align="left"> </td> |
| 14586 |
<td valign="middle" align="left"> </td> |
| 14587 |
<td valign="middle" align="left"> </td> |
| 14588 |
<td valign="middle" align="left"> </td> |
| 14589 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14590 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14591 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14592 |
</tr></table> |
| 14593 |
<a name="String_002dports-1"></a> |
| 14594 |
<h2 class="section">17.10 String-ports</h2> |
| 14595 |
|
| 14596 |
<a name="Definition_of_open-string"></a><a name="Procedure_open-string"></a><a name="index-open_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-string">open-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14597 |
<a name="Definition_of_open-input-string"></a><a name="Procedure_open-input-string"></a><a name="index-open_002dinput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-input-string">open-input-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14598 |
<a name="Definition_of_open-output-string"></a><a name="Procedure_open-output-string"></a><a name="index-open_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-output-string">open-output-string</a></b></code><i> <span class="roman">[</span><var>string-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14599 |
<a name="Definition_of_call-with-input-string"></a><a name="Procedure_call-with-input-string"></a><a name="index-call_002dwith_002dinput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-input-string">call-with-input-string</a></b></code><i> <var>string-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14600 |
<a name="Definition_of_call-with-output-string"></a><a name="Procedure_call-with-output-string"></a><a name="index-call_002dwith_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-output-string">call-with-output-string</a></b></code><i> <var>string-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14601 |
<a name="Definition_of_with-input-from-string"></a><a name="Procedure_with-input-from-string"></a><a name="index-with_002dinput_002dfrom_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-string">with-input-from-string</a></b></code><i> <var>string-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14602 |
<a name="Definition_of_with-output-to-string"></a><a name="Procedure_with-output-to-string"></a><a name="index-with_002doutput_002dto_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-string">with-output-to-string</a></b></code><i> <var>string-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14603 |
<a name="Definition_of_open-string-pipe"></a><a name="Procedure_open-string-pipe"></a><a name="index-open_002dstring_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-string-pipe">open-string-pipe</a></b></code><i> <span class="roman">[</span><var>string-or-settings1</var> <span class="roman">[</span><var>string-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14604 |
<a name="Definition_of_get-output-string"></a><a name="Procedure_get-output-string"></a><a name="index-get_002doutput_002dstring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_get-output-string">get-output-string</a></b></code><i> <var>string-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14605 |
|
| 14606 |
<p>String-ports represent streams of characters. They are a direct |
| 14607 |
subtype of character-ports. These procedures are the string-port |
| 14608 |
analog of the procedures specified in the vector-ports section. Note |
| 14609 |
that these procedures are a superset of the procedures specified in |
| 14610 |
the “Basic String Ports SRFI” (SRFI 6). |
| 14611 |
</p> |
| 14612 |
<p>For example: |
| 14613 |
</p> |
| 14614 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-string))</b> |
| 14615 |
> <b>(write 1 p)</b> |
| 14616 |
> <b>(write 2 p)</b> |
| 14617 |
> <b>(write 3 p)</b> |
| 14618 |
> <b>(force-output p)</b> |
| 14619 |
> <b>(read-char p)</b> |
| 14620 |
#\1 |
| 14621 |
> <b>(read-char p)</b> |
| 14622 |
#\2 |
| 14623 |
> <b>(close-output-port p)</b> |
| 14624 |
> <b>(read-char p)</b> |
| 14625 |
#\3 |
| 14626 |
> <b>(read-char p)</b> |
| 14627 |
#!eof |
| 14628 |
> <b>(with-output-to-string '() (lambda () (write 1) (write 2)))</b> |
| 14629 |
"12" |
| 14630 |
</pre></td></tr></table> |
| 14631 |
|
| 14632 |
|
| 14633 |
|
| 14634 |
<a name="Definition_of_object-%3Estring"></a><a name="Procedure_object-%3Estring"></a><a name="index-object_002d_003estring"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_object-%3Estring">object->string</a></b></code><i> <var>obj</var> <span class="roman">[</span><var>n</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14635 |
|
| 14636 |
<p>This procedure converts the object <var>obj</var> to its external |
| 14637 |
representation and returns it in a string. The parameter <var>n</var> |
| 14638 |
specifies the maximal width of the resulting string. If the external |
| 14639 |
representation is wider than <var>n</var>, the resulting string will be |
| 14640 |
truncated to <var>n</var> characters and the last 3 characters will be set |
| 14641 |
to periods. Note that the current readtable is used. |
| 14642 |
</p> |
| 14643 |
<p>For example: |
| 14644 |
</p> |
| 14645 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(object->string (expt 2 100))</b> |
| 14646 |
"1267650600228229401496703205376" |
| 14647 |
> <b>(object->string (expt 2 100) 30)</b> |
| 14648 |
"126765060022822940149670320..." |
| 14649 |
> <b>(object->string (cons car cdr))</b> |
| 14650 |
"(#<procedure #2 car> . #<procedure #3 cdr>)" |
| 14651 |
</pre></td></tr></table> |
| 14652 |
|
| 14653 |
|
| 14654 |
|
| 14655 |
<a name="U8vector_002dports"></a><hr size="6"><br/><br/><br/> |
| 14656 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14657 |
<tr><td valign="middle" align="left"><a href="#String_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14658 |
<td valign="middle" align="left"><a href="#Other-procedures-related-to-I_002fO" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14659 |
<td valign="middle" align="left"> </td> |
| 14660 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14661 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14662 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14663 |
<td valign="middle" align="left"> </td> |
| 14664 |
<td valign="middle" align="left"> </td> |
| 14665 |
<td valign="middle" align="left"> </td> |
| 14666 |
<td valign="middle" align="left"> </td> |
| 14667 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14668 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14669 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14670 |
</tr></table> |
| 14671 |
<a name="U8vector_002dports-1"></a> |
| 14672 |
<h2 class="section">17.11 U8vector-ports</h2> |
| 14673 |
|
| 14674 |
<a name="Definition_of_open-u8vector"></a><a name="Procedure_open-u8vector"></a><a name="index-open_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-u8vector">open-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14675 |
<a name="Definition_of_open-input-u8vector"></a><a name="Procedure_open-input-u8vector"></a><a name="index-open_002dinput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-input-u8vector">open-input-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14676 |
<a name="Definition_of_open-output-u8vector"></a><a name="Procedure_open-output-u8vector"></a><a name="index-open_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-output-u8vector">open-output-u8vector</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14677 |
<a name="Definition_of_call-with-input-u8vector"></a><a name="Procedure_call-with-input-u8vector"></a><a name="index-call_002dwith_002dinput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-input-u8vector">call-with-input-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14678 |
<a name="Definition_of_call-with-output-u8vector"></a><a name="Procedure_call-with-output-u8vector"></a><a name="index-call_002dwith_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_call-with-output-u8vector">call-with-output-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>proc</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14679 |
<a name="Definition_of_with-input-from-u8vector"></a><a name="Procedure_with-input-from-u8vector"></a><a name="index-with_002dinput_002dfrom_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-input-from-u8vector">with-input-from-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14680 |
<a name="Definition_of_with-output-to-u8vector"></a><a name="Procedure_with-output-to-u8vector"></a><a name="index-with_002doutput_002dto_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_with-output-to-u8vector">with-output-to-u8vector</a></b></code><i> <var>u8vector-or-settings</var> <var>thunk</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14681 |
<a name="Definition_of_open-u8vector-pipe"></a><a name="Procedure_open-u8vector-pipe"></a><a name="index-open_002du8vector_002dpipe"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_open-u8vector-pipe">open-u8vector-pipe</a></b></code><i> <span class="roman">[</span><var>u8vector-or-settings1</var> <span class="roman">[</span><var>u8vector-or-settings2</var><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14682 |
<a name="Definition_of_get-output-u8vector"></a><a name="Procedure_get-output-u8vector"></a><a name="index-get_002doutput_002du8vector"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_get-output-u8vector">get-output-u8vector</a></b></code><i> <var>u8vector-port</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14683 |
|
| 14684 |
<p>U8vector-ports represent streams of bytes. They are a direct subtype |
| 14685 |
of byte-ports. These procedures are the u8vector-port analog of the |
| 14686 |
procedures specified in the vector-ports section. |
| 14687 |
</p> |
| 14688 |
<p>For example: |
| 14689 |
</p> |
| 14690 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define p (open-u8vector))</b> |
| 14691 |
> <b>(write 1 p)</b> |
| 14692 |
> <b>(write 2 p)</b> |
| 14693 |
> <b>(write 3 p)</b> |
| 14694 |
> <b>(force-output p)</b> |
| 14695 |
> <b>(read-u8 p)</b> |
| 14696 |
49 |
| 14697 |
> <b>(read-u8 p)</b> |
| 14698 |
50 |
| 14699 |
> <b>(close-output-port p)</b> |
| 14700 |
> <b>(read-u8 p)</b> |
| 14701 |
51 |
| 14702 |
> <b>(read-u8 p)</b> |
| 14703 |
#!eof |
| 14704 |
> <b>(with-output-to-u8vector '() (lambda () (write 1) (write 2)))</b> |
| 14705 |
#u8(49 50) |
| 14706 |
</pre></td></tr></table> |
| 14707 |
|
| 14708 |
|
| 14709 |
|
| 14710 |
<a name="Other-procedures-related-to-I_002fO"></a><hr size="6"><br/><br/><br/> |
| 14711 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14712 |
<tr><td valign="middle" align="left"><a href="#U8vector_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14713 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14714 |
<td valign="middle" align="left"> </td> |
| 14715 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14716 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14717 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14718 |
<td valign="middle" align="left"> </td> |
| 14719 |
<td valign="middle" align="left"> </td> |
| 14720 |
<td valign="middle" align="left"> </td> |
| 14721 |
<td valign="middle" align="left"> </td> |
| 14722 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14723 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14724 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14725 |
</tr></table> |
| 14726 |
<a name="Other-procedures-related-to-I_002fO-1"></a> |
| 14727 |
<h2 class="section">17.12 Other procedures related to I/O</h2> |
| 14728 |
|
| 14729 |
<a name="Definition_of_current-input-port"></a><a name="Procedure_current-input-port"></a><a name="index-current_002dinput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-input-port">current-input-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14730 |
<a name="Definition_of_current-output-port"></a><a name="Procedure_current-output-port"></a><a name="index-current_002doutput_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-output-port">current-output-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14731 |
<a name="Definition_of_current-error-port"></a><a name="Procedure_current-error-port"></a><a name="index-current_002derror_002dport"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-error-port">current-error-port</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14732 |
<a name="Definition_of_current-readtable"></a><a name="Procedure_current-readtable"></a><a name="index-current_002dreadtable"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_current-readtable">current-readtable</a></b></code><i> <span class="roman">[</span><var>new-value</var><span class="roman">]</span></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14733 |
|
| 14734 |
<p>These procedures are parameter objects which represent respectively: |
| 14735 |
the current input-port, the current output-port, the current |
| 14736 |
error-port, and the current readtable. |
| 14737 |
</p> |
| 14738 |
|
| 14739 |
|
| 14740 |
<a name="Definition_of_print"></a><a name="Procedure_print"></a><a name="index-print"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_print">print</a></b></code><i> <span class="roman">[</span><code>port:</code> <var>port</var><span class="roman">]</span> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14741 |
<a name="Definition_of_println"></a><a name="Procedure_println"></a><a name="index-println"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_println">println</a></b></code><i> <span class="roman">[</span><code>port:</code> <var>port</var><span class="roman">]</span> <var>obj</var>…</i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14742 |
|
| 14743 |
<p>The <code>print</code> procedure writes a representation of each <var>obj</var>, |
| 14744 |
from left to right, to <var>port</var>. When a compound object is |
| 14745 |
encountered (pair, list, vector, box) the elements of that object are |
| 14746 |
recursively written without the surrounding tokens (parentheses, |
| 14747 |
spaces, dots, etc). Strings, symbols, keywords and characters are |
| 14748 |
written like the <code>display</code> procedure. If there are more than one |
| 14749 |
<var>obj</var>, the first <var>obj</var> must not be a keyword object. If it is |
| 14750 |
not specified, <var>port</var> defaults to the current output-port. The |
| 14751 |
procedure <code>print</code> returns an unspecified value. |
| 14752 |
</p> |
| 14753 |
<p>The <code>println</code> procedure does the same thing as the <code>print</code> |
| 14754 |
procedure and then writes an end of line to <var>port</var>. |
| 14755 |
</p> |
| 14756 |
<p>For example: |
| 14757 |
</p> |
| 14758 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(println "2*2 is " (* 2 2) " and 2+2 is " (+ 2 2))</b> |
| 14759 |
2*2 is 4 and 2+2 is 4 |
| 14760 |
> <b>(define x (list "<i>" (list "<tt>" 123 "</tt>") "</i>"))</b> |
| 14761 |
> <b>(println x)</b> |
| 14762 |
<i><tt>123</tt></i> |
| 14763 |
> <b>(define p (open-output-string))</b> |
| 14764 |
> <b>(print port: p 1 #\2 "345")</b> |
| 14765 |
> <b>(get-output-string p)</b> |
| 14766 |
"12345" |
| 14767 |
</pre></td></tr></table> |
| 14768 |
|
| 14769 |
|
| 14770 |
|
| 14771 |
<a name="Lexical-syntax-and-readtables"></a><hr size="6"><br/><br/><br/> |
| 14772 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14773 |
<tr><td valign="middle" align="left"><a href="#Other-procedures-related-to-I_002fO" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14774 |
<td valign="middle" align="left"><a href="#Readtables" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14775 |
<td valign="middle" align="left"> </td> |
| 14776 |
<td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14777 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14778 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14779 |
<td valign="middle" align="left"> </td> |
| 14780 |
<td valign="middle" align="left"> </td> |
| 14781 |
<td valign="middle" align="left"> </td> |
| 14782 |
<td valign="middle" align="left"> </td> |
| 14783 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14784 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14785 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14786 |
</tr></table> |
| 14787 |
<a name="Lexical-syntax-and-readtables-1"></a> |
| 14788 |
<h1 class="chapter">18. Lexical syntax and readtables</h1> |
| 14789 |
|
| 14790 |
<table class="menu" border="0" cellspacing="0"> |
| 14791 |
<tr><td align="left" valign="top"><a href="#Readtables">18.1 Readtables</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14792 |
<tr><td align="left" valign="top"><a href="#Boolean-syntax">18.2 Boolean syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14793 |
<tr><td align="left" valign="top"><a href="#Character-syntax">18.3 Character syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14794 |
<tr><td align="left" valign="top"><a href="#String-syntax">18.4 String syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14795 |
<tr><td align="left" valign="top"><a href="#Symbol-syntax">18.5 Symbol syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14796 |
<tr><td align="left" valign="top"><a href="#Keyword-syntax">18.6 Keyword syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14797 |
<tr><td align="left" valign="top"><a href="#Box-syntax">18.7 Box syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14798 |
<tr><td align="left" valign="top"><a href="#Number-syntax">18.8 Number syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14799 |
<tr><td align="left" valign="top"><a href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14800 |
<tr><td align="left" valign="top"><a href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></td><td> </td><td align="left" valign="top"> Special #! syntax |
| 14801 |
</td></tr> |
| 14802 |
<tr><td align="left" valign="top"><a href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14803 |
<tr><td align="left" valign="top"><a href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 14804 |
</table> |
| 14805 |
|
| 14806 |
<a name="Readtables"></a><hr size="6"><br/><br/><br/> |
| 14807 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 14808 |
<tr><td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 14809 |
<td valign="middle" align="left"><a href="#Boolean-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 14810 |
<td valign="middle" align="left"> </td> |
| 14811 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 14812 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 14813 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 14814 |
<td valign="middle" align="left"> </td> |
| 14815 |
<td valign="middle" align="left"> </td> |
| 14816 |
<td valign="middle" align="left"> </td> |
| 14817 |
<td valign="middle" align="left"> </td> |
| 14818 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 14819 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 14820 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 14821 |
</tr></table> |
| 14822 |
<a name="Readtables-1"></a> |
| 14823 |
<h2 class="section">18.1 Readtables</h2> |
| 14824 |
|
| 14825 |
<p>Readtables control the external textual representation of Scheme |
| 14826 |
objects, that is the encoding of Scheme objects using characters. |
| 14827 |
Readtables affect the behavior of the reader (i.e. the <code>read</code> |
| 14828 |
procedure and the parser used by the <code>load</code> procedure and the |
| 14829 |
interpreter and compiler) and the printer (i.e. the procedures |
| 14830 |
<code>write</code>, <code>display</code>, <code>print</code>, <code>println</code>, |
| 14831 |
<code>pretty-print</code>, and <code>pp</code>, and the procedure used by the REPL |
| 14832 |
to print results). To preserve write/read invariance the printer and |
| 14833 |
reader must be using compatible readtables. For example a symbol |
| 14834 |
which contains upper case letters will be printed with special escapes |
| 14835 |
if the readtable indicates that the reader is case-insensitive. |
| 14836 |
</p> |
| 14837 |
<p>Readtables are immutable records whose fields specify various textual |
| 14838 |
representation aspects. There are accessor procedures to retrieve the |
| 14839 |
content of specific fields. There are also functional update |
| 14840 |
procedures that create a copy of a readtable, with a specific field |
| 14841 |
set to a new value. |
| 14842 |
</p> |
| 14843 |
<a name="Definition_of_readtable?"></a><a name="Procedure_readtable?"></a><a name="index-readtable_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable?">readtable?</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14844 |
|
| 14845 |
<p>This procedure returns <code>#t</code> when <var>obj</var> is a readtable and |
| 14846 |
<code>#f</code> otherwise. |
| 14847 |
</p> |
| 14848 |
<p>For example: |
| 14849 |
</p> |
| 14850 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(readtable? (current-readtable))</b> |
| 14851 |
#t |
| 14852 |
> <b>(readtable? 123)</b> |
| 14853 |
#f |
| 14854 |
</pre></td></tr></table> |
| 14855 |
|
| 14856 |
|
| 14857 |
|
| 14858 |
<a name="Definition_of_readtable-case-conversion?"></a><a name="Procedure_readtable-case-conversion?"></a><a name="index-readtable_002dcase_002dconversion_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-case-conversion?">readtable-case-conversion?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14859 |
<a name="Definition_of_readtable-case-conversion?-set"></a><a name="Procedure_readtable-case-conversion?-set"></a><a name="index-readtable_002dcase_002dconversion_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-case-conversion?-set">readtable-case-conversion?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14860 |
|
| 14861 |
<p>The procedure <code>readtable-case-conversion?</code> returns the content of |
| 14862 |
the ‘<samp>case-conversion?</samp>’ field of <var>readtable</var>. When the |
| 14863 |
content of this field is <code>#f</code>, the reader preserves the case of |
| 14864 |
symbols and keyword objects that are read (i.e. <code>Ice</code> and |
| 14865 |
<code>ice</code> are distinct symbols). When the content of this field is |
| 14866 |
the symbol <code>upcase</code>, the reader converts lowercase letters to |
| 14867 |
uppercase when reading symbols and keywords (i.e. <code>Ice</code> is read |
| 14868 |
as the symbol <code>(string->symbol "ICE")</code>). Otherwise the reader |
| 14869 |
converts uppercase letters to lowercase when reading symbols and |
| 14870 |
keywords (i.e. <code>Ice</code> is read as the symbol <code>(string->symbol |
| 14871 |
"ice")</code>). |
| 14872 |
</p> |
| 14873 |
<p>The procedure <code>readtable-case-conversion?-set</code> returns a copy |
| 14874 |
of <var>readtable</var> where only the ‘<samp>case-conversion?</samp>’ field |
| 14875 |
has been changed to <var>new-value</var>. |
| 14876 |
</p> |
| 14877 |
<p>For example: |
| 14878 |
</p> |
| 14879 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-readtable-set! |
| 14880 |
(repl-output-port) |
| 14881 |
(readtable-case-conversion?-set |
| 14882 |
(output-port-readtable (repl-output-port)) |
| 14883 |
#f))</b> |
| 14884 |
> <b>(input-port-readtable-set! |
| 14885 |
(repl-input-port) |
| 14886 |
(readtable-case-conversion?-set |
| 14887 |
(input-port-readtable (repl-input-port)) |
| 14888 |
#f))</b> |
| 14889 |
> <b>'Ice</b> |
| 14890 |
Ice |
| 14891 |
> <b>(input-port-readtable-set! |
| 14892 |
(repl-input-port) |
| 14893 |
(readtable-case-conversion?-set |
| 14894 |
(input-port-readtable (repl-input-port)) |
| 14895 |
#t))</b> |
| 14896 |
> <b>'Ice</b> |
| 14897 |
ice |
| 14898 |
> <b>(input-port-readtable-set! |
| 14899 |
(repl-input-port) |
| 14900 |
(readtable-case-conversion?-set |
| 14901 |
(input-port-readtable (repl-input-port)) |
| 14902 |
'upcase))</b> |
| 14903 |
> <b>'Ice</b> |
| 14904 |
ICE |
| 14905 |
</pre></td></tr></table> |
| 14906 |
|
| 14907 |
|
| 14908 |
|
| 14909 |
<a name="Definition_of_readtable-keywords-allowed?"></a><a name="Procedure_readtable-keywords-allowed?"></a><a name="index-readtable_002dkeywords_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-keywords-allowed?">readtable-keywords-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14910 |
<a name="Definition_of_readtable-keywords-allowed?-set"></a><a name="Procedure_readtable-keywords-allowed?-set"></a><a name="index-readtable_002dkeywords_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-keywords-allowed?-set">readtable-keywords-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14911 |
|
| 14912 |
<p>The procedure <code>readtable-keywords-allowed?</code> returns the content |
| 14913 |
of the ‘<samp>keywords-allowed?</samp>’ field of <var>readtable</var>. When the |
| 14914 |
content of this field is <code>#f</code>, the reader does not recognize |
| 14915 |
keyword objects (i.e. <code>:foo</code> and <code>foo:</code> are read as the |
| 14916 |
symbols <code>(string->symbol ":foo")</code> and <code>(string->symbol |
| 14917 |
"foo:")</code> respectively). When the content of this field is the symbol |
| 14918 |
<code>prefix</code>, the reader recognizes keyword objects that start with a |
| 14919 |
colon, as in Common Lisp (i.e. <code>:foo</code> is read as the keyword |
| 14920 |
<code>(string->keyword "foo")</code>). Otherwise the reader recognizes |
| 14921 |
keyword objects that end with a colon, as in DSSSL (i.e. <code>foo:</code> |
| 14922 |
is read as the symbol <code>(string->symbol "foo")</code>). |
| 14923 |
</p> |
| 14924 |
<p>The procedure <code>readtable-keywords-allowed?-set</code> returns a copy |
| 14925 |
of <var>readtable</var> where only the ‘<samp>keywords-allowed?</samp>’ field |
| 14926 |
has been changed to <var>new-value</var>. |
| 14927 |
</p> |
| 14928 |
<p>For example: |
| 14929 |
</p> |
| 14930 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-readtable-set! |
| 14931 |
(repl-input-port) |
| 14932 |
(readtable-keywords-allowed?-set |
| 14933 |
(input-port-readtable (repl-input-port)) |
| 14934 |
#f))</b> |
| 14935 |
> <b>(map keyword? '(foo :foo foo:))</b> |
| 14936 |
(#f #f #f) |
| 14937 |
> <b>(input-port-readtable-set! |
| 14938 |
(repl-input-port) |
| 14939 |
(readtable-keywords-allowed?-set |
| 14940 |
(input-port-readtable (repl-input-port)) |
| 14941 |
#t))</b> |
| 14942 |
> <b>(map keyword? '(foo :foo foo:))</b> |
| 14943 |
(#f #f #t) |
| 14944 |
> <b>(input-port-readtable-set! |
| 14945 |
(repl-input-port) |
| 14946 |
(readtable-keywords-allowed?-set |
| 14947 |
(input-port-readtable (repl-input-port)) |
| 14948 |
'prefix))</b> |
| 14949 |
> <b>(map keyword? '(foo :foo foo:))</b> |
| 14950 |
(#f #t #f) |
| 14951 |
</pre></td></tr></table> |
| 14952 |
|
| 14953 |
|
| 14954 |
|
| 14955 |
<a name="Definition_of_readtable-sharing-allowed?"></a><a name="Procedure_readtable-sharing-allowed?"></a><a name="index-readtable_002dsharing_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-sharing-allowed?">readtable-sharing-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14956 |
<a name="Definition_of_readtable-sharing-allowed?-set"></a><a name="Procedure_readtable-sharing-allowed?-set"></a><a name="index-readtable_002dsharing_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-sharing-allowed?-set">readtable-sharing-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 14957 |
<a name="index-serialization-1"></a> |
| 14958 |
<a name="index-deserialization-1"></a> |
| 14959 |
|
| 14960 |
<p>The procedure <code>readtable-sharing-allowed?</code> returns the content of |
| 14961 |
the ‘<samp>sharing-allowed?</samp>’ field of <var>readtable</var>. The reader |
| 14962 |
recognizes the <code>#<var>n</var>#</code> and <code>#<var>n</var>=<var>datum</var></code> |
| 14963 |
notation for circular structures and the printer uses this notation if |
| 14964 |
and only if the content of the ‘<samp>sharing-allowed?</samp>’ field is not |
| 14965 |
<code>#f</code>. Moreover when the content of the ‘<samp>sharing-allowed?</samp>’ |
| 14966 |
field is the symbol <code>serialize</code>, the printer uses a special |
| 14967 |
external representation that the reader understands and that extends |
| 14968 |
write/read invariance to the following types: records, procedures and |
| 14969 |
continuations. Note that an object can be serialized and deserialized |
| 14970 |
if and only if all of its components are serializable. |
| 14971 |
</p> |
| 14972 |
<p>The procedure <code>readtable-sharing-allowed?-set</code> returns a copy |
| 14973 |
of <var>readtable</var> where only the ‘<samp>sharing-allowed?</samp>’ field |
| 14974 |
has been changed to <var>new-value</var>. |
| 14975 |
</p> |
| 14976 |
<p>Here is a simple example: |
| 14977 |
</p> |
| 14978 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj allow?) |
| 14979 |
(call-with-output-string |
| 14980 |
'() |
| 14981 |
(lambda (p) |
| 14982 |
(output-port-readtable-set! |
| 14983 |
p |
| 14984 |
(readtable-sharing-allowed?-set |
| 14985 |
(output-port-readtable p) |
| 14986 |
allow?)) |
| 14987 |
(write obj p))))</b> |
| 14988 |
> <b>(define (rd str allow?) |
| 14989 |
(call-with-input-string |
| 14990 |
str |
| 14991 |
(lambda (p) |
| 14992 |
(input-port-readtable-set! |
| 14993 |
p |
| 14994 |
(readtable-sharing-allowed?-set |
| 14995 |
(input-port-readtable p) |
| 14996 |
allow?)) |
| 14997 |
(read p))))</b> |
| 14998 |
> <b>(define x (list 1 2 3))</b> |
| 14999 |
> <b>(set-car! (cdr x) (cddr x))</b> |
| 15000 |
> <b>(wr x #f)</b> |
| 15001 |
"(1 (3) 3)" |
| 15002 |
> <b>(wr x #t)</b> |
| 15003 |
"(1 #0=(3) . #0#)" |
| 15004 |
> <b>(define y (rd (wr x #t) #t))</b> |
| 15005 |
> <b>y</b> |
| 15006 |
(1 (3) 3) |
| 15007 |
> <b>(eq? (cadr y) (cddr y))</b> |
| 15008 |
#t |
| 15009 |
> <b>(define f #f)</b> |
| 15010 |
> <b>(let ((free (expt 2 10))) |
| 15011 |
(set! f (lambda (x) (+ x free))))</b> |
| 15012 |
> <b>(define s (wr f 'serialize))</b> |
| 15013 |
> <b>(string-length s)</b> |
| 15014 |
4196 |
| 15015 |
> <b>(define g (rd s 'serialize))</b> |
| 15016 |
> <b>(eq? f g)</b> |
| 15017 |
#f |
| 15018 |
> <b>(g 4)</b> |
| 15019 |
1028 |
| 15020 |
</pre></td></tr></table> |
| 15021 |
|
| 15022 |
<p>Continuations are tricky to serialize because they contain a dynamic |
| 15023 |
environment and this dynamic environment may contain non-serializable |
| 15024 |
objects, in particular ports attached to operating-system streams such |
| 15025 |
as files, the console or standard input/output. Indeed, all dynamic |
| 15026 |
environments contain a binding for the <code>current-input-port</code> and |
| 15027 |
<code>current-output-port</code>. Moreover, any thread that has started a |
| 15028 |
REPL has a continuation which refers to the <em>repl-context</em> object |
| 15029 |
in its dynamic environment. A repl-context object contains the |
| 15030 |
interaction channel, which is typically connected to a |
| 15031 |
non-serializable port, such as the console. Another problem is that |
| 15032 |
the <code>parameterize</code> form saves the old binding of the parameter in |
| 15033 |
the continuation, so it is not possible to eliminate the references to |
| 15034 |
these ports in the continuation by using the <code>parameterize</code> form |
| 15035 |
alone. |
| 15036 |
</p> |
| 15037 |
<p>Serialization of continuations can be achieved dependably by taking |
| 15038 |
advantage of string-ports, which are serializable objects (unless |
| 15039 |
there is a blocked thread), and the following features of threads: |
| 15040 |
they inherit the dynamic environment of the parent thread and they |
| 15041 |
start with an initial continuation that contains only serializable |
| 15042 |
objects. So a thread created in a dynamic environment where |
| 15043 |
<code>current-input-port</code> and <code>current-output-port</code> are bound to |
| 15044 |
a dummy string-port has a serializable continuation. |
| 15045 |
</p> |
| 15046 |
<p>Here is an example where continuations are serialized: |
| 15047 |
</p> |
| 15048 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj) |
| 15049 |
(call-with-output-string |
| 15050 |
'() |
| 15051 |
(lambda (p) |
| 15052 |
(output-port-readtable-set! |
| 15053 |
p |
| 15054 |
(readtable-sharing-allowed?-set |
| 15055 |
(output-port-readtable p) |
| 15056 |
'serialize)) |
| 15057 |
(write obj p))))</b> |
| 15058 |
> <b>(define (rd str) |
| 15059 |
(call-with-input-string |
| 15060 |
str |
| 15061 |
(lambda (p) |
| 15062 |
(input-port-readtable-set! |
| 15063 |
p |
| 15064 |
(readtable-sharing-allowed?-set |
| 15065 |
(input-port-readtable p) |
| 15066 |
'serialize)) |
| 15067 |
(read p))))</b> |
| 15068 |
> <b>(define fifo (open-vector))</b> |
| 15069 |
> <b>(define (suspend-and-die!) |
| 15070 |
(call-with-current-continuation |
| 15071 |
(lambda (k) |
| 15072 |
(write (wr k) fifo) |
| 15073 |
(newline fifo) |
| 15074 |
(force-output fifo) |
| 15075 |
(thread-terminate! (current-thread)))))</b> |
| 15076 |
> <b>(let ((dummy-port (open-string))) |
| 15077 |
(parameterize ((current-input-port dummy-port) |
| 15078 |
(current-output-port dummy-port)) |
| 15079 |
(thread-start! |
| 15080 |
(make-thread |
| 15081 |
(lambda () |
| 15082 |
(* 100 |
| 15083 |
(suspend-and-die!)))))))</b> |
| 15084 |
#<thread #2> |
| 15085 |
> <b>(define s (read fifo))</b> |
| 15086 |
> <b>(thread-join! |
| 15087 |
(thread-start! |
| 15088 |
(make-thread |
| 15089 |
(lambda () |
| 15090 |
((rd s) 111)))))</b> |
| 15091 |
11100 |
| 15092 |
> <b>(thread-join! |
| 15093 |
(thread-start! |
| 15094 |
(make-thread |
| 15095 |
(lambda () |
| 15096 |
((rd s) 222)))))</b> |
| 15097 |
22200 |
| 15098 |
> <b>(string-length s)</b> |
| 15099 |
13114 |
| 15100 |
</pre></td></tr></table> |
| 15101 |
|
| 15102 |
|
| 15103 |
|
| 15104 |
<a name="Definition_of_readtable-eval-allowed?"></a><a name="Procedure_readtable-eval-allowed?"></a><a name="index-readtable_002deval_002dallowed_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-eval-allowed?">readtable-eval-allowed?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15105 |
<a name="Definition_of_readtable-eval-allowed?-set"></a><a name="Procedure_readtable-eval-allowed?-set"></a><a name="index-readtable_002deval_002dallowed_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-eval-allowed?-set">readtable-eval-allowed?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15106 |
|
| 15107 |
<p>The procedure <code>readtable-eval-allowed?</code> returns the content of |
| 15108 |
the ‘<samp>eval-allowed?</samp>’ field of <var>readtable</var>. The reader |
| 15109 |
recognizes the <code>#.<var>expression</var></code> notation for read-time |
| 15110 |
evaluation if and only if the content of the ‘<samp>eval-allowed?</samp>’ |
| 15111 |
field is not <code>#f</code>. |
| 15112 |
</p> |
| 15113 |
<p>The procedure <code>readtable-eval-allowed?-set</code> returns a copy |
| 15114 |
of <var>readtable</var> where only the ‘<samp>eval-allowed?</samp>’ field |
| 15115 |
has been changed to <var>new-value</var>. |
| 15116 |
</p> |
| 15117 |
<p>For example: |
| 15118 |
</p> |
| 15119 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(input-port-readtable-set! |
| 15120 |
(repl-input-port) |
| 15121 |
(readtable-eval-allowed?-set |
| 15122 |
(input-port-readtable (repl-input-port)) |
| 15123 |
#t))</b> |
| 15124 |
> <b>'(5 plus 7 is #.(+ 5 7))</b> |
| 15125 |
(5 plus 7 is 12) |
| 15126 |
> <b>'(buf = #.(make-u8vector 25))</b> |
| 15127 |
(buf = #u8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) |
| 15128 |
</pre></td></tr></table> |
| 15129 |
|
| 15130 |
|
| 15131 |
|
| 15132 |
<a name="Definition_of_readtable-write-cdr-read-macros?"></a><a name="Procedure_readtable-write-cdr-read-macros?"></a><a name="index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-write-cdr-read-macros?">readtable-write-cdr-read-macros?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15133 |
<a name="Definition_of_readtable-write-cdr-read-macros?-set"></a><a name="Procedure_readtable-write-cdr-read-macros?-set"></a><a name="index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-write-cdr-read-macros?-set">readtable-write-cdr-read-macros?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15134 |
<a name="Definition_of_readtable-write-extended-read-macros?"></a><a name="Procedure_readtable-write-extended-read-macros?"></a><a name="index-readtable_002dwrite_002dextended_002dread_002dmacros_003f"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-write-extended-read-macros?">readtable-write-extended-read-macros?</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15135 |
<a name="Definition_of_readtable-write-extended-read-macros?-set"></a><a name="Procedure_readtable-write-extended-read-macros?-set"></a><a name="index-readtable_002dwrite_002dextended_002dread_002dmacros_003f_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-write-extended-read-macros?-set">readtable-write-extended-read-macros?-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15136 |
|
| 15137 |
<p>The procedure <code>readtable-write-cdr-read-macros?</code> returns the |
| 15138 |
content of the ‘<samp>write-cdr-read-macros?</samp>’ field of <var>readtable</var>. |
| 15139 |
The procedure <code>readtable-write-extended-read-macros?</code> returns the |
| 15140 |
content of the ‘<samp>write-extended-read-macros?</samp>’ field of |
| 15141 |
<var>readtable</var>. |
| 15142 |
</p> |
| 15143 |
<p>At all times the printer uses read-macros in its output for datums of |
| 15144 |
the form <code>(quote <var>datum</var>)</code>, <code>(quasiquote <var>datum</var>)</code>, |
| 15145 |
<code>(unquote <var>datum</var>)</code>, and <code>(unquote-splicing |
| 15146 |
<var>datum</var>)</code>. That is the following read-macro notations will be |
| 15147 |
used respectively: <code>'<var>datum</var></code>, <code>`<var>datum</var></code>, |
| 15148 |
<code>,<var>datum</var></code>, and <code>,@<var>datum</var></code>. Moreover, normally |
| 15149 |
the read-macros will not be used when the form appears in the cdr of a |
| 15150 |
list, for example <code>(foo quote bar)</code>, <code>(foo . (quote bar))</code> |
| 15151 |
and <code>(foo . 'bar)</code> will all be printed as <code>(foo quote bar)</code>. |
| 15152 |
</p> |
| 15153 |
<p>When the content of the ‘<samp>write-cdr-read-macros?</samp>’ field is not |
| 15154 |
<code>#f</code>, the printer will use read-macros when the forms appear in |
| 15155 |
the cdr of a list. For example <code>(foo quote bar)</code> will be printed |
| 15156 |
as <code>(foo . 'bar)</code>. When the content of the |
| 15157 |
‘<samp>write-extended-read-macros?</samp>’ field is not <code>#f</code>, the printer |
| 15158 |
will also use extended read-macros, for example <code>#'<var>datum</var></code> |
| 15159 |
in place of <code>(syntax <var>datum</var>)</code>. |
| 15160 |
</p> |
| 15161 |
<p>The procedure <code>readtable-write-cdr-read-macros?-set</code> returns a |
| 15162 |
copy of <var>readtable</var> where only the ‘<samp>write-cdr-read-macros?</samp>’ |
| 15163 |
field has been changed to <var>new-value</var>. The procedure |
| 15164 |
<code>readtable-write-extended-read-macros?-set</code> returns a copy of |
| 15165 |
<var>readtable</var> where only the ‘<samp>write-extended-read-macros?</samp>’ |
| 15166 |
field has been changed to <var>new-value</var>. |
| 15167 |
</p> |
| 15168 |
<p>For example: |
| 15169 |
</p> |
| 15170 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(output-port-readtable-set! |
| 15171 |
(repl-output-port) |
| 15172 |
(readtable-write-extended-read-macros?-set |
| 15173 |
(output-port-readtable (repl-output-port)) |
| 15174 |
#t))</b> |
| 15175 |
> <b>'(foo (syntax bar))</b> |
| 15176 |
(foo #'bar) |
| 15177 |
> <b>'(foo syntax bar)</b> |
| 15178 |
(foo syntax bar) |
| 15179 |
> <b>(output-port-readtable-set! |
| 15180 |
(repl-output-port) |
| 15181 |
(readtable-write-cdr-read-macros?-set |
| 15182 |
(output-port-readtable (repl-output-port)) |
| 15183 |
#t))</b> |
| 15184 |
> <b>'(foo syntax bar)</b> |
| 15185 |
(foo . #'bar) |
| 15186 |
</pre></td></tr></table> |
| 15187 |
|
| 15188 |
|
| 15189 |
|
| 15190 |
<a name="Definition_of_readtable-max-write-level"></a><a name="Procedure_readtable-max-write-level"></a><a name="index-readtable_002dmax_002dwrite_002dlevel"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-write-level">readtable-max-write-level</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15191 |
<a name="Definition_of_readtable-max-write-level-set"></a><a name="Procedure_readtable-max-write-level-set"></a><a name="index-readtable_002dmax_002dwrite_002dlevel_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-write-level-set">readtable-max-write-level-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15192 |
|
| 15193 |
<p>The procedure <code>readtable-max-write-level</code> returns the content of |
| 15194 |
the ‘<samp>max-write-level</samp>’ field of <var>readtable</var>. The printer will |
| 15195 |
display an ellipsis for the elements of lists and vectors that are |
| 15196 |
nested deeper than this level. |
| 15197 |
</p> |
| 15198 |
<p>The procedure <code>readtable-max-write-level-set</code> returns a copy |
| 15199 |
of <var>readtable</var> where only the ‘<samp>max-write-level</samp>’ field |
| 15200 |
has been changed to <var>new-value</var>, which must be an nonnegative |
| 15201 |
fixnum. |
| 15202 |
</p> |
| 15203 |
<p>For example: |
| 15204 |
</p> |
| 15205 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj n) |
| 15206 |
(call-with-output-string |
| 15207 |
'() |
| 15208 |
(lambda (p) |
| 15209 |
(output-port-readtable-set! |
| 15210 |
p |
| 15211 |
(readtable-max-write-level-set |
| 15212 |
(output-port-readtable p) |
| 15213 |
n)) |
| 15214 |
(write obj p))))</b> |
| 15215 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 3)</b> |
| 15216 |
"(a #(b (c c) #u8(9 9 9) b) a)" |
| 15217 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 2)</b> |
| 15218 |
"(a #(b (...) #u8(...) b) a)" |
| 15219 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 1)</b> |
| 15220 |
"(a #(...) a)" |
| 15221 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 0)</b> |
| 15222 |
"(...)" |
| 15223 |
> <b>(wr 'hello 0)</b> |
| 15224 |
"hello" |
| 15225 |
</pre></td></tr></table> |
| 15226 |
|
| 15227 |
|
| 15228 |
|
| 15229 |
<a name="Definition_of_readtable-max-write-length"></a><a name="Procedure_readtable-max-write-length"></a><a name="index-readtable_002dmax_002dwrite_002dlength"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-write-length">readtable-max-write-length</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15230 |
<a name="Definition_of_readtable-max-write-length-set"></a><a name="Procedure_readtable-max-write-length-set"></a><a name="index-readtable_002dmax_002dwrite_002dlength_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-write-length-set">readtable-max-write-length-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15231 |
<p>The procedure <code>readtable-max-write-length</code> returns the content of |
| 15232 |
the ‘<samp>max-write-length</samp>’ field of <var>readtable</var>. The printer will |
| 15233 |
display an ellipsis for the elements of lists and vectors that are at |
| 15234 |
an index beyond that length. |
| 15235 |
</p> |
| 15236 |
<p>The procedure <code>readtable-max-write-length-set</code> returns a copy |
| 15237 |
of <var>readtable</var> where only the ‘<samp>max-write-length</samp>’ field |
| 15238 |
has been changed to <var>new-value</var>, which must be an nonnegative |
| 15239 |
fixnum. |
| 15240 |
</p> |
| 15241 |
<p>For example: |
| 15242 |
</p> |
| 15243 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define (wr obj n) |
| 15244 |
(call-with-output-string |
| 15245 |
'() |
| 15246 |
(lambda (p) |
| 15247 |
(output-port-readtable-set! |
| 15248 |
p |
| 15249 |
(readtable-max-write-length-set |
| 15250 |
(output-port-readtable p) |
| 15251 |
n)) |
| 15252 |
(write obj p))))</b> |
| 15253 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 4)</b> |
| 15254 |
"(a #(b (c c) #u8(9 9 9) b) . a)" |
| 15255 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 3)</b> |
| 15256 |
"(a #(b (c c) #u8(9 9 9) ...) . a)" |
| 15257 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 2)</b> |
| 15258 |
"(a #(b (c c) ...) . a)" |
| 15259 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 1)</b> |
| 15260 |
"(a ...)" |
| 15261 |
> <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 0)</b> |
| 15262 |
"(...)" |
| 15263 |
</pre></td></tr></table> |
| 15264 |
|
| 15265 |
|
| 15266 |
|
| 15267 |
<a name="Definition_of_readtable-max-unescaped-char"></a><a name="Procedure_readtable-max-unescaped-char"></a><a name="index-readtable_002dmax_002dunescaped_002dchar"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-unescaped-char">readtable-max-unescaped-char</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15268 |
<a name="Definition_of_readtable-max-unescaped-char-set"></a><a name="Procedure_readtable-max-unescaped-char-set"></a><a name="index-readtable_002dmax_002dunescaped_002dchar_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-max-unescaped-char-set">readtable-max-unescaped-char-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15269 |
|
| 15270 |
<p>The procedure <code>readtable-max-unescaped-char</code> returns the content |
| 15271 |
of the ‘<samp>max-unescaped-char</samp>’ field of <var>readtable</var>. The |
| 15272 |
printer will display using an escape sequence any character within |
| 15273 |
symbols, strings and character objects greater than |
| 15274 |
‘<samp>max-unescaped-char</samp>’ |
| 15275 |
</p> |
| 15276 |
<p>The procedure <code>readtable-max-unescaped-char-set</code> returns a copy |
| 15277 |
of <var>readtable</var> where only the ‘<samp>max-unescaped-char</samp>’ field |
| 15278 |
has been changed to <var>new-value</var>, which must be a character. |
| 15279 |
</p> |
| 15280 |
<p>For example: |
| 15281 |
</p> |
| 15282 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(define rt (output-port-readtable (repl-output-port)))</b> |
| 15283 |
> <b>(readtable-max-unescaped-char rt)</b> |
| 15284 |
#\delete |
| 15285 |
> <b>(string (integer->char 233))</b> |
| 15286 |
"\351" |
| 15287 |
> <b>(define (f c) |
| 15288 |
(with-output-to-string |
| 15289 |
(list readtable: (readtable-max-unescaped-char-set rt c)) |
| 15290 |
(lambda () (write (string (integer->char 233))))))</b> |
| 15291 |
> <b>(f #\delete)</b> |
| 15292 |
"\"\\351\"" |
| 15293 |
> <b>(string-length (f #\delete))</b> |
| 15294 |
6 |
| 15295 |
> <b>(f #\U0010ffff)</b> |
| 15296 |
"\"\351\"" |
| 15297 |
> <b>(string-length (f #\U0010ffff))</b> |
| 15298 |
3 |
| 15299 |
> <b>(output-port-readtable-set! |
| 15300 |
(repl-output-port) |
| 15301 |
(readtable-max-unescaped-char-set rt #\U0010ffff))</b> |
| 15302 |
> <b>(string (integer->char 233))</b> |
| 15303 |
"é" |
| 15304 |
</pre></td></tr></table> |
| 15305 |
|
| 15306 |
|
| 15307 |
|
| 15308 |
<a name="Definition_of_readtable-start-syntax"></a><a name="Procedure_readtable-start-syntax"></a><a name="index-readtable_002dstart_002dsyntax"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-start-syntax">readtable-start-syntax</a></b></code><i> <var>readtable</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15309 |
<a name="Definition_of_readtable-start-syntax-set"></a><a name="Procedure_readtable-start-syntax-set"></a><a name="index-readtable_002dstart_002dsyntax_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Procedure_readtable-start-syntax-set">readtable-start-syntax-set</a></b></code><i> <var>readtable</var> <var>new-value</var></i><code>)</code></td><td align="right">procedure</td></tr></table> |
| 15310 |
|
| 15311 |
<p>The procedure <code>readtable-start-syntax</code> returns the content of the |
| 15312 |
‘<samp>start-syntax</samp>’ field of <var>readtable</var>. The reader uses this |
| 15313 |
field to determine in which syntax to start parsing the input. When |
| 15314 |
the content of this field is the symbol <code>six</code>, the reader starts |
| 15315 |
in the infix syntax. Otherwise the reader starts in the prefix |
| 15316 |
syntax. |
| 15317 |
</p> |
| 15318 |
<p>The procedure <code>readtable-start-syntax-set</code> returns a copy |
| 15319 |
of <var>readtable</var> where only the ‘<samp>start-syntax</samp>’ field |
| 15320 |
has been changed to <var>new-value</var>. |
| 15321 |
</p> |
| 15322 |
<p>For example: |
| 15323 |
</p> |
| 15324 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(+ 2 3)</b> |
| 15325 |
5 |
| 15326 |
> <b>(input-port-readtable-set! |
| 15327 |
(repl-input-port) |
| 15328 |
(readtable-start-syntax-set |
| 15329 |
(input-port-readtable (repl-input-port)) |
| 15330 |
'six))</b> |
| 15331 |
> <b>2+3;</b> |
| 15332 |
5 |
| 15333 |
> <b>exit();</b> |
| 15334 |
</pre></td></tr></table> |
| 15335 |
|
| 15336 |
|
| 15337 |
|
| 15338 |
<a name="Boolean-syntax"></a><hr size="6"><br/><br/><br/> |
| 15339 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15340 |
<tr><td valign="middle" align="left"><a href="#Readtables" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15341 |
<td valign="middle" align="left"><a href="#Character-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15342 |
<td valign="middle" align="left"> </td> |
| 15343 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15344 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15345 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15346 |
<td valign="middle" align="left"> </td> |
| 15347 |
<td valign="middle" align="left"> </td> |
| 15348 |
<td valign="middle" align="left"> </td> |
| 15349 |
<td valign="middle" align="left"> </td> |
| 15350 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15351 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15352 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15353 |
</tr></table> |
| 15354 |
<a name="Boolean-syntax-1"></a> |
| 15355 |
<h2 class="section">18.2 Boolean syntax</h2> |
| 15356 |
|
| 15357 |
<p>Booleans are required to be followed by a delimiter |
| 15358 |
(i.e. <code>#f64()</code> is not the boolean <code>#f</code> followed by the |
| 15359 |
number <code>64</code> and the empty list). |
| 15360 |
</p> |
| 15361 |
<a name="Character-syntax"></a><hr size="6"><br/><br/><br/> |
| 15362 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15363 |
<tr><td valign="middle" align="left"><a href="#Boolean-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15364 |
<td valign="middle" align="left"><a href="#String-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15365 |
<td valign="middle" align="left"> </td> |
| 15366 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15367 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15368 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15369 |
<td valign="middle" align="left"> </td> |
| 15370 |
<td valign="middle" align="left"> </td> |
| 15371 |
<td valign="middle" align="left"> </td> |
| 15372 |
<td valign="middle" align="left"> </td> |
| 15373 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15374 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15375 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15376 |
</tr></table> |
| 15377 |
<a name="Character-syntax-1"></a> |
| 15378 |
<h2 class="section">18.3 Character syntax</h2> |
| 15379 |
|
| 15380 |
<p>Characters are required to be followed by a delimiter |
| 15381 |
(i.e. <code>#\spaceballs</code> is not the character <code>#\space</code> followed |
| 15382 |
by the symbol <code>balls</code>). The lexical syntax of characters is |
| 15383 |
extended to allow the following: |
| 15384 |
</p> |
| 15385 |
<dl compact="compact"> |
| 15386 |
<dt> <code>#\nul</code></dt> |
| 15387 |
<dd><p>Unicode character 0 |
| 15388 |
</p></dd> |
| 15389 |
<dt> <code>#\alarm</code></dt> |
| 15390 |
<dd><p>Unicode character 7 |
| 15391 |
</p></dd> |
| 15392 |
<dt> <code>#\backspace</code></dt> |
| 15393 |
<dd><p>Unicode character 8 |
| 15394 |
</p></dd> |
| 15395 |
<dt> <code>#\tab</code></dt> |
| 15396 |
<dd><p>Unicode character 9 |
| 15397 |
</p></dd> |
| 15398 |
<dt> <code>#\newline</code></dt> |
| 15399 |
<dd><p>Unicode character 10 (newline character) |
| 15400 |
</p></dd> |
| 15401 |
<dt> <code>#\linefeed</code></dt> |
| 15402 |
<dd><p>Unicode character 10 |
| 15403 |
</p></dd> |
| 15404 |
<dt> <code>#\vtab</code></dt> |
| 15405 |
<dd><p>Unicode character 11 |
| 15406 |
</p></dd> |
| 15407 |
<dt> <code>#\page</code></dt> |
| 15408 |
<dd><p>Unicode character 12 |
| 15409 |
</p></dd> |
| 15410 |
<dt> <code>#\return</code></dt> |
| 15411 |
<dd><p>Unicode character 13 |
| 15412 |
</p></dd> |
| 15413 |
<dt> <code>#\esc</code></dt> |
| 15414 |
<dd><p>Unicode character 27 |
| 15415 |
</p></dd> |
| 15416 |
<dt> <code>#\space</code></dt> |
| 15417 |
<dd><p>Unicode character 32 (space character) |
| 15418 |
</p></dd> |
| 15419 |
<dt> <code>#\delete</code></dt> |
| 15420 |
<dd><p>Unicode character 127 |
| 15421 |
</p></dd> |
| 15422 |
<dt> <code>#\x<var>hh</var></code></dt> |
| 15423 |
<dd><p>character encoded in hexadecimal (>= 1 hexadecimal digit) |
| 15424 |
</p></dd> |
| 15425 |
<dt> <code>#\u<var>hhhh</var></code></dt> |
| 15426 |
<dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits) |
| 15427 |
</p></dd> |
| 15428 |
<dt> <code>#\U<var>hhhhhhhh</var></code></dt> |
| 15429 |
<dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits) |
| 15430 |
</p></dd> |
| 15431 |
</dl> |
| 15432 |
|
| 15433 |
<a name="String-syntax"></a><hr size="6"><br/><br/><br/> |
| 15434 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15435 |
<tr><td valign="middle" align="left"><a href="#Character-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15436 |
<td valign="middle" align="left"><a href="#Symbol-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15437 |
<td valign="middle" align="left"> </td> |
| 15438 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15439 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15440 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15441 |
<td valign="middle" align="left"> </td> |
| 15442 |
<td valign="middle" align="left"> </td> |
| 15443 |
<td valign="middle" align="left"> </td> |
| 15444 |
<td valign="middle" align="left"> </td> |
| 15445 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15446 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15447 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15448 |
</tr></table> |
| 15449 |
<a name="String-syntax-1"></a> |
| 15450 |
<h2 class="section">18.4 String syntax</h2> |
| 15451 |
|
| 15452 |
<p>The lexical syntax of quoted strings is extended to allow the following |
| 15453 |
escape codes: |
| 15454 |
</p> |
| 15455 |
<dl compact="compact"> |
| 15456 |
<dt> <code>\a</code></dt> |
| 15457 |
<dd><p>Unicode character 7 |
| 15458 |
</p></dd> |
| 15459 |
<dt> <code>\b</code></dt> |
| 15460 |
<dd><p>Unicode character 8 |
| 15461 |
</p></dd> |
| 15462 |
<dt> <code>\t</code></dt> |
| 15463 |
<dd><p>Unicode character 9 |
| 15464 |
</p></dd> |
| 15465 |
<dt> <code>\n</code></dt> |
| 15466 |
<dd><p>Unicode character 10 (newline character) |
| 15467 |
</p></dd> |
| 15468 |
<dt> <code>\v</code></dt> |
| 15469 |
<dd><p>Unicode character 11 |
| 15470 |
</p></dd> |
| 15471 |
<dt> <code>\f</code></dt> |
| 15472 |
<dd><p>Unicode character 12 |
| 15473 |
</p></dd> |
| 15474 |
<dt> <code>\r</code></dt> |
| 15475 |
<dd><p>Unicode character 13 |
| 15476 |
</p></dd> |
| 15477 |
<dt> <code>\"</code></dt> |
| 15478 |
<dd><p><code>"</code> |
| 15479 |
</p></dd> |
| 15480 |
<dt> <code>\\</code></dt> |
| 15481 |
<dd><p><code>\</code> |
| 15482 |
</p></dd> |
| 15483 |
<dt> <code>\|</code></dt> |
| 15484 |
<dd><p><code>|</code> |
| 15485 |
</p></dd> |
| 15486 |
<dt> <code>\?</code></dt> |
| 15487 |
<dd><p><code>?</code> |
| 15488 |
</p></dd> |
| 15489 |
<dt> <code>\<var>ooo</var></code></dt> |
| 15490 |
<dd><p>character encoded in octal (1 to 3 octal digits, first digit must be less |
| 15491 |
than 4 when there are 3 octal digits) |
| 15492 |
</p></dd> |
| 15493 |
<dt> <code>\x<var>hh</var></code></dt> |
| 15494 |
<dd><p>character encoded in hexadecimal (>= 1 hexadecimal digit) |
| 15495 |
</p></dd> |
| 15496 |
<dt> <code>\u<var>hhhh</var></code></dt> |
| 15497 |
<dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits) |
| 15498 |
</p></dd> |
| 15499 |
<dt> <code>\U<var>hhhhhhhh</var></code></dt> |
| 15500 |
<dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits) |
| 15501 |
</p></dd> |
| 15502 |
<dt> <code>\<space></code></dt> |
| 15503 |
<dd><p>Unicode character 32 (space character) |
| 15504 |
</p></dd> |
| 15505 |
<dt> <code>\<newline><whitespace-except-newline>*</code></dt> |
| 15506 |
<dd><p>This sequence expands to nothing (it is useful for splitting a long |
| 15507 |
string literal on multiple lines while respecting proper indentation |
| 15508 |
of the source code) |
| 15509 |
</p></dd> |
| 15510 |
</dl> |
| 15511 |
|
| 15512 |
<p>Gambit also supports a “here string” syntax that is similar |
| 15513 |
to shell “here documents”. For example: |
| 15514 |
</p> |
| 15515 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(pretty-print #<<THE-END |
| 15516 |
hello |
| 15517 |
world |
| 15518 |
THE-END |
| 15519 |
)</b> |
| 15520 |
"hello\nworld" |
| 15521 |
</pre></td></tr></table> |
| 15522 |
|
| 15523 |
<p>The here string starts with the sequence ‘<samp>#<<</samp>’. The part of the |
| 15524 |
line after the ‘<samp>#<<</samp>’ up to and including the newline character is |
| 15525 |
the key. The first line afterward that matches the key marks the end |
| 15526 |
of the here string. The string contains all the characters between |
| 15527 |
the start key and the end key, with the exception of the newline |
| 15528 |
character before the end key. |
| 15529 |
</p> |
| 15530 |
<a name="Symbol-syntax"></a><hr size="6"><br/><br/><br/> |
| 15531 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15532 |
<tr><td valign="middle" align="left"><a href="#String-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15533 |
<td valign="middle" align="left"><a href="#Keyword-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15534 |
<td valign="middle" align="left"> </td> |
| 15535 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15536 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15537 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15538 |
<td valign="middle" align="left"> </td> |
| 15539 |
<td valign="middle" align="left"> </td> |
| 15540 |
<td valign="middle" align="left"> </td> |
| 15541 |
<td valign="middle" align="left"> </td> |
| 15542 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15543 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15544 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15545 |
</tr></table> |
| 15546 |
<a name="Symbol-syntax-1"></a> |
| 15547 |
<h2 class="section">18.5 Symbol syntax</h2> |
| 15548 |
|
| 15549 |
<p>The lexical syntax of symbols is extended to allow a leading and |
| 15550 |
trailing vertical bar (e.g. <code>|a\|b"c:|</code>). The symbol’s name |
| 15551 |
corresponds verbatim to the characters between the vertical bars |
| 15552 |
except for escaped characters. The same escape sequences as for |
| 15553 |
strings are permitted except that ‘<samp>"</samp>’ does not need to be escaped |
| 15554 |
and ‘<samp>|</samp>’ needs to be escaped. |
| 15555 |
</p> |
| 15556 |
<p>For example: |
| 15557 |
</p> |
| 15558 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(symbol->string '|a\|b"c:|)</b> |
| 15559 |
"a|b\"c:" |
| 15560 |
</pre></td></tr></table> |
| 15561 |
|
| 15562 |
<a name="Keyword-syntax"></a><hr size="6"><br/><br/><br/> |
| 15563 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15564 |
<tr><td valign="middle" align="left"><a href="#Symbol-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15565 |
<td valign="middle" align="left"><a href="#Box-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15566 |
<td valign="middle" align="left"> </td> |
| 15567 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15568 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15569 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15570 |
<td valign="middle" align="left"> </td> |
| 15571 |
<td valign="middle" align="left"> </td> |
| 15572 |
<td valign="middle" align="left"> </td> |
| 15573 |
<td valign="middle" align="left"> </td> |
| 15574 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15575 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15576 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15577 |
</tr></table> |
| 15578 |
<a name="Keyword-syntax-1"></a> |
| 15579 |
<h2 class="section">18.6 Keyword syntax</h2> |
| 15580 |
|
| 15581 |
<p>The lexical syntax of keywords is like symbols, but with a colon at |
| 15582 |
the end (note that this can be changed to a leading colon by setting |
| 15583 |
the ‘<samp>keywords-allowed?</samp>’ field of the readtable to the symbol |
| 15584 |
<code>prefix</code>). A colon by itself is not a keyword, it is a symbol. |
| 15585 |
Vertical bars can be used like symbols but the colon must be outside |
| 15586 |
the vertical bars. Note that the string returned by the |
| 15587 |
<code>keyword->string</code> procedure does not include the colon. |
| 15588 |
</p> |
| 15589 |
<p>For example: |
| 15590 |
</p> |
| 15591 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(keyword->string 'foo:)</b> |
| 15592 |
"foo" |
| 15593 |
> <b>(map keyword? '(|ab()cd:| |ab()cd|: : ||:))</b> |
| 15594 |
(#f #t #f #t) |
| 15595 |
</pre></td></tr></table> |
| 15596 |
|
| 15597 |
<a name="Box-syntax"></a><hr size="6"><br/><br/><br/> |
| 15598 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15599 |
<tr><td valign="middle" align="left"><a href="#Keyword-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15600 |
<td valign="middle" align="left"><a href="#Number-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15601 |
<td valign="middle" align="left"> </td> |
| 15602 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15603 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15604 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15605 |
<td valign="middle" align="left"> </td> |
| 15606 |
<td valign="middle" align="left"> </td> |
| 15607 |
<td valign="middle" align="left"> </td> |
| 15608 |
<td valign="middle" align="left"> </td> |
| 15609 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15610 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15611 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15612 |
</tr></table> |
| 15613 |
<a name="Box-syntax-1"></a> |
| 15614 |
<h2 class="section">18.7 Box syntax</h2> |
| 15615 |
|
| 15616 |
<p>The lexical syntax of boxes is <code>#&<var>obj</var></code> where <var>obj</var> is the |
| 15617 |
content of the box. |
| 15618 |
</p> |
| 15619 |
<p>For example: |
| 15620 |
</p> |
| 15621 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(list '#&"hello" '#&123)</b> |
| 15622 |
(#&"hello" #&123) |
| 15623 |
> <b>(box (box (+ 10 20)))</b> |
| 15624 |
#&#&30 |
| 15625 |
</pre></td></tr></table> |
| 15626 |
|
| 15627 |
<a name="Number-syntax"></a><hr size="6"><br/><br/><br/> |
| 15628 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15629 |
<tr><td valign="middle" align="left"><a href="#Box-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15630 |
<td valign="middle" align="left"><a href="#Homogeneous-vector-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15631 |
<td valign="middle" align="left"> </td> |
| 15632 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15633 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15634 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15635 |
<td valign="middle" align="left"> </td> |
| 15636 |
<td valign="middle" align="left"> </td> |
| 15637 |
<td valign="middle" align="left"> </td> |
| 15638 |
<td valign="middle" align="left"> </td> |
| 15639 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15640 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15641 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15642 |
</tr></table> |
| 15643 |
<a name="Number-syntax-1"></a> |
| 15644 |
<h2 class="section">18.8 Number syntax</h2> |
| 15645 |
|
| 15646 |
<p>The lexical syntax of the special inexact real numbers is as follows: |
| 15647 |
</p> |
| 15648 |
<dl compact="compact"> |
| 15649 |
<dt> <code>+inf.0</code></dt> |
| 15650 |
<dd><p>positive infinity |
| 15651 |
</p></dd> |
| 15652 |
<dt> <code>-inf.0</code></dt> |
| 15653 |
<dd><p>negative infinity |
| 15654 |
</p></dd> |
| 15655 |
<dt> <code>+nan.0</code></dt> |
| 15656 |
<dd><p>“not a number” |
| 15657 |
</p></dd> |
| 15658 |
<dt> <code>-0.</code></dt> |
| 15659 |
<dd><p>negative zero (‘<samp>0.</samp>’ is the positive zero) |
| 15660 |
</p></dd> |
| 15661 |
</dl> |
| 15662 |
|
| 15663 |
<a name="Homogeneous-vector-syntax"></a><hr size="6"><br/><br/><br/> |
| 15664 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15665 |
<tr><td valign="middle" align="left"><a href="#Number-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15666 |
<td valign="middle" align="left"><a href="#Special-_0023_0021-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15667 |
<td valign="middle" align="left"> </td> |
| 15668 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15669 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15670 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15671 |
<td valign="middle" align="left"> </td> |
| 15672 |
<td valign="middle" align="left"> </td> |
| 15673 |
<td valign="middle" align="left"> </td> |
| 15674 |
<td valign="middle" align="left"> </td> |
| 15675 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15676 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15677 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15678 |
</tr></table> |
| 15679 |
<a name="Homogeneous-vector-syntax-1"></a> |
| 15680 |
<h2 class="section">18.9 Homogeneous vector syntax</h2> |
| 15681 |
<a name="index-homogeneous-vectors-1"></a> |
| 15682 |
|
| 15683 |
<p>Homogeneous vectors are vectors containing raw numbers of the same |
| 15684 |
type (signed or unsigned exact integers or inexact reals). There are |
| 15685 |
10 types of homogeneous vectors: |
| 15686 |
‘<samp>s8vector</samp>’ (vector of 8 bit signed integers), |
| 15687 |
‘<samp>u8vector</samp>’ (vector of 8 bit unsigned integers), |
| 15688 |
‘<samp>s16vector</samp>’ (vector of 16 bit signed integers), |
| 15689 |
‘<samp>u16vector</samp>’ (vector of 16 bit unsigned integers), |
| 15690 |
‘<samp>s32vector</samp>’ (vector of 32 bit signed integers), |
| 15691 |
‘<samp>u32vector</samp>’ (vector of 32 bit unsigned integers), |
| 15692 |
‘<samp>s64vector</samp>’ (vector of 64 bit signed integers), |
| 15693 |
‘<samp>u64vector</samp>’ (vector of 64 bit unsigned integers), |
| 15694 |
‘<samp>f32vector</samp>’ (vector of 32 bit floating point numbers), |
| 15695 |
and ‘<samp>f64vector</samp>’ (vector of 64 bit floating point numbers). |
| 15696 |
</p> |
| 15697 |
<p>The external representation of homogeneous vectors is similar to |
| 15698 |
normal vectors but with the ‘<samp>#(</samp>’ prefix replaced respectively |
| 15699 |
with |
| 15700 |
‘<samp>#s8(</samp>’, ‘<samp>#u8(</samp>’, |
| 15701 |
‘<samp>#s16(</samp>’, ‘<samp>#u16(</samp>’, |
| 15702 |
‘<samp>#s32(</samp>’, ‘<samp>#u32(</samp>’, |
| 15703 |
‘<samp>#s64(</samp>’, ‘<samp>#u64(</samp>’, |
| 15704 |
‘<samp>#f32(</samp>’, and ‘<samp>#f64(</samp>’. |
| 15705 |
</p> |
| 15706 |
<p>The elements of the integer homogeneous vectors must be exact integers |
| 15707 |
fitting in the given precision. The elements of the floating point |
| 15708 |
homogeneous vectors must be inexact reals. |
| 15709 |
</p> |
| 15710 |
<a name="Special-_0023_0021-syntax"></a><hr size="6"><br/><br/><br/> |
| 15711 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15712 |
<tr><td valign="middle" align="left"><a href="#Homogeneous-vector-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15713 |
<td valign="middle" align="left"><a href="#Multiline-comment-syntax" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15714 |
<td valign="middle" align="left"> </td> |
| 15715 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15716 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15717 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15718 |
<td valign="middle" align="left"> </td> |
| 15719 |
<td valign="middle" align="left"> </td> |
| 15720 |
<td valign="middle" align="left"> </td> |
| 15721 |
<td valign="middle" align="left"> </td> |
| 15722 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15723 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15724 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15725 |
</tr></table> |
| 15726 |
<a name="Special-_0023_0021-syntax-1"></a> |
| 15727 |
<h2 class="section">18.10 Special <code>#!</code> syntax</h2> |
| 15728 |
|
| 15729 |
<p>The lexical syntax of the special <code>#!</code> objects is as follows: |
| 15730 |
</p> |
| 15731 |
<dl compact="compact"> |
| 15732 |
<dt> <code>#!eof</code></dt> |
| 15733 |
<dd><p>end-of-file object |
| 15734 |
</p></dd> |
| 15735 |
<dt> <code>#!void</code></dt> |
| 15736 |
<dd><p>void object |
| 15737 |
</p></dd> |
| 15738 |
<dt> <code>#!optional</code></dt> |
| 15739 |
<dd><p>optional object |
| 15740 |
</p></dd> |
| 15741 |
<dt> <code>#!rest</code></dt> |
| 15742 |
<dd><p>rest object |
| 15743 |
</p></dd> |
| 15744 |
<dt> <code>#!key</code></dt> |
| 15745 |
<dd><p>key object |
| 15746 |
</p></dd> |
| 15747 |
</dl> |
| 15748 |
|
| 15749 |
<a name="Multiline-comment-syntax"></a><hr size="6"><br/><br/><br/> |
| 15750 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15751 |
<tr><td valign="middle" align="left"><a href="#Special-_0023_0021-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15752 |
<td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15753 |
<td valign="middle" align="left"> </td> |
| 15754 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15755 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15756 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15757 |
<td valign="middle" align="left"> </td> |
| 15758 |
<td valign="middle" align="left"> </td> |
| 15759 |
<td valign="middle" align="left"> </td> |
| 15760 |
<td valign="middle" align="left"> </td> |
| 15761 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15762 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15763 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15764 |
</tr></table> |
| 15765 |
<a name="Multiline-comment-syntax-1"></a> |
| 15766 |
<h2 class="section">18.11 Multiline comment syntax</h2> |
| 15767 |
|
| 15768 |
<p>Multiline comments are delimited by the tokens ‘<samp>#|</samp>’ and ‘<samp>|#</samp>’. |
| 15769 |
These comments can be nested. |
| 15770 |
</p> |
| 15771 |
<a name="Scheme-infix-syntax-extension"></a><hr size="6"><br/><br/><br/> |
| 15772 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15773 |
<tr><td valign="middle" align="left"><a href="#Multiline-comment-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15774 |
<td valign="middle" align="left"><a href="#SIX-grammar" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15775 |
<td valign="middle" align="left"> </td> |
| 15776 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15777 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15778 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15779 |
<td valign="middle" align="left"> </td> |
| 15780 |
<td valign="middle" align="left"> </td> |
| 15781 |
<td valign="middle" align="left"> </td> |
| 15782 |
<td valign="middle" align="left"> </td> |
| 15783 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15784 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15785 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15786 |
</tr></table> |
| 15787 |
<a name="Scheme-infix-syntax-extension-1"></a> |
| 15788 |
<h2 class="section">18.12 Scheme infix syntax extension</h2> |
| 15789 |
|
| 15790 |
<p>The reader supports an infix syntax extension which is called SIX |
| 15791 |
(Scheme Infix eXtension). This extension is both supported by the |
| 15792 |
‘<samp>read</samp>’ procedure and in program source code. |
| 15793 |
</p> |
| 15794 |
<p>The backslash character is a delimiter that marks the beginning of a |
| 15795 |
single datum expressed in the infix syntax (the details are given |
| 15796 |
below). One way to think about it is that the backslash character |
| 15797 |
escapes the prefix syntax temporarily to use the infix syntax. For |
| 15798 |
example a three element list could be written as ‘<samp>(<var>X</var> |
| 15799 |
\<var>Y</var> <var>Z</var>)</samp>’, the elements <var>X</var> and <var>Z</var> are expressed |
| 15800 |
using the normal prefix syntax and <var>Y</var> is expressed using the |
| 15801 |
infix syntax. |
| 15802 |
</p> |
| 15803 |
<p>When the reader encounters an infix datum, it constructs a syntax tree |
| 15804 |
for that particular datum. Each node of this tree is represented with |
| 15805 |
a list whose first element is a symbol indicating the type of node. |
| 15806 |
For example, ‘<samp>(six.identifier abc)</samp>’ is the representation of the |
| 15807 |
infix identifier ‘<samp>abc</samp>’ and ‘<samp>(six.index (six.identifier abc) |
| 15808 |
(six.identifier i))</samp>’ is the representation of the infix datum |
| 15809 |
‘<samp>abc[i];</samp>’. |
| 15810 |
</p> |
| 15811 |
<a name="SIX-grammar"></a><hr size="6"><br/><br/><br/> |
| 15812 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 15813 |
<tr><td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 15814 |
<td valign="middle" align="left"><a href="#SIX-semantics" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 15815 |
<td valign="middle" align="left"> </td> |
| 15816 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 15817 |
<td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 15818 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 15819 |
<td valign="middle" align="left"> </td> |
| 15820 |
<td valign="middle" align="left"> </td> |
| 15821 |
<td valign="middle" align="left"> </td> |
| 15822 |
<td valign="middle" align="left"> </td> |
| 15823 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 15824 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 15825 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 15826 |
</tr></table> |
| 15827 |
<h3 class="subsection">18.12.1 SIX grammar</h3> |
| 15828 |
|
| 15829 |
<p>The SIX grammar is given below. On the left hand side are the |
| 15830 |
production rules. On the right hand side is the datum that is |
| 15831 |
constructed by the reader. The notation <var>$i</var> denotes the datum |
| 15832 |
that is constructed by the reader for the <var>i</var>th part of the |
| 15833 |
production rule. |
| 15834 |
</p> |
| 15835 |
|
| 15836 |
|
| 15837 |
|
| 15838 |
|
| 15839 |
<table> |
| 15840 |
<tr><td width="60%"><em><</em>infix datum<em>></em> ::=</td></tr> |
| 15841 |
<tr><td width="60%"> <em><</em>stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15842 |
<tr><td width="60%"><em><</em>stat<em>></em> ::=</td></tr> |
| 15843 |
<tr><td width="60%"> <em><</em>if stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15844 |
<tr><td width="60%"> | <em><</em>for stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15845 |
<tr><td width="60%"> | <em><</em>while stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15846 |
<tr><td width="60%"> | <em><</em>do stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15847 |
<tr><td width="60%"> | <em><</em>switch stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15848 |
<tr><td width="60%"> | <em><</em>case stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15849 |
<tr><td width="60%"> | <em><</em>break stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15850 |
<tr><td width="60%"> | <em><</em>continue stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15851 |
<tr><td width="60%"> | <em><</em>label stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15852 |
<tr><td width="60%"> | <em><</em>goto stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15853 |
<tr><td width="60%"> | <em><</em>return stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15854 |
<tr><td width="60%"> | <em><</em>expression stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15855 |
<tr><td width="60%"> | <em><</em>procedure definition<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15856 |
<tr><td width="60%"> | <em><</em>variable definition<em>></em> <code>;</code></td><td width="40%"><var>$1</var></td></tr> |
| 15857 |
<tr><td width="60%"> | <em><</em>clause stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15858 |
<tr><td width="60%"> | <em><</em>compound stat<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15859 |
<tr><td width="60%"> | <code>;</code></td><td width="40%"><code>(six.compound)</code></td></tr> |
| 15860 |
<tr><td width="60%"><em><</em>if stat<em>></em> ::=</td></tr> |
| 15861 |
<tr><td width="60%"> <code>if</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var>)</code></td></tr> |
| 15862 |
<tr><td width="60%"> | <code>if</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em> <code>else</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var> <var>$7</var>)</code></td></tr> |
| 15863 |
<tr><td width="60%"><em><</em>for stat<em>></em> ::=</td></tr> |
| 15864 |
<tr><td width="60%"> <code>for</code> <code>(</code> <em><</em>stat<em>></em> <code>;</code> <em><</em>oexpr<em>></em> <code>;</code> <em><</em>oexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.for <var>$3</var> <var>$5</var> <var>$7</var> <var>$9</var>)</code></td></tr> |
| 15865 |
<tr><td width="60%"><em><</em>while stat<em>></em> ::=</td></tr> |
| 15866 |
<tr><td width="60%"> <code>while</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.while <var>$3</var> <var>$5</var>)</code></td></tr> |
| 15867 |
<tr><td width="60%"><em><</em>do stat<em>></em> ::=</td></tr> |
| 15868 |
<tr><td width="60%"> <code>do</code> <em><</em>stat<em>></em> <code>while</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <code>;</code></td><td width="40%"><code>(six.do-while <var>$2</var> <var>$5</var>)</code></td></tr> |
| 15869 |
<tr><td width="60%"><em><</em>switch stat<em>></em> ::=</td></tr> |
| 15870 |
<tr><td width="60%"> <code>switch</code> <code>(</code> <em><</em>pexpr<em>></em> <code>)</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.switch <var>$3</var> <var>$5</var>)</code></td></tr> |
| 15871 |
<tr><td width="60%"><em><</em>case stat<em>></em> ::=</td></tr> |
| 15872 |
<tr><td width="60%"> <code>case</code> <em><</em>expr<em>></em> <code>:</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.case <var>$2</var> <var>$4</var>)</code></td></tr> |
| 15873 |
<tr><td width="60%"><em><</em>break stat<em>></em> ::=</td></tr> |
| 15874 |
<tr><td width="60%"> <code>break</code> <code>;</code></td><td width="40%"><code>(six.break)</code></td></tr> |
| 15875 |
<tr><td width="60%"><em><</em>continue stat<em>></em> ::=</td></tr> |
| 15876 |
<tr><td width="60%"> <code>continue</code> <code>;</code></td><td width="40%"><code>(six.continue)</code></td></tr> |
| 15877 |
<tr><td width="60%"><em><</em>label stat<em>></em> ::=</td></tr> |
| 15878 |
<tr><td width="60%"> <em><</em>identifier<em>></em> <code>:</code> <em><</em>stat<em>></em></td><td width="40%"><code>(six.label <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15879 |
<tr><td width="60%"><em><</em>goto stat<em>></em> ::=</td></tr> |
| 15880 |
<tr><td width="60%"> <code>goto</code> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><code>(six.goto <var>$2</var>)</code></td></tr> |
| 15881 |
<tr><td width="60%"><em><</em>return stat<em>></em> ::=</td></tr> |
| 15882 |
<tr><td width="60%"> <code>return</code> <code>;</code></td><td width="40%"><code>(six.return)</code></td></tr> |
| 15883 |
<tr><td width="60%"> | <code>return</code> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><code>(six.return <var>$2</var>)</code></td></tr> |
| 15884 |
<tr><td width="60%"><em><</em>expression stat<em>></em> ::=</td></tr> |
| 15885 |
<tr><td width="60%"> <em><</em>expr<em>></em> <code>;</code></td><td width="40%"><var>$1</var></td></tr> |
| 15886 |
<tr><td width="60%"><em><</em>clause stat<em>></em> ::=</td></tr> |
| 15887 |
<tr><td width="60%"> <em><</em>expr<em>></em> <code>.</code></td><td width="40%"><code>(six.clause <var>$1</var>)</code></td></tr> |
| 15888 |
<tr><td width="60%"><em><</em>pexpr<em>></em> ::=</td></tr> |
| 15889 |
<tr><td width="60%"> <em><</em>procedure definition<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15890 |
<tr><td width="60%"> | <em><</em>variable definition<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15891 |
<tr><td width="60%"> | <em><</em>expr<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15892 |
<tr><td width="60%"><em><</em>procedure definition<em>></em> ::=</td></tr> |
| 15893 |
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em> <code>(</code> <em><</em>parameters<em>></em> <code>)</code> <em><</em>body<em>></em></td><td width="40%"><code>(six.define-procedure <var>$2</var> (six.procedure <var>$1</var> <var>$4</var> <var>$6</var>))</code></td></tr> |
| 15894 |
<tr><td width="60%"><em><</em>variable definition<em>></em> ::=</td></tr> |
| 15895 |
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em> <em><</em>dimensions<em>></em> <em><</em>iexpr<em>></em></td><td width="40%"><code>(six.define-variable <var>$2</var> <var>$1</var> <var>$3</var> <var>$4</var>)</code></td></tr> |
| 15896 |
<tr><td width="60%"><em><</em>iexpr<em>></em> ::=</td></tr> |
| 15897 |
<tr><td width="60%"> <code>=</code> <em><</em>expr<em>></em></td><td width="40%"><var>$2</var></td></tr> |
| 15898 |
<tr><td width="60%"> | </td><td width="40%"><code>#f</code></td></tr> |
| 15899 |
<tr><td width="60%"><em><</em>dimensions<em>></em> ::=</td></tr> |
| 15900 |
<tr><td width="60%"> | <code>[</code> <em><</em>expr<em>></em> <code>]</code> <em><</em>dimensions<em>></em></td><td width="40%"><code>(<var>$2</var> . <var>$4</var>)</code></td></tr> |
| 15901 |
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr> |
| 15902 |
<tr><td width="60%"><em><</em>oexpr<em>></em> ::=</td></tr> |
| 15903 |
<tr><td width="60%"> <em><</em>expr<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15904 |
<tr><td width="60%"> | </td><td width="40%"><code>#f</code></td></tr> |
| 15905 |
<tr><td width="60%"><em><</em>expr<em>></em> ::=</td></tr> |
| 15906 |
<tr><td width="60%"> <em><</em>expr18<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15907 |
<tr><td width="60%"><em><</em>expr18<em>></em> ::=</td></tr> |
| 15908 |
<tr><td width="60%"> <em><</em>expr17<em>></em> <code>:-</code> <em><</em>expr18<em>></em></td><td width="40%"><code>(six.x:-y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15909 |
<tr><td width="60%"> | <em><</em>expr17<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15910 |
<tr><td width="60%"><em><</em>expr17<em>></em> ::=</td></tr> |
| 15911 |
<tr><td width="60%"> <em><</em>expr17<em>></em> <code>,</code> <em><</em>expr16<em>></em></td><td width="40%"><code>(|six.x,y| <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15912 |
<tr><td width="60%"> | <em><</em>expr16<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15913 |
<tr><td width="60%"><em><</em>expr16<em>></em> ::=</td></tr> |
| 15914 |
<tr><td width="60%"> <em><</em>expr15<em>></em> <code>:=</code> <em><</em>expr16<em>></em></td><td width="40%"><code>(six.x:=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15915 |
<tr><td width="60%"> | <em><</em>expr15<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15916 |
<tr><td width="60%"><em><</em>expr15<em>></em> ::=</td></tr> |
| 15917 |
<tr><td width="60%"> <em><</em>expr14<em>></em> <code>%=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x%=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15918 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>&=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x&=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15919 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>*=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x*=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15920 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>+=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x+=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15921 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>-=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x-=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15922 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>/=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x/=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15923 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code><<=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x<<=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15924 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15925 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>>>=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x>>=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15926 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>^=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(six.x^=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15927 |
<tr><td width="60%"> | <em><</em>expr14<em>></em> <code>|=</code> <em><</em>expr15<em>></em></td><td width="40%"><code>(|six.x\|=y| <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15928 |
<tr><td width="60%"> | <em><</em>expr14<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15929 |
<tr><td width="60%"><em><</em>expr14<em>></em> ::=</td></tr> |
| 15930 |
<tr><td width="60%"> <em><</em>expr13<em>></em> <code>:</code> <em><</em>expr14<em>></em></td><td width="40%"><code>(six.x:y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15931 |
<tr><td width="60%"> | <em><</em>expr13<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15932 |
<tr><td width="60%"><em><</em>expr13<em>></em> ::=</td></tr> |
| 15933 |
<tr><td width="60%"> <em><</em>expr12<em>></em> <code>?</code> <em><</em>expr<em>></em> <code>:</code> <em><</em>expr13<em>></em></td><td width="40%"><code>(six.x?y:z <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr> |
| 15934 |
<tr><td width="60%"> | <em><</em>expr12<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15935 |
<tr><td width="60%"><em><</em>expr12<em>></em> ::=</td></tr> |
| 15936 |
<tr><td width="60%"> <em><</em>expr12<em>></em> <code>||</code> <em><</em>expr11<em>></em></td><td width="40%"><code>(|six.x\|\|y| <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15937 |
<tr><td width="60%"> | <em><</em>expr11<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15938 |
<tr><td width="60%"><em><</em>expr11<em>></em> ::=</td></tr> |
| 15939 |
<tr><td width="60%"> <em><</em>expr11<em>></em> <code>&&</code> <em><</em>expr10<em>></em></td><td width="40%"><code>(six.x&&y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15940 |
<tr><td width="60%"> | <em><</em>expr10<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15941 |
<tr><td width="60%"><em><</em>expr10<em>></em> ::=</td></tr> |
| 15942 |
<tr><td width="60%"> <em><</em>expr10<em>></em> <code>|</code> <em><</em>expr9<em>></em></td><td width="40%"><code>(|six.x\|y| <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15943 |
<tr><td width="60%"> | <em><</em>expr9<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15944 |
<tr><td width="60%"><em><</em>expr9<em>></em> ::=</td></tr> |
| 15945 |
<tr><td width="60%"> <em><</em>expr9<em>></em> <code>^</code> <em><</em>expr8<em>></em></td><td width="40%"><code>(six.x^y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15946 |
<tr><td width="60%"> | <em><</em>expr8<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15947 |
<tr><td width="60%"><em><</em>expr8<em>></em> ::=</td></tr> |
| 15948 |
<tr><td width="60%"> <em><</em>expr8<em>></em> <code>&</code> <em><</em>expr7<em>></em></td><td width="40%"><code>(six.x&y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15949 |
<tr><td width="60%"> | <em><</em>expr7<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15950 |
<tr><td width="60%"><em><</em>expr7<em>></em> ::=</td></tr> |
| 15951 |
<tr><td width="60%"> <em><</em>expr7<em>></em> <code>!=</code> <em><</em>expr6<em>></em></td><td width="40%"><code>(six.x!=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15952 |
<tr><td width="60%"> | <em><</em>expr7<em>></em> <code>==</code> <em><</em>expr6<em>></em></td><td width="40%"><code>(six.x==y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15953 |
<tr><td width="60%"> | <em><</em>expr6<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15954 |
<tr><td width="60%"><em><</em>expr6<em>></em> ::=</td></tr> |
| 15955 |
<tr><td width="60%"> <em><</em>expr6<em>></em> <code><</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x<y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15956 |
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code><=</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x<=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15957 |
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code>></code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x>y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15958 |
<tr><td width="60%"> | <em><</em>expr6<em>></em> <code>>=</code> <em><</em>expr5<em>></em></td><td width="40%"><code>(six.x>=y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15959 |
<tr><td width="60%"> | <em><</em>expr5<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15960 |
<tr><td width="60%"><em><</em>expr5<em>></em> ::=</td></tr> |
| 15961 |
<tr><td width="60%"> <em><</em>expr5<em>></em> <code><<</code> <em><</em>expr4<em>></em></td><td width="40%"><code>(six.x<<y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15962 |
<tr><td width="60%"> | <em><</em>expr5<em>></em> <code>>></code> <em><</em>expr4<em>></em></td><td width="40%"><code>(six.x>>y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15963 |
<tr><td width="60%"> | <em><</em>expr4<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15964 |
<tr><td width="60%"><em><</em>expr4<em>></em> ::=</td></tr> |
| 15965 |
<tr><td width="60%"> <em><</em>expr4<em>></em> <code>+</code> <em><</em>expr3<em>></em></td><td width="40%"><code>(six.x+y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15966 |
<tr><td width="60%"> | <em><</em>expr4<em>></em> <code>-</code> <em><</em>expr3<em>></em></td><td width="40%"><code>(six.x-y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15967 |
<tr><td width="60%"> | <em><</em>expr3<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15968 |
<tr><td width="60%"><em><</em>expr3<em>></em> ::=</td></tr> |
| 15969 |
<tr><td width="60%"> <em><</em>expr3<em>></em> <code>%</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x%y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15970 |
<tr><td width="60%"> | <em><</em>expr3<em>></em> <code>*</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x*y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15971 |
<tr><td width="60%"> | <em><</em>expr3<em>></em> <code>/</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.x/y <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15972 |
<tr><td width="60%"> | <em><</em>expr2<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15973 |
<tr><td width="60%"><em><</em>expr2<em>></em> ::=</td></tr> |
| 15974 |
<tr><td width="60%"> <code>&</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.&x <var>$2</var>)</code></td></tr> |
| 15975 |
<tr><td width="60%"> | <code>+</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.+x <var>$2</var>)</code></td></tr> |
| 15976 |
<tr><td width="60%"> | <code>-</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.-x <var>$2</var>)</code></td></tr> |
| 15977 |
<tr><td width="60%"> | <code>*</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.*x <var>$2</var>)</code></td></tr> |
| 15978 |
<tr><td width="60%"> | <code>!</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.!x <var>$2</var>)</code></td></tr> |
| 15979 |
<tr><td width="60%"> | <code>!</code></td><td width="40%"><code>(six.!)</code></td></tr> |
| 15980 |
<tr><td width="60%"> | <code>++</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.++x <var>$2</var>)</code></td></tr> |
| 15981 |
<tr><td width="60%"> | <code>--</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.--x <var>$2</var>)</code></td></tr> |
| 15982 |
<tr><td width="60%"> | <code>~</code> <em><</em>expr2<em>></em></td><td width="40%"><code>(six.~x <var>$2</var>)</code></td></tr> |
| 15983 |
<tr><td width="60%"> | <code>new</code> <em><</em>id-or-prefix<em>></em> <code>(</code> <em><</em>arguments<em>></em> <code>)</code></td><td width="40%"><code>(six.new <var>$2</var> . <var>$4</var>)</code></td></tr> |
| 15984 |
<tr><td width="60%"> | <em><</em>expr1<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15985 |
<tr><td width="60%"><em><</em>expr1<em>></em> ::=</td></tr> |
| 15986 |
<tr><td width="60%"> <em><</em>expr1<em>></em> <code>++</code></td><td width="40%"><code>(six.x++ <var>$1</var>)</code></td></tr> |
| 15987 |
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>--</code></td><td width="40%"><code>(six.x-- <var>$1</var>)</code></td></tr> |
| 15988 |
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>(</code> <em><</em>arguments<em>></em> <code>)</code></td><td width="40%"><code>(six.call <var>$1</var> . <var>$3</var>)</code></td></tr> |
| 15989 |
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>[</code> <em><</em>expr<em>></em> <code>]</code></td><td width="40%"><code>(six.index <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15990 |
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>-></code> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(six.arrow <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15991 |
<tr><td width="60%"> | <em><</em>expr1<em>></em> <code>.</code> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(six.dot <var>$1</var> <var>$3</var>)</code></td></tr> |
| 15992 |
<tr><td width="60%"> | <em><</em>expr0<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15993 |
<tr><td width="60%"><em><</em>expr0<em>></em> ::=</td></tr> |
| 15994 |
<tr><td width="60%"> <em><</em>id-or-prefix<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 15995 |
<tr><td width="60%"> | <em><</em>string<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr> |
| 15996 |
<tr><td width="60%"> | <em><</em>char<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr> |
| 15997 |
<tr><td width="60%"> | <em><</em>number<em>></em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr> |
| 15998 |
<tr><td width="60%"> | <code>(</code> <em><</em>expr<em>></em> <code>)</code></td><td width="40%"><var>$2</var></td></tr> |
| 15999 |
<tr><td width="60%"> | <code>(</code> <em><</em>block stat<em>></em> <code>)</code></td><td width="40%"><var>$2</var></td></tr> |
| 16000 |
<tr><td width="60%"> | <em><</em>datum-starting-with-#-or-backquote<em>></em></td><td width="40%"><code>(six.prefix <var>$1</var>)</code></td></tr> |
| 16001 |
<tr><td width="60%"> | <code>[</code> <em><</em>elements<em>></em> <code>]</code></td><td width="40%"><var>$2</var></td></tr> |
| 16002 |
<tr><td width="60%"> | <em><</em>type<em>></em> <code>(</code> <em><</em>parameters<em>></em> <code>)</code> <em><</em>body<em>></em></td><td width="40%"><code>(six.procedure <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr> |
| 16003 |
<tr><td width="60%"><em><</em>block stat<em>></em> ::=</td></tr> |
| 16004 |
<tr><td width="60%"> <code>{</code> <em><</em>stat list<em>></em> <code>}</code></td><td width="40%"><code>(six.compound . <var>$2</var>)</code></td></tr> |
| 16005 |
<tr><td width="60%"><em><</em>body<em>></em> ::=</td></tr> |
| 16006 |
<tr><td width="60%"> <code>{</code> <em><</em>stat list<em>></em> <code>}</code></td><td width="40%"><code>(six.procedure-body . <var>$2</var>)</code></td></tr> |
| 16007 |
<tr><td width="60%"><em><</em>stat list<em>></em> ::=</td></tr> |
| 16008 |
<tr><td width="60%"> <em><</em>stat<em>></em> <em><</em>stat list<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$2</var>)</code></td></tr> |
| 16009 |
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr> |
| 16010 |
<tr><td width="60%"><em><</em>parameters<em>></em> ::=</td></tr> |
| 16011 |
<tr><td width="60%"> <em><</em>nonempty parameters<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 16012 |
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr> |
| 16013 |
<tr><td width="60%"><em><</em>nonempty parameters<em>></em> ::=</td></tr> |
| 16014 |
<tr><td width="60%"> <em><</em>parameter<em>></em> <code>,</code> <em><</em>nonempty parameters<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr> |
| 16015 |
<tr><td width="60%"> | <em><</em>parameter<em>></em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr> |
| 16016 |
<tr><td width="60%"><em><</em>parameter<em>></em> ::=</td></tr> |
| 16017 |
<tr><td width="60%"> <em><</em>type<em>></em> <em><</em>id-or-prefix<em>></em></td><td width="40%"><code>(<var>$2</var> <var>$1</var>)</code></td></tr> |
| 16018 |
<tr><td width="60%"><em><</em>arguments<em>></em> ::=</td></tr> |
| 16019 |
<tr><td width="60%"> <em><</em>nonempty arguments<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 16020 |
<tr><td width="60%"> | </td><td width="40%"><code>()</code></td></tr> |
| 16021 |
<tr><td width="60%"><em><</em>nonempty arguments<em>></em> ::=</td></tr> |
| 16022 |
<tr><td width="60%"> <em><</em>expr<em>></em> <code>,</code> <em><</em>nonempty arguments<em>></em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr> |
| 16023 |
<tr><td width="60%"> | <em><</em>expr<em>></em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr> |
| 16024 |
<tr><td width="60%"><em><</em>elements<em>></em> ::=</td></tr> |
| 16025 |
<tr><td width="60%"> <em><</em>nonempty elements<em>></em></td><td width="40%"><var>$1</var></td></tr> |
| 16026 |
<tr><td width="60%"> | </td><td width="40%"><code>(six.null)</code></td></tr> |
| 16027 |
<tr><td width="60%"><em><</em>nonempty elements<em>></em> ::=</td></tr> |
| 16028 |
<tr><td width="60%"> <em><</em>expr<em>></em></td><td width="40%"><code>(six.list <var>$1</var> (six.null))</code></td></tr> |
| 16029 |
<tr><td width="60%"> | <em><</em>expr<em>></em> <code>,</code> <em><</em>nonempty elements<em>></em></td><td width="40%"><code>(six.list <var>$1</var> <var>$3</var>)</code></td></tr> |
| 16030 |
<tr><td width="60%"> | <em><</em>expr<em>></em> <code>|</code> <em><</em>expr<em>></em></td><td width="40%"><code>(six.cons <var>$1</var> <var>$3</var>)</code></td></tr> |
| 16031 |
<tr><td width="60%"><em><</em>id-or-prefix<em>></em> ::=</td></tr> |
| 16032 |
<tr><td width="60%"> <em><</em>identifier<em>></em></td><td width="40%"><code>(six.identifier <var>$1</var>)</code></td></tr> |
| 16033 |
<tr><td width="60%"> | <code>\</code> <em><</em>datum<em>></em></td><td width="40%"><code>(six.prefix <var>$2</var>)</code></td></tr> |
| 16034 |
<tr><td width="60%"><em><</em>type<em>></em> ::=</td></tr> |
| 16035 |
<tr><td width="60%"> <code>int</code></td><td width="40%"><code>int</code></td></tr> |
| 16036 |
<tr><td width="60%"> | <code>char</code></td><td width="40%"><code>char</code></td></tr> |
| 16037 |
<tr><td width="60%"> | <code>bool</code></td><td width="40%"><code>bool</code></td></tr> |
| 16038 |
<tr><td width="60%"> | <code>void</code></td><td width="40%"><code>void</code></td></tr> |
| 16039 |
<tr><td width="60%"> | <code>float</code></td><td width="40%"><code>float</code></td></tr> |
| 16040 |
<tr><td width="60%"> | <code>double</code></td><td width="40%"><code>double</code></td></tr> |
| 16041 |
<tr><td width="60%"> | <code>obj</code></td><td width="40%"><code>obj</code></td></tr> |
| 16042 |
</table> |
| 16043 |
|
| 16044 |
<a name="SIX-semantics"></a><hr size="6"><br/><br/><br/> |
| 16045 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16046 |
<tr><td valign="middle" align="left"><a href="#SIX-grammar" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16047 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16048 |
<td valign="middle" align="left"> </td> |
| 16049 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16050 |
<td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16051 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16052 |
<td valign="middle" align="left"> </td> |
| 16053 |
<td valign="middle" align="left"> </td> |
| 16054 |
<td valign="middle" align="left"> </td> |
| 16055 |
<td valign="middle" align="left"> </td> |
| 16056 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16057 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16058 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16059 |
</tr></table> |
| 16060 |
<h3 class="subsection">18.12.2 SIX semantics</h3> |
| 16061 |
|
| 16062 |
<p>The semantics of SIX depends on the definition of the |
| 16063 |
<code>six.<var>XXX</var></code> identifiers (as functions and macros). Many of |
| 16064 |
these identifiers are predefined macros which give SIX a semantics |
| 16065 |
that is close to C’s. The user may override these definitions to |
| 16066 |
change the semantics either globally or locally. For example, |
| 16067 |
<code>six.x^y</code> is a predefined macro that expands <code>(six.x^y x y)</code> |
| 16068 |
into <code>(bitwise-xor x y)</code>. If the user prefers the ‘<samp>^</samp>’ |
| 16069 |
operator to express exponentiation in a specific function, then in |
| 16070 |
that function <code>six.x^y</code> can be redefined as a macro that expands |
| 16071 |
<code>(six.x^y x y)</code> into <code>(expt x y)</code>. Note that the |
| 16072 |
associativity and precedence of operators cannot be changed as that is |
| 16073 |
a syntactic issue. |
| 16074 |
</p> |
| 16075 |
<p>Note that the following identifiers are not predefined, and |
| 16076 |
consequently they do not have a predefined semantics: |
| 16077 |
<code>six.label</code>, <code>six.goto</code>, <code>six.switch</code>, <code>six.case</code>, |
| 16078 |
<code>six.break</code>, <code>six.continue</code>, <code>six.return</code>, |
| 16079 |
<code>six.clause</code>, <code>six.x:-y</code>, and <code>six.!</code>. |
| 16080 |
</p> |
| 16081 |
<p>The following is an example showing some of the predefined semantics |
| 16082 |
of SIX: |
| 16083 |
</p> |
| 16084 |
<table><tr><td> </td><td><pre class="smallexample">> <b>(list (+ 1 2) \3+4; (+ 5 6))</b> |
| 16085 |
(3 7 11) |
| 16086 |
> <b>\[ 1+2, \(+ 3 4), 5+6 ];</b> |
| 16087 |
(3 7 11) |
| 16088 |
> <b>(map (lambda (x) \(x*x-1)/log(x+1);) '(1 2 3 4))</b> |
| 16089 |
(0 2.730717679880512 5.7707801635558535 9.320024018394177) |
| 16090 |
> <b>\obj n = expt(10,5);</b> |
| 16091 |
> <b>n</b> |
| 16092 |
100000 |
| 16093 |
> <b>\obj t[3][10] = 88;</b> |
| 16094 |
> <b>\t[0][9] = t[2][1] = 11;</b> |
| 16095 |
11 |
| 16096 |
> <b>t</b> |
| 16097 |
#(#(88 88 88 88 88 88 88 88 88 11) |
| 16098 |
#(88 88 88 88 88 88 88 88 88 88) |
| 16099 |
#(88 11 88 88 88 88 88 88 88 88)) |
| 16100 |
> <b>\obj radix = new parameter (10);</b> |
| 16101 |
> <b>\radix(2);</b> |
| 16102 |
> <b>\radix();</b> |
| 16103 |
2 |
| 16104 |
> <b>\for (int i=0; i<5; i++) pp(1<<i*8);</b> |
| 16105 |
1 |
| 16106 |
256 |
| 16107 |
65536 |
| 16108 |
16777216 |
| 16109 |
4294967296 |
| 16110 |
> <b>\obj \make-adder (obj x) { obj (obj y) { x+y; }; }</b> |
| 16111 |
> <b>\map (new adder (100), [1,2,3,4]);</b> |
| 16112 |
(101 102 103 104) |
| 16113 |
> <b>(map (make-adder 100) (list 1 2 3 4))</b> |
| 16114 |
(101 102 103 104) |
| 16115 |
</pre></td></tr></table> |
| 16116 |
|
| 16117 |
<a name="C_002dinterface"></a><hr size="6"><br/><br/><br/> |
| 16118 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16119 |
<tr><td valign="middle" align="left"><a href="#SIX-semantics" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16120 |
<td valign="middle" align="left"><a href="#mapping-of-types" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16121 |
<td valign="middle" align="left"> </td> |
| 16122 |
<td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16123 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16124 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16125 |
<td valign="middle" align="left"> </td> |
| 16126 |
<td valign="middle" align="left"> </td> |
| 16127 |
<td valign="middle" align="left"> </td> |
| 16128 |
<td valign="middle" align="left"> </td> |
| 16129 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16130 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16131 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16132 |
</tr></table> |
| 16133 |
<a name="C_002dinterface-1"></a> |
| 16134 |
<h1 class="chapter">19. C-interface</h1> |
| 16135 |
<a name="index-FFI"></a> |
| 16136 |
<a name="index-foreign-function-interface"></a> |
| 16137 |
|
| 16138 |
<p>The Gambit Scheme system offers a mechanism for interfacing Scheme code |
| 16139 |
and C code called the “C-interface”. A Scheme program indicates which |
| 16140 |
C functions it needs to have access to and which Scheme procedures can |
| 16141 |
be called from C, and the C interface automatically constructs the |
| 16142 |
corresponding Scheme procedures and C functions. The conversions needed |
| 16143 |
to transform data from the Scheme representation to the C representation |
| 16144 |
(and back), are generated automatically in accordance with the argument |
| 16145 |
and result types of the C function or Scheme procedure. |
| 16146 |
</p> |
| 16147 |
<p>The C-interface places some restrictions on the types of data that can |
| 16148 |
be exchanged between C and Scheme. The mapping of data types between C |
| 16149 |
and Scheme is discussed in the next section. The remaining sections of |
| 16150 |
this chapter describe each special form of the C-interface. |
| 16151 |
</p> |
| 16152 |
<table class="menu" border="0" cellspacing="0"> |
| 16153 |
<tr><td align="left" valign="top"><a href="#mapping-of-types">19.1 The mapping of types between C and Scheme</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16154 |
<tr><td align="left" valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16155 |
<tr><td align="left" valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16156 |
<tr><td align="left" valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16157 |
<tr><td align="left" valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16158 |
<tr><td align="left" valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16159 |
<tr><td align="left" valign="top"><a href="#continuations">19.7 Continuations and the C-interface</a></td><td> </td><td align="left" valign="top"></td></tr> |
| 16160 |
</table> |
| 16161 |
|
| 16162 |
<a name="mapping-of-types"></a><hr size="6"><br/><br/><br/> |
| 16163 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16164 |
<tr><td valign="middle" align="left"><a href="#C_002dinterface" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16165 |
<td valign="middle" align="left"><a href="#c_002ddeclare" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16166 |
<td valign="middle" align="left"> </td> |
| 16167 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16168 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16169 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16170 |
<td valign="middle" align="left"> </td> |
| 16171 |
<td valign="middle" align="left"> </td> |
| 16172 |
<td valign="middle" align="left"> </td> |
| 16173 |
<td valign="middle" align="left"> </td> |
| 16174 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16175 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16176 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16177 |
</tr></table> |
| 16178 |
<a name="The-mapping-of-types-between-C-and-Scheme"></a> |
| 16179 |
<h2 class="section">19.1 The mapping of types between C and Scheme</h2> |
| 16180 |
|
| 16181 |
<p>Scheme and C do not provide the same set of built-in data types so it is |
| 16182 |
important to understand which Scheme type is compatible with which C |
| 16183 |
type and how values get mapped from one environment to the other. To |
| 16184 |
improve compatibility a new type is added to Scheme, the ‘<samp>foreign</samp>’ |
| 16185 |
object type, and the following data types are added to C: |
| 16186 |
</p> |
| 16187 |
<dl compact="compact"> |
| 16188 |
<dt> <code>scheme-object</code></dt> |
| 16189 |
<dd><p>denotes the universal type of Scheme objects |
| 16190 |
(type <code>___SCMOBJ</code> defined in ‘<samp>gambit.h</samp>’) |
| 16191 |
</p></dd> |
| 16192 |
<dt> <code>bool</code></dt> |
| 16193 |
<dd><p>denotes the C++ ‘<samp>bool</samp>’ type or the C ‘<samp>int</samp>’ type |
| 16194 |
(type <code>___BOOL</code> defined in ‘<samp>gambit.h</samp>’) |
| 16195 |
</p></dd> |
| 16196 |
<dt> <code>int8</code></dt> |
| 16197 |
<dd><p>8 bit signed integer (type <code>___S8</code> defined in ‘<samp>gambit.h</samp>’) |
| 16198 |
</p></dd> |
| 16199 |
<dt> <code>unsigned-int8</code></dt> |
| 16200 |
<dd><p>8 bit unsigned integer (type <code>___U8</code> defined in ‘<samp>gambit.h</samp>’) |
| 16201 |
</p></dd> |
| 16202 |
<dt> <code>int16</code></dt> |
| 16203 |
<dd><p>16 bit signed integer (type <code>___S16</code> defined in ‘<samp>gambit.h</samp>’) |
| 16204 |
</p></dd> |
| 16205 |
<dt> <code>unsigned-int16</code></dt> |
| 16206 |
<dd><p>16 bit unsigned integer (type <code>___U16</code> defined in ‘<samp>gambit.h</samp>’) |
| 16207 |
</p></dd> |
| 16208 |
<dt> <code>int32</code></dt> |
| 16209 |
<dd><p>32 bit signed integer (type <code>___S32</code> defined in ‘<samp>gambit.h</samp>’) |
| 16210 |
</p></dd> |
| 16211 |
<dt> <code>unsigned-int32</code></dt> |
| 16212 |
<dd><p>32 bit unsigned integer (type <code>___U32</code> defined in ‘<samp>gambit.h</samp>’) |
| 16213 |
</p></dd> |
| 16214 |
<dt> <code>int64</code></dt> |
| 16215 |
<dd><p>64 bit signed integer (type <code>___S64</code> defined in ‘<samp>gambit.h</samp>’) |
| 16216 |
</p></dd> |
| 16217 |
<dt> <code>unsigned-int64</code></dt> |
| 16218 |
<dd><p>64 bit unsigned integer (type <code>___U64</code> defined in ‘<samp>gambit.h</samp>’) |
| 16219 |
</p></dd> |
| 16220 |
<dt> <code>float32</code></dt> |
| 16221 |
<dd><p>32 bit floating point number (type <code>___F32</code> defined in ‘<samp>gambit.h</samp>’) |
| 16222 |
</p></dd> |
| 16223 |
<dt> <code>float64</code></dt> |
| 16224 |
<dd><p>64 bit floating point number (type <code>___F64</code> defined in ‘<samp>gambit.h</samp>’) |
| 16225 |
</p></dd> |
| 16226 |
<dt> <code>ISO-8859-1</code></dt> |
| 16227 |
<dd><p>denotes ISO-8859-1 encoded characters |
| 16228 |
(8 bit unsigned integer, type <code>___ISO_8859_1</code> defined in ‘<samp>gambit.h</samp>’) |
| 16229 |
</p></dd> |
| 16230 |
<dt> <code>UCS-2</code></dt> |
| 16231 |
<dd><p>denotes UCS-2 encoded characters |
| 16232 |
(16 bit unsigned integer, type <code>___UCS_2</code> defined in ‘<samp>gambit.h</samp>’) |
| 16233 |
</p></dd> |
| 16234 |
<dt> <code>UCS-4</code></dt> |
| 16235 |
<dd><p>denotes UCS-4 encoded characters |
| 16236 |
(32 bit unsigned integer, type <code>___UCS_4</code> defined in ‘<samp>gambit.h</samp>’) |
| 16237 |
</p></dd> |
| 16238 |
<dt> <code>char-string</code></dt> |
| 16239 |
<dd><p>denotes the C ‘<samp>char*</samp>’ type when used as a null terminated string |
| 16240 |
</p></dd> |
| 16241 |
<dt> <code>nonnull-char-string</code></dt> |
| 16242 |
<dd><p>denotes the nonnull C ‘<samp>char*</samp>’ type when used as a null terminated string |
| 16243 |
</p></dd> |
| 16244 |
<dt> <code>nonnull-char-string-list</code></dt> |
| 16245 |
<dd><p>denotes an array of nonnull C ‘<samp>char*</samp>’ terminated with a null pointer |
| 16246 |
</p></dd> |
| 16247 |
<dt> <code>ISO-8859-1-string</code></dt> |
| 16248 |
<dd><p>denotes ISO-8859-1 encoded strings |
| 16249 |
(null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>) |
| 16250 |
</p></dd> |
| 16251 |
<dt> <code>nonnull-ISO-8859-1-string</code></dt> |
| 16252 |
<dd><p>denotes nonnull ISO-8859-1 encoded strings |
| 16253 |
(null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>) |
| 16254 |
</p></dd> |
| 16255 |
<dt> <code>nonnull-ISO-8859-1-stringlist</code></dt> |
| 16256 |
<dd><p>denotes an array of nonnull ISO-8859-1 encoded strings terminated with a null pointer |
| 16257 |
</p></dd> |
| 16258 |
<dt> <code>UTF-8-string</code></dt> |
| 16259 |
<dd><p>denotes UTF-8 encoded strings |
| 16260 |
(null terminated string of <code>char</code>, i.e. <code>char*</code>) |
| 16261 |
</p></dd> |
| 16262 |
<dt> <code>nonnull-UTF-8-string</code></dt> |
| 16263 |
<dd><p>denotes nonnull UTF-8 encoded strings |
| 16264 |
(null terminated string of <code>char</code>, i.e. <code>char*</code>) |
| 16265 |
</p></dd> |
| 16266 |
<dt> <code>nonnull-UTF-8-string-list</code></dt> |
| 16267 |
<dd><p>denotes an array of nonnull UTF-8 encoded strings terminated with a null pointer |
| 16268 |
</p></dd> |
| 16269 |
<dt> <code>UTF-16-string</code></dt> |
| 16270 |
<dd><p>denotes UTF-16 encoded strings |
| 16271 |
(null terminated string of <code>char</code>, i.e. <code>char*</code>) |
| 16272 |
</p></dd> |
| 16273 |
<dt> <code>nonnull-UTF-16-string</code></dt> |
| 16274 |
<dd><p>denotes nonnull UTF-16 encoded strings |
| 16275 |
(null terminated string of <code>char</code>, i.e. <code>char*</code>) |
| 16276 |
</p></dd> |
| 16277 |
<dt> <code>nonnull-UTF-16-string-list</code></dt> |
| 16278 |
<dd><p>denotes an array of nonnull UTF-16 encoded strings terminated with a null pointer |
| 16279 |
</p></dd> |
| 16280 |
<dt> <code>UCS-2-string</code></dt> |
| 16281 |
<dd><p>denotes UCS-2 encoded strings |
| 16282 |
(null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>) |
| 16283 |
</p></dd> |
| 16284 |
<dt> <code>nonnull-UCS-2-string</code></dt> |
| 16285 |
<dd><p>denotes nonnull UCS-2 encoded strings |
| 16286 |
(null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>) |
| 16287 |
</p></dd> |
| 16288 |
<dt> <code>nonnull-UCS-2-string-list</code></dt> |
| 16289 |
<dd><p>denotes an array of nonnull UCS-2 encoded strings terminated with a null pointer |
| 16290 |
</p></dd> |
| 16291 |
<dt> <code>UCS-4-string</code></dt> |
| 16292 |
<dd><p>denotes UCS-4 encoded strings |
| 16293 |
(null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>) |
| 16294 |
</p></dd> |
| 16295 |
<dt> <code>nonnull-UCS-4-string</code></dt> |
| 16296 |
<dd><p>denotes nonnull UCS-4 encoded strings |
| 16297 |
(null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>) |
| 16298 |
</p></dd> |
| 16299 |
<dt> <code>nonnull-UCS-4-string-list</code></dt> |
| 16300 |
<dd><p>denotes an array of nonnull UCS-4 encoded strings terminated with a null pointer |
| 16301 |
</p></dd> |
| 16302 |
<dt> <code>wchar_t-string</code></dt> |
| 16303 |
<dd><p>denotes <code>wchar_t</code> encoded strings |
| 16304 |
(null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>) |
| 16305 |
</p></dd> |
| 16306 |
<dt> <code>nonnull-wchar_t-string</code></dt> |
| 16307 |
<dd><p>denotes nonnull <code>wchar_t</code> encoded strings |
| 16308 |
(null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>) |
| 16309 |
</p></dd> |
| 16310 |
<dt> <code>nonnull-wchar_t-string-list</code></dt> |
| 16311 |
<dd><p>denotes an array of nonnull <code>wchar_t</code> encoded strings terminated with a null pointer |
| 16312 |
</p></dd> |
| 16313 |
</dl> |
| 16314 |
|
| 16315 |
<p>To specify a particular C type inside the <code>c-lambda</code>, |
| 16316 |
<code>c-define</code> and <code>c-define-type</code> forms, the following “Scheme |
| 16317 |
notation” is used: |
| 16318 |
</p> |
| 16319 |
<dl compact="compact"> |
| 16320 |
<dt> <code><span class="roman">Scheme notation</span></code></dt> |
| 16321 |
<dd><p>C type |
| 16322 |
</p></dd> |
| 16323 |
<dt> <code>void</code></dt> |
| 16324 |
<dd><p><code>void</code> |
| 16325 |
</p></dd> |
| 16326 |
<dt> <code>bool</code></dt> |
| 16327 |
<dd><p><code>bool</code> |
| 16328 |
</p></dd> |
| 16329 |
<dt> <code>char</code></dt> |
| 16330 |
<dd><p><code>char</code> (may be signed or unsigned depending on the C compiler) |
| 16331 |
</p></dd> |
| 16332 |
<dt> <code>signed-char</code></dt> |
| 16333 |
<dd><p><code>signed char</code> |
| 16334 |
</p></dd> |
| 16335 |
<dt> <code>unsigned-char</code></dt> |
| 16336 |
<dd><p><code>unsigned char</code> |
| 16337 |
</p></dd> |
| 16338 |
<dt> <code>ISO-8859-1</code></dt> |
| 16339 |
<dd><p><code>ISO-8859-1</code> |
| 16340 |
</p></dd> |
| 16341 |
<dt> <code>UCS-2</code></dt> |
| 16342 |
<dd><p><code>UCS-2</code> |
| 16343 |
</p></dd> |
| 16344 |
<dt> <code>UCS-4</code></dt> |
| 16345 |
<dd><p><code>UCS-4</code> |
| 16346 |
</p></dd> |
| 16347 |
<dt> <code>wchar_t</code></dt> |
| 16348 |
<dd><p><code>wchar_t</code> |
| 16349 |
</p></dd> |
| 16350 |
<dt> <code>size_t</code></dt> |
| 16351 |
<dd><p><code>size_t</code> (type <code>___SIZE_T</code> defined in ‘<samp>gambit.h</samp>’) |
| 16352 |
</p></dd> |
| 16353 |
<dt> <code>ssize_t</code></dt> |
| 16354 |
<dd><p><code>ssize_t</code> (type <code>___SSIZE_T</code> defined in ‘<samp>gambit.h</samp>’) |
| 16355 |
</p></dd> |
| 16356 |
<dt> <code>ptrdiff_t</code></dt> |
| 16357 |
<dd><p><code>ptrdiff_t</code> (type <code>___PTRDIFF_T</code> defined in ‘<samp>gambit.h</samp>’) |
| 16358 |
</p></dd> |
| 16359 |
<dt> <code>short</code></dt> |
| 16360 |
<dd><p><code>short</code> |
| 16361 |
</p></dd> |
| 16362 |
<dt> <code>unsigned-short</code></dt> |
| 16363 |
<dd><p><code>unsigned short</code> |
| 16364 |
</p></dd> |
| 16365 |
<dt> <code>int</code></dt> |
| 16366 |
<dd><p><code>int</code> |
| 16367 |
</p></dd> |
| 16368 |
<dt> <code>unsigned-int</code></dt> |
| 16369 |
<dd><p><code>unsigned int</code> |
| 16370 |
</p></dd> |
| 16371 |
<dt> <code>long</code></dt> |
| 16372 |
<dd><p><code>long</code> |
| 16373 |
</p></dd> |
| 16374 |
<dt> <code>unsigned-long</code></dt> |
| 16375 |
<dd><p><code>unsigned long</code> |
| 16376 |
</p></dd> |
| 16377 |
<dt> <code>long-long</code></dt> |
| 16378 |
<dd><p><code>long long</code> |
| 16379 |
</p></dd> |
| 16380 |
<dt> <code>unsigned-long-long</code></dt> |
| 16381 |
<dd><p><code>unsigned long long</code> |
| 16382 |
</p></dd> |
| 16383 |
<dt> <code>float</code></dt> |
| 16384 |
<dd><p><code>float</code> |
| 16385 |
</p></dd> |
| 16386 |
<dt> <code>double</code></dt> |
| 16387 |
<dd><p><code>double</code> |
| 16388 |
</p></dd> |
| 16389 |
<dt> <code>int8</code></dt> |
| 16390 |
<dd><p><code>int8</code> |
| 16391 |
</p></dd> |
| 16392 |
<dt> <code>unsigned-int8</code></dt> |
| 16393 |
<dd><p><code>unsigned-int8</code> |
| 16394 |
</p></dd> |
| 16395 |
<dt> <code>int16</code></dt> |
| 16396 |
<dd><p><code>int16</code> |
| 16397 |
</p></dd> |
| 16398 |
<dt> <code>unsigned-int16</code></dt> |
| 16399 |
<dd><p><code>unsigned-int16</code> |
| 16400 |
</p></dd> |
| 16401 |
<dt> <code>int32</code></dt> |
| 16402 |
<dd><p><code>int32</code> |
| 16403 |
</p></dd> |
| 16404 |
<dt> <code>unsigned-int32</code></dt> |
| 16405 |
<dd><p><code>unsigned-int32</code> |
| 16406 |
</p></dd> |
| 16407 |
<dt> <code>int64</code></dt> |
| 16408 |
<dd><p><code>int64</code> |
| 16409 |
</p></dd> |
| 16410 |
<dt> <code>unsigned-int64</code></dt> |
| 16411 |
<dd><p><code>unsigned-int64</code> |
| 16412 |
</p></dd> |
| 16413 |
<dt> <code>float32</code></dt> |
| 16414 |
<dd><p><code>float32</code> |
| 16415 |
</p></dd> |
| 16416 |
<dt> <code>float64</code></dt> |
| 16417 |
<dd><p><code>float64</code> |
| 16418 |
</p></dd> |
| 16419 |
<dt> <code>(struct "<var>c-struct-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt> |
| 16420 |
<dd><p><code>struct <var>c-struct-id</var></code> (where <var>c-struct-id</var> is the name of a |
| 16421 |
C structure; see below for the meaning of <var>tags</var> and <var>release-function</var>) |
| 16422 |
</p></dd> |
| 16423 |
<dt> <code>(union "<var>c-union-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt> |
| 16424 |
<dd><p><code>union <var>c-union-id</var></code> (where <var>c-union-id</var> is the name of a |
| 16425 |
C union; see below for the meaning of <var>tags</var> and <var>release-function</var>) |
| 16426 |
</p></dd> |
| 16427 |
<dt> <code>(type "<var>c-type-id</var>" <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt> |
| 16428 |
<dd><p><code><var>c-type-id</var></code> (where <var>c-type-id</var> is an identifier naming a |
| 16429 |
C type; see below for the meaning of <var>tags</var> and <var>release-function</var>) |
| 16430 |
</p></dd> |
| 16431 |
<dt> <code>(pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt> |
| 16432 |
<dd><p><code><var>T</var>*</code> (where <var>T</var> is the C equivalent of <var>type</var> |
| 16433 |
which must be the Scheme notation of a C type; see below for the meaning |
| 16434 |
of <var>tags</var> and <var>release-function</var>) |
| 16435 |
</p></dd> |
| 16436 |
<dt> <code>(nonnull-pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code></dt> |
| 16437 |
<dd><p>same as <code>(pointer <var>type</var> <span class="roman">[</span><var>tags</var> <span class="roman">[</span><var>release-function</var><span class="roman">]</span><span class="roman">]</span>)</code> |
| 16438 |
except the <code>NULL</code> pointer is not allowed |
| 16439 |
</p></dd> |
| 16440 |
<dt> <code>(function (<var>type1</var>…) <var>result-type</var>)</code></dt> |
| 16441 |
<dd><p>function with the given argument types and result type |
| 16442 |
</p></dd> |
| 16443 |
<dt> <code>(nonnull-function (<var>type1</var>…) <var>result-type</var>)</code></dt> |
| 16444 |
<dd><p>same as <code>(function (<var>type1</var>…) <var>result-type</var>)</code> |
| 16445 |
except the <code>NULL</code> pointer is not allowed |
| 16446 |
</p></dd> |
| 16447 |
<dt> <code>char-string</code></dt> |
| 16448 |
<dd><p><code>char-string</code> |
| 16449 |
</p></dd> |
| 16450 |
<dt> <code>nonnull-char-string</code></dt> |
| 16451 |
<dd><p><code>nonnull-char-string</code> |
| 16452 |
</p></dd> |
| 16453 |
<dt> <code>nonnull-char-string-list</code></dt> |
| 16454 |
<dd><p><code>nonnull-char-string-list</code> |
| 16455 |
</p></dd> |
| 16456 |
<dt> <code>ISO-8859-1-string</code></dt> |
| 16457 |
<dd><p><code>ISO-8859-1-string</code> |
| 16458 |
</p></dd> |
| 16459 |
<dt> <code>nonnull-ISO-8859-1-string</code></dt> |
| 16460 |
<dd><p><code>nonnull-ISO-8859-1-string</code> |
| 16461 |
</p></dd> |
| 16462 |
<dt> <code>nonnull-ISO-8859-1-string-list</code></dt> |
| 16463 |
<dd><p><code>nonnull-ISO-8859-1-string-list</code> |
| 16464 |
</p></dd> |
| 16465 |
<dt> <code>UTF-8-string</code></dt> |
| 16466 |
<dd><p><code>UTF-8-string</code> |
| 16467 |
</p></dd> |
| 16468 |
<dt> <code>nonnull-UTF-8-string</code></dt> |
| 16469 |
<dd><p><code>nonnull-UTF-8-string</code> |
| 16470 |
</p></dd> |
| 16471 |
<dt> <code>nonnull-UTF-8-string-list</code></dt> |
| 16472 |
<dd><p><code>nonnull-UTF-8-string-list</code> |
| 16473 |
</p></dd> |
| 16474 |
<dt> <code>UTF-16-string</code></dt> |
| 16475 |
<dd><p><code>UTF-16-string</code> |
| 16476 |
</p></dd> |
| 16477 |
<dt> <code>nonnull-UTF-16-string</code></dt> |
| 16478 |
<dd><p><code>nonnull-UTF-16-string</code> |
| 16479 |
</p></dd> |
| 16480 |
<dt> <code>nonnull-UTF-16-string-list</code></dt> |
| 16481 |
<dd><p><code>nonnull-UTF-16-string-list</code> |
| 16482 |
</p></dd> |
| 16483 |
<dt> <code>UCS-2-string</code></dt> |
| 16484 |
<dd><p><code>UCS-2-string</code> |
| 16485 |
</p></dd> |
| 16486 |
<dt> <code>nonnull-UCS-2-string</code></dt> |
| 16487 |
<dd><p><code>nonnull-UCS-2-string</code> |
| 16488 |
</p></dd> |
| 16489 |
<dt> <code>nonnull-UCS-2-string-list</code></dt> |
| 16490 |
<dd><p><code>nonnull-UCS-2-string-list</code> |
| 16491 |
</p></dd> |
| 16492 |
<dt> <code>UCS-4-string</code></dt> |
| 16493 |
<dd><p><code>UCS-4-string</code> |
| 16494 |
</p></dd> |
| 16495 |
<dt> <code>nonnull-UCS-4-string</code></dt> |
| 16496 |
<dd><p><code>nonnull-UCS-4-string</code> |
| 16497 |
</p></dd> |
| 16498 |
<dt> <code>nonnull-UCS-4-string-list</code></dt> |
| 16499 |
<dd><p><code>nonnull-UCS-4-string-list</code> |
| 16500 |
</p></dd> |
| 16501 |
<dt> <code>wchar_t-string</code></dt> |
| 16502 |
<dd><p><code>wchar_t-string</code> |
| 16503 |
</p></dd> |
| 16504 |
<dt> <code>nonnull-wchar_t-string</code></dt> |
| 16505 |
<dd><p><code>nonnull-wchar_t-string</code> |
| 16506 |
</p></dd> |
| 16507 |
<dt> <code>nonnull-wchar_t-string-list</code></dt> |
| 16508 |
<dd><p><code>nonnull-wchar_t-string-list</code> |
| 16509 |
</p></dd> |
| 16510 |
<dt> <code>scheme-object</code></dt> |
| 16511 |
<dd><p><code>scheme-object</code> |
| 16512 |
</p></dd> |
| 16513 |
<dt> <code><var>name</var></code></dt> |
| 16514 |
<dd><p>appropriate translation of <var>name</var> (where <var>name</var> |
| 16515 |
is a C type defined with <code>c-define-type</code>) |
| 16516 |
</p></dd> |
| 16517 |
<dt> <code>"<var>c-type-id</var>"</code></dt> |
| 16518 |
<dd><p><var>c-type-id</var> (this form is equivalent to <code>(type "<var>c-type-id</var>")</code>) |
| 16519 |
</p></dd> |
| 16520 |
</dl> |
| 16521 |
|
| 16522 |
<p>The <code>struct</code>, <code>union</code>, <code>type</code>, <code>pointer</code> and |
| 16523 |
<code>nonnull-pointer</code> types are “foreign types” and they are |
| 16524 |
represented on the Scheme side as “foreign objects”. A foreign object |
| 16525 |
is internally represented as a pointer. This internal pointer is |
| 16526 |
identical to the C pointer being represented in the case of the |
| 16527 |
<code>pointer</code> and <code>nonnull-pointer</code> types. |
| 16528 |
</p> |
| 16529 |
<p>In the case of the <code>struct</code>, <code>union</code> and <code>type</code> types, |
| 16530 |
the internal pointer points to a copy of the C data type being |
| 16531 |
represented. When an instance of one of these types is converted from C |
| 16532 |
to Scheme, a block of memory is allocated from the C heap and |
| 16533 |
initialized with the instance and then a foreign object is allocated |
| 16534 |
from the Scheme heap and initialized with the pointer to this copy. |
| 16535 |
This approach may appear overly complex, but it allows the conversion of |
| 16536 |
C++ classes that do not have a zero parameter constructor or an |
| 16537 |
assignment method (i.e. when compiling with a C++ compiler an instance |
| 16538 |
is copied using ‘<samp>new <var>type</var> (<var>instance</var>)</samp>’, which calls the |
| 16539 |
copy-constructor of <var>type</var> if it is a class; <var>type</var>’s assignment |
| 16540 |
operator is never used). Conversion from Scheme to C simply |
| 16541 |
dereferences the internal pointer (no allocation from the C heap is |
| 16542 |
performed). Deallocation of the copy on the C heap is under the control |
| 16543 |
of the release function attached to the foreign object (see below). |
| 16544 |
</p> |
| 16545 |
<p>The optional <var>tags</var> field of foreign type specifications is used |
| 16546 |
for type checking on the Scheme side. The <var>tags</var> field must be |
| 16547 |
<code>#f</code>, a symbol or a non-empty list of symbols. When it is not |
| 16548 |
specified the <var>tags</var> field defaults to a symbol whose name, as |
| 16549 |
returned by <code>symbol->string</code>, is the C type declaration for that |
| 16550 |
type. For example the symbol ‘<samp>char**</samp>’ is the default for the |
| 16551 |
type ‘<samp>(pointer (pointer char))</samp>’. A <var>tags</var> field that is a |
| 16552 |
single symbol is equivalent to a list containing only that symbol. |
| 16553 |
The first symbol in the list of tags is the primary tag. For example |
| 16554 |
the primary tag of the type ‘<samp>(pointer char)</samp>’ is ‘<samp>char*</samp>’ and |
| 16555 |
the primary tag of the type ‘<samp>(pointer char (foo bar))</samp>’ is |
| 16556 |
‘<samp>foo</samp>’. |
| 16557 |
</p> |
| 16558 |
<p>Type compatibility between two foreign types depends on their tags. |
| 16559 |
An instance of a foreign type <var>T</var> can be used where a foreign type |
| 16560 |
<var>E</var> is expected if and only if |
| 16561 |
</p> |
| 16562 |
<ul> |
| 16563 |
<li> |
| 16564 |
<var>T</var>’s <var>tags</var> field is <code>#f</code>, or |
| 16565 |
|
| 16566 |
</li><li> |
| 16567 |
<var>E</var>’s <var>tags</var> field is <code>#f</code>, or |
| 16568 |
|
| 16569 |
</li><li> |
| 16570 |
<var>T</var>’s primary tag is a member of <var>E</var>’s tags. |
| 16571 |
|
| 16572 |
</li></ul> |
| 16573 |
|
| 16574 |
<p>For the safest code a <var>tags</var> field of <code>#f</code> should be used |
| 16575 |
sparingly, as it completely bypasses type checking. The external |
| 16576 |
representation of Scheme foreign objects (used by the <code>write</code> |
| 16577 |
procedure) contains the primary tag (if the <var>tags</var> field is not |
| 16578 |
<code>#f</code>), and the hexadecimal address denoted by the internal |
| 16579 |
pointer, for example ‘<samp>#<char** #2 0x2AAC535C></samp>’. Note that the |
| 16580 |
hexadecimal address is in C notation, which can be easily transferred |
| 16581 |
to a C debugger with a “cut-and-paste”. |
| 16582 |
</p> |
| 16583 |
<p>A <var>release-function</var> can also be specified within a foreign type |
| 16584 |
specification. The <var>release-function</var> must be <code>#f</code> or a string |
| 16585 |
naming a C function with a single parameter of type ‘<samp>void*</samp>’ (in |
| 16586 |
which the internal pointer is passed) and with a result of type |
| 16587 |
‘<samp>___SCMOBJ</samp>’ (for returning an error code). When the |
| 16588 |
<var>release-function</var> is not specified or is <code>#f</code> a default |
| 16589 |
function is constructed by the C-interface. This default function does |
| 16590 |
nothing in the case of the <code>pointer</code> and <code>nonnull-pointer</code> |
| 16591 |
types (deallocation is not the responsibility of the C-interface) and |
| 16592 |
returns the fixnum ‘<samp>___FIX(___NO_ERR)</samp>’ to indicate no error. In |
| 16593 |
the case of the <code>struct</code>, <code>union</code> and <code>type</code> types, the |
| 16594 |
default function reclaims the copy on the C heap referenced by the |
| 16595 |
internal pointer (when using a C++ compiler this is done using |
| 16596 |
‘<samp>delete (<var>type</var>*)<var>internal-pointer</var></samp>’, which calls the |
| 16597 |
destructor of <var>type</var> if it is a class) and returns |
| 16598 |
‘<samp>___FIX(___NO_ERR)</samp>’. In many situations the default |
| 16599 |
<var>release-function</var> will perform the appropriate cleanup for the |
| 16600 |
foreign type. However, in certain cases special operations (such as |
| 16601 |
decrementing a reference count, removing the object from a table, etc) |
| 16602 |
must be performed. For such cases a user supplied |
| 16603 |
<var>release-function</var> is needed. |
| 16604 |
</p> |
| 16605 |
<p>The <var>release-function</var> is invoked at most once for any foreign |
| 16606 |
object. After the <var>release-function</var> is invoked, the foreign |
| 16607 |
object is considered “released” and can no longer be used in a |
| 16608 |
foreign type conversion. When the garbage collector detects that a |
| 16609 |
foreign object is no longer reachable by the program, it will invoke |
| 16610 |
the <var>release-function</var> if the foreign object is not yet released. |
| 16611 |
When there is a need to release the foreign object promptly, the |
| 16612 |
program can explicitly call <code>(foreign-release! <var>obj</var>)</code> which |
| 16613 |
invokes the <var>release-function</var> if the foreign object is not yet |
| 16614 |
released, and does nothing otherwise. The call |
| 16615 |
<code>(foreign-released? <var>obj</var>)</code> returns a boolean indicating |
| 16616 |
whether the foreign object <var>obj</var> has been released yet or not. |
| 16617 |
The call <code>(foreign-address <var>obj</var>)</code> returns the address |
| 16618 |
denoted by the internal pointer of foreign object <var>obj</var> or 0 if it |
| 16619 |
has been released. The call <code>(foreign? <var>obj</var>)</code> tests that |
| 16620 |
<var>obj</var> is a foreign object. Finally the call <code>(foreign-tags |
| 16621 |
<var>obj</var>)</code> returns the list of tags of foreign object <var>obj</var>, or |
| 16622 |
<code>#f</code>. |
| 16623 |
</p> |
| 16624 |
<p>The following table gives the C types to which each Scheme type |
| 16625 |
can be converted: |
| 16626 |
</p> |
| 16627 |
<dl compact="compact"> |
| 16628 |
<dt> Scheme type</dt> |
| 16629 |
<dd><p>Allowed target C types |
| 16630 |
</p></dd> |
| 16631 |
<dt> boolean <code>#f</code></dt> |
| 16632 |
<dd><p><code>scheme-object</code>; <code>bool</code>; |
| 16633 |
<code>pointer</code>; |
| 16634 |
<code>function</code>; |
| 16635 |
<code>char-string</code>; |
| 16636 |
<code>ISO-8859-1-string</code>; |
| 16637 |
<code>UTF-8-string</code>; |
| 16638 |
<code>UTF-16-string</code>; |
| 16639 |
<code>UCS-2-string</code>; |
| 16640 |
<code>UCS-4-string</code>; |
| 16641 |
<code>wchar_t-string</code> |
| 16642 |
</p></dd> |
| 16643 |
<dt> boolean <code>#t</code></dt> |
| 16644 |
<dd><p><code>scheme-object</code>; <code>bool</code> |
| 16645 |
</p></dd> |
| 16646 |
<dt> character</dt> |
| 16647 |
<dd><p><code>scheme-object</code>; <code>bool</code>; |
| 16648 |
<span class="roman">[</span><code><span class="roman">[</span>un<span class="roman">]</span>signed</code><span class="roman">]</span> <code>char</code>; <code>ISO-8859-1</code>; <code>UCS-2</code>; |
| 16649 |
<code>UCS-4</code>; <code>wchar_t</code> |
| 16650 |
</p></dd> |
| 16651 |
<dt> exact integer</dt> |
| 16652 |
<dd><p><code>scheme-object</code>; <code>bool</code>; <span class="roman">[</span><code>unsigned-</code><span class="roman">]</span> |
| 16653 |
<code>int8</code>/<code>int16</code>/<code>int32</code>/<code>int64</code>; <span class="roman">[</span><code>unsigned</code><span class="roman">]</span> |
| 16654 |
<code>short</code>/<code>int</code>/<code>long</code>; <code>size_t</code>/<code>ssize_t</code>/<code>ptrdiff_t</code> |
| 16655 |
</p></dd> |
| 16656 |
<dt> inexact real</dt> |
| 16657 |
<dd><p><code>scheme-object</code>; <code>bool</code>; <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code> |
| 16658 |
</p></dd> |
| 16659 |
<dt> string</dt> |
| 16660 |
<dd><p><code>scheme-object</code>; <code>bool</code>; |
| 16661 |
<code>char-string</code>; |
| 16662 |
<code>nonnull-char-string</code>; |
| 16663 |
<code>ISO-8859-1-string</code>; |
| 16664 |
<code>nonnull-ISO-8859-1-string</code>; |
| 16665 |
<code>UTF-8-string</code>; |
| 16666 |
<code>nonnull-UTF-8-string</code>; |
| 16667 |
<code>UTF-16-string</code>; |
| 16668 |
<code>nonnull-UTF-16-string</code>; |
| 16669 |
<code>UCS-2-string</code>; |
| 16670 |
<code>nonnull-UCS-2-string</code>; |
| 16671 |
<code>UCS-4-string</code>; |
| 16672 |
<code>nonnull-UCS-4-string</code>; |
| 16673 |
<code>wchar_t-string</code>; |
| 16674 |
<code>nonnull-wchar_t-string</code> |
| 16675 |
</p></dd> |
| 16676 |
<dt> foreign object</dt> |
| 16677 |
<dd><p><code>scheme-object</code>; <code>bool</code>; <code>struct</code>/<code>union</code>/<code>type</code>/<code>pointer</code>/<code>nonnull-pointer</code> with the appropriate tags |
| 16678 |
</p></dd> |
| 16679 |
<dt> vector</dt> |
| 16680 |
<dd><p><code>scheme-object</code>; <code>bool</code> |
| 16681 |
</p></dd> |
| 16682 |
<dt> symbol</dt> |
| 16683 |
<dd><p><code>scheme-object</code>; <code>bool</code> |
| 16684 |
</p></dd> |
| 16685 |
<dt> procedure</dt> |
| 16686 |
<dd><p><code>scheme-object</code>; <code>bool</code>; |
| 16687 |
<code>function</code>; |
| 16688 |
<code>nonnull-function</code> |
| 16689 |
</p></dd> |
| 16690 |
<dt> other objects</dt> |
| 16691 |
<dd><p><code>scheme-object</code>; <code>bool</code> |
| 16692 |
</p></dd> |
| 16693 |
</dl> |
| 16694 |
|
| 16695 |
<p>The following table gives the Scheme types to which each C type |
| 16696 |
will be converted: |
| 16697 |
</p> |
| 16698 |
<dl compact="compact"> |
| 16699 |
<dt> C type</dt> |
| 16700 |
<dd><p>Resulting Scheme type |
| 16701 |
</p></dd> |
| 16702 |
<dt> scheme-object</dt> |
| 16703 |
<dd><p>the Scheme object encoded |
| 16704 |
</p></dd> |
| 16705 |
<dt> bool</dt> |
| 16706 |
<dd><p>boolean |
| 16707 |
</p></dd> |
| 16708 |
<dt> <span class="roman">[</span><code><span class="roman">[</span>un<span class="roman">]</span>signed</code><span class="roman">]</span> <code>char</code>; <code>ISO-8859-1</code>; <code>UCS-2</code>; <code>UCS-4</code>; <code>wchar_t</code></dt> |
| 16709 |
<dd><p>character |
| 16710 |
</p></dd> |
| 16711 |
<dt> <span class="roman">[</span><code>unsigned-</code><span class="roman">]</span> <code>int8</code>/<code>int16</code>/<code>int32</code>/<code>int64</code>; <span class="roman">[</span><code>unsigned</code><span class="roman">]</span> <code>short</code>/<code>int</code>/<code>long</code>; <code>size_t</code>/<code>ssize_t</code>/<code>ptrdiff_t</code></dt> |
| 16712 |
<dd><p>exact integer |
| 16713 |
</p></dd> |
| 16714 |
<dt> <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code></dt> |
| 16715 |
<dd><p>inexact real |
| 16716 |
</p></dd> |
| 16717 |
<dt> <code>char-string</code>; <code>ISO-8859-1-string</code>; <code>UTF-8-string</code>; <code>UTF-16-string</code>; <code>UCS-2-string</code>; <code>UCS-4-string</code>; <code>wchar_t-string</code></dt> |
| 16718 |
<dd><p>string or <code>#f</code> if it is equal to ‘<samp>NULL</samp>’ |
| 16719 |
</p></dd> |
| 16720 |
<dt> <code>nonnull-char-string</code>; <code>nonnull-ISO-8859-1-string</code>; <code>nonnull-UTF-8-string</code>; <code>nonnull-UTF-16-string</code>; <code>nonnull-UCS-2-string</code>; <code>nonnull-UCS-4-string</code>; <code>nonnull-wchar_t-string</code></dt> |
| 16721 |
<dd><p>string |
| 16722 |
</p></dd> |
| 16723 |
<dt> <code>struct</code>/<code>union</code>/<code>type</code>/<code>pointer</code>/<code>nonnull-pointer</code></dt> |
| 16724 |
<dd><p>foreign object with the appropriate tags |
| 16725 |
or <code>#f</code> in the case of a <code>pointer</code> equal to ‘<samp>NULL</samp>’ |
| 16726 |
</p></dd> |
| 16727 |
<dt> <code>function</code></dt> |
| 16728 |
<dd><p>procedure or <code>#f</code> if it is equal to ‘<samp>NULL</samp>’ |
| 16729 |
</p></dd> |
| 16730 |
<dt> <code>nonnull-function</code></dt> |
| 16731 |
<dd><p>procedure |
| 16732 |
</p></dd> |
| 16733 |
<dt> <code>void</code></dt> |
| 16734 |
<dd><p>void object |
| 16735 |
</p></dd> |
| 16736 |
</dl> |
| 16737 |
|
| 16738 |
<p>All Scheme types are compatible with the C types <code>scheme-object</code> |
| 16739 |
and <code>bool</code>. Conversion to and from the C type |
| 16740 |
<code>scheme-object</code> is the identity function on the object encoding. |
| 16741 |
This provides a low-level mechanism for accessing Scheme’s object |
| 16742 |
representation from C (with the help of the macros in the |
| 16743 |
‘<samp>gambit.h</samp>’ header file). When a C <code>bool</code> type is expected, |
| 16744 |
an extended Scheme boolean can be passed (<code>#f</code> is converted to 0 |
| 16745 |
and all other values are converted to 1). |
| 16746 |
</p> |
| 16747 |
<p>The Scheme boolean <code>#f</code> can be passed to the C environment where |
| 16748 |
a <code>char-string</code>, <code>ISO-8859-1-string</code>, <code>UTF-8-string</code>, |
| 16749 |
<code>UTF-16-string</code>, <code>UCS-2-string</code>, <code>UCS-4-string</code>, |
| 16750 |
<code>wchar_t-string</code>, <code>pointer</code> or <code>function</code> type is |
| 16751 |
expected. In this case, <code>#f</code> is converted to the ‘<samp>NULL</samp>’ |
| 16752 |
pointer. C <code>bool</code>s are extended booleans so any value different |
| 16753 |
from 0 represents true. Thus, a C <code>bool</code> passed to the Scheme |
| 16754 |
environment is mapped as follows: 0 to <code>#f</code> and all other values |
| 16755 |
to <code>#t</code>. |
| 16756 |
</p> |
| 16757 |
<p>A Scheme character passed to the C environment where any C character |
| 16758 |
type is expected is converted to the corresponding character in the C |
| 16759 |
environment. An error is signaled if the Scheme character does not fit |
| 16760 |
in the C character. Any C character type passed to Scheme is converted |
| 16761 |
to the corresponding Scheme character. An error is signaled if the C |
| 16762 |
character does not fit in the Scheme character. |
| 16763 |
</p> |
| 16764 |
<p>A Scheme exact integer passed to the C environment where a C integer |
| 16765 |
type (other than <code>char</code>) is expected is converted to the |
| 16766 |
corresponding integral value. An error is signaled if the value falls |
| 16767 |
outside of the range representable by that integral type. C integer |
| 16768 |
values passed to the Scheme environment are mapped to the same Scheme |
| 16769 |
exact integer. If the value is outside the fixnum range, a bignum is |
| 16770 |
created. |
| 16771 |
</p> |
| 16772 |
<p>A Scheme inexact real passed to the C environment is converted to the |
| 16773 |
corresponding <code>float</code>, <code>double</code>, <code>float32</code> or |
| 16774 |
<code>float64</code> value. C <code>float</code>, <code>double</code>, <code>float32</code> and |
| 16775 |
<code>float64</code> values passed to the Scheme environment are mapped to the |
| 16776 |
closest Scheme inexact real. |
| 16777 |
</p> |
| 16778 |
<p>Scheme’s rational numbers and complex numbers are not compatible with |
| 16779 |
any C numeric type. |
| 16780 |
</p> |
| 16781 |
<p>A Scheme string passed to the C environment where any C string type is |
| 16782 |
expected is converted to a null terminated string using the appropriate |
| 16783 |
encoding. The C string is a fresh copy of the Scheme string. If the C |
| 16784 |
string was created for an argument of a <code>c-lambda</code>, the C string |
| 16785 |
will be reclaimed when the <code>c-lambda</code> returns. If the C string was |
| 16786 |
created for returning the result of a <code>c-define</code> to C, the caller |
| 16787 |
is responsible for reclaiming the C string with a call to the |
| 16788 |
<code>___release_string</code> function (see below for an example). Any C |
| 16789 |
string type passed to the Scheme environment causes the creation of a |
| 16790 |
fresh Scheme string containing a copy of the C string (unless the C |
| 16791 |
string is equal to <code>NULL</code>, in which case it is converted to |
| 16792 |
<code>#f</code>). |
| 16793 |
</p> |
| 16794 |
<p>A foreign type passed to the Scheme environment causes the creation |
| 16795 |
and initialization of a Scheme foreign object with the appropriate |
| 16796 |
tags (except for the case of a <code>pointer</code> equal to <code>NULL</code> |
| 16797 |
which is converted to <code>#f</code>). A Scheme foreign object can be |
| 16798 |
passed where a foreign type is expected, on the condition that the |
| 16799 |
tags are compatible and the Scheme foreign object is not yet released. |
| 16800 |
The value <code>#f</code> is also acceptable for a <code>pointer</code> type, and |
| 16801 |
is converted to <code>NULL</code>. |
| 16802 |
</p> |
| 16803 |
<p>Scheme procedures defined with the <code>c-define</code> special form can be |
| 16804 |
passed where the <code>function</code> and <code>nonnull-function</code> types are |
| 16805 |
expected. The value <code>#f</code> is also acceptable for a <code>function</code> |
| 16806 |
type, and is converted to <code>NULL</code>. No other Scheme procedures are |
| 16807 |
acceptable. Conversion from the <code>function</code> and |
| 16808 |
<code>nonnull-function</code> types to Scheme procedures is not currently |
| 16809 |
implemented. |
| 16810 |
</p> |
| 16811 |
<a name="c_002ddeclare"></a><hr size="6"><br/><br/><br/> |
| 16812 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16813 |
<tr><td valign="middle" align="left"><a href="#mapping-of-types" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16814 |
<td valign="middle" align="left"><a href="#c_002dinitialize" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16815 |
<td valign="middle" align="left"> </td> |
| 16816 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16817 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16818 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16819 |
<td valign="middle" align="left"> </td> |
| 16820 |
<td valign="middle" align="left"> </td> |
| 16821 |
<td valign="middle" align="left"> </td> |
| 16822 |
<td valign="middle" align="left"> </td> |
| 16823 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16824 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16825 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16826 |
</tr></table> |
| 16827 |
<a name="The-c_002ddeclare-special-form"></a> |
| 16828 |
<h2 class="section">19.2 The <code>c-declare</code> special form</h2> |
| 16829 |
<a name="index-c_002ddeclare"></a> |
| 16830 |
|
| 16831 |
<a name="Definition_of_c-declare"></a><a name="Special_form_c-declare"></a><a name="index-c_002ddeclare-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_c-declare">c-declare</a></b></code><i> <span class="roman"><i>c-declaration</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 16832 |
|
| 16833 |
<p>Initially, the C file produced by <code>gsc</code> contains only an |
| 16834 |
‘<samp>#include</samp>’ of ‘<samp>gambit.h</samp>’. This header file provides a |
| 16835 |
number of macro and procedure declarations to access the Scheme object |
| 16836 |
representation. The special form <code>c-declare</code> adds |
| 16837 |
<i>c-declaration</i> (which must be a string containing the C |
| 16838 |
declarations) to the C file. This string is copied to the C file on a |
| 16839 |
new line so it can start with preprocessor directives. All types of C |
| 16840 |
declarations are allowed (including type declarations, variable |
| 16841 |
declarations, function declarations, ‘<samp>#include</samp>’ directives, |
| 16842 |
‘<samp>#define</samp>’s, and so on). These declarations are visible to |
| 16843 |
subsequent <code>c-declare</code>s, <code>c-initialize</code>s, and |
| 16844 |
<code>c-lambda</code>s, and <code>c-define</code>s in the same module. The most |
| 16845 |
common use of this special form is to declare the external functions |
| 16846 |
that are referenced in <code>c-lambda</code> special forms. Such functions |
| 16847 |
must either be declared explicitly or by including a header file which |
| 16848 |
contains the appropriate C declarations. |
| 16849 |
</p> |
| 16850 |
<p>The <code>c-declare</code> special form does not return a value. |
| 16851 |
It can only appear at top level. |
| 16852 |
</p> |
| 16853 |
<p>For example: |
| 16854 |
</p> |
| 16855 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end |
| 16856 |
|
| 16857 |
#include <stdio.h> |
| 16858 |
|
| 16859 |
extern char *getlogin (); |
| 16860 |
|
| 16861 |
#ifdef sparc |
| 16862 |
char *host = "sparc"; |
| 16863 |
#else |
| 16864 |
char *host = "unknown"; |
| 16865 |
#endif |
| 16866 |
|
| 16867 |
FILE *tfile; |
| 16868 |
|
| 16869 |
c-declare-end |
| 16870 |
) |
| 16871 |
</pre></td></tr></table> |
| 16872 |
|
| 16873 |
|
| 16874 |
|
| 16875 |
<a name="c_002dinitialize"></a><hr size="6"><br/><br/><br/> |
| 16876 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16877 |
<tr><td valign="middle" align="left"><a href="#c_002ddeclare" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16878 |
<td valign="middle" align="left"><a href="#c_002dlambda" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16879 |
<td valign="middle" align="left"> </td> |
| 16880 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16881 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16882 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16883 |
<td valign="middle" align="left"> </td> |
| 16884 |
<td valign="middle" align="left"> </td> |
| 16885 |
<td valign="middle" align="left"> </td> |
| 16886 |
<td valign="middle" align="left"> </td> |
| 16887 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16888 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16889 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16890 |
</tr></table> |
| 16891 |
<a name="The-c_002dinitialize-special-form"></a> |
| 16892 |
<h2 class="section">19.3 The <code>c-initialize</code> special form</h2> |
| 16893 |
<a name="index-c_002dinitialize"></a> |
| 16894 |
|
| 16895 |
<a name="Definition_of_c-initialize"></a><a name="Special_form_c-initialize"></a><a name="index-c_002dinitialize-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_c-initialize">c-initialize</a></b></code><i> <span class="roman"><i>c-code</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 16896 |
|
| 16897 |
<p>Just after the program is loaded and before control is passed to the |
| 16898 |
Scheme code, each C file is initialized by calling its associated |
| 16899 |
initialization function. The body of this function is normally empty |
| 16900 |
but it can be extended by using the <code>c-initialize</code> form. Each |
| 16901 |
occurence of the <code>c-initialize</code> form adds code to the body of the |
| 16902 |
initialization function in the order of appearance in the source file. |
| 16903 |
<i>c-code</i> must be a string containing the C code to execute. This |
| 16904 |
string is copied to the C file on a new line so it can start with |
| 16905 |
preprocessor directives. |
| 16906 |
</p> |
| 16907 |
<p>The <code>c-initialize</code> special form does not return a value. |
| 16908 |
It can only appear at top level. |
| 16909 |
</p> |
| 16910 |
<p>For example: |
| 16911 |
</p> |
| 16912 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-initialize "tfile = tmpfile ();") |
| 16913 |
</pre></td></tr></table> |
| 16914 |
|
| 16915 |
|
| 16916 |
|
| 16917 |
<a name="c_002dlambda"></a><hr size="6"><br/><br/><br/> |
| 16918 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 16919 |
<tr><td valign="middle" align="left"><a href="#c_002dinitialize" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 16920 |
<td valign="middle" align="left"><a href="#c_002ddefine" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 16921 |
<td valign="middle" align="left"> </td> |
| 16922 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 16923 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 16924 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 16925 |
<td valign="middle" align="left"> </td> |
| 16926 |
<td valign="middle" align="left"> </td> |
| 16927 |
<td valign="middle" align="left"> </td> |
| 16928 |
<td valign="middle" align="left"> </td> |
| 16929 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 16930 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 16931 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 16932 |
</tr></table> |
| 16933 |
<a name="The-c_002dlambda-special-form"></a> |
| 16934 |
<h2 class="section">19.4 The <code>c-lambda</code> special form</h2> |
| 16935 |
<a name="index-c_002dlambda"></a> |
| 16936 |
|
| 16937 |
<a name="Definition_of_c-lambda"></a><a name="Special_form_c-lambda"></a><a name="index-c_002dlambda-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_c-lambda">c-lambda</a></b></code><i> (<span class="roman"><i>type1</i></span>…) <span class="roman"><i>result-type</i></span> <span class="roman"><i>c-name-or-code</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 16938 |
|
| 16939 |
<p>The <code>c-lambda</code> special form makes it possible to create a Scheme |
| 16940 |
procedure that will act as a representative of some C function or C code |
| 16941 |
sequence. The first subform is a list containing the type of each |
| 16942 |
argument. The type of the function’s result is given next. Finally, |
| 16943 |
the last subform is a string that either contains the name of the C |
| 16944 |
function to call or some sequence of C code to execute. Variadic C |
| 16945 |
functions are not supported. The resulting Scheme procedure takes |
| 16946 |
exactly the number of arguments specified and delivers them in the same |
| 16947 |
order to the C function. When the Scheme procedure is called, the |
| 16948 |
arguments will be converted to their C representation and then the C |
| 16949 |
function will be called. The result returned by the C function will be |
| 16950 |
converted to its Scheme representation and this value will be returned |
| 16951 |
from the Scheme procedure call. An error will be signaled if some |
| 16952 |
conversion is not possible. The temporary memory allocated from the C |
| 16953 |
heap for the conversion of the arguments and result will be reclaimed |
| 16954 |
whether there is an error or not. |
| 16955 |
</p> |
| 16956 |
<p>When <i>c-name-or-code</i> is not a valid C identifier, it is treated |
| 16957 |
as an arbitrary piece of C code. Within the C code the variables |
| 16958 |
‘<samp>___arg1</samp>’, ‘<samp>___arg2</samp>’, etc. can be referenced to access the |
| 16959 |
converted arguments. Similarly, the result to be returned from the |
| 16960 |
call should be assigned to the variable ‘<samp>___result</samp>’ except when |
| 16961 |
the result is of type <code>struct</code>, <code>union</code>, <code>type</code>, |
| 16962 |
<code>pointer</code>, <code>nonnull-pointer</code>, <code>function</code> or |
| 16963 |
<code>nonnull-function</code> in which case a pointer must be assigned to |
| 16964 |
the variable ‘<samp>___result_voidstar</samp>’ which is of type ‘<samp>void*</samp>’. |
| 16965 |
For results of type <code>pointer</code>, <code>nonnull-pointer</code>, |
| 16966 |
<code>function</code> and <code>nonnull-function</code>, the value assigned to the |
| 16967 |
variable ‘<samp>___result_voidstar</samp>’ must be the pointer or function |
| 16968 |
cast to ‘<samp>void*</samp>’. For results of type <code>struct</code>, |
| 16969 |
<code>union</code>, and <code>type</code>, the value assigned to the variable |
| 16970 |
‘<samp>___result_voidstar</samp>’ must be a pointer to a memory allocated |
| 16971 |
block containing a copy of the result. Note that this block will be |
| 16972 |
reclaimed by the <var>release-function</var> associated with the type. |
| 16973 |
If no result needs to be returned, the <i>result-type</i> should be |
| 16974 |
<code>void</code> and no assignment to the variable ‘<samp>___result</samp>’ or |
| 16975 |
‘<samp>___result_voidstar</samp>’ should take place. Note that the C code |
| 16976 |
should not contain <code>return</code> statements as this is meaningless. |
| 16977 |
Control must always fall off the end of the C code. The C code is |
| 16978 |
copied to the C file on a new line so it can start with preprocessor |
| 16979 |
directives. Moreover the C code is always placed at the head of a |
| 16980 |
compound statement whose lifetime encloses the C to Scheme conversion of |
| 16981 |
the result. Consequently, temporary storage (strings in particular) |
| 16982 |
declared at the head of the C code can be returned by assigning them to |
| 16983 |
‘<samp>___result</samp>’ or ‘<samp>___result_voidstar</samp>’. In the |
| 16984 |
<i>c-name-or-code</i>, the macro ‘<samp>___AT_END</samp>’ may be defined as the |
| 16985 |
piece of C code to execute before control is returned to Scheme but |
| 16986 |
after the result is converted to its Scheme representation. This is |
| 16987 |
mainly useful to deallocate temporary storage contained in the result. |
| 16988 |
</p> |
| 16989 |
<p>When passed to the Scheme environment, the C <code>void</code> type is |
| 16990 |
converted to the void object. |
| 16991 |
</p> |
| 16992 |
<p>For example: |
| 16993 |
</p> |
| 16994 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(define fopen |
| 16995 |
(c-lambda (nonnull-char-string nonnull-char-string) |
| 16996 |
(pointer "FILE") |
| 16997 |
"fopen")) |
| 16998 |
|
| 16999 |
(define fgetc |
| 17000 |
(c-lambda ((pointer "FILE")) |
| 17001 |
int |
| 17002 |
"fgetc")) |
| 17003 |
|
| 17004 |
(let ((f (fopen "datafile" "r"))) |
| 17005 |
(if f (write (fgetc f)))) |
| 17006 |
|
| 17007 |
(define char-code |
| 17008 |
(c-lambda (char) int "___result = ___arg1;")) |
| 17009 |
|
| 17010 |
(define host |
| 17011 |
((c-lambda () nonnull-char-string "___result = host;"))) |
| 17012 |
|
| 17013 |
(define stdin |
| 17014 |
((c-lambda () (pointer "FILE") "___result_voidstar = stdin;"))) |
| 17015 |
|
| 17016 |
((c-lambda () void |
| 17017 |
#<<c-lambda-end |
| 17018 |
printf( "hello\n" ); |
| 17019 |
printf( "world\n" ); |
| 17020 |
c-lambda-end |
| 17021 |
)) |
| 17022 |
|
| 17023 |
(define pack-1-char |
| 17024 |
(c-lambda (char) |
| 17025 |
nonnull-char-string |
| 17026 |
#<<c-lambda-end |
| 17027 |
___result = malloc (2); |
| 17028 |
if (___result != NULL) { ___result[0] = ___arg1; ___result[1] = 0; } |
| 17029 |
#define ___AT_END if (___result != NULL) free (___result); |
| 17030 |
c-lambda-end |
| 17031 |
)) |
| 17032 |
|
| 17033 |
(define pack-2-chars |
| 17034 |
(c-lambda (char char) |
| 17035 |
nonnull-char-string |
| 17036 |
#<<c-lambda-end |
| 17037 |
char s[3]; |
| 17038 |
s[0] = ___arg1; |
| 17039 |
s[1] = ___arg2; |
| 17040 |
s[2] = 0; |
| 17041 |
___result = s; |
| 17042 |
c-lambda-end |
| 17043 |
)) |
| 17044 |
</pre></td></tr></table> |
| 17045 |
|
| 17046 |
|
| 17047 |
|
| 17048 |
<a name="c_002ddefine"></a><hr size="6"><br/><br/><br/> |
| 17049 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 17050 |
<tr><td valign="middle" align="left"><a href="#c_002dlambda" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 17051 |
<td valign="middle" align="left"><a href="#c_002ddefine_002dtype" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 17052 |
<td valign="middle" align="left"> </td> |
| 17053 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 17054 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 17055 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 17056 |
<td valign="middle" align="left"> </td> |
| 17057 |
<td valign="middle" align="left"> </td> |
| 17058 |
<td valign="middle" align="left"> </td> |
| 17059 |
<td valign="middle" align="left"> </td> |
| 17060 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 17061 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 17062 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 17063 |
</tr></table> |
| 17064 |
<a name="The-c_002ddefine-special-form"></a> |
| 17065 |
<h2 class="section">19.5 The <code>c-define</code> special form</h2> |
| 17066 |
<a name="index-c_002ddefine"></a> |
| 17067 |
|
| 17068 |
<a name="Definition_of_c-define"></a><a name="Special_form_c-define"></a><a name="index-c_002ddefine-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_c-define">c-define</a></b></code><i> (<span class="roman"><i>variable</i></span> <span class="roman"><i>define-formals</i></span>) (<span class="roman"><i>type1</i></span>…) <span class="roman"><i>result-type</i></span> <span class="roman"><i>c-name</i></span> <span class="roman"><i>scope</i></span> <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 17069 |
|
| 17070 |
<p>The <code>c-define</code> special form makes it possible to create a C |
| 17071 |
function that will act as a representative of some Scheme procedure. A |
| 17072 |
C function named <i>c-name</i> as well as a Scheme procedure bound to the |
| 17073 |
variable <i>variable</i> are defined. The parameters of the Scheme |
| 17074 |
procedure are <i>define-formals</i> and its body is at the end of the |
| 17075 |
form. The type of each argument of the C function, its result type and |
| 17076 |
<i>c-name</i> (which must be a string) are specified after the parameter |
| 17077 |
specification of the Scheme procedure. When the C function <i>c-name</i> |
| 17078 |
is called from C, its arguments are converted to their Scheme |
| 17079 |
representation and passed to the Scheme procedure. The result of the |
| 17080 |
Scheme procedure is then converted to its C representation and the C |
| 17081 |
function <i>c-name</i> returns it to its caller. |
| 17082 |
</p> |
| 17083 |
<p>The scope of the C function can be changed with the <i>scope</i> |
| 17084 |
parameter, which must be a string. This string is placed immediately |
| 17085 |
before the declaration of the C function. So if <i>scope</i> is the |
| 17086 |
string <code>"static"</code>, the scope of <i>c-name</i> is local to the module |
| 17087 |
it is in, whereas if <i>scope</i> is the empty string, <i>c-name</i> is |
| 17088 |
visible from other modules. |
| 17089 |
</p> |
| 17090 |
<p>The <code>c-define</code> special form does not return a value. |
| 17091 |
It can only appear at top level. |
| 17092 |
</p> |
| 17093 |
<p>For example: |
| 17094 |
</p> |
| 17095 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-define (proc x #!optional (y x) #!rest z) (int int char float) int "f" "" |
| 17096 |
(write (cons x (cons y z))) |
| 17097 |
(newline) |
| 17098 |
(+ x y)) |
| 17099 |
|
| 17100 |
(proc 1 2 #\x 1.5) => 3 and prints (1 2 #\x 1.5) |
| 17101 |
(proc 1) => 2 and prints (1 1) |
| 17102 |
|
| 17103 |
; if f is called from C with the call f (1, 2, 'x', 1.5) |
| 17104 |
; the value 3 is returned and (1 2 #\x 1.5) is printed. |
| 17105 |
; f has to be called with 4 arguments. |
| 17106 |
</pre></td></tr></table> |
| 17107 |
|
| 17108 |
<a name="index-_005f_005f_005fsetup"></a> |
| 17109 |
<a name="index-_005f_005f_005fcleanup"></a> |
| 17110 |
<p>The <code>c-define</code> special form is particularly useful when the |
| 17111 |
driving part of an application is written in C and Scheme procedures |
| 17112 |
are called directly from C. The Scheme part of the application is in |
| 17113 |
a sense a “server” that is providing services to the C part. The |
| 17114 |
Scheme procedures that are to be called from C need to be defined |
| 17115 |
using the <code>c-define</code> special form. Before it can be used, the |
| 17116 |
Scheme part must be initialized with a call to the function |
| 17117 |
‘<samp>___setup</samp>’. Before the program terminates, it must call the |
| 17118 |
function ‘<samp>___cleanup</samp>’ so that the Scheme part may do final |
| 17119 |
cleanup. A sample application is given in the file |
| 17120 |
‘<samp>tests/server.scm</samp>’. |
| 17121 |
</p> |
| 17122 |
|
| 17123 |
|
| 17124 |
<a name="c_002ddefine_002dtype"></a><hr size="6"><br/><br/><br/> |
| 17125 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 17126 |
<tr><td valign="middle" align="left"><a href="#c_002ddefine" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 17127 |
<td valign="middle" align="left"><a href="#continuations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 17128 |
<td valign="middle" align="left"> </td> |
| 17129 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 17130 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 17131 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 17132 |
<td valign="middle" align="left"> </td> |
| 17133 |
<td valign="middle" align="left"> </td> |
| 17134 |
<td valign="middle" align="left"> </td> |
| 17135 |
<td valign="middle" align="left"> </td> |
| 17136 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 17137 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 17138 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 17139 |
</tr></table> |
| 17140 |
<a name="The-c_002ddefine_002dtype-special-form"></a> |
| 17141 |
<h2 class="section">19.6 The <code>c-define-type</code> special form</h2> |
| 17142 |
<a name="index-c_002ddefine_002dtype"></a> |
| 17143 |
|
| 17144 |
<a name="Definition_of_c-define-type"></a><a name="Special_form_c-define-type"></a><a name="index-c_002ddefine_002dtype-1"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="event:browse:http://gambitscheme.org/wiki/index.php?title=Documentation:Special_form_c-define-type">c-define-type</a></b></code><i> <span class="roman"><i>name</i></span> <span class="roman"><i>type</i></span> <span class="roman">[</span><span class="roman"><i>c-to-scheme</i></span> <span class="roman"><i>scheme-to-c</i></span> <span class="roman">[</span><span class="roman"><i>cleanup</i></span><span class="roman">]</span><span class="roman">]</span></i><code>)</code></td><td align="right">special form</td></tr></table> |
| 17145 |
|
| 17146 |
<p>This form associates the type identifier <i>name</i> to the C type |
| 17147 |
<i>type</i>. The <i>name</i> must not clash with predefined types |
| 17148 |
(e.g. <code>char-string</code>, <code>ISO-8859-1</code>, etc.) or with types previously |
| 17149 |
defined with <code>c-define-type</code> in the same file. The |
| 17150 |
<code>c-define-type</code> special form does not return a value. It can only |
| 17151 |
appear at top level. |
| 17152 |
</p> |
| 17153 |
<p>If only the two parameters <i>name</i> and <i>type</i> are supplied then |
| 17154 |
after this definition, the use of <i>name</i> in a type specification is |
| 17155 |
synonymous to <i>type</i>. |
| 17156 |
</p> |
| 17157 |
<p>For example: |
| 17158 |
</p> |
| 17159 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-define-type FILE "FILE") |
| 17160 |
(c-define-type FILE* (pointer FILE)) |
| 17161 |
(c-define-type time-struct-ptr (pointer (struct "tms"))) |
| 17162 |
(define fopen (c-lambda (char-string char-string) FILE* "fopen")) |
| 17163 |
(define fgetc (c-lambda (FILE*) int "fgetc")) |
| 17164 |
</pre></td></tr></table> |
| 17165 |
|
| 17166 |
<p>Note that identifiers are not case-sensitive in standard Scheme but it |
| 17167 |
is good programming practice to use a <i>name</i> with the same case as |
| 17168 |
in C. |
| 17169 |
</p> |
| 17170 |
<p>If four or more parameters are supplied, then <i>type</i> must be a |
| 17171 |
string naming the C type, <i>c-to-scheme</i> and <i>scheme-to-c</i> must |
| 17172 |
be strings suffixing the C macros that convert data of that type between |
| 17173 |
C and Scheme. If <i>cleanup</i> is supplied it must be a boolean |
| 17174 |
indicating whether it is necessary to perform a cleanup operation (such |
| 17175 |
as freeing memory) when data of that type is converted from Scheme to C |
| 17176 |
(it defaults to <code>#t</code>). The cleanup information is used when the C |
| 17177 |
stack is unwound due to a continuation invocation (see |
| 17178 |
<a href="#continuations">Continuations and the C-interface</a>). Although it is safe to always specify <code>#t</code>, |
| 17179 |
it is more efficient in time and space to specify <code>#f</code> because the |
| 17180 |
unwinding mechanism can skip C-interface frames which only contain |
| 17181 |
conversions of data types requiring no cleanup. Two pairs of C macros |
| 17182 |
need to be defined for conversions performed by <code>c-lambda</code> forms |
| 17183 |
and two pairs for conversions performed by <code>c-define</code> forms: |
| 17184 |
</p> |
| 17185 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>___BEGIN_CFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>, int) |
| 17186 |
___END_CFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>, int) |
| 17187 |
|
| 17188 |
___BEGIN_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ) |
| 17189 |
___END_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ) |
| 17190 |
|
| 17191 |
___BEGIN_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int) |
| 17192 |
___END_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int) |
| 17193 |
|
| 17194 |
___BEGIN_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>) |
| 17195 |
___END_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>) |
| 17196 |
</pre></td></tr></table> |
| 17197 |
|
| 17198 |
<p>The macros prefixed with <code>___BEGIN</code> perform the conversion and |
| 17199 |
those prefixed with <code>___END</code> perform any cleanup necessary (such as |
| 17200 |
freeing memory temporarily allocated for the conversion). The macro |
| 17201 |
<code>___END_CFUN_<span class="roman"><i>scheme-to-c</i></span></code> must free the result of the |
| 17202 |
conversion if it is memory allocated, and |
| 17203 |
<code>___END_SFUN_<span class="roman"><i>scheme-to-c</i></span></code> must not (i.e. it is the |
| 17204 |
responsibility of the caller to free the result). |
| 17205 |
</p> |
| 17206 |
<p>The first parameter of these macros is the C variable that contains the |
| 17207 |
value to be converted, and the second parameter is the C variable in |
| 17208 |
which to store the converted value. The third parameter, when present, |
| 17209 |
is the index (starting at 1) of the parameter of the <code>c-lambda</code> or |
| 17210 |
<code>c-define</code> form that is being converted (this is useful for |
| 17211 |
reporting precise error information when a conversion is impossible). |
| 17212 |
</p> |
| 17213 |
<p>To allow for type checking, the first three <code>___BEGIN</code> macros must |
| 17214 |
expand to an unterminated compound statement prefixed by an <code>if</code>, |
| 17215 |
conditional on the absence of type check error: |
| 17216 |
</p> |
| 17217 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>if ((___err = <var>conversion_operation</var>) == ___FIX(___NO_ERR)) { |
| 17218 |
</pre></td></tr></table> |
| 17219 |
|
| 17220 |
<p>The last <code>___BEGIN</code> macro must expand to an unterminated compound |
| 17221 |
statement: |
| 17222 |
</p> |
| 17223 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>{ ___err = <var>conversion_operation</var>; |
| 17224 |
</pre></td></tr></table> |
| 17225 |
|
| 17226 |
<p>If type check errors are impossible then a <code>___BEGIN</code> macro can |
| 17227 |
simply expand to an unterminated compound statement performing the |
| 17228 |
conversion: |
| 17229 |
</p> |
| 17230 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>{ <var>conversion_operation</var>; |
| 17231 |
</pre></td></tr></table> |
| 17232 |
|
| 17233 |
<p>The <code>___END</code> macros must expand to a statement, or to nothing if no |
| 17234 |
cleanup is required, followed by a closing brace (to terminate the |
| 17235 |
compound statement started at the corresponding <code>___BEGIN</code> macro). |
| 17236 |
</p> |
| 17237 |
<p>The <var>conversion_operation</var> is typically a function call that returns |
| 17238 |
an error code value of type <code>___SCMOBJ</code> (the error codes are defined in |
| 17239 |
‘<samp>gambit.h</samp>’, and the error code <code>___FIX(___UNKNOWN_ERR)</code> is available |
| 17240 |
for generic errors). <var>conversion_operation</var> can also set the |
| 17241 |
variable <code>___errmsg</code> of type <code>___SCMOBJ</code> to a specific Scheme |
| 17242 |
string error message. |
| 17243 |
</p> |
| 17244 |
<p>Below is a simple example showing how to interface to an ‘<samp>EBCDIC</samp>’ |
| 17245 |
character type. Memory allocation is not needed for conversion and type |
| 17246 |
check errors are impossible when converting EBCDIC to Scheme characters, |
| 17247 |
but they are possible when converting from Scheme characters to EBCDIC |
| 17248 |
since Gambit supports Unicode characters. |
| 17249 |
</p> |
| 17250 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end |
| 17251 |
|
| 17252 |
typedef char EBCDIC; /* EBCDIC encoded characters */ |
| 17253 |
|
| 17254 |
void put_char (EBCDIC c) { ... } /* EBCDIC I/O functions */ |
| 17255 |
EBCDIC get_char (void) { ... } |
| 17256 |
|
| 17257 |
char EBCDIC_to_ISO_8859_1[256] = { ... }; /* conversion tables */ |
| 17258 |
char ISO_8859_1_to_EBCDIC[256] = { ... }; |
| 17259 |
|
| 17260 |
___SCMOBJ SCMOBJ_to_EBCDIC (___SCMOBJ src, EBCDIC *dst) |
| 17261 |
{ |
| 17262 |
int x = ___INT(src); /* convert from Scheme character to int */ |
| 17263 |
if (x > 255) return ___FIX(___UNKNOWN_ERR); |
| 17264 |
*dst = ISO_8859_1_to_EBCDIC[x]; |
| 17265 |
return ___FIX(___NO_ERR); |
| 17266 |
} |
| 17267 |
|
| 17268 |
#define ___BEGIN_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) \ |
| 17269 |
if ((___err = SCMOBJ_to_EBCDIC (src, &dst)) == ___FIX(___NO_ERR)) { |
| 17270 |
#define ___END_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) } |
| 17271 |
|
| 17272 |
#define ___BEGIN_CFUN_EBCDIC_to_SCMOBJ(src,dst) \ |
| 17273 |
{ dst = ___CHR(EBCDIC_to_ISO_8859_1[src]); |
| 17274 |
#define ___END_CFUN_EBCDIC_to_SCMOBJ(src,dst) } |
| 17275 |
|
| 17276 |
#define ___BEGIN_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) \ |
| 17277 |
{ dst = ___CHR(EBCDIC_to_ISO_8859_1[src]); |
| 17278 |
#define ___END_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) } |
| 17279 |
|
| 17280 |
#define ___BEGIN_SFUN_SCMOBJ_to_EBCDIC(src,dst) \ |
| 17281 |
{ ___err = SCMOBJ_to_EBCDIC (src, &dst); |
| 17282 |
#define ___END_SFUN_SCMOBJ_to_EBCDIC(src,dst) } |
| 17283 |
|
| 17284 |
c-declare-end |
| 17285 |
) |
| 17286 |
|
| 17287 |
(c-define-type EBCDIC "EBCDIC" "EBCDIC_to_SCMOBJ" "SCMOBJ_to_EBCDIC" #f) |
| 17288 |
|
| 17289 |
(define put-char (c-lambda (EBCDIC) void "put_char")) |
| 17290 |
(define get-char (c-lambda () EBCDIC "get_char")) |
| 17291 |
|
| 17292 |
(c-define (write-EBCDIC c) (EBCDIC) void "write_EBCDIC" "" |
| 17293 |
(write-char c)) |
| 17294 |
|
| 17295 |
(c-define (read-EBCDIC) () EBCDIC "read_EBCDIC" "" |
| 17296 |
(read-char)) |
| 17297 |
</pre></td></tr></table> |
| 17298 |
|
| 17299 |
<p>Below is a more complex example that requires memory allocation when |
| 17300 |
converting from C to Scheme. It is an interface to a 2D ‘<samp>point</samp>’ |
| 17301 |
type which is represented in Scheme by a pair of integers. The |
| 17302 |
conversion of the <code>x</code> and <code>y</code> components is done by calls to |
| 17303 |
the conversion macros for the <code>int</code> type (defined in |
| 17304 |
‘<samp>gambit.h</samp>’). Note that no cleanup is necessary when converting |
| 17305 |
from Scheme to C (i.e. the last parameter of the <code>c-define-type</code> is |
| 17306 |
<code>#f</code>). |
| 17307 |
</p> |
| 17308 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end |
| 17309 |
|
| 17310 |
typedef struct { int x, y; } point; |
| 17311 |
|
| 17312 |
void line_to (point p) { ... } |
| 17313 |
point get_mouse (void) { ... } |
| 17314 |
point add_points (point p1, point p2) { ... } |
| 17315 |
|
| 17316 |
___SCMOBJ SCMOBJ_to_POINT (___SCMOBJ src, point *dst, int arg_num) |
| 17317 |
{ |
| 17318 |
___SCMOBJ ___err = ___FIX(___NO_ERR); |
| 17319 |
if (!___PAIRP(src)) |
| 17320 |
___err = ___FIX(___UNKNOWN_ERR); |
| 17321 |
else |
| 17322 |
{ |
| 17323 |
___SCMOBJ car = ___CAR(src); |
| 17324 |
___SCMOBJ cdr = ___CDR(src); |
| 17325 |
___BEGIN_CFUN_SCMOBJ_TO_INT(car,dst->x,arg_num) |
| 17326 |
___BEGIN_CFUN_SCMOBJ_TO_INT(cdr,dst->y,arg_num) |
| 17327 |
___END_CFUN_SCMOBJ_TO_INT(cdr,dst->y,arg_num) |
| 17328 |
___END_CFUN_SCMOBJ_TO_INT(car,dst->x,arg_num) |
| 17329 |
} |
| 17330 |
return ___err; |
| 17331 |
} |
| 17332 |
|
| 17333 |
___SCMOBJ POINT_to_SCMOBJ (point src, ___SCMOBJ *dst, int arg_num) |
| 17334 |
{ |
| 17335 |
___SCMOBJ ___err = ___FIX(___NO_ERR); |
| 17336 |
___SCMOBJ x_scmobj; |
| 17337 |
___SCMOBJ y_scmobj; |
| 17338 |
___BEGIN_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num) |
| 17339 |
___BEGIN_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num) |
| 17340 |
*dst = ___EXT(___make_pair) (x_scmobj, y_scmobj, ___STILL); |
| 17341 |
if (___FIXNUMP(*dst)) |
| 17342 |
___err = *dst; /* return allocation error */ |
| 17343 |
___END_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num) |
| 17344 |
___END_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num) |
| 17345 |
return ___err; |
| 17346 |
} |
| 17347 |
|
| 17348 |
#define ___BEGIN_CFUN_SCMOBJ_to_POINT(src,dst,i) \ |
| 17349 |
if ((___err = SCMOBJ_to_POINT (src, &dst, i)) == ___FIX(___NO_ERR)) { |
| 17350 |
#define ___END_CFUN_SCMOBJ_to_POINT(src,dst,i) } |
| 17351 |
|
| 17352 |
#define ___BEGIN_CFUN_POINT_to_SCMOBJ(src,dst) \ |
| 17353 |
if ((___err = POINT_to_SCMOBJ (src, &dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) { |
| 17354 |
#define ___END_CFUN_POINT_to_SCMOBJ(src,dst) \ |
| 17355 |
___EXT(___release_scmobj) (dst); } |
| 17356 |
|
| 17357 |
#define ___BEGIN_SFUN_POINT_to_SCMOBJ(src,dst,i) \ |
| 17358 |
if ((___err = POINT_to_SCMOBJ (src, &dst, i)) == ___FIX(___NO_ERR)) { |
| 17359 |
#define ___END_SFUN_POINT_to_SCMOBJ(src,dst,i) \ |
| 17360 |
___EXT(___release_scmobj) (dst); } |
| 17361 |
|
| 17362 |
#define ___BEGIN_SFUN_SCMOBJ_to_POINT(src,dst) \ |
| 17363 |
{ ___err = SCMOBJ_to_POINT (src, &dst, ___RETURN_POS); |
| 17364 |
#define ___END_SFUN_SCMOBJ_to_POINT(src,dst) } |
| 17365 |
|
| 17366 |
c-declare-end |
| 17367 |
) |
| 17368 |
|
| 17369 |
(c-define-type point "point" "POINT_to_SCMOBJ" "SCMOBJ_to_POINT" #f) |
| 17370 |
|
| 17371 |
(define line-to (c-lambda (point) void "line_to")) |
| 17372 |
(define get-mouse (c-lambda () point "get_mouse")) |
| 17373 |
(define add-points (c-lambda (point point) point "add_points")) |
| 17374 |
|
| 17375 |
(c-define (write-point p) (point) void "write_point" "" |
| 17376 |
(write p)) |
| 17377 |
|
| 17378 |
(c-define (read-point) () point "read_point" "" |
| 17379 |
(read)) |
| 17380 |
</pre></td></tr></table> |
| 17381 |
|
| 17382 |
<p>An example that requires memory allocation when converting from C to |
| 17383 |
Scheme and Scheme to C is shown below. It is an interface to a |
| 17384 |
“null-terminated array of strings” type which is represented in Scheme |
| 17385 |
by a list of strings. Note that some cleanup is necessary when |
| 17386 |
converting from Scheme to C. |
| 17387 |
</p> |
| 17388 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end |
| 17389 |
|
| 17390 |
#include <stdlib.h> |
| 17391 |
#include <unistd.h> |
| 17392 |
|
| 17393 |
extern char **environ; |
| 17394 |
|
| 17395 |
char **get_environ (void) { return environ; } |
| 17396 |
|
| 17397 |
void free_strings (char **strings) |
| 17398 |
{ |
| 17399 |
char **ptr = strings; |
| 17400 |
while (*ptr != NULL) |
| 17401 |
{ |
| 17402 |
___EXT(___release_string) (*ptr); |
| 17403 |
ptr++; |
| 17404 |
} |
| 17405 |
free (strings); |
| 17406 |
} |
| 17407 |
|
| 17408 |
___SCMOBJ SCMOBJ_to_STRINGS (___SCMOBJ src, char ***dst, int arg_num) |
| 17409 |
{ |
| 17410 |
/* |
| 17411 |
* Src is a list of Scheme strings. Dst will be a null terminated |
| 17412 |
* array of C strings. |
| 17413 |
*/ |
| 17414 |
|
| 17415 |
int i; |
| 17416 |
___SCMOBJ lst = src; |
| 17417 |
int len = 4; /* start with a small result array */ |
| 17418 |
char **result = (char**) malloc (len * sizeof (char*)); |
| 17419 |
|
| 17420 |
if (result == NULL) |
| 17421 |
return ___FIX(___HEAP_OVERFLOW_ERR); |
| 17422 |
|
| 17423 |
i = 0; |
| 17424 |
result[i] = NULL; /* always keep array null terminated */ |
| 17425 |
|
| 17426 |
while (___PAIRP(lst)) |
| 17427 |
{ |
| 17428 |
___SCMOBJ scm_str = ___CAR(lst); |
| 17429 |
char *c_str; |
| 17430 |
___SCMOBJ ___err; |
| 17431 |
|
| 17432 |
if (i >= len-1) /* need to grow the result array? */ |
| 17433 |
{ |
| 17434 |
char **new_result; |
| 17435 |
int j; |
| 17436 |
|
| 17437 |
len = len * 3 / 2; |
| 17438 |
new_result = (char**) malloc (len * sizeof (char*)); |
| 17439 |
if (new_result == NULL) |
| 17440 |
{ |
| 17441 |
free_strings (result); |
| 17442 |
return ___FIX(___HEAP_OVERFLOW_ERR); |
| 17443 |
} |
| 17444 |
for (j=i; j>=0; j--) |
| 17445 |
new_result[j] = result[j]; |
| 17446 |
free (result); |
| 17447 |
result = new_result; |
| 17448 |
} |
| 17449 |
|
| 17450 |
___err = ___EXT(___SCMOBJ_to_CHARSTRING) (scm_str, &c_str, arg_num); |
| 17451 |
|
| 17452 |
if (___err != ___FIX(___NO_ERR)) |
| 17453 |
{ |
| 17454 |
free_strings (result); |
| 17455 |
return ___err; |
| 17456 |
} |
| 17457 |
|
| 17458 |
result[i++] = c_str; |
| 17459 |
result[i] = NULL; |
| 17460 |
lst = ___CDR(lst); |
| 17461 |
} |
| 17462 |
|
| 17463 |
if (!___NULLP(lst)) |
| 17464 |
{ |
| 17465 |
free_strings (result); |
| 17466 |
return ___FIX(___UNKNOWN_ERR); |
| 17467 |
} |
| 17468 |
|
| 17469 |
/* |
| 17470 |
* Note that the caller is responsible for calling free_strings |
| 17471 |
* when it is done with the result. |
| 17472 |
*/ |
| 17473 |
|
| 17474 |
*dst = result; |
| 17475 |
return ___FIX(___NO_ERR); |
| 17476 |
} |
| 17477 |
|
| 17478 |
___SCMOBJ STRINGS_to_SCMOBJ (char **src, ___SCMOBJ *dst, int arg_num) |
| 17479 |
{ |
| 17480 |
___SCMOBJ ___err = ___FIX(___NO_ERR); |
| 17481 |
___SCMOBJ result = ___NUL; /* start with the empty list */ |
| 17482 |
int i = 0; |
| 17483 |
|
| 17484 |
while (src[i] != NULL) |
| 17485 |
i++; |
| 17486 |
|
| 17487 |
/* build the list of strings starting at the tail */ |
| 17488 |
|
| 17489 |
while (--i >= 0) |
| 17490 |
{ |
| 17491 |
___SCMOBJ scm_str; |
| 17492 |
___SCMOBJ new_result; |
| 17493 |
|
| 17494 |
/* |
| 17495 |
* Invariant: result is either the empty list or a ___STILL pair |
| 17496 |
* with reference count equal to 1. This is important because |
| 17497 |
* it is possible that ___CHARSTRING_to_SCMOBJ and ___make_pair |
| 17498 |
* will invoke the garbage collector and we don't want the |
| 17499 |
* reference in result to become invalid (which would be the |
| 17500 |
* case if result was a ___MOVABLE pair or if it had a zero |
| 17501 |
* reference count). |
| 17502 |
*/ |
| 17503 |
|
| 17504 |
___err = ___EXT(___CHARSTRING_to_SCMOBJ) (src[i], &scm_str, arg_num); |
| 17505 |
|
| 17506 |
if (___err != ___FIX(___NO_ERR)) |
| 17507 |
{ |
| 17508 |
___EXT(___release_scmobj) (result); /* allow GC to reclaim result */ |
| 17509 |
return ___FIX(___UNKNOWN_ERR); |
| 17510 |
} |
| 17511 |
|
| 17512 |
/* |
| 17513 |
* Note that scm_str will be a ___STILL object with reference |
| 17514 |
* count equal to 1, so there is no risk that it will be |
| 17515 |
* reclaimed or moved if ___make_pair invokes the garbage |
| 17516 |
* collector. |
| 17517 |
*/ |
| 17518 |
|
| 17519 |
new_result = ___EXT(___make_pair) (scm_str, result, ___STILL); |
| 17520 |
|
| 17521 |
/* |
| 17522 |
* We can zero the reference count of scm_str and result (if |
| 17523 |
* not the empty list) because the pair now references these |
| 17524 |
* objects and the pair is reachable (it can't be reclaimed |
| 17525 |
* or moved by the garbage collector). |
| 17526 |
*/ |
| 17527 |
|
| 17528 |
___EXT(___release_scmobj) (scm_str); |
| 17529 |
___EXT(___release_scmobj) (result); |
| 17530 |
|
| 17531 |
result = new_result; |
| 17532 |
|
| 17533 |
if (___FIXNUMP(result)) |
| 17534 |
return result; /* allocation failed */ |
| 17535 |
} |
| 17536 |
|
| 17537 |
/* |
| 17538 |
* Note that result is either the empty list or a ___STILL pair |
| 17539 |
* with a reference count equal to 1. There will be a call to |
| 17540 |
* ___release_scmobj later on (in ___END_CFUN_STRINGS_to_SCMOBJ |
| 17541 |
* or ___END_SFUN_STRINGS_to_SCMOBJ) that will allow the garbage |
| 17542 |
* collector to reclaim the whole list of strings when the Scheme |
| 17543 |
* world no longer references it. |
| 17544 |
*/ |
| 17545 |
|
| 17546 |
*dst = result; |
| 17547 |
return ___FIX(___NO_ERR); |
| 17548 |
} |
| 17549 |
|
| 17550 |
#define ___BEGIN_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \ |
| 17551 |
if ((___err = SCMOBJ_to_STRINGS (src, &dst, i)) == ___FIX(___NO_ERR)) { |
| 17552 |
#define ___END_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \ |
| 17553 |
free_strings (dst); } |
| 17554 |
|
| 17555 |
#define ___BEGIN_CFUN_STRINGS_to_SCMOBJ(src,dst) \ |
| 17556 |
if ((___err = STRINGS_to_SCMOBJ (src, &dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) { |
| 17557 |
#define ___END_CFUN_STRINGS_to_SCMOBJ(src,dst) \ |
| 17558 |
___EXT(___release_scmobj) (dst); } |
| 17559 |
|
| 17560 |
#define ___BEGIN_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \ |
| 17561 |
if ((___err = STRINGS_to_SCMOBJ (src, &dst, i)) == ___FIX(___NO_ERR)) { |
| 17562 |
#define ___END_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \ |
| 17563 |
___EXT(___release_scmobj) (dst); } |
| 17564 |
|
| 17565 |
#define ___BEGIN_SFUN_SCMOBJ_to_STRINGS(src,dst) \ |
| 17566 |
{ ___err = SCMOBJ_to_STRINGS (src, &dst, ___RETURN_POS); |
| 17567 |
#define ___END_SFUN_SCMOBJ_to_STRINGS(src,dst) } |
| 17568 |
|
| 17569 |
c-declare-end |
| 17570 |
) |
| 17571 |
|
| 17572 |
(c-define-type char** "char**" "STRINGS_to_SCMOBJ" "SCMOBJ_to_STRINGS") |
| 17573 |
|
| 17574 |
(define execv (c-lambda (char-string char**) int "execv")) |
| 17575 |
(define get-environ (c-lambda () char** "get_environ")) |
| 17576 |
|
| 17577 |
(c-define (write-strings x) (char**) void "write_strings" "" |
| 17578 |
(write x)) |
| 17579 |
|
| 17580 |
(c-define (read-strings) () char** "read_strings" "" |
| 17581 |
(read)) |
| 17582 |
</pre></td></tr></table> |
| 17583 |
|
| 17584 |
|
| 17585 |
|
| 17586 |
<a name="continuations"></a><hr size="6"><br/><br/><br/> |
| 17587 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 17588 |
<tr><td valign="middle" align="left"><a href="#c_002ddefine_002dtype" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 17589 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 17590 |
<td valign="middle" align="left"> </td> |
| 17591 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 17592 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 17593 |
<td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 17594 |
<td valign="middle" align="left"> </td> |
| 17595 |
<td valign="middle" align="left"> </td> |
| 17596 |
<td valign="middle" align="left"> </td> |
| 17597 |
<td valign="middle" align="left"> </td> |
| 17598 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 17599 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 17600 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 17601 |
</tr></table> |
| 17602 |
<a name="Continuations-and-the-C_002dinterface"></a> |
| 17603 |
<h2 class="section">19.7 Continuations and the C-interface</h2> |
| 17604 |
<a name="index-continuations"></a> |
| 17605 |
|
| 17606 |
<p>The C-interface allows C to Scheme calls to be nested. This means |
| 17607 |
that during a call from C to Scheme another call from C to Scheme |
| 17608 |
can be performed. This case occurs in the following program: |
| 17609 |
</p> |
| 17610 |
<table><tr><td> </td><td><pre class="smallexample"><b></b>(c-declare #<<c-declare-end |
| 17611 |
|
| 17612 |
int p (char *); /* forward declarations */ |
| 17613 |
int q (void); |
| 17614 |
|
| 17615 |
int a (char *x) { return 2 * p (x+1); } |
| 17616 |
int b (short y) { return y + q (); } |
| 17617 |
|
| 17618 |
c-declare-end |
| 17619 |
) |
| 17620 |
|
| 17621 |
(define a (c-lambda (char-string) int "a")) |
| 17622 |
(define b (c-lambda (short) int "b")) |
| 17623 |
|
| 17624 |
(c-define (p z) (char-string) int "p" "" |
| 17625 |
(+ (b 10) (string-length z))) |
| 17626 |
|
| 17627 |
(c-define (q) () int "q" "" |
| 17628 |
123) |
| 17629 |
|
| 17630 |
(write (a "hello")) |
| 17631 |
</pre></td></tr></table> |
| 17632 |
|
| 17633 |
<p>In this example, the main Scheme program calls the C function ‘<samp>a</samp>’ |
| 17634 |
which calls the Scheme procedure ‘<samp>p</samp>’ which in turn calls the C |
| 17635 |
function ‘<samp>b</samp>’ which finally calls the Scheme procedure ‘<samp>q</samp>’. |
| 17636 |
</p> |
| 17637 |
<p>Gambit-C maintains the Scheme continuation separately from the C stack, |
| 17638 |
thus allowing the Scheme continuation to be unwound independently from |
| 17639 |
the C stack. The C stack frame created for the C function ‘<samp>f</samp>’ is |
| 17640 |
only removed from the C stack when control returns from ‘<samp>f</samp>’ or when |
| 17641 |
control returns to a C function “above” ‘<samp>f</samp>’. Special care is |
| 17642 |
required for programs which escape to Scheme (using first-class |
| 17643 |
continuations) from a Scheme to C (to Scheme) call because the C stack |
| 17644 |
frame will remain on the stack. The C stack may overflow if this |
| 17645 |
happens in a loop with no intervening return to a C function. To avoid |
| 17646 |
this problem make sure the C stack gets cleaned up by executing a normal |
| 17647 |
return from a Scheme to C call. |
| 17648 |
</p> |
| 17649 |
<a name="System-limitations"></a><hr size="6"><br/><br/><br/> |
| 17650 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 17651 |
<tr><td valign="middle" align="left"><a href="#continuations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 17652 |
<td valign="middle" align="left"><a href="#Copyright-and-license" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 17653 |
<td valign="middle" align="left"> </td> |
| 17654 |
<td valign="middle" align="left"><a href="#C_002dinterface" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 17655 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 17656 |
<td valign="middle" align="left"><a href="#Copyright-and-license" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 17657 |
<td valign="middle" align="left"> </td> |
| 17658 |
<td valign="middle" align="left"> </td> |
| 17659 |
<td valign="middle" align="left"> </td> |
| 17660 |
<td valign="middle" align="left"> </td> |
| 17661 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 17662 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 17663 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 17664 |
</tr></table> |
| 17665 |
<a name="System-limitations-1"></a> |
| 17666 |
<h1 class="chapter">20. System limitations</h1> |
| 17667 |
<a name="index-limitations"></a> |
| 17668 |
|
| 17669 |
<ul> |
| 17670 |
<li> |
| 17671 |
<a name="index-floating-point-overflow"></a> |
| 17672 |
<a name="index-overflow_002c-floating-point"></a> |
| 17673 |
On some systems floating point overflows will cause the program to |
| 17674 |
terminate with a floating point exception. |
| 17675 |
|
| 17676 |
</li><li> |
| 17677 |
On some systems floating point operations involving ‘<samp>+nan.0</samp>’ |
| 17678 |
‘<samp>+inf.0</samp>’, ‘<samp>-inf.0</samp>’, or ‘<samp>-0.</samp>’ do not return the |
| 17679 |
value required by the IEEE 754 floating point standard. |
| 17680 |
|
| 17681 |
</li><li> |
| 17682 |
<a name="index-define-1"></a> |
| 17683 |
<a name="index-set_0021"></a> |
| 17684 |
The compiler will not properly compile files with more than one |
| 17685 |
definition (with <code>define</code>) of the same procedure. Replace all |
| 17686 |
but the first <code>define</code> with assignments (<code>set!</code>). |
| 17687 |
|
| 17688 |
</li><li> |
| 17689 |
The maximum number of arguments that can be passed to a procedure by |
| 17690 |
the <code>apply</code> procedure is 8192. |
| 17691 |
|
| 17692 |
</li></ul> |
| 17693 |
|
| 17694 |
<a name="Copyright-and-license"></a><hr size="6"><br/><br/><br/> |
| 17695 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 17696 |
<tr><td valign="middle" align="left"><a href="#System-limitations" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 17697 |
<td valign="middle" align="left"><a href="#General-index" title="Next section in reading order"><img src="button-right.png" border="0" align="middle" width="32"></td> |
| 17698 |
<td valign="middle" align="left"> </td> |
| 17699 |
<td valign="middle" align="left"><a href="#System-limitations" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 17700 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 17701 |
<td valign="middle" align="left"><a href="#General-index" title="Next chapter"><img src="button-right-right.png" border="0" align="middle" width="32"></td> |
| 17702 |
<td valign="middle" align="left"> </td> |
| 17703 |
<td valign="middle" align="left"> </td> |
| 17704 |
<td valign="middle" align="left"> </td> |
| 17705 |
<td valign="middle" align="left"> </td> |
| 17706 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 17707 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 17708 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 17709 |
</tr></table> |
| 17710 |
<a name="Copyright-and-license-1"></a> |
| 17711 |
<h1 class="chapter">21. Copyright and license</h1> |
| 17712 |
|
| 17713 |
<p>The Gambit-C system release v4.7.3 is Copyright © |
| 17714 |
1994-2009 by Marc Feeley, all rights reserved. The Gambit-C system |
| 17715 |
release v4.7.3 is licensed under two licenses: the Apache |
| 17716 |
License, Version 2.0, and the GNU LESSER GENERAL PUBLIC LICENSE, |
| 17717 |
Version 2.1. You have the option to choose which of these two |
| 17718 |
licenses to abide by. The licenses are copied below. |
| 17719 |
</p> |
| 17720 |
|
| 17721 |
|
| 17722 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> |
| 17723 |
Apache License |
| 17724 |
Version 2.0, January 2004 |
| 17725 |
http://www.apache.org/licenses/ |
| 17726 |
|
| 17727 |
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
| 17728 |
|
| 17729 |
1. Definitions. |
| 17730 |
|
| 17731 |
"License" shall mean the terms and conditions for use, reproduction, |
| 17732 |
and distribution as defined by Sections 1 through 9 of this document. |
| 17733 |
|
| 17734 |
"Licensor" shall mean the copyright owner or entity authorized by |
| 17735 |
the copyright owner that is granting the License. |
| 17736 |
|
| 17737 |
"Legal Entity" shall mean the union of the acting entity and all |
| 17738 |
other entities that control, are controlled by, or are under common |
| 17739 |
control with that entity. For the purposes of this definition, |
| 17740 |
"control" means (i) the power, direct or indirect, to cause the |
| 17741 |
direction or management of such entity, whether by contract or |
| 17742 |
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
| 17743 |
outstanding shares, or (iii) beneficial ownership of such entity. |
| 17744 |
|
| 17745 |
"You" (or "Your") shall mean an individual or Legal Entity |
| 17746 |
exercising permissions granted by this License. |
| 17747 |
|
| 17748 |
"Source" form shall mean the preferred form for making modifications, |
| 17749 |
including but not limited to software source code, documentation |
| 17750 |
source, and configuration files. |
| 17751 |
|
| 17752 |
"Object" form shall mean any form resulting from mechanical |
| 17753 |
transformation or translation of a Source form, including but |
| 17754 |
not limited to compiled object code, generated documentation, |
| 17755 |
and conversions to other media types. |
| 17756 |
|
| 17757 |
"Work" shall mean the work of authorship, whether in Source or |
| 17758 |
Object form, made available under the License, as indicated by a |
| 17759 |
copyright notice that is included in or attached to the work |
| 17760 |
(an example is provided in the Appendix below). |
| 17761 |
|
| 17762 |
"Derivative Works" shall mean any work, whether in Source or Object |
| 17763 |
form, that is based on (or derived from) the Work and for which the |
| 17764 |
editorial revisions, annotations, elaborations, or other modifications |
| 17765 |
represent, as a whole, an original work of authorship. For the purposes |
| 17766 |
of this License, Derivative Works shall not include works that remain |
| 17767 |
separable from, or merely link (or bind by name) to the interfaces of, |
| 17768 |
the Work and Derivative Works thereof. |
| 17769 |
|
| 17770 |
"Contribution" shall mean any work of authorship, including |
| 17771 |
the original version of the Work and any modifications or additions |
| 17772 |
to that Work or Derivative Works thereof, that is intentionally |
| 17773 |
submitted to Licensor for inclusion in the Work by the copyright owner |
| 17774 |
or by an individual or Legal Entity authorized to submit on behalf of |
| 17775 |
the copyright owner. For the purposes of this definition, "submitted" |
| 17776 |
means any form of electronic, verbal, or written communication sent |
| 17777 |
to the Licensor or its representatives, including but not limited to |
| 17778 |
communication on electronic mailing lists, source code control systems, |
| 17779 |
and issue tracking systems that are managed by, or on behalf of, the |
| 17780 |
Licensor for the purpose of discussing and improving the Work, but |
| 17781 |
excluding communication that is conspicuously marked or otherwise |
| 17782 |
designated in writing by the copyright owner as "Not a Contribution." |
| 17783 |
|
| 17784 |
"Contributor" shall mean Licensor and any individual or Legal Entity |
| 17785 |
on behalf of whom a Contribution has been received by Licensor and |
| 17786 |
subsequently incorporated within the Work. |
| 17787 |
|
| 17788 |
2. Grant of Copyright License. Subject to the terms and conditions of |
| 17789 |
this License, each Contributor hereby grants to You a perpetual, |
| 17790 |
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
| 17791 |
copyright license to reproduce, prepare Derivative Works of, |
| 17792 |
publicly display, publicly perform, sublicense, and distribute the |
| 17793 |
Work and such Derivative Works in Source or Object form. |
| 17794 |
|
| 17795 |
3. Grant of Patent License. Subject to the terms and conditions of |
| 17796 |
this License, each Contributor hereby grants to You a perpetual, |
| 17797 |
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
| 17798 |
(except as stated in this section) patent license to make, have made, |
| 17799 |
use, offer to sell, sell, import, and otherwise transfer the Work, |
| 17800 |
where such license applies only to those patent claims licensable |
| 17801 |
by such Contributor that are necessarily infringed by their |
| 17802 |
Contribution(s) alone or by combination of their Contribution(s) |
| 17803 |
with the Work to which such Contribution(s) was submitted. If You |
| 17804 |
institute patent litigation against any entity (including a |
| 17805 |
cross-claim or counterclaim in a lawsuit) alleging that the Work |
| 17806 |
or a Contribution incorporated within the Work constitutes direct |
| 17807 |
or contributory patent infringement, then any patent licenses |
| 17808 |
granted to You under this License for that Work shall terminate |
| 17809 |
as of the date such litigation is filed. |
| 17810 |
|
| 17811 |
4. Redistribution. You may reproduce and distribute copies of the |
| 17812 |
Work or Derivative Works thereof in any medium, with or without |
| 17813 |
modifications, and in Source or Object form, provided that You |
| 17814 |
meet the following conditions: |
| 17815 |
|
| 17816 |
(a) You must give any other recipients of the Work or |
| 17817 |
Derivative Works a copy of this License; and |
| 17818 |
|
| 17819 |
(b) You must cause any modified files to carry prominent notices |
| 17820 |
stating that You changed the files; and |
| 17821 |
|
| 17822 |
(c) You must retain, in the Source form of any Derivative Works |
| 17823 |
that You distribute, all copyright, patent, trademark, and |
| 17824 |
attribution notices from the Source form of the Work, |
| 17825 |
excluding those notices that do not pertain to any part of |
| 17826 |
the Derivative Works; and |
| 17827 |
|
| 17828 |
(d) If the Work includes a "NOTICE" text file as part of its |
| 17829 |
distribution, then any Derivative Works that You distribute must |
| 17830 |
include a readable copy of the attribution notices contained |
| 17831 |
within such NOTICE file, excluding those notices that do not |
| 17832 |
pertain to any part of the Derivative Works, in at least one |
| 17833 |
of the following places: within a NOTICE text file distributed |
| 17834 |
as part of the Derivative Works; within the Source form or |
| 17835 |
documentation, if provided along with the Derivative Works; or, |
| 17836 |
within a display generated by the Derivative Works, if and |
| 17837 |
wherever such third-party notices normally appear. The contents |
| 17838 |
of the NOTICE file are for informational purposes only and |
| 17839 |
do not modify the License. You may add Your own attribution |
| 17840 |
notices within Derivative Works that You distribute, alongside |
| 17841 |
or as an addendum to the NOTICE text from the Work, provided |
| 17842 |
that such additional attribution notices cannot be construed |
| 17843 |
as modifying the License. |
| 17844 |
|
| 17845 |
You may add Your own copyright statement to Your modifications and |
| 17846 |
may provide additional or different license terms and conditions |
| 17847 |
for use, reproduction, or distribution of Your modifications, or |
| 17848 |
for any such Derivative Works as a whole, provided Your use, |
| 17849 |
reproduction, and distribution of the Work otherwise complies with |
| 17850 |
the conditions stated in this License. |
| 17851 |
|
| 17852 |
5. Submission of Contributions. Unless You explicitly state otherwise, |
| 17853 |
any Contribution intentionally submitted for inclusion in the Work |
| 17854 |
by You to the Licensor shall be under the terms and conditions of |
| 17855 |
this License, without any additional terms or conditions. |
| 17856 |
Notwithstanding the above, nothing herein shall supersede or modify |
| 17857 |
the terms of any separate license agreement you may have executed |
| 17858 |
with Licensor regarding such Contributions. |
| 17859 |
|
| 17860 |
6. Trademarks. This License does not grant permission to use the trade |
| 17861 |
names, trademarks, service marks, or product names of the Licensor, |
| 17862 |
except as required for reasonable and customary use in describing the |
| 17863 |
origin of the Work and reproducing the content of the NOTICE file. |
| 17864 |
|
| 17865 |
7. Disclaimer of Warranty. Unless required by applicable law or |
| 17866 |
agreed to in writing, Licensor provides the Work (and each |
| 17867 |
Contributor provides its Contributions) on an "AS IS" BASIS, |
| 17868 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 17869 |
implied, including, without limitation, any warranties or conditions |
| 17870 |
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
| 17871 |
PARTICULAR PURPOSE. You are solely responsible for determining the |
| 17872 |
appropriateness of using or redistributing the Work and assume any |
| 17873 |
risks associated with Your exercise of permissions under this License. |
| 17874 |
|
| 17875 |
8. Limitation of Liability. In no event and under no legal theory, |
| 17876 |
whether in tort (including negligence), contract, or otherwise, |
| 17877 |
unless required by applicable law (such as deliberate and grossly |
| 17878 |
negligent acts) or agreed to in writing, shall any Contributor be |
| 17879 |
liable to You for damages, including any direct, indirect, special, |
| 17880 |
incidental, or consequential damages of any character arising as a |
| 17881 |
result of this License or out of the use or inability to use the |
| 17882 |
Work (including but not limited to damages for loss of goodwill, |
| 17883 |
work stoppage, computer failure or malfunction, or any and all |
| 17884 |
other commercial damages or losses), even if such Contributor |
| 17885 |
has been advised of the possibility of such damages. |
| 17886 |
|
| 17887 |
9. Accepting Warranty or Additional Liability. While redistributing |
| 17888 |
the Work or Derivative Works thereof, You may choose to offer, |
| 17889 |
and charge a fee for, acceptance of support, warranty, indemnity, |
| 17890 |
or other liability obligations and/or rights consistent with this |
| 17891 |
License. However, in accepting such obligations, You may act only |
| 17892 |
on Your own behalf and on Your sole responsibility, not on behalf |
| 17893 |
of any other Contributor, and only if You agree to indemnify, |
| 17894 |
defend, and hold each Contributor harmless for any liability |
| 17895 |
incurred by, or claims asserted against, such Contributor by reason |
| 17896 |
of your accepting any such warranty or additional liability. |
| 17897 |
|
| 17898 |
END OF TERMS AND CONDITIONS |
| 17899 |
|
| 17900 |
APPENDIX: How to apply the Apache License to your work. |
| 17901 |
|
| 17902 |
To apply the Apache License to your work, attach the following |
| 17903 |
boilerplate notice, with the fields enclosed by brackets "[]" |
| 17904 |
replaced with your own identifying information. (Don't include |
| 17905 |
the brackets!) The text should be enclosed in the appropriate |
| 17906 |
comment syntax for the file format. We also recommend that a |
| 17907 |
file or class name and description of purpose be included on the |
| 17908 |
same "printed page" as the copyright notice for easier |
| 17909 |
identification within third-party archives. |
| 17910 |
|
| 17911 |
Copyright [yyyy] [name of copyright owner] |
| 17912 |
|
| 17913 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 17914 |
you may not use this file except in compliance with the License. |
| 17915 |
You may obtain a copy of the License at |
| 17916 |
|
| 17917 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 17918 |
|
| 17919 |
Unless required by applicable law or agreed to in writing, software |
| 17920 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 17921 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17922 |
See the License for the specific language governing permissions and |
| 17923 |
limitations under the License. |
| 17924 |
</pre></td></tr></table> |
| 17925 |
|
| 17926 |
|
| 17927 |
|
| 17928 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE |
| 17929 |
Version 2.1, February 1999 |
| 17930 |
|
| 17931 |
Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
| 17932 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 17933 |
Everyone is permitted to copy and distribute verbatim copies |
| 17934 |
of this license document, but changing it is not allowed. |
| 17935 |
|
| 17936 |
[This is the first released version of the Lesser GPL. It also counts |
| 17937 |
as the successor of the GNU Library Public License, version 2, hence |
| 17938 |
the version number 2.1.] |
| 17939 |
|
| 17940 |
Preamble |
| 17941 |
|
| 17942 |
The licenses for most software are designed to take away your |
| 17943 |
freedom to share and change it. By contrast, the GNU General Public |
| 17944 |
Licenses are intended to guarantee your freedom to share and change |
| 17945 |
free software--to make sure the software is free for all its users. |
| 17946 |
|
| 17947 |
This license, the Lesser General Public License, applies to some |
| 17948 |
specially designated software packages--typically libraries--of the |
| 17949 |
Free Software Foundation and other authors who decide to use it. You |
| 17950 |
can use it too, but we suggest you first think carefully about whether |
| 17951 |
this license or the ordinary General Public License is the better |
| 17952 |
strategy to use in any particular case, based on the explanations below. |
| 17953 |
|
| 17954 |
When we speak of free software, we are referring to freedom of use, |
| 17955 |
not price. Our General Public Licenses are designed to make sure that |
| 17956 |
you have the freedom to distribute copies of free software (and charge |
| 17957 |
for this service if you wish); that you receive source code or can get |
| 17958 |
it if you want it; that you can change the software and use pieces of |
| 17959 |
it in new free programs; and that you are informed that you can do |
| 17960 |
these things. |
| 17961 |
|
| 17962 |
To protect your rights, we need to make restrictions that forbid |
| 17963 |
distributors to deny you these rights or to ask you to surrender these |
| 17964 |
rights. These restrictions translate to certain responsibilities for |
| 17965 |
you if you distribute copies of the library or if you modify it. |
| 17966 |
|
| 17967 |
For example, if you distribute copies of the library, whether gratis |
| 17968 |
or for a fee, you must give the recipients all the rights that we gave |
| 17969 |
you. You must make sure that they, too, receive or can get the source |
| 17970 |
code. If you link other code with the library, you must provide |
| 17971 |
complete object files to the recipients, so that they can relink them |
| 17972 |
with the library after making changes to the library and recompiling |
| 17973 |
it. And you must show them these terms so they know their rights. |
| 17974 |
|
| 17975 |
We protect your rights with a two-step method: (1) we copyright the |
| 17976 |
library, and (2) we offer you this license, which gives you legal |
| 17977 |
permission to copy, distribute and/or modify the library. |
| 17978 |
|
| 17979 |
To protect each distributor, we want to make it very clear that |
| 17980 |
there is no warranty for the free library. Also, if the library is |
| 17981 |
modified by someone else and passed on, the recipients should know |
| 17982 |
that what they have is not the original version, so that the original |
| 17983 |
author's reputation will not be affected by problems that might be |
| 17984 |
introduced by others. |
| 17985 |
</pre></td></tr></table> |
| 17986 |
|
| 17987 |
|
| 17988 |
|
| 17989 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> Finally, software patents pose a constant threat to the existence of |
| 17990 |
any free program. We wish to make sure that a company cannot |
| 17991 |
effectively restrict the users of a free program by obtaining a |
| 17992 |
restrictive license from a patent holder. Therefore, we insist that |
| 17993 |
any patent license obtained for a version of the library must be |
| 17994 |
consistent with the full freedom of use specified in this license. |
| 17995 |
|
| 17996 |
Most GNU software, including some libraries, is covered by the |
| 17997 |
ordinary GNU General Public License. This license, the GNU Lesser |
| 17998 |
General Public License, applies to certain designated libraries, and |
| 17999 |
is quite different from the ordinary General Public License. We use |
| 18000 |
this license for certain libraries in order to permit linking those |
| 18001 |
libraries into non-free programs. |
| 18002 |
|
| 18003 |
When a program is linked with a library, whether statically or using |
| 18004 |
a shared library, the combination of the two is legally speaking a |
| 18005 |
combined work, a derivative of the original library. The ordinary |
| 18006 |
General Public License therefore permits such linking only if the |
| 18007 |
entire combination fits its criteria of freedom. The Lesser General |
| 18008 |
Public License permits more lax criteria for linking other code with |
| 18009 |
the library. |
| 18010 |
|
| 18011 |
We call this license the "Lesser" General Public License because it |
| 18012 |
does Less to protect the user's freedom than the ordinary General |
| 18013 |
Public License. It also provides other free software developers Less |
| 18014 |
of an advantage over competing non-free programs. These disadvantages |
| 18015 |
are the reason we use the ordinary General Public License for many |
| 18016 |
libraries. However, the Lesser license provides advantages in certain |
| 18017 |
special circumstances. |
| 18018 |
|
| 18019 |
For example, on rare occasions, there may be a special need to |
| 18020 |
encourage the widest possible use of a certain library, so that it becomes |
| 18021 |
a de-facto standard. To achieve this, non-free programs must be |
| 18022 |
allowed to use the library. A more frequent case is that a free |
| 18023 |
library does the same job as widely used non-free libraries. In this |
| 18024 |
case, there is little to gain by limiting the free library to free |
| 18025 |
software only, so we use the Lesser General Public License. |
| 18026 |
|
| 18027 |
In other cases, permission to use a particular library in non-free |
| 18028 |
programs enables a greater number of people to use a large body of |
| 18029 |
free software. For example, permission to use the GNU C Library in |
| 18030 |
non-free programs enables many more people to use the whole GNU |
| 18031 |
operating system, as well as its variant, the GNU/Linux operating |
| 18032 |
system. |
| 18033 |
|
| 18034 |
Although the Lesser General Public License is Less protective of the |
| 18035 |
users' freedom, it does ensure that the user of a program that is |
| 18036 |
linked with the Library has the freedom and the wherewithal to run |
| 18037 |
that program using a modified version of the Library. |
| 18038 |
|
| 18039 |
The precise terms and conditions for copying, distribution and |
| 18040 |
modification follow. Pay close attention to the difference between a |
| 18041 |
"work based on the library" and a "work that uses the library". The |
| 18042 |
former contains code derived from the library, whereas the latter must |
| 18043 |
be combined with the library in order to run. |
| 18044 |
</pre></td></tr></table> |
| 18045 |
|
| 18046 |
|
| 18047 |
|
| 18048 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE |
| 18049 |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 18050 |
|
| 18051 |
0. This License Agreement applies to any software library or other |
| 18052 |
program which contains a notice placed by the copyright holder or |
| 18053 |
other authorized party saying it may be distributed under the terms of |
| 18054 |
this Lesser General Public License (also called "this License"). |
| 18055 |
Each licensee is addressed as "you". |
| 18056 |
|
| 18057 |
A "library" means a collection of software functions and/or data |
| 18058 |
prepared so as to be conveniently linked with application programs |
| 18059 |
(which use some of those functions and data) to form executables. |
| 18060 |
|
| 18061 |
The "Library", below, refers to any such software library or work |
| 18062 |
which has been distributed under these terms. A "work based on the |
| 18063 |
Library" means either the Library or any derivative work under |
| 18064 |
copyright law: that is to say, a work containing the Library or a |
| 18065 |
portion of it, either verbatim or with modifications and/or translated |
| 18066 |
straightforwardly into another language. (Hereinafter, translation is |
| 18067 |
included without limitation in the term "modification".) |
| 18068 |
|
| 18069 |
"Source code" for a work means the preferred form of the work for |
| 18070 |
making modifications to it. For a library, complete source code means |
| 18071 |
all the source code for all modules it contains, plus any associated |
| 18072 |
interface definition files, plus the scripts used to control compilation |
| 18073 |
and installation of the library. |
| 18074 |
|
| 18075 |
Activities other than copying, distribution and modification are not |
| 18076 |
covered by this License; they are outside its scope. The act of |
| 18077 |
running a program using the Library is not restricted, and output from |
| 18078 |
such a program is covered only if its contents constitute a work based |
| 18079 |
on the Library (independent of the use of the Library in a tool for |
| 18080 |
writing it). Whether that is true depends on what the Library does |
| 18081 |
and what the program that uses the Library does. |
| 18082 |
|
| 18083 |
1. You may copy and distribute verbatim copies of the Library's |
| 18084 |
complete source code as you receive it, in any medium, provided that |
| 18085 |
you conspicuously and appropriately publish on each copy an |
| 18086 |
appropriate copyright notice and disclaimer of warranty; keep intact |
| 18087 |
all the notices that refer to this License and to the absence of any |
| 18088 |
warranty; and distribute a copy of this License along with the |
| 18089 |
Library. |
| 18090 |
|
| 18091 |
You may charge a fee for the physical act of transferring a copy, |
| 18092 |
and you may at your option offer warranty protection in exchange for a |
| 18093 |
fee. |
| 18094 |
</pre></td></tr></table> |
| 18095 |
|
| 18096 |
|
| 18097 |
|
| 18098 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> 2. You may modify your copy or copies of the Library or any portion |
| 18099 |
of it, thus forming a work based on the Library, and copy and |
| 18100 |
distribute such modifications or work under the terms of Section 1 |
| 18101 |
above, provided that you also meet all of these conditions: |
| 18102 |
|
| 18103 |
a) The modified work must itself be a software library. |
| 18104 |
|
| 18105 |
b) You must cause the files modified to carry prominent notices |
| 18106 |
stating that you changed the files and the date of any change. |
| 18107 |
|
| 18108 |
c) You must cause the whole of the work to be licensed at no |
| 18109 |
charge to all third parties under the terms of this License. |
| 18110 |
|
| 18111 |
d) If a facility in the modified Library refers to a function or a |
| 18112 |
table of data to be supplied by an application program that uses |
| 18113 |
the facility, other than as an argument passed when the facility |
| 18114 |
is invoked, then you must make a good faith effort to ensure that, |
| 18115 |
in the event an application does not supply such function or |
| 18116 |
table, the facility still operates, and performs whatever part of |
| 18117 |
its purpose remains meaningful. |
| 18118 |
|
| 18119 |
(For example, a function in a library to compute square roots has |
| 18120 |
a purpose that is entirely well-defined independent of the |
| 18121 |
application. Therefore, Subsection 2d requires that any |
| 18122 |
application-supplied function or table used by this function must |
| 18123 |
be optional: if the application does not supply it, the square |
| 18124 |
root function must still compute square roots.) |
| 18125 |
|
| 18126 |
These requirements apply to the modified work as a whole. If |
| 18127 |
identifiable sections of that work are not derived from the Library, |
| 18128 |
and can be reasonably considered independent and separate works in |
| 18129 |
themselves, then this License, and its terms, do not apply to those |
| 18130 |
sections when you distribute them as separate works. But when you |
| 18131 |
distribute the same sections as part of a whole which is a work based |
| 18132 |
on the Library, the distribution of the whole must be on the terms of |
| 18133 |
this License, whose permissions for other licensees extend to the |
| 18134 |
entire whole, and thus to each and every part regardless of who wrote |
| 18135 |
it. |
| 18136 |
|
| 18137 |
Thus, it is not the intent of this section to claim rights or contest |
| 18138 |
your rights to work written entirely by you; rather, the intent is to |
| 18139 |
exercise the right to control the distribution of derivative or |
| 18140 |
collective works based on the Library. |
| 18141 |
|
| 18142 |
In addition, mere aggregation of another work not based on the Library |
| 18143 |
with the Library (or with a work based on the Library) on a volume of |
| 18144 |
a storage or distribution medium does not bring the other work under |
| 18145 |
the scope of this License. |
| 18146 |
|
| 18147 |
3. You may opt to apply the terms of the ordinary GNU General Public |
| 18148 |
License instead of this License to a given copy of the Library. To do |
| 18149 |
this, you must alter all the notices that refer to this License, so |
| 18150 |
that they refer to the ordinary GNU General Public License, version 2, |
| 18151 |
instead of to this License. (If a newer version than version 2 of the |
| 18152 |
ordinary GNU General Public License has appeared, then you can specify |
| 18153 |
that version instead if you wish.) Do not make any other change in |
| 18154 |
these notices. |
| 18155 |
</pre></td></tr></table> |
| 18156 |
|
| 18157 |
|
| 18158 |
|
| 18159 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> Once this change is made in a given copy, it is irreversible for |
| 18160 |
that copy, so the ordinary GNU General Public License applies to all |
| 18161 |
subsequent copies and derivative works made from that copy. |
| 18162 |
|
| 18163 |
This option is useful when you wish to copy part of the code of |
| 18164 |
the Library into a program that is not a library. |
| 18165 |
|
| 18166 |
4. You may copy and distribute the Library (or a portion or |
| 18167 |
derivative of it, under Section 2) in object code or executable form |
| 18168 |
under the terms of Sections 1 and 2 above provided that you accompany |
| 18169 |
it with the complete corresponding machine-readable source code, which |
| 18170 |
must be distributed under the terms of Sections 1 and 2 above on a |
| 18171 |
medium customarily used for software interchange. |
| 18172 |
|
| 18173 |
If distribution of object code is made by offering access to copy |
| 18174 |
from a designated place, then offering equivalent access to copy the |
| 18175 |
source code from the same place satisfies the requirement to |
| 18176 |
distribute the source code, even though third parties are not |
| 18177 |
compelled to copy the source along with the object code. |
| 18178 |
|
| 18179 |
5. A program that contains no derivative of any portion of the |
| 18180 |
Library, but is designed to work with the Library by being compiled or |
| 18181 |
linked with it, is called a "work that uses the Library". Such a |
| 18182 |
work, in isolation, is not a derivative work of the Library, and |
| 18183 |
therefore falls outside the scope of this License. |
| 18184 |
|
| 18185 |
However, linking a "work that uses the Library" with the Library |
| 18186 |
creates an executable that is a derivative of the Library (because it |
| 18187 |
contains portions of the Library), rather than a "work that uses the |
| 18188 |
library". The executable is therefore covered by this License. |
| 18189 |
Section 6 states terms for distribution of such executables. |
| 18190 |
|
| 18191 |
When a "work that uses the Library" uses material from a header file |
| 18192 |
that is part of the Library, the object code for the work may be a |
| 18193 |
derivative work of the Library even though the source code is not. |
| 18194 |
Whether this is true is especially significant if the work can be |
| 18195 |
linked without the Library, or if the work is itself a library. The |
| 18196 |
threshold for this to be true is not precisely defined by law. |
| 18197 |
|
| 18198 |
If such an object file uses only numerical parameters, data |
| 18199 |
structure layouts and accessors, and small macros and small inline |
| 18200 |
functions (ten lines or less in length), then the use of the object |
| 18201 |
file is unrestricted, regardless of whether it is legally a derivative |
| 18202 |
work. (Executables containing this object code plus portions of the |
| 18203 |
Library will still fall under Section 6.) |
| 18204 |
|
| 18205 |
Otherwise, if the work is a derivative of the Library, you may |
| 18206 |
distribute the object code for the work under the terms of Section 6. |
| 18207 |
Any executables containing that work also fall under Section 6, |
| 18208 |
whether or not they are linked directly with the Library itself. |
| 18209 |
</pre></td></tr></table> |
| 18210 |
|
| 18211 |
|
| 18212 |
|
| 18213 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> 6. As an exception to the Sections above, you may also combine or |
| 18214 |
link a "work that uses the Library" with the Library to produce a |
| 18215 |
work containing portions of the Library, and distribute that work |
| 18216 |
under terms of your choice, provided that the terms permit |
| 18217 |
modification of the work for the customer's own use and reverse |
| 18218 |
engineering for debugging such modifications. |
| 18219 |
|
| 18220 |
You must give prominent notice with each copy of the work that the |
| 18221 |
Library is used in it and that the Library and its use are covered by |
| 18222 |
this License. You must supply a copy of this License. If the work |
| 18223 |
during execution displays copyright notices, you must include the |
| 18224 |
copyright notice for the Library among them, as well as a reference |
| 18225 |
directing the user to the copy of this License. Also, you must do one |
| 18226 |
of these things: |
| 18227 |
|
| 18228 |
a) Accompany the work with the complete corresponding |
| 18229 |
machine-readable source code for the Library including whatever |
| 18230 |
changes were used in the work (which must be distributed under |
| 18231 |
Sections 1 and 2 above); and, if the work is an executable linked |
| 18232 |
with the Library, with the complete machine-readable "work that |
| 18233 |
uses the Library", as object code and/or source code, so that the |
| 18234 |
user can modify the Library and then relink to produce a modified |
| 18235 |
executable containing the modified Library. (It is understood |
| 18236 |
that the user who changes the contents of definitions files in the |
| 18237 |
Library will not necessarily be able to recompile the application |
| 18238 |
to use the modified definitions.) |
| 18239 |
|
| 18240 |
b) Use a suitable shared library mechanism for linking with the |
| 18241 |
Library. A suitable mechanism is one that (1) uses at run time a |
| 18242 |
copy of the library already present on the user's computer system, |
| 18243 |
rather than copying library functions into the executable, and (2) |
| 18244 |
will operate properly with a modified version of the library, if |
| 18245 |
the user installs one, as long as the modified version is |
| 18246 |
interface-compatible with the version that the work was made with. |
| 18247 |
|
| 18248 |
c) Accompany the work with a written offer, valid for at |
| 18249 |
least three years, to give the same user the materials |
| 18250 |
specified in Subsection 6a, above, for a charge no more |
| 18251 |
than the cost of performing this distribution. |
| 18252 |
|
| 18253 |
d) If distribution of the work is made by offering access to copy |
| 18254 |
from a designated place, offer equivalent access to copy the above |
| 18255 |
specified materials from the same place. |
| 18256 |
|
| 18257 |
e) Verify that the user has already received a copy of these |
| 18258 |
materials or that you have already sent this user a copy. |
| 18259 |
|
| 18260 |
For an executable, the required form of the "work that uses the |
| 18261 |
Library" must include any data and utility programs needed for |
| 18262 |
reproducing the executable from it. However, as a special exception, |
| 18263 |
the materials to be distributed need not include anything that is |
| 18264 |
normally distributed (in either source or binary form) with the major |
| 18265 |
components (compiler, kernel, and so on) of the operating system on |
| 18266 |
which the executable runs, unless that component itself accompanies |
| 18267 |
the executable. |
| 18268 |
|
| 18269 |
It may happen that this requirement contradicts the license |
| 18270 |
restrictions of other proprietary libraries that do not normally |
| 18271 |
accompany the operating system. Such a contradiction means you cannot |
| 18272 |
use both them and the Library together in an executable that you |
| 18273 |
distribute. |
| 18274 |
|
| 18275 |
7. You may place library facilities that are a work based on the |
| 18276 |
Library side-by-side in a single library together with other library |
| 18277 |
facilities not covered by this License, and distribute such a combined |
| 18278 |
library, provided that the separate distribution of the work based on |
| 18279 |
the Library and of the other library facilities is otherwise |
| 18280 |
permitted, and provided that you do these two things: |
| 18281 |
|
| 18282 |
a) Accompany the combined library with a copy of the same work |
| 18283 |
based on the Library, uncombined with any other library |
| 18284 |
facilities. This must be distributed under the terms of the |
| 18285 |
Sections above. |
| 18286 |
|
| 18287 |
b) Give prominent notice with the combined library of the fact |
| 18288 |
that part of it is a work based on the Library, and explaining |
| 18289 |
where to find the accompanying uncombined form of the same work. |
| 18290 |
|
| 18291 |
8. You may not copy, modify, sublicense, link with, or distribute |
| 18292 |
the Library except as expressly provided under this License. Any |
| 18293 |
attempt otherwise to copy, modify, sublicense, link with, or |
| 18294 |
distribute the Library is void, and will automatically terminate your |
| 18295 |
rights under this License. However, parties who have received copies, |
| 18296 |
or rights, from you under this License will not have their licenses |
| 18297 |
terminated so long as such parties remain in full compliance. |
| 18298 |
|
| 18299 |
9. You are not required to accept this License, since you have not |
| 18300 |
signed it. However, nothing else grants you permission to modify or |
| 18301 |
distribute the Library or its derivative works. These actions are |
| 18302 |
prohibited by law if you do not accept this License. Therefore, by |
| 18303 |
modifying or distributing the Library (or any work based on the |
| 18304 |
Library), you indicate your acceptance of this License to do so, and |
| 18305 |
all its terms and conditions for copying, distributing or modifying |
| 18306 |
the Library or works based on it. |
| 18307 |
|
| 18308 |
10. Each time you redistribute the Library (or any work based on the |
| 18309 |
Library), the recipient automatically receives a license from the |
| 18310 |
original licensor to copy, distribute, link with or modify the Library |
| 18311 |
subject to these terms and conditions. You may not impose any further |
| 18312 |
restrictions on the recipients' exercise of the rights granted herein. |
| 18313 |
You are not responsible for enforcing compliance by third parties with |
| 18314 |
this License. |
| 18315 |
</pre></td></tr></table> |
| 18316 |
|
| 18317 |
|
| 18318 |
|
| 18319 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> 11. If, as a consequence of a court judgment or allegation of patent |
| 18320 |
infringement or for any other reason (not limited to patent issues), |
| 18321 |
conditions are imposed on you (whether by court order, agreement or |
| 18322 |
otherwise) that contradict the conditions of this License, they do not |
| 18323 |
excuse you from the conditions of this License. If you cannot |
| 18324 |
distribute so as to satisfy simultaneously your obligations under this |
| 18325 |
License and any other pertinent obligations, then as a consequence you |
| 18326 |
may not distribute the Library at all. For example, if a patent |
| 18327 |
license would not permit royalty-free redistribution of the Library by |
| 18328 |
all those who receive copies directly or indirectly through you, then |
| 18329 |
the only way you could satisfy both it and this License would be to |
| 18330 |
refrain entirely from distribution of the Library. |
| 18331 |
|
| 18332 |
If any portion of this section is held invalid or unenforceable under any |
| 18333 |
particular circumstance, the balance of the section is intended to apply, |
| 18334 |
and the section as a whole is intended to apply in other circumstances. |
| 18335 |
|
| 18336 |
It is not the purpose of this section to induce you to infringe any |
| 18337 |
patents or other property right claims or to contest validity of any |
| 18338 |
such claims; this section has the sole purpose of protecting the |
| 18339 |
integrity of the free software distribution system which is |
| 18340 |
implemented by public license practices. Many people have made |
| 18341 |
generous contributions to the wide range of software distributed |
| 18342 |
through that system in reliance on consistent application of that |
| 18343 |
system; it is up to the author/donor to decide if he or she is willing |
| 18344 |
to distribute software through any other system and a licensee cannot |
| 18345 |
impose that choice. |
| 18346 |
|
| 18347 |
This section is intended to make thoroughly clear what is believed to |
| 18348 |
be a consequence of the rest of this License. |
| 18349 |
|
| 18350 |
12. If the distribution and/or use of the Library is restricted in |
| 18351 |
certain countries either by patents or by copyrighted interfaces, the |
| 18352 |
original copyright holder who places the Library under this License may add |
| 18353 |
an explicit geographical distribution limitation excluding those countries, |
| 18354 |
so that distribution is permitted only in or among countries not thus |
| 18355 |
excluded. In such case, this License incorporates the limitation as if |
| 18356 |
written in the body of this License. |
| 18357 |
|
| 18358 |
13. The Free Software Foundation may publish revised and/or new |
| 18359 |
versions of the Lesser General Public License from time to time. |
| 18360 |
Such new versions will be similar in spirit to the present version, |
| 18361 |
but may differ in detail to address new problems or concerns. |
| 18362 |
|
| 18363 |
Each version is given a distinguishing version number. If the Library |
| 18364 |
specifies a version number of this License which applies to it and |
| 18365 |
"any later version", you have the option of following the terms and |
| 18366 |
conditions either of that version or of any later version published by |
| 18367 |
the Free Software Foundation. If the Library does not specify a |
| 18368 |
license version number, you may choose any version ever published by |
| 18369 |
the Free Software Foundation. |
| 18370 |
</pre></td></tr></table> |
| 18371 |
|
| 18372 |
|
| 18373 |
|
| 18374 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> 14. If you wish to incorporate parts of the Library into other free |
| 18375 |
programs whose distribution conditions are incompatible with these, |
| 18376 |
write to the author to ask for permission. For software which is |
| 18377 |
copyrighted by the Free Software Foundation, write to the Free |
| 18378 |
Software Foundation; we sometimes make exceptions for this. Our |
| 18379 |
decision will be guided by the two goals of preserving the free status |
| 18380 |
of all derivatives of our free software and of promoting the sharing |
| 18381 |
and reuse of software generally. |
| 18382 |
|
| 18383 |
NO WARRANTY |
| 18384 |
|
| 18385 |
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
| 18386 |
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
| 18387 |
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
| 18388 |
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
| 18389 |
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
| 18390 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18391 |
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
| 18392 |
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
| 18393 |
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| 18394 |
|
| 18395 |
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
| 18396 |
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
| 18397 |
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
| 18398 |
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
| 18399 |
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
| 18400 |
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
| 18401 |
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
| 18402 |
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
| 18403 |
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 18404 |
DAMAGES. |
| 18405 |
|
| 18406 |
END OF TERMS AND CONDITIONS |
| 18407 |
</pre></td></tr></table> |
| 18408 |
|
| 18409 |
|
| 18410 |
|
| 18411 |
<table><tr><td> </td><td><pre class="smallexample"><b></b> How to Apply These Terms to Your New Libraries |
| 18412 |
|
| 18413 |
If you develop a new library, and you want it to be of the greatest |
| 18414 |
possible use to the public, we recommend making it free software that |
| 18415 |
everyone can redistribute and change. You can do so by permitting |
| 18416 |
redistribution under these terms (or, alternatively, under the terms of the |
| 18417 |
ordinary General Public License). |
| 18418 |
|
| 18419 |
To apply these terms, attach the following notices to the library. It is |
| 18420 |
safest to attach them to the start of each source file to most effectively |
| 18421 |
convey the exclusion of warranty; and each file should have at least the |
| 18422 |
"copyright" line and a pointer to where the full notice is found. |
| 18423 |
|
| 18424 |
<one line to give the library's name and a brief idea of what it does.> |
| 18425 |
Copyright (C) <year> <name of author> |
| 18426 |
|
| 18427 |
This library is free software; you can redistribute it and/or |
| 18428 |
modify it under the terms of the GNU Lesser General Public |
| 18429 |
License as published by the Free Software Foundation; either |
| 18430 |
version 2.1 of the License, or (at your option) any later version. |
| 18431 |
|
| 18432 |
This library is distributed in the hope that it will be useful, |
| 18433 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18434 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18435 |
Lesser General Public License for more details. |
| 18436 |
|
| 18437 |
You should have received a copy of the GNU Lesser General Public |
| 18438 |
License along with this library; if not, write to the Free Software |
| 18439 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18440 |
|
| 18441 |
Also add information on how to contact you by electronic and paper mail. |
| 18442 |
|
| 18443 |
You should also get your employer (if you work as a programmer) or your |
| 18444 |
school, if any, to sign a "copyright disclaimer" for the library, if |
| 18445 |
necessary. Here is a sample; alter the names: |
| 18446 |
|
| 18447 |
Yoyodyne, Inc., hereby disclaims all copyright interest in the |
| 18448 |
library `Frob' (a library for tweaking knobs) written by James Random Hacker. |
| 18449 |
|
| 18450 |
<signature of Ty Coon>, 1 April 1990 |
| 18451 |
Ty Coon, President of Vice |
| 18452 |
|
| 18453 |
That's all there is to it! |
| 18454 |
</pre></td></tr></table> |
| 18455 |
|
| 18456 |
|
| 18457 |
|
| 18458 |
<a name="General-index"></a><hr size="6"><br/><br/><br/> |
| 18459 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 18460 |
<tr><td valign="middle" align="left"><a href="#Copyright-and-license" title="Previous section in reading order"><img src="button-left.png" border="0" align="middle" width="32"></a></td> |
| 18461 |
<td valign="middle" align="left"> </td> |
| 18462 |
<td valign="middle" align="left"> </td> |
| 18463 |
<td valign="middle" align="left"><a href="#Copyright-and-license" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" align="middle" width="32"></td> |
| 18464 |
<td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up-arrow.png" border="0" align="middle" width="32"></td> |
| 18465 |
<td valign="middle" align="left"> </td> |
| 18466 |
<td valign="middle" align="left"> </td> |
| 18467 |
<td valign="middle" align="left"> </td> |
| 18468 |
<td valign="middle" align="left"> </td> |
| 18469 |
<td valign="middle" align="left"> </td> |
| 18470 |
<td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 18471 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 18472 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 18473 |
</tr></table> |
| 18474 |
<a name="General-index-1"></a> |
| 18475 |
<h1 class="unnumbered">General index</h1> |
| 18476 |
|
| 18477 |
<table><tr><th valign="top">Jump to: </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a> |
| 18478 |
|
| 18479 |
<a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a> |
| 18480 |
|
| 18481 |
<a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a> |
| 18482 |
|
| 18483 |
<a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a> |
| 18484 |
|
| 18485 |
<a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a> |
| 18486 |
|
| 18487 |
<a href="#General-index-1_cp_symbol-6" class="summary-letter"><b><</b></a> |
| 18488 |
|
| 18489 |
<a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a> |
| 18490 |
|
| 18491 |
<a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>></b></a> |
| 18492 |
|
| 18493 |
<a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a> |
| 18494 |
|
| 18495 |
<a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a> |
| 18496 |
|
| 18497 |
<a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a> |
| 18498 |
|
| 18499 |
<a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a> |
| 18500 |
|
| 18501 |
<br> |
| 18502 |
<a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a> |
| 18503 |
|
| 18504 |
<a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a> |
| 18505 |
|
| 18506 |
<a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a> |
| 18507 |
|
| 18508 |
<a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a> |
| 18509 |
|
| 18510 |
<a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a> |
| 18511 |
|
| 18512 |
<a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a> |
| 18513 |
|
| 18514 |
<a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a> |
| 18515 |
|
| 18516 |
<a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a> |
| 18517 |
|
| 18518 |
<a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a> |
| 18519 |
|
| 18520 |
<a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a> |
| 18521 |
|
| 18522 |
<a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a> |
| 18523 |
|
| 18524 |
<a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a> |
| 18525 |
|
| 18526 |
<a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a> |
| 18527 |
|
| 18528 |
<a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a> |
| 18529 |
|
| 18530 |
<a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a> |
| 18531 |
|
| 18532 |
<a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a> |
| 18533 |
|
| 18534 |
<a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a> |
| 18535 |
|
| 18536 |
<a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a> |
| 18537 |
|
| 18538 |
<a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a> |
| 18539 |
|
| 18540 |
<a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a> |
| 18541 |
|
| 18542 |
<a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a> |
| 18543 |
|
| 18544 |
<a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a> |
| 18545 |
|
| 18546 |
</td></tr></table> |
| 18547 |
<table border="0" class="index-cp"> |
| 18548 |
<tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr> |
| 18549 |
<tr><td colspan="3"> <hr></td></tr> |
| 18550 |
<tr><th><a name="General-index-1_cp_symbol-1">#</a></th><td></td><td></td></tr> |
| 18551 |
<tr><td></td><td valign="top"><a href="#index-_0023">#</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 18552 |
<tr><td></td><td valign="top"><a href="#index-_0023_0023">##</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 18553 |
<tr><td colspan="3"> <hr></td></tr> |
| 18554 |
<tr><th><a name="General-index-1_cp_symbol-2">+</a></th><td></td><td></td></tr> |
| 18555 |
<tr><td></td><td valign="top"><a href="#index-_002bz"><code>+z</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18556 |
<tr><td colspan="3"> <hr></td></tr> |
| 18557 |
<tr><th><a name="General-index-1_cp_symbol-3">,</a></th><td></td><td></td></tr> |
| 18558 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028b-expr_0029"><code>,(b <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18559 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028be-expr_0029"><code>,(be <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18560 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028bed-expr_0029"><code>,(bed <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18561 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028c-expr_0029"><code>,(c <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18562 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028e-expr_0029"><code>,(e <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18563 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028ed-expr_0029"><code>,(ed <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18564 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028h-subject_0029"><code>,(h <var>subject</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18565 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028st-expr_0029"><code>,(st <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18566 |
<tr><td></td><td valign="top"><a href="#index-_002c_0028v-expr_0029"><code>,(v <var>expr</var>)</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18567 |
<tr><td></td><td valign="top"><a href="#index-_002c_002b"><code>,+</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18568 |
<tr><td></td><td valign="top"><a href="#index-_002c_002b_002b"><code>,++</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18569 |
<tr><td></td><td valign="top"><a href="#index-_002c_002d"><code>,-</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18570 |
<tr><td></td><td valign="top"><a href="#index-_002c_002d_002d"><code>,--</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18571 |
<tr><td></td><td valign="top"><a href="#index-_002c_003f"><code>,?</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18572 |
<tr><td></td><td valign="top"><a href="#index-_002cb"><code>,b</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18573 |
<tr><td></td><td valign="top"><a href="#index-_002cbe"><code>,be</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18574 |
<tr><td></td><td valign="top"><a href="#index-_002cbed"><code>,bed</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18575 |
<tr><td></td><td valign="top"><a href="#index-_002cc"><code>,c</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18576 |
<tr><td></td><td valign="top"><a href="#index-_002cd"><code>,d</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18577 |
<tr><td></td><td valign="top"><a href="#index-_002ce"><code>,e</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18578 |
<tr><td></td><td valign="top"><a href="#index-_002ced"><code>,ed</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18579 |
<tr><td></td><td valign="top"><a href="#index-_002ch"><code>,h</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18580 |
<tr><td></td><td valign="top"><a href="#index-_002ci"><code>,i</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18581 |
<tr><td></td><td valign="top"><a href="#index-_002cl"><code>,l</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18582 |
<tr><td></td><td valign="top"><a href="#index-_002cN"><code>,<var>N</var></code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18583 |
<tr><td></td><td valign="top"><a href="#index-_002cN_002b"><code>,<var>N</var>+</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18584 |
<tr><td></td><td valign="top"><a href="#index-_002cN_002d"><code>,<var>N</var>-</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18585 |
<tr><td></td><td valign="top"><a href="#index-_002cq"><code>,q</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18586 |
<tr><td></td><td valign="top"><a href="#index-_002cqt"><code>,qt</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18587 |
<tr><td></td><td valign="top"><a href="#index-_002cs"><code>,s</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18588 |
<tr><td></td><td valign="top"><a href="#index-_002cst"><code>,st</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18589 |
<tr><td></td><td valign="top"><a href="#index-_002ct"><code>,t</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18590 |
<tr><td></td><td valign="top"><a href="#index-_002cy"><code>,y</code></a></td><td valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td></tr> |
| 18591 |
<tr><td colspan="3"> <hr></td></tr> |
| 18592 |
<tr><th><a name="General-index-1_cp_symbol-4">-</a></th><td></td><td></td></tr> |
| 18593 |
<tr><td></td><td valign="top"><a href="#index-_002d"><code>-</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18594 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_002b"><code>-:+</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18595 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_002d"><code>-:-</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18596 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_003a"><code>-::</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18597 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_003d"><code>-:=</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18598 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_0040"><code>-:}</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18599 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ad"><code>-:d</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18600 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ad_002d"><code>-:d-</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18601 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ad_0040_005bHOST_005d_005b_003aPORT_005d"><code>-:d@<span class="roman">[</span><var>HOST</var><span class="roman">]</span><span class="roman">[</span>:<var>PORT</var><span class="roman">]</span></code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18602 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ada"><code>-:da</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18603 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adc"><code>-:dc</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18604 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adD"><code>-:dD</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18605 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adi"><code>-:di</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18606 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adLEVEL"><code>-:d<var>LEVEL</var></code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18607 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adp"><code>-:dp</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18608 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adQ"><code>-:dQ</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18609 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adq"><code>-:dq</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18610 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adR"><code>-:dR</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18611 |
<tr><td></td><td valign="top"><a href="#index-_002d_003adr"><code>-:dr</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18612 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ads"><code>-:ds</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18613 |
<tr><td></td><td valign="top"><a href="#index-_002d_003af"><code>-:f</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18614 |
<tr><td></td><td valign="top"><a href="#index-_002d_003ah"><code>-:h</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18615 |
<tr><td></td><td valign="top"><a href="#index-_002d_003al"><code>-:l</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18616 |
<tr><td></td><td valign="top"><a href="#index-_002d_003am"><code>-:m</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18617 |
<tr><td></td><td valign="top"><a href="#index-_002d_003aS"><code>-:S</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18618 |
<tr><td></td><td valign="top"><a href="#index-_002d_003as"><code>-:s</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18619 |
<tr><td></td><td valign="top"><a href="#index-_002d_003as-1"><code>-:s</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18620 |
<tr><td></td><td valign="top"><a href="#index-_002d_003at"><code>-:t</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18621 |
<tr><td></td><td valign="top"><a href="#index-_002d_003a_007e_007e"><code>-:~~</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18622 |
<tr><td></td><td valign="top"><a href="#index-_002dc"><code>-c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18623 |
<tr><td></td><td valign="top"><a href="#index-_002dcall_005fshared"><code>-call_shared</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18624 |
<tr><td></td><td valign="top"><a href="#index-_002dcc_002doptions"><code>-cc-options</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18625 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug"><code>-debug</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18626 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug-1"><code>-debug</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18627 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002denvironments"><code>-debug-environments</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18628 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002denvironments-1"><code>-debug-environments</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18629 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dlocation"><code>-debug-location</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18630 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dlocation-1"><code>-debug-location</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18631 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dsource"><code>-debug-source</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18632 |
<tr><td></td><td valign="top"><a href="#index-_002ddebug_002dsource-1"><code>-debug-source</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18633 |
<tr><td></td><td valign="top"><a href="#index-_002ddynamic"><code>-dynamic</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18634 |
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fDYNAMIC"><code>-D___DYNAMIC</code></a></td><td valign="top"><a href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></td></tr> |
| 18635 |
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fLIBRARY"><code>-D___LIBRARY</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr> |
| 18636 |
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fPRIMAL"><code>-D___PRIMAL</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr> |
| 18637 |
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fSHARED"><code>-D___SHARED</code></a></td><td valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td></tr> |
| 18638 |
<tr><td></td><td valign="top"><a href="#index-_002dD_005f_005f_005fSINGLE_005fHOST"><code>-D___SINGLE_HOST</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18639 |
<tr><td></td><td valign="top"><a href="#index-_002de"><code>-e</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18640 |
<tr><td></td><td valign="top"><a href="#index-_002dexe"><code>-exe</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18641 |
<tr><td></td><td valign="top"><a href="#index-_002dexe-1"><code>-exe</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18642 |
<tr><td></td><td valign="top"><a href="#index-_002dexpansion"><code>-expansion</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18643 |
<tr><td></td><td valign="top"><a href="#index-_002dflat"><code>-flat</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18644 |
<tr><td></td><td valign="top"><a href="#index-_002dfPIC"><code>-fPIC</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18645 |
<tr><td></td><td valign="top"><a href="#index-_002dfpic"><code>-fpic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18646 |
<tr><td></td><td valign="top"><a href="#index-_002dG"><code>-G</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18647 |
<tr><td></td><td valign="top"><a href="#index-_002dgvm"><code>-gvm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18648 |
<tr><td></td><td valign="top"><a href="#index-_002di"><code>-i</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18649 |
<tr><td></td><td valign="top"><a href="#index-_002dI_002fusr_002flocal_002fGambit_002dC_002finclude"><code>-I/usr/local/Gambit-C/include</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18650 |
<tr><td></td><td valign="top"><a href="#index-_002dkeep_002dc"><code>-keep-c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18651 |
<tr><td></td><td valign="top"><a href="#index-_002dKPIC"><code>-KPIC</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18652 |
<tr><td></td><td valign="top"><a href="#index-_002dKpic"><code>-Kpic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18653 |
<tr><td></td><td valign="top"><a href="#index-_002dl-base"><code>-l <var>base</var></code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18654 |
<tr><td></td><td valign="top"><a href="#index-_002dL_002fusr_002flocal_002fGambit_002dC_002flib"><code>-L/usr/local/Gambit-C/lib</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18655 |
<tr><td></td><td valign="top"><a href="#index-_002dld_002doptions"><code>-ld-options</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18656 |
<tr><td></td><td valign="top"><a href="#index-_002dld_002doptions_002dprelude"><code>-ld-options-prelude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18657 |
<tr><td></td><td valign="top"><a href="#index-_002dlink"><code>-link</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18658 |
<tr><td></td><td valign="top"><a href="#index-_002dlink-1"><code>-link</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18659 |
<tr><td></td><td valign="top"><a href="#index-_002dO"><code>-O</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18660 |
<tr><td></td><td valign="top"><a href="#index-_002do-output"><code>-o <var>output</var></code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18661 |
<tr><td></td><td valign="top"><a href="#index-_002dobj"><code>-obj</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18662 |
<tr><td></td><td valign="top"><a href="#index-_002dpic"><code>-pic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18663 |
<tr><td></td><td valign="top"><a href="#index-_002dpostlude"><code>-postlude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18664 |
<tr><td></td><td valign="top"><a href="#index-_002dprelude"><code>-prelude</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18665 |
<tr><td></td><td valign="top"><a href="#index-_002drdynamic"><code>-rdynamic</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18666 |
<tr><td></td><td valign="top"><a href="#index-_002dreport"><code>-report</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18667 |
<tr><td></td><td valign="top"><a href="#index-_002dshared"><code>-shared</code></a></td><td valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td></tr> |
| 18668 |
<tr><td></td><td valign="top"><a href="#index-_002dtrack_002dscheme"><code>-track-scheme</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18669 |
<tr><td></td><td valign="top"><a href="#index-_002dverbose"><code>-verbose</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18670 |
<tr><td></td><td valign="top"><a href="#index-_002dwarnings"><code>-warnings</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18671 |
<tr><td colspan="3"> <hr></td></tr> |
| 18672 |
<tr><th><a name="General-index-1_cp_symbol-5">.</a></th><td></td><td></td></tr> |
| 18673 |
<tr><td></td><td valign="top"><a href="#index-_002ec"><code>.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18674 |
<tr><td></td><td valign="top"><a href="#index-_002escm"><code>.scm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18675 |
<tr><td></td><td valign="top"><a href="#index-_002esix"><code>.six</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18676 |
<tr><td colspan="3"> <hr></td></tr> |
| 18677 |
<tr><th><a name="General-index-1_cp_symbol-6"><</a></th><td></td><td></td></tr> |
| 18678 |
<tr><td></td><td valign="top"><a href="#index-_003c"><code><</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr> |
| 18679 |
<tr><td></td><td valign="top"><a href="#index-_003c_003d"><code><=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr> |
| 18680 |
<tr><td colspan="3"> <hr></td></tr> |
| 18681 |
<tr><th><a name="General-index-1_cp_symbol-7">=</a></th><td></td><td></td></tr> |
| 18682 |
<tr><td></td><td valign="top"><a href="#index-_003d"><code>=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr> |
| 18683 |
<tr><td colspan="3"> <hr></td></tr> |
| 18684 |
<tr><th><a name="General-index-1_cp_symbol-8">></a></th><td></td><td></td></tr> |
| 18685 |
<tr><td></td><td valign="top"><a href="#index-_003e"><code>></code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr> |
| 18686 |
<tr><td></td><td valign="top"><a href="#index-_003e_003d"><code>>=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr> |
| 18687 |
<tr><td colspan="3"> <hr></td></tr> |
| 18688 |
<tr><th><a name="General-index-1_cp_symbol-9">^</a></th><td></td><td></td></tr> |
| 18689 |
<tr><td></td><td valign="top"><a href="#index-_005eC"><code>^C</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 18690 |
<tr><td></td><td valign="top"><a href="#index-_005eC-1"><code>^C</code></a></td><td valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td></tr> |
| 18691 |
<tr><td></td><td valign="top"><a href="#index-_005eD"><code>^D</code></a></td><td valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td></tr> |
| 18692 |
<tr><td colspan="3"> <hr></td></tr> |
| 18693 |
<tr><th><a name="General-index-1_cp_symbol-10">_</a></th><td></td><td></td></tr> |
| 18694 |
<tr><td></td><td valign="top"><a href="#index-_005f_005f_005fcleanup"><code>___cleanup</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr> |
| 18695 |
<tr><td></td><td valign="top"><a href="#index-_005f_005f_005fsetup"><code>___setup</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr> |
| 18696 |
<tr><td colspan="3"> <hr></td></tr> |
| 18697 |
<tr><th><a name="General-index-1_cp_symbol-11">|</a></th><td></td><td></td></tr> |
| 18698 |
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex"><code>|six.x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18699 |
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007c_003dy_007c"><code>|six.x\|=y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18700 |
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007cy_007c"><code>|six.x\|y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18701 |
<tr><td></td><td valign="top"><a href="#index-_007csix_002ex_005c_007c_005c_007cy_007c"><code>|six.x\|\|y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18702 |
<tr><td colspan="3"> <hr></td></tr> |
| 18703 |
<tr><th><a name="General-index-1_cp_symbol-12">~</a></th><td></td><td></td></tr> |
| 18704 |
<tr><td></td><td valign="top"><a href="#index-_007e">~</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18705 |
<tr><td></td><td valign="top"><a href="#index-_007eusername">~username</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18706 |
<tr><td></td><td valign="top"><a href="#index-_007e_007e">~~</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18707 |
<tr><td colspan="3"> <hr></td></tr> |
| 18708 |
<tr><th><a name="General-index-1_cp_letter-A">A</a></th><td></td><td></td></tr> |
| 18709 |
<tr><td></td><td valign="top"><a href="#index-abandoned_002dmutex_002dexception_003f"><code>abandoned-mutex-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 18710 |
<tr><td></td><td valign="top"><a href="#index-abort"><code>abort</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 18711 |
<tr><td></td><td valign="top"><a href="#index-absolute-path">absolute path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18712 |
<tr><td></td><td valign="top"><a href="#index-absolute-path-1">absolute path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18713 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dfamily"><code>address-info-family</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18714 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dprotocol"><code>address-info-protocol</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18715 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dsocket_002dinfo"><code>address-info-socket-info</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18716 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_002dsocket_002dtype"><code>address-info-socket-type</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18717 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfo_003f"><code>address-info?</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18718 |
<tr><td></td><td valign="top"><a href="#index-address_002dinfos"><code>address-infos</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 18719 |
<tr><td></td><td valign="top"><a href="#index-all_002dbits_002dset_003f"><code>all-bits-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18720 |
<tr><td></td><td valign="top"><a href="#index-any_002dbits_002dset_003f"><code>any-bits-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18721 |
<tr><td></td><td valign="top"><a href="#index-append_002df32vectors"><code>append-f32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18722 |
<tr><td></td><td valign="top"><a href="#index-append_002df64vectors"><code>append-f64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18723 |
<tr><td></td><td valign="top"><a href="#index-append_002ds16vectors"><code>append-s16vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18724 |
<tr><td></td><td valign="top"><a href="#index-append_002ds32vectors"><code>append-s32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18725 |
<tr><td></td><td valign="top"><a href="#index-append_002ds64vectors"><code>append-s64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18726 |
<tr><td></td><td valign="top"><a href="#index-append_002ds8vectors"><code>append-s8vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18727 |
<tr><td></td><td valign="top"><a href="#index-append_002dstrings"><code>string-concatenate</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18728 |
<tr><td></td><td valign="top"><a href="#index-append_002du16vectors"><code>append-u16vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18729 |
<tr><td></td><td valign="top"><a href="#index-append_002du32vectors"><code>append-u32vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18730 |
<tr><td></td><td valign="top"><a href="#index-append_002du64vectors"><code>append-u64vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18731 |
<tr><td></td><td valign="top"><a href="#index-append_002du8vectors"><code>append-u8vectors</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18732 |
<tr><td></td><td valign="top"><a href="#index-append_002dvectors"><code>vector-concatenate</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18733 |
<tr><td></td><td valign="top"><a href="#index-arithmetic_002dshift"><code>arithmetic-shift</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18734 |
<tr><td colspan="3"> <hr></td></tr> |
| 18735 |
<tr><th><a name="General-index-1_cp_letter-B">B</a></th><td></td><td></td></tr> |
| 18736 |
<tr><td></td><td valign="top"><a href="#index-bit_002dcount"><code>bit-count</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18737 |
<tr><td></td><td valign="top"><a href="#index-bit_002dset_003f"><code>bit-set?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18738 |
<tr><td></td><td valign="top"><a href="#index-bitwise_002dand"><code>bitwise-and</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18739 |
<tr><td></td><td valign="top"><a href="#index-bitwise_002dior"><code>bitwise-ior</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18740 |
<tr><td></td><td valign="top"><a href="#index-bitwise_002dmerge"><code>bitwise-merge</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18741 |
<tr><td></td><td valign="top"><a href="#index-bitwise_002dnot"><code>bitwise-not</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18742 |
<tr><td></td><td valign="top"><a href="#index-bitwise_002dxor"><code>bitwise-xor</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18743 |
<tr><td></td><td valign="top"><a href="#index-block"><code>block</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18744 |
<tr><td></td><td valign="top"><a href="#index-box"><code>box</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18745 |
<tr><td></td><td valign="top"><a href="#index-box_003f"><code>box?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18746 |
<tr><td></td><td valign="top"><a href="#index-boxes">boxes</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18747 |
<tr><td></td><td valign="top"><a href="#index-break"><code>break</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 18748 |
<tr><td colspan="3"> <hr></td></tr> |
| 18749 |
<tr><th><a name="General-index-1_cp_letter-C">C</a></th><td></td><td></td></tr> |
| 18750 |
<tr><td></td><td valign="top"><a href="#index-c_002ddeclare"><code>c-declare</code></a></td><td valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td></tr> |
| 18751 |
<tr><td></td><td valign="top"><a href="#index-c_002ddeclare-1"><code>c-declare</code></a></td><td valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td></tr> |
| 18752 |
<tr><td></td><td valign="top"><a href="#index-c_002ddefine"><code>c-define</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr> |
| 18753 |
<tr><td></td><td valign="top"><a href="#index-c_002ddefine-1"><code>c-define</code></a></td><td valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td></tr> |
| 18754 |
<tr><td></td><td valign="top"><a href="#index-c_002ddefine_002dtype"><code>c-define-type</code></a></td><td valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td></tr> |
| 18755 |
<tr><td></td><td valign="top"><a href="#index-c_002ddefine_002dtype-1"><code>c-define-type</code></a></td><td valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td></tr> |
| 18756 |
<tr><td></td><td valign="top"><a href="#index-c_002dinitialize"><code>c-initialize</code></a></td><td valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td></tr> |
| 18757 |
<tr><td></td><td valign="top"><a href="#index-c_002dinitialize-1"><code>c-initialize</code></a></td><td valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td></tr> |
| 18758 |
<tr><td></td><td valign="top"><a href="#index-c_002dlambda"><code>c-lambda</code></a></td><td valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td></tr> |
| 18759 |
<tr><td></td><td valign="top"><a href="#index-c_002dlambda-1"><code>c-lambda</code></a></td><td valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td></tr> |
| 18760 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dcurrent_002dcontinuation"><code>call-with-current-continuation</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr> |
| 18761 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dfile"><code>call-with-input-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 18762 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dprocess"><code>call-with-input-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 18763 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dstring"><code>call-with-input-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 18764 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002du8vector"><code>call-with-input-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 18765 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002dinput_002dvector"><code>call-with-input-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 18766 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dfile"><code>call-with-output-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 18767 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dprocess"><code>call-with-output-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 18768 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dstring"><code>call-with-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 18769 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002du8vector"><code>call-with-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 18770 |
<tr><td></td><td valign="top"><a href="#index-call_002dwith_002doutput_002dvector"><code>call-with-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 18771 |
<tr><td></td><td valign="top"><a href="#index-call_002fcc"><code>call/cc</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr> |
| 18772 |
<tr><td></td><td valign="top"><a href="#index-central-installation-directory">central installation directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18773 |
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002darguments"><code>cfun-conversion-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 18774 |
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dcode"><code>cfun-conversion-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 18775 |
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dmessage"><code>cfun-conversion-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 18776 |
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_002dprocedure"><code>cfun-conversion-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 18777 |
<tr><td></td><td valign="top"><a href="#index-cfun_002dconversion_002dexception_003f"><code>cfun-conversion-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 18778 |
<tr><td></td><td valign="top"><a href="#index-char_002d_003einteger"><code>char->integer</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18779 |
<tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003d_003f"><code>char-ci<=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18780 |
<tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003f"><code>char-ci<?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18781 |
<tr><td></td><td valign="top"><a href="#index-char_002dci_003d_003f"><code>char-ci=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18782 |
<tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003d_003f"><code>char-ci>=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18783 |
<tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003f"><code>char-ci>?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18784 |
<tr><td></td><td valign="top"><a href="#index-char_003c_003d_003f"><code>char<=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18785 |
<tr><td></td><td valign="top"><a href="#index-char_003c_003f"><code>char<?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18786 |
<tr><td></td><td valign="top"><a href="#index-char_003d_003f"><code>char=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18787 |
<tr><td></td><td valign="top"><a href="#index-char_003e_003d_003f"><code>char>=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18788 |
<tr><td></td><td valign="top"><a href="#index-char_003e_003f"><code>char>?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 18789 |
<tr><td></td><td valign="top"><a href="#index-clear_002dbit_002dfield"><code>clear-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18790 |
<tr><td></td><td valign="top"><a href="#index-close_002dinput_002dport"><code>close-input-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 18791 |
<tr><td></td><td valign="top"><a href="#index-close_002doutput_002dport"><code>close-output-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 18792 |
<tr><td></td><td valign="top"><a href="#index-close_002dport"><code>close-port</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 18793 |
<tr><td></td><td valign="top"><a href="#index-command_002dline"><code>command-line</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 18794 |
<tr><td></td><td valign="top"><a href="#index-command_002dline-1"><code>command-line</code></a></td><td valign="top"><a href="#Command-line-arguments">16.5 Command line arguments</a></td></tr> |
| 18795 |
<tr><td></td><td valign="top"><a href="#index-compile_002dfile"><code>compile-file</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 18796 |
<tr><td></td><td valign="top"><a href="#index-compile_002dfile_002dto_002dtarget"><code>compile-file-to-target</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 18797 |
<tr><td></td><td valign="top"><a href="#index-compiler">compiler</a></td><td valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td></tr> |
| 18798 |
<tr><td></td><td valign="top"><a href="#index-compiler-options">compiler options</a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18799 |
<tr><td></td><td valign="top"><a href="#index-cond_002dexpand"><code>cond-expand</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18800 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dbroadcast_0021"><code>condition-variable-broadcast!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18801 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dname"><code>condition-variable-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18802 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dsignal_0021"><code>condition-variable-signal!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18803 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dspecific"><code>condition-variable-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18804 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_002dspecific_002dset_0021"><code>condition-variable-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18805 |
<tr><td></td><td valign="top"><a href="#index-condition_002dvariable_003f"><code>condition-variable?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18806 |
<tr><td></td><td valign="top"><a href="#index-configure_002dcommand_002dstring"><code>configure-command-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18807 |
<tr><td></td><td valign="top"><a href="#index-console_002dport"><code>console-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18808 |
<tr><td></td><td valign="top"><a href="#index-constant_002dfold"><code>constant-fold</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18809 |
<tr><td></td><td valign="top"><a href="#index-continuation_002dcapture"><code>continuation-capture</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18810 |
<tr><td></td><td valign="top"><a href="#index-continuation_002dgraft"><code>continuation-graft</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18811 |
<tr><td></td><td valign="top"><a href="#index-continuation_002dreturn"><code>continuation-return</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18812 |
<tr><td></td><td valign="top"><a href="#index-continuation_003f"><code>continuation?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18813 |
<tr><td></td><td valign="top"><a href="#index-continuations">continuations</a></td><td valign="top"><a href="#continuations">19.7 Continuations and the C-interface</a></td></tr> |
| 18814 |
<tr><td></td><td valign="top"><a href="#index-copy_002dbit_002dfield"><code>copy-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18815 |
<tr><td></td><td valign="top"><a href="#index-copy_002dfile"><code>copy-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18816 |
<tr><td></td><td valign="top"><a href="#index-cpu_002dtime"><code>cpu-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 18817 |
<tr><td></td><td valign="top"><a href="#index-create_002ddirectory"><code>create-directory</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18818 |
<tr><td></td><td valign="top"><a href="#index-create_002dfifo"><code>create-fifo</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18819 |
<tr><td></td><td valign="top"><a href="#index-create_002dlink"><code>create-link</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18820 |
<tr><td></td><td valign="top"><a href="#index-create_002dsymbolic_002dlink"><code>create-symbolic-link</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18821 |
<tr><td></td><td valign="top"><a href="#index-current-exception_002dhandler">current exception-handler</a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 18822 |
<tr><td></td><td valign="top"><a href="#index-current-working-directory">current working directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18823 |
<tr><td></td><td valign="top"><a href="#index-current-working-directory-1">current working directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18824 |
<tr><td></td><td valign="top"><a href="#index-current_002ddirectory"><code>current-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18825 |
<tr><td></td><td valign="top"><a href="#index-current_002derror_002dport"><code>current-error-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 18826 |
<tr><td></td><td valign="top"><a href="#index-current_002dexception_002dhandler"><code>current-exception-handler</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 18827 |
<tr><td></td><td valign="top"><a href="#index-current_002dinput_002dport"><code>current-input-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 18828 |
<tr><td></td><td valign="top"><a href="#index-current_002doutput_002dport"><code>current-output-port</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 18829 |
<tr><td></td><td valign="top"><a href="#index-current_002dreadtable"><code>current-readtable</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 18830 |
<tr><td></td><td valign="top"><a href="#index-current_002dthread"><code>current-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 18831 |
<tr><td></td><td valign="top"><a href="#index-current_002dtime"><code>current-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 18832 |
<tr><td></td><td valign="top"><a href="#index-current_002duser_002dinterrupt_002dhandler"><code>current-user-interrupt-handler</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18833 |
<tr><td colspan="3"> <hr></td></tr> |
| 18834 |
<tr><th><a name="General-index-1_cp_letter-D">D</a></th><td></td><td></td></tr> |
| 18835 |
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dkind"><code>datum-parsing-exception-kind</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr> |
| 18836 |
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dparameters"><code>datum-parsing-exception-parameters</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr> |
| 18837 |
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_002dreadenv"><code>datum-parsing-exception-readenv</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr> |
| 18838 |
<tr><td></td><td valign="top"><a href="#index-datum_002dparsing_002dexception_003f"><code>datum-parsing-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></td></tr> |
| 18839 |
<tr><td></td><td valign="top"><a href="#index-deadlock_002dexception_003f"><code>deadlock-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 18840 |
<tr><td></td><td valign="top"><a href="#index-debug"><code>debug</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18841 |
<tr><td></td><td valign="top"><a href="#index-debug-1"><code>debug</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18842 |
<tr><td></td><td valign="top"><a href="#index-debug_002denvironments"><code>debug-environments</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18843 |
<tr><td></td><td valign="top"><a href="#index-debug_002denvironments-1"><code>debug-environments</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18844 |
<tr><td></td><td valign="top"><a href="#index-debug_002dlocation"><code>debug-location</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18845 |
<tr><td></td><td valign="top"><a href="#index-debug_002dlocation-1"><code>debug-location</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18846 |
<tr><td></td><td valign="top"><a href="#index-debug_002dsource"><code>debug-source</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18847 |
<tr><td></td><td valign="top"><a href="#index-debug_002dsource-1"><code>debug-source</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18848 |
<tr><td></td><td valign="top"><a href="#index-declare"><code>declare</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18849 |
<tr><td></td><td valign="top"><a href="#index-default_002drandom_002dsource"><code>default-random-source</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 18850 |
<tr><td></td><td valign="top"><a href="#index-defer_002duser_002dinterrupts"><code>defer-user-interrupts</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18851 |
<tr><td></td><td valign="top"><a href="#index-define"><code>define</code></a></td><td valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td></tr> |
| 18852 |
<tr><td></td><td valign="top"><a href="#index-define-1"><code>define</code></a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr> |
| 18853 |
<tr><td></td><td valign="top"><a href="#index-define_002dcond_002dexpand_002dfeature"><code>define-cond-expand-feature</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18854 |
<tr><td></td><td valign="top"><a href="#index-define_002dmacro"><code>define-macro</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18855 |
<tr><td></td><td valign="top"><a href="#index-define_002drecord_002dtype"><code>define-record-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18856 |
<tr><td></td><td valign="top"><a href="#index-define_002dstructure"><code>define-structure</code></a></td><td valign="top"><a href="#Records">12. Records</a></td></tr> |
| 18857 |
<tr><td></td><td valign="top"><a href="#index-define_002dsyntax"><code>define-syntax</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18858 |
<tr><td></td><td valign="top"><a href="#index-define_002dsyntax-1"><code>define-syntax</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18859 |
<tr><td></td><td valign="top"><a href="#index-define_002dtype"><code>define-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18860 |
<tr><td></td><td valign="top"><a href="#index-define_002dtype_002dof_002dthread"><code>define-type-of-thread</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18861 |
<tr><td></td><td valign="top"><a href="#index-delete_002ddirectory"><code>delete-directory</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18862 |
<tr><td></td><td valign="top"><a href="#index-delete_002dfile"><code>delete-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18863 |
<tr><td></td><td valign="top"><a href="#index-deserialization">deserialization</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18864 |
<tr><td></td><td valign="top"><a href="#index-deserialization-1">deserialization</a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 18865 |
<tr><td></td><td valign="top"><a href="#index-directory_002dfiles"><code>directory-files</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 18866 |
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002dbacktrace"><code>display-continuation-backtrace</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18867 |
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002ddynamic_002denvironment"><code>display-continuation-dynamic-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18868 |
<tr><td></td><td valign="top"><a href="#index-display_002dcontinuation_002denvironment"><code>display-continuation-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18869 |
<tr><td></td><td valign="top"><a href="#index-display_002ddynamic_002denvironment_003f"><code>display-dynamic-environment?</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 18870 |
<tr><td></td><td valign="top"><a href="#index-display_002denvironment_002dset_0021"><code>display-environment-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 18871 |
<tr><td></td><td valign="top"><a href="#index-display_002dexception"><code>display-exception</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18872 |
<tr><td></td><td valign="top"><a href="#index-display_002dexception_002din_002dcontext"><code>display-exception-in-context</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18873 |
<tr><td></td><td valign="top"><a href="#index-display_002dprocedure_002denvironment"><code>display-procedure-environment</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18874 |
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_002darguments"><code>divide-by-zero-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 18875 |
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_002dprocedure"><code>divide-by-zero-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 18876 |
<tr><td></td><td valign="top"><a href="#index-divide_002dby_002dzero_002dexception_003f"><code>divide-by-zero-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 18877 |
<tr><td colspan="3"> <hr></td></tr> |
| 18878 |
<tr><th><a name="General-index-1_cp_letter-E">E</a></th><td></td><td></td></tr> |
| 18879 |
<tr><td></td><td valign="top"><a href="#index-Emacs">Emacs</a></td><td valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td></tr> |
| 18880 |
<tr><td></td><td valign="top"><a href="#index-eq_003f_002dhash"><code>eq?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 18881 |
<tr><td></td><td valign="top"><a href="#index-equal_003f_002dhash"><code>equal?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 18882 |
<tr><td></td><td valign="top"><a href="#index-eqv_003f_002dhash"><code>eqv?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 18883 |
<tr><td></td><td valign="top"><a href="#index-err_002dcode_002d_003estring"><code>err-code->string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18884 |
<tr><td></td><td valign="top"><a href="#index-error"><code>error</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr> |
| 18885 |
<tr><td></td><td valign="top"><a href="#index-error_002dexception_002dmessage"><code>error-exception-message</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr> |
| 18886 |
<tr><td></td><td valign="top"><a href="#index-error_002dexception_002dparameters"><code>error-exception-parameters</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr> |
| 18887 |
<tr><td></td><td valign="top"><a href="#index-error_002dexception_003f"><code>error-exception?</code></a></td><td valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td></tr> |
| 18888 |
<tr><td></td><td valign="top"><a href="#index-eval"><code>eval</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18889 |
<tr><td></td><td valign="top"><a href="#index-exit"><code>exit</code></a></td><td valign="top"><a href="#Process-termination">16.4 Process termination</a></td></tr> |
| 18890 |
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dkind"><code>expression-parsing-exception-kind</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 18891 |
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dparameters"><code>expression-parsing-exception-parameters</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 18892 |
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_002dsource"><code>expression-parsing-exception-source</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 18893 |
<tr><td></td><td valign="top"><a href="#index-expression_002dparsing_002dexception_003f"><code>expression-parsing-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 18894 |
<tr><td></td><td valign="top"><a href="#index-extended_002dbindings"><code>extended-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18895 |
<tr><td></td><td valign="top"><a href="#index-extract_002dbit_002dfield"><code>extract-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18896 |
<tr><td colspan="3"> <hr></td></tr> |
| 18897 |
<tr><th><a name="General-index-1_cp_letter-F">F</a></th><td></td><td></td></tr> |
| 18898 |
<tr><td></td><td valign="top"><a href="#index-f32vector"><code>f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18899 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002d_003elist"><code>f32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18900 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dappend"><code>f32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18901 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dcopy"><code>f32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18902 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dfill_0021"><code>f32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18903 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dlength"><code>f32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18904 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dref"><code>f32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18905 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dset_0021"><code>f32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18906 |
<tr><td></td><td valign="top"><a href="#index-f32vector_002dshrink_0021"><code>f32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18907 |
<tr><td></td><td valign="top"><a href="#index-f32vector_003f"><code>f32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18908 |
<tr><td></td><td valign="top"><a href="#index-f64vector"><code>f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18909 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002d_003elist"><code>f64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18910 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dappend"><code>f64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18911 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dcopy"><code>f64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18912 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dfill_0021"><code>f64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18913 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dlength"><code>f64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18914 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dref"><code>f64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18915 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dset_0021"><code>f64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18916 |
<tr><td></td><td valign="top"><a href="#index-f64vector_002dshrink_0021"><code>f64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18917 |
<tr><td></td><td valign="top"><a href="#index-f64vector_003f"><code>f64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 18918 |
<tr><td></td><td valign="top"><a href="#index-FFI">FFI</a></td><td valign="top"><a href="#C_002dinterface">19. C-interface</a></td></tr> |
| 18919 |
<tr><td></td><td valign="top"><a href="#index-file-names">file names</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 18920 |
<tr><td></td><td valign="top"><a href="#index-file_002dattributes"><code>file-attributes</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18921 |
<tr><td></td><td valign="top"><a href="#index-file_002dcreation_002dtime"><code>file-creation-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18922 |
<tr><td></td><td valign="top"><a href="#index-file_002ddevice"><code>file-device</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18923 |
<tr><td></td><td valign="top"><a href="#index-file_002dexists_003f"><code>file-exists?</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18924 |
<tr><td></td><td valign="top"><a href="#index-file_002dgroup"><code>file-group</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18925 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo"><code>file-info</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18926 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dattributes"><code>file-info-attributes</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18927 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dcreation_002dtime"><code>file-info-creation-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18928 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002ddevice"><code>file-info-device</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18929 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dgroup"><code>file-info-group</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18930 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dinode"><code>file-info-inode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18931 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002daccess_002dtime"><code>file-info-last-access-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18932 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002dchange_002dtime"><code>file-info-last-change-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18933 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dlast_002dmodification_002dtime"><code>file-info-last-modification-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18934 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dmode"><code>file-info-mode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18935 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dnumber_002dof_002dlinks"><code>file-info-number-of-links</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18936 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002downer"><code>file-info-owner</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18937 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dsize"><code>file-info-size</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18938 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_002dtype"><code>file-info-type</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18939 |
<tr><td></td><td valign="top"><a href="#index-file_002dinfo_003f"><code>file-info?</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18940 |
<tr><td></td><td valign="top"><a href="#index-file_002dinode"><code>file-inode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18941 |
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002daccess_002dtime"><code>file-last-access-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18942 |
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002dchange_002dtime"><code>file-last-change-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18943 |
<tr><td></td><td valign="top"><a href="#index-file_002dlast_002dmodification_002dtime"><code>file-last-modification-time</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18944 |
<tr><td></td><td valign="top"><a href="#index-file_002dmode"><code>file-mode</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18945 |
<tr><td></td><td valign="top"><a href="#index-file_002dnumber_002dof_002dlinks"><code>file-number-of-links</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18946 |
<tr><td></td><td valign="top"><a href="#index-file_002downer"><code>file-owner</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18947 |
<tr><td></td><td valign="top"><a href="#index-file_002dsize"><code>file-size</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18948 |
<tr><td></td><td valign="top"><a href="#index-file_002dtype"><code>file-type</code></a></td><td valign="top"><a href="#File-information">16.8 File information</a></td></tr> |
| 18949 |
<tr><td></td><td valign="top"><a href="#index-file_002ec"><code><var>file</var>.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18950 |
<tr><td></td><td valign="top"><a href="#index-file_002escm"><code><var>file</var>.scm</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18951 |
<tr><td></td><td valign="top"><a href="#index-file_002esix"><code><var>file</var>.six</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 18952 |
<tr><td></td><td valign="top"><a href="#index-finite_003f"><code>finite?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 18953 |
<tr><td></td><td valign="top"><a href="#index-first_002dset_002dbit"><code>first-set-bit</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 18954 |
<tr><td></td><td valign="top"><a href="#index-fixnum"><code>fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18955 |
<tr><td></td><td valign="top"><a href="#index-fixnum_002d_003eflonum"><code>fixnum->flonum</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18956 |
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_002darguments"><code>fixnum-overflow-exception-arguments</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 18957 |
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_002dprocedure"><code>fixnum-overflow-exception-procedure</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 18958 |
<tr><td></td><td valign="top"><a href="#index-fixnum_002doverflow_002dexception_003f"><code>fixnum-overflow-exception?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 18959 |
<tr><td></td><td valign="top"><a href="#index-fixnum_003f"><code>fixnum?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 18960 |
<tr><td></td><td valign="top"><a href="#index-fl_002a"><code>fl*</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18961 |
<tr><td></td><td valign="top"><a href="#index-fl_002b"><code>fl+</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18962 |
<tr><td></td><td valign="top"><a href="#index-fl_002d"><code>fl-</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18963 |
<tr><td></td><td valign="top"><a href="#index-fl_002f"><code>fl/</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18964 |
<tr><td></td><td valign="top"><a href="#index-fl_003c"><code>fl<</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18965 |
<tr><td></td><td valign="top"><a href="#index-fl_003c_003d"><code>fl<=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18966 |
<tr><td></td><td valign="top"><a href="#index-fl_003d"><code>fl=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18967 |
<tr><td></td><td valign="top"><a href="#index-fl_003e"><code>fl></code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18968 |
<tr><td></td><td valign="top"><a href="#index-fl_003e_003d"><code>fl>=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18969 |
<tr><td></td><td valign="top"><a href="#index-flabs"><code>flabs</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18970 |
<tr><td></td><td valign="top"><a href="#index-flacos"><code>flacos</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18971 |
<tr><td></td><td valign="top"><a href="#index-flasin"><code>flasin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18972 |
<tr><td></td><td valign="top"><a href="#index-flatan"><code>flatan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18973 |
<tr><td></td><td valign="top"><a href="#index-flatan-1"><code>flatan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18974 |
<tr><td></td><td valign="top"><a href="#index-flceiling"><code>flceiling</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18975 |
<tr><td></td><td valign="top"><a href="#index-flcos"><code>flcos</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18976 |
<tr><td></td><td valign="top"><a href="#index-fldenominator"><code>fldenominator</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18977 |
<tr><td></td><td valign="top"><a href="#index-fleven_003f"><code>fleven?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18978 |
<tr><td></td><td valign="top"><a href="#index-flexp"><code>flexp</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18979 |
<tr><td></td><td valign="top"><a href="#index-flexpt"><code>flexpt</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18980 |
<tr><td></td><td valign="top"><a href="#index-flfinite_003f"><code>flfinite?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18981 |
<tr><td></td><td valign="top"><a href="#index-flfloor"><code>flfloor</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18982 |
<tr><td></td><td valign="top"><a href="#index-flinfinite_003f"><code>flinfinite?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18983 |
<tr><td></td><td valign="top"><a href="#index-flinteger_003f"><code>flinteger?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18984 |
<tr><td></td><td valign="top"><a href="#index-fllog"><code>fllog</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18985 |
<tr><td></td><td valign="top"><a href="#index-flmax"><code>flmax</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18986 |
<tr><td></td><td valign="top"><a href="#index-flmin"><code>flmin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18987 |
<tr><td></td><td valign="top"><a href="#index-flnan_003f"><code>flnan?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18988 |
<tr><td></td><td valign="top"><a href="#index-flnegative_003f"><code>flnegative?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18989 |
<tr><td></td><td valign="top"><a href="#index-flnumerator"><code>flnumerator</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18990 |
<tr><td></td><td valign="top"><a href="#index-floating-point-overflow">floating point overflow</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr> |
| 18991 |
<tr><td></td><td valign="top"><a href="#index-flodd_003f"><code>flodd?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18992 |
<tr><td></td><td valign="top"><a href="#index-flonum"><code>flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 18993 |
<tr><td></td><td valign="top"><a href="#index-flonum_003f"><code>flonum?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18994 |
<tr><td></td><td valign="top"><a href="#index-flpositive_003f"><code>flpositive?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18995 |
<tr><td></td><td valign="top"><a href="#index-flround"><code>flround</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18996 |
<tr><td></td><td valign="top"><a href="#index-flsin"><code>flsin</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18997 |
<tr><td></td><td valign="top"><a href="#index-flsqrt"><code>flsqrt</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18998 |
<tr><td></td><td valign="top"><a href="#index-fltan"><code>fltan</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 18999 |
<tr><td></td><td valign="top"><a href="#index-fltruncate"><code>fltruncate</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 19000 |
<tr><td></td><td valign="top"><a href="#index-flzero_003f"><code>flzero?</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr> |
| 19001 |
<tr><td></td><td valign="top"><a href="#index-force_002doutput"><code>force-output</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19002 |
<tr><td></td><td valign="top"><a href="#index-foreign-function-interface">foreign function interface</a></td><td valign="top"><a href="#C_002dinterface">19. C-interface</a></td></tr> |
| 19003 |
<tr><td></td><td valign="top"><a href="#index-foreign_002daddress"><code>foreign-address</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19004 |
<tr><td></td><td valign="top"><a href="#index-foreign_002drelease_0021"><code>foreign-release!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19005 |
<tr><td></td><td valign="top"><a href="#index-foreign_002dreleased_003f"><code>foreign-released?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19006 |
<tr><td></td><td valign="top"><a href="#index-foreign_002dtags"><code>foreign-tags</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19007 |
<tr><td></td><td valign="top"><a href="#index-foreign_003f"><code>foreign?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19008 |
<tr><td></td><td valign="top"><a href="#index-future"><code>future</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19009 |
<tr><td></td><td valign="top"><a href="#index-fx_002a"><code>fx*</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19010 |
<tr><td></td><td valign="top"><a href="#index-fx_002b"><code>fx+</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19011 |
<tr><td></td><td valign="top"><a href="#index-fx_002d"><code>fx-</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19012 |
<tr><td></td><td valign="top"><a href="#index-fx_003c"><code>fx<</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19013 |
<tr><td></td><td valign="top"><a href="#index-fx_003c_003d"><code>fx<=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19014 |
<tr><td></td><td valign="top"><a href="#index-fx_003d"><code>fx=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19015 |
<tr><td></td><td valign="top"><a href="#index-fx_003e"><code>fx></code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19016 |
<tr><td></td><td valign="top"><a href="#index-fx_003e_003d"><code>fx>=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19017 |
<tr><td></td><td valign="top"><a href="#index-fxabs"><code>fxabs</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19018 |
<tr><td></td><td valign="top"><a href="#index-fxand"><code>fxand</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19019 |
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift"><code>fxarithmetic-shift</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19020 |
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift_002dleft"><code>fxarithmetic-shift-left</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19021 |
<tr><td></td><td valign="top"><a href="#index-fxarithmetic_002dshift_002dright"><code>fxarithmetic-shift-right</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19022 |
<tr><td></td><td valign="top"><a href="#index-fxbit_002dcount"><code>fxbit-count</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19023 |
<tr><td></td><td valign="top"><a href="#index-fxbit_002dset_003f"><code>fxbit-set?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19024 |
<tr><td></td><td valign="top"><a href="#index-fxeven_003f"><code>fxeven?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19025 |
<tr><td></td><td valign="top"><a href="#index-fxfirst_002dset_002dbit"><code>fxfirst-set-bit</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19026 |
<tr><td></td><td valign="top"><a href="#index-fxif"><code>fxif</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19027 |
<tr><td></td><td valign="top"><a href="#index-fxior"><code>fxior</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19028 |
<tr><td></td><td valign="top"><a href="#index-fxlength"><code>fxlength</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19029 |
<tr><td></td><td valign="top"><a href="#index-fxmax"><code>fxmax</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19030 |
<tr><td></td><td valign="top"><a href="#index-fxmin"><code>fxmin</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19031 |
<tr><td></td><td valign="top"><a href="#index-fxmodulo"><code>fxmodulo</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19032 |
<tr><td></td><td valign="top"><a href="#index-fxnegative_003f"><code>fxnegative?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19033 |
<tr><td></td><td valign="top"><a href="#index-fxnot"><code>fxnot</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19034 |
<tr><td></td><td valign="top"><a href="#index-fxodd_003f"><code>fxodd?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19035 |
<tr><td></td><td valign="top"><a href="#index-fxpositive_003f"><code>fxpositive?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19036 |
<tr><td></td><td valign="top"><a href="#index-fxquotient"><code>fxquotient</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19037 |
<tr><td></td><td valign="top"><a href="#index-fxremainder"><code>fxremainder</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19038 |
<tr><td></td><td valign="top"><a href="#index-fxwrap_002a"><code>fxwrap*</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19039 |
<tr><td></td><td valign="top"><a href="#index-fxwrap_002b"><code>fxwrap+</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19040 |
<tr><td></td><td valign="top"><a href="#index-fxwrap_002d"><code>fxwrap-</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19041 |
<tr><td></td><td valign="top"><a href="#index-fxwrapabs"><code>fxwrapabs</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19042 |
<tr><td></td><td valign="top"><a href="#index-fxwraparithmetic_002dshift"><code>fxwraparithmetic-shift</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19043 |
<tr><td></td><td valign="top"><a href="#index-fxwraparithmetic_002dshift_002dleft"><code>fxwraparithmetic-shift-left</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19044 |
<tr><td></td><td valign="top"><a href="#index-fxwraplogical_002dshift_002dright"><code>fxwraplogical-shift-right</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19045 |
<tr><td></td><td valign="top"><a href="#index-fxwrapquotient"><code>fxwrapquotient</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19046 |
<tr><td></td><td valign="top"><a href="#index-fxxor"><code>fxxor</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19047 |
<tr><td></td><td valign="top"><a href="#index-fxzero_003f"><code>fxzero?</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr> |
| 19048 |
<tr><td colspan="3"> <hr></td></tr> |
| 19049 |
<tr><th><a name="General-index-1_cp_letter-G">G</a></th><td></td><td></td></tr> |
| 19050 |
<tr><td></td><td valign="top"><a href="#index-GAMBCOPT_002c-environment-variable">GAMBCOPT, environment variable</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 19051 |
<tr><td></td><td valign="top"><a href="#index-Gambit">Gambit</a></td><td valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td></tr> |
| 19052 |
<tr><td></td><td valign="top"><a href="#index-Gambit_002dC">Gambit-C</a></td><td valign="top"><a href="#Top">Gambit-C</a></td></tr> |
| 19053 |
<tr><td></td><td valign="top"><a href="#index-Gambit_002dC-1">Gambit-C</a></td><td valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td></tr> |
| 19054 |
<tr><td></td><td valign="top"><a href="#index-gambit_002dscheme"><code>gambit-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19055 |
<tr><td></td><td valign="top"><a href="#index-gambit_002eel">gambit.el</a></td><td valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td></tr> |
| 19056 |
<tr><td></td><td valign="top"><a href="#index-GC">GC</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19057 |
<tr><td></td><td valign="top"><a href="#index-gc_002dreport_002dset_0021"><code>gc-report-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19058 |
<tr><td></td><td valign="top"><a href="#index-generate_002dproper_002dtail_002dcalls"><code>generate-proper-tail-calls</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19059 |
<tr><td></td><td valign="top"><a href="#index-generative_002dlambda"><code>generative-lambda</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19060 |
<tr><td></td><td valign="top"><a href="#index-generic"><code>generic</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19061 |
<tr><td></td><td valign="top"><a href="#index-gensym"><code>gensym</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19062 |
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002dstring"><code>get-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19063 |
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002du8vector"><code>get-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19064 |
<tr><td></td><td valign="top"><a href="#index-get_002doutput_002dvector"><code>get-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19065 |
<tr><td></td><td valign="top"><a href="#index-getenv"><code>getenv</code></a></td><td valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td></tr> |
| 19066 |
<tr><td></td><td valign="top"><a href="#index-group_002dinfo"><code>group-info</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr> |
| 19067 |
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dgid"><code>group-info-gid</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr> |
| 19068 |
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dmembers"><code>group-info-members</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr> |
| 19069 |
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_002dname"><code>group-info-name</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr> |
| 19070 |
<tr><td></td><td valign="top"><a href="#index-group_002dinfo_003f"><code>group-info?</code></a></td><td valign="top"><a href="#Group-information">16.9 Group information</a></td></tr> |
| 19071 |
<tr><td></td><td valign="top"><a href="#index-gsc"><code>gsc</code></a></td><td valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td></tr> |
| 19072 |
<tr><td></td><td valign="top"><a href="#index-gsc-1"><code>gsc</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 19073 |
<tr><td></td><td valign="top"><a href="#index-gsc-2"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19074 |
<tr><td></td><td valign="top"><a href="#index-gsc-3"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19075 |
<tr><td></td><td valign="top"><a href="#index-gsc-4"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19076 |
<tr><td></td><td valign="top"><a href="#index-gsc-5"><code>gsc</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19077 |
<tr><td></td><td valign="top"><a href="#index-gsc-6"><code>gsc</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 19078 |
<tr><td></td><td valign="top"><a href="#index-gsc_002dscript"><code>gsc-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19079 |
<tr><td></td><td valign="top"><a href="#index-gsi"><code>gsi</code></a></td><td valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td></tr> |
| 19080 |
<tr><td></td><td valign="top"><a href="#index-gsi-1"><code>gsi</code></a></td><td valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td></tr> |
| 19081 |
<tr><td></td><td valign="top"><a href="#index-gsi-2"><code>gsi</code></a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 19082 |
<tr><td></td><td valign="top"><a href="#index-gsi_002dscript"><code>gsi-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19083 |
<tr><td colspan="3"> <hr></td></tr> |
| 19084 |
<tr><th><a name="General-index-1_cp_letter-H">H</a></th><td></td><td></td></tr> |
| 19085 |
<tr><td></td><td valign="top"><a href="#index-hashing">hashing</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr> |
| 19086 |
<tr><td></td><td valign="top"><a href="#index-heap_002doverflow_002dexception_003f"><code>heap-overflow-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td></tr> |
| 19087 |
<tr><td></td><td valign="top"><a href="#index-help"><code>help</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19088 |
<tr><td></td><td valign="top"><a href="#index-help_002dbrowser"><code>help-browser</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19089 |
<tr><td></td><td valign="top"><a href="#index-home-directory">home directory</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19090 |
<tr><td></td><td valign="top"><a href="#index-homogeneous-vectors">homogeneous vectors</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19091 |
<tr><td></td><td valign="top"><a href="#index-homogeneous-vectors-1">homogeneous vectors</a></td><td valign="top"><a href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></td></tr> |
| 19092 |
<tr><td></td><td valign="top"><a href="#index-host_002dinfo"><code>host-info</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19093 |
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002daddresses"><code>host-info-addresses</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19094 |
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002daliases"><code>host-info-aliases</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19095 |
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_002dname"><code>host-info-name</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19096 |
<tr><td></td><td valign="top"><a href="#index-host_002dinfo_003f"><code>host-info?</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19097 |
<tr><td></td><td valign="top"><a href="#index-host_002dname"><code>host-name</code></a></td><td valign="top"><a href="#Host-information">16.11 Host information</a></td></tr> |
| 19098 |
<tr><td colspan="3"> <hr></td></tr> |
| 19099 |
<tr><th><a name="General-index-1_cp_letter-I">I</a></th><td></td><td></td></tr> |
| 19100 |
<tr><td></td><td valign="top"><a href="#index-ieee_002dscheme"><code>ieee-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19101 |
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002darg_002dnum"><code>improper-length-list-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19102 |
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002darguments"><code>improper-length-list-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19103 |
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_002dprocedure"><code>improper-length-list-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19104 |
<tr><td></td><td valign="top"><a href="#index-improper_002dlength_002dlist_002dexception_003f"><code>improper-length-list-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19105 |
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_002darguments"><code>inactive-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19106 |
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_002dprocedure"><code>inactive-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19107 |
<tr><td></td><td valign="top"><a href="#index-inactive_002dthread_002dexception_003f"><code>inactive-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19108 |
<tr><td></td><td valign="top"><a href="#index-include"><code>include</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19109 |
<tr><td></td><td valign="top"><a href="#index-include-1"><code>include</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19110 |
<tr><td></td><td valign="top"><a href="#index-infinite_003f"><code>infinite?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19111 |
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_002darguments"><code>initialized-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19112 |
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_002dprocedure"><code>initialized-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19113 |
<tr><td></td><td valign="top"><a href="#index-initialized_002dthread_002dexception_003f"><code>initialized-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19114 |
<tr><td></td><td valign="top"><a href="#index-inline"><code>inline</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19115 |
<tr><td></td><td valign="top"><a href="#index-inline_002dprimitives"><code>inline-primitives</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19116 |
<tr><td></td><td valign="top"><a href="#index-inlining_002dlimit"><code>inlining-limit</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19117 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dbyte_002dposition"><code>input-port-byte-position</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19118 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dbytes_002dbuffered"><code>input-port-bytes-buffered</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19119 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dchar_002dposition"><code>input-port-char-position</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19120 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dcharacters_002dbuffered"><code>input-port-characters-buffered</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19121 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dcolumn"><code>input-port-column</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19122 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dline"><code>input-port-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19123 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dreadtable"><code>input-port-readtable</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19124 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dreadtable_002dset_0021"><code>input-port-readtable-set!</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19125 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_002dtimeout_002dset_0021"><code>input-port-timeout-set!</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19126 |
<tr><td></td><td valign="top"><a href="#index-input_002dport_003f"><code>input-port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19127 |
<tr><td></td><td valign="top"><a href="#index-installation-directories">installation directories</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19128 |
<tr><td></td><td valign="top"><a href="#index-integer_002d_003echar"><code>integer->char</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr> |
| 19129 |
<tr><td></td><td valign="top"><a href="#index-integer_002dlength"><code>integer-length</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 19130 |
<tr><td></td><td valign="top"><a href="#index-integer_002dnth_002droot"><code>integer-nth-root</code></a></td><td valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td></tr> |
| 19131 |
<tr><td></td><td valign="top"><a href="#index-integer_002dsqrt"><code>integer-sqrt</code></a></td><td valign="top"><a href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></td></tr> |
| 19132 |
<tr><td></td><td valign="top"><a href="#index-interpreter">interpreter</a></td><td valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td></tr> |
| 19133 |
<tr><td></td><td valign="top"><a href="#index-interpreter-1">interpreter</a></td><td valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td></tr> |
| 19134 |
<tr><td></td><td valign="top"><a href="#index-interrupts_002denabled"><code>interrupts-enabled</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19135 |
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_002darguments"><code>invalid-hash-number-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19136 |
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_002dprocedure"><code>invalid-hash-number-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19137 |
<tr><td></td><td valign="top"><a href="#index-invalid_002dhash_002dnumber_002dexception_003f"><code>invalid-hash-number-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19138 |
<tr><td colspan="3"> <hr></td></tr> |
| 19139 |
<tr><th><a name="General-index-1_cp_letter-J">J</a></th><td></td><td></td></tr> |
| 19140 |
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_002darguments"><code>join-timeout-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19141 |
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_002dprocedure"><code>join-timeout-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19142 |
<tr><td></td><td valign="top"><a href="#index-join_002dtimeout_002dexception_003f"><code>join-timeout-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19143 |
<tr><td colspan="3"> <hr></td></tr> |
| 19144 |
<tr><th><a name="General-index-1_cp_letter-K">K</a></th><td></td><td></td></tr> |
| 19145 |
<tr><td></td><td valign="top"><a href="#index-keyword_002d_003estring"><code>keyword->string</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19146 |
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_002darguments"><code>keyword-expected-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19147 |
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_002dprocedure"><code>keyword-expected-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19148 |
<tr><td></td><td valign="top"><a href="#index-keyword_002dexpected_002dexception_003f"><code>keyword-expected-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19149 |
<tr><td></td><td valign="top"><a href="#index-keyword_002dhash"><code>keyword-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19150 |
<tr><td></td><td valign="top"><a href="#index-keyword_003f"><code>keyword?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19151 |
<tr><td></td><td valign="top"><a href="#index-keywords">keywords</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19152 |
<tr><td colspan="3"> <hr></td></tr> |
| 19153 |
<tr><th><a name="General-index-1_cp_letter-L">L</a></th><td></td><td></td></tr> |
| 19154 |
<tr><td></td><td valign="top"><a href="#index-lambda"><code>lambda</code></a></td><td valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td></tr> |
| 19155 |
<tr><td></td><td valign="top"><a href="#index-lambda_002dlift"><code>lambda-lift</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19156 |
<tr><td></td><td valign="top"><a href="#index-last_005f_002ec"><code><var>last</var>_.c</code></a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 19157 |
<tr><td></td><td valign="top"><a href="#index-limitations">limitations</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr> |
| 19158 |
<tr><td></td><td valign="top"><a href="#index-link_002dflat"><code>link-flat</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19159 |
<tr><td></td><td valign="top"><a href="#index-link_002dincremental"><code>link-incremental</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19160 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003ef32vector"><code>list->f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19161 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003ef64vector"><code>list->f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19162 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003es16vector"><code>list->s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19163 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003es32vector"><code>list->s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19164 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003es64vector"><code>list->s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19165 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003es8vector"><code>list->s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19166 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003etable"><code>list->table</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19167 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu16vector"><code>list->u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19168 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu32vector"><code>list->u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19169 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu64vector"><code>list->u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19170 |
<tr><td></td><td valign="top"><a href="#index-list_002d_003eu8vector"><code>list->u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19171 |
<tr><td></td><td valign="top"><a href="#index-load"><code>load</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19172 |
<tr><td colspan="3"> <hr></td></tr> |
| 19173 |
<tr><th><a name="General-index-1_cp_letter-M">M</a></th><td></td><td></td></tr> |
| 19174 |
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_002darguments"><code>mailbox-receive-timeout-exception-arguments</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19175 |
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_002dprocedure"><code>mailbox-receive-timeout-exception-procedure</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19176 |
<tr><td></td><td valign="top"><a href="#index-mailbox_002dreceive_002dtimeout_002dexception_003f"><code>mailbox-receive-timeout-exception?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19177 |
<tr><td></td><td valign="top"><a href="#index-main"><code>main</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19178 |
<tr><td></td><td valign="top"><a href="#index-make_002dcondition_002dvariable"><code>make-condition-variable</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19179 |
<tr><td></td><td valign="top"><a href="#index-make_002df32vector"><code>make-f32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19180 |
<tr><td></td><td valign="top"><a href="#index-make_002df64vector"><code>make-f64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19181 |
<tr><td></td><td valign="top"><a href="#index-make_002dmutex"><code>make-mutex</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19182 |
<tr><td></td><td valign="top"><a href="#index-make_002dparameter"><code>make-parameter</code></a></td><td valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td></tr> |
| 19183 |
<tr><td></td><td valign="top"><a href="#index-make_002drandom_002dsource"><code>make-random-source</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19184 |
<tr><td></td><td valign="top"><a href="#index-make_002droot_002dthread"><code>make-root-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19185 |
<tr><td></td><td valign="top"><a href="#index-make_002ds16vector"><code>make-s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19186 |
<tr><td></td><td valign="top"><a href="#index-make_002ds32vector"><code>make-s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19187 |
<tr><td></td><td valign="top"><a href="#index-make_002ds64vector"><code>make-s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19188 |
<tr><td></td><td valign="top"><a href="#index-make_002ds8vector"><code>make-s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19189 |
<tr><td></td><td valign="top"><a href="#index-make_002dtable"><code>make-table</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19190 |
<tr><td></td><td valign="top"><a href="#index-make_002dthread"><code>make-thread</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19191 |
<tr><td></td><td valign="top"><a href="#index-make_002dthread_002dgroup"><code>make-thread-group</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19192 |
<tr><td></td><td valign="top"><a href="#index-make_002du16vector"><code>make-u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19193 |
<tr><td></td><td valign="top"><a href="#index-make_002du32vector"><code>make-u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19194 |
<tr><td></td><td valign="top"><a href="#index-make_002du64vector"><code>make-u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19195 |
<tr><td></td><td valign="top"><a href="#index-make_002du8vector"><code>make-u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19196 |
<tr><td></td><td valign="top"><a href="#index-make_002duninterned_002dkeyword"><code>make-uninterned-keyword</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19197 |
<tr><td></td><td valign="top"><a href="#index-make_002duninterned_002dsymbol"><code>make-uninterned-symbol</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19198 |
<tr><td></td><td valign="top"><a href="#index-make_002dwill"><code>make-will</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr> |
| 19199 |
<tr><td></td><td valign="top"><a href="#index-mostly_002dfixnum"><code>mostly-fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19200 |
<tr><td></td><td valign="top"><a href="#index-mostly_002dfixnum_002dflonum"><code>mostly-fixnum-flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19201 |
<tr><td></td><td valign="top"><a href="#index-mostly_002dflonum"><code>mostly-flonum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19202 |
<tr><td></td><td valign="top"><a href="#index-mostly_002dflonum_002dfixnum"><code>mostly-flonum-fixnum</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19203 |
<tr><td></td><td valign="top"><a href="#index-mostly_002dgeneric"><code>mostly-generic</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19204 |
<tr><td></td><td valign="top"><a href="#index-multiple_002dc_002dreturn_002dexception_003f"><code>multiple-c-return-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19205 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dlock_0021"><code>mutex-lock!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19206 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dname"><code>mutex-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19207 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dspecific"><code>mutex-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19208 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dspecific_002dset_0021"><code>mutex-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19209 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dstate"><code>mutex-state</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19210 |
<tr><td></td><td valign="top"><a href="#index-mutex_002dunlock_0021"><code>mutex-unlock!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19211 |
<tr><td></td><td valign="top"><a href="#index-mutex_003f"><code>mutex?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19212 |
<tr><td colspan="3"> <hr></td></tr> |
| 19213 |
<tr><th><a name="General-index-1_cp_letter-N">N</a></th><td></td><td></td></tr> |
| 19214 |
<tr><td></td><td valign="top"><a href="#index-namespace"><code>namespace</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19215 |
<tr><td></td><td valign="top"><a href="#index-nan_003f"><code>nan?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19216 |
<tr><td></td><td valign="top"><a href="#index-network_002dinfo"><code>network-info</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr> |
| 19217 |
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002daliases"><code>network-info-aliases</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr> |
| 19218 |
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002dname"><code>network-info-name</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr> |
| 19219 |
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_002dnumber"><code>network-info-number</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr> |
| 19220 |
<tr><td></td><td valign="top"><a href="#index-network_002dinfo_003f"><code>network-info?</code></a></td><td valign="top"><a href="#Network-information">16.14 Network information</a></td></tr> |
| 19221 |
<tr><td></td><td valign="top"><a href="#index-newline"><code>newline</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19222 |
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002darguments"><code>no-such-file-or-directory-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19223 |
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_002dprocedure"><code>no-such-file-or-directory-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19224 |
<tr><td></td><td valign="top"><a href="#index-no_002dsuch_002dfile_002dor_002ddirectory_002dexception_003f"><code>no-such-file-or-directory-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19225 |
<tr><td></td><td valign="top"><a href="#index-noncontinuable_002dexception_002dreason"><code>noncontinuable-exception-reason</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 19226 |
<tr><td></td><td valign="top"><a href="#index-noncontinuable_002dexception_003f"><code>noncontinuable-exception?</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 19227 |
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002darguments"><code>nonempty-input-port-character-buffer-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19228 |
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_002dprocedure"><code>nonempty-input-port-character-buffer-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19229 |
<tr><td></td><td valign="top"><a href="#index-nonempty_002dinput_002dport_002dcharacter_002dbuffer_002dexception_003f"><code>nonempty-input-port-character-buffer-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19230 |
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002darguments"><code>nonprocedure-operator-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19231 |
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002dcode"><code>nonprocedure-operator-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19232 |
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002doperator"><code>nonprocedure-operator-exception-operator</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19233 |
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_002drte"><code>nonprocedure-operator-exception-rte</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19234 |
<tr><td></td><td valign="top"><a href="#index-nonprocedure_002doperator_002dexception_003f"><code>nonprocedure-operator-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19235 |
<tr><td></td><td valign="top"><a href="#index-normalized-path">normalized path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19236 |
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_002darguments"><code>number-of-arguments-limit-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19237 |
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_002dprocedure"><code>number-of-arguments-limit-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19238 |
<tr><td></td><td valign="top"><a href="#index-number_002dof_002darguments_002dlimit_002dexception_003f"><code>number-of-arguments-limit-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19239 |
<tr><td colspan="3"> <hr></td></tr> |
| 19240 |
<tr><th><a name="General-index-1_cp_letter-O">O</a></th><td></td><td></td></tr> |
| 19241 |
<tr><td></td><td valign="top"><a href="#index-object-file">object file</a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr> |
| 19242 |
<tr><td></td><td valign="top"><a href="#index-object_002d_003eserial_002dnumber"><code>object->serial-number</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19243 |
<tr><td></td><td valign="top"><a href="#index-object_002d_003estring"><code>object->string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19244 |
<tr><td></td><td valign="top"><a href="#index-object_002d_003eu8vector"><code>object->u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19245 |
<tr><td></td><td valign="top"><a href="#index-open_002ddirectory"><code>open-directory</code></a></td><td valign="top"><a href="#Directory_002dports">17.8 Directory-ports</a></td></tr> |
| 19246 |
<tr><td></td><td valign="top"><a href="#index-open_002ddummy"><code>open-dummy</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19247 |
<tr><td></td><td valign="top"><a href="#index-open_002devent_002dqueue"><code>open-event-queue</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19248 |
<tr><td></td><td valign="top"><a href="#index-open_002dfile"><code>open-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19249 |
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dfile"><code>open-input-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19250 |
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dprocess"><code>open-input-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19251 |
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dstring"><code>open-input-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19252 |
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002du8vector"><code>open-input-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19253 |
<tr><td></td><td valign="top"><a href="#index-open_002dinput_002dvector"><code>open-input-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19254 |
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dfile"><code>open-output-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19255 |
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dprocess"><code>open-output-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19256 |
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dstring"><code>open-output-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19257 |
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002du8vector"><code>open-output-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19258 |
<tr><td></td><td valign="top"><a href="#index-open_002doutput_002dvector"><code>open-output-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19259 |
<tr><td></td><td valign="top"><a href="#index-open_002dprocess"><code>open-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19260 |
<tr><td></td><td valign="top"><a href="#index-open_002dstring"><code>open-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19261 |
<tr><td></td><td valign="top"><a href="#index-open_002dstring_002dpipe"><code>open-string-pipe</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19262 |
<tr><td></td><td valign="top"><a href="#index-open_002dtcp_002dclient"><code>open-tcp-client</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr> |
| 19263 |
<tr><td></td><td valign="top"><a href="#index-open_002dtcp_002dserver"><code>open-tcp-server</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr> |
| 19264 |
<tr><td></td><td valign="top"><a href="#index-open_002du8vector"><code>open-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19265 |
<tr><td></td><td valign="top"><a href="#index-open_002du8vector_002dpipe"><code>open-u8vector-pipe</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19266 |
<tr><td></td><td valign="top"><a href="#index-open_002dvector"><code>open-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19267 |
<tr><td></td><td valign="top"><a href="#index-open_002dvector_002dpipe"><code>open-vector-pipe</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19268 |
<tr><td></td><td valign="top"><a href="#index-optimize_002ddead_002dlocal_002dvariables"><code>optimize-dead-local-variables</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19269 |
<tr><td></td><td valign="top"><a href="#index-options_002c-compiler">options, compiler</a></td><td valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td></tr> |
| 19270 |
<tr><td></td><td valign="top"><a href="#index-options_002c-runtime">options, runtime</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 19271 |
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002darguments"><code>os-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19272 |
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dcode"><code>os-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19273 |
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dmessage"><code>os-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19274 |
<tr><td></td><td valign="top"><a href="#index-os_002dexception_002dprocedure"><code>os-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19275 |
<tr><td></td><td valign="top"><a href="#index-os_002dexception_003f"><code>os-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19276 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dbyte_002dposition"><code>output-port-byte-position</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19277 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dchar_002dposition"><code>output-port-char-position</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19278 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dcolumn"><code>output-port-column</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19279 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dline"><code>output-port-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19280 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dreadtable"><code>output-port-readtable</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19281 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dreadtable_002dset_0021"><code>output-port-readtable-set!</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19282 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dtimeout_002dset_0021"><code>output-port-timeout-set!</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19283 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_002dwidth"><code>output-port-width</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19284 |
<tr><td></td><td valign="top"><a href="#index-output_002dport_003f"><code>output-port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19285 |
<tr><td></td><td valign="top"><a href="#index-overflow_002c-floating-point">overflow, floating point</a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr> |
| 19286 |
<tr><td colspan="3"> <hr></td></tr> |
| 19287 |
<tr><th><a name="General-index-1_cp_letter-P">P</a></th><td></td><td></td></tr> |
| 19288 |
<tr><td></td><td valign="top"><a href="#index-parameterize"><code>parameterize</code></a></td><td valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td></tr> |
| 19289 |
<tr><td></td><td valign="top"><a href="#index-path_002ddirectory"><code>path-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19290 |
<tr><td></td><td valign="top"><a href="#index-path_002dexpand"><code>path-expand</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19291 |
<tr><td></td><td valign="top"><a href="#index-path_002dextension"><code>path-extension</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19292 |
<tr><td></td><td valign="top"><a href="#index-path_002dnormalize"><code>path-normalize</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19293 |
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002ddirectory"><code>path-strip-directory</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19294 |
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dextension"><code>path-strip-extension</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19295 |
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dtrailing_002ddirectory_002dseparator"><code>path-strip-trailing-directory-separator</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19296 |
<tr><td></td><td valign="top"><a href="#index-path_002dstrip_002dvolume"><code>path-strip-volume</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19297 |
<tr><td></td><td valign="top"><a href="#index-path_002dvolume"><code>path-volume</code></a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19298 |
<tr><td></td><td valign="top"><a href="#index-peek_002dchar"><code>peek-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19299 |
<tr><td></td><td valign="top"><a href="#index-port_002dio_002dexception_002dhandler_002dset_0021"><code>port-io-exception-handler-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19300 |
<tr><td></td><td valign="top"><a href="#index-port_002dsettings_002dset_0021"><code>port-settings-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19301 |
<tr><td></td><td valign="top"><a href="#index-port_003f"><code>port?</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19302 |
<tr><td></td><td valign="top"><a href="#index-pp"><code>pp</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19303 |
<tr><td></td><td valign="top"><a href="#index-pretty_002dprint"><code>pretty-print</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19304 |
<tr><td></td><td valign="top"><a href="#index-primordial_002dexception_002dhandler"><code>primordial-exception-handler</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19305 |
<tr><td></td><td valign="top"><a href="#index-print"><code>print</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 19306 |
<tr><td></td><td valign="top"><a href="#index-println"><code>println</code></a></td><td valign="top"><a href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></td></tr> |
| 19307 |
<tr><td></td><td valign="top"><a href="#index-process_002dpid"><code>process-pid</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19308 |
<tr><td></td><td valign="top"><a href="#index-process_002dstatus"><code>process-status</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19309 |
<tr><td></td><td valign="top"><a href="#index-process_002dtimes"><code>process-times</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19310 |
<tr><td></td><td valign="top"><a href="#index-proper-tail_002dcalls">proper tail-calls</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19311 |
<tr><td></td><td valign="top"><a href="#index-proper-tail_002dcalls-1">proper tail-calls</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19312 |
<tr><td></td><td valign="top"><a href="#index-proper_002dtail_002dcalls"><code>proper-tail-calls</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19313 |
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo"><code>protocol-info</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr> |
| 19314 |
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002daliases"><code>protocol-info-aliases</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr> |
| 19315 |
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002dname"><code>protocol-info-name</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr> |
| 19316 |
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_002dnumber"><code>protocol-info-number</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr> |
| 19317 |
<tr><td></td><td valign="top"><a href="#index-protocol_002dinfo_003f"><code>protocol-info?</code></a></td><td valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td></tr> |
| 19318 |
<tr><td colspan="3"> <hr></td></tr> |
| 19319 |
<tr><th><a name="General-index-1_cp_letter-R">R</a></th><td></td><td></td></tr> |
| 19320 |
<tr><td></td><td valign="top"><a href="#index-r4rs_002dscheme"><code>r4rs-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19321 |
<tr><td></td><td valign="top"><a href="#index-r5rs_002dscheme"><code>r5rs-scheme</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19322 |
<tr><td></td><td valign="top"><a href="#index-raise"><code>raise</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 19323 |
<tr><td></td><td valign="top"><a href="#index-random_002df64vector"><code>random-f64vector</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19324 |
<tr><td></td><td valign="top"><a href="#index-random_002dinteger"><code>random-integer</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19325 |
<tr><td></td><td valign="top"><a href="#index-random_002dreal"><code>random-real</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19326 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002df64vectors"><code>random-source-make-f64vectors</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19327 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002dintegers"><code>random-source-make-integers</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19328 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002dreals"><code>random-source-make-reals</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19329 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dmake_002du8vectors"><code>random-source-make-u8vectors</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19330 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dpseudo_002drandomize_0021"><code>random-source-pseudo-randomize!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19331 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002drandomize_0021"><code>random-source-randomize!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19332 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dstate_002dref"><code>random-source-state-ref</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19333 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_002dstate_002dset_0021"><code>random-source-state-set!</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19334 |
<tr><td></td><td valign="top"><a href="#index-random_002dsource_003f"><code>random-source?</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19335 |
<tr><td></td><td valign="top"><a href="#index-random_002du8vector"><code>random-u8vector</code></a></td><td valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td></tr> |
| 19336 |
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002darg_002dnum"><code>range-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19337 |
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002darguments"><code>range-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19338 |
<tr><td></td><td valign="top"><a href="#index-range_002dexception_002dprocedure"><code>range-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19339 |
<tr><td></td><td valign="top"><a href="#index-range_002dexception_003f"><code>range-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19340 |
<tr><td></td><td valign="top"><a href="#index-read"><code>read</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19341 |
<tr><td></td><td valign="top"><a href="#index-read_002dall"><code>read-all</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19342 |
<tr><td></td><td valign="top"><a href="#index-read_002dchar"><code>read-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19343 |
<tr><td></td><td valign="top"><a href="#index-read_002dline"><code>read-line</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19344 |
<tr><td></td><td valign="top"><a href="#index-read_002dsubstring"><code>read-substring</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19345 |
<tr><td></td><td valign="top"><a href="#index-read_002dsubu8vector"><code>read-subu8vector</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr> |
| 19346 |
<tr><td></td><td valign="top"><a href="#index-read_002du8"><code>read-u8</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr> |
| 19347 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dcase_002dconversion_003f"><code>readtable-case-conversion?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19348 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dcase_002dconversion_003f_002dset"><code>readtable-case-conversion?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19349 |
<tr><td></td><td valign="top"><a href="#index-readtable_002deval_002dallowed_003f"><code>readtable-eval-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19350 |
<tr><td></td><td valign="top"><a href="#index-readtable_002deval_002dallowed_003f_002dset"><code>readtable-eval-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19351 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dkeywords_002dallowed_003f"><code>readtable-keywords-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19352 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dkeywords_002dallowed_003f_002dset"><code>readtable-keywords-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19353 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dunescaped_002dchar"><code>readtable-max-unescaped-char</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19354 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dunescaped_002dchar_002dset"><code>readtable-max-unescaped-char-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19355 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlength"><code>readtable-max-write-length</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19356 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlength_002dset"><code>readtable-max-write-length-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19357 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlevel"><code>readtable-max-write-level</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19358 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dmax_002dwrite_002dlevel_002dset"><code>readtable-max-write-level-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19359 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dsharing_002dallowed_003f"><code>readtable-sharing-allowed?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19360 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dsharing_002dallowed_003f_002dset"><code>readtable-sharing-allowed?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19361 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dstart_002dsyntax"><code>readtable-start-syntax</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19362 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dstart_002dsyntax_002dset"><code>readtable-start-syntax-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19363 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f"><code>readtable-write-cdr-read-macros?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19364 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dcdr_002dread_002dmacros_003f_002dset"><code>readtable-write-cdr-read-macros?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19365 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dextended_002dread_002dmacros_003f"><code>readtable-write-extended-read-macros?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19366 |
<tr><td></td><td valign="top"><a href="#index-readtable_002dwrite_002dextended_002dread_002dmacros_003f_002dset"><code>readtable-write-extended-read-macros?-set</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19367 |
<tr><td></td><td valign="top"><a href="#index-readtable_003f"><code>readtable?</code></a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19368 |
<tr><td></td><td valign="top"><a href="#index-real_002dtime"><code>real-time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19369 |
<tr><td></td><td valign="top"><a href="#index-receive"><code>receive</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19370 |
<tr><td></td><td valign="top"><a href="#index-relative-path">relative path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19371 |
<tr><td></td><td valign="top"><a href="#index-relative-path-1">relative path</a></td><td valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td></tr> |
| 19372 |
<tr><td></td><td valign="top"><a href="#index-rename_002dfile"><code>rename-file</code></a></td><td valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td></tr> |
| 19373 |
<tr><td></td><td valign="top"><a href="#index-repl_002ddisplay_002denvironment_003f"><code>repl-display-environment?</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19374 |
<tr><td></td><td valign="top"><a href="#index-repl_002dinput_002dport"><code>repl-input-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19375 |
<tr><td></td><td valign="top"><a href="#index-repl_002doutput_002dport"><code>repl-output-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19376 |
<tr><td></td><td valign="top"><a href="#index-repl_002dresult_002dhistory_002dmax_002dlength_002dset_0021"><code>repl-result-history-max-length-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19377 |
<tr><td></td><td valign="top"><a href="#index-repl_002dresult_002dhistory_002dref"><code>repl-result-history-ref</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19378 |
<tr><td></td><td valign="top"><a href="#index-replace_002dbit_002dfield"><code>replace-bit-field</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 19379 |
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002darguments"><code>rpc-remote-error-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19380 |
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002dmessage"><code>rpc-remote-error-exception-message</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19381 |
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_002dprocedure"><code>rpc-remote-error-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19382 |
<tr><td></td><td valign="top"><a href="#index-rpc_002dremote_002derror_002dexception_003f"><code>rpc-remote-error-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19383 |
<tr><td></td><td valign="top"><a href="#index-run_002dtime_002dbindings"><code>run-time-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19384 |
<tr><td></td><td valign="top"><a href="#index-runtime-options">runtime options</a></td><td valign="top"><a href="#Runtime-options">4. Runtime options</a></td></tr> |
| 19385 |
<tr><td colspan="3"> <hr></td></tr> |
| 19386 |
<tr><th><a name="General-index-1_cp_letter-S">S</a></th><td></td><td></td></tr> |
| 19387 |
<tr><td></td><td valign="top"><a href="#index-s16vector"><code>s16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19388 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002d_003elist"><code>s16vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19389 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dappend"><code>s16vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19390 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dcopy"><code>s16vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19391 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dfill_0021"><code>s16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19392 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dlength"><code>s16vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19393 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dref"><code>s16vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19394 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dset_0021"><code>s16vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19395 |
<tr><td></td><td valign="top"><a href="#index-s16vector_002dshrink_0021"><code>s16vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19396 |
<tr><td></td><td valign="top"><a href="#index-s16vector_003f"><code>s16vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19397 |
<tr><td></td><td valign="top"><a href="#index-s32vector"><code>s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19398 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002d_003elist"><code>s32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19399 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dappend"><code>s32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19400 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dcopy"><code>s32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19401 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dfill_0021"><code>s32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19402 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dlength"><code>s32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19403 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dref"><code>s32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19404 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dset_0021"><code>s32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19405 |
<tr><td></td><td valign="top"><a href="#index-s32vector_002dshrink_0021"><code>s32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19406 |
<tr><td></td><td valign="top"><a href="#index-s32vector_003f"><code>s32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19407 |
<tr><td></td><td valign="top"><a href="#index-s64vector"><code>s64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19408 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002d_003elist"><code>s64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19409 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dappend"><code>s64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19410 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dcopy"><code>s64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19411 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dfill_0021"><code>s64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19412 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dlength"><code>s64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19413 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dref"><code>s64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19414 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dset_0021"><code>s64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19415 |
<tr><td></td><td valign="top"><a href="#index-s64vector_002dshrink_0021"><code>s64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19416 |
<tr><td></td><td valign="top"><a href="#index-s64vector_003f"><code>s64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19417 |
<tr><td></td><td valign="top"><a href="#index-s8vector"><code>s8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19418 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002d_003elist"><code>s8vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19419 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dappend"><code>s8vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19420 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dcopy"><code>s8vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19421 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dfill_0021"><code>s8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19422 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dlength"><code>s8vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19423 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dref"><code>s8vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19424 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dset_0021"><code>s8vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19425 |
<tr><td></td><td valign="top"><a href="#index-s8vector_002dshrink_0021"><code>s8vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19426 |
<tr><td></td><td valign="top"><a href="#index-s8vector_003f"><code>s8vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19427 |
<tr><td></td><td valign="top"><a href="#index-safe"><code>safe</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19428 |
<tr><td></td><td valign="top"><a href="#index-scheduler_002dexception_002dreason"><code>scheduler-exception-reason</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19429 |
<tr><td></td><td valign="top"><a href="#index-scheduler_002dexception_003f"><code>scheduler-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19430 |
<tr><td></td><td valign="top"><a href="#index-Scheme">Scheme</a></td><td valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td></tr> |
| 19431 |
<tr><td></td><td valign="top"><a href="#index-Scheme_002c-implementation-of">Scheme, implementation of</a></td><td valign="top"><a href="#Top">Gambit-C</a></td></tr> |
| 19432 |
<tr><td></td><td valign="top"><a href="#index-scheme_002dieee_002d1178_002d1990"><code>scheme-ieee-1178-1990</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19433 |
<tr><td></td><td valign="top"><a href="#index-scheme_002dr4rs"><code>scheme-r4rs</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19434 |
<tr><td></td><td valign="top"><a href="#index-scheme_002dr5rs"><code>scheme-r5rs</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19435 |
<tr><td></td><td valign="top"><a href="#index-scheme_002dsrfi_002d0"><code>scheme-srfi-0</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19436 |
<tr><td></td><td valign="top"><a href="#index-seconds_002d_003etime"><code>seconds->time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19437 |
<tr><td></td><td valign="top"><a href="#index-separate"><code>separate</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19438 |
<tr><td></td><td valign="top"><a href="#index-serial_002dnumber_002d_003eobject"><code>serial-number->object</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19439 |
<tr><td></td><td valign="top"><a href="#index-serialization">serialization</a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19440 |
<tr><td></td><td valign="top"><a href="#index-serialization-1">serialization</a></td><td valign="top"><a href="#Readtables">18.1 Readtables</a></td></tr> |
| 19441 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo"><code>service-info</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19442 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002daliases"><code>service-info-aliases</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19443 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dname"><code>service-info-name</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19444 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dport_002dnumber"><code>service-info-port-number</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19445 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_002dprotocol"><code>service-info-protocol</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19446 |
<tr><td></td><td valign="top"><a href="#index-service_002dinfo_003f"><code>service-info?</code></a></td><td valign="top"><a href="#Service-information">16.12 Service information</a></td></tr> |
| 19447 |
<tr><td></td><td valign="top"><a href="#index-set_0021"><code>set!</code></a></td><td valign="top"><a href="#System-limitations">20. System limitations</a></td></tr> |
| 19448 |
<tr><td></td><td valign="top"><a href="#index-set_002dbox_0021"><code>set-box!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19449 |
<tr><td></td><td valign="top"><a href="#index-setenv"><code>setenv</code></a></td><td valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td></tr> |
| 19450 |
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002darguments"><code>sfun-conversion-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19451 |
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dcode"><code>sfun-conversion-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19452 |
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dmessage"><code>sfun-conversion-exception-message</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19453 |
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_002dprocedure"><code>sfun-conversion-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19454 |
<tr><td></td><td valign="top"><a href="#index-sfun_002dconversion_002dexception_003f"><code>sfun-conversion-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></td></tr> |
| 19455 |
<tr><td></td><td valign="top"><a href="#index-shell_002dcommand"><code>shell-command</code></a></td><td valign="top"><a href="#Shell-command-execution">16.3 Shell command execution</a></td></tr> |
| 19456 |
<tr><td></td><td valign="top"><a href="#index-six_002dscript"><code>six-script</code></a></td><td valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td></tr> |
| 19457 |
<tr><td></td><td valign="top"><a href="#index-six_002e_0021"><code>six.!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19458 |
<tr><td></td><td valign="top"><a href="#index-six_002e_0021x"><code>six.!x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19459 |
<tr><td></td><td valign="top"><a href="#index-six_002e_0026x"><code>six.&x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19460 |
<tr><td></td><td valign="top"><a href="#index-six_002e_002ax"><code>six.*x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19461 |
<tr><td></td><td valign="top"><a href="#index-six_002e_002b_002bx"><code>six.++x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19462 |
<tr><td></td><td valign="top"><a href="#index-six_002e_002bx"><code>six.+x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19463 |
<tr><td></td><td valign="top"><a href="#index-six_002e_002d_002dx"><code>six.--x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19464 |
<tr><td></td><td valign="top"><a href="#index-six_002e_002dx"><code>six.-x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19465 |
<tr><td></td><td valign="top"><a href="#index-six_002earrow"><code>six.arrow</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19466 |
<tr><td></td><td valign="top"><a href="#index-six_002ebreak"><code>six.break</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19467 |
<tr><td></td><td valign="top"><a href="#index-six_002ecall"><code>six.call</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19468 |
<tr><td></td><td valign="top"><a href="#index-six_002ecase"><code>six.case</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19469 |
<tr><td></td><td valign="top"><a href="#index-six_002eclause"><code>six.clause</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19470 |
<tr><td></td><td valign="top"><a href="#index-six_002ecompound"><code>six.compound</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19471 |
<tr><td></td><td valign="top"><a href="#index-six_002econs"><code>six.cons</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19472 |
<tr><td></td><td valign="top"><a href="#index-six_002econtinue"><code>six.continue</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19473 |
<tr><td></td><td valign="top"><a href="#index-six_002edefine_002dprocedure"><code>six.define-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19474 |
<tr><td></td><td valign="top"><a href="#index-six_002edefine_002dvariable"><code>six.define-variable</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19475 |
<tr><td></td><td valign="top"><a href="#index-six_002edo_002dwhile"><code>six.do-while</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19476 |
<tr><td></td><td valign="top"><a href="#index-six_002edot"><code>six.dot</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19477 |
<tr><td></td><td valign="top"><a href="#index-six_002efor"><code>six.for</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19478 |
<tr><td></td><td valign="top"><a href="#index-six_002egoto"><code>six.goto</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19479 |
<tr><td></td><td valign="top"><a href="#index-six_002eidentifier"><code>six.identifier</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19480 |
<tr><td></td><td valign="top"><a href="#index-six_002eif"><code>six.if</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19481 |
<tr><td></td><td valign="top"><a href="#index-six_002eindex"><code>six.index</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19482 |
<tr><td></td><td valign="top"><a href="#index-six_002elabel"><code>six.label</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19483 |
<tr><td></td><td valign="top"><a href="#index-six_002elist"><code>six.list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19484 |
<tr><td></td><td valign="top"><a href="#index-six_002eliteral"><code>six.literal</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19485 |
<tr><td></td><td valign="top"><a href="#index-six_002emake_002darray"><code>six.make-array</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19486 |
<tr><td></td><td valign="top"><a href="#index-six_002enew"><code>six.new</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19487 |
<tr><td></td><td valign="top"><a href="#index-six_002enull"><code>six.null</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19488 |
<tr><td></td><td valign="top"><a href="#index-six_002eprefix"><code>six.prefix</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19489 |
<tr><td></td><td valign="top"><a href="#index-six_002eprocedure"><code>six.procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19490 |
<tr><td></td><td valign="top"><a href="#index-six_002eprocedure_002dbody"><code>six.procedure-body</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19491 |
<tr><td></td><td valign="top"><a href="#index-six_002ereturn"><code>six.return</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19492 |
<tr><td></td><td valign="top"><a href="#index-six_002eswitch"><code>six.switch</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19493 |
<tr><td></td><td valign="top"><a href="#index-six_002ewhile"><code>six.while</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19494 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0021_003dy"><code>six.x!=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19495 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0025_003dy"><code>six.x%=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19496 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0025y"><code>six.x%y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19497 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026_0026y"><code>six.x&&y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19498 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026_003dy"><code>six.x&=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19499 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_0026y"><code>six.x&y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19500 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002a_003dy"><code>six.x*=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19501 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002ay"><code>six.x*y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19502 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002b_002b"><code>six.x++</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19503 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002b_003dy"><code>six.x+=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19504 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002by"><code>six.x+y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19505 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002d_002d"><code>six.x--</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19506 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002d_003dy"><code>six.x-=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19507 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002dy"><code>six.x-y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19508 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002f_003dy"><code>six.x/=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19509 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_002fy"><code>six.x/y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19510 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003a_002dy"><code>six.x:-y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19511 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003a_003dy"><code>six.x:=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19512 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003ay"><code>six.x:y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19513 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003c_003dy"><code>six.x<<=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19514 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003cy"><code>six.x<<y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19515 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003dy"><code>six.x<=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19516 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003cy"><code>six.x<y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19517 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003d_003dy"><code>six.x==y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19518 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003dy"><code>six.x=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19519 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003dy"><code>six.x>=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19520 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003e_003dy"><code>six.x>>=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19521 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003ey"><code>six.x>>y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19522 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003ey"><code>six.x>y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19523 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_003fy_003az"><code>six.x?y:z</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19524 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_005e_003dy"><code>six.x^=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19525 |
<tr><td></td><td valign="top"><a href="#index-six_002ex_005ey"><code>six.x^y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19526 |
<tr><td></td><td valign="top"><a href="#index-six_002e_007ex"><code>six.~x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19527 |
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002daddress"><code>socket-info-address</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19528 |
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002dfamily"><code>socket-info-family</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19529 |
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_002dport_002dnumber"><code>socket-info-port-number</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19530 |
<tr><td></td><td valign="top"><a href="#index-socket_002dinfo_003f"><code>socket-info?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19531 |
<tr><td></td><td valign="top"><a href="#index-stack_002doverflow_002dexception_003f"><code>stack-overflow-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></td></tr> |
| 19532 |
<tr><td></td><td valign="top"><a href="#index-standard_002dbindings"><code>standard-bindings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19533 |
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_002darguments"><code>started-thread-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19534 |
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_002dprocedure"><code>started-thread-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19535 |
<tr><td></td><td valign="top"><a href="#index-started_002dthread_002dexception_003f"><code>started-thread-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19536 |
<tr><td></td><td valign="top"><a href="#index-step"><code>step</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19537 |
<tr><td></td><td valign="top"><a href="#index-step_002dlevel_002dset_0021"><code>step-level-set!</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19538 |
<tr><td></td><td valign="top"><a href="#index-string_002d_003ekeyword"><code>string->keyword</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19539 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003d_003f"><code>string-ci<=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19540 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003f"><code>string-ci<?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19541 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003d_003f"><code>string-ci=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19542 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003d_003f_002dhash"><code>string-ci=?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19543 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003d_003f"><code>string-ci>=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19544 |
<tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003f"><code>string-ci>?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19545 |
<tr><td></td><td valign="top"><a href="#index-string_002dshrink_0021"><code>string-shrink!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19546 |
<tr><td></td><td valign="top"><a href="#index-string_003c_003d_003f"><code>string<=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19547 |
<tr><td></td><td valign="top"><a href="#index-string_003c_003f"><code>string<?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19548 |
<tr><td></td><td valign="top"><a href="#index-string_003d_003f"><code>string=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19549 |
<tr><td></td><td valign="top"><a href="#index-string_003d_003f_002dhash"><code>string=?-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19550 |
<tr><td></td><td valign="top"><a href="#index-string_003e_003d_003f"><code>string>=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19551 |
<tr><td></td><td valign="top"><a href="#index-string_003e_003f"><code>string>?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr> |
| 19552 |
<tr><td></td><td valign="top"><a href="#index-subf32vector"><code>subf32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19553 |
<tr><td></td><td valign="top"><a href="#index-subf32vector_002dfill_0021"><code>subf32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19554 |
<tr><td></td><td valign="top"><a href="#index-subf32vector_002dmove_0021"><code>subf32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19555 |
<tr><td></td><td valign="top"><a href="#index-subf64vector"><code>subf64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19556 |
<tr><td></td><td valign="top"><a href="#index-subf64vector_002dfill_0021"><code>subf64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19557 |
<tr><td></td><td valign="top"><a href="#index-subf64vector_002dmove_0021"><code>subf64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19558 |
<tr><td></td><td valign="top"><a href="#index-subs16vector"><code>subs16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19559 |
<tr><td></td><td valign="top"><a href="#index-subs16vector_002dfill_0021"><code>subs16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19560 |
<tr><td></td><td valign="top"><a href="#index-subs16vector_002dmove_0021"><code>subs16vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19561 |
<tr><td></td><td valign="top"><a href="#index-subs32vector"><code>subs32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19562 |
<tr><td></td><td valign="top"><a href="#index-subs32vector_002dfill_0021"><code>subs32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19563 |
<tr><td></td><td valign="top"><a href="#index-subs32vector_002dmove_0021"><code>subs32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19564 |
<tr><td></td><td valign="top"><a href="#index-subs64vector"><code>subs64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19565 |
<tr><td></td><td valign="top"><a href="#index-subs64vector_002dfill_0021"><code>subs64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19566 |
<tr><td></td><td valign="top"><a href="#index-subs64vector_002dmove_0021"><code>subs64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19567 |
<tr><td></td><td valign="top"><a href="#index-subs8vector"><code>subs8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19568 |
<tr><td></td><td valign="top"><a href="#index-subs8vector_002dfill_0021"><code>subs8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19569 |
<tr><td></td><td valign="top"><a href="#index-subs8vector_002dmove_0021"><code>subs8vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19570 |
<tr><td></td><td valign="top"><a href="#index-substring_002dfill_0021"><code>substring-fill!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19571 |
<tr><td></td><td valign="top"><a href="#index-substring_002dmove_0021"><code>substring-move!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19572 |
<tr><td></td><td valign="top"><a href="#index-subu16vector"><code>subu16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19573 |
<tr><td></td><td valign="top"><a href="#index-subu16vector_002dfill_0021"><code>subu16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19574 |
<tr><td></td><td valign="top"><a href="#index-subu16vector_002dmove_0021"><code>subu16vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19575 |
<tr><td></td><td valign="top"><a href="#index-subu32vector"><code>subu32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19576 |
<tr><td></td><td valign="top"><a href="#index-subu32vector_002dfill_0021"><code>subu32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19577 |
<tr><td></td><td valign="top"><a href="#index-subu32vector_002dmove_0021"><code>subu32vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19578 |
<tr><td></td><td valign="top"><a href="#index-subu64vector"><code>subu64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19579 |
<tr><td></td><td valign="top"><a href="#index-subu64vector_002dfill_0021"><code>subu64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19580 |
<tr><td></td><td valign="top"><a href="#index-subu64vector_002dmove_0021"><code>subu64vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19581 |
<tr><td></td><td valign="top"><a href="#index-subu8vector"><code>subu8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19582 |
<tr><td></td><td valign="top"><a href="#index-subu8vector_002dfill_0021"><code>subu8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19583 |
<tr><td></td><td valign="top"><a href="#index-subu8vector_002dmove_0021"><code>subu8vector-move!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19584 |
<tr><td></td><td valign="top"><a href="#index-subvector"><code>subvector</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19585 |
<tr><td></td><td valign="top"><a href="#index-subvector_002dfill_0021"><code>subvector-fill!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19586 |
<tr><td></td><td valign="top"><a href="#index-subvector_002dmove_0021"><code>subvector-move!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19587 |
<tr><td></td><td valign="top"><a href="#index-symbol_002dhash"><code>symbol-hash</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19588 |
<tr><td></td><td valign="top"><a href="#index-syntax_002dcase"><code>syntax-case</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19589 |
<tr><td></td><td valign="top"><a href="#index-syntax_002drules"><code>syntax-rules</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19590 |
<tr><td></td><td valign="top"><a href="#index-system_002dstamp"><code>system-stamp</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19591 |
<tr><td></td><td valign="top"><a href="#index-system_002dtype"><code>system-type</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19592 |
<tr><td></td><td valign="top"><a href="#index-system_002dtype_002dstring"><code>system-type-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19593 |
<tr><td></td><td valign="top"><a href="#index-system_002dversion"><code>system-version</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19594 |
<tr><td></td><td valign="top"><a href="#index-system_002dversion_002dstring"><code>system-version-string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19595 |
<tr><td colspan="3"> <hr></td></tr> |
| 19596 |
<tr><th><a name="General-index-1_cp_letter-T">T</a></th><td></td><td></td></tr> |
| 19597 |
<tr><td></td><td valign="top"><a href="#index-table_002d_003elist"><code>table->list</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19598 |
<tr><td></td><td valign="top"><a href="#index-table_002dcopy"><code>table-copy</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19599 |
<tr><td></td><td valign="top"><a href="#index-table_002dfor_002deach"><code>table-for-each</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19600 |
<tr><td></td><td valign="top"><a href="#index-table_002dlength"><code>table-length</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19601 |
<tr><td></td><td valign="top"><a href="#index-table_002dmerge"><code>table-merge</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19602 |
<tr><td></td><td valign="top"><a href="#index-table_002dmerge_0021"><code>table-merge!</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19603 |
<tr><td></td><td valign="top"><a href="#index-table_002dref"><code>table-ref</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19604 |
<tr><td></td><td valign="top"><a href="#index-table_002dsearch"><code>table-search</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19605 |
<tr><td></td><td valign="top"><a href="#index-table_002dset_0021"><code>table-set!</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19606 |
<tr><td></td><td valign="top"><a href="#index-table_003f"><code>table?</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19607 |
<tr><td></td><td valign="top"><a href="#index-tables">tables</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr> |
| 19608 |
<tr><td></td><td valign="top"><a href="#index-tail_002dcalls">tail-calls</a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19609 |
<tr><td></td><td valign="top"><a href="#index-tail_002dcalls-1">tail-calls</a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19610 |
<tr><td></td><td valign="top"><a href="#index-tcp_002dclient_002dpeer_002dsocket_002dinfo"><code>tcp-client-peer-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19611 |
<tr><td></td><td valign="top"><a href="#index-tcp_002dclient_002dself_002dsocket_002dinfo"><code>tcp-client-self-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19612 |
<tr><td></td><td valign="top"><a href="#index-tcp_002dserver_002dsocket_002dinfo"><code>tcp-server-socket-info</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19613 |
<tr><td></td><td valign="top"><a href="#index-tcp_002dservice_002dregister_0021"><code>tcp-service-register!</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr> |
| 19614 |
<tr><td></td><td valign="top"><a href="#index-tcp_002dservice_002dunregister_0021"><code>tcp-service-unregister!</code></a></td><td valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td></tr> |
| 19615 |
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_002darguments"><code>terminated-thread-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19616 |
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_002dprocedure"><code>terminated-thread-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19617 |
<tr><td></td><td valign="top"><a href="#index-terminated_002dthread_002dexception_003f"><code>terminated-thread-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19618 |
<tr><td></td><td valign="top"><a href="#index-test_002dbit_002dfield_003f"><code>test-bit-field?</code></a></td><td valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td></tr> |
| 19619 |
<tr><td></td><td valign="top"><a href="#index-this_002dsource_002dfile"><code>this-source-file</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19620 |
<tr><td></td><td valign="top"><a href="#index-thread_002dbase_002dpriority"><code>thread-base-priority</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19621 |
<tr><td></td><td valign="top"><a href="#index-thread_002dbase_002dpriority_002dset_0021"><code>thread-base-priority-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19622 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dlist"><code>thread-group->thread-group-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19623 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dvector"><code>thread-group->thread-group-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19624 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dlist"><code>thread-group->thread-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19625 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dvector"><code>thread-group->thread-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19626 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dname"><code>thread-group-name</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19627 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dparent"><code>thread-group-parent</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19628 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dresume_0021"><code>thread-group-resume!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19629 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dsuspend_0021"><code>thread-group-suspend!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19630 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002dterminate_0021"><code>thread-group-terminate!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19631 |
<tr><td></td><td valign="top"><a href="#index-thread_002dgroup_003f"><code>thread-group?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19632 |
<tr><td></td><td valign="top"><a href="#index-thread_002dinit_0021"><code>thread-init!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19633 |
<tr><td></td><td valign="top"><a href="#index-thread_002dinterrupt_0021"><code>thread-interrupt!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19634 |
<tr><td></td><td valign="top"><a href="#index-thread_002djoin_0021"><code>thread-join!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19635 |
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002dextract_002dand_002drewind"><code>thread-mailbox-extract-and-rewind</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19636 |
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002dnext"><code>thread-mailbox-next</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19637 |
<tr><td></td><td valign="top"><a href="#index-thread_002dmailbox_002drewind"><code>thread-mailbox-rewind</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19638 |
<tr><td></td><td valign="top"><a href="#index-thread_002dname"><code>thread-name</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19639 |
<tr><td></td><td valign="top"><a href="#index-thread_002dpriority_002dboost"><code>thread-priority-boost</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19640 |
<tr><td></td><td valign="top"><a href="#index-thread_002dpriority_002dboost_002dset_0021"><code>thread-priority-boost-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19641 |
<tr><td></td><td valign="top"><a href="#index-thread_002dquantum"><code>thread-quantum</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19642 |
<tr><td></td><td valign="top"><a href="#index-thread_002dquantum_002dset_0021"><code>thread-quantum-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19643 |
<tr><td></td><td valign="top"><a href="#index-thread_002dreceive"><code>thread-receive</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19644 |
<tr><td></td><td valign="top"><a href="#index-thread_002dresume_0021"><code>thread-resume!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19645 |
<tr><td></td><td valign="top"><a href="#index-thread_002dsend"><code>thread-send</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19646 |
<tr><td></td><td valign="top"><a href="#index-thread_002dsleep_0021"><code>thread-sleep!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19647 |
<tr><td></td><td valign="top"><a href="#index-thread_002dspecific"><code>thread-specific</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19648 |
<tr><td></td><td valign="top"><a href="#index-thread_002dspecific_002dset_0021"><code>thread-specific-set!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19649 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstart_0021"><code>thread-start!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19650 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate"><code>thread-state</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19651 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dabnormally_002dterminated_002dreason"><code>thread-state-abnormally-terminated-reason</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19652 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dabnormally_002dterminated_003f"><code>thread-state-abnormally-terminated?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19653 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dactive_002dtimeout"><code>thread-state-active-timeout</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19654 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dactive_002dwaiting_002dfor"><code>thread-state-active-waiting-for</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19655 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dactive_003f"><code>thread-state-active?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19656 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dinitialized_003f"><code>thread-state-initialized?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19657 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dnormally_002dterminated_002dresult"><code>thread-state-normally-terminated-result</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19658 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002dnormally_002dterminated_003f"><code>thread-state-normally-terminated?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19659 |
<tr><td></td><td valign="top"><a href="#index-thread_002dstate_002duninitialized_003f"><code>thread-state-uninitialized?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19660 |
<tr><td></td><td valign="top"><a href="#index-thread_002dsuspend_0021"><code>thread-suspend!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19661 |
<tr><td></td><td valign="top"><a href="#index-thread_002dterminate_0021"><code>thread-terminate!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19662 |
<tr><td></td><td valign="top"><a href="#index-thread_002dthread_002dgroup"><code>thread-thread-group</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19663 |
<tr><td></td><td valign="top"><a href="#index-thread_002dyield_0021"><code>thread-yield!</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19664 |
<tr><td></td><td valign="top"><a href="#index-thread_003f"><code>thread?</code></a></td><td valign="top"><a href="#Procedures">13.9 Procedures</a></td></tr> |
| 19665 |
<tr><td></td><td valign="top"><a href="#index-threads">threads</a></td><td valign="top"><a href="#Threads">13. Threads</a></td></tr> |
| 19666 |
<tr><td></td><td valign="top"><a href="#index-time"><code>time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19667 |
<tr><td></td><td valign="top"><a href="#index-time_002d_003eseconds"><code>time->seconds</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19668 |
<tr><td></td><td valign="top"><a href="#index-time_003f"><code>time?</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr> |
| 19669 |
<tr><td></td><td valign="top"><a href="#index-timeout_002d_003etime"><code>timeout->time</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19670 |
<tr><td></td><td valign="top"><a href="#index-top"><code>top</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19671 |
<tr><td></td><td valign="top"><a href="#index-touch"><code>touch</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19672 |
<tr><td></td><td valign="top"><a href="#index-trace"><code>trace</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19673 |
<tr><td></td><td valign="top"><a href="#index-transcript_002doff"><code>transcript-off</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr> |
| 19674 |
<tr><td></td><td valign="top"><a href="#index-transcript_002don"><code>transcript-on</code></a></td><td valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td></tr> |
| 19675 |
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory"><code>tty-history</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19676 |
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory_002dmax_002dlength_002dset_0021"><code>tty-history-max-length-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19677 |
<tr><td></td><td valign="top"><a href="#index-tty_002dhistory_002dset_0021"><code>tty-history-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19678 |
<tr><td></td><td valign="top"><a href="#index-tty_002dmode_002dset_0021"><code>tty-mode-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19679 |
<tr><td></td><td valign="top"><a href="#index-tty_002dparen_002dbalance_002dduration_002dset_0021"><code>tty-paren-balance-duration-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19680 |
<tr><td></td><td valign="top"><a href="#index-tty_002dtext_002dattributes_002dset_0021"><code>tty-text-attributes-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19681 |
<tr><td></td><td valign="top"><a href="#index-tty_002dtype_002dset_0021"><code>tty-type-set!</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19682 |
<tr><td></td><td valign="top"><a href="#index-tty_003f"><code>tty?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19683 |
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002darg_002dnum"><code>type-exception-arg-num</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19684 |
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002darguments"><code>type-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19685 |
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002dprocedure"><code>type-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19686 |
<tr><td></td><td valign="top"><a href="#index-type_002dexception_002dtype_002did"><code>type-exception-type-id</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19687 |
<tr><td></td><td valign="top"><a href="#index-type_002dexception_003f"><code>type-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></td></tr> |
| 19688 |
<tr><td colspan="3"> <hr></td></tr> |
| 19689 |
<tr><th><a name="General-index-1_cp_letter-U">U</a></th><td></td><td></td></tr> |
| 19690 |
<tr><td></td><td valign="top"><a href="#index-u16vector"><code>u16vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19691 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002d_003elist"><code>u16vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19692 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dappend"><code>u16vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19693 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dcopy"><code>u16vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19694 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dfill_0021"><code>u16vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19695 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dlength"><code>u16vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19696 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dref"><code>u16vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19697 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dset_0021"><code>u16vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19698 |
<tr><td></td><td valign="top"><a href="#index-u16vector_002dshrink_0021"><code>u16vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19699 |
<tr><td></td><td valign="top"><a href="#index-u16vector_003f"><code>u16vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19700 |
<tr><td></td><td valign="top"><a href="#index-u32vector"><code>u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19701 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002d_003elist"><code>u32vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19702 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dappend"><code>u32vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19703 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dcopy"><code>u32vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19704 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dfill_0021"><code>u32vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19705 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dlength"><code>u32vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19706 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dref"><code>u32vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19707 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dset_0021"><code>u32vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19708 |
<tr><td></td><td valign="top"><a href="#index-u32vector_002dshrink_0021"><code>u32vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19709 |
<tr><td></td><td valign="top"><a href="#index-u32vector_003f"><code>u32vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19710 |
<tr><td></td><td valign="top"><a href="#index-u64vector"><code>u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19711 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002d_003elist"><code>u64vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19712 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dappend"><code>u64vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19713 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dcopy"><code>u64vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19714 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dfill_0021"><code>u64vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19715 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dlength"><code>u64vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19716 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dref"><code>u64vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19717 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dset_0021"><code>u64vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19718 |
<tr><td></td><td valign="top"><a href="#index-u64vector_002dshrink_0021"><code>u64vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19719 |
<tr><td></td><td valign="top"><a href="#index-u64vector_003f"><code>u64vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19720 |
<tr><td></td><td valign="top"><a href="#index-u8vector"><code>u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19721 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002d_003elist"><code>u8vector->list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19722 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002d_003eobject"><code>u8vector->object</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19723 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dappend"><code>u8vector-append</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19724 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dcopy"><code>u8vector-copy</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19725 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dfill_0021"><code>u8vector-fill!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19726 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dlength"><code>u8vector-length</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19727 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dref"><code>u8vector-ref</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19728 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dset_0021"><code>u8vector-set!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19729 |
<tr><td></td><td valign="top"><a href="#index-u8vector_002dshrink_0021"><code>u8vector-shrink!</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19730 |
<tr><td></td><td valign="top"><a href="#index-u8vector_003f"><code>u8vector?</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr> |
| 19731 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002dcode"><code>unbound-global-exception-code</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 19732 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002drte"><code>unbound-global-exception-rte</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 19733 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_002dvariable"><code>unbound-global-exception-variable</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 19734 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dglobal_002dexception_003f"><code>unbound-global-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></td></tr> |
| 19735 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_002darguments"><code>unbound-os-environment-variable-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19736 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_002dprocedure"><code>unbound-os-environment-variable-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19737 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dos_002denvironment_002dvariable_002dexception_003f"><code>unbound-os-environment-variable-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></td></tr> |
| 19738 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_002darguments"><code>unbound-serial-number-exception-arguments</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19739 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_002dprocedure"><code>unbound-serial-number-exception-procedure</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19740 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dserial_002dnumber_002dexception_003f"><code>unbound-serial-number-exception?</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr> |
| 19741 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_002darguments"><code>unbound-table-key-exception-arguments</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19742 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_002dprocedure"><code>unbound-table-key-exception-procedure</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19743 |
<tr><td></td><td valign="top"><a href="#index-unbound_002dtable_002dkey_002dexception_003f"><code>unbound-table-key-exception?</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr> |
| 19744 |
<tr><td></td><td valign="top"><a href="#index-unbox"><code>unbox</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19745 |
<tr><td></td><td valign="top"><a href="#index-unbreak"><code>unbreak</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19746 |
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002darguments"><code>uncaught-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19747 |
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002dprocedure"><code>uncaught-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19748 |
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_002dreason"><code>uncaught-exception-reason</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19749 |
<tr><td></td><td valign="top"><a href="#index-uncaught_002dexception_003f"><code>uncaught-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td></tr> |
| 19750 |
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_002darguments"><code>uninitialized-thread-exception-arguments</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19751 |
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_002dprocedure"><code>uninitialized-thread-exception-procedure</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19752 |
<tr><td></td><td valign="top"><a href="#index-uninitialized_002dthread_002dexception_003f"><code>uninitialized-thread-exception?</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19753 |
<tr><td></td><td valign="top"><a href="#index-uninterned_002dkeyword_003f"><code>uninterned-keyword?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19754 |
<tr><td></td><td valign="top"><a href="#index-uninterned_002dsymbol_003f"><code>uninterned-symbol?</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19755 |
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_002darguments"><code>unknown-keyword-argument-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19756 |
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_002dprocedure"><code>unknown-keyword-argument-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19757 |
<tr><td></td><td valign="top"><a href="#index-unknown_002dkeyword_002dargument_002dexception_003f"><code>unknown-keyword-argument-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19758 |
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_002darguments"><code>unterminated-process-exception-arguments</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19759 |
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_002dprocedure"><code>unterminated-process-exception-procedure</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19760 |
<tr><td></td><td valign="top"><a href="#index-unterminated_002dprocess_002dexception_003f"><code>unterminated-process-exception?</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19761 |
<tr><td></td><td valign="top"><a href="#index-untrace"><code>untrace</code></a></td><td valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td></tr> |
| 19762 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo"><code>user-info</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19763 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dgid"><code>user-info-gid</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19764 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dhome"><code>user-info-home</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19765 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dname"><code>user-info-name</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19766 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002dshell"><code>user-info-shell</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19767 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_002duid"><code>user-info-uid</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19768 |
<tr><td></td><td valign="top"><a href="#index-user_002dinfo_003f"><code>user-info?</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19769 |
<tr><td></td><td valign="top"><a href="#index-user_002dname"><code>user-name</code></a></td><td valign="top"><a href="#User-information">16.10 User information</a></td></tr> |
| 19770 |
<tr><td colspan="3"> <hr></td></tr> |
| 19771 |
<tr><th><a name="General-index-1_cp_letter-V">V</a></th><td></td><td></td></tr> |
| 19772 |
<tr><td></td><td valign="top"><a href="#index-vector_002dappend"><code>vector-append</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19773 |
<tr><td></td><td valign="top"><a href="#index-vector_002dcopy"><code>vector-copy</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19774 |
<tr><td></td><td valign="top"><a href="#index-vector_002dshrink_0021"><code>vector-shrink!</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19775 |
<tr><td></td><td valign="top"><a href="#index-void"><code>void</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr> |
| 19776 |
<tr><td colspan="3"> <hr></td></tr> |
| 19777 |
<tr><th><a name="General-index-1_cp_letter-W">W</a></th><td></td><td></td></tr> |
| 19778 |
<tr><td></td><td valign="top"><a href="#index-weak-references">weak references</a></td><td valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td></tr> |
| 19779 |
<tr><td></td><td valign="top"><a href="#index-will_002dexecute_0021"><code>will-execute!</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr> |
| 19780 |
<tr><td></td><td valign="top"><a href="#index-will_002dtestator"><code>will-testator</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr> |
| 19781 |
<tr><td></td><td valign="top"><a href="#index-will_003f"><code>will?</code></a></td><td valign="top"><a href="#Wills">11.2.1 Wills</a></td></tr> |
| 19782 |
<tr><td></td><td valign="top"><a href="#index-with_002dexception_002dcatcher"><code>with-exception-catcher</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 19783 |
<tr><td></td><td valign="top"><a href="#index-with_002dexception_002dhandler"><code>with-exception-handler</code></a></td><td valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td></tr> |
| 19784 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dfile"><code>with-input-from-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19785 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dport"><code>with-input-from-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19786 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dprocess"><code>with-input-from-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19787 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dstring"><code>with-input-from-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19788 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002du8vector"><code>with-input-from-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19789 |
<tr><td></td><td valign="top"><a href="#index-with_002dinput_002dfrom_002dvector"><code>with-input-from-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19790 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dfile"><code>with-output-to-file</code></a></td><td valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td></tr> |
| 19791 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dport"><code>with-output-to-port</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr> |
| 19792 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dprocess"><code>with-output-to-process</code></a></td><td valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td></tr> |
| 19793 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dstring"><code>with-output-to-string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr> |
| 19794 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002du8vector"><code>with-output-to-u8vector</code></a></td><td valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td></tr> |
| 19795 |
<tr><td></td><td valign="top"><a href="#index-with_002doutput_002dto_002dvector"><code>with-output-to-vector</code></a></td><td valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td></tr> |
| 19796 |
<tr><td></td><td valign="top"><a href="#index-write"><code>write</code></a></td><td valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td></tr> |
| 19797 |
<tr><td></td><td valign="top"><a href="#index-write_002dchar"><code>write-char</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19798 |
<tr><td></td><td valign="top"><a href="#index-write_002dsubstring"><code>write-substring</code></a></td><td valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td></tr> |
| 19799 |
<tr><td></td><td valign="top"><a href="#index-write_002dsubu8vector"><code>write-subu8vector</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr> |
| 19800 |
<tr><td></td><td valign="top"><a href="#index-write_002du8"><code>write-u8</code></a></td><td valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td></tr> |
| 19801 |
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_002darguments"><code>wrong-number-of-arguments-exception-arguments</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19802 |
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_002dprocedure"><code>wrong-number-of-arguments-exception-procedure</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19803 |
<tr><td></td><td valign="top"><a href="#index-wrong_002dnumber_002dof_002darguments_002dexception_003f"><code>wrong-number-of-arguments-exception?</code></a></td><td valign="top"><a href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></td></tr> |
| 19804 |
<tr><td colspan="3"> <hr></td></tr> |
| 19805 |
</table> |
| 19806 |
<table><tr><th valign="top">Jump to: </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a> |
| 19807 |
|
| 19808 |
<a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a> |
| 19809 |
|
| 19810 |
<a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a> |
| 19811 |
|
| 19812 |
<a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a> |
| 19813 |
|
| 19814 |
<a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a> |
| 19815 |
|
| 19816 |
<a href="#General-index-1_cp_symbol-6" class="summary-letter"><b><</b></a> |
| 19817 |
|
| 19818 |
<a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a> |
| 19819 |
|
| 19820 |
<a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>></b></a> |
| 19821 |
|
| 19822 |
<a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a> |
| 19823 |
|
| 19824 |
<a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a> |
| 19825 |
|
| 19826 |
<a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a> |
| 19827 |
|
| 19828 |
<a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a> |
| 19829 |
|
| 19830 |
<br> |
| 19831 |
<a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a> |
| 19832 |
|
| 19833 |
<a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a> |
| 19834 |
|
| 19835 |
<a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a> |
| 19836 |
|
| 19837 |
<a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a> |
| 19838 |
|
| 19839 |
<a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a> |
| 19840 |
|
| 19841 |
<a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a> |
| 19842 |
|
| 19843 |
<a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a> |
| 19844 |
|
| 19845 |
<a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a> |
| 19846 |
|
| 19847 |
<a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a> |
| 19848 |
|
| 19849 |
<a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a> |
| 19850 |
|
| 19851 |
<a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a> |
| 19852 |
|
| 19853 |
<a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a> |
| 19854 |
|
| 19855 |
<a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a> |
| 19856 |
|
| 19857 |
<a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a> |
| 19858 |
|
| 19859 |
<a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a> |
| 19860 |
|
| 19861 |
<a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a> |
| 19862 |
|
| 19863 |
<a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a> |
| 19864 |
|
| 19865 |
<a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a> |
| 19866 |
|
| 19867 |
<a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a> |
| 19868 |
|
| 19869 |
<a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a> |
| 19870 |
|
| 19871 |
<a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a> |
| 19872 |
|
| 19873 |
<a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a> |
| 19874 |
|
| 19875 |
</td></tr></table> |
| 19876 |
|
| 19877 |
<a name="SEC_Contents"></a><hr size="6"><br/><br/><br/> |
| 19878 |
<table cellpadding="1" cellspacing="1" border="0"> |
| 19879 |
<tr><td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" align="middle" width="32"></a></td> |
| 19880 |
<td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" align="middle" width="32"></a></td> |
| 19881 |
<td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" align="middle" width="32"></a></td> |
| 19882 |
</tr></table> |
| 19883 |
<h1>Table of Contents</h1> |
| 19884 |
<div class="contents"> |
| 19885 |
|
| 19886 |
<ul class="toc"> |
| 19887 |
<li><a name="toc-The-Gambit_002dC-system-1" href="#The-Gambit_002dC-system">1. The Gambit-C system</a> |
| 19888 |
<ul class="toc"> |
| 19889 |
<li><a name="toc-Accessing-the-system-files-1" href="#Accessing-the-system-files">1.1 Accessing the system files</a></li> |
| 19890 |
</ul></li> |
| 19891 |
<li><a name="toc-The-Gambit-Scheme-interpreter" href="#GSI">2. The Gambit Scheme interpreter</a> |
| 19892 |
<ul class="toc"> |
| 19893 |
<li><a name="toc-Interactive-mode-1" href="#GSI-interactive-mode">2.1 Interactive mode</a></li> |
| 19894 |
<li><a name="toc-Batch-mode-1" href="#GSI-batch-mode">2.2 Batch mode</a></li> |
| 19895 |
<li><a name="toc-Customization-1" href="#GSI-customization">2.3 Customization</a></li> |
| 19896 |
<li><a name="toc-Process-exit-status" href="#GSI-exit-status">2.4 Process exit status</a></li> |
| 19897 |
<li><a name="toc-Scheme-scripts-1" href="#Scheme-scripts">2.5 Scheme scripts</a> |
| 19898 |
<ul class="toc"> |
| 19899 |
<li><a name="toc-Scripts-under-UNIX-and-Mac-OS-X-1" href="#Scripts-under-UNIX-and-Mac-OS-X">2.5.1 Scripts under UNIX and Mac OS X</a></li> |
| 19900 |
<li><a name="toc-Scripts-under-Microsoft-Windows-1" href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></li> |
| 19901 |
<li><a name="toc-Compiling-scripts-1" href="#Compiling-scripts">2.5.3 Compiling scripts</a></li> |
| 19902 |
</ul> |
| 19903 |
</li> |
| 19904 |
</ul></li> |
| 19905 |
<li><a name="toc-The-Gambit-Scheme-compiler" href="#GSC">3. The Gambit Scheme compiler</a> |
| 19906 |
<ul class="toc"> |
| 19907 |
<li><a name="toc-Interactive-mode" href="#GSC-interactive-mode">3.1 Interactive mode</a></li> |
| 19908 |
<li><a name="toc-Customization" href="#GSC-customization">3.2 Customization</a></li> |
| 19909 |
<li><a name="toc-Batch-mode" href="#GSC-batch-mode">3.3 Batch mode</a></li> |
| 19910 |
<li><a name="toc-Link-files-1" href="#Link-files">3.4 Link files</a> |
| 19911 |
<ul class="toc"> |
| 19912 |
<li><a name="toc-Building-an-executable-program-1" href="#Building-an-executable-program">3.4.1 Building an executable program</a></li> |
| 19913 |
<li><a name="toc-Building-a-loadable-library-1" href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></li> |
| 19914 |
<li><a name="toc-Building-a-shared_002dlibrary-1" href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></li> |
| 19915 |
<li><a name="toc-Other-compilation-options-1" href="#Other-compilation-options">3.4.4 Other compilation options</a></li> |
| 19916 |
</ul></li> |
| 19917 |
<li><a name="toc-Procedures-specific-to-compiler-1" href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></li> |
| 19918 |
</ul></li> |
| 19919 |
<li><a name="toc-Runtime-options-1" href="#Runtime-options">4. Runtime options</a></li> |
| 19920 |
<li><a name="toc-Debugging-1" href="#Debugging">5. Debugging</a> |
| 19921 |
<ul class="toc"> |
| 19922 |
<li><a name="toc-Debugging-model-1" href="#Debugging-model">5.1 Debugging model</a></li> |
| 19923 |
<li><a name="toc-Debugging-commands-1" href="#Debugging-commands">5.2 Debugging commands</a></li> |
| 19924 |
<li><a name="toc-Debugging-example-1" href="#Debugging-example">5.3 Debugging example</a></li> |
| 19925 |
<li><a name="toc-Procedures-related-to-debugging-1" href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></li> |
| 19926 |
<li><a name="toc-Console-line_002dediting-1" href="#Console-line_002dediting">5.5 Console line-editing</a></li> |
| 19927 |
<li><a name="toc-Emacs-interface-1" href="#Emacs-interface">5.6 Emacs interface</a></li> |
| 19928 |
<li><a name="toc-GUIDE-1" href="#GUIDE">5.7 GUIDE</a></li> |
| 19929 |
</ul></li> |
| 19930 |
<li><a name="toc-Scheme-extensions-1" href="#Scheme-extensions">6. Scheme extensions</a> |
| 19931 |
<ul class="toc"> |
| 19932 |
<li><a name="toc-Extensions-to-standard-procedures-1" href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></li> |
| 19933 |
<li><a name="toc-Extensions-to-standard-special-forms-1" href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></li> |
| 19934 |
<li><a name="toc-Miscellaneous-extensions-1" href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></li> |
| 19935 |
<li><a name="toc-Undocumented-extensions-1" href="#Undocumented-extensions">6.4 Undocumented extensions</a></li> |
| 19936 |
</ul></li> |
| 19937 |
<li><a name="toc-Namespaces-1" href="#Namespaces">7. Namespaces</a></li> |
| 19938 |
<li><a name="toc-Characters-and-strings-1" href="#Characters-and-strings">8. Characters and strings</a> |
| 19939 |
<ul class="toc"> |
| 19940 |
<li><a name="toc-Extensions-to-character-procedures-1" href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></li> |
| 19941 |
<li><a name="toc-Extensions-to-string-procedures-1" href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></li> |
| 19942 |
</ul></li> |
| 19943 |
<li><a name="toc-Numbers-1" href="#Numbers">9. Numbers</a> |
| 19944 |
<ul class="toc"> |
| 19945 |
<li><a name="toc-Extensions-to-numeric-procedures-1" href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></li> |
| 19946 |
<li><a name="toc-IEEE-floating-point-arithmetic-1" href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></li> |
| 19947 |
<li><a name="toc-Integer-square-root-and-nth-root-1" href="#Integer-square-root-and-nth-root">9.3 Integer square root and nth root</a></li> |
| 19948 |
<li><a name="toc-Bitwise_002doperations-on-exact-integers-1" href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></li> |
| 19949 |
<li><a name="toc-Fixnum-specific-operations-1" href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></li> |
| 19950 |
<li><a name="toc-Flonum-specific-operations-1" href="#Flonum-specific-operations">9.6 Flonum specific operations</a></li> |
| 19951 |
<li><a name="toc-Pseudo-random-numbers-1" href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></li> |
| 19952 |
</ul></li> |
| 19953 |
<li><a name="toc-Homogeneous-vectors-1" href="#Homogeneous-vectors">10. Homogeneous vectors</a></li> |
| 19954 |
<li><a name="toc-Hashing-and-weak-references-1" href="#Hashing-and-weak-references">11. Hashing and weak references</a> |
| 19955 |
<ul class="toc"> |
| 19956 |
<li><a name="toc-Hashing-1" href="#Hashing">11.1 Hashing</a></li> |
| 19957 |
<li><a name="toc-Weak-references-1" href="#Weak-references">11.2 Weak references</a> |
| 19958 |
<ul class="toc"> |
| 19959 |
<li><a name="toc-Wills-1" href="#Wills">11.2.1 Wills</a></li> |
| 19960 |
<li><a name="toc-Tables-1" href="#Tables">11.2.2 Tables</a></li> |
| 19961 |
</ul> |
| 19962 |
</li> |
| 19963 |
</ul></li> |
| 19964 |
<li><a name="toc-Records-1" href="#Records">12. Records</a></li> |
| 19965 |
<li><a name="toc-Threads-1" href="#Threads">13. Threads</a> |
| 19966 |
<ul class="toc"> |
| 19967 |
<li><a name="toc-Introduction-1" href="#Introduction">13.1 Introduction</a></li> |
| 19968 |
<li><a name="toc-Thread-objects-1" href="#Thread-objects">13.2 Thread objects</a></li> |
| 19969 |
<li><a name="toc-Mutex-objects-1" href="#Mutex-objects">13.3 Mutex objects</a></li> |
| 19970 |
<li><a name="toc-Condition-variable-objects-1" href="#Condition-variable-objects">13.4 Condition variable objects</a></li> |
| 19971 |
<li><a name="toc-Fairness-1" href="#Fairness">13.5 Fairness</a></li> |
| 19972 |
<li><a name="toc-Memory-coherency-1" href="#Memory-coherency">13.6 Memory coherency</a></li> |
| 19973 |
<li><a name="toc-Timeouts-1" href="#Timeouts">13.7 Timeouts</a></li> |
| 19974 |
<li><a name="toc-Primordial-thread-1" href="#Primordial-thread">13.8 Primordial thread</a></li> |
| 19975 |
<li><a name="toc-Procedures-1" href="#Procedures">13.9 Procedures</a></li> |
| 19976 |
</ul></li> |
| 19977 |
<li><a name="toc-Dynamic-environment-1" href="#Dynamic-environment">14. Dynamic environment</a></li> |
| 19978 |
<li><a name="toc-Exceptions-1" href="#Exceptions">15. Exceptions</a> |
| 19979 |
<ul class="toc"> |
| 19980 |
<li><a name="toc-Exception_002dhandling-1" href="#Exception_002dhandling">15.1 Exception-handling</a></li> |
| 19981 |
<li><a name="toc-Exception-objects-related-to-memory-management-1" href="#Exception-objects-related-to-memory-management">15.2 Exception objects related to memory management</a></li> |
| 19982 |
<li><a name="toc-Exception-objects-related-to-the-host-environment-1" href="#Exception-objects-related-to-the-host-environment">15.3 Exception objects related to the host environment</a></li> |
| 19983 |
<li><a name="toc-Exception-objects-related-to-threads-1" href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></li> |
| 19984 |
<li><a name="toc-Exception-objects-related-to-C_002dinterface-1" href="#Exception-objects-related-to-C_002dinterface">15.5 Exception objects related to C-interface</a></li> |
| 19985 |
<li><a name="toc-Exception-objects-related-to-the-reader-1" href="#Exception-objects-related-to-the-reader">15.6 Exception objects related to the reader</a></li> |
| 19986 |
<li><a name="toc-Exception-objects-related-to-evaluation-and-compilation-1" href="#Exception-objects-related-to-evaluation-and-compilation">15.7 Exception objects related to evaluation and compilation</a></li> |
| 19987 |
<li><a name="toc-Exception-objects-related-to-type-checking-1" href="#Exception-objects-related-to-type-checking">15.8 Exception objects related to type checking</a></li> |
| 19988 |
<li><a name="toc-Exception-objects-related-to-procedure-call-1" href="#Exception-objects-related-to-procedure-call">15.9 Exception objects related to procedure call</a></li> |
| 19989 |
<li><a name="toc-Other-exception-objects-1" href="#Other-exception-objects">15.10 Other exception objects</a></li> |
| 19990 |
</ul></li> |
| 19991 |
<li><a name="toc-Host-environment-1" href="#Host-environment">16. Host environment</a> |
| 19992 |
<ul class="toc"> |
| 19993 |
<li><a name="toc-Handling-of-file-names-1" href="#Handling-of-file-names">16.1 Handling of file names</a></li> |
| 19994 |
<li><a name="toc-Filesystem-operations-1" href="#Filesystem-operations">16.2 Filesystem operations</a></li> |
| 19995 |
<li><a name="toc-Shell-command-execution-1" href="#Shell-command-execution">16.3 Shell command execution</a></li> |
| 19996 |
<li><a name="toc-Process-termination-1" href="#Process-termination">16.4 Process termination</a></li> |
| 19997 |
<li><a name="toc-Command-line-arguments-1" href="#Command-line-arguments">16.5 Command line arguments</a></li> |
| 19998 |
<li><a name="toc-Environment-variables-1" href="#Environment-variables">16.6 Environment variables</a></li> |
| 19999 |
<li><a name="toc-Measuring-time-1" href="#Measuring-time">16.7 Measuring time</a></li> |
| 20000 |
<li><a name="toc-File-information-1" href="#File-information">16.8 File information</a></li> |
| 20001 |
<li><a name="toc-Group-information-1" href="#Group-information">16.9 Group information</a></li> |
| 20002 |
<li><a name="toc-User-information-1" href="#User-information">16.10 User information</a></li> |
| 20003 |
<li><a name="toc-Host-information-1" href="#Host-information">16.11 Host information</a></li> |
| 20004 |
<li><a name="toc-Service-information-1" href="#Service-information">16.12 Service information</a></li> |
| 20005 |
<li><a name="toc-Protocol-information-1" href="#Protocol-information">16.13 Protocol information</a></li> |
| 20006 |
<li><a name="toc-Network-information-1" href="#Network-information">16.14 Network information</a></li> |
| 20007 |
</ul></li> |
| 20008 |
<li><a name="toc-I_002fO-and-ports-1" href="#I_002fO-and-ports">17. I/O and ports</a> |
| 20009 |
<ul class="toc"> |
| 20010 |
<li><a name="toc-Unidirectional-and-bidirectional-ports-1" href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></li> |
| 20011 |
<li><a name="toc-Port-classes-1" href="#Port-classes">17.2 Port classes</a></li> |
| 20012 |
<li><a name="toc-Port-settings-1" href="#Port-settings">17.3 Port settings</a></li> |
| 20013 |
<li><a name="toc-Object_002dports-1" href="#Object_002dports">17.4 Object-ports</a> |
| 20014 |
<ul class="toc"> |
| 20015 |
<li><a name="toc-Object_002dport-settings-1" href="#Object_002dport-settings">17.4.1 Object-port settings</a></li> |
| 20016 |
<li><a name="toc-Object_002dport-operations-1" href="#Object_002dport-operations">17.4.2 Object-port operations</a></li> |
| 20017 |
</ul></li> |
| 20018 |
<li><a name="toc-Character_002dports-1" href="#Character_002dports">17.5 Character-ports</a> |
| 20019 |
<ul class="toc"> |
| 20020 |
<li><a name="toc-Character_002dport-settings-1" href="#Character_002dport-settings">17.5.1 Character-port settings</a></li> |
| 20021 |
<li><a name="toc-Character_002dport-operations-1" href="#Character_002dport-operations">17.5.2 Character-port operations</a></li> |
| 20022 |
</ul></li> |
| 20023 |
<li><a name="toc-Byte_002dports-1" href="#Byte_002dports">17.6 Byte-ports</a> |
| 20024 |
<ul class="toc"> |
| 20025 |
<li><a name="toc-Byte_002dport-settings-1" href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></li> |
| 20026 |
<li><a name="toc-Byte_002dport-operations-1" href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></li> |
| 20027 |
</ul></li> |
| 20028 |
<li><a name="toc-Device_002dports-1" href="#Device_002dports">17.7 Device-ports</a> |
| 20029 |
<ul class="toc"> |
| 20030 |
<li><a name="toc-Filesystem-devices-1" href="#Filesystem-devices">17.7.1 Filesystem devices</a></li> |
| 20031 |
<li><a name="toc-Process-devices-1" href="#Process-devices">17.7.2 Process devices</a></li> |
| 20032 |
<li><a name="toc-Network-devices-1" href="#Network-devices">17.7.3 Network devices</a></li> |
| 20033 |
</ul></li> |
| 20034 |
<li><a name="toc-Directory_002dports-1" href="#Directory_002dports">17.8 Directory-ports</a></li> |
| 20035 |
<li><a name="toc-Vector_002dports-1" href="#Vector_002dports">17.9 Vector-ports</a></li> |
| 20036 |
<li><a name="toc-String_002dports-1" href="#String_002dports">17.10 String-ports</a></li> |
| 20037 |
<li><a name="toc-U8vector_002dports-1" href="#U8vector_002dports">17.11 U8vector-ports</a></li> |
| 20038 |
<li><a name="toc-Other-procedures-related-to-I_002fO-1" href="#Other-procedures-related-to-I_002fO">17.12 Other procedures related to I/O</a></li> |
| 20039 |
</ul></li> |
| 20040 |
<li><a name="toc-Lexical-syntax-and-readtables-1" href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a> |
| 20041 |
<ul class="toc"> |
| 20042 |
<li><a name="toc-Readtables-1" href="#Readtables">18.1 Readtables</a></li> |
| 20043 |
<li><a name="toc-Boolean-syntax-1" href="#Boolean-syntax">18.2 Boolean syntax</a></li> |
| 20044 |
<li><a name="toc-Character-syntax-1" href="#Character-syntax">18.3 Character syntax</a></li> |
| 20045 |
<li><a name="toc-String-syntax-1" href="#String-syntax">18.4 String syntax</a></li> |
| 20046 |
<li><a name="toc-Symbol-syntax-1" href="#Symbol-syntax">18.5 Symbol syntax</a></li> |
| 20047 |
<li><a name="toc-Keyword-syntax-1" href="#Keyword-syntax">18.6 Keyword syntax</a></li> |
| 20048 |
<li><a name="toc-Box-syntax-1" href="#Box-syntax">18.7 Box syntax</a></li> |
| 20049 |
<li><a name="toc-Number-syntax-1" href="#Number-syntax">18.8 Number syntax</a></li> |
| 20050 |
<li><a name="toc-Homogeneous-vector-syntax-1" href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></li> |
| 20051 |
<li><a name="toc-Special-_0023_0021-syntax-1" href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></li> |
| 20052 |
<li><a name="toc-Multiline-comment-syntax-1" href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></li> |
| 20053 |
<li><a name="toc-Scheme-infix-syntax-extension-1" href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a> |
| 20054 |
<ul class="toc"> |
| 20055 |
<li><a name="toc-SIX-grammar" href="#SIX-grammar">18.12.1 SIX grammar</a></li> |
| 20056 |
<li><a name="toc-SIX-semantics" href="#SIX-semantics">18.12.2 SIX semantics</a></li> |
| 20057 |
</ul> |
| 20058 |
</li> |
| 20059 |
</ul></li> |
| 20060 |
<li><a name="toc-C_002dinterface-1" href="#C_002dinterface">19. C-interface</a> |
| 20061 |
<ul class="toc"> |
| 20062 |
<li><a name="toc-The-mapping-of-types-between-C-and-Scheme" href="#mapping-of-types">19.1 The mapping of types between C and Scheme</a></li> |
| 20063 |
<li><a name="toc-The-c_002ddeclare-special-form" href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></li> |
| 20064 |
<li><a name="toc-The-c_002dinitialize-special-form" href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></li> |
| 20065 |
<li><a name="toc-The-c_002dlambda-special-form" href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></li> |
| 20066 |
<li><a name="toc-The-c_002ddefine-special-form" href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></li> |
| 20067 |
<li><a name="toc-The-c_002ddefine_002dtype-special-form" href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></li> |
| 20068 |
<li><a name="toc-Continuations-and-the-C_002dinterface" href="#continuations">19.7 Continuations and the C-interface</a></li> |
| 20069 |
</ul></li> |
| 20070 |
<li><a name="toc-System-limitations-1" href="#System-limitations">20. System limitations</a></li> |
| 20071 |
<li><a name="toc-Copyright-and-license-1" href="#Copyright-and-license">21. Copyright and license</a></li> |
| 20072 |
<li><a name="toc-General-index-1" href="#General-index">General index</a></li> |
| 20073 |
</ul> |
| 20074 |
</div> |
| 20075 |
|
| 20076 |
<hr size="1"> |
| 20077 |
<p> |
| 20078 |
<font size="-1"> |
| 20079 |
This document was generated by <em>Marc Feeley</em> on <em>September 18, 2014</em> using <a href="event:browse:http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>. |
| 20080 |
</font> |
| 20081 |
<br> |
| 20082 |
|
| 20083 |
</p> |
| 20084 |
</body> |
| 20085 |
</html> |