Improve grd program in Gambit REPL iOS example (add "mv" command, on Windows provide...
[gambit-c.git] / examples / iOS / gambit-c.html
blobc636a2e5d5efa955f8b497e508b927515822cb0a
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 16, 2011 by texi2html 1.82
4 texi2html was written by:
5 Lionel Cons <Lionel.Cons@cern.ch> (original author)
6 Karl Berry <karl@freefriends.org>
7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
8 and many others.
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
11 -->
12 <head>
13 <title>Gambit-C, a portable implementation of Scheme</title>
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 <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.25, maximum-scale=1.6">
23 <script>
25 function gestureStart() {
26 var metas = document.getElementsByTagName('meta');
27 for (var i=0; i<metas.length; i++) {
28 if (metas[i].name === "viewport") {
29 metas[i].content = "width=device-width, initial-scale=1.0, minimum-scale=0.25, maximum-scale=1.6";
34 document.addEventListener("gesturestart", gestureStart, false);
36 </script>
37 <style type="text/css">
38 <!--
39 body { -webkit-text-size-adjust:none }
40 a.summary-letter {text-decoration: none}
41 a:link {color: #0000e0}
42 a:visited {color: #0000e0}
43 blockquote.smallquotation {font-size: smaller}
44 pre.display {font-family: serif}
45 pre.format {font-size: smaller}
46 pre.menu-comment {font-family: serif}
47 pre.menu-preformatted {font-family: serif}
48 pre.smalldisplay {font-family: serif; font-size: smaller}
49 pre.smallexample {font-size: smaller}
50 pre.example {font-size: smaller}
51 pre.smallformat {font-family: serif; font-size: smaller}
52 pre.smalllisp {font-size: smaller}
53 span.roman {font-family:serif; font-weight:normal;}
54 span.sansserif {font-family:sans-serif; font-weight:normal;}
55 ul.toc {list-style: none}
56 -->
57 </style>
60 </head>
62 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000" onLoad="window.location='event:loaded'">
64 <a name="Top"></a>
65 <table cellpadding="1" cellspacing="1" border="0">
66 <tr><td valign="middle" align="left"><a href="#Top" title="Previous section in reading order"><img src="button-empty.png" border="0" alt="Back: Gambit-C" align="middle" width="32"></a></td>
67 <td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 1.1 Accessing the system files" align="middle" width="32"></a></td>
68 <td valign="middle" align="left"> &nbsp; </td>
69 <td valign="middle" align="left"><a href="#Top" title="Beginning of this chapter or previous chapter"><img src="button-empty.png" border="0" alt="FastBack: Gambit-C" align="middle" width="32"></a></td>
70 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-empty.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
71 <td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
72 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
73 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
74 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
75 </tr></table>
77 <a name="Gambit_002dC"></a>
78 <h1 class="settitle">Gambit-C</h1>
79 <a name="index-Gambit_002dC"></a>
80 <a name="index-Scheme_002c-implementation-of"></a>
82 <br>
84 <center><a href="gambit-c.pdf">[View PDF version]</a></center>
86 <p>This manual documents Gambit-C. It covers release v4.6.1.
87 </p>
88 <table class="menu" border="0" cellspacing="0">
89 <tr><td align="left" valign="top"><a href="#The-Gambit_002dC-system">1. The Gambit-C system</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
90 <tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
91 <tr><td align="left" valign="top"><a href="#GSI">2. The Gambit Scheme interpreter</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
92 <tr><td align="left" valign="top"><a href="#GSC">3. The Gambit Scheme compiler</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
93 <tr><td align="left" valign="top"><a href="#Runtime-options">4. Runtime options</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
94 <tr><td align="left" valign="top"><a href="#Debugging">5. Debugging</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
95 <tr><td align="left" valign="top"><a href="#Scheme-extensions">6. Scheme extensions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
96 <tr><td align="left" valign="top"><a href="#Namespaces">7. Namespaces</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
97 <tr><td align="left" valign="top"><a href="#Characters-and-strings">8. Characters and strings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
98 <tr><td align="left" valign="top"><a href="#Numbers">9. Numbers</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
99 <tr><td align="left" valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
100 <tr><td align="left" valign="top"><a href="#Hashing-and-weak-references">11. Hashing and weak references</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
101 <tr><td align="left" valign="top"><a href="#Records">12. Records</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
102 <tr><td align="left" valign="top"><a href="#Threads">13. Threads</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
103 <tr><td align="left" valign="top"><a href="#Dynamic-environment">14. Dynamic environment</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
104 <tr><td align="left" valign="top"><a href="#Exceptions">15. Exceptions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
105 <tr><td align="left" valign="top"><a href="#Host-environment">16. Host environment</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
106 <tr><td align="left" valign="top"><a href="#I_002fO-and-ports">17. I/O and ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
107 <tr><td align="left" valign="top"><a href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
108 <tr><td align="left" valign="top"><a href="#C_002dinterface">19. C-interface</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
109 <tr><td align="left" valign="top"><a href="#System-limitations">20. System limitations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
110 <tr><td align="left" valign="top"><a href="#Copyright-and-license">21. Copyright and license</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
111 <tr><td align="left" valign="top"><a href="#General-index">General index</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
112 </table>
115 <hr size="1">
116 <a name="The-Gambit_002dC-system"></a>
117 <table cellpadding="1" cellspacing="1" border="0">
118 <tr><td valign="middle" align="left"><a href="#Top" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: Gambit-C" align="middle" width="32"></a></td>
119 <td valign="middle" align="left"><a href="#Accessing-the-system-files" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 1.1 Accessing the system files" align="middle" width="32"></a></td>
120 <td valign="middle" align="left"> &nbsp; </td>
121 <td valign="middle" align="left"><a href="#Top" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: Gambit-C" align="middle" width="32"></a></td>
122 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
123 <td valign="middle" align="left"><a href="#GSI" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
124 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
125 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
126 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
127 </tr></table>
128 <a name="The-Gambit_002dC-system-1"></a>
129 <h1 class="chapter">1. The Gambit-C system</h1>
130 <a name="index-Gambit"></a>
131 <a name="index-Gambit_002dC-1"></a>
132 <a name="index-Scheme"></a>
134 <a name="index-gsi"></a>
135 <a name="index-gsc"></a>
136 <p>The Gambit programming system is a full implementation of the Scheme
137 language which conforms to the R4RS, R5RS and IEEE Scheme standards. It
138 consists of two main programs: <code>gsi</code>, the Gambit Scheme
139 interpreter, and <code>gsc</code>, the Gambit Scheme compiler.
140 </p>
141 <p>Gambit-C is a version of the Gambit programming system in which the
142 compiler generates portable C code, making the whole Gambit-C system and
143 the programs compiled with it easily portable to many computer
144 architectures for which a C compiler is available. With appropriate
145 declarations in the source code the executable programs generated by
146 the compiler run roughly as fast as equivalent C programs.
147 </p>
148 <p>For the most up to date information on Gambit and add-on packages
149 please check the Gambit web page at
150 <a href="http://gambit.iro.umontreal.ca">http://gambit.iro.umontreal.ca</a>. The web page has links to the
151 Gambit mailing list, the bug reporting system, and the source code
152 repository.
153 </p>
154 <table class="menu" border="0" cellspacing="0">
155 <tr><td align="left" valign="top"><a href="#Accessing-the-system-files">1.1 Accessing the system files</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
156 </table>
158 <hr size="1">
159 <a name="Accessing-the-system-files"></a>
160 <table cellpadding="1" cellspacing="1" border="0">
161 <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" alt="Back: 1. The Gambit-C system" align="middle" width="32"></a></td>
162 <td valign="middle" align="left"><a href="#GSI" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
163 <td valign="middle" align="left"> &nbsp; </td>
164 <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" alt="FastBack: 1. The Gambit-C system" align="middle" width="32"></a></td>
165 <td valign="middle" align="left"><a href="#The-Gambit_002dC-system" title="Up section"><img src="button-up.png" border="0" alt="Up: 1. The Gambit-C system" align="middle" width="32"></a></td>
166 <td valign="middle" align="left"><a href="#GSI" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
167 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
168 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
169 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
170 </tr></table>
171 <a name="Accessing-the-system-files-1"></a>
172 <h2 class="section">1.1 Accessing the system files</h2>
174 <p>Files related to Gambit, such as executables, libraries and header files,
175 are stored in multiple <em>Gambit installation directories</em>.
176 Gambit may be installed on a system according to two different
177 installation models.
178 </p>
179 <p>In the first model there is a single directory where all the Gambit
180 installation directories are stored. This <em>central installation
181 directory</em> is typically <code>/usr/local/Gambit-C</code> under UNIX,
182 <code>/Library/Gambit-C</code> under Mac OS X and <code>C:/Program
183 Files/Gambit-C</code> under Microsoft Windows. This may have been
184 overridden when the system was built with the command <samp>configure
185 --prefix=/my/Gambit-C</samp>. If the system was built with the command
186 <samp>configure --enable-multiple-versions</samp> then the central
187 installation directory is <code><span class="roman"><i>prefix</i></span>/<span class="roman"><i>version</i></span></code>, where
188 <code><span class="roman"><i>version</i></span></code> is the system version string
189 (e.g. <code>v4.6.1</code> for Gambit v4.6.1). Moreover,
190 <code><span class="roman"><i>prefix</i></span>/current</code> will be a symbolic link which points to
191 the central installation directory. In this model, the Gambit
192 installation directory named <var>X</var> is simply the subdirectory
193 <var>X</var> of the central installation directory.
194 </p>
195 <p>In the second model some or all of the Gambit installation directories
196 are stored in installation specific directories. The location of
197 these directories is assigned when the system is built using the
198 command <samp>configure --bindir=/my/bin --includedir=/my/include
199 --libdir=/my/lib</samp>.
200 </p>
201 <p>The advantage of the first model is that it is easy to have multiple
202 versions of Gambit coexist and to remove all the files of a given
203 version. However, the second model may be necessary to conform to the
204 package installation conventions of some operating systems.
205 </p>
206 <p>Executable programs such as the interpreter <code>gsi</code> and compiler
207 <code>gsc</code> can be found in the <code>bin</code> installation directory.
208 Adding this directory to the <code>PATH</code> environment variable allows
209 these programs to be started by simply entering their name. This is
210 done automatically by the Mac OS X and Microsoft Windows installers.
211 </p>
212 <p>The runtime library is located in the <code>lib</code> installation
213 directory. When the system&rsquo;s runtime library is built as a
214 shared-library (with the command <samp>configure --enable-shared</samp>) all
215 programs built with Gambit-C, including the interpreter and compiler,
216 need to find this library when they are executed and consequently this
217 directory must be in the path searched by the system for
218 shared-libraries. This path is normally specified through an
219 environment variable which is <code>LD_LIBRARY_PATH</code> on most versions
220 of UNIX, <code>LIBPATH</code> on AIX, <code>SHLIB_PATH</code> on HPUX,
221 <code>DYLD_LIBRARY_PATH</code> on Mac OS X, and <code>PATH</code> on Microsoft
222 Windows. If the shell is <code>sh</code>, the setting of the path can be
223 made for a single execution by prefixing the program name with the
224 environment variable assignment, as in:
225 </p>
226 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>$ <b>LD_LIBRARY_PATH=/usr/local/Gambit-C/lib gsi</b>
227 </pre></td></tr></table>
229 <p>A similar problem exists with the Gambit header file <code>gambit.h</code>,
230 located in the <code>include</code> installation directory. This header
231 file is needed for compiling Scheme programs with the Gambit-C
232 compiler. When the C compiler is being called explicitly it may be
233 necessary to use a <code>-I<var>&lt;dir&gt;</var></code> command line option to
234 indicate where to find header files and a <code>-L<var>&lt;dir&gt;</var></code> command
235 line option to indicate where to find libraries.
236 </p>
237 <p>Access to both of these files can be simplified by creating a link to
238 them in the appropriate system directories (special privileges may
239 however be required):
240 </p>
241 <table><tr><td>&nbsp;</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>
242 $ <b>ln -s /usr/local/Gambit-C/include/gambit.h /usr/include</b>
243 </pre></td></tr></table>
245 <p>Alternatively these files can be copied or linked in the directory
246 where the C compiler is invoked (this requires no special privileges).
247 </p>
248 <p>Another approach is to set some environment variables which
249 are used to tell the C compiler where to find header files
250 and libraries. For example, the following settings can be
251 used for the <code>gcc</code> C compiler:
252 </p>
253 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>$ <b>export LIBRARY_PATH=/usr/local/Gambit-C/lib</b>
254 $ <b>export CPATH=/usr/local/Gambit-C/include</b>
255 </pre></td></tr></table>
257 <p>Note that this may have been done by the installation process. In
258 particular, the Mac OS X and Microsoft Windows prebuilt installers set
259 up the environment so that the <code>gcc</code> compiler finds these files
260 automatically.
261 </p>
263 <hr size="1">
264 <a name="GSI"></a>
265 <table cellpadding="1" cellspacing="1" border="0">
266 <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" alt="Back: 1.1 Accessing the system files" align="middle" width="32"></a></td>
267 <td valign="middle" align="left"><a href="#GSI-interactive-mode" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.1 Interactive mode" align="middle" width="32"></a></td>
268 <td valign="middle" align="left"> &nbsp; </td>
269 <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" alt="FastBack: 1. The Gambit-C system" align="middle" width="32"></a></td>
270 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
271 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
272 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
273 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
274 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
275 </tr></table>
276 <a name="The-Gambit-Scheme-interpreter"></a>
277 <h1 class="chapter">2. The Gambit Scheme interpreter</h1>
278 <a name="index-interpreter"></a>
280 <p>Synopsis:
281 </p>
282 <table><tr><td>&nbsp;</td><td><pre class="example"><b></b>gsi <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,&hellip;<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>&hellip;
283 </pre></td></tr></table>
285 <a name="index-gsi-1"></a>
286 <p>The interpreter is executed in <em>interactive mode</em> when no file or
287 <samp>-</samp> or <samp>-e</samp> option is given on the command line. Otherwise
288 the interpreter is executed in <em>batch mode</em>. The <samp>-i</samp> option
289 is ignored by the interpreter. The initialization file will be
290 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
291 string, system time stamp, operating system type, and configure script
292 options on standard output and exits. Runtime options are explained
293 in <a href="#Runtime-options">Runtime options</a>.
294 </p>
295 <table class="menu" border="0" cellspacing="0">
296 <tr><td align="left" valign="top"><a href="#GSI-interactive-mode">2.1 Interactive mode</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
297 <tr><td align="left" valign="top"><a href="#GSI-batch-mode">2.2 Batch mode</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
298 <tr><td align="left" valign="top"><a href="#GSI-customization">2.3 Customization</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
299 <tr><td align="left" valign="top"><a href="#GSI-exit-status">2.4 Process exit status</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
300 <tr><td align="left" valign="top"><a href="#Scheme-scripts">2.5 Scheme scripts</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
301 </table>
303 <hr size="1">
304 <a name="GSI-interactive-mode"></a>
305 <table cellpadding="1" cellspacing="1" border="0">
306 <tr><td valign="middle" align="left"><a href="#GSI" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
307 <td valign="middle" align="left"><a href="#GSI-batch-mode" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.2 Batch mode" align="middle" width="32"></a></td>
308 <td valign="middle" align="left"> &nbsp; </td>
309 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
310 <td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up.png" border="0" alt="Up: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
311 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
312 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
313 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
314 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
315 </tr></table>
316 <a name="Interactive-mode-1"></a>
317 <h2 class="section">2.1 Interactive mode</h2>
319 <p>In interactive mode a read-eval-print loop (REPL) is started for the
320 user to interact with the interpreter. At each iteration of this loop
321 the interpreter displays a prompt, reads a command and executes it.
322 The commands can be expressions to evaluate (the typical case)
323 or special commands related to debugging, for example <samp>,q</samp> to
324 terminate the process (for a complete list of commands see
325 <a href="#Debugging">Debugging</a>). Most commands produce some output, such as the
326 value or error message resulting from an evaluation.
327 </p>
328 <p>The input and output of the interaction is done on the
329 <em>interaction channel</em>. The interaction channel can be specified
330 through the runtime options but if none is specified the system uses a
331 reasonable default that depends on the system&rsquo;s configuration. When
332 the system&rsquo;s runtime library was built with support for GUIDE, the
333 Gambit Universal IDE (with the command <samp>configure
334 --enable-guide</samp>) the interaction channel corresponds to the
335 <em>console window</em> of the primordial thread (for details see
336 <a href="#GUIDE">GUIDE</a>), otherwise the interaction channel is the user&rsquo;s
337 <em>console</em>, also known as the <em>controlling terminal</em> in the
338 UNIX world. When the REPL starts, the ports associated with
339 <samp>(current-input-port)</samp>, <samp>(current-output-port)</samp> and
340 <samp>(current-error-port)</samp> all refer to the interaction channel.
341 </p>
342 <p>Expressions are evaluated in the global <em>interaction environment</em>.
343 The interpreter adds to this environment any definition entered using
344 the <code>define</code> and <code>define-macro</code>
345 special forms. Once the evaluation of an expression is completed, the
346 value or values resulting from the evaluation are output to the
347 interaction channel by the pretty printer. The special &ldquo;void&rdquo;
348 object is not output. This object is returned by most procedures and
349 special forms which the Scheme standard defines as returning an
350 unspecified value (e.g. <code>write</code>, <code>set!</code>, <code>define</code>).
351 </p>
352 <p>Here is a sample interaction with <code>gsi</code>:
353 </p>
354 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi</b>
355 Gambit v4.6.1
357 &gt; <b>(define (fact n) (if (&lt; n 2) 1 (* n (fact (- n 1)))))</b>
358 &gt; <b>(map fact '(1 2 3 4 5 6))</b>
359 (1 2 6 24 120 720)
360 &gt; <b>(values (fact 10) (fact 40))</b>
361 3628800
362 815915283247897734345611269596115894272000000000
363 &gt; <b>,q</b>
364 </pre></td></tr></table>
366 <p>What happens when errors occur is explained in <a href="#Debugging">Debugging</a>.
367 </p>
368 <hr size="1">
369 <a name="GSI-batch-mode"></a>
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" alt="Back: 2.1 Interactive mode" 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" alt="Forward: 2.3 Customization" align="middle" width="32"></a></td>
373 <td valign="middle" align="left"> &nbsp; </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" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
375 <td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up.png" border="0" alt="Up: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
376 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
377 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
378 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
379 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
380 </tr></table>
381 <a name="Batch-mode-1"></a>
382 <h2 class="section">2.2 Batch mode</h2>
384 <p>In batch mode the command line arguments denote files to be loaded,
385 REPL interactions to start (<samp>-</samp> option), and expressions to be
386 evaluated (<samp>-e</samp> option). Note that the <samp>-</samp> and <samp>-e</samp>
387 options can be interspersed with the files on the command line and can
388 occur multiple times. The interpreter processes the command line
389 arguments from left to right, loading files with the <code>load</code>
390 procedure and evaluating expressions with the <code>eval</code> procedure in
391 the global interaction environment. After this processing the
392 interpreter exits.
393 </p>
394 <p>When the file name has no extension the <code>load</code> procedure first
395 attempts to load the file with no extension as a Scheme source file.
396 If that file doesn&rsquo;t exist it will search for both a source file and
397 an object file. The object file&rsquo;s name is obtained by adding to the
398 file name a <samp>.o<var>n</var></samp> extension with the highest consecutive
399 version number starting with 1. The source file&rsquo;s name is obtained by
400 adding to the file name the file extensions <samp>.scm</samp> and
401 <samp>.six</samp> (the first found is the source file). If both a source
402 file and an object file exist, then the one with the latest
403 modification time is loaded. Otherwise the file that is found is
404 loaded. When the file name has an extension, the <code>load</code>
405 procedure will only attempt to load the file with that specific name.
406 </p>
407 <p>When the extension of the file loaded is <samp>.scm</samp> the content of
408 the file will be parsed using the normal Scheme prefix syntax. When
409 the extension of the file loaded is <samp>.six</samp> the content of the
410 file will be parsed using the Scheme infix syntax extension (see
411 <a href="#Scheme-infix-syntax-extension">Scheme infix syntax extension</a>). Otherwise, <code>gsi</code> will
412 parse the file using the normal Scheme prefix syntax.
413 </p>
414 <p>The ports associated with <samp>(current-input-port)</samp>,
415 <samp>(current-output-port)</samp> and <samp>(current-error-port)</samp> initially
416 refer respectively to the standard input (<samp>stdin</samp>), standard
417 output (<samp>stdout</samp>) and the standard error (<samp>stderr</samp>) of the
418 interpreter. This is true even in REPLs started with the <samp>-</samp>
419 option. The usual interaction channel (console or IDE&rsquo;s console
420 window) is still used to read expressions and commands and to display
421 results. This makes it possible to use REPLs to debug programs which
422 read the standard input and write to the standard output, even when
423 these have been redirected.
424 </p>
425 <p>Here is a sample use of the interpreter in batch mode, under UNIX:
426 </p>
427 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat h.scm</b>
428 (display &quot;hello&quot;) (newline)
429 $ <b>cat w.six</b>
430 display(&quot;world&quot;); newline();
431 $ <b>gsi h.scm - w.six -e &quot;(pretty-print 1)(pretty-print 2)&quot;</b>
432 hello
433 &gt; <b>(define (display x) (write (reverse (string-&gt;list x))))</b>
434 &gt; <b>,(c 0)</b>
435 (#\d #\l #\r #\o #\w)
438 </pre></td></tr></table>
440 <hr size="1">
441 <a name="GSI-customization"></a>
442 <table cellpadding="1" cellspacing="1" border="0">
443 <tr><td valign="middle" align="left"><a href="#GSI-batch-mode" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2.2 Batch mode" align="middle" width="32"></a></td>
444 <td valign="middle" align="left"><a href="#GSI-exit-status" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.4 Process exit status" align="middle" width="32"></a></td>
445 <td valign="middle" align="left"> &nbsp; </td>
446 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
447 <td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up.png" border="0" alt="Up: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
448 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
449 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
450 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
451 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
452 </tr></table>
453 <a name="Customization-1"></a>
454 <h2 class="section">2.3 Customization</h2>
456 <p>There are two ways to customize the interpreter. When the interpreter
457 starts off it tries to execute a <samp>(load &quot;~~lib/gambcext&quot;)</samp> (for an
458 explanation of how file names are interpreted see <a href="#Host-environment">Host environment</a>).
459 An error is not signaled when the file does not exist. Interpreter
460 extensions and patches that are meant to apply to all users and all
461 modes should go in that file.
462 </p>
463 <p>Extensions which are meant to apply to a single user or to a specific
464 working directory are best placed in the <em>initialization file</em>,
465 which is a file containing Scheme code. In all modes, the interpreter
466 first tries to locate the initialization file by searching the following
467 locations: &lsquo;<tt>.gambcini</tt>&rsquo; and &lsquo;<tt>~/.gambcini</tt>&rsquo; (with no extension, a
468 <samp>.scm</samp> extension, and a <samp>.six</samp> extension in that order). The
469 first file that is found is examined as though the expression
470 <code>(include <var>initialization-file</var>)</code> had been entered at the
471 read-eval-print loop where <var>initialization-file</var> is the file that
472 was found. Note that by using an <code>include</code> the macros defined in
473 the initialization file will be visible from the read-eval-print loop
474 (this would not have been the case if <code>load</code> had been used). The
475 initialization file is not searched for or examined when the <samp>-f</samp>
476 option is specified.
477 </p>
478 <hr size="1">
479 <a name="GSI-exit-status"></a>
480 <table cellpadding="1" cellspacing="1" border="0">
481 <tr><td valign="middle" align="left"><a href="#GSI-customization" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2.3 Customization" align="middle" width="32"></a></td>
482 <td valign="middle" align="left"><a href="#Scheme-scripts" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.5 Scheme scripts" align="middle" width="32"></a></td>
483 <td valign="middle" align="left"> &nbsp; </td>
484 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
485 <td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up.png" border="0" alt="Up: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
486 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
487 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
488 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
489 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
490 </tr></table>
491 <a name="Process-exit-status"></a>
492 <h2 class="section">2.4 Process exit status</h2>
494 <p>The status is zero when the interpreter exits normally and is nonzero
495 when the interpreter exits due to an error. Here is the meaning of
496 the exit statuses:
497 </p>
498 <dl compact="compact">
499 <dt> <code>0</code></dt>
500 <dd><p>The execution of the primordial thread (i.e. the main thread) did not
501 encounter any error. It is however possible that other threads
502 terminated abnormally (by default threads other than the primordial
503 thread terminate silently when they raise an exception that is not
504 handled).
505 </p>
506 </dd>
507 <dt> <code>64</code></dt>
508 <dd><p>The runtime options or the environment variable <samp>GAMBCOPT</samp>
509 contained a syntax error or were invalid.
510 </p>
511 </dd>
512 <dt> <code>70</code></dt>
513 <dd><p>This normally indicates that an exception was raised in the primordial
514 thread and the exception was not handled.
515 </p>
516 </dd>
517 <dt> <code>71</code></dt>
518 <dd><p>There was a problem initializing the runtime system, for example
519 insufficient memory to allocate critical tables.
520 </p>
521 </dd>
522 </dl>
524 <p>For example, if the shell is <code>sh</code>:
525 </p>
526 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi -:d0 -e &quot;(pretty-print (expt 2 100))&quot;</b>
527 1267650600228229401496703205376
528 $ <b>echo $?</b>
530 $ <b>gsi -:d0,unknown <span class="roman"><i># try to use an unknown runtime option</i></span></b>
531 $ <b>echo $?</b>
533 $ <b>gsi -:d0 nonexistent.scm <span class="roman"><i># try to load a file that does not exist</i></span></b>
534 $ <b>echo $?</b>
536 $ <b>gsi nonexistent.scm</b>
537 *** ERROR IN ##main -- No such file or directory
538 (load &quot;nonexistent.scm&quot;)
539 $ <b>echo $?</b>
541 </pre></td></tr></table>
543 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>$ <b>gsi -:m4000000 <span class="roman"><i># ask for a 4 gigabyte heap</i></span></b>
544 *** malloc: vm_allocate(size=528384) failed (error code=3)
545 *** malloc[15068]: error: Can't allocate region
546 $ <b>echo $?</b>
548 </pre></td></tr></table>
550 <p>Note the use of the runtime option <samp>-:d0</samp> that prevents error
551 messages from being output, and the runtime option <samp>-:m4000000</samp>
552 which sets the minimum heap size to 4 gigabytes.
553 </p>
554 <hr size="1">
555 <a name="Scheme-scripts"></a>
556 <table cellpadding="1" cellspacing="1" border="0">
557 <tr><td valign="middle" align="left"><a href="#GSI-exit-status" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2.4 Process exit status" align="middle" width="32"></a></td>
558 <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" alt="Forward: 2.5.1 Scripts under UNIX and Mac OS X" align="middle" width="32"></a></td>
559 <td valign="middle" align="left"> &nbsp; </td>
560 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
561 <td valign="middle" align="left"><a href="#GSI" title="Up section"><img src="button-up.png" border="0" alt="Up: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
562 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
563 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
564 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
565 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
566 </tr></table>
567 <a name="Scheme-scripts-1"></a>
568 <h2 class="section">2.5 Scheme scripts</h2>
570 <p>The <code>load</code> procedure treats specially files that begin with the
571 two characters <samp>#!</samp> and <samp>@;</samp>. Such files are called
572 <em>script files</em> and the first line is called the <em>script line</em>.
573 In addition to indicating that the file is a script, the script line
574 provides information about the source code language to be used by the
575 <code>load</code> procedure. After the two characters <samp>#!</samp> and
576 <samp>@;</samp> the system will search for the first substring matching one
577 of the following language specifying tokens:
578 </p>
579 <dl compact="compact">
580 <dt> <code>scheme-r4rs</code></dt>
581 <dd><a name="index-scheme_002dr4rs"></a>
582 <p>R4RS language with prefix syntax, case-insensitivity, keyword syntax
583 not supported
584 </p>
585 </dd>
586 <dt> <code>scheme-r5rs</code></dt>
587 <dd><a name="index-scheme_002dr5rs"></a>
588 <p>R5RS language with prefix syntax, case-insensitivity, keyword syntax
589 not supported
590 </p>
591 </dd>
592 <dt> <code>scheme-ieee-1178-1990</code></dt>
593 <dd><a name="index-scheme_002dieee_002d1178_002d1990"></a>
594 <p>IEEE 1178-1990 language with prefix syntax, case-insensitivity, keyword
595 syntax not supported
596 </p>
597 </dd>
598 <dt> <code>scheme-srfi-0</code></dt>
599 <dd><a name="index-scheme_002dsrfi_002d0"></a>
600 <p>R5RS language with prefix syntax and SRFI 0 support
601 (i.e. <code>cond-expand</code> special form), case-insensitivity, keyword
602 syntax not supported
603 </p>
604 </dd>
605 <dt> <code>gsi-script</code></dt>
606 <dd><a name="index-gsi_002dscript"></a>
607 <p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword
608 syntax supported
609 </p>
610 </dd>
611 <dt> <code>gsc-script</code></dt>
612 <dd><a name="index-gsc_002dscript"></a>
613 <p>Full Gambit Scheme language with prefix syntax, case-sensitivity, keyword
614 syntax supported
615 </p>
616 </dd>
617 <dt> <code>six-script</code></dt>
618 <dd><a name="index-six_002dscript"></a>
619 <p>Full Gambit Scheme language with infix syntax, case-sensitivity, keyword
620 syntax supported
621 </p>
622 </dd>
623 </dl>
625 <p>If a language specifying token is not found, <code>load</code> will use the
626 same language as a nonscript file (i.e. it uses the file extension and
627 runtime system options to determine the language).
628 </p>
629 <p>After processing the script line, <code>load</code> will parse the rest of
630 the file (using the syntax of the language indicated) and then execute
631 it. When the file is being loaded because it is an argument on the
632 interpreter&rsquo;s command line, the interpreter will:
633 </p>
634 <ul>
635 <li>
636 <a name="index-command_002dline"></a>
637 Setup the <code>command-line</code> procedure so that it returns a list
638 containing the expanded file name of the script file and the
639 arguments following the script file on the command line.
640 This is done before the script is executed. The expanded file name
641 of the script file can be used to determine the directory that
642 contains the script (i.e. <code>(path-directory (car (command-line)))</code>).
644 </li><li>
645 After the script is loaded the procedure <code>main</code> is called with
646 the command-line arguments. The way this is done depends on the
647 language specifying token. For <code>scheme-r4rs</code>,
648 <code>scheme-r5rs</code>, <code>scheme-ieee-1178-1990</code>, and
649 <code>scheme-srfi-0</code>, the <code>main</code> procedure is called with the
650 equivalent of <code>(main (cdr (command-line)))</code> and <code>main</code> is
651 expected to return a process exit status code in the range 0 to 255.
652 This conforms to the &ldquo;Running Scheme Scripts on Unix SRFI&rdquo; (SRFI
653 22). For <code>gsi-script</code> and <code>six-script</code> the <code>main</code>
654 procedure is called with the equivalent of <code>(apply main (cdr
655 (command-line)))</code> and the process exit status code is 0 (<code>main</code>&rsquo;s
656 result is ignored). The Gambit-C system has a predefined <code>main</code>
657 procedure which accepts any number of arguments and returns 0, so it
658 is perfectly valid for a script to not define <code>main</code> and to do
659 all its processing with top-level expressions (examples are given in
660 the next section).
662 </li><li>
663 When <code>main</code> returns, the interpreter exits. The command-line
664 arguments after a script file are consequently not processed (however
665 they do appear in the list returned by the <code>command-line</code>
666 procedure, after the script file&rsquo;s expanded file name, so it is up to
667 the script to process them).
669 </li></ul>
671 <table class="menu" border="0" cellspacing="0">
672 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
673 <tr><td align="left" valign="top"><a href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
674 <tr><td align="left" valign="top"><a href="#Compiling-scripts">2.5.3 Compiling scripts</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
675 </table>
677 <hr size="1">
678 <a name="Scripts-under-UNIX-and-Mac-OS-X"></a>
679 <table cellpadding="1" cellspacing="1" border="0">
680 <tr><td valign="middle" align="left"><a href="#Scheme-scripts" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2.5 Scheme scripts" align="middle" width="32"></a></td>
681 <td valign="middle" align="left"><a href="#Scripts-under-Microsoft-Windows" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.5.2 Scripts under Microsoft Windows" align="middle" width="32"></a></td>
682 <td valign="middle" align="left"> &nbsp; </td>
683 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
684 <td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up.png" border="0" alt="Up: 2.5 Scheme scripts" align="middle" width="32"></a></td>
685 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
686 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
687 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
688 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
689 </tr></table>
690 <a name="Scripts-under-UNIX-and-Mac-OS-X-1"></a>
691 <h3 class="subsection">2.5.1 Scripts under UNIX and Mac OS X</h3>
693 <p>Under UNIX and Mac OS X, the Gambit-C installation process creates the
694 executable <samp>gsi</samp> and also the executables <samp>six</samp>,
695 <samp>gsi-script</samp>, <samp>six-script</samp>, <samp>scheme-r5rs</samp>,
696 <samp>scheme-srfi-0</samp>, etc as links to <samp>gsi</samp>. A Scheme script
697 need only start with the name of the desired Scheme language variant
698 prefixed with <samp>#!</samp> and the directory where the Gambit-C
699 executables are stored. This script should be made executable by
700 setting the execute permission bits (with a <samp>chmod +x
701 <var>script</var></samp>). Here is an example of a script which lists on standard
702 output the files in the current directory:
703 </p>
704 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit-C/bin/gsi-script
705 (for-each pretty-print (directory-files))
706 </pre></td></tr></table>
708 <p>Here is another UNIX script, using the Scheme infix syntax extension,
709 which takes a single integer argument and prints on standard output the
710 numbers from 1 to that integer:
711 </p>
712 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>#!/usr/local/Gambit-C/bin/six-script
714 void main (obj n_str)
716 int n = \string-&gt;number(n_str);
717 for (int i=1; i&lt;=n; i++)
718 \pretty-print(i);
720 </pre></td></tr></table>
722 <p>For maximal portability it is a good idea to start scripts indirectly
723 through the <samp>/usr/bin/env</samp> program, so that the executable of the
724 interpreter will be searched in the user&rsquo;s <samp>PATH</samp>. This is what
725 SRFI 22 recommends. For example here is a script that mimics the UNIX
726 <samp>cat</samp> utility for text files:
727 </p>
728 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>#!/usr/bin/env gsi-script
730 (define (display-file filename)
731 (display (call-with-input-file filename
732 (lambda (port)
733 (read-line port #f)))))
735 (for-each display-file (cdr (command-line)))
736 </pre></td></tr></table>
738 <hr size="1">
739 <a name="Scripts-under-Microsoft-Windows"></a>
740 <table cellpadding="1" cellspacing="1" border="0">
741 <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" alt="Back: 2.5.1 Scripts under UNIX and Mac OS X" align="middle" width="32"></a></td>
742 <td valign="middle" align="left"><a href="#Compiling-scripts" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 2.5.3 Compiling scripts" align="middle" width="32"></a></td>
743 <td valign="middle" align="left"> &nbsp; </td>
744 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
745 <td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up.png" border="0" alt="Up: 2.5 Scheme scripts" align="middle" width="32"></a></td>
746 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
747 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
748 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
749 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
750 </tr></table>
751 <a name="Scripts-under-Microsoft-Windows-1"></a>
752 <h3 class="subsection">2.5.2 Scripts under Microsoft Windows</h3>
754 <p>Under Microsoft Windows, the Gambit-C installation process creates the
755 executable <samp>gsi.exe</samp> and <samp>six.exe</samp> and also the batch files
756 <samp>gsi-script.bat</samp>, <samp>six-script.bat</samp>, <samp>scheme-r5rs.bat</samp>,
757 <samp>scheme-srfi-0.bat</samp>, etc which simply invoke <samp>gsi.exe</samp> with
758 the same command line arguments. A Scheme script need only start with
759 the name of the desired Scheme language variant prefixed with
760 <samp>@;</samp>. A UNIX script can be converted to a Microsoft Windows
761 script simply by changing the script line and storing the script in a
762 file whose name has a <samp>.bat</samp> or <samp>.cmd</samp> extension:
763 </p>
764 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>@;gsi-script %~f0 %*
765 (display &quot;files:\n&quot;)
766 (pretty-print (directory-files))
767 </pre></td></tr></table>
769 <p>Note that Microsoft Windows always searches executables in the user&rsquo;s
770 <samp>PATH</samp>, so there is no need for an indirection such as the UNIX
771 <samp>/usr/bin/env</samp>. However the script line must end with <samp>%~f0
772 %*</samp> to pass the expanded filename of the script and command line
773 arguments to the interpreter.
774 </p>
775 <hr size="1">
776 <a name="Compiling-scripts"></a>
777 <table cellpadding="1" cellspacing="1" border="0">
778 <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" alt="Back: 2.5.2 Scripts under Microsoft Windows" align="middle" width="32"></a></td>
779 <td valign="middle" align="left"><a href="#GSC" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
780 <td valign="middle" align="left"> &nbsp; </td>
781 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
782 <td valign="middle" align="left"><a href="#Scheme-scripts" title="Up section"><img src="button-up.png" border="0" alt="Up: 2.5 Scheme scripts" align="middle" width="32"></a></td>
783 <td valign="middle" align="left"><a href="#GSC" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
784 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
785 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
786 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
787 </tr></table>
788 <a name="Compiling-scripts-1"></a>
789 <h3 class="subsection">2.5.3 Compiling scripts</h3>
791 <p>A script file can be compiled using the Gambit Scheme compiler
792 (see section <a href="#GSC">The Gambit Scheme compiler</a>) into a standalone executable. The script line will
793 provide information to the compiler on which language to use. The
794 script line also provides information on which runtime options to use
795 when executing the compiled script. This is useful to set the default
796 runtime options of an executable program.
797 </p>
798 <p>The compiled script will be executed similarly to an interpreted
799 script (i.e. the list of command line arguments returned by the
800 <code>command-line</code> procedure and the invocation of the <code>main</code>
801 procedure).
802 </p>
803 <p>For example:
804 </p>
805 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat square.scm</b>
806 #!/usr/local/Gambit-C/bin/gsi-script -:d0
807 (define (main arg)
808 (pretty-print (expt (string-&gt;number arg) 2)))
809 $ <b>gsi square 30 <span class="roman"><i># gsi will load square.scm</i></span></b>
811 $ <b>gsc -exe square <span class="roman"><i># compile the script to a standalone program</i></span></b>
812 $ <b>./square 30</b>
814 $ <b>./square 1 2 3 <span class="roman"><i># too many arguments to main</i></span></b>
815 $ <b>echo $?</b>
817 $ <b>./square -:d1 1 2 3 <span class="roman"><i># ask for error message</i></span></b>
818 *** ERROR -- Wrong number of arguments passed to procedure
819 (main &quot;1&quot; &quot;2&quot; &quot;3&quot;)
820 </pre></td></tr></table>
822 <hr size="1">
823 <a name="GSC"></a>
824 <table cellpadding="1" cellspacing="1" border="0">
825 <tr><td valign="middle" align="left"><a href="#Compiling-scripts" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 2.5.3 Compiling scripts" align="middle" width="32"></a></td>
826 <td valign="middle" align="left"><a href="#GSC-interactive-mode" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.1 Interactive mode" align="middle" width="32"></a></td>
827 <td valign="middle" align="left"> &nbsp; </td>
828 <td valign="middle" align="left"><a href="#GSI" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 2. The Gambit Scheme interpreter" align="middle" width="32"></a></td>
829 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
830 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
831 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
832 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
833 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
834 </tr></table>
835 <a name="The-Gambit-Scheme-compiler"></a>
836 <h1 class="chapter">3. The Gambit Scheme compiler</h1>
837 <a name="index-compiler"></a>
838 <a name="index-interpreter-1"></a>
840 <p>Synopsis:
841 </p>
842 <table><tr><td>&nbsp;</td><td><pre class="example"><b></b>gsc <span class="roman">[</span>-:<span class="roman"><var>runtimeoption</var></span>,&hellip;<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>
843 <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>
844 <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>
845 <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>
846 <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>
847 <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>
848 <span class="roman">[</span>-debug-environments<span class="roman">]</span> <span class="roman">[</span>-track-scheme<span class="roman">]</span>
849 <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>
850 <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>&hellip;
851 </pre></td></tr></table>
853 <table class="menu" border="0" cellspacing="0">
854 <tr><td align="left" valign="top"><a href="#GSC-interactive-mode">3.1 Interactive mode</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
855 <tr><td align="left" valign="top"><a href="#GSC-customization">3.2 Customization</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
856 <tr><td align="left" valign="top"><a href="#GSC-batch-mode">3.3 Batch mode</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
857 <tr><td align="left" valign="top"><a href="#Link-files">3.4 Link files</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
858 <tr><td align="left" valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
859 </table>
861 <hr size="1">
862 <a name="GSC-interactive-mode"></a>
863 <table cellpadding="1" cellspacing="1" border="0">
864 <tr><td valign="middle" align="left"><a href="#GSC" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
865 <td valign="middle" align="left"><a href="#GSC-customization" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.2 Customization" align="middle" width="32"></a></td>
866 <td valign="middle" align="left"> &nbsp; </td>
867 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
868 <td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up.png" border="0" alt="Up: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
869 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
870 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
871 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
872 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
873 </tr></table>
874 <a name="Interactive-mode"></a>
875 <h2 class="section">3.1 Interactive mode</h2>
877 <p>When no command line argument is present other than options the
878 compiler behaves like the interpreter in interactive mode. The only
879 difference with the interpreter is that the compilation related
880 procedures listed in this chapter are also available
881 (i.e. <code>compile-file</code>, <code>compile-file-to-c</code>, etc).
882 </p>
883 <hr size="1">
884 <a name="GSC-customization"></a>
885 <table cellpadding="1" cellspacing="1" border="0">
886 <tr><td valign="middle" align="left"><a href="#GSC-interactive-mode" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3.1 Interactive mode" align="middle" width="32"></a></td>
887 <td valign="middle" align="left"><a href="#GSC-batch-mode" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.3 Batch mode" align="middle" width="32"></a></td>
888 <td valign="middle" align="left"> &nbsp; </td>
889 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
890 <td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up.png" border="0" alt="Up: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
891 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
892 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
893 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
894 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
895 </tr></table>
896 <a name="Customization"></a>
897 <h2 class="section">3.2 Customization</h2>
899 <p>Like the interpreter, the compiler will examine the initialization
900 file unless the <samp>-f</samp> option is specified.
901 </p>
902 <hr size="1">
903 <a name="GSC-batch-mode"></a>
904 <table cellpadding="1" cellspacing="1" border="0">
905 <tr><td valign="middle" align="left"><a href="#GSC-customization" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3.2 Customization" align="middle" width="32"></a></td>
906 <td valign="middle" align="left"><a href="#Link-files" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.4 Link files" align="middle" width="32"></a></td>
907 <td valign="middle" align="left"> &nbsp; </td>
908 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
909 <td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up.png" border="0" alt="Up: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
910 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
911 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
912 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
913 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
914 </tr></table>
915 <a name="Batch-mode"></a>
916 <h2 class="section">3.3 Batch mode</h2>
918 <a name="index-gsc-1"></a>
919 <a name="index-_002escm"></a>
920 <a name="index-_002esix"></a>
921 <a name="index-_002ec"></a>
922 <a name="index-file_002escm"></a>
923 <a name="index-file_002esix"></a>
924 <a name="index-file_002ec"></a>
925 <p>In batch mode <code>gsc</code> takes a set of file names (with either no
926 extension, or a C file extension, or some other extension) on the
927 command line and compiles each Scheme file into a C file.
928 The recognized C file extensions are <samp>.c</samp>, <samp>.C</samp>, <samp>.cc</samp>,
929 <samp>.cp</samp>, <samp>.cpp</samp>, <samp>.CPP</samp>, <samp>.cxx</samp>, <samp>.c++</samp>,
930 <samp>.m</samp>, <samp>.M</samp>, and <samp>.mm</samp>.
931 The extension can be omitted from <var>file</var> when the Scheme file has a
932 <samp>.scm</samp> or <samp>.six</samp> extension. When the extension of the
933 Scheme file is <samp>.six</samp> the content of the file will be parsed
934 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
935 normal Scheme prefix syntax. Files with a C file extension must
936 have been previously produced by <code>gsc</code>, with the <samp>-c</samp> option,
937 and are used by Gambit&rsquo;s linker.
938 </p>
939 <p>For each Scheme file a C file <samp><var>file</var>.c</samp> will be produced.
940 The C file&rsquo;s name is the same as the Scheme file, but the extension is
941 changed to <samp>.c</samp>. By default the C file is created in the same
942 directory as the Scheme file. This default can be overridden with the
943 compiler&rsquo;s <samp>-o</samp> option.
944 </p>
945 <p>The C files produced by the compiler serve two purposes. They will be
946 processed by a C compiler to generate object files, and they also
947 contain information to be read by Gambit&rsquo;s linker to generate a
948 <em>link file</em>. The link file is a C file that collects various
949 linking information for a group of modules, such as the set of all
950 symbols and global variables used by the modules.
951 <a name="index-_002dlink"></a>
952 <a name="index-_002dexe"></a>
953 The linker is only invoked when the <samp>-link</samp> or <samp>-exe</samp>
954 options appear on the command line.
955 </p>
956 <p>Compiler options must be specified before the first file name and
957 after the <samp>-:</samp> runtime option (see section <a href="#Runtime-options">Runtime options</a>). If
958 present, the <samp>-i</samp>, <samp>-f</samp>, and <samp>-v</samp> compiler options
959 must come first. The available options are:
960 </p>
961 <a name="index-compiler-options"></a>
962 <a name="index-options_002c-compiler"></a>
963 <dl compact="compact">
964 <dt> <code>-i</code></dt>
965 <dd><p>Force interpreter mode.
966 </p></dd>
967 <dt> <code>-f</code></dt>
968 <dd><p>Do not examine the initialization file.
969 </p></dd>
970 <dt> <code>-v</code></dt>
971 <dd><p>Print the system version string, system time stamp, operating system
972 type, and configure script options on standard output and exit.
973 </p></dd>
974 <dt> <code>-prelude <var>expressions</var></code></dt>
975 <dd><p>Add expressions to the top of the source code being compiled.
976 </p></dd>
977 <dt> <code>-postlude <var>expressions</var></code></dt>
978 <dd><p>Add expressions to the bottom of the source code being compiled.
979 </p></dd>
980 <dt> <code>-cc-options <var>options</var></code></dt>
981 <dd><p>Add options to the command that invokes the C compiler.
982 </p></dd>
983 <dt> <code>-ld-options-prelude <var>options</var></code></dt>
984 <dd><p>Add options to the command that invokes the C linker.
985 </p></dd>
986 <dt> <code>-ld-options <var>options</var></code></dt>
987 <dd><p>Add options to the command that invokes the C linker.
988 </p></dd>
989 <dt> <code>-warnings</code></dt>
990 <dd><p>Display warnings.
991 </p></dd>
992 <dt> <code>-verbose</code></dt>
993 <dd><p>Display a trace of the compiler&rsquo;s activity.
994 </p></dd>
995 <dt> <code>-report</code></dt>
996 <dd><p>Display a global variable usage report.
997 </p></dd>
998 <dt> <code>-expansion</code></dt>
999 <dd><p>Display the source code after expansion.
1000 </p></dd>
1001 <dt> <code>-gvm</code></dt>
1002 <dd><p>Generate a listing of the GVM code.
1003 </p></dd>
1004 <dt> <code>-debug</code></dt>
1005 <dd><p>Include all debugging information in the code generated.
1006 </p></dd>
1007 <dt> <code>-debug-location</code></dt>
1008 <dd><p>Include source code location debugging information in the code generated.
1009 </p></dd>
1010 <dt> <code>-debug-source</code></dt>
1011 <dd><p>Include the source code debugging information in the code generated.
1012 </p></dd>
1013 <dt> <code>-debug-environments</code></dt>
1014 <dd><p>Include environment debugging information in the code generated.
1015 </p></dd>
1016 <dt> <code>-track-scheme</code></dt>
1017 <dd><p>Generate <samp>#line</samp> directives referring back to the Scheme code.
1018 </p></dd>
1019 <dt> <code>-o <var>output</var></code></dt>
1020 <dd><p>Set name of output file or directory where output file(s) are written.
1021 </p></dd>
1022 <dt> <code>-dynamic</code></dt>
1023 <dd><p>Compile Scheme source files to dynamically loadable object
1024 files (this is the default).
1025 </p></dd>
1026 <dt> <code>-exe</code></dt>
1027 <dd><p>Compile Scheme source files into an executable program.
1028 </p></dd>
1029 <dt> <code>-obj</code></dt>
1030 <dd><p>Compile Scheme source files to object files.
1031 </p></dd>
1032 <dt> <code>-keep-c</code></dt>
1033 <dd><p>Keep any intermediate <samp>.c</samp> files that are generated.
1034 </p></dd>
1035 <dt> <code>-c</code></dt>
1036 <dd><p>Compile Scheme source files to C without generating link file.
1037 </p></dd>
1038 <dt> <code>-link</code></dt>
1039 <dd><p>Compile Scheme source files to C and generate a link file.
1040 </p></dd>
1041 <dt> <code>-flat</code></dt>
1042 <dd><p>Generate a flat link file instead of the default incremental link file.
1043 </p></dd>
1044 <dt> <code>-l <var>base</var></code></dt>
1045 <dd><p>Specify the link file of the base library to use for the link.
1046 </p></dd>
1047 <dt> <code>-</code></dt>
1048 <dd><p>Start REPL interaction.
1049 </p></dd>
1050 <dt> <code>-e <var>expressions</var></code></dt>
1051 <dd><p>Evaluate expressions in the interaction environment.
1052 </p></dd>
1053 </dl>
1055 <a name="index-_002di"></a>
1056 <p>The <samp>-i</samp> option forces the compiler to process the remaining
1057 command line arguments like the interpreter.
1058 </p>
1059 <a name="index-_002dprelude"></a>
1060 <p>The <samp>-prelude</samp> option adds the specified expressions to the top of
1061 the source code being compiled. The main use of this option is to
1062 supply declarations on the command line. For example the following
1063 invocation of the compiler will compile the file <samp>bench.scm</samp> in
1064 unsafe mode:
1065 </p>
1066 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -prelude &quot;(declare (not safe))&quot; bench.scm</b>
1067 </pre></td></tr></table>
1069 <a name="index-_002dpostlude"></a>
1070 <p>The <samp>-postlude</samp> option adds the specified expressions to the bottom
1071 of the source code being compiled. The main use of this option is to
1072 supply the expression that will start the execution of the program. For
1073 example:
1074 </p>
1075 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -postlude &quot;(start-bench)&quot; bench.scm</b>
1076 </pre></td></tr></table>
1078 <a name="index-_002dcc_002doptions"></a>
1079 <p>The <samp>-cc-options</samp> option is only meaningful when a dynamically
1080 loadable object file is being generated (neither the <samp>-c</samp> or
1081 <samp>-link</samp> options are used). The <samp>-cc-options</samp> option adds
1082 the specified options to the command that invokes the C compiler. The
1083 main use of this option is to specify the include path, some symbols
1084 to define or undefine, the optimization level, or any C compiler
1085 option that is different from the default. For example:
1086 </p>
1087 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -cc-options &quot;-U___SINGLE_HOST -O2 -I../include&quot; bench.scm</b>
1088 </pre></td></tr></table>
1090 <a name="index-_002dld_002doptions_002dprelude"></a>
1091 <a name="index-_002dld_002doptions"></a>
1092 <p>The <samp>-ld-options-prelude</samp> and <samp>-ld-options</samp> options are only
1093 meaningful when a dynamically loadable object file is being generated
1094 (neither the <samp>-c</samp> or <samp>-link</samp> options are used). The
1095 <samp>-ld-options-prelude</samp> and <samp>-ld-options</samp> options add the
1096 specified options to the command that invokes the C linker (the
1097 options in <var>ld-options-prelude</var> are passed to the C linker before
1098 the input file and the options in <var>ld-options</var> are passed after).
1099 The main use of this option is to specify additional object files or
1100 libraries that need to be linked, or any C linker option that is
1101 different from the default (such as the library search path and flags
1102 to select between static and dynamic linking). For example:
1103 </p>
1104 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -ld-options &quot;-L/usr/X11R6/lib -lX11 -dynamic&quot; bench.scm</b>
1105 </pre></td></tr></table>
1107 <a name="index-_002dwarnings"></a>
1108 <p>The <samp>-warnings</samp> option displays on standard output all warnings
1109 that the compiler may have.
1110 </p>
1111 <a name="index-_002dverbose"></a>
1112 <p>The <samp>-verbose</samp> option displays on standard output a trace of the
1113 compiler&rsquo;s activity.
1114 </p>
1115 <a name="index-_002dreport"></a>
1116 <p>The <samp>-report</samp> option displays on standard output a global
1117 variable usage report. Each global variable used in the program is
1118 listed with 4 flags that indicate whether the global variable is
1119 defined, referenced, mutated and called.
1120 </p>
1121 <a name="index-_002dexpansion"></a>
1122 <p>The <samp>-expansion</samp> option displays on standard output the source code
1123 after expansion and inlining by the front end.
1124 </p>
1125 <a name="index-_002dgvm"></a>
1126 <p>The <samp>-gvm</samp> option generates a listing of the intermediate code
1127 for the &ldquo;Gambit Virtual Machine&rdquo; (GVM) of each Scheme file on
1128 <samp><var>file</var>.gvm</samp>.
1129 </p>
1130 <a name="index-_002ddebug"></a>
1131 <a name="index-debug"></a>
1132 <p>The <samp>-debug</samp> option causes all kinds of debugging information to
1133 be saved in the code generated. See the documentation of the
1134 <samp>debug</samp> declaration for details.
1135 </p>
1136 <a name="index-_002ddebug_002dlocation"></a>
1137 <a name="index-debug_002dlocation"></a>
1138 <p>The <samp>-debug-location</samp> option causes source code location
1139 debugging information to be saved in the code generated. See the
1140 documentation of the <samp>debug-location</samp> declaration for details.
1141 </p>
1142 <a name="index-_002ddebug_002dsource"></a>
1143 <a name="index-debug_002dsource"></a>
1144 <p>The <samp>-debug-source</samp> option causes source code debugging
1145 information to be saved in the code generated. See the documentation
1146 of the <samp>debug-source</samp> declaration for details.
1147 </p>
1148 <a name="index-_002ddebug_002denvironments"></a>
1149 <a name="index-debug_002denvironments"></a>
1150 <p>The <samp>-debug-environments</samp> option causes environment debugging
1151 information to be saved in the code generated. See the documentation
1152 of the <samp>debug-environments</samp> declaration for details.
1153 </p>
1154 <a name="index-_002dtrack_002dscheme"></a>
1155 <p>The <samp>-track-scheme</samp> options causes the generation of <samp>#line</samp>
1156 directives that refer back to the Scheme source code. This allows the
1157 use of a C debugger or profiler to debug Scheme code.
1158 </p>
1159 <a name="index-_002do-output"></a>
1160 <p>The <samp>-o</samp> option sets the filename of the output file, or the
1161 directory in which the output file(s) generated by the compiler are
1162 written.
1163 </p>
1164 <a name="index-_002dc"></a>
1165 <a name="index-_002ddynamic"></a>
1166 <a name="index-_002dexe-1"></a>
1167 <a name="index-_002dobj"></a>
1168 <a name="index-_002dlink-1"></a>
1169 <a name="index-_002dkeep_002dc"></a>
1170 <a name="index-last_005f_002ec"></a>
1171 <p>If the <samp>-link</samp> or <samp>-exe</samp> options appear on the command line,
1172 the Gambit linker is invoked to generate the link file from the set of
1173 C files specified on the command line or produced by the Gambit
1174 compiler. By default the link file is <samp><var>last</var>_.c</samp>, where
1175 <samp><var>last</var>.c</samp> is the last file in the set of C files. When the
1176 <samp>-c</samp> option is specified, the Scheme source files are compiled to
1177 C files. When the <samp>-exe</samp> option is specified, the generated C
1178 files and link file are compiled and linked using the C compiler to
1179 produce an executable program whose name defaults to
1180 <samp><var>last</var>.exe</samp>. When the <samp>-obj</samp> option is specified, the
1181 generated C files are compiled using the C compiler to produce object
1182 files (<samp>.o</samp> or <samp>.obj</samp> extensions). If neither the
1183 <samp>-link</samp>, <samp>-c</samp>, <samp>-exe</samp>, <samp>-obj</samp> options appear on
1184 the command line, the Scheme source files are compiled to dynamically
1185 loadable object files (<samp>.o<var>n</var></samp> extension). The
1186 <samp>-keep-c</samp> option will prevent the deletion of any intermediate
1187 <samp>.c</samp> file that is generated. Note that in this case the
1188 intermediate <samp>.c</samp> file will be generated in the same directory as
1189 the Scheme source file even if the <samp>-o</samp> option is used.
1190 </p>
1191 <a name="index-_002dflat"></a>
1192 <p>The <samp>-flat</samp> option is only meaningful when a link file is being
1193 generated (i.e. the <samp>-link</samp> or <samp>-exe</samp> options also appear on
1194 the command line). The <samp>-flat</samp> option directs the Gambit linker
1195 to generate a flat link file. By default, the linker generates an
1196 incremental link file (see the next section for a description of the
1197 two types of link files).
1198 </p>
1199 <a name="index-_002dl-base"></a>
1200 <p>The <samp>-l</samp> option is only meaningful when an incremental link file
1201 is being generated (i.e. the <samp>-link</samp> or <samp>-exe</samp> options
1202 appear on the command line and the <samp>-flat</samp> option is absent).
1203 The <samp>-l</samp> option specifies the link file (without the <samp>.c</samp>
1204 extension) of the base library to use for the incremental link. By
1205 default the link file of the Gambit runtime library is used
1206 (i.e. <samp>~~lib/_gambc.c</samp>).
1207 </p>
1208 <a name="index-_002d"></a>
1209 <p>The <samp>-</samp> option starts a REPL interaction.
1210 </p>
1211 <a name="index-_002de"></a>
1212 <p>The <samp>-e</samp> option evaluates the specified expressions in the
1213 interaction environment.
1214 </p>
1215 <hr size="1">
1216 <a name="Link-files"></a>
1217 <table cellpadding="1" cellspacing="1" border="0">
1218 <tr><td valign="middle" align="left"><a href="#GSC-batch-mode" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3.3 Batch mode" align="middle" width="32"></a></td>
1219 <td valign="middle" align="left"><a href="#Building-an-executable-program" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.4.1 Building an executable program" align="middle" width="32"></a></td>
1220 <td valign="middle" align="left"> &nbsp; </td>
1221 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1222 <td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up.png" border="0" alt="Up: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1223 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1224 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1225 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1226 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1227 </tr></table>
1228 <a name="Link-files-1"></a>
1229 <h2 class="section">3.4 Link files</h2>
1231 <p>Gambit can be used to create programs and libraries of Scheme
1232 modules. This section explains the steps required to do so and the role
1233 played by the link files.
1234 </p>
1235 <p>In general, a program is composed of a set of Scheme modules and C
1236 modules. Some of the modules are part of the Gambit runtime library and
1237 the other modules are supplied by the user. When the program is
1238 started it must setup various global tables (including the symbol table
1239 and the global variable table) and then sequentially execute the Scheme
1240 modules (more or less as though they were being loaded one after another).
1241 The information required for this is contained in one or more <em>link
1242 files</em> generated by the Gambit linker from the C files produced by the
1243 Gambit compiler.
1244 </p>
1245 <p>The order of execution of the Scheme modules corresponds to the order of
1246 the modules on the command line which produced the link file. The order
1247 is usually important because most modules define variables and
1248 procedures which are used by other modules (for this reason the
1249 program&rsquo;s main computation is normally started by the last module).
1250 </p>
1251 <p>When a single link file is used to contain the linking information of
1252 all the Scheme modules it is called a <em>flat link file</em>. Thus a
1253 program built with a flat link file contains in its link file both
1254 information on the user modules and on the runtime library. This is
1255 fine if the program is to be statically linked but is wasteful in
1256 a shared-library context because the linking information of the
1257 runtime library can&rsquo;t be shared and will be duplicated in all
1258 programs (this linking information typically takes hundreds of kilobytes).
1259 </p>
1260 <p>Flat link files are mainly useful to bundle multiple Scheme modules to
1261 make a runtime library (such as the Gambit runtime library) or to make a
1262 single file that can be loaded with the <code>load</code> procedure.
1263 </p>
1264 <p>An <em>incremental link file</em> contains only the linking information
1265 that is not already contained in a second link file (the &ldquo;base&rdquo; link
1266 file). Assuming that a flat link file was produced when the runtime
1267 library was linked, a program can be built by linking the user
1268 modules with the runtime library&rsquo;s link file, producing an incremental
1269 link file. This allows the creation of a shared-library which
1270 contains the modules of the runtime library and its flat link file.
1271 The program is dynamically linked with this shared-library and
1272 only contains the user modules and the incremental link file. For
1273 small programs this approach greatly reduces the size of the
1274 program because the incremental link file is small. A &ldquo;hello
1275 world&rdquo; program built this way can be as small as 5 Kbytes. Note that
1276 it is perfectly fine to use an incremental link file for statically
1277 linked programs (there is very little loss compared to a single flat
1278 link file).
1279 </p>
1280 <p>Incremental link files may be built from other incremental link files.
1281 This allows the creation of shared-libraries which extend the
1282 functionality of the Gambit runtime library.
1283 </p>
1284 <table class="menu" border="0" cellspacing="0">
1285 <tr><td align="left" valign="top"><a href="#Building-an-executable-program">3.4.1 Building an executable program</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
1286 <tr><td align="left" valign="top"><a href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
1287 <tr><td align="left" valign="top"><a href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
1288 <tr><td align="left" valign="top"><a href="#Other-compilation-options">3.4.4 Other compilation options</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
1289 </table>
1291 <hr size="1">
1292 <a name="Building-an-executable-program"></a>
1293 <table cellpadding="1" cellspacing="1" border="0">
1294 <tr><td valign="middle" align="left"><a href="#Link-files" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3.4 Link files" align="middle" width="32"></a></td>
1295 <td valign="middle" align="left"><a href="#Building-a-loadable-library" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.4.2 Building a loadable library" align="middle" width="32"></a></td>
1296 <td valign="middle" align="left"> &nbsp; </td>
1297 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1298 <td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up.png" border="0" alt="Up: 3.4 Link files" align="middle" width="32"></a></td>
1299 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1300 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1301 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1302 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1303 </tr></table>
1304 <a name="Building-an-executable-program-1"></a>
1305 <h3 class="subsection">3.4.1 Building an executable program</h3>
1307 <p>The simplest way to create an executable program is to invoke
1308 <code>gsc</code> with the <samp>-exe</samp> option. The compiler will
1309 transparently perform all the steps necessary, including compiling
1310 Scheme source files to C files, generating the link file, compiling
1311 the C files generated to object files, and creating the final
1312 executable file using the C linker. The following example shows how
1313 to build the executable program <samp>hello.exe</samp> which contains the
1314 two Scheme modules <samp>h.scm</samp> and <samp>w.six</samp>.
1315 </p>
1316 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat h.scm</b>
1317 (display &quot;hello&quot;) (newline)
1318 $ <b>cat w.six</b>
1319 display(&quot;world&quot;); newline();
1320 $ <b>gsc -o hello.exe -exe h.scm w.six</b>
1321 h.scm:
1322 /Users/feeley/gambit/doc/h.c:
1323 w.six:
1324 /Users/feeley/gambit/doc/w.c:
1325 /Users/feeley/gambit/doc/w_.c:
1326 $ <b>./hello.exe</b>
1327 hello
1328 world
1329 </pre></td></tr></table>
1331 <p>The detailed steps which are performed can be viewed by setting the
1332 <samp>GAMBC_CC_VERBOSE</samp> environment variable to a nonnull value. For
1333 example:
1334 </p>
1335 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>export GAMBC_CC_VERBOSE=yes</b>
1336 $ <b>gsc -o hello.exe -exe h.scm w.six</b>
1337 h.scm:
1338 /Users/feeley/gambit/doc/h.c:
1339 gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
1340 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
1341 -fPIC -fno-common -mieee-fp -I&quot;/usr/local/Gambit-C/include&quot; -c -o &quot;h.o&quot; h.c
1342 w.six:
1343 /Users/feeley/gambit/doc/w.c:
1344 gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
1345 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
1346 -fPIC -fno-common -mieee-fp -I&quot;/usr/local/Gambit-C/include&quot; -c -o &quot;w.o&quot; w.c
1347 /Users/feeley/gambit/doc/w_.c:
1348 gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
1349 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
1350 -fPIC -fno-common -mieee-fp -I&quot;/usr/local/Gambit-C/include&quot; -c -o &quot;w_.o&quot; w_.c
1351 gcc -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2
1352 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer
1353 -fPIC -fno-common -mieee-fp -I&quot;/usr/local/Gambit-C/include&quot;
1354 -o &quot;hello.exe&quot; h.o w.o w_.o &quot;/usr/local/Gambit-C/lib/libgambc.a&quot;
1355 </pre></td></tr></table>
1357 <p>Using a single invocation of <code>gsc</code> with the <samp>-exe</samp> option is
1358 sometimes inappropriate when the build process is more complex, for
1359 example when the program is composed of several seperately compiled
1360 modules. In such a case it is useful to decompose the build process
1361 into smaller compilation steps. The <samp>hello.exe</samp> executable
1362 program could have been built by seperating the generation of C files
1363 from the C compilation and linking:
1364 </p>
1365 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -c h.scm</b>
1366 $ <b>gsc -c w.six</b>
1367 $ <b>gsc -o hello.exe -exe h.c w.c</b>
1368 </pre></td></tr></table>
1370 <p>When even finer control is desired the build process can be decomposed
1371 into smaller steps that invoke the C compiler and linker explicitly.
1372 This is described in the rest of this section.
1373 </p>
1374 <p>The <code>gsc</code> compiler can be invoked to compile each Scheme module
1375 into a C file and to create an incremental link file. The C files and
1376 the link file must then be compiled with a C compiler and linked (at
1377 the object file level) with the Gambit runtime library and possibly
1378 other libraries (such as the math library and the dynamic loading
1379 library).
1380 </p>
1381 <p>Here is for example how a program with three modules (one in C and two
1382 in Scheme) can be built. The content of the three source files (<samp>m1.c</samp>,
1383 <samp>m2.scm</samp> and <samp>m3.scm</samp>) is:
1384 </p>
1385 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>/* File: &quot;m1.c&quot; */
1386 int power_of_2 (int x) { return 1&lt;&lt;x; }
1388 ; File: &quot;m2.scm&quot;
1389 (c-declare &quot;extern int power_of_2 ();&quot;)
1390 (define pow2 (c-lambda (int) int &quot;power_of_2&quot;))
1391 (define (twice x) (cons x x))
1393 ; File: &quot;m3.scm&quot;
1394 (write (map twice (map pow2 '(1 2 3 4)))) (newline)
1395 </pre></td></tr></table>
1397 <p>The compilation of the two Scheme source files can be done with
1398 three invocations of <code>gsc</code>:
1399 </p>
1400 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -c m2.scm <span class="roman"><i># create m2.c (note: .scm is optional)</i></span></b>
1401 $ <b>gsc -c m3.scm <span class="roman"><i># create m3.c (note: .scm is optional)</i></span></b>
1402 $ <b>gsc -link m2.c m3.c <span class="roman"><i># create the incremental link file m3_.c</i></span></b>
1403 </pre></td></tr></table>
1405 <p>Alternatively, the three invocations of <code>gsc</code> can be replaced by a
1406 single invocation:
1407 </p>
1408 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -link m2 m3</b>
1411 </pre></td></tr></table>
1413 <p>At this point there will be 4 C files: <samp>m1.c</samp>, <samp>m2.c</samp>,
1414 <samp>m3.c</samp>, and <samp>m3_.c</samp>. To produce an executable program these
1415 files must be compiled with a C compiler and linked with the Gambit-C
1416 runtime library. The C compiler options needed will depend on the C
1417 compiler and the operating system (in particular it may be necessary
1418 to add the options <samp>-I/usr/local/Gambit-C/include
1419 -L/usr/local/Gambit-C/lib</samp> to access the <samp>gambit.h</samp> header file
1420 and the Gambit-C runtime library).
1421 </p>
1422 <p>Here is an example under Mac OS X:
1423 </p>
1424 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1425 Darwin 8.1.0 Power Macintosh powerpc
1426 $ <b>gsc -obj m1.c m2.c m3.c m3_.c</b>
1427 m1.c:
1428 m2.c:
1429 m3.c:
1430 m3_.c:
1431 $ <b>gcc m1.o m2.o m3.o m3_.o -lgambc</b>
1432 $ <b>./a.out</b>
1433 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
1434 </pre></td></tr></table>
1436 <p>Here is an example under Linux:
1437 </p>
1438 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1439 Linux 2.6.8-1.521 i686 athlon
1440 $ <b>gsc -obj m1.c m2.c m3.c m3_.c</b>
1441 m1.c:
1442 m2.c:
1443 m3.c:
1444 m3_.c:
1445 $ <b>gcc m1.o m2.o m3.o m3_.o -lgambc -lm -ldl -lutil</b>
1446 $ <b>./a.out</b>
1447 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
1448 </pre></td></tr></table>
1450 <hr size="1">
1451 <a name="Building-a-loadable-library"></a>
1452 <table cellpadding="1" cellspacing="1" border="0">
1453 <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" alt="Back: 3.4.1 Building an executable program" align="middle" width="32"></a></td>
1454 <td valign="middle" align="left"><a href="#Building-a-shared_002dlibrary" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.4.3 Building a shared-library" align="middle" width="32"></a></td>
1455 <td valign="middle" align="left"> &nbsp; </td>
1456 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1457 <td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up.png" border="0" alt="Up: 3.4 Link files" align="middle" width="32"></a></td>
1458 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1459 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1460 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1461 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1462 </tr></table>
1463 <a name="Building-a-loadable-library-1"></a>
1464 <h3 class="subsection">3.4.2 Building a loadable library</h3>
1466 <a name="index-_002dD_005f_005f_005fDYNAMIC"></a>
1467 <p>To bundle multiple modules into a single object file that can be
1468 dynamically loaded with the <code>load</code> procedure, a flat link file is
1469 needed. The compiler&rsquo;s <samp>-o</samp> option must be used to name the C
1470 file generated as follows. If the dynamically loadable object file is
1471 to be named <samp><var>myfile</var>.o<var>n</var></samp> then the <samp>-o</samp> option
1472 must set the name of the link file generated to
1473 <samp><var>myfile</var>.o<var>n</var>.c</samp> (note that the <samp>.c</samp> extension
1474 could also be <samp>.cc</samp>, <samp>.cpp</samp> or whatever extension is
1475 appropriate for C/C++ source files). The three modules of the
1476 previous example can be bundled by generating a link file in this way:
1477 </p>
1478 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -link -flat -o foo.o1.c m2 m3</b>
1481 *** WARNING -- &quot;cons&quot; is not defined,
1482 *** referenced in: (&quot;m2.c&quot;)
1483 *** WARNING -- &quot;map&quot; is not defined,
1484 *** referenced in: (&quot;m3.c&quot;)
1485 *** WARNING -- &quot;newline&quot; is not defined,
1486 *** referenced in: (&quot;m3.c&quot;)
1487 *** WARNING -- &quot;write&quot; is not defined,
1488 *** referenced in: (&quot;m3.c&quot;)
1489 </pre></td></tr></table>
1491 <p>The warnings indicate that there are no definitions (<code>define</code>s or
1492 <code>set!</code>s) of the variables <code>cons</code>, <code>map</code>, <code>newline</code>
1493 and <code>write</code> in the set of modules being linked. Before
1494 <samp>foo.o1</samp> is loaded, these variables will have to be bound; either
1495 implicitly (by the runtime library) or explicitly.
1496 </p>
1497 <p>When compiling the C files and link file generated, the flag
1498 <samp>-D___DYNAMIC</samp> must be passed to the C compiler and the C
1499 compiler and linker must be told to generate a dynamically loadable
1500 shared library.
1501 </p>
1502 <p>Here is an example under Mac OS X:
1503 </p>
1504 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1505 Darwin 10.5.0 i386 i386
1506 $ <b>gsc -link -flat -o foo.o1.c m2 m3 &gt; /dev/null</b>
1509 $ <b>gsc -cc-options &quot;-D___DYNAMIC&quot; -obj m1.c m2.c m3.c foo.o1.c</b>
1510 m1.c:
1511 m2.c:
1512 m3.c:
1513 foo.o1.c:
1514 $ <b>gcc -bundle m1.o m2.o m3.o foo.o1.o -o foo.o1</b>
1515 $ <b>gsi foo.o1</b>
1516 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
1517 </pre></td></tr></table>
1519 <p>Here is an example under Linux:
1520 </p>
1521 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1522 Linux 2.6.8-1.521 i686 athlon
1523 $ <b>gsc -link -flat -o foo.o1.c m2 m3 &gt; /dev/null</b>
1526 $ <b>gsc -cc-options &quot;-D___DYNAMIC&quot; -obj m1.c m2.c m3.c foo.o1.c</b>
1527 m1.c:
1528 m2.c:
1529 m3.c:
1530 foo.o1.c:
1531 $ <b>gcc -shared m1.o m2.o m3.o foo.o1.o -o foo.o1</b>
1532 $ <b>gsi foo.o1</b>
1533 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
1534 </pre></td></tr></table>
1536 <p>Here is a more complex example, under Solaris, which shows how to build
1537 a loadable library <samp>mymod.o1</samp> composed of the files <samp>m4.scm</samp>,
1538 <samp>m5.scm</samp> and <samp>x.c</samp> that links to system shared libraries (for
1539 X-windows):
1540 </p>
1541 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1542 SunOS ungava 5.6 Generic_105181-05 sun4m sparc SUNW,SPARCstation-20
1543 $ <b>gsc -link -flat -o mymod.o1.c m4 m5</b>
1546 *** WARNING -- &quot;*&quot; is not defined,
1547 *** referenced in: (&quot;m4.c&quot;)
1548 *** WARNING -- &quot;+&quot; is not defined,
1549 *** referenced in: (&quot;m5.c&quot;)
1550 *** WARNING -- &quot;display&quot; is not defined,
1551 *** referenced in: (&quot;m5.c&quot; &quot;m4.c&quot;)
1552 *** WARNING -- &quot;newline&quot; is not defined,
1553 *** referenced in: (&quot;m5.c&quot; &quot;m4.c&quot;)
1554 *** WARNING -- &quot;write&quot; is not defined,
1555 *** referenced in: (&quot;m5.c&quot;)
1556 $ <b>gsc -cc-options &quot;-D___DYNAMIC&quot; -obj m4.c m5.c x.c mymod.o1.c</b>
1557 m4.c:
1558 m5.c:
1559 x.c:
1560 mymod.o1.c:
1561 $ <b>/usr/ccs/bin/ld -G -o mymod.o1 mymod.o1.o m4.o m5.o x.o -lX11 -lsocket</b>
1562 $ <b>gsi mymod.o1</b>
1563 hello from m4
1564 hello from m5
1565 (f1 10) = 22
1566 $ <b>cat m4.scm</b>
1567 (define (f1 x) (* 2 (f2 x)))
1568 (display &quot;hello from m4&quot;)
1569 (newline)
1571 (c-declare #&lt;&lt;c-declare-end
1572 #include &quot;x.h&quot;
1573 c-declare-end
1575 (define x-initialize (c-lambda (char-string) bool &quot;x_initialize&quot;))
1576 (define x-display-name (c-lambda () char-string &quot;x_display_name&quot;))
1577 (define x-bell (c-lambda (int) void &quot;x_bell&quot;))
1578 $ <b>cat m5.scm</b>
1579 (define (f2 x) (+ x 1))
1580 (display &quot;hello from m5&quot;)
1581 (newline)
1583 (display &quot;(f1 10) = &quot;)
1584 (write (f1 10))
1585 (newline)
1587 (x-initialize (x-display-name))
1588 (x-bell 50) ; sound the bell at 50%
1589 $ <b>cat x.c</b>
1590 #include &lt;X11/Xlib.h&gt;
1592 static Display *display;
1594 int x_initialize (char *display_name)
1596 display = XOpenDisplay (display_name);
1597 return display != NULL;
1600 char *x_display_name (void)
1602 return XDisplayName (NULL);
1605 void x_bell (int volume)
1607 XBell (display, volume);
1608 XFlush (display);
1610 $ <b>cat x.h</b>
1611 int x_initialize (char *display_name);
1612 char *x_display_name (void);
1613 void x_bell (int);
1614 </pre></td></tr></table>
1616 <hr size="1">
1617 <a name="Building-a-shared_002dlibrary"></a>
1618 <table cellpadding="1" cellspacing="1" border="0">
1619 <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" alt="Back: 3.4.2 Building a loadable library" align="middle" width="32"></a></td>
1620 <td valign="middle" align="left"><a href="#Other-compilation-options" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.4.4 Other compilation options" align="middle" width="32"></a></td>
1621 <td valign="middle" align="left"> &nbsp; </td>
1622 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1623 <td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up.png" border="0" alt="Up: 3.4 Link files" align="middle" width="32"></a></td>
1624 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1625 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1626 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1627 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1628 </tr></table>
1629 <a name="Building-a-shared_002dlibrary-1"></a>
1630 <h3 class="subsection">3.4.3 Building a shared-library</h3>
1632 <a name="index-_002dD_005f_005f_005fPRIMAL"></a>
1633 <a name="index-_002dD_005f_005f_005fLIBRARY"></a>
1634 <a name="index-_002dD_005f_005f_005fSHARED"></a>
1635 <p>A shared-library can be built using an incremental link file or a flat
1636 link file. An incremental link file is normally used when the Gambit
1637 runtime library (or some other library) is to be extended with new
1638 procedures. A flat link file is mainly useful when building a
1639 &ldquo;primal&rdquo; runtime library, which is a library (such as the Gambit
1640 runtime library) that does not extend another library. When compiling
1641 the C files and link file generated, the flags <samp>-D___LIBRARY</samp> and
1642 <samp>-D___SHARED</samp> must be passed to the C compiler. The flag
1643 <samp>-D___PRIMAL</samp> must also be passed to the C compiler when a primal
1644 library is being built.
1645 </p>
1646 <p>A shared-library <samp>mylib.so</samp> containing the two first modules of
1647 the previous example can be built this way:
1648 </p>
1649 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1650 Linux bailey 1.2.13 #2 Wed Aug 28 16:29:41 GMT 1996 i586
1651 $ <b>gsc -link -o mylib.c m2</b>
1652 $ <b>gsc -obj -cc-options &quot;-D___SHARED&quot; m1.c m2.c mylib.c</b>
1653 m1.c:
1654 m2.c:
1655 mylib.c:
1656 $ <b>gcc -shared m1.o m2.o mylib.o -o mylib.so</b>
1657 </pre></td></tr></table>
1659 <p>Note that this shared-library is built using an incremental link file
1660 (it extends the Gambit runtime library with the procedures <code>pow2</code>
1661 and <code>twice</code>). This shared-library can in turn be used to build
1662 an executable program from the third module of the previous example:
1663 </p>
1664 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsc -link -l mylib m3</b>
1665 $ <b>gsc -obj m3.c m3_.c</b>
1666 m3.c:
1667 m3_.c:
1668 $ <b>gcc m3.o m3_.o mylib.so -lgambc</b>
1669 $ <b>LD_LIBRARY_PATH=.:/usr/local/lib ./a.out</b>
1670 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
1671 </pre></td></tr></table>
1673 <hr size="1">
1674 <a name="Other-compilation-options"></a>
1675 <table cellpadding="1" cellspacing="1" border="0">
1676 <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" alt="Back: 3.4.3 Building a shared-library" align="middle" width="32"></a></td>
1677 <td valign="middle" align="left"><a href="#Procedures-specific-to-compiler" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 3.5 Procedures specific to compiler" align="middle" width="32"></a></td>
1678 <td valign="middle" align="left"> &nbsp; </td>
1679 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1680 <td valign="middle" align="left"><a href="#Link-files" title="Up section"><img src="button-up.png" border="0" alt="Up: 3.4 Link files" align="middle" width="32"></a></td>
1681 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1682 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1683 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1684 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1685 </tr></table>
1686 <a name="Other-compilation-options-1"></a>
1687 <h3 class="subsection">3.4.4 Other compilation options</h3>
1689 <a name="index-_002dD_005f_005f_005fSINGLE_005fHOST"></a>
1690 <a name="index-_002dO"></a>
1691 <p>The performance of the code can be increased by passing the
1692 <samp>-D___SINGLE_HOST</samp> flag to the C compiler. This will merge all
1693 the procedures of a module into a single C procedure, which reduces
1694 the cost of intra-module procedure calls. In addition the <samp>-O</samp>
1695 option can be passed to the C compiler. For large modules, it will
1696 not be practical to specify both <samp>-O</samp> and <samp>-D___SINGLE_HOST</samp>
1697 for typical C compilers because the compile time will be high and the
1698 C compiler might even fail to compile the program for lack of memory.
1699 It has been observed that lower levels of optimization (e.g. <samp>-O1</samp>)
1700 often give faster compilation and also generate faster code. It is
1701 a good idea to experiment.
1702 </p>
1703 <a name="index-_002dI_002fusr_002flocal_002fGambit_002dC_002finclude"></a>
1704 <a name="index-_002dL_002fusr_002flocal_002fGambit_002dC_002flib"></a>
1705 <p>Normally C compilers will not automatically search
1706 <samp>/usr/local/Gambit-C/include</samp> for header files so the flag
1707 <samp>-I/usr/local/Gambit-C/include</samp> should be passed to the C
1708 compiler. Similarly, C compilers/linkers will not automatically
1709 search <samp>/usr/local/Gambit-C/lib</samp> for libraries so the flag
1710 <samp>-L/usr/local/Gambit-C/lib</samp> should be passed to the C
1711 compiler/linker. Alternatives are given in <a href="#Accessing-the-system-files">Accessing the system files</a>.
1712 </p>
1713 <a name="index-_002dshared"></a>
1714 <a name="index-_002dcall_005fshared"></a>
1715 <a name="index-_002drdynamic"></a>
1716 <a name="index-_002dfpic"></a>
1717 <a name="index-_002dfPIC"></a>
1718 <a name="index-_002dKpic"></a>
1719 <a name="index-_002dKPIC"></a>
1720 <a name="index-_002dpic"></a>
1721 <a name="index-_002bz"></a>
1722 <a name="index-_002dG"></a>
1723 <p>A variety of flags are needed by some C compilers when compiling a
1724 shared-library or a dynamically loadable library. Some of these flags
1725 are: <samp>-shared</samp>, <samp>-call_shared</samp>, <samp>-rdynamic</samp>,
1726 <samp>-fpic</samp>, <samp>-fPIC</samp>, <samp>-Kpic</samp>, <samp>-KPIC</samp>, <samp>-pic</samp>,
1727 <samp>+z</samp>, <samp>-G</samp>. Check your compiler&rsquo;s documentation to see
1728 which flag you need.
1729 </p>
1730 <hr size="1">
1731 <a name="Procedures-specific-to-compiler"></a>
1732 <table cellpadding="1" cellspacing="1" border="0">
1733 <tr><td valign="middle" align="left"><a href="#Other-compilation-options" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 3.4.4 Other compilation options" align="middle" width="32"></a></td>
1734 <td valign="middle" align="left"><a href="#Runtime-options" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 4. Runtime options" align="middle" width="32"></a></td>
1735 <td valign="middle" align="left"> &nbsp; </td>
1736 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1737 <td valign="middle" align="left"><a href="#GSC" title="Up section"><img src="button-up.png" border="0" alt="Up: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
1738 <td valign="middle" align="left"><a href="#Runtime-options" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 4. Runtime options" align="middle" width="32"></a></td>
1739 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
1740 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
1741 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
1742 </tr></table>
1743 <a name="Procedures-specific-to-compiler-1"></a>
1744 <h2 class="section">3.5 Procedures specific to compiler</h2>
1746 <p>The Gambit Scheme compiler features the following procedures that
1747 are not available in the Gambit Scheme interpreter.
1748 </p>
1749 <a name="Definition_of_compile-file-to-c"></a><a name="Procedure_compile-file-to-c"></a><a name="index-compile_002dfile_002dto_002dc"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_compile-file-to-c">compile-file-to-c</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>
1750 <a name="index-gsc-2"></a>
1752 <p>The <var>file</var> parameter must be a string naming an existing file
1753 containing Scheme source code. The extension can be omitted from
1754 <var>file</var> when the Scheme file has a <samp>.scm</samp> or <samp>.six</samp>
1755 extension. This procedure compiles the source file into a file
1756 containing C code. By default, this file is named after <var>file</var>
1757 with the extension replaced with <samp>.c</samp>. The name of the generated
1758 file can be specified with the <var>output</var> parameter. If
1759 <var>output</var> is a string naming a directory then the C file is created
1760 in that directory. Otherwise the name of the C file is <var>output</var>.
1761 The name of the generated module can be specified with the
1762 <var>module-name</var> parameter. If <var>module-name</var> is <code>#f</code> or is
1763 not specified, then the name of the module is derived from the name of
1764 the C file generated, without the extension.
1765 </p>
1766 <p>Compilation options are specified through the <var>options</var> parameter
1767 which must be a list of symbols. Any combination of the following
1768 options can be used: <samp>verbose</samp>, <samp>report</samp>, <samp>expansion</samp>,
1769 <samp>gvm</samp>, and <samp>debug</samp>.
1770 </p>
1771 <p>When the compilation is successful, <code>compile-file-to-c</code> returns
1772 the name of the C file generated. When there is a compilation error,
1773 <code>#f</code> is returned.
1774 </p>
1775 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat h.scm</b>
1776 (display &quot;hello&quot;) (newline)
1777 $ <b>gsc</b>
1778 Gambit v4.6.1
1780 &gt; <b>(compile-file-to-c &quot;h&quot;)</b>
1781 &quot;/Users/feeley/gambit/doc/h.c&quot;
1782 </pre></td></tr></table>
1785 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
1786 <a name="index-gsc-3"></a>
1787 <a name="index-load"></a>
1788 <a name="index-object-file"></a>
1790 <p>The <var>file</var>, <var>options</var>, and <var>output</var> parameters have the
1791 same meaning as for the <code>compile-file-to-c</code> procedure, except that
1792 <var>file</var> may be a Scheme source file or a
1793 C file possibly generated by the Gambit Scheme compiler (for example
1794 with the <code>compile-file-to-c</code> procedure). The
1795 <var>cc-options</var> parameter is a string containing the options to pass
1796 to the C compiler and the <var>ld-options-prelude</var> and
1797 <var>ld-options</var> parameters are strings containing the options to pass
1798 to the C linker (the options in <var>ld-options-prelude</var> are passed to
1799 the C linker before the input file and the options in <var>ld-options</var>
1800 are passed after).
1801 </p>
1802 <p>The <code>compile-file</code> procedure compiles the source file <var>file</var>
1803 into an object file, which is either a file dynamically loadable using
1804 the <code>load</code> procedure, or a C linkable object file destined to be
1805 linked with the C linker (for example to create a standalone
1806 executable program). The presence of the
1807 <code>obj</code> option in <var>options</var> will cause the creation of a C
1808 linkable object file and therefore the options
1809 <var>ld-options-prelude</var> and <var>ld-options</var> are ignored, otherwise a
1810 dynamically loadable file is created. In both cases, if <var>file</var> is
1811 a Scheme source file, the compiler first compiles <var>file</var> to a C
1812 file which is created in the same directory as <var>file</var> regardless
1813 of the <var>output</var> parameter. Then the C file is compiled with the C
1814 compiler.
1815 </p>
1816 <p>When the compilation is successful, <code>compile-file</code> returns the
1817 name of the object file generated. When there is a compilation error,
1818 <code>#f</code> is returned.
1819 </p>
1820 <p>The name of the object file can be specified with the <var>output</var>
1821 parameter. If <var>output</var> is a string naming a directory then the
1822 object file is created in that directory. Otherwise the name of the
1823 object file is <var>output</var>.
1824 </p>
1825 <p>In the case of a dynamically loadable object file, by default the
1826 object file is named after <var>file</var> with the extension replaced with
1827 <samp>.o<var>n</var></samp>, where <var>n</var> is a positive integer that acts as a
1828 version number. The next available version number is generated
1829 automatically by <code>compile-file</code>.
1830 </p>
1831 <p>When dynamically loaded object files are loaded using the <code>load</code>
1832 procedure, the <samp>.o<var>n</var></samp> extension can be specified (to select
1833 a particular version) or omitted (to load the file with a
1834 <samp>.o<var>n</var></samp> extension with the highest <var>n</var> consecutively from
1835 1). When the <samp>.o<var>n</var></samp> extension is not specified and older
1836 versions are no longer needed, all versions must be deleted and the
1837 compilation must be repeated (this is necessary because the file name,
1838 including the extension, is used to name some of the exported symbols
1839 of the object file).
1840 </p>
1841 <p>Note that dynamically loadable object files can only be generated on
1842 host operating systems that support dynamic loading.
1843 </p>
1844 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat h.scm</b>
1845 (display &quot;hello&quot;) (newline)
1846 $ <b>gsc</b>
1847 Gambit v4.6.1
1849 &gt; <b>(compile-file &quot;h&quot;)</b>
1850 &quot;/Users/feeley/gambit/doc/h.o1&quot;
1851 &gt; <b>(load &quot;h&quot;)</b>
1852 hello
1853 &quot;/Users/feeley/gambit/doc/h.o1&quot;
1854 &gt; <b>(compile-file-to-c &quot;h&quot; output: &quot;h.o99.c&quot;)</b>
1855 &quot;/Users/feeley/gambit/doc/h.o99.c&quot;
1856 &gt; <b>(compile-file &quot;h.o99.c&quot;)</b>
1857 &quot;/Users/feeley/gambit/doc/h.o99&quot;
1858 &gt; <b>(load &quot;h.o99&quot;)</b>
1859 hello
1860 &quot;/Users/feeley/gambit/doc/h.o99&quot;
1861 &gt; <b>(compile-file-to-c &quot;h&quot;)</b>
1862 &quot;/Users/feeley/gambit/doc/h.c&quot;
1863 &gt; <b>(compile-file &quot;h.c&quot; options: '(obj))</b>
1864 &quot;/Users/feeley/gambit/doc/h.o&quot;
1865 </pre></td></tr></table>
1869 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
1870 <a name="index-gsc-4"></a>
1872 <p>The first parameter must be a non empty list of strings naming Scheme
1873 modules to link (the file extension may be omitted). An incremental link
1874 file is generated for the modules specified in <var>module-list</var>. By
1875 default the link file generated is named <samp><var>last</var>_.c</samp>, where
1876 <var>last</var> is the name of the last module, without the file extension.
1877 The name of the generated
1878 link file can be specified with the <var>output</var> parameter. If
1879 <var>output</var> is a string naming a directory then the link file is
1880 created in that directory. Otherwise the name of the link file is
1881 <var>output</var>.
1882 </p>
1883 <p>The base link file is specified by the <var>base</var> parameter, which
1884 must be a string. By default the base link file is the Gambit runtime
1885 library link file <samp>~~lib/_gambc.c</samp>. However, when <var>base</var> is
1886 supplied it is the name of the base link file (the file extension
1887 may be omitted).
1888 </p>
1889 <p>The <var>warnings?</var> parameter controls whether warnings are
1890 generated for undefined references.
1891 </p>
1892 <p>The following example shows how to build the executable program
1893 <samp>hello</samp> which contains the two Scheme modules <samp>h.scm</samp> and
1894 <samp>w.six</samp>.
1895 </p>
1896 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1897 Darwin 8.1.0 Power Macintosh powerpc
1898 $ <b>cat h.scm</b>
1899 (display &quot;hello&quot;) (newline)
1900 $ <b>cat w.six</b>
1901 display(&quot;world&quot;); newline();
1902 $ <b>gsc</b>
1903 Gambit v4.6.1
1905 &gt; <b>(compile-file-to-c &quot;h&quot;)</b>
1906 &quot;/Users/feeley/gambit/doc/h.c&quot;
1907 &gt; <b>(compile-file-to-c &quot;w&quot;)</b>
1908 &quot;/Users/feeley/gambit/doc/w.c&quot;
1909 &gt; <b>(link-incremental '(&quot;h&quot; &quot;w&quot;) output: &quot;hello.c&quot;)</b>
1910 &quot;/Users/feeley/gambit/doc/hello_.c&quot;
1911 &gt; <b>,q</b>
1912 $ <b>gsc -obj h.c w.c hello.c</b>
1913 h.c:
1914 w.c:
1915 hello.c:
1916 $ <b>gcc h.o w.o hello.o -lgambc -o hello</b>
1917 $ <b>./hello</b>
1918 hello
1919 world
1920 </pre></td></tr></table>
1924 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
1925 <a name="index-gsc-5"></a>
1927 <p>The first parameter must be a non empty list of strings naming Scheme
1928 modules to link (the file extension may be omitted). The first string
1929 must be the name of a Scheme module
1930 or the name of a link file and the remaining strings must name Scheme
1931 modules. A flat link file
1932 is generated for the modules specified in <var>module-list</var>. By
1933 default the link file generated is named <samp><var>last</var>_.c</samp>, where
1934 <var>last</var> is the name of the last module. The name of the generated
1935 link file can be specified with the <var>output</var> parameter. If
1936 <var>output</var> is a string naming a directory then the link file is
1937 created in that directory. Otherwise the name of the link file is
1938 <var>output</var>. If a dynamically loadable object file is produced from
1939 the link file <samp><var>output</var></samp>, then the name of the dynamically
1940 loadable object file must be <samp><var>output</var></samp> stripped of its file
1941 extension.
1942 </p>
1943 <p>The <var>warnings?</var> parameter controls whether warnings are
1944 generated for undefined references.
1945 </p>
1946 <p>The following example shows how to build the dynamically loadable object
1947 file <samp>lib.o1</samp> which contains the two Scheme modules
1948 <samp>m6.scm</samp> and <samp>m7.scm</samp>.
1949 </p>
1950 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>uname -srmp</b>
1951 Darwin 8.1.0 Power Macintosh powerpc
1952 $ <b>cat m6.scm</b>
1953 (define (f x) (g (* x x)))
1954 $ <b>cat m7.scm</b>
1955 (define (g y) (+ n y))
1956 $ <b>gsc</b>
1957 Gambit v4.6.1
1959 &gt; <b>(compile-file-to-c &quot;m6&quot;)</b>
1960 &quot;/Users/feeley/gambit/doc/m6.c&quot;
1961 &gt; <b>(compile-file-to-c &quot;m7&quot;)</b>
1962 &quot;/Users/feeley/gambit/doc/m7.c&quot;
1963 &gt; <b>(link-flat '(&quot;m6&quot; &quot;m7&quot;) output: &quot;lib.o1.c&quot;)</b>
1964 *** WARNING -- &quot;*&quot; is not defined,
1965 *** referenced in: (&quot;m6.c&quot;)
1966 *** WARNING -- &quot;+&quot; is not defined,
1967 *** referenced in: (&quot;m7.c&quot;)
1968 *** WARNING -- &quot;n&quot; is not defined,
1969 *** referenced in: (&quot;m7.c&quot;)
1970 &quot;/Users/feeley/gambit/doc/lib.o1.c&quot;
1971 &gt; <b>,q</b>
1972 $ <b>gcc -bundle -D___DYNAMIC m6.c m7.c lib.o1.c -o lib.o1</b>
1973 $ <b>gsc</b>
1974 Gambit v4.6.1
1976 &gt; <b>(load &quot;lib&quot;)</b>
1977 *** WARNING -- Variable &quot;n&quot; used in module &quot;m7&quot; is undefined
1978 &quot;/Users/feeley/gambit/doc/lib.o1&quot;
1979 &gt; <b>(define n 10)</b>
1980 &gt; <b>(f 5)</b>
1982 &gt; <b>,q</b>
1983 </pre></td></tr></table>
1985 <p>The warnings indicate that there are no definitions (<code>define</code>s or
1986 <code>set!</code>s) of the variables <code>*</code>, <code>+</code> and <code>n</code> in the
1987 modules contained in the library. Before the library is used, these
1988 variables will have to be bound; either implicitly (by the runtime
1989 library) or explicitly.
1990 </p>
1993 <hr size="1">
1994 <a name="Runtime-options"></a>
1995 <table cellpadding="1" cellspacing="1" border="0">
1996 <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" alt="Back: 3.5 Procedures specific to compiler" align="middle" width="32"></a></td>
1997 <td valign="middle" align="left"><a href="#Debugging" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5. Debugging" align="middle" width="32"></a></td>
1998 <td valign="middle" align="left"> &nbsp; </td>
1999 <td valign="middle" align="left"><a href="#GSC" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 3. The Gambit Scheme compiler" align="middle" width="32"></a></td>
2000 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
2001 <td valign="middle" align="left"><a href="#Debugging" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 5. Debugging" align="middle" width="32"></a></td>
2002 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2003 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2004 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2005 </tr></table>
2006 <a name="Runtime-options-1"></a>
2007 <h1 class="chapter">4. Runtime options</h1>
2008 <a name="index-runtime-options"></a>
2009 <a name="index-options_002c-runtime"></a>
2011 <a name="index-gsc-6"></a>
2012 <a name="index-gsi-2"></a>
2013 <p>Both <code>gsi</code> and <code>gsc</code> as well as executable programs compiled
2014 and linked using <code>gsc</code> take a <samp>-:</samp> option which supplies
2015 parameters to the runtime system. This option must appear first on
2016 the command line. The colon is followed by a comma separated list of
2017 options with no intervening spaces. The available options are:
2018 </p>
2019 <dl compact="compact">
2020 <dt> <code>m<var>HEAPSIZE</var></code></dt>
2021 <dd><p>Set minimum heap size in kilobytes.
2022 </p></dd>
2023 <dt> <code>h<var>HEAPSIZE</var></code></dt>
2024 <dd><p>Set maximum heap size in kilobytes.
2025 </p></dd>
2026 <dt> <code>l<var>LIVEPERCENT</var></code></dt>
2027 <dd><p>Set heap occupation after garbage collection.
2028 </p></dd>
2029 <dt> <code>s</code></dt>
2030 <dd><p>Select standard Scheme mode.
2031 </p></dd>
2032 <dt> <code>S</code></dt>
2033 <dd><p>Select Gambit Scheme mode.
2034 </p></dd>
2035 <dt> <code>d<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
2036 <dd><p>Set debugging options.
2037 </p></dd>
2038 <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>
2039 <dd><p>Override the configuration of the main RPC server.
2040 </p></dd>
2041 <dt> <code>=<var>DIRECTORY</var></code></dt>
2042 <dd><p>Override the central installation directory.
2043 </p></dd>
2044 <dt> <code>~~<var>DIR</var>=<var>DIRECTORY</var></code></dt>
2045 <dd><p>Override the <var>DIR</var> installation directory.
2046 </p></dd>
2047 <dt> <code>+<var>ARGUMENT</var></code></dt>
2048 <dd><p>Add <var>ARGUMENT</var> to the command line before other arguments.
2049 </p></dd>
2050 <dt> <code>f<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
2051 <dd><p>Set file options.
2052 </p></dd>
2053 <dt> <code>t<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
2054 <dd><p>Set terminal options.
2055 </p></dd>
2056 <dt> <code>-<span class="roman">[</span><var>OPT</var>...<span class="roman">]</span></code></dt>
2057 <dd><p>Set standard input and output options.
2058 </p></dd>
2059 </dl>
2061 <a name="index-_002d_003am"></a>
2062 <p>The <samp>m</samp> option specifies the minimum size of the heap. The
2063 <samp>m</samp> is immediately followed by an integer indicating the number
2064 of kilobytes of memory. The heap will not shrink lower than this
2065 size. By default, the minimum size is 0.
2066 </p>
2067 <a name="index-_002d_003ah"></a>
2068 <p>The <samp>h</samp> option specifies the maximum size of the heap. The
2069 <samp>h</samp> is immediately followed by an integer indicating the number
2070 of kilobytes of memory. The heap will not grow larger than this size.
2071 By default, there is no limit (i.e. the heap will grow until the
2072 virtual memory is exhausted).
2073 </p>
2074 <a name="index-_002d_003al"></a>
2075 <p>The <samp>l</samp> option specifies the percentage of the heap that will be
2076 occupied with live objects after the heap is resized at the end of a
2077 garbage collection. The <samp>l</samp> is immediately followed by an
2078 integer between 1 and 100 inclusively indicating the desired
2079 percentage. The garbage collector resizes the heap to reach this
2080 percentage occupation. By default, the percentage is 50.
2081 </p>
2082 <a name="index-_002d_003as"></a>
2083 <a name="index-_002d_003aS"></a>
2084 <p>The <samp>s</samp> option selects standard Scheme mode. In this mode the
2085 reader is case-insensitive and keywords are not recognized. The
2086 <samp>S</samp> option selects Gambit Scheme mode (the reader is case-sensitive
2087 and recognizes keywords which end with a colon). By default Gambit
2088 Scheme mode is used.
2089 </p>
2090 <a name="index-_002d_003ad"></a>
2091 <p>The <samp>d</samp> option sets various debugging options. The letter
2092 <samp>d</samp> is followed by a sequence of letters indicating suboptions.
2093 </p>
2094 <dl compact="compact">
2095 <dt> <code>p</code></dt>
2096 <dd><a name="index-_002d_003adp"></a>
2097 <p>Uncaught exceptions will be treated as &ldquo;errors&rdquo; in the primordial thread
2098 only.
2099 </p>
2100 </dd>
2101 <dt> <code>a</code></dt>
2102 <dd><a name="index-_002d_003ada"></a>
2103 <p>Uncaught exceptions will be treated as &ldquo;errors&rdquo; in all threads.
2104 </p>
2105 </dd>
2106 <dt> <code>r</code></dt>
2107 <dd><a name="index-_002d_003adr"></a>
2108 <p>When an &ldquo;error&rdquo; occurs a new REPL will be started.
2109 </p>
2110 </dd>
2111 <dt> <code>s</code></dt>
2112 <dd><a name="index-_002d_003ads"></a>
2113 <p>When an &ldquo;error&rdquo; occurs a new REPL will be started.
2114 Moreover the program starts in single-stepping mode.
2115 </p>
2116 </dd>
2117 <dt> <code>q</code></dt>
2118 <dd><a name="index-_002d_003adq"></a>
2119 <p>When an &ldquo;error&rdquo; occurs the program will terminate with a nonzero
2120 exit status.
2121 </p>
2122 </dd>
2123 <dt> <code>R</code></dt>
2124 <dd><a name="index-_002d_003adR"></a>
2125 <a name="index-_005eC"></a>
2126 <p>When a user interrupt occurs a new REPL will be started. User
2127 interrupts are typically obtained by typing &lt;^C&gt;. Note that with
2128 some system configurations &lt;^C&gt; abruptly terminates the process.
2129 For example, under Microsoft Windows, &lt;^C&gt; works fine with the
2130 standard console but with the MSYS terminal window it terminates the
2131 process.
2132 </p>
2133 </dd>
2134 <dt> <code>D</code></dt>
2135 <dd><a name="index-_002d_003adD"></a>
2136 <p>When a user interrupt occurs it will be deferred until the parameter
2137 <code>current-user-interrupt-handler</code> is bound.
2138 </p>
2139 </dd>
2140 <dt> <code>Q</code></dt>
2141 <dd><a name="index-_002d_003adQ"></a>
2142 <p>When a user interrupt occurs the program will terminate with a nonzero
2143 exit status.
2144 </p>
2145 </dd>
2146 <dt> <code><var>LEVEL</var></code></dt>
2147 <dd><a name="index-_002d_003adLEVEL"></a>
2148 <p>The verbosity level is set to <var>LEVEL</var> (a digit from 0 to 9).
2149 At level 0 the runtime system will not display error messages
2150 and warnings.
2151 </p>
2152 </dd>
2153 <dt> <code>i</code></dt>
2154 <dd><a name="index-_002d_003adi"></a>
2155 <p>The REPL interaction channel will be the IDE REPL window (if the IDE
2156 is available).
2157 </p>
2158 </dd>
2159 <dt> <code>c</code></dt>
2160 <dd><a name="index-_002d_003adc"></a>
2161 <p>The REPL interaction channel will be the console.
2162 </p>
2163 </dd>
2164 <dt> <code>-</code></dt>
2165 <dd><a name="index-_002d_003ad_002d"></a>
2166 <p>The REPL interaction channel will be standard input and standard output.
2167 </p>
2168 </dd>
2169 <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>
2170 <dd><a name="index-_002d_003ad_0040_005bHOST_005d_005b_003aPORT_005d"></a>
2171 <p>The REPL interaction channel will be connected to the remote debugger
2172 at address <var>HOST</var>:<var>PORT</var> (if there is a remote debugger at
2173 that address). The default <var>HOST</var> is 127.0.0.1 and the default
2174 <var>PORT</var> is 44555.
2175 THIS OPTION IS NOT YET IMPLEMENTED!
2176 </p>
2177 </dd>
2178 </dl>
2180 <p>The default debugging options are equivalent to <code>-:dpqQ1i</code>
2181 (i.e. an uncaught exception in the primordial thread terminates the
2182 program after displaying an error message). When the letter <samp>d</samp>
2183 is not followed by suboptions, it is equivalent to <code>-:dprR1i</code>
2184 (i.e. a new REPL is started only when an uncaught exception occurs in
2185 the primordial thread). When <code>gsi</code> and <code>gsc</code> are running
2186 the main REPL, the debugging options are changed to cause errors in
2187 the primordial thread and user interrupts to start a nested REPL.
2188 </p>
2189 <a name="index-_002d_003a_0040"></a>
2190 <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
2191 overrides the configuration of the main RPC server. The default
2192 <var>INTF</var> is 127.0.0.1 and the default <var>PORT</var> is 44556.
2193 THIS OPTION IS NOT YET IMPLEMENTED!
2194 </p>
2195 <a name="index-_002d_003a_003d"></a>
2196 <p>The <samp>=<var>DIRECTORY</var></samp> option overrides the setting of the
2197 central installation directory.
2198 </p>
2199 <a name="index-_002d_003a_007e_007e"></a>
2200 <p>The <samp>~~<var>DIR</var>=<var>DIRECTORY</var></samp> option overrides the setting of
2201 the <var>DIR</var> installation directory.
2202 </p>
2203 <a name="index-_002d_003a_002b"></a>
2204 <p>The <samp>+</samp> option adds the text that follows to the command line
2205 before other arguments.
2206 </p>
2207 <a name="index-_002d_003af"></a>
2208 <a name="index-_002d_003at"></a>
2209 <a name="index-_002d_003a_002d"></a>
2210 <p>The <samp>f</samp>, <samp>t</samp> and <samp>-</samp> options specify the default
2211 settings of the ports created for files, terminals and standard input
2212 and output respectively. The default character encoding, end-of-line
2213 encoding and buffering can be set. Moreover, for terminals the
2214 line-editing feature can be enabled or disabled. The <samp>f</samp>,
2215 <samp>t</samp> and <samp>-</samp> must be followed by a sequence of these options:
2216 </p>
2217 <dl compact="compact">
2218 <dt> <code>A</code></dt>
2219 <dd><p>ASCII character encoding.
2220 </p></dd>
2221 <dt> <code>1</code></dt>
2222 <dd><p>ISO-8859-1 character encoding.
2223 </p></dd>
2224 <dt> <code>2</code></dt>
2225 <dd><p>UCS-2 character encoding.
2226 </p></dd>
2227 <dt> <code>4</code></dt>
2228 <dd><p>UCS-4 character encoding.
2229 </p></dd>
2230 <dt> <code>6</code></dt>
2231 <dd><p>UTF-16 character encoding.
2232 </p></dd>
2233 <dt> <code>8</code></dt>
2234 <dd><p>UTF-8 character encoding.
2235 </p></dd>
2236 <dt> <code>U</code></dt>
2237 <dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present.
2238 </p></dd>
2239 <dt> <code>UA</code></dt>
2240 <dd><p>UTF character encoding with fallback to ASCII on input if no BOM is present.
2241 </p></dd>
2242 <dt> <code>U1</code></dt>
2243 <dd><p>UTF character encoding with fallback to ISO-8859-1 on input if no BOM is present.
2244 </p></dd>
2245 <dt> <code>U6</code></dt>
2246 <dd><p>UTF character encoding with fallback to UTF-16 on input if no BOM is present.
2247 </p></dd>
2248 <dt> <code>U8</code></dt>
2249 <dd><p>UTF character encoding with fallback to UTF-8 on input if no BOM is present.
2250 </p></dd>
2251 <dt> <code>c</code></dt>
2252 <dd><p>End-of-line is encoded as CR (carriage-return).
2253 </p></dd>
2254 <dt> <code>l</code></dt>
2255 <dd><p>End-of-line is encoded as LF (linefeed)
2256 </p></dd>
2257 <dt> <code>cl</code></dt>
2258 <dd><p>End-of-line is encoded as CR-LF.
2259 </p></dd>
2260 <dt> <code>u</code></dt>
2261 <dd><p>Unbuffered I/O.
2262 </p></dd>
2263 <dt> <code>n</code></dt>
2264 <dd><p>Line buffered I/O (<samp>n</samp> for &ldquo;at newline&rdquo;).
2265 </p></dd>
2266 <dt> <code>f</code></dt>
2267 <dd><p>Fully buffered I/O.
2268 </p></dd>
2269 <dt> <code>r</code></dt>
2270 <dd><p>Illegal character encoding is treated as an error (exception raised).
2271 </p></dd>
2272 <dt> <code>R</code></dt>
2273 <dd><p>Silently replace illegal character encodings with Unicode character #xfffd
2274 (replacement character).
2275 </p></dd>
2276 <dt> <code>e</code></dt>
2277 <dd><p>Enable line-editing (applies to terminals only).
2278 </p></dd>
2279 <dt> <code>E</code></dt>
2280 <dd><p>Disable line-editing (applies to terminals only).
2281 </p></dd>
2282 </dl>
2284 <a name="index-_002d_003a_003a"></a>
2285 <a name="index-GAMBCOPT_002c-environment-variable"></a>
2286 <p>When a program&rsquo;s execution starts, the runtime system obtains the
2287 runtime options by processing in turn four sources of runtime options:
2288 the defaults, the environment variable <samp>GAMBCOPT</samp>, the script
2289 line of the source code, and the first command line argument of the
2290 program. Any runtime option can be overriden by a subsequent source
2291 of runtime options. It is sometimes useful to prevent overriding
2292 the runtime options of the script line. This can be achieved by
2293 starting the script line runtime options with <samp>-::</samp>. In
2294 this case the environment variable <samp>GAMBCOPT</samp> is ignored,
2295 and the first command line argument of the program is
2296 not used for runtime options (it is treated like a normal
2297 command line argument).
2298 </p>
2299 <p>For example:
2300 </p>
2301 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>GAMBCOPT=d0,=~/my-gambit2</b>
2302 $ <b>export GAMBCOPT</b>
2303 $ <b>gsi -e '(pretty-print (path-expand &quot;~~&quot;)) (/ 1 0)'</b>
2304 &quot;/Users/feeley/my-gambit2/&quot;
2305 $ <b>echo $?</b>
2307 $ <b>gsi -:d1 -e '(pretty-print (path-expand &quot;~~&quot;)) (/ 1 0)'</b>
2308 &quot;/Users/feeley/my-gambit2/&quot;
2309 *** ERROR IN (string)@1.3 -- Divide by zero
2310 (/ 1 0)
2311 </pre></td></tr></table>
2313 <hr size="1">
2314 <a name="Debugging"></a>
2315 <table cellpadding="1" cellspacing="1" border="0">
2316 <tr><td valign="middle" align="left"><a href="#Runtime-options" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 4. Runtime options" align="middle" width="32"></a></td>
2317 <td valign="middle" align="left"><a href="#Debugging-model" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.1 Debugging model" align="middle" width="32"></a></td>
2318 <td valign="middle" align="left"> &nbsp; </td>
2319 <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" alt="FastBack: 4. Runtime options" align="middle" width="32"></a></td>
2320 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
2321 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
2322 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2323 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2324 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2325 </tr></table>
2326 <a name="Debugging-1"></a>
2327 <h1 class="chapter">5. Debugging</h1>
2329 <table class="menu" border="0" cellspacing="0">
2330 <tr><td align="left" valign="top"><a href="#Debugging-model">5.1 Debugging model</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2331 <tr><td align="left" valign="top"><a href="#Debugging-commands">5.2 Debugging commands</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2332 <tr><td align="left" valign="top"><a href="#Debugging-example">5.3 Debugging example</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2333 <tr><td align="left" valign="top"><a href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2334 <tr><td align="left" valign="top"><a href="#Console-line_002dediting">5.5 Console line-editing</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2335 <tr><td align="left" valign="top"><a href="#Emacs-interface">5.6 Emacs interface</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2336 <tr><td align="left" valign="top"><a href="#GUIDE">5.7 GUIDE</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
2337 </table>
2339 <hr size="1">
2340 <a name="Debugging-model"></a>
2341 <table cellpadding="1" cellspacing="1" border="0">
2342 <tr><td valign="middle" align="left"><a href="#Debugging" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5. Debugging" align="middle" width="32"></a></td>
2343 <td valign="middle" align="left"><a href="#Debugging-commands" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.2 Debugging commands" align="middle" width="32"></a></td>
2344 <td valign="middle" align="left"> &nbsp; </td>
2345 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
2346 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
2347 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
2348 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2349 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2350 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2351 </tr></table>
2352 <a name="Debugging-model-1"></a>
2353 <h2 class="section">5.1 Debugging model</h2>
2355 <p>The evaluation of an expression may stop before it is completed for the
2356 following reasons:
2357 </p>
2358 <ol>
2359 <li> An evaluation error has occured, such as attempting to
2360 divide by zero.
2362 <a name="index-_005eC-1"></a>
2363 </li><li> The user has interrupted the evaluation (usually by typing &lt;^C&gt;).
2365 </li><li> A breakpoint has been reached or <code>(step)</code> was evaluated.
2367 </li><li> Single-stepping mode is enabled.
2369 </li></ol>
2371 <p>When an evaluation stops, a message is displayed indicating the reason
2372 and location where the evaluation was stopped. The location
2373 information includes, if known, the name of the procedure where the
2374 evaluation was stopped and the source code location in the format
2375 <samp><var>stream</var>@<var>line</var>.<var>column</var></samp>, where <var>stream</var> is
2376 either a string naming a file or a symbol within parentheses, such as
2377 <samp>(console)</samp>.
2378 </p>
2379 <p>A <em>nested REPL</em> is then initiated in the context of the point of
2380 execution where the evaluation was stopped. The nested REPL&rsquo;s
2381 continuation and evaluation environment are the same as the point where
2382 the evaluation was stopped. For example when evaluating the expression
2383 <samp>(let ((y (- 1 1))) (* (/ x y) 2))</samp>, a &ldquo;divide by zero&rdquo; error is
2384 reported and the nested REPL&rsquo;s continuation is the one that takes the
2385 result and multiplies it by two. The REPL&rsquo;s lexical environment
2386 includes the lexical variable <samp>y</samp>. This allows the inspection of
2387 the evaluation context (i.e. the lexical and dynamic environments and
2388 continuation), which is particularly useful to determine the exact
2389 location and cause of an error.
2390 </p>
2391 <a name="index-_005eD"></a>
2392 <p>The prompt of nested REPLs includes the nesting level; <samp>1&gt;</samp> is the
2393 prompt at the first nesting level, <samp>2&gt;</samp> at the second nesting
2394 level, and so on. An end of file (usually &lt;^D&gt;) will cause the
2395 current REPL to be terminated and the enclosing REPL (one nesting level
2396 less) to be resumed.
2397 </p>
2398 <p>At any time the user can examine the frames in the REPL&rsquo;s
2399 continuation, which is useful to determine which chain of procedure
2400 calls lead to an error. A backtrace that lists the chain of active
2401 continuation frames in the REPL&rsquo;s continuation can be obtained with
2402 the <samp>,b</samp> command. The frames are numbered from 0, that is frame
2403 0 is the most recent frame of the continuation where execution
2404 stopped, frame 1 is the parent frame of frame 0, and so on. It is
2405 also possible to move the REPL to a specific parent continuation
2406 (i.e. a specific frame of the continuation where execution stopped)
2407 with the <samp>,<var>N</var></samp>, <samp>,<var>N</var>+</samp>, <samp>,<var>N</var>-</samp>,
2408 <samp>,+</samp>, <samp>,-</samp>, <samp>,++</samp>, and <samp>,--</samp> commands. When the
2409 frame number of the frame being examined is not zero, it is shown in
2410 the prompt after the nesting level, for example <samp>1\5&gt;</samp> is the
2411 prompt when the REPL nesting level is 1 and the frame number is 5.
2412 </p>
2413 <p>Expressions entered at a nested REPL are evaluated in the environment
2414 (both lexical and dynamic) of the continuation frame currently being
2415 examined if that frame was created by interpreted Scheme code. If the
2416 frame was created by compiled Scheme code then expressions get evaluated
2417 in the global interaction environment. This feature may be used in
2418 interpreted code to fetch the value of a variable in the current frame
2419 or to change its value with <code>set!</code>. Note that some special forms
2420 (<code>define</code> in particular) can only be evaluated in the global
2421 interaction environment.
2422 </p>
2423 <hr size="1">
2424 <a name="Debugging-commands"></a>
2425 <table cellpadding="1" cellspacing="1" border="0">
2426 <tr><td valign="middle" align="left"><a href="#Debugging-model" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.1 Debugging model" align="middle" width="32"></a></td>
2427 <td valign="middle" align="left"><a href="#Debugging-example" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.3 Debugging example" align="middle" width="32"></a></td>
2428 <td valign="middle" align="left"> &nbsp; </td>
2429 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
2430 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
2431 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
2432 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2433 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2434 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2435 </tr></table>
2436 <a name="Debugging-commands-1"></a>
2437 <h2 class="section">5.2 Debugging commands</h2>
2439 <p>In addition to expressions, the REPL accepts the following special
2440 &ldquo;comma&rdquo; commands:
2441 </p>
2442 <dl compact="compact">
2443 <dt> <code>,?</code></dt>
2444 <dd><a name="index-_002c_003f"></a>
2445 <p>Give a summary of the REPL commands.
2446 </p>
2447 </dd>
2448 <dt> <code>,(h <var>subject</var>)</code></dt>
2449 <dd><a name="index-_002c_0028h-subject_0029"></a>
2450 <p>This command will show the section of the Gambit manual with the
2451 definition of the procedure or special form <var>subject</var>, which must
2452 be a symbol. For example <samp>,(h time)</samp> will show the section
2453 documenting the <code>time</code> special form. Please see the <code>help</code>
2454 procedure for additional information.
2455 </p>
2456 </dd>
2457 <dt> <code>,h</code></dt>
2458 <dd><a name="index-_002ch"></a>
2459 <p>This command will show the section of the Gambit manual with the
2460 definition of the procedure which raised the exception for which this
2461 REPL was started.
2462 </p>
2463 </dd>
2464 <dt> <code>,q</code></dt>
2465 <dd><a name="index-_002cq"></a>
2466 <p>Terminate the process with exit status 0. This is equivalent to
2467 calling <code>(exit 0)</code>.
2468 </p>
2469 </dd>
2470 <dt> <code>,qt</code></dt>
2471 <dd><a name="index-_002cqt"></a>
2472 <p>Terminate the current thread (note that terminating the primordial
2473 thread terminates the process).
2474 </p>
2475 </dd>
2476 <dt> <code>,t</code></dt>
2477 <dd><a name="index-_002ct"></a>
2478 <p>Return to the outermost REPL, also known as the &ldquo;top-level REPL&rdquo;.
2479 </p>
2480 </dd>
2481 <dt> <code>,d</code></dt>
2482 <dd><a name="index-_002cd"></a>
2483 <p>Leave the current REPL and resume the enclosing REPL. This command does
2484 nothing in the top-level REPL.
2485 </p>
2486 </dd>
2487 <dt> <code>,(c <var>expr</var>)</code></dt>
2488 <dd><a name="index-_002c_0028c-expr_0029"></a>
2489 <p>Leave the current REPL and continue the computation that initiated the
2490 REPL with a specific value. This command can only be used to continue
2491 a computation that signaled an error. The expression <var>expr</var> is
2492 evaluated in the current context and the resulting value is returned
2493 as the value of the expression which signaled the error. For example,
2494 if the evaluation of the expression <samp>(* (/ x y) 2)</samp> signaled an
2495 error because <samp>y</samp> is zero, then in the nested REPL a <samp>,(c (+
2496 4 y))</samp> will resume the computation of <samp>(* (/ x y) 2)</samp> as though
2497 the value of <samp>(/ x y)</samp> was 4. This command must be used
2498 carefully because the context where the error occured may rely on the
2499 result being of a particular type. For instance a <samp>,(c #f)</samp> in
2500 the previous example will cause <samp>*</samp> to signal a type error (this
2501 problem is the most troublesome when debugging Scheme code that was
2502 compiled with type checking turned off so be careful).
2503 </p>
2504 </dd>
2505 <dt> <code>,c</code></dt>
2506 <dd><a name="index-_002cc"></a>
2507 <p>Leave the current REPL and continue the computation that initiated the
2508 REPL. This command can only be used to continue a computation that was
2509 stopped due to a user interrupt, breakpoint or a single-step.
2510 </p>
2511 </dd>
2512 <dt> <code>,s</code></dt>
2513 <dd><a name="index-_002cs"></a>
2514 <p>Leave the current REPL and continue the computation that initiated the
2515 REPL in single-stepping mode. The computation will perform an
2516 evaluation step (as defined by <code>step-level-set!</code>) and then stop,
2517 causing a nested REPL to be entered. Just before the evaluation step is
2518 performed, a line is displayed (in the same format as <code>trace</code>)
2519 which indicates the expression that is being evaluated. If the
2520 evaluation step produces a result, the result is also displayed on
2521 another line. A nested REPL is then entered after displaying a message
2522 which describes the next step of the computation. This command can
2523 only be used to continue a computation that was stopped due to a user
2524 interrupt, breakpoint or a single-step.
2525 </p>
2526 </dd>
2527 <dt> <code>,l</code></dt>
2528 <dd><a name="index-_002cl"></a>
2529 <p>This command is similar to <samp>,s</samp> except that it &ldquo;leaps&rdquo; over
2530 procedure calls, that is procedure calls are treated like a single step.
2531 Single-stepping mode will resume when the procedure call returns, or if
2532 and when the execution of the called procedure encounters a breakpoint.
2533 </p>
2534 </dd>
2535 <dt> <code>,<var>N</var></code></dt>
2536 <dd><a name="index-_002cN"></a>
2537 <p>Move to frame number <var>N</var> of the continuation. After changing the
2538 current frame, a one-line summary of the frame is displayed as if the
2539 <samp>,y</samp> command was entered.
2540 </p>
2541 </dd>
2542 <dt> <code>,<var>N</var>+</code></dt>
2543 <dd><a name="index-_002cN_002b"></a>
2544 <p>Move forward by <var>N</var> frames in the chain of continuation frames
2545 (i.e. towards older continuation frames). After changing the current
2546 frame, a one-line summary of the frame is displayed as if the
2547 <samp>,y</samp> command was entered.
2548 </p>
2549 </dd>
2550 <dt> <code>,<var>N</var>-</code></dt>
2551 <dd><a name="index-_002cN_002d"></a>
2552 <p>Move backward by <var>N</var> frames in the chain of continuation frames
2553 (i.e. towards more recent continuation frames). After changing the
2554 current frame, a one-line summary of the frame is displayed as if the
2555 <samp>,y</samp> command was entered.
2556 </p>
2557 </dd>
2558 <dt> <code>,+</code></dt>
2559 <dd><a name="index-_002c_002b"></a>
2560 <p>Equivalent to <samp>,1+</samp>.
2561 </p>
2562 </dd>
2563 <dt> <code>,-</code></dt>
2564 <dd><a name="index-_002c_002d"></a>
2565 <p>Equivalent to <samp>,1-</samp>.
2566 </p>
2567 </dd>
2568 <dt> <code>,++</code></dt>
2569 <dd><a name="index-_002c_002b_002b"></a>
2570 <p>Equivalent to <samp>,<var>N</var>+</samp> where <var>N</var> is the number of
2571 continuation frames displayed at the head of a backtrace.
2572 </p>
2573 </dd>
2574 <dt> <code>,--</code></dt>
2575 <dd><a name="index-_002c_002d_002d"></a>
2576 <p>Equivalent to <samp>,<var>N</var>-</samp> where <var>N</var> is the number of
2577 continuation frames displayed at the head of a backtrace.
2578 </p>
2579 </dd>
2580 <dt> <code>,y</code></dt>
2581 <dd><a name="index-_002cy"></a>
2582 <p>Display a one-line summary of the current frame. The information is
2583 displayed in four fields. The first field is the frame number. The
2584 second field is the procedure that created the frame or
2585 <samp>(interaction)</samp> if the frame was created by an expression entered
2586 at the REPL. The remaining fields describe the subproblem associated
2587 with the frame, that is the expression whose value is being computed.
2588 The third field is the location of the subproblem&rsquo;s source code and
2589 the fourth field is a reproduction of the source code, possibly
2590 truncated to fit on the line. The last two fields may be missing if
2591 that information is not available. In particular, the third field is
2592 missing when the frame was created by a user call to the <samp>eval</samp>
2593 procedure or by a compiled procedure not compiled with the declaration
2594 <samp>debug-location</samp>, and the last field is missing when the frame
2595 was created by a compiled procedure not compiled with the declaration
2596 <samp>debug-source</samp>.
2597 </p>
2598 </dd>
2599 <dt> <code>,b</code></dt>
2600 <dd><a name="index-_002cb"></a>
2601 <p>Display a backtrace summarizing each frame in the chain of continuation
2602 frames starting with the current frame. For each frame, the same
2603 information as for the <samp>,y</samp> command is displayed (except that
2604 location information is displayed in the format
2605 <samp><var>stream</var>@<var>line</var>:<var>column</var></samp>). If there are more than 15
2606 frames in the chain of continuation frames, some of the middle frames
2607 will be omitted.
2608 </p>
2609 </dd>
2610 <dt> <code>,be</code></dt>
2611 <dd><a name="index-_002cbe"></a>
2612 <p>Like the <samp>,b</samp> command but also display the environment.
2613 </p>
2614 </dd>
2615 <dt> <code>,bed</code></dt>
2616 <dd><a name="index-_002cbed"></a>
2617 <p>Like the <samp>,be</samp> command but also display the dynamic environment.
2618 </p>
2619 </dd>
2620 <dt> <code>,(b <var>expr</var>)</code></dt>
2621 <dd><a name="index-_002c_0028b-expr_0029"></a>
2622 <p>Display the backtrace of <var>expr</var>&rsquo;s value, <var>X</var>, which is
2623 obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
2624 be a continuation or a thread. When <var>X</var> is a continuation, the
2625 frames in that continuation are displayed. When <var>X</var> is a thread,
2626 the backtrace of the current continuation of that thread is displayed.
2627 </p>
2628 </dd>
2629 <dt> <code>,(be <var>expr</var>)</code></dt>
2630 <dd><a name="index-_002c_0028be-expr_0029"></a>
2631 <p>Like the <samp>,(b <var>expr</var>)</samp> command but also display the
2632 environment.
2633 </p>
2634 </dd>
2635 <dt> <code>,(bed <var>expr</var>)</code></dt>
2636 <dd><a name="index-_002c_0028bed-expr_0029"></a>
2637 <p>Like the <samp>,(be <var>expr</var>)</samp> command but also display the dynamic
2638 environment.
2639 </p>
2640 </dd>
2641 <dt> <code>,i</code></dt>
2642 <dd><a name="index-_002ci"></a>
2643 <p>Pretty print the procedure that created the current frame or
2644 <samp>(interaction)</samp> if the frame was created by an expression entered
2645 at the REPL. Compiled procedures will only be pretty printed when
2646 they are compiled with the declaration <samp>debug-source</samp>.
2647 </p>
2648 </dd>
2649 <dt> <code>,e</code></dt>
2650 <dd><a name="index-_002ce"></a>
2651 <p>Display the environment which is accessible from the current frame.
2652 The lexical environment is displayed, followed by the dynamic
2653 environment if the parameter object
2654 <code>repl-display-dynamic-environment?</code> is not false. Global lexical
2655 variables are not displayed. Moreover the frame must have been
2656 created by interpreted code or code compiled with the declaration
2657 <samp>debug-environments</samp>. Due to space safety
2658 considerations and compiler optimizations, some of the lexical
2659 variable bindings may be missing. Lexical variable bindings are
2660 displayed using the format <samp><var>variable</var> = <var>expression</var></samp>
2661 (when <var>variable</var> is mutable) or <samp><var>variable</var> == <var>expression</var></samp>
2662 (when <var>variable</var> is immutable, which may happen in compiled code
2663 due to compiler optimization)
2664 and dynamically-bound parameter bindings are displayed using the
2665 format <samp>(<var>parameter</var>) = <var>expression</var></samp>. Note that
2666 <var>expression</var> can be a self-evaluating expression (number, string,
2667 boolean, character, ...), a quoted expression, a lambda expression or
2668 a global variable (the last two cases, which are only used when the
2669 value of the variable or parameter is a procedure, simplifies the
2670 debugging of higher-order procedures). A <var>parameter</var> can be a
2671 quoted expression or a global variable. Lexical bindings are
2672 displayed in inverse binding order (most deeply nested first) and
2673 shadowed variables are included in the list.
2674 </p>
2675 </dd>
2676 <dt> <code>,ed</code></dt>
2677 <dd><a name="index-_002ced"></a>
2678 <p>Like the <samp>,e</samp> command but the dynamic environment is always
2679 displayed.
2680 </p>
2681 </dd>
2682 <dt> <code>,(e <var>expr</var>)</code></dt>
2683 <dd><a name="index-_002c_0028e-expr_0029"></a>
2684 <p>Display the environment of <var>expr</var>&rsquo;s value, <var>X</var>, which is
2685 obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
2686 be a continuation, a thread, a procedure, or a nonnegative integer.
2687 When <var>X</var> is a continuation, the environment at that point in the
2688 code is displayed. When <var>X</var> is a thread, the environment of the
2689 current continuation of that thread is displayed. When <var>X</var> is a
2690 procedure, the lexical environment where <var>X</var> was created is
2691 combined with the current continuation and this combined environment
2692 is displayed. When <var>X</var> is an integer, the environment at frame
2693 number <var>X</var> of the continuation is displayed.
2694 </p>
2695 </dd>
2696 <dt> <code>,(ed <var>expr</var>)</code></dt>
2697 <dd><a name="index-_002c_0028ed-expr_0029"></a>
2698 <p>Like the <samp>,(e <var>expr</var>)</samp> command but the dynamic environment is
2699 always displayed.
2700 </p>
2701 </dd>
2702 <dt> <code>,st</code></dt>
2703 <dd><a name="index-_002cst"></a>
2704 <p>Display the state of the threads in the current thread&rsquo;s thread group.
2705 A thread can be: uninitialized, initialized, active, and
2706 terminated (normally or abnormally). Active threads can be
2707 running, sleeping and waiting on a synchronization object
2708 (mutex, condition variable or port) possibly with a timeout.
2709 </p>
2710 </dd>
2711 <dt> <code>,(st <var>expr</var>)</code></dt>
2712 <dd><a name="index-_002c_0028st-expr_0029"></a>
2713 <p>Display the state of a specific thread or thread group.
2714 The value of <var>expr</var> must be a thread or thread group.
2715 </p>
2716 </dd>
2717 <dt> <code>,(v <var>expr</var>)</code></dt>
2718 <dd><a name="index-_002c_0028v-expr_0029"></a>
2719 <p>Start a new REPL visiting <var>expr</var>&rsquo;s value, <var>X</var>, which is
2720 obtained by evaluating <var>expr</var> in the current frame. <var>X</var> must
2721 be a continuation, a thread, a procedure, or a nonnegative integer.
2722 When <var>X</var> is a continuation, the new REPL&rsquo;s continuation is <var>X</var>
2723 and evaluations are done in the environment at that point in the code.
2724 When <var>X</var> is a thread, the thread is interrupted and the new REPL&rsquo;s
2725 continuation is the point where the thread was interrupted. When
2726 <var>X</var> is a procedure, the lexical environment where <var>X</var> was
2727 created is combined with the current continuation and evaluations are
2728 done in this combined environment. When <var>X</var> is an integer, the
2729 REPL is started in frame number <var>X</var> of the continuation.
2730 </p>
2731 </dd>
2732 </dl>
2734 <hr size="1">
2735 <a name="Debugging-example"></a>
2736 <table cellpadding="1" cellspacing="1" border="0">
2737 <tr><td valign="middle" align="left"><a href="#Debugging-commands" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.2 Debugging commands" align="middle" width="32"></a></td>
2738 <td valign="middle" align="left"><a href="#Procedures-related-to-debugging" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.4 Procedures related to debugging" align="middle" width="32"></a></td>
2739 <td valign="middle" align="left"> &nbsp; </td>
2740 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
2741 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
2742 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
2743 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2744 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2745 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2746 </tr></table>
2747 <a name="Debugging-example-1"></a>
2748 <h2 class="section">5.3 Debugging example</h2>
2750 <p>Here is a sample interaction with <code>gsi</code>:
2751 </p>
2752 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi</b>
2753 Gambit v4.6.1
2755 &gt; <b>(define (invsqr x) (/ 1 (expt x 2)))</b>
2756 &gt; <b>(define (mymap fn lst)
2757 (define (mm in)
2758 (if (null? in)
2760 (cons (fn (car in)) (mm (cdr in)))))
2761 (mm lst))</b>
2762 &gt; <b>(mymap invsqr '(5 2 hello 9 1))</b>
2763 *** ERROR IN invsqr, (console)@1.25 -- (Argument 1) NUMBER expected
2764 (expt 'hello 2)
2765 1&gt; <b>,i</b>
2766 #&lt;procedure #2 invsqr&gt; =
2767 (lambda (x) (/ 1 (expt x 2)))
2768 1&gt; <b>,e</b>
2769 x = 'hello
2770 1&gt; <b>,b</b>
2771 0 invsqr (console)@1:25 (expt x 2)
2772 1 #&lt;procedure #4&gt; (console)@6:17 (fn (car in))
2773 2 #&lt;procedure #4&gt; (console)@6:31 (mm (cdr in))
2774 3 #&lt;procedure #4&gt; (console)@6:31 (mm (cdr in))
2775 4 (interaction) (console)@8:1 (mymap invsqr '(5 2 hel...
2776 1&gt; <b>,+</b>
2777 1 #&lt;procedure #4&gt; (console)@6.17 (fn (car in))
2778 1\1&gt; <b>(pp #4)</b>
2779 (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
2780 1\1&gt; <b>,e</b>
2781 in = '(hello 9 1)
2782 mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
2783 fn = invsqr
2784 lst = '(5 2 hello 9 1)
2785 1\1&gt; <b>,(e mm)</b>
2786 mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
2787 fn = invsqr
2788 lst = '(5 2 hello 9 1)
2789 1\1&gt; <b>fn</b>
2790 #&lt;procedure #2 invsqr&gt;
2791 1\1&gt; <b>(pp fn)</b>
2792 (lambda (x) (/ 1 (expt x 2)))
2793 1\1&gt; <b>,+</b>
2794 2 #&lt;procedure #4&gt; (console)@6.31 (mm (cdr in))
2795 1\2&gt; <b>,e</b>
2796 in = '(2 hello 9 1)
2797 mm = (lambda (in) (if (null? in) '() (cons (fn (car in)) (mm (cdr in)))))
2798 fn = invsqr
2799 lst = '(5 2 hello 9 1)
2800 1\2&gt; <b>,(c (list 3 4 5))</b>
2801 (1/25 1/4 3 4 5)
2802 &gt; <b>,q</b>
2803 </pre></td></tr></table>
2805 <hr size="1">
2806 <a name="Procedures-related-to-debugging"></a>
2807 <table cellpadding="1" cellspacing="1" border="0">
2808 <tr><td valign="middle" align="left"><a href="#Debugging-example" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.3 Debugging example" align="middle" width="32"></a></td>
2809 <td valign="middle" align="left"><a href="#Console-line_002dediting" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.5 Console line-editing" align="middle" width="32"></a></td>
2810 <td valign="middle" align="left"> &nbsp; </td>
2811 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
2812 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
2813 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
2814 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
2815 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
2816 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
2817 </tr></table>
2818 <a name="Procedures-related-to-debugging-1"></a>
2819 <h2 class="section">5.4 Procedures related to debugging</h2>
2821 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
2822 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
2824 <p>The <code>help</code> procedure displays the section of the Gambit manual
2825 with the definition of the procedure or special form <var>subject</var>,
2826 which must be a procedure or symbol. For example the call <code>(help
2827 gensym)</code> will show the section documenting the <code>gensym</code> procedure
2828 and the call <code>(help 'time)</code> will show the section documenting the
2829 <code>time</code> special form. The <code>help</code> procedure returns the void
2830 object.
2831 </p>
2832 <p>The parameter object <code>help-browser</code> is bound to a string naming
2833 the external program that is used by the <code>help</code> procedure to view
2834 the documentation. Initially it is bound to the empty string. In
2835 normal circumstances when <code>help-browser</code> is bound to an empty
2836 string the <code>help</code> procedure runs the script
2837 <code>~~bin/gambc-doc.bat</code> which searches for a suitable web browser
2838 to open the documentation in HTML format. Unless the system was built
2839 with the command <samp>configure --enable-help-browser=...</samp>, the
2840 text-only browser <samp>lynx</samp> (see <a href="http://lynx.isc.org/">http://lynx.isc.org/</a>) will
2841 be used by default if it is available. We highly recommend that you
2842 install this browser if you are interested in viewing the
2843 documentation within the console in which the REPL is running. You
2844 can exit <samp>lynx</samp> conveniently by typing an end of file (usually
2845 &lt;^D&gt;).
2846 </p>
2847 <p>For example:
2848 </p>
2849 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(help-browser &quot;firefox&quot;)</b> <span class="roman"><i>; use firefox instead of lynx</i></span>
2850 &gt; <b>(help 'gensym)</b>
2851 &gt; <b>(help gensym)</b> <span class="roman"><i>; OK because gensym is a procedure</i></span>
2852 &gt; <b>(help 'time)</b>
2853 &gt; <b>(help time)</b> <span class="roman"><i>; not OK because time is a special form</i></span>
2854 *** ERROR IN (console)@5.7 -- Macro name can't be used as a variable: time
2855 &gt;
2856 </pre></td></tr></table>
2860 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
2861 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
2863 <a name="index-_0023"></a>
2864 <a name="index-_0023_0023"></a>
2865 <p>The REPL keeps a history of the last few results printed by the
2866 REPL. The call <code>(repl-result-history-ref <var>i</var>)</code> returns the
2867 <var>i</var>th previous result (the last for <var>i</var>=0, the next to last
2868 for <var>i</var>=1, etc). By default the REPL result history remembers up
2869 to 3 results. The maximal length of the history can be set to <var>n</var>
2870 between 0 and 10 by a call to
2871 <code>(repl-result-history-max-length-set! <var>n</var>)</code>.
2872 </p>
2873 <p>For convenience the reader defines an abbreviation for calling
2874 <code>repl-result-history-ref</code>. Tokens formed by a sequence of one or
2875 more hash signs, such as <samp><code>#</code></samp>, <samp><code>##</code></samp>, etc, are
2876 expanded by the reader into the list <code>(repl-result-history-ref
2877 <var>i</var>)</code>, where <var>i</var> is the number of hash signs minus 1. In
2878 other words, <samp><code>#</code></samp> will return the last result printed by
2879 the REPL, <samp><code>##</code></samp> will return the next to last, etc.
2880 </p>
2881 <p>For example:
2882 </p>
2883 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map (lambda (x) (* x x)) '(1 2 3))</b>
2884 (1 4 9)
2885 &gt; <b>(reverse #)</b>
2886 (9 4 1)
2887 &gt; <b>(append # ##)</b>
2888 (9 4 1 1 4 9)
2889 &gt; <b>1</b>
2891 &gt; <b>1</b>
2893 &gt; <b>(+ # ##)</b>
2895 &gt; <b>(+ # ##)</b>
2897 &gt; <b>(+ # ##)</b>
2899 &gt; <b>####</b>
2900 *** ERROR IN (console)@9.1 -- (Argument 1) Out of range
2901 (repl-result-history-ref 3)
2902 1&gt;
2903 </pre></td></tr></table>
2907 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_trace">trace</a></b></code><i> <var>proc</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
2908 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_untrace">untrace</a></b></code><i> <var>proc</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
2910 <p>The <code>trace</code> procedure starts tracing calls to the specified
2911 procedures. When a traced procedure is called, a line containing the
2912 procedure and its arguments is displayed (using the procedure call
2913 expression syntax). The line is indented with a sequence of vertical
2914 bars which indicate the nesting depth of the procedure&rsquo;s continuation.
2915 After the vertical bars is a greater-than sign which indicates that
2916 the evaluation of the call is starting.
2917 </p>
2918 <p>When a traced procedure returns a result, it is displayed with the same
2919 indentation as the call but without the greater-than sign. This makes
2920 it easy to match calls and results (the result of a given call is the
2921 value at the same indentation as the greater-than sign). If a traced
2922 procedure P1 performs a tail call to a traced procedure P2, then P2 will
2923 use the same indentation as P1. This makes it easy to spot tail calls.
2924 The special handling for tail calls is needed to preserve the space
2925 complexity of the program (i.e. tail calls are implemented as required
2926 by Scheme even when they involve traced procedures).
2927 </p>
2928 <p>The <code>untrace</code> procedure stops tracing calls to the specified
2929 procedures. When no argument is passed to the <code>trace</code>
2930 procedure, the list of procedures currently being traced is returned.
2931 The void object is returned by the <code>trace</code> procedure when it is
2932 passed one or more arguments. When no argument is passed to the
2933 <code>untrace</code> procedure stops all tracing and returns the void
2934 object. A compiled procedure may be traced but only if it is bound to
2935 a global variable.
2936 </p>
2937 <p>For example:
2938 </p>
2939 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (fact n) (if (&lt; n 2) 1 (* n (fact (- n 1)))))</b>
2940 &gt; <b>(trace fact)</b>
2941 &gt; <b>(fact 5)</b>
2942 | &gt; (fact 5)
2943 | | &gt; (fact 4)
2944 | | | &gt; (fact 3)
2945 | | | | &gt; (fact 2)
2946 | | | | | &gt; (fact 1)
2947 | | | | | 1
2948 | | | | 2
2949 | | | 6
2950 | | 24
2951 | 120
2953 &gt; <b>(trace -)</b>
2954 *** WARNING -- Rebinding global variable &quot;-&quot; to an interpreted procedure
2955 &gt; <b>(define (fact-iter n r) (if (&lt; n 2) r (fact-iter (- n 1) (* n r))))</b>
2956 &gt; <b>(trace fact-iter)</b>
2957 &gt; <b>(fact-iter 5 1)</b>
2958 | &gt; (fact-iter 5 1)
2959 | | &gt; (- 5 1)
2960 | | 4
2961 | &gt; (fact-iter 4 5)
2962 | | &gt; (- 4 1)
2963 | | 3
2964 | &gt; (fact-iter 3 20)
2965 | | &gt; (- 3 1)
2966 | | 2
2967 | &gt; (fact-iter 2 60)
2968 | | &gt; (- 2 1)
2969 | | 1
2970 | &gt; (fact-iter 1 120)
2971 | 120
2973 &gt; <b>(trace)</b>
2974 (#&lt;procedure #2 fact-iter&gt; #&lt;procedure #3 -&gt; #&lt;procedure #4 fact&gt;)
2975 &gt; <b>(untrace)</b>
2976 &gt; <b>(fact 5)</b>
2978 </pre></td></tr></table>
2982 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_step">step</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
2983 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
2985 <p>The <code>step</code> procedure enables single-stepping mode. After the call
2986 to <code>step</code> the computation will stop just before the interpreter
2987 executes the next evaluation step (as defined by
2988 <code>step-level-set!</code>). A nested REPL is then started. Note that
2989 because single-stepping is stopped by the REPL whenever the prompt is
2990 displayed it is pointless to enter <code>(step)</code> by itself. On the
2991 other hand entering <code>(begin (step) <var>expr</var>)</code> will evaluate
2992 <var>expr</var> in single-stepping mode.
2993 </p>
2994 <p>The procedure <code>step-level-set!</code> sets the stepping level which
2995 determines the granularity of the evaluation steps when single-stepping
2996 is enabled. The stepping level <var>level</var> must be an exact integer in
2997 the range 0 to 7. At a level of 0, the interpreter ignores
2998 single-stepping mode. At higher levels the interpreter stops the
2999 computation just before it performs the following operations, depending
3000 on the stepping level:
3001 </p>
3002 <ol>
3003 <li>
3004 procedure call
3007 </li><li>
3008 <code>delay</code> special form and operations at lower levels
3010 </li><li>
3011 <code>lambda</code> special form and operations at lower levels
3013 </li><li>
3014 <code>define</code> special form and operations at lower levels
3016 </li><li>
3017 <code>set!</code> special form and operations at lower levels
3019 </li><li>
3020 variable reference and operations at lower levels
3022 </li><li>
3023 constant reference and operations at lower levels
3025 </li></ol>
3027 <p>The default stepping level is 7.
3028 </p>
3029 <p>For example:
3030 </p>
3031 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (fact n) (if (&lt; n 2) 1 (* n (fact (- n 1)))))</b>
3032 &gt; <b>(step-level-set! 1)</b>
3033 &gt; <b>(begin (step) (fact 5))</b>
3034 *** STOPPED IN (console)@3.15
3035 1&gt; <b>,s</b>
3036 | &gt; (fact 5)
3037 *** STOPPED IN fact, (console)@1.22
3038 1&gt; <b>,s</b>
3039 | | &gt; (&lt; n 2)
3040 | | #f
3041 *** STOPPED IN fact, (console)@1.43
3042 1&gt; <b>,s</b>
3043 | | &gt; (- n 1)
3044 | | 4
3045 *** STOPPED IN fact, (console)@1.37
3046 1&gt; <b>,s</b>
3047 | | &gt; (fact (- n 1))
3048 *** STOPPED IN fact, (console)@1.22
3049 1&gt; <b>,s</b>
3050 | | | &gt; (&lt; n 2)
3051 | | | #f
3052 *** STOPPED IN fact, (console)@1.43
3053 1&gt; <b>,s</b>
3054 | | | &gt; (- n 1)
3055 | | | 3
3056 *** STOPPED IN fact, (console)@1.37
3057 1&gt; <b>,l</b>
3058 | | | &gt; (fact (- n 1))
3059 *** STOPPED IN fact, (console)@1.22
3060 1&gt; <b>,l</b>
3061 | | &gt; (* n (fact (- n 1)))
3062 | | 24
3063 *** STOPPED IN fact, (console)@1.32
3064 1&gt; <b>,l</b>
3065 | &gt; (* n (fact (- n 1)))
3066 | 120
3068 </pre></td></tr></table>
3072 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_break">break</a></b></code><i> <var>proc</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
3073 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_unbreak">unbreak</a></b></code><i> <var>proc</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
3075 <p>The <code>break</code> procedure places a breakpoint on each of the
3076 specified procedures. When a procedure is called that has a
3077 breakpoint, the interpreter will enable single-stepping mode (as if
3078 <code>step</code> had been called). This typically causes the computation
3079 to stop soon inside the procedure if the stepping level is high
3080 enough.
3081 </p>
3082 <p>The <code>unbreak</code> procedure removes the breakpoints on the specified
3083 procedures. With no argument, <code>break</code> returns the list of
3084 procedures currently containing breakpoints. The void object is
3085 returned by <code>break</code> if it is passed one or more arguments. With
3086 no argument <code>unbreak</code> removes all the breakpoints and returns the
3087 void object. A breakpoint can be placed on a compiled procedure but
3088 only if it is bound to a global variable.
3089 </p>
3090 <p>For example:
3091 </p>
3092 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (double x) (+ x x))</b>
3093 &gt; <b>(define (triple y) (- (double (double y)) y))</b>
3094 &gt; <b>(define (f z) (* (triple z) 10))</b>
3095 &gt; <b>(break double)</b>
3096 &gt; <b>(break -)</b>
3097 *** WARNING -- Rebinding global variable &quot;-&quot; to an interpreted procedure
3098 &gt; <b>(f 5)</b>
3099 *** STOPPED IN double, (console)@1.21
3100 1&gt; <b>,b</b>
3101 0 double (console)@1:21 +
3102 1 triple (console)@2:31 (double y)
3103 2 f (console)@3:18 (triple z)
3104 3 (interaction) (console)@6:1 (f 5)
3105 1&gt; <b>,e</b>
3106 x = 5
3107 1&gt; <b>,c</b>
3108 *** STOPPED IN double, (console)@1.21
3109 1&gt; <b>,c</b>
3110 *** STOPPED IN f, (console)@3.29
3111 1&gt; <b>,c</b>
3113 &gt; <b>(break)</b>
3114 (#&lt;procedure #3 -&gt; #&lt;procedure #4 double&gt;)
3115 &gt; <b>(unbreak)</b>
3116 &gt; <b>(f 5)</b>
3118 </pre></td></tr></table>
3122 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3124 <a name="index-proper-tail_002dcalls"></a>
3125 <a name="index-tail_002dcalls"></a>
3127 <p>[Note: this procedure is DEPRECATED and will be removed
3128 in a future version of Gambit. Use the <samp>proper-tail-calls</samp>
3129 declaration instead.]
3130 </p>
3131 <p>The parameter object <code>generate-proper-tail-calls</code> is bound to a
3132 boolean value controlling how the interpreter handles tail calls.
3133 When it is bound to <code>#f</code> the interpreter will treat tail calls
3134 like nontail calls, that is a new continuation will be created for the
3135 call. This setting is useful for debugging, because when a primitive
3136 signals an error the location information will point to the call site
3137 of the primitive even if this primitive was called with a tail call.
3138 The initial value of this parameter object is <code>#t</code>, which means
3139 that a tail call will reuse the continuation of the calling function.
3140 </p>
3141 <p>This parameter object only affects code that is subsequently processed
3142 by <code>load</code> or <code>eval</code>, or entered at the REPL.
3143 </p>
3144 <p>For example:
3145 </p>
3146 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(generate-proper-tail-calls)</b>
3148 &gt; <b>(let loop ((i 1)) (if (&lt; i 10) (loop (* i 2)) oops))</b>
3149 *** ERROR IN #&lt;procedure #2&gt;, (console)@2.47 -- Unbound variable: oops
3150 1&gt; <b>,b</b>
3151 0 #&lt;procedure #2&gt; (console)@2:47 oops
3152 1 (interaction) (console)@2:1 ((letrec ((loop (lambda...
3153 1&gt; <b>,t</b>
3154 &gt; <b>(generate-proper-tail-calls #f)</b>
3155 &gt; <b>(let loop ((i 1)) (if (&lt; i 10) (loop (* i 2)) oops))</b>
3156 *** ERROR IN #&lt;procedure #3&gt;, (console)@6.47 -- Unbound variable: oops
3157 1&gt; <b>,b</b>
3158 0 #&lt;procedure #3&gt; (console)@6:47 oops
3159 1 #&lt;procedure #3&gt; (console)@6:32 (loop (* i 2))
3160 2 #&lt;procedure #3&gt; (console)@6:32 (loop (* i 2))
3161 3 #&lt;procedure #3&gt; (console)@6:32 (loop (* i 2))
3162 4 #&lt;procedure #3&gt; (console)@6:32 (loop (* i 2))
3163 5 (interaction) (console)@6:1 ((letrec ((loop (lambda...
3165 </pre></td></tr></table>
3169 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3171 <p>[Note: this procedure is DEPRECATED and will be removed
3172 in a future version of Gambit. Use the parameter object
3173 <code>repl-display-environment?</code> instead.]
3174 </p>
3175 <p>This procedure sets a flag that controls the automatic display of the
3176 environment by the REPL. If <var>display?</var> is true, the environment
3177 is displayed by the REPL before the prompt. The default setting is
3178 not to display the environment.
3179 </p>
3182 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3184 <p>The parameter object <code>repl-display-environment?</code> is bound to a
3185 boolean value that controls the automatic display of the environment
3186 by the REPL. If <var>display?</var> is true, the environment is displayed
3187 by the REPL before the prompt. This is particularly useful in
3188 single-stepping mode. The default setting is not to display the
3189 environment.
3190 </p>
3193 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3195 <p>The parameter object <code>display-dynamic-environment?</code> is bound to a
3196 boolean value that controls wether the dynamic environment is
3197 displayed when the environment is displayed. The default setting is
3198 not to display the dynamic environment.
3199 </p>
3202 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3204 <p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. If it
3205 is not specified, <var>port</var> defaults to the current output-port.
3206 </p>
3207 <p>For example:
3208 </p>
3209 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(pretty-print
3210 (let* ((x '(1 2 3 4)) (y (list x x x))) (list y y y)))</b>
3211 (((1 2 3 4) (1 2 3 4) (1 2 3 4))
3212 ((1 2 3 4) (1 2 3 4) (1 2 3 4))
3213 ((1 2 3 4) (1 2 3 4) (1 2 3 4)))
3214 </pre></td></tr></table>
3218 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3220 <p>This procedure pretty-prints <var>obj</var> on the port <var>port</var>. When
3221 <var>obj</var> is a procedure created by the interpreter or a procedure
3222 created by code compiled with the declaration
3223 <samp>debug-source</samp>, the procedure&rsquo;s source code is
3224 displayed. If it is not specified, <var>port</var> defaults to the
3225 interaction channel (i.e. the output will appear at the REPL).
3226 </p>
3227 <p>For example:
3228 </p>
3229 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (f g) (+ (time (g 100)) (time (g 1000))))</b>
3230 &gt; <b>(pp f)</b>
3231 (lambda (g)
3232 (+ (##time (lambda () (g 100)) '(g 100))
3233 (##time (lambda () (g 1000)) '(g 1000))))
3234 </pre></td></tr></table>
3238 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3239 <a name="index-GC"></a>
3241 <p>This procedure controls the generation of reports during garbage
3242 collections. If the argument is true, a brief report of memory usage
3243 is generated after every garbage collection. It contains: the time
3244 taken for this garbage collection, the amount of memory allocated in
3245 megabytes since the program was started, the size of the heap in
3246 megabytes, the heap memory in megabytes occupied by live data, the
3247 proportion of the heap occupied by live data, and the number of bytes
3248 occupied by movable and nonmovable objects.
3249 </p>
3252 <hr size="1">
3253 <a name="Console-line_002dediting"></a>
3254 <table cellpadding="1" cellspacing="1" border="0">
3255 <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" alt="Back: 5.4 Procedures related to debugging" align="middle" width="32"></a></td>
3256 <td valign="middle" align="left"><a href="#Emacs-interface" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.6 Emacs interface" align="middle" width="32"></a></td>
3257 <td valign="middle" align="left"> &nbsp; </td>
3258 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
3259 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
3260 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
3261 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3262 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3263 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3264 </tr></table>
3265 <a name="Console-line_002dediting-1"></a>
3266 <h2 class="section">5.5 Console line-editing</h2>
3268 <p>The console implements a simple Scheme-friendly line-editing
3269 user-interface that is enabled by default. It offers parentheses
3270 balancing, a history of previous commands, symbol completion, and
3271 several emacs-compatible keyboard commands. The user&rsquo;s input is
3272 displayed in a bold font and the output produced by the system is in a
3273 plain font. The history of previous commands is saved in the file
3274 &lsquo;<tt>~/.gambc_history</tt>&rsquo;. It is restored when a REPL is started.
3275 </p>
3276 <p>Symbol completion is triggered with the tab key. When the cursor is
3277 after a sequence of characters that can form a symbol, typing the tab
3278 key will search the symbol table for the first symbol (in alphabetical
3279 order) that begins with that sequence and insert that symbol. Typing
3280 the tab key in succession will cycle through all symbols with that
3281 prefix. When all possible symbols have been shown or there are no
3282 possible completions, the text reverts to the uncompleted symbol and
3283 the bell is rung.
3284 </p>
3285 <p>Here are the keyboard commands available (where the <samp><code>M-</code></samp>
3286 prefix means the escape key is typed and the <samp><code>C-</code></samp> prefix
3287 means the control key is pressed):
3288 </p>
3289 <dl compact="compact">
3290 <dt> <code>C-d</code></dt>
3291 <dd><p>Generate an end-of-file when the line is empty, otherwise delete
3292 character at cursor.
3293 </p>
3294 </dd>
3295 <dt> <code>delete <span class="roman">or backspace</span></code></dt>
3296 <dd><p>Delete character before cursor.
3297 </p>
3298 </dd>
3299 <dt> <code>M-C-d</code></dt>
3300 <dd><p>Delete word forward and keep a copy of this text on the clipboard.
3301 </p>
3302 </dd>
3303 <dt> <code>M-delete</code></dt>
3304 <dd><p>Delete word backward and keep a copy of this text on the clipboard.
3305 </p>
3306 </dd>
3307 <dt> <code>M-backspace</code></dt>
3308 <dd><p>Delete S-expression backward and keep a copy of this text on the clipboard.
3309 </p>
3310 </dd>
3311 <dt> <code>C-a</code></dt>
3312 <dd><p>Move cursor to beginning of line.
3313 </p>
3314 </dd>
3315 <dt> <code>C-e</code></dt>
3316 <dd><p>Move cursor to end of line.
3317 </p>
3318 </dd>
3319 <dt> <code>C-b <span class="roman">or <i>left-arrow</i></span></code></dt>
3320 <dd><p>Move cursor left one character.
3321 </p>
3322 </dd>
3323 <dt> <code>M-b</code></dt>
3324 <dd><p>Move cursor left one word.
3325 </p>
3326 </dd>
3327 <dt> <code>M-C-b <span class="roman">or <code>M-</code><i>left-arrow</i></span></code></dt>
3328 <dd><p>Move cursor left one S-expression.
3329 </p>
3330 </dd>
3331 <dt> <code>C-f <span class="roman">or <i>right-arrow</i></span></code></dt>
3332 <dd><p>Move cursor right one character.
3333 </p>
3334 </dd>
3335 <dt> <code>M-f</code></dt>
3336 <dd><p>Move cursor right one word.
3337 </p>
3338 </dd>
3339 <dt> <code>M-C-f <span class="roman">or <code>M-</code><i>right-arrow</i></span></code></dt>
3340 <dd><p>Move cursor right one S-expression.
3341 </p>
3342 </dd>
3343 <dt> <code>C-p <span class="roman">or <code>M-p</code> or <i>up-arrow</i></span></code></dt>
3344 <dd><p>Move to previous line in history.
3345 </p>
3346 </dd>
3347 <dt> <code>C-n <span class="roman">or <code>M-n</code> or <i>down-arrow</i></span></code></dt>
3348 <dd><p>Move to next line in history.
3349 </p>
3350 </dd>
3351 <dt> <code>C-t</code></dt>
3352 <dd><p>Transpose character at cursor with previous character.
3353 </p>
3354 </dd>
3355 <dt> <code>M-t</code></dt>
3356 <dd><p>Transpose word after cursor with previous word.
3357 </p>
3358 </dd>
3359 <dt> <code>M-C-t</code></dt>
3360 <dd><p>Transpose S-expression after cursor with previous S-expression.
3361 </p>
3362 </dd>
3363 <dt> <code>C-l</code></dt>
3364 <dd><p>Clear console and redraw line being edited.
3365 </p>
3366 </dd>
3367 <dt> <code>C-<i>nul</i></code></dt>
3368 <dd><p>Set the mark to the cursor.
3369 </p>
3370 </dd>
3371 <dt> <code>C-w</code></dt>
3372 <dd><p>Delete the text between the cursor and the mark and keep a copy
3373 of this text on the clipboard.
3374 </p>
3375 </dd>
3376 <dt> <code>C-k</code></dt>
3377 <dd><p>Delete the text from the cursor to the end of the line and keep a copy
3378 of this text on the clipboard.
3379 </p>
3380 </dd>
3381 <dt> <code>C-y</code></dt>
3382 <dd><p>Paste the text that is on the clipboard.
3383 </p>
3384 </dd>
3385 <dt> <code>F8</code></dt>
3386 <dd><p>Same as typing <samp>#||#,c;</samp> (REPL command to continue the computation).
3387 </p>
3388 </dd>
3389 <dt> <code>F9</code></dt>
3390 <dd><p>Same as typing <samp>#||#,-;</samp> (REPL command to move to newer frame).
3391 </p>
3392 </dd>
3393 <dt> <code>F10</code></dt>
3394 <dd><p>Same as typing <samp>#||#,+;</samp> (REPL command to move to older frame).
3395 </p>
3396 </dd>
3397 <dt> <code>F11</code></dt>
3398 <dd><p>Same as typing <samp>#||#,s;</samp> (REPL command to step the computation).
3399 </p>
3400 </dd>
3401 <dt> <code>F12</code></dt>
3402 <dd><p>Same as typing <samp>#||#,l;</samp> (REPL command to leap the computation).
3403 </p>
3404 </dd>
3405 </dl>
3407 <p>On Mac OS X, depending on your configuration, you may have to press
3408 the <code>fn</code> key to access the function key <code>F12</code> and the
3409 <code>option</code> key to access the other function keys.
3410 </p>
3411 <p>On Microsoft Windows the clipboard is the system clipboard. This
3412 allows text to be copied and pasted between the program and other
3413 applications. On other operating systems the clipboard is internal to
3414 the program (it is not integrated with the operating system).
3415 </p>
3416 <hr size="1">
3417 <a name="Emacs-interface"></a>
3418 <table cellpadding="1" cellspacing="1" border="0">
3419 <tr><td valign="middle" align="left"><a href="#Console-line_002dediting" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.5 Console line-editing" align="middle" width="32"></a></td>
3420 <td valign="middle" align="left"><a href="#GUIDE" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 5.7 GUIDE" align="middle" width="32"></a></td>
3421 <td valign="middle" align="left"> &nbsp; </td>
3422 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
3423 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
3424 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
3425 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3426 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3427 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3428 </tr></table>
3429 <a name="Emacs-interface-1"></a>
3430 <h2 class="section">5.6 Emacs interface</h2>
3431 <a name="index-Emacs"></a>
3432 <a name="index-gambit_002eel"></a>
3434 <p>Gambit comes with the Emacs package <samp>gambit.el</samp> which provides a
3435 nice environment for running Gambit from within the Emacs editor.
3436 This package filters the standard output of the Gambit process and
3437 when it intercepts a location information (in the format
3438 <samp><var>stream</var>@<var>line</var>.<var>column</var></samp> where <var>stream</var> is
3439 either <samp>(stdin)</samp> when the expression was obtained from standard
3440 input, <samp>(console)</samp> when the expression was obtained from the
3441 console, or a string naming a file) it opens a window to highlight the
3442 corresponding expression.
3443 </p>
3444 <p>To use this package, make sure the file <samp>gambit.el</samp> is accessible
3445 from your load-path and that the following lines are in your
3446 <samp>.emacs</samp> file:
3447 </p>
3448 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(autoload 'gambit-inferior-mode &quot;gambit&quot; &quot;Hook Gambit mode into cmuscheme.&quot;)
3449 (autoload 'gambit-mode &quot;gambit&quot; &quot;Hook Gambit mode into scheme.&quot;)
3450 (add-hook 'inferior-scheme-mode-hook (function gambit-inferior-mode))
3451 (add-hook 'scheme-mode-hook (function gambit-mode))
3452 (setq scheme-program-name &quot;gsi -:d-&quot;)
3453 </pre></td></tr></table>
3455 <p>Alternatively, if you don&rsquo;t mind always loading this package,
3456 you can simply add this line to your <samp>.emacs</samp> file:
3457 </p>
3458 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(require 'gambit)
3459 </pre></td></tr></table>
3461 <p>You can then start an inferior Gambit process by typing <samp>M-x
3462 run-scheme</samp>. The commands provided in <samp>cmuscheme</samp> mode will be
3463 available in the Gambit interaction buffer (i.e. <samp>*scheme*</samp>) and in
3464 buffers attached to Scheme source files. Here is a list of the most
3465 useful commands (for a complete list type <samp>C-h m</samp> in the Gambit
3466 interaction buffer):
3467 </p><dl compact="compact">
3468 <dt> <code>C-x C-e</code></dt>
3469 <dd><p>Evaluate the expression which is before the cursor (the expression will
3470 be copied to the Gambit interaction buffer).
3471 </p></dd>
3472 <dt> <code>C-c C-z</code></dt>
3473 <dd><p>Switch to Gambit interaction buffer.
3474 </p></dd>
3475 <dt> <code>C-c C-l</code></dt>
3476 <dd><p>Load a file (file attached to current buffer is default) using
3477 <code>(load <var>file</var>)</code>.
3478 </p></dd>
3479 <dt> <code>C-c C-k</code></dt>
3480 <dd><p>Compile a file (file attached to current buffer is default) using
3481 <code>(compile-file <var>file</var>)</code>.
3482 </p></dd>
3483 </dl>
3485 <p>The file <samp>gambit.el</samp> provides these additional commands:
3486 </p>
3487 <dl compact="compact">
3488 <dt> <code>F8 <span class="roman"><i>or</i></span> C-c c</code></dt>
3489 <dd><p>Continue the computation (same as typing <samp>#||#,c;</samp> to the REPL).
3490 </p></dd>
3491 <dt> <code>F9 <span class="roman"><i>or</i></span> C-c ]</code></dt>
3492 <dd><p>Move to newer frame (same as typing <samp>#||#,-;</samp> to the REPL).
3493 </p></dd>
3494 <dt> <code>F10 <span class="roman"><i>or</i></span> C-c [</code></dt>
3495 <dd><p>Move to older frame (same as typing <samp>#||#,+;</samp> to the REPL).
3496 </p></dd>
3497 <dt> <code>F11 <span class="roman"><i>or</i></span> C-c s</code></dt>
3498 <dd><p>Step the computation (same as typing <samp>#||#,s;</samp> to the REPL).
3499 </p></dd>
3500 <dt> <code>F12 <span class="roman"><i>or</i></span> C-c l</code></dt>
3501 <dd><p>Leap the computation (same as typing <samp>#||#,l;</samp> to the REPL).
3502 </p></dd>
3503 <dt> <code>C-c _</code></dt>
3504 <dd><p>Removes the last window that was opened to highlight an expression.
3505 </p></dd>
3506 </dl>
3508 <p>The two keystroke version of these commands can be shortened to
3509 <samp>M-c</samp>, <samp>M-[</samp>, <samp>M-]</samp>, <samp>M-s</samp>, <samp>M-l</samp>, and
3510 <samp>M-_</samp> respectively by adding this line to your <samp>.emacs</samp>
3511 file:
3512 </p>
3513 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(setq gambit-repl-command-prefix &quot;\e&quot;)
3514 </pre></td></tr></table>
3516 <p>This is more convenient to type than the two keystroke <samp>C-c</samp> based
3517 sequences but the purist may not like this because it does not follow
3518 normal Emacs conventions.
3519 </p>
3520 <p>Here is what a typical <samp>.emacs</samp> file will look like:
3521 </p>
3522 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(setq load-path ; add directory containing gambit.el
3523 (cons &quot;/usr/local/Gambit-C/share/emacs/site-lisp&quot;
3524 load-path))
3525 (setq scheme-program-name &quot;/tmp/gsi -:d-&quot;) ; if gsi not in executable path
3526 (setq gambit-highlight-color &quot;gray&quot;) ; if you don't like the default
3527 (setq gambit-repl-command-prefix &quot;\e&quot;) ; if you want M-c, M-s, etc
3528 (require 'gambit)
3529 </pre></td></tr></table>
3531 <hr size="1">
3532 <a name="GUIDE"></a>
3533 <table cellpadding="1" cellspacing="1" border="0">
3534 <tr><td valign="middle" align="left"><a href="#Emacs-interface" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.6 Emacs interface" align="middle" width="32"></a></td>
3535 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 6. Scheme extensions" align="middle" width="32"></a></td>
3536 <td valign="middle" align="left"> &nbsp; </td>
3537 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
3538 <td valign="middle" align="left"><a href="#Debugging" title="Up section"><img src="button-up.png" border="0" alt="Up: 5. Debugging" align="middle" width="32"></a></td>
3539 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 6. Scheme extensions" align="middle" width="32"></a></td>
3540 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3541 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3542 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3543 </tr></table>
3544 <a name="GUIDE-1"></a>
3545 <h2 class="section">5.7 GUIDE</h2>
3547 <p>The implementation and documentation for GUIDE, the Gambit Universal
3548 IDE, are not yet complete.
3549 </p>
3550 <hr size="1">
3551 <a name="Scheme-extensions"></a>
3552 <table cellpadding="1" cellspacing="1" border="0">
3553 <tr><td valign="middle" align="left"><a href="#GUIDE" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 5.7 GUIDE" align="middle" width="32"></a></td>
3554 <td valign="middle" align="left"><a href="#Extensions-to-standard-procedures" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 6.1 Extensions to standard procedures" align="middle" width="32"></a></td>
3555 <td valign="middle" align="left"> &nbsp; </td>
3556 <td valign="middle" align="left"><a href="#Debugging" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 5. Debugging" align="middle" width="32"></a></td>
3557 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
3558 <td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 7. Namespaces" align="middle" width="32"></a></td>
3559 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3560 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3561 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3562 </tr></table>
3563 <a name="Scheme-extensions-1"></a>
3564 <h1 class="chapter">6. Scheme extensions</h1>
3566 <table class="menu" border="0" cellspacing="0">
3567 <tr><td align="left" valign="top"><a href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
3568 <tr><td align="left" valign="top"><a href="#Extensions-to-standard-special-forms">6.2 Extensions to standard special forms</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
3569 <tr><td align="left" valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
3570 <tr><td align="left" valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
3571 </table>
3573 <hr size="1">
3574 <a name="Extensions-to-standard-procedures"></a>
3575 <table cellpadding="1" cellspacing="1" border="0">
3576 <tr><td valign="middle" align="left"><a href="#Scheme-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 6. Scheme extensions" align="middle" width="32"></a></td>
3577 <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" alt="Forward: 6.2 Extensions to standard special forms" align="middle" width="32"></a></td>
3578 <td valign="middle" align="left"> &nbsp; </td>
3579 <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" alt="FastBack: 6. Scheme extensions" align="middle" width="32"></a></td>
3580 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up.png" border="0" alt="Up: 6. Scheme extensions" align="middle" width="32"></a></td>
3581 <td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 7. Namespaces" align="middle" width="32"></a></td>
3582 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3583 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3584 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3585 </tr></table>
3586 <a name="Extensions-to-standard-procedures-1"></a>
3587 <h2 class="section">6.1 Extensions to standard procedures</h2>
3589 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3590 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_transcript-off">transcript-off</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
3592 <p>These procedures do nothing.
3593 </p>
3596 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3597 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3599 <p>The procedure <code>call-with-current-continuation</code> is bound to the
3600 global variables <code>call-with-current-continuation</code> and
3601 <code>call/cc</code>.
3602 </p>
3605 <hr size="1">
3606 <a name="Extensions-to-standard-special-forms"></a>
3607 <table cellpadding="1" cellspacing="1" border="0">
3608 <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" alt="Back: 6.1 Extensions to standard procedures" align="middle" width="32"></a></td>
3609 <td valign="middle" align="left"><a href="#Miscellaneous-extensions" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 6.3 Miscellaneous extensions" align="middle" width="32"></a></td>
3610 <td valign="middle" align="left"> &nbsp; </td>
3611 <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" alt="FastBack: 6. Scheme extensions" align="middle" width="32"></a></td>
3612 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up.png" border="0" alt="Up: 6. Scheme extensions" align="middle" width="32"></a></td>
3613 <td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 7. Namespaces" align="middle" width="32"></a></td>
3614 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3615 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3616 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3617 </tr></table>
3618 <a name="Extensions-to-standard-special-forms-1"></a>
3619 <h2 class="section">6.2 Extensions to standard special forms</h2>
3621 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3622 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3624 <ul class="toc">
3625 <li> <var> </var>
3626 <i>lambda-formals</i> = <code>(</code> <i>formal-argument-list</i> <code>)</code> | <i>r4rs-lambda-formals</i>
3627 </li><li> <var> </var>
3628 <i>define-formals</i> = <i>formal-argument-list</i> | <i>r4rs-define-formals</i>
3629 </li><li> <var> </var>
3630 <i>formal-argument-list</i> = <i>dsssl-formal-argument-list</i> | <i>rest-at-end-formal-argument-list</i>
3631 </li><li> <var> </var>
3632 <i>dsssl-formal-argument-list</i> = <i>reqs</i> <i>opts</i> <i>rest</i> <i>keys</i>
3633 </li><li> <var> </var>
3634 <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>
3635 </li><li> <var> </var>
3636 <i>reqs</i> = <i>required-formal-argument</i>*
3637 </li><li> <var> </var>
3638 <i>required-formal-argument</i> = <i>variable</i>
3639 </li><li> <var> </var>
3640 <i>opts</i> = <code>#!optional</code> <i>optional-formal-argument</i>* | <i>empty</i>
3641 </li><li> <var> </var>
3642 <i>optional-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code>
3643 </li><li> <var> </var>
3644 <i>rest</i> = <code>#!rest</code> <i>rest-formal-argument</i> | <i>empty</i>
3645 </li><li> <var> </var>
3646 <i>rest-formal-argument</i> = <i>variable</i>
3647 </li><li> <var> </var>
3648 <i>keys</i> = <code>#!key</code> <i>keyword-formal-argument</i>* | <i>empty</i>
3649 </li><li> <var> </var>
3650 <i>keyword-formal-argument</i> = <i>variable</i> | <code>(</code> <i>variable</i> <i>initializer</i> <code>)</code>
3651 </li><li> <var> </var>
3652 <i>initializer</i> = <i>expression</i>
3653 </li><li> <var> </var>
3654 <i>r4rs-lambda-formals</i> = <code>(</code> <i>variable</i>* <code>)</code> |
3655 <code>(</code> <i>variable</i>+ <code>.</code> <i>variable</i> <code>)</code> |
3656 <i>variable</i>
3657 </li><li> <var> </var>
3658 <i>r4rs-define-formals</i> = <i>variable</i>* | <i>variable</i>* <code>.</code> <i>variable</i>
3659 </li></ul>
3661 <p>These forms are extended versions of the <code>lambda</code> and <code>define</code>
3662 special forms of standard Scheme. They allow the use of optional formal
3663 arguments, either positional or named, and support the syntax and semantics
3664 of the DSSSL standard.
3665 </p>
3666 <p>When the procedure introduced by a <code>lambda</code> (or <code>define</code>) is
3667 applied to a list of actual arguments, the formal and actual arguments
3668 are processed as specified in the R4RS if the <i>lambda-formals</i> (or
3669 <i>define-formals</i>) is a <i>r4rs-lambda-formals</i> (or
3670 <i>r4rs-define-formals</i>).
3671 </p>
3672 <p>If the <i>formal-argument-list</i> matches
3673 <i>dsssl-formal-argument-list</i> or <i>extended-formal-argument-list</i>
3674 they are processed as follows:
3675 </p>
3676 <ol>
3677 <li>
3678 <i>Variable</i>s in <i>required-formal-argument</i>s are bound to
3679 successive actual arguments starting with the first actual argument. It
3680 shall be an error if there are fewer actual arguments than
3681 <i>required-formal-argument</i>s.
3683 </li><li>
3684 Next <i>variable</i>s in <i>optional-formal-argument</i>s are bound to
3685 remaining actual arguments. If there are fewer remaining actual
3686 arguments than <i>optional-formal-argument</i>s, then the variables are
3687 bound to the result of evaluating <i>initializer</i>, if one was
3688 specified, and otherwise to <code>#f</code>. The <i>initializer</i> is
3689 evaluated in an environment in which all previous formal arguments have
3690 been bound.
3692 </li><li>
3693 If <code>#!key</code> does not appear in the <i>formal-argument-list</i>
3694 and there is no <i>rest-formal-argument</i> then it shall be an error
3695 if there are any remaining actual arguments.
3697 </li><li>
3698 If <code>#!key</code> does not appear in the <i>formal-argument-list</i>
3699 and there is a <i>rest-formal-argument</i> then the
3700 <i>rest-formal-argument</i> is bound to a list of all remaining actual
3701 arguments.
3703 </li><li>
3704 If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
3705 no <i>rest-formal-argument</i> then there shall be an even number of
3706 remaining actual arguments. These are interpreted as a series of
3707 pairs, where the first member of each pair is a keyword specifying the
3708 argument name, and the second is the corresponding value. It shall be
3709 an error if the first member of a pair is not a keyword. It shall be
3710 an error if the argument name is not the same as a variable in a
3711 <i>keyword-formal-argument</i>. If the same argument name occurs more
3712 than once in the list of actual arguments, then the first value is
3713 used. If there is no actual argument for a particular
3714 <i>keyword-formal-argument</i>, then the variable is bound to the
3715 result of evaluating <i>initializer</i> if one was specified, and
3716 otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an
3717 environment in which all previous formal arguments have been bound.
3719 </li><li>
3720 If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
3721 a <i>rest-formal-argument</i> <b>before</b> the <code>#!key</code> then there
3722 may be an even or odd number of remaining actual arguments and the
3723 <i>rest-formal-argument</i> is bound to a list of all remaining actual
3724 arguments. Then, these remaining actual arguments are scanned from
3725 left to right in pairs, stopping at the first pair whose first element
3726 is not a keyword. Each pair whose first element is a keyword matching
3727 the name of a <i>keyword-formal-argument</i> gives the value (i.e. the
3728 second element of the pair) of the corresponding formal argument. If
3729 the same argument name occurs more than once in the list of actual
3730 arguments, then the first value is used. If there is no actual
3731 argument for a particular <i>keyword-formal-argument</i>, then the
3732 variable is bound to the result of evaluating <i>initializer</i> if one
3733 was specified, and otherwise to <code>#f</code>. The <i>initializer</i> is
3734 evaluated in an environment in which all previous formal arguments
3735 have been bound.
3737 </li><li>
3738 If <code>#!key</code> appears in the <i>formal-argument-list</i> and there is
3739 a <i>rest-formal-argument</i> <b>after</b> the <code>#!key</code> then there may
3740 be an even or odd number of remaining actual arguments. The remaining
3741 actual arguments are scanned from left to right in pairs, stopping at
3742 the first pair whose first element is not a keyword. Each pair shall
3743 have as its first element a keyword matching the name of a
3744 <i>keyword-formal-argument</i>; the second element gives the value of
3745 the corresponding formal argument. If the same argument name occurs
3746 more than once in the list of actual arguments, then the first value
3747 is used. If there is no actual argument for a particular
3748 <i>keyword-formal-argument</i>, then the variable is bound to the
3749 result of evaluating <i>initializer</i> if one was specified, and
3750 otherwise to <code>#f</code>. The <i>initializer</i> is evaluated in an
3751 environment in which all previous formal arguments have been bound.
3752 Finally, the <i>rest-formal-argument</i> is bound to the list of the
3753 actual arguments that were not scanned (i.e. after the last
3754 keyword/value pair).
3755 </li></ol>
3757 <p>In all cases it is an error for a <i>variable</i> to appear more than
3758 once in a <i>formal-argument-list</i>.
3759 </p>
3760 <p>Note that this specification is compatible with the DSSSL language
3761 standard (i.e. a correct DSSSL program will have the same semantics
3762 when run with Gambit).
3763 </p>
3764 <p>It is unspecified whether variables receive their value by binding or by
3765 assignment. Currently the compiler and interpreter use different
3766 methods, which can lead to different semantics if
3767 <code>call-with-current-continuation</code> is used in an <i>initializer</i>.
3768 Note that this is irrelevant for DSSSL programs because
3769 <code>call-with-current-continuation</code> does not exist in DSSSL.
3770 </p>
3771 <p>For example:
3772 </p>
3773 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>((lambda (#!rest x) x) 1 2 3)</b>
3774 (1 2 3)
3775 &gt; <b>(define (f a #!optional b) (list a b))</b>
3776 &gt; <b>(define (g a #!optional (b a) #!key (k (* a b))) (list a b k))</b>
3777 &gt; <b>(define (h1 a #!rest r #!key k) (list a k r))</b>
3778 &gt; <b>(define (h2 a #!key k #!rest r) (list a k r))</b>
3779 &gt; <b>(f 1)</b>
3780 (1 #f)
3781 &gt; <b>(f 1 2)</b>
3782 (1 2)
3783 &gt; <b>(g 3)</b>
3784 (3 3 9)
3785 &gt; <b>(g 3 4)</b>
3786 (3 4 12)
3787 &gt; <b>(g 3 4 k: 5)</b>
3788 (3 4 5)
3789 &gt; <b>(g 3 4 k: 5 k: 6)</b>
3790 (3 4 5)
3791 &gt; <b>(h1 7)</b>
3792 (7 #f ())
3793 &gt; <b>(h1 7 k: 8 9)</b>
3794 (7 8 (k: 8 9))
3795 &gt; <b>(h1 7 k: 8 z: 9)</b>
3796 (7 8 (k: 8 z: 9))
3797 &gt; <b>(h2 7)</b>
3798 (7 #f ())
3799 &gt; <b>(h2 7 k: 8 9)</b>
3800 (7 8 (9))
3801 &gt; <b>(h2 7 k: 8 z: 9)</b>
3802 *** ERROR IN (console)@17.1 -- Unknown keyword argument passed to procedure
3803 (h2 7 k: 8 z: 9)
3804 </pre></td></tr></table>
3808 <hr size="1">
3809 <a name="Miscellaneous-extensions"></a>
3810 <table cellpadding="1" cellspacing="1" border="0">
3811 <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" alt="Back: 6.2 Extensions to standard special forms" align="middle" width="32"></a></td>
3812 <td valign="middle" align="left"><a href="#Undocumented-extensions" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 6.4 Undocumented extensions" align="middle" width="32"></a></td>
3813 <td valign="middle" align="left"> &nbsp; </td>
3814 <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" alt="FastBack: 6. Scheme extensions" align="middle" width="32"></a></td>
3815 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up.png" border="0" alt="Up: 6. Scheme extensions" align="middle" width="32"></a></td>
3816 <td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 7. Namespaces" align="middle" width="32"></a></td>
3817 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
3818 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
3819 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
3820 </tr></table>
3821 <a name="Miscellaneous-extensions-1"></a>
3822 <h2 class="section">6.3 Miscellaneous extensions</h2>
3824 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3826 <p>This procedure returns a newly allocated vector with the same content
3827 as the vector <var>vector</var>. Note that the elements are not
3828 recursively copied.
3829 </p>
3830 <p>For example:
3831 </p>
3832 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v1 '#(1 2 3))</b>
3833 &gt; <b>(define v2 (vector-copy v1))</b>
3834 &gt; <b>v2</b>
3835 #(1 2 3)
3836 &gt; <b>(eq? v1 v2)</b>
3838 </pre></td></tr></table>
3842 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3844 <p>This procedure is the vector analog of the <code>substring</code>
3845 procedure. It returns a newly allocated vector formed from the
3846 elements of the vector <var>vector</var> beginning with index <var>start</var>
3847 (inclusive) and ending with index <var>end</var> (exclusive).
3848 </p>
3849 <p>For example:
3850 </p>
3851 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(subvector '#(a b c d e f) 3 5)</b>
3852 #(d e)
3853 </pre></td></tr></table>
3857 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_vector-append">vector-append</a></b></code><i> <var>vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
3859 <p>This procedure is the vector analog of the <code>string-append</code>
3860 procedure. It returns a newly allocated vector whose elements
3861 form the concatenation of the given vectors.
3862 </p>
3863 <p>For example:
3864 </p>
3865 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v '#(1 2 3))</b>
3866 &gt; <b>(vector-append v v v)</b>
3867 #(1 2 3 1 2 3 1 2 3)
3868 </pre></td></tr></table>
3872 <a name="Definition_of_append-vectors"></a><a name="Procedure_append-vectors"></a><a name="index-append_002dvectors"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-vectors">append-vectors</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
3874 <p>This procedure returns a newly allocated vector whose elements form
3875 the concatenation of all the vectors in the list <var>lst</var>. It is
3876 equivalent to <code>(apply vector-append <span class="roman"><var>lst</var></span>)</code>.
3877 </p>
3878 <p>For example:
3879 </p>
3880 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v '#(1 2 3))</b>
3881 &gt; <b>(append-vectors (list v v v))</b>
3882 #(1 2 3 1 2 3 1 2 3)
3883 </pre></td></tr></table>
3887 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3889 <p>This procedure is like <code>vector-fill!</code>, but fills a selected part
3890 of the given vector. It sets the elements of the vector <var>vector</var>,
3891 beginning with index <var>start</var> (inclusive) and ending with index
3892 <var>end</var> (exclusive) to <var>fill</var>. The value returned is
3893 unspecified.
3894 </p>
3895 <p>For example:
3896 </p>
3897 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b>
3898 &gt; <b>(subvector-fill! v 3 5 'x)</b>
3899 &gt; <b>v</b>
3900 #(a b c x x f)
3901 </pre></td></tr></table>
3905 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3907 <p>This procedure replaces part of the contents of vector
3908 <var>dst-vector</var> with part of the contents of vector
3909 <var>src-vector</var>. It copies elements from <var>src-vector</var>, beginning
3910 with index <var>src-start</var> (inclusive) and ending with index
3911 <var>src-end</var> (exclusive) to <var>dst-vector</var> beginning with index
3912 <var>dst-start</var> (inclusive). The value returned is unspecified.
3913 </p>
3914 <p>For example:
3915 </p>
3916 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v1 '#(1 2 3 4 5 6))</b>
3917 &gt; <b>(define v2 (vector 'a 'b 'c 'd 'e 'f))</b>
3918 &gt; <b>(subvector-move! v1 3 5 v2 1)</b>
3919 &gt; <b>v2</b>
3920 #(a 4 5 d e f)
3921 </pre></td></tr></table>
3925 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3927 <p>This procedure shortens the vector <var>vector</var> so that its new size
3928 is <var>k</var>. The value returned is unspecified.
3929 </p>
3930 <p>For example:
3931 </p>
3932 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v (vector 'a 'b 'c 'd 'e 'f))</b>
3933 &gt; <b>v</b>
3934 #(a b c d e f)
3935 &gt; <b>(vector-shrink! v 3)</b>
3936 &gt; <b>v</b>
3937 #(a b c)
3938 </pre></td></tr></table>
3942 <a name="Definition_of_append-strings"></a><a name="Procedure_append-strings"></a><a name="index-append_002dstrings"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_append-strings">append-strings</a></b></code><i> <var>lst</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
3944 <p>This procedure returns a newly allocated string whose elements form
3945 the concatenation of all the strings in the list <var>lst</var>. It is
3946 equivalent to <code>(apply string-append <span class="roman"><var>lst</var></span>)</code>.
3947 </p>
3948 <p>For example:
3949 </p>
3950 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s &quot;abc&quot;)</b>
3951 &gt; <b>(append-strings (list s s s))</b>
3952 &quot;abcabcabc&quot;
3953 </pre></td></tr></table>
3957 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3959 <p>This procedure is like <code>string-fill!</code>, but fills a selected part
3960 of the given string. It sets the elements of the string <var>string</var>,
3961 beginning with index <var>start</var> (inclusive) and ending with index
3962 <var>end</var> (exclusive) to <var>fill</var>. The value returned is
3963 unspecified.
3964 </p>
3965 <p>For example:
3966 </p>
3967 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (string #\a #\b #\c #\d #\e #\f))</b>
3968 &gt; <b>(substring-fill! s 3 5 #\x)</b>
3969 &gt; <b>s</b>
3970 &quot;abcxxf&quot;
3971 </pre></td></tr></table>
3975 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3977 <p>This procedure replaces part of the contents of string
3978 <var>dst-string</var> with part of the contents of string
3979 <var>src-string</var>. It copies elements from <var>src-string</var>, beginning
3980 with index <var>src-start</var> (inclusive) and ending with index
3981 <var>src-end</var> (exclusive) to <var>dst-string</var> beginning with index
3982 <var>dst-start</var> (inclusive). The value returned is unspecified.
3983 </p>
3984 <p>For example:
3985 </p>
3986 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s1 &quot;123456&quot;)</b>
3987 &gt; <b>(define s2 (string #\a #\b #\c #\d #\e #\f))</b>
3988 &gt; <b>(substring-move! s1 3 5 s2 1)</b>
3989 &gt; <b>s2</b>
3990 &quot;a45def&quot;
3991 </pre></td></tr></table>
3995 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
3997 <p>This procedure shortens the string <var>string</var> so that its new size
3998 is <var>k</var>. The value returned is unspecified.
3999 </p>
4000 <p>For example:
4001 </p>
4002 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (string #\a #\b #\c #\d #\e #\f))</b>
4003 &gt; <b>s</b>
4004 &quot;abcdef&quot;
4005 &gt; <b>(string-shrink! s 3)</b>
4006 &gt; <b>s</b>
4007 &quot;abc&quot;
4008 </pre></td></tr></table>
4012 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4013 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4014 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4015 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4016 <a name="index-boxes"></a>
4018 <p>These procedures implement the <em>box</em> data type. A box is a
4019 cell containing a single mutable field. The lexical syntax
4020 of a box containing the object <var>obj</var> is <code>#&amp;<var>obj</var></code>
4021 (see section <a href="#Box-syntax">Box syntax</a>).
4022 </p>
4023 <p>The procedure <code>box</code> returns a new box object whose content is
4024 initialized to <var>obj</var>. The procedure <code>box?</code> returns <code>#t</code>
4025 if <var>obj</var> is a box, and otherwise returns <code>#f</code>. The procedure
4026 <code>unbox</code> returns the content of the box <var>box</var>. The procedure
4027 <code>set-box!</code> changes the content of the box <var>box</var> to <var>obj</var>.
4028 The procedure <code>set-box!</code> returns an unspecified value.
4029 </p>
4030 <p>For example:
4031 </p>
4032 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define b (box 0))</b>
4033 &gt; <b>b</b>
4034 #&amp;0
4035 &gt; <b>(define (inc!) (set-box! b (+ (unbox b) 1)))</b>
4036 &gt; <b>(inc!)</b>
4037 &gt; <b>b</b>
4038 #&amp;1
4039 &gt; <b>(unbox b)</b>
4041 </pre></td></tr></table>
4045 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4046 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_keyword-%3Estring">keyword-&gt;string</a></b></code><i> <var>keyword</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4047 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-%3Ekeyword">string-&gt;keyword</a></b></code><i> <var>string</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4048 <a name="index-keywords"></a>
4050 <p>These procedures implement the <em>keyword</em> data type. Keywords are
4051 similar to symbols but are self evaluating and distinct from the
4052 symbol data type. The lexical syntax of keywords is specified in
4053 <a href="#Keyword-syntax">Keyword syntax</a>.
4054 </p>
4055 <p>The procedure <code>keyword?</code> returns <code>#t</code> if <var>obj</var> is a
4056 keyword, and otherwise returns <code>#f</code>. The procedure
4057 <code>keyword-&gt;string</code> returns the name of <var>keyword</var> as a string.
4058 The procedure <code>string-&gt;keyword</code> returns the keyword whose name is
4059 <var>string</var>.
4060 </p>
4061 <p>For example:
4062 </p>
4063 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(keyword? 'color)</b>
4065 &gt; <b>(keyword? color:)</b>
4067 &gt; <b>(keyword-&gt;string color:)</b>
4068 &quot;color&quot;
4069 &gt; <b>(string-&gt;keyword &quot;color&quot;)</b>
4070 color:
4071 </pre></td></tr></table>
4075 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4077 <p>This procedure returns a new <em>uninterned symbol</em>. Uninterned symbols
4078 are guaranteed to be distinct from the symbols generated by the
4079 procedures <code>read</code> and <code>string-&gt;symbol</code>. The symbol
4080 <var>prefix</var> is the prefix used to generate the new symbol&rsquo;s name. If
4081 it is not specified, the prefix defaults to <samp>g</samp>.
4082 </p>
4083 <p>For example:
4084 </p>
4085 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(gensym)</b>
4086 #:g0
4087 &gt; <b>(gensym)</b>
4088 #:g1
4089 &gt; <b>(gensym 'star-trek-)</b>
4090 #:star-trek-2
4091 </pre></td></tr></table>
4095 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4096 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4098 <p>The procedure <code>make-uninterned-symbol</code> returns a new uninterned
4099 symbol whose name is <var>name</var> and hash is <var>hash</var>. The name must
4100 be a string and the hash must be a nonnegative fixnum.
4101 </p>
4102 <p>The procedure <code>uninterned-symbol?</code> returns <code>#t</code> when
4103 <var>obj</var> is a symbol that is uninterned and <code>#f</code> otherwise.
4104 </p>
4105 <p>For example:
4106 </p>
4107 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(uninterned-symbol? (gensym))</b>
4109 &gt; <b>(make-uninterned-symbol &quot;foo&quot;)</b>
4110 #:foo:
4111 &gt; <b>(uninterned-symbol? (make-uninterned-symbol &quot;foo&quot;))</b>
4113 &gt; <b>(uninterned-symbol? 'hello)</b>
4115 &gt; <b>(uninterned-symbol? 123)</b>
4117 </pre></td></tr></table>
4121 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4122 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4124 <p>The procedure <code>make-uninterned-keyword</code> returns a new uninterned
4125 keyword whose name is <var>name</var> and hash is <var>hash</var>. The name must
4126 be a string and the hash must be a nonnegative fixnum.
4127 </p>
4128 <p>The procedure <code>uninterned-keyword?</code> returns <code>#t</code> when
4129 <var>obj</var> is a keyword that is uninterned and <code>#f</code> otherwise.
4130 </p>
4131 <p>For example:
4132 </p>
4133 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(make-uninterned-keyword &quot;foo&quot;)</b>
4134 #:foo:
4135 &gt; <b>(uninterned-keyword? (make-uninterned-keyword &quot;foo&quot;))</b>
4137 &gt; <b>(uninterned-keyword? hello:)</b>
4139 &gt; <b>(uninterned-keyword? 123)</b>
4141 </pre></td></tr></table>
4145 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_void">void</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4147 <p>This procedure returns the void object. The read-eval-print loop
4148 prints nothing when the result is the void object.
4149 </p>
4152 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4154 <p>The first parameter is a datum representing an expression. The
4155 <code>eval</code> procedure evaluates this expression in the global
4156 interaction environment and returns the result. If present, the
4157 second parameter is ignored (it is provided for compatibility with
4158 R5RS).
4159 </p>
4160 <p>For example:
4161 </p>
4162 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(eval '(+ 1 2))</b>
4164 &gt; <b>((eval 'car) '(1 2))</b>
4166 &gt; <b>(eval '(define x 5))</b>
4167 &gt; <b>x</b>
4169 </pre></td></tr></table>
4173 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4175 <p>The <i>file</i> parameter must be a string naming an existing file
4176 containing Scheme source code. The <code>include</code> special form
4177 splices the content of the specified source file. This form can only
4178 appear where a <code>define</code> form is acceptable.
4179 </p>
4180 <p>For example:
4181 </p>
4182 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(include &quot;macros.scm&quot;)
4184 (define (f lst)
4185 (include &quot;sort.scm&quot;)
4186 (map sqrt (sort lst)))
4187 </pre></td></tr></table>
4191 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4192 <a name="index-include-1"></a>
4194 <p>Define <i>name</i> as a macro special form which expands into <i>body</i>.
4195 This form can only appear where a <code>define</code> form is acceptable.
4196 Macros are lexically scoped. The scope of a local macro definition
4197 extends from the definition to the end of the body of the surrounding
4198 binding construct. Macros defined at the top level of a Scheme module
4199 are only visible in that module. To have access to the macro
4200 definitions contained in a file, that file must be included using the
4201 <code>include</code> special form. Macros which are visible from the REPL are
4202 also visible during the compilation of Scheme source files.
4203 </p>
4204 <p>For example:
4205 </p>
4206 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define-macro (unless test . body)
4207 `(if ,test #f (begin ,@body)))
4209 (define-macro (push var #!optional val)
4210 `(set! ,var (cons ,val ,var)))
4211 </pre></td></tr></table>
4213 <p>To examine the code into which a macro expands you can use the
4214 compiler&rsquo;s <samp>-expansion</samp> option or the <code>pp</code> procedure.
4215 For example:
4216 </p>
4217 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define-macro (push var #!optional val)
4218 `(set! ,var (cons ,val ,var)))</b>
4219 &gt; <b>(pp (lambda () (push stack 1) (push stack) (push stack 3)))</b>
4220 (lambda ()
4221 (set! stack (cons 1 stack))
4222 (set! stack (cons #f stack))
4223 (set! stack (cons 3 stack)))
4224 </pre></td></tr></table>
4228 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4229 <a name="index-define_002dsyntax-1"></a>
4230 <a name="index-syntax_002drules"></a>
4231 <a name="index-syntax_002dcase"></a>
4232 <a name="index-_002d_003as-1"></a>
4234 <p>Define <i>name</i> as a macro special form whose expansion is specified
4235 by <i>expander</i>. This form is available only when the runtime option
4236 <samp>-:s</samp> is used. This option causes the loading of the
4237 <code>~~lib/syntax-case</code> support library, which is the Hieb and Dybvig
4238 portable <code>syntax-case</code> implementation which has been ported to
4239 the Gambit interpreter and compiler. Note that this implementation of
4240 <code>syntax-case</code> does not support special forms that are specific to
4241 Gambit.
4242 </p>
4243 <p>For example:
4244 </p>
4245 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi -:s</b>
4246 Gambit v4.6.1
4248 &gt; <b>(define-syntax unless
4249 (syntax-rules ()
4250 ((unless test body ...)
4251 (if test #f (begin body ...)))))</b>
4252 &gt; <b>(let ((test 111)) (unless (= 1 2) (list test test)))</b>
4253 (111 111)
4254 &gt; <b>(pp (lambda () (let ((test 111)) (unless (= 1 2) (list test test)))))</b>
4255 (lambda () ((lambda (%%test14) (if (= 1 2) #f (list %%test14 %%test14))) 111))
4256 &gt; <b>(unless #f (pp xxx))</b>
4257 *** ERROR IN (console)@7.16 -- Unbound variable: xxx
4258 </pre></td></tr></table>
4262 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_declare">declare</a></b></code><i> <span class="roman"><i>declaration</i></span>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4264 <p>This form introduces declarations to be used by the compiler
4265 (currently the interpreter ignores the declarations). This form can
4266 only appear where a <code>define</code> form is acceptable. Declarations
4267 are lexically scoped in the same way as macros. The following
4268 declarations are accepted by the compiler:
4269 </p>
4270 <dl compact="compact">
4271 <dt> <code>(<var>dialect</var>)</code></dt>
4272 <dd><a name="index-ieee_002dscheme"></a>
4273 <a name="index-r4rs_002dscheme"></a>
4274 <a name="index-r5rs_002dscheme"></a>
4275 <a name="index-gambit_002dscheme"></a>
4276 <p>Use the given dialect&rsquo;s semantics. <var>dialect</var> can be:
4277 <samp>ieee-scheme</samp>, <samp>r4rs-scheme</samp>, <samp>r5rs-scheme</samp>
4278 or <samp>gambit-scheme</samp>.
4279 </p>
4280 </dd>
4281 <dt> <code>(<var>strategy</var>)</code></dt>
4282 <dd><a name="index-block"></a>
4283 <a name="index-separate"></a>
4284 <p>Select block compilation or separate compilation. In block
4285 compilation, the compiler assumes that global variables defined in the
4286 current file that are not mutated in the file will never be mutated.
4287 <var>strategy</var> can be: <samp>block</samp> or <samp>separate</samp>.
4288 </p>
4289 </dd>
4290 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline)</code></dt>
4291 <dd><a name="index-inline"></a>
4292 <p>Allow (or disallow) inlining of user procedures.
4293 </p>
4294 </dd>
4295 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> inline-primitives <var>primitive</var>&hellip;)</code></dt>
4296 <dd><a name="index-inline_002dprimitives"></a>
4297 <p>The given primitives should (or should not) be inlined
4298 if possible (all primitives if none specified).
4299 </p>
4300 </dd>
4301 <dt> <code>(inlining-limit <var>n</var>)</code></dt>
4302 <dd><a name="index-inlining_002dlimit"></a>
4303 <p>Select the degree to which the compiler inlines user procedures.
4304 <var>n</var> is the upper-bound, in percent, on code expansion that will
4305 result from inlining. Thus, a value of 300 indicates that the size of
4306 the program will not grow by more than 300 percent (i.e. it will be at
4307 most 4 times the size of the original). A value of 0 disables inlining.
4308 The size of a program is the total number of subexpressions it contains
4309 (i.e. the size of an expression is one plus the size of its immediate
4310 subexpressions). The following conditions must hold for a procedure to
4311 be inlined: inlining the procedure must not cause the size of the call
4312 site to grow more than specified by the inlining limit, the site of
4313 definition (the <code>define</code> or <code>lambda</code>) and the call site must
4314 be declared as <code>(inline)</code>, and the compiler must be able to find
4315 the definition of the procedure referred to at the call site (if the
4316 procedure is bound to a global variable, the definition site must have a
4317 <code>(block)</code> declaration). Note that inlining usually causes much
4318 less code expansion than specified by the inlining limit (an expansion
4319 around 10% is common for <var>n</var>=350).
4320 </p>
4321 </dd>
4322 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> lambda-lift)</code></dt>
4323 <dd><a name="index-lambda_002dlift"></a>
4324 <p>Lambda-lift (or don&rsquo;t lambda-lift) locally defined procedures.
4325 </p>
4326 </dd>
4327 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> constant-fold)</code></dt>
4328 <dd><a name="index-constant_002dfold"></a>
4329 <p>Allow (or disallow) constant-folding of primitive procedures.
4330 </p>
4331 </dd>
4332 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> standard-bindings <var>var</var>&hellip;)</code></dt>
4333 <dd><a name="index-standard_002dbindings"></a>
4334 <p>The given global variables are known (or not known) to be equal to
4335 the value defined for them in the dialect (all variables defined in
4336 the standard if none specified).
4337 </p>
4338 </dd>
4339 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> extended-bindings <var>var</var>&hellip;)</code></dt>
4340 <dd><a name="index-extended_002dbindings"></a>
4341 <p>The given global variables are known (or not known) to be equal to the
4342 value defined for them in the runtime system (all variables defined
4343 in the runtime if none specified).
4344 </p>
4345 </dd>
4346 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> run-time-bindings <var>var</var>&hellip;)</code></dt>
4347 <dd><a name="index-run_002dtime_002dbindings"></a>
4348 <p>The given global variables will be tested at run time to see if they
4349 are equal to the value defined for them in the runtime system (all
4350 variables defined in the runtime if none specified).
4351 </p>
4352 </dd>
4353 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> safe)</code></dt>
4354 <dd><a name="index-safe"></a>
4355 <p>Generate (or don&rsquo;t generate) code that will prevent fatal errors at
4356 run time. Note that in <samp>safe</samp> mode certain semantic errors will
4357 not be checked as long as they can&rsquo;t crash the system. For example
4358 the primitive <code>char=?</code> may disregard the type of its arguments in
4359 <samp>safe</samp> as well as <samp>not safe</samp> mode.
4360 </p>
4361 </dd>
4362 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> interrupts-enabled)</code></dt>
4363 <dd><a name="index-interrupts_002denabled"></a>
4364 <p>Generate (or don&rsquo;t generate) interrupt checks. Interrupt checks are
4365 used to detect user interrupts and also to check for stack overflows.
4366 Interrupt checking should not be turned off casually.
4367 </p>
4368 </dd>
4369 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug)</code></dt>
4370 <dd><a name="index-debug-1"></a>
4371 <a name="index-_002ddebug-1"></a>
4372 <p>Enable (or disable) the generation of debugging information. The kind
4373 of debugging information that is generated depends on the declarations
4374 <samp>debug-location</samp>, <samp>debug-source</samp>, and
4375 <samp>debug-environments</samp>. If any of the command line options
4376 <samp>-debug</samp>, <samp>-debug-location</samp>, <samp>-debug-source</samp> and
4377 <samp>-debug-environments</samp> are present, the <samp>debug</samp> declaration
4378 is initially enabled, otherwise it is initially disabled. When all
4379 kinds of debugging information are generated there is a substantial
4380 increase in the C compilation time and the size of the generated code.
4381 When compiling a 3000 line Scheme file it was observed that the total
4382 compilation time is 500% longer and the executable code is 150%
4383 bigger.
4384 </p>
4385 </dd>
4386 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-location)</code></dt>
4387 <dd><a name="index-debug_002dlocation-1"></a>
4388 <a name="index-_002ddebug_002dlocation-1"></a>
4389 <p>Select (or deselect) source code location debugging information. When
4390 this declaration and the <samp>debug</samp> declaration are in effect, run
4391 time error messages indicate the location of the error in the source
4392 code file. If any of the command line options <samp>-debug-source</samp>
4393 and <samp>-debug-environments</samp> are present and <samp>-debug-location</samp>
4394 is absent, the <samp>debug-location</samp> declaration is initially
4395 disabled, otherwise it is initially enabled. When compiling a 3000
4396 line Scheme file it was observed that the total compilation time is
4397 200% longer and the executable code is 60% bigger.
4398 </p>
4399 </dd>
4400 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-source)</code></dt>
4401 <dd><a name="index-debug_002dsource-1"></a>
4402 <a name="index-_002ddebug_002dsource-1"></a>
4403 <p>Select (or deselect) source code debugging information. When this
4404 declaration and the <samp>debug</samp> declaration are in effect, run time
4405 error messages indicate the source code, the backtraces are more
4406 precise, and the <code>pp</code> procedure will display the source code of
4407 compiled procedures. If any of the command line options
4408 <samp>-debug-location</samp> and <samp>-debug-environments</samp> are present and
4409 <samp>-debug-source</samp> is absent, the <samp>debug-source</samp> declaration is
4410 initially disabled, otherwise it is initially enabled. When compiling
4411 a 3000 line Scheme file it was observed that the total compilation
4412 time is 90% longer and the executable code is 90% bigger.
4413 </p>
4414 </dd>
4415 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> debug-environments)</code></dt>
4416 <dd><a name="index-debug_002denvironments-1"></a>
4417 <a name="index-_002ddebug_002denvironments-1"></a>
4418 <p>Select (or deselect) environment debugging information. When this
4419 declaration and the <samp>debug</samp> declaration are in effect, the
4420 debugger will have access to the environments of the continuations.
4421 In other words the local variables defined in compiled procedures (and
4422 not optimized away by the compiler) will be shown by the <samp>,e</samp>
4423 REPL command. If any of the command line options
4424 <samp>-debug-location</samp> and <samp>-debug-source</samp> are present and
4425 <samp>-debug-environments</samp> is absent, the <samp>debug-environments</samp>
4426 declaration is initially disabled, otherwise it is initially enabled.
4427 When compiling a 3000 line Scheme file it was observed that the total
4428 compilation time is 70% longer and the executable code is 40% bigger.
4429 </p>
4430 </dd>
4431 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> proper-tail-calls)</code></dt>
4432 <dd><a name="index-proper_002dtail_002dcalls"></a>
4433 <a name="index-proper-tail_002dcalls-1"></a>
4434 <a name="index-tail_002dcalls-1"></a>
4435 <p>Generate (or don&rsquo;t generate) proper tail calls. When proper tail
4436 calls are turned off, tail calls are handled like non-tail calls, that
4437 is a continuation frame will be created for all calls regardless of
4438 their kind. This is useful for debugging because the caller of a
4439 procedure will be visible in the backtrace produced by the REPL&rsquo;s
4440 <samp>,b</samp> command even when the call is a tail call. Be advised that
4441 this does cause stack space to be consumed for tail calls which may
4442 cause the stack to overflow when performing long iterations with tail
4443 calls (whether they are expressed with a <code>letrec</code>, named
4444 <code>let</code>, <code>do</code>, or other form).
4445 </p>
4446 </dd>
4447 <dt> <code>(<span class="roman">[</span>not<span class="roman">]</span> optimize-dead-local-variables)</code></dt>
4448 <dd><a name="index-optimize_002ddead_002dlocal_002dvariables"></a>
4449 <p>Remove (or preserve) the dead local variables in the environment.
4450 Preserving the dead local variables is useful for debugging because
4451 continuations will contain the dead variables. Thus, if the code is
4452 also compiled with the declaration <samp>debug-environments</samp>
4453 the <samp>,e</samp>, <samp>,ed</samp>, <samp>,be</samp>, and <samp>,bed</samp> REPL
4454 commands will display the dead variables. On the other hand,
4455 preserving the dead local variables may change the space complexity of
4456 the program (i.e. some of the data that would normally be reclaimed by
4457 the garbage collector will not be). Note that due to other compiler
4458 optimizations some dead local variables may be removed regardless of
4459 this declaration.
4460 </p>
4461 </dd>
4462 <dt> <code>(<var>number-type</var> <var>primitive</var>&hellip;)</code></dt>
4463 <dd><a name="index-generic"></a>
4464 <a name="index-fixnum"></a>
4465 <a name="index-flonum"></a>
4466 <p>Numeric arguments and result of the specified primitives are
4467 known to be of the given type (all primitives if none specified).
4468 <var>number-type</var> can be: <samp>generic</samp>, <samp>fixnum</samp>, or
4469 <samp>flonum</samp>.
4470 </p>
4471 </dd>
4472 <dt> <code>(<var>mostly-number-type</var> <var>primitive</var>&hellip;)</code></dt>
4473 <dd><a name="index-mostly_002dgeneric"></a>
4474 <a name="index-mostly_002dfixnum"></a>
4475 <a name="index-mostly_002dfixnum_002dflonum"></a>
4476 <a name="index-mostly_002dflonum"></a>
4477 <a name="index-mostly_002dflonum_002dfixnum"></a>
4478 <p>Numeric arguments and result of the specified primitives are expected
4479 to be most often of the given type (all primitives if none specified).
4480 <var>mostly-number-type</var> can be: <samp>mostly-generic</samp>,
4481 <samp>mostly-fixnum</samp>, <samp>mostly-fixnum-flonum</samp>,
4482 <samp>mostly-flonum</samp>, or <samp>mostly-flonum-fixnum</samp>.
4483 </p>
4484 </dd>
4485 </dl>
4487 <p>The default declarations used by the compiler are equivalent to:
4488 </p>
4489 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(declare
4490 (gambit-scheme)
4491 (separate)
4492 (inline)
4493 (inline-primitives)
4494 (inlining-limit 350)
4495 (constant-fold)
4496 (lambda-lift)
4497 (not standard-bindings)
4498 (not extended-bindings)
4499 (run-time-bindings)
4500 (safe)
4501 (interrupts-enabled)
4502 (not debug) ;; depends on debugging command line options
4503 (debug-location) ;; depends on debugging command line options
4504 (debug-source) ;; depends on debugging command line options
4505 (debug-environments) ;; depends on debugging command line options
4506 (proper-tail-calls)
4507 (optimize-dead-local-variables)
4508 (generic)
4509 (mostly-fixnum-flonum)
4511 </pre></td></tr></table>
4513 <p>These declarations are compatible with the semantics of R5RS Scheme
4514 and includes a few procedures from R6RS (mainly fixnum specific and
4515 flonum specific procedures). Typically used declarations that enhance
4516 performance, at the cost of violating the R5RS Scheme semantics, are:
4517 <code>(standard-bindings)</code>, <code>(block)</code>, <code>(not safe)</code> and
4518 <code>(fixnum)</code>.
4519 </p>
4522 <hr size="1">
4523 <a name="Undocumented-extensions"></a>
4524 <table cellpadding="1" cellspacing="1" border="0">
4525 <tr><td valign="middle" align="left"><a href="#Miscellaneous-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 6.3 Miscellaneous extensions" align="middle" width="32"></a></td>
4526 <td valign="middle" align="left"><a href="#Namespaces" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 7. Namespaces" align="middle" width="32"></a></td>
4527 <td valign="middle" align="left"> &nbsp; </td>
4528 <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" alt="FastBack: 6. Scheme extensions" align="middle" width="32"></a></td>
4529 <td valign="middle" align="left"><a href="#Scheme-extensions" title="Up section"><img src="button-up.png" border="0" alt="Up: 6. Scheme extensions" align="middle" width="32"></a></td>
4530 <td valign="middle" align="left"><a href="#Namespaces" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 7. Namespaces" align="middle" width="32"></a></td>
4531 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
4532 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
4533 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
4534 </tr></table>
4535 <a name="Undocumented-extensions-1"></a>
4536 <h2 class="section">6.4 Undocumented extensions</h2>
4538 <p>The procedures in this section are not yet documented.
4539 </p>
4540 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4541 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4542 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation-graft">continuation-graft</a></b></code><i> <var>cont</var> <var>proc</var> <var>obj</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
4543 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_continuation-return">continuation-return</a></b></code><i> <var>cont</var> <var>obj</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
4545 <p>These procedures provide access to internal first-class continuations
4546 which are represented using continuation objects distinct from procedures.
4547 </p>
4548 <p>The procedure <code>continuation?</code> returns <code>#t</code> when <var>obj</var> is
4549 a continuation object and <code>#f</code> otherwise.
4550 </p>
4551 <p>The procedure <code>continuation-capture</code> is similar to the
4552 <code>call/cc</code> procedure but it represents the continuation with a
4553 continuation object. The <var>proc</var> parameter must be a procedure
4554 accepting a single argument. The procedure
4555 <code>continuation-capture</code> reifies its continuation and calls
4556 <var>proc</var> with the corresponding continuation object as its sole
4557 argument. Like for <code>call/cc</code>, the implicit continuation of the
4558 call to <var>proc</var> is the implicit continuation of the call to
4559 <code>continuation-capture</code>.
4560 </p>
4561 <p>The procedure <code>continuation-graft</code> performs a procedure call to
4562 the procedure <var>proc</var> with arguments <var>obj</var>&hellip; and the
4563 implicit continuation corresponding to the continuation object
4564 <var>cont</var>. The current continuation of the call to procedure
4565 <code>continuation-graft</code> is ignored.
4566 </p>
4567 <p>The procedure <code>continuation-return</code> invokes the implicit
4568 continuation corresponding to the continuation object <var>cont</var> with
4569 the result(s) <var>obj</var>&hellip;. This procedure can be easily
4570 defined in terms of <code>continuation-graft</code>:
4571 </p>
4572 <table><tr><td>&nbsp;</td><td><pre class="smallexample">(define (continuation-return cont . objs)
4573 (continuation-graft (lambda () (apply values objs))))
4574 </pre></td></tr></table>
4576 <p>For example:
4577 </p>
4578 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define x #f)</b>
4579 &gt; <b>(define p (make-parameter 11))</b>
4580 &gt; <b>(pp (parameterize ((p 22))
4581 (cons 33 (continuation-capture
4582 (lambda (c) (set! x c) 44)))))</b>
4583 (33 . 44)
4584 &gt; <b>x</b>
4585 #&lt;continuation #2&gt;
4586 &gt; <b>(continuation-return x 55)</b>
4587 (33 . 55)
4588 &gt; <b>(continuation-graft x (lambda () (expt 2 10)))</b>
4589 (33 . 1024)
4590 &gt; <b>(continuation-graft x expt 2 10)</b>
4591 (33 . 1024)
4592 &gt; <b>(continuation-graft x (lambda () (p)))</b>
4593 (33 . 22)
4594 &gt; <b>(define (map-sqrt1 lst)
4595 (call/cc
4596 (lambda (k)
4597 (map (lambda (x)
4598 (if (&lt; x 0)
4599 (k 'error)
4600 (sqrt x)))
4601 lst))))</b>
4602 &gt; <b>(map-sqrt1 '(1 4 9))</b>
4603 (1 2 3)
4604 &gt; <b>(map-sqrt1 '(1 -1 9))</b>
4605 error
4606 &gt; <b>(define (map-sqrt2 lst)
4607 (continuation-capture
4608 (lambda (c)
4609 (map (lambda (x)
4610 (if (&lt; x 0)
4611 (continuation-return c 'error)
4612 (sqrt x)))
4613 lst))))</b>
4614 &gt; <b>(map-sqrt2 '(1 4 9))</b>
4615 (1 2 3)
4616 &gt; <b>(map-sqrt2 '(1 -1 9))</b>
4617 error
4618 </pre></td></tr></table>
4622 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4623 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4624 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4625 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4626 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4629 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4631 <p>The procedure <code>display-continuation-backtrace</code> displays the
4632 frames of the continuation corresponding to the continuation object
4633 <var>cont</var> on the port <var>port</var>. If it is not specified, <var>port</var>
4634 defaults to the current output-port. The frames are displayed in the
4635 same format as the REPL&rsquo;s <samp>,b</samp> command.
4636 </p>
4637 <p>The parameter <var>all-frames?</var>, which defaults to <code>#f</code>, controls
4638 which frames are displayed. Some frames of ancillary importance, such
4639 as internal frames created by the interpreter, are not displayed when
4640 <var>all-frames?</var> is <code>#f</code>. Otherwise all frames are displayed.
4641 </p>
4642 <p>The parameter <var>display-env?</var>, which defaults to <code>#f</code>, controls
4643 if the frames are displayed with its environment (the variables
4644 accessible and their bindings).
4645 </p>
4646 <p>The parameters <var>max-head</var> and <var>max-tail</var>, which default to 10
4647 and 4 respectively, control how many frames are displayed at the head
4648 and tail of the continuation.
4649 </p>
4650 <p>The parameter <var>depth</var>, which defaults to 0, causes the frame numbers
4651 to be offset by that value.
4652 </p>
4653 <p>For example:
4654 </p>
4655 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define x #f)</b>
4656 &gt; <b>(define (fib n)
4657 (if (&lt; n 2)
4658 (continuation-capture
4659 (lambda (c) (set! x c) 1))
4660 (+ (fib (- n 1))
4661 (fib (- n 2)))))</b>
4662 &gt; <b>(fib 10)</b>
4664 &gt; <b>(display-continuation-backtrace x)</b>
4665 0 fib (console)@7:12 (fib (- n 2))
4666 1 fib (console)@7:12 (fib (- n 2))
4667 2 fib (console)@7:12 (fib (- n 2))
4668 3 fib (console)@7:12 (fib (- n 2))
4669 4 fib (console)@7:12 (fib (- n 2))
4670 5 (interaction) (console)@8:1 (fib 10)
4672 &gt; <b>(display-continuation-backtrace x (current-output-port) #t)</b>
4673 0 fib (console)@7:12 (fib (- n 2))
4674 1 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4675 2 fib (console)@7:12 (fib (- n 2))
4676 3 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4677 4 fib (console)@7:12 (fib (- n 2))
4678 5 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4679 6 fib (console)@7:12 (fib (- n 2))
4680 7 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4681 8 fib (console)@7:12 (fib (- n 2))
4682 9 fib (console)@6:9 (+ (fib (- n 1)) (fib (- ...
4684 13 ##with-no-result-expected-toplevel
4685 14 ##repl-debug
4686 15 ##repl-debug-main
4687 16 ##kernel-handlers
4689 &gt; <b>(display-continuation-backtrace x (current-output-port) #f #t)</b>
4690 0 fib (console)@7:12 (fib (- n 2))
4691 n = 2
4692 1 fib (console)@7:12 (fib (- n 2))
4693 n = 4
4694 2 fib (console)@7:12 (fib (- n 2))
4695 n = 6
4696 3 fib (console)@7:12 (fib (- n 2))
4697 n = 8
4698 4 fib (console)@7:12 (fib (- n 2))
4699 n = 10
4700 5 (interaction) (console)@8:1 (fib 10)
4702 &gt; <b>(display-continuation-backtrace x (current-output-port) #f #f 2 1 100)</b>
4703 100 fib (console)@7:12 (fib (- n 2))
4704 101 fib (console)@7:12 (fib (- n 2))
4706 105 (interaction) (console)@8:1 (fib 10)
4708 </pre></td></tr></table>
4712 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4713 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4714 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4715 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4716 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4717 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4718 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4719 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-list">thread-group-&gt;thread-group-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4720 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-group-vector">thread-group-&gt;thread-group-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4721 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-list">thread-group-&gt;thread-list</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4722 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-group-%3Ethread-vector">thread-group-&gt;thread-vector</a></b></code><i> <var>thread-group</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4725 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4726 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4727 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4728 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4729 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4730 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4731 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4732 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4733 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4734 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4735 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4738 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4741 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4742 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4745 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4748 <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="http://dynamo.iro.umontreal.ca/~gambit/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>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4751 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4754 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4755 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4756 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4759 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4760 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4761 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4764 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4765 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4766 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4769 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4770 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4771 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4772 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4775 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_timeout-%3Etime">timeout-&gt;time</a></b></code><i> <var>timeout</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4778 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_open-dummy">open-dummy</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4781 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4784 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4787 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4790 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4791 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4792 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4795 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4796 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4797 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_console-port">console-port</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4800 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4801 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4804 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4807 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_err-code-%3Estring">err-code-&gt;string</a></b></code><i> <var>code</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
4810 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4811 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4812 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4813 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4814 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4817 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4818 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4819 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4822 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4823 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4826 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4829 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4830 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4831 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4832 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4835 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-version">system-version</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4836 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4839 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-type">system-type</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4840 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4841 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4844 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_system-stamp">system-stamp</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
4847 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4848 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4851 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4852 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4853 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4854 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4855 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4856 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4857 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4858 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4861 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4862 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4865 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4866 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4869 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4872 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_main">main</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
4875 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-record-type">define-record-type</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4876 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_define-type">define-type</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4879 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_namespace">namespace</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4882 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4885 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_receive">receive</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4888 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_cond-expand">cond-expand</a></b></code><i> &hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4891 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4894 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4895 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4896 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4899 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.!">six.!</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4900 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4901 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.&x">six.&amp;x</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4902 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4903 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4904 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4905 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4906 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4907 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4908 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.break">six.break</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4909 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.call">six.call</a></b></code><i> <var>func</var> <var>arg</var>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4910 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.case">six.case</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4911 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.clause">six.clause</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4912 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.compound">six.compound</a></b></code><i> <var>statement</var>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4913 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4914 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.continue">six.continue</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4915 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4916 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4917 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4918 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4919 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4920 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.goto">six.goto</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4921 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4922 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4923 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4924 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.label">six.label</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4925 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4926 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4927 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_six.make-array">six.make-array</a></b></code><i> <var>init</var> <var>dim</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
4928 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.new">six.new</a></b></code><i> <var>ident</var> <var>arg</var>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4929 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4930 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4931 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4932 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.procedure-body">six.procedure-body</a></b></code><i> <var>stat</var>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4933 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.return">six.return</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4934 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Undefined_six.switch">six.switch</a></b></code><code>)</code></td><td align="right">undefined</td></tr></table>
4935 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.while">six.while</a></b></code><i> <var>expr</var> <var>stat</var>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
4936 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4937 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4938 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4939 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&&y">six.x&amp;&amp;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4940 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&=y">six.x&amp;=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4941 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x&y">six.x&amp;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4942 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4943 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4944 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4945 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4946 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4947 <a name="Definition_of_|six.x,y|"></a><a name="Special_form_|six.x,y|"></a><a name="index-_007csix_002ex"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_|six.x">|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>
4948 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4949 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4950 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4951 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4952 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4953 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4954 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4955 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4956 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C%3C=y">six.x&lt;&lt;=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4957 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C%3Cy">six.x&lt;&lt;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4958 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3C=y">six.x&lt;=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4959 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3Cy">six.x&lt;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4960 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4961 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4962 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E=y">six.x&gt;=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4963 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E%3E=y">six.x&gt;&gt;=y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4964 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3E%3Ey">six.x&gt;&gt;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4965 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_six.x%3Ey">six.x&gt;y</a></b></code><i> <var>x</var> <var>y</var></i><code>)</code></td><td align="right">special form</td></tr></table>
4966 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4967 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4968 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4969 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4970 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4971 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4972 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
4975 <hr size="1">
4976 <a name="Namespaces"></a>
4977 <table cellpadding="1" cellspacing="1" border="0">
4978 <tr><td valign="middle" align="left"><a href="#Undocumented-extensions" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 6.4 Undocumented extensions" align="middle" width="32"></a></td>
4979 <td valign="middle" align="left"><a href="#Characters-and-strings" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 8. Characters and strings" align="middle" width="32"></a></td>
4980 <td valign="middle" align="left"> &nbsp; </td>
4981 <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" alt="FastBack: 6. Scheme extensions" align="middle" width="32"></a></td>
4982 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
4983 <td valign="middle" align="left"><a href="#Characters-and-strings" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 8. Characters and strings" align="middle" width="32"></a></td>
4984 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
4985 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
4986 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
4987 </tr></table>
4988 <a name="Namespaces-1"></a>
4989 <h1 class="chapter">7. Namespaces</h1>
4991 <p>TO DO!
4992 </p>
4993 <hr size="1">
4994 <a name="Characters-and-strings"></a>
4995 <table cellpadding="1" cellspacing="1" border="0">
4996 <tr><td valign="middle" align="left"><a href="#Namespaces" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 7. Namespaces" align="middle" width="32"></a></td>
4997 <td valign="middle" align="left"><a href="#Extensions-to-character-procedures" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 8.1 Extensions to character procedures" align="middle" width="32"></a></td>
4998 <td valign="middle" align="left"> &nbsp; </td>
4999 <td valign="middle" align="left"><a href="#Namespaces" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 7. Namespaces" align="middle" width="32"></a></td>
5000 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
5001 <td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 9. Numbers" align="middle" width="32"></a></td>
5002 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5003 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5004 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5005 </tr></table>
5006 <a name="Characters-and-strings-1"></a>
5007 <h1 class="chapter">8. Characters and strings</h1>
5009 <p>Gambit supports the Unicode character encoding standard. Scheme
5010 characters can be any of the characters whose Unicode encoding is in
5011 the range 0 to #x10ffff (inclusive) but not in the range #xd800 to
5012 #xdfff. Source code can also contain any Unicode character, however
5013 to read such source code properly <code>gsi</code> and <code>gsc</code> must be
5014 told which character encoding to use for reading the source code
5015 (i.e. ASCII, ISO-8859-1, UTF-8, etc). This can be done by specifying
5016 the runtime option <samp>-:f</samp> when <code>gsi</code> and <code>gsc</code> are
5017 started.
5018 </p>
5019 <table class="menu" border="0" cellspacing="0">
5020 <tr><td align="left" valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5021 <tr><td align="left" valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5022 </table>
5024 <hr size="1">
5025 <a name="Extensions-to-character-procedures"></a>
5026 <table cellpadding="1" cellspacing="1" border="0">
5027 <tr><td valign="middle" align="left"><a href="#Characters-and-strings" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 8. Characters and strings" align="middle" width="32"></a></td>
5028 <td valign="middle" align="left"><a href="#Extensions-to-string-procedures" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 8.2 Extensions to string procedures" align="middle" width="32"></a></td>
5029 <td valign="middle" align="left"> &nbsp; </td>
5030 <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" alt="FastBack: 8. Characters and strings" align="middle" width="32"></a></td>
5031 <td valign="middle" align="left"><a href="#Characters-and-strings" title="Up section"><img src="button-up.png" border="0" alt="Up: 8. Characters and strings" align="middle" width="32"></a></td>
5032 <td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 9. Numbers" align="middle" width="32"></a></td>
5033 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5034 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5035 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5036 </tr></table>
5037 <a name="Extensions-to-character-procedures-1"></a>
5038 <h2 class="section">8.1 Extensions to character procedures</h2>
5040 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-%3Einteger">char-&gt;integer</a></b></code><i> <var>char</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
5041 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_integer-%3Echar">integer-&gt;char</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
5043 <p>The procedure <code>char-&gt;integer</code> returns the Unicode encoding of
5044 the character <var>char</var>.
5045 </p>
5046 <p>The procedure <code>integer-&gt;char</code> returns the character whose
5047 Unicode encoding is the exact integer <var>n</var>.
5048 </p>
5049 <p>For example:
5050 </p>
5051 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(char-&gt;integer #\!)</b>
5053 &gt; <b>(integer-&gt;char 65)</b>
5055 &gt; <b>(integer-&gt;char (char-&gt;integer #\u1234))</b>
5056 #\u1234
5057 &gt; <b>(integer-&gt;char #xd800)</b>
5058 *** ERROR IN (console)@4.1 -- (Argument 1) Out of range
5059 (integer-&gt;char 55296)
5060 </pre></td></tr></table>
5064 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char=?">char=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5065 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3C?">char&lt;?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5066 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3E?">char&gt;?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5067 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3C=?">char&lt;=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5068 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char%3E=?">char&gt;=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5069 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci=?">char-ci=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5070 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3C?">char-ci&lt;?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5071 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3E?">char-ci&gt;?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5072 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3C=?">char-ci&lt;=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5073 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_char-ci%3E=?">char-ci&gt;=?</a></b></code><i> <var>char1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5075 <p>These procedures take any number of arguments including no argument.
5076 This is useful to test if the elements of a list are sorted in a
5077 particular order. For example, testing that the list of characters
5078 <code>lst</code> is sorted in nondecreasing order can be done with the call
5079 <code>(apply char&lt;? lst)</code>.
5080 </p>
5083 <hr size="1">
5084 <a name="Extensions-to-string-procedures"></a>
5085 <table cellpadding="1" cellspacing="1" border="0">
5086 <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" alt="Back: 8.1 Extensions to character procedures" align="middle" width="32"></a></td>
5087 <td valign="middle" align="left"><a href="#Numbers" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9. Numbers" align="middle" width="32"></a></td>
5088 <td valign="middle" align="left"> &nbsp; </td>
5089 <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" alt="FastBack: 8. Characters and strings" align="middle" width="32"></a></td>
5090 <td valign="middle" align="left"><a href="#Characters-and-strings" title="Up section"><img src="button-up.png" border="0" alt="Up: 8. Characters and strings" align="middle" width="32"></a></td>
5091 <td valign="middle" align="left"><a href="#Numbers" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 9. Numbers" align="middle" width="32"></a></td>
5092 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5093 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5094 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5095 </tr></table>
5096 <a name="Extensions-to-string-procedures-1"></a>
5097 <h2 class="section">8.2 Extensions to string procedures</h2>
5099 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string=?">string=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5100 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3C?">string&lt;?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5101 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3E?">string&gt;?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5102 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3C=?">string&lt;=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5103 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string%3E=?">string&gt;=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5104 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci=?">string-ci=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5105 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3C?">string-ci&lt;?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5106 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3E?">string-ci&gt;?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5107 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3C=?">string-ci&lt;=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5108 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_string-ci%3E=?">string-ci&gt;=?</a></b></code><i> <var>string1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5110 <p>These procedures take any number of arguments including no argument.
5111 This is useful to test if the elements of a list are sorted in a
5112 particular order. For example, testing that the list of strings
5113 <code>lst</code> is sorted in nondecreasing order can be done with the call
5114 <code>(apply string&lt;? lst)</code>.
5115 </p>
5118 <hr size="1">
5119 <a name="Numbers"></a>
5120 <table cellpadding="1" cellspacing="1" border="0">
5121 <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" alt="Back: 8.2 Extensions to string procedures" align="middle" width="32"></a></td>
5122 <td valign="middle" align="left"><a href="#Extensions-to-numeric-procedures" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9.1 Extensions to numeric procedures" align="middle" width="32"></a></td>
5123 <td valign="middle" align="left"> &nbsp; </td>
5124 <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" alt="FastBack: 8. Characters and strings" align="middle" width="32"></a></td>
5125 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
5126 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5127 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5128 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5129 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5130 </tr></table>
5131 <a name="Numbers-1"></a>
5132 <h1 class="chapter">9. Numbers</h1>
5134 <table class="menu" border="0" cellspacing="0">
5135 <tr><td align="left" valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5136 <tr><td align="left" valign="top"><a href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5137 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5138 <tr><td align="left" valign="top"><a href="#Bitwise_002doperations-on-exact-integers">9.4 Bitwise-operations on exact integers</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5139 <tr><td align="left" valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"> Operations on fixnums
5140 </td></tr>
5141 <tr><td align="left" valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"> Operations on flonums
5142 </td></tr>
5143 <tr><td align="left" valign="top"><a href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
5144 </table>
5146 <hr size="1">
5147 <a name="Extensions-to-numeric-procedures"></a>
5148 <table cellpadding="1" cellspacing="1" border="0">
5149 <tr><td valign="middle" align="left"><a href="#Numbers" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 9. Numbers" align="middle" width="32"></a></td>
5150 <td valign="middle" align="left"><a href="#IEEE-floating-point-arithmetic" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9.2 IEEE floating point arithmetic" align="middle" width="32"></a></td>
5151 <td valign="middle" align="left"> &nbsp; </td>
5152 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5153 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5154 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5155 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5156 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5157 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5158 </tr></table>
5159 <a name="Extensions-to-numeric-procedures-1"></a>
5160 <h2 class="section">9.1 Extensions to numeric procedures</h2>
5162 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_=">=</a></b></code><i> <var>z1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5163 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3C">&lt;</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5164 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3E">&gt;</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5165 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3C=">&lt;=</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5166 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_%3E=">&gt;=</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5168 <p>These procedures take any number of arguments including no argument.
5169 This is useful to test if the elements of a list are sorted in a
5170 particular order. For example, testing that the list of numbers
5171 <code>lst</code> is sorted in nondecreasing order can be done with the call
5172 <code>(apply &lt; lst)</code>.
5173 </p>
5176 <hr size="1">
5177 <a name="IEEE-floating-point-arithmetic"></a>
5178 <table cellpadding="1" cellspacing="1" border="0">
5179 <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" alt="Back: 9.1 Extensions to numeric procedures" align="middle" width="32"></a></td>
5180 <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" alt="Forward: 9.3 Integer square root and nth root" align="middle" width="32"></a></td>
5181 <td valign="middle" align="left"> &nbsp; </td>
5182 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5183 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5184 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5185 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5186 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5187 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5188 </tr></table>
5189 <a name="IEEE-floating-point-arithmetic-1"></a>
5190 <h2 class="section">9.2 IEEE floating point arithmetic</h2>
5192 <p>To better conform to IEEE floating point arithmetic the standard
5193 numeric tower is extended with these special inexact reals:
5194 </p>
5195 <dl compact="compact">
5196 <dt> <code>+inf.0</code></dt>
5197 <dd><p>positive infinity
5198 </p></dd>
5199 <dt> <code>-inf.0</code></dt>
5200 <dd><p>negative infinity
5201 </p></dd>
5202 <dt> <code>+nan.0</code></dt>
5203 <dd><p>&ldquo;not a number&rdquo;
5204 </p></dd>
5205 <dt> <code>-0.</code></dt>
5206 <dd><p>negative zero (<samp>0.</samp> is the positive zero)
5207 </p></dd>
5208 </dl>
5210 <p>The infinities and &ldquo;not a number&rdquo; are reals (i.e. <code>(real?
5211 +inf.0)</code> is <code>#t</code>) but are not rational (i.e. <code>(rational?
5212 +inf.0)</code> is <code>#f</code>).
5213 </p>
5214 <p>Both zeros are numerically equal (i.e. <code>(= -0. 0.)</code> is <code>#t</code>)
5215 but are not equivalent (i.e. <code>(eqv? -0. 0.)</code> and <code>(equal?
5216 -0. 0.)</code> are <code>#f</code>). All numerical comparisons with &ldquo;not a
5217 number&rdquo;, including <code>(= +nan.0 +nan.0)</code>, are <code>#f</code>.
5218 </p>
5219 <hr size="1">
5220 <a name="Integer-square-root-and-nth-root"></a>
5221 <table cellpadding="1" cellspacing="1" border="0">
5222 <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" alt="Back: 9.2 IEEE floating point arithmetic" align="middle" width="32"></a></td>
5223 <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" alt="Forward: 9.4 Bitwise-operations on exact integers" align="middle" width="32"></a></td>
5224 <td valign="middle" align="left"> &nbsp; </td>
5225 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5226 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5227 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5228 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5229 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5230 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5231 </tr></table>
5232 <a name="Integer-square-root-and-nth-root-1"></a>
5233 <h2 class="section">9.3 Integer square root and nth root</h2>
5235 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5237 <p>This procedure returns the integer part of the square root of the
5238 nonnegative exact integer <var>n</var>.
5239 </p>
5240 <p>For example:
5241 </p>
5242 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(integer-sqrt 123)</b>
5244 </pre></td></tr></table>
5248 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5250 <p>This procedure returns the integer part of <var>n1</var> raised to the
5251 power 1/<var>n2</var>, where <var>n1</var> is a nonnegative exact integer and
5252 <var>n2</var> is a positive exact integer.
5253 </p>
5254 <p>For example:
5255 </p>
5256 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(integer-nth-root 100 3)</b>
5258 </pre></td></tr></table>
5262 <hr size="1">
5263 <a name="Bitwise_002doperations-on-exact-integers"></a>
5264 <table cellpadding="1" cellspacing="1" border="0">
5265 <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" alt="Back: 9.3 Integer square root and nth root" align="middle" width="32"></a></td>
5266 <td valign="middle" align="left"><a href="#Fixnum-specific-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9.5 Fixnum specific operations" align="middle" width="32"></a></td>
5267 <td valign="middle" align="left"> &nbsp; </td>
5268 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5269 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5270 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5271 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5272 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5273 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5274 </tr></table>
5275 <a name="Bitwise_002doperations-on-exact-integers-1"></a>
5276 <h2 class="section">9.4 Bitwise-operations on exact integers</h2>
5278 <p>The procedures defined in this section are compatible with the
5279 withdrawn &ldquo;Integer Bitwise-operation Library SRFI&rdquo; (SRFI 33). Note
5280 that some of the procedures specified in SRFI 33 are not provided.
5281 </p>
5282 <p>Most procedures in this section are specified in terms of the binary
5283 representation of exact integers. The two&rsquo;s complement representation
5284 is assumed where an integer is composed of an infinite number of bits.
5285 The upper section of an integer (the most significant bits) are either
5286 an infinite sequence of ones when the integer is negative, or they are
5287 an infinite sequence of zeros when the integer is nonnegative.
5288 </p>
5289 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5291 <p>This procedure returns <var>n1</var> shifted to the left by <var>n2</var> bits,
5292 that is <code>(floor (* <var>n1</var> (expt 2 <var>n2</var>)))</code>. Both <var>n1</var>
5293 and <var>n2</var> must be exact integers.
5294 </p>
5295 <p>For example:
5296 </p>
5297 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(arithmetic-shift 1000 7) <span class="roman"><i>; n1=...0000001111101000</i></span></b>
5298 128000
5299 &gt; <b>(arithmetic-shift 1000 -6) <span class="roman"><i>; n1=...0000001111101000</i></span></b>
5301 &gt; <b>(arithmetic-shift -23 -3) <span class="roman"><i>; n1=...1111111111101001</i></span></b>
5303 </pre></td></tr></table>
5307 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5309 <p>This procedure returns an exact integer whose bits combine the bits
5310 from <var>n2</var> and <var>n3</var> depending on <var>n1</var>. The bit at index
5311 <var>i</var> of the result depends only on the bits at index <var>i</var> in
5312 <var>n1</var>, <var>n2</var> and <var>n3</var>: it is equal to the bit in <var>n2</var>
5313 when the bit in <var>n1</var> is 0 and it is equal to the bit in <var>n3</var>
5314 when the bit in <var>n1</var> is 1. All arguments must be exact integers.
5315 </p>
5316 <p>For example:
5317 </p>
5318 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bitwise-merge -4 -11 10) <span class="roman"><i>; ...11111100 ...11110101 ...00001010</i></span></b>
5320 &gt; <b>(bitwise-merge 12 -11 10) <span class="roman"><i>; ...00001100 ...11110101 ...00001010</i></span></b>
5322 </pre></td></tr></table>
5326 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-and">bitwise-and</a></b></code><i> <var>n</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5328 <p>This procedure returns the bitwise &ldquo;and&rdquo; of the exact integers
5329 <var>n</var>&hellip;. The value -1 is returned when there are no arguments.
5330 </p>
5331 <p>For example:
5332 </p>
5333 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bitwise-and 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
5335 &gt; <b>(bitwise-and 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
5337 &gt; <b>(bitwise-and -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
5339 &gt; <b>(bitwise-and)</b>
5341 </pre></td></tr></table>
5345 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-ior">bitwise-ior</a></b></code><i> <var>n</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5347 <p>This procedure returns the bitwise &ldquo;inclusive-or&rdquo; of the exact
5348 integers <var>n</var>&hellip;. The value 0 is returned when there are no
5349 arguments.
5350 </p>
5351 <p>For example:
5352 </p>
5353 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bitwise-ior 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
5355 &gt; <b>(bitwise-ior 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
5357 &gt; <b>(bitwise-ior -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
5359 &gt; <b>(bitwise-ior)</b>
5361 </pre></td></tr></table>
5365 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_bitwise-xor">bitwise-xor</a></b></code><i> <var>n</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5367 <p>This procedure returns the bitwise &ldquo;exclusive-or&rdquo; of the exact
5368 integers <var>n</var>&hellip;. The value 0 is returned when there are no
5369 arguments.
5370 </p>
5371 <p>For example:
5372 </p>
5373 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bitwise-xor 6 12) <span class="roman"><i>; ...00000110 ...00001100</i></span></b>
5375 &gt; <b>(bitwise-xor 6 -4) <span class="roman"><i>; ...00000110 ...11111100</i></span></b>
5377 &gt; <b>(bitwise-xor -6 -4) <span class="roman"><i>; ...11111010 ...11111100</i></span></b>
5379 &gt; <b>(bitwise-xor)</b>
5381 </pre></td></tr></table>
5385 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5387 <p>This procedure returns the bitwise complement of the exact integer
5388 <var>n</var>.
5389 </p>
5390 <p>For example:
5391 </p>
5392 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bitwise-not 3) <span class="roman"><i>; ...00000011</i></span></b>
5394 &gt; <b>(bitwise-not -1) <span class="roman"><i>; ...11111111</i></span></b>
5396 </pre></td></tr></table>
5400 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5402 <p>This procedure returns the bit count of the exact integer <var>n</var>. If
5403 <var>n</var> is nonnegative, the bit count is the number of 1 bits in the
5404 two&rsquo;s complement representation of <var>n</var>. If <var>n</var> is negative,
5405 the bit count is the number of 0 bits in the two&rsquo;s complement
5406 representation of <var>n</var>.
5407 </p>
5408 <p>For example:
5409 </p>
5410 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(bit-count 0) <span class="roman"><i>; ...00000000</i></span></b>
5412 &gt; <b>(bit-count 1) <span class="roman"><i>; ...00000001</i></span></b>
5414 &gt; <b>(bit-count 2) <span class="roman"><i>; ...00000010</i></span></b>
5416 &gt; <b>(bit-count 3) <span class="roman"><i>; ...00000011</i></span></b>
5418 &gt; <b>(bit-count 4) <span class="roman"><i>; ...00000100</i></span></b>
5420 &gt; <b>(bit-count -23) <span class="roman"><i>; ...11101001</i></span></b>
5422 </pre></td></tr></table>
5426 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5428 <p>This procedure returns the bit length of the exact integer <var>n</var>.
5429 If <var>n</var> is a positive integer the bit length is one more than the
5430 index of the highest 1 bit (the least significant bit is at index 0).
5431 If <var>n</var> is a negative integer the bit length is one more than the
5432 index of the highest 0 bit. If <var>n</var> is zero, the bit length is 0.
5433 </p>
5434 <p>For example:
5435 </p>
5436 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(integer-length 0) <span class="roman"><i>; ...00000000</i></span></b>
5438 &gt; <b>(integer-length 1) <span class="roman"><i>; ...00000001</i></span></b>
5440 &gt; <b>(integer-length 2) <span class="roman"><i>; ...00000010</i></span></b>
5442 &gt; <b>(integer-length 3) <span class="roman"><i>; ...00000011</i></span></b>
5444 &gt; <b>(integer-length 4) <span class="roman"><i>; ...00000100</i></span></b>
5446 &gt; <b>(integer-length -23) <span class="roman"><i>; ...11101001</i></span></b>
5448 </pre></td></tr></table>
5452 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5454 <p>This procedure returns a boolean indicating if the bit at index
5455 <var>n1</var> of <var>n2</var> is set (i.e. equal to 1) or not. Both <var>n1</var>
5456 and <var>n2</var> must be exact integers, and <var>n1</var> must be
5457 nonnegative.
5458 </p>
5459 <p>For example:
5460 </p>
5461 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map (lambda (i) (bit-set? i -23)) <span class="roman"><i>; ...11101001</i></span>
5462 '(7 6 5 4 3 2 1 0))</b>
5463 (#t #t #t #f #t #f #f #t)
5464 </pre></td></tr></table>
5468 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5470 <p>This procedure returns a boolean indicating if the bitwise and
5471 of <var>n1</var> and <var>n2</var> is different from zero or not. This procedure
5472 is implemented more efficiently than the naive definition:
5473 </p>
5474 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define (any-bits-set? n1 n2) (not (zero? (bitwise-and n1 n2))))
5475 </pre></td></tr></table>
5477 <p>For example:
5478 </p>
5479 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(any-bits-set? 5 10) <span class="roman"><i>; ...00000101 ...00001010</i></span></b>
5481 &gt; <b>(any-bits-set? -23 32) <span class="roman"><i>; ...11101001 ...00100000</i></span></b>
5483 </pre></td></tr></table>
5487 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5489 <p>This procedure returns a boolean indicating if the bitwise and
5490 of <var>n1</var> and <var>n2</var> is equal to <var>n1</var> or not. This procedure
5491 is implemented more efficiently than the naive definition:
5492 </p>
5493 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define (all-bits-set? n1 n2) (= n1 (bitwise-and n1 n2)))
5494 </pre></td></tr></table>
5496 <p>For example:
5497 </p>
5498 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(all-bits-set? 1 3) <span class="roman"><i>; ...00000001 ...00000011</i></span></b>
5500 &gt; <b>(all-bits-set? 7 3) <span class="roman"><i>; ...00000111 ...00000011</i></span></b>
5502 </pre></td></tr></table>
5506 <a name="Definition_of_first-bit-set"></a><a name="Procedure_first-bit-set"></a><a name="index-first_002dbit_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_first-bit-set">first-bit-set</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
5508 <p>This procedure returns the bit index of the least significant bit of
5509 <var>n</var> equal to 1 (which is also the number of 0 bits that are below
5510 the least significant 1 bit). This procedure returns <code>-1</code> when
5511 <var>n</var> is zero.
5512 </p>
5513 <p>For example:
5514 </p>
5515 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(first-bit-set 24) <span class="roman"><i>; ...00011000</i></span></b>
5517 &gt; <b>(first-bit-set 0) <span class="roman"><i>; ...00000000</i></span></b>
5519 </pre></td></tr></table>
5523 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5524 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5525 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5526 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5527 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5529 <p>These procedures operate on a bit-field which is <var>n1</var> bits wide
5530 starting at bit index <var>n2</var>. All arguments must be exact integers
5531 and <var>n1</var> and <var>n2</var> must be nonnegative.
5532 </p>
5533 <p>The procedure <code>extract-bit-field</code> returns the bit-field of
5534 <var>n3</var> shifted to the right so that the least significant bit of the
5535 bit-field is the least significant bit of the result.
5536 </p>
5537 <p>The procedure <code>test-bit-field?</code> returns <code>#t</code> if any bit in
5538 the bit-field of <var>n3</var> is equal to 1, otherwise <code>#f</code> is
5539 returned.
5540 </p>
5541 <p>The procedure <code>clear-bit-field</code> returns <var>n3</var> with all bits
5542 in the bit-field replaced with 0.
5543 </p>
5544 <p>The procedure <code>replace-bit-field</code> returns <var>n4</var> with the
5545 bit-field replaced with the least-significant <var>n1</var> bits of
5546 <var>n3</var>.
5547 </p>
5548 <p>The procedure <code>copy-bit-field</code> returns <var>n4</var> with the
5549 bit-field replaced with the (same index and size) bit-field in
5550 <var>n3</var>.
5551 </p>
5552 <p>For example:
5553 </p>
5554 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(extract-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
5556 &gt; <b>(test-bit-field? 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
5558 &gt; <b>(test-bit-field? 1 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
5560 &gt; <b>(clear-bit-field 5 2 -37) <span class="roman"><i>; ...11011011</i></span></b>
5561 -125
5562 &gt; <b>(replace-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b>
5564 &gt; <b>(copy-bit-field 5 2 -6 -37) <span class="roman"><i>; ...11111010 ...11011011</i></span></b>
5566 </pre></td></tr></table>
5570 <hr size="1">
5571 <a name="Fixnum-specific-operations"></a>
5572 <table cellpadding="1" cellspacing="1" border="0">
5573 <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" alt="Back: 9.4 Bitwise-operations on exact integers" align="middle" width="32"></a></td>
5574 <td valign="middle" align="left"><a href="#Flonum-specific-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9.6 Flonum specific operations" align="middle" width="32"></a></td>
5575 <td valign="middle" align="left"> &nbsp; </td>
5576 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5577 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5578 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5579 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5580 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5581 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5582 </tr></table>
5583 <a name="Fixnum-specific-operations-1"></a>
5584 <h2 class="section">9.5 Fixnum specific operations</h2>
5586 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5589 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%2A">fx*</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5592 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%2B">fx+</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5595 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx-">fx-</a></b></code><i> <var>n1</var> <var>n2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5598 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3C">fx&lt;</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5601 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3C=">fx&lt;=</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5604 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx=">fx=</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5607 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3E">fx&gt;</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5610 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fx%3E=">fx&gt;=</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5613 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5616 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxand">fxand</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5619 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5622 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5625 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5628 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5631 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5634 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5637 <a name="Definition_of_fxfirst-bit-set"></a><a name="Procedure_fxfirst-bit-set"></a><a name="index-fxfirst_002dbit_002dset"></a><table width="100%"><tr><td align="left"> <code>(</code><code><b><a href="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxfirst-bit-set">fxfirst-bit-set</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
5640 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5643 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxior">fxior</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5646 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5649 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxmax">fxmax</a></b></code><i> <var>n1</var> <var>n2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5652 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxmin">fxmin</a></b></code><i> <var>n1</var> <var>n2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5655 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5658 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5661 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5664 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5667 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5670 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5673 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5676 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap%2A">fxwrap*</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5679 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap%2B">fxwrap+</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5682 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxwrap-">fxwrap-</a></b></code><i> <var>n1</var> <var>n2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5685 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5688 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5691 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5694 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5697 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5700 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fxxor">fxxor</a></b></code><i> <var>n1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5703 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5706 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5707 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5708 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5710 <p>Fixnum-overflow-exception objects are raised by some of the fixnum
5711 specific procedures when the result is larger than can fit in a
5712 fixnum. The parameter <var>exc</var> must be a fixnum-overflow-exception
5713 object.
5714 </p>
5715 <p>The procedure <code>fixnum-overflow-exception?</code> returns
5716 <code>#t</code> when <var>obj</var> is a fixnum-overflow-exception
5717 object and <code>#f</code> otherwise.
5718 </p>
5719 <p>The procedure <code>fixnum-overflow-exception-procedure</code>
5720 returns the procedure that raised <var>exc</var>.
5721 </p>
5722 <p>The procedure <code>fixnum-overflow-exception-arguments</code>
5723 returns the list of arguments of the procedure that raised <var>exc</var>.
5724 </p>
5725 <p>For example:
5726 </p>
5727 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
5728 (if (fixnum-overflow-exception? exc)
5729 (list (fixnum-overflow-exception-procedure exc)
5730 (fixnum-overflow-exception-arguments exc))
5731 'not-fixnum-overflow-exception))</b>
5732 &gt; <b>(with-exception-catcher
5733 handler
5734 (lambda () (fx* 100000 100000)))</b>
5735 (#&lt;procedure #2 fx*&gt; (100000 100000))
5736 </pre></td></tr></table>
5740 <hr size="1">
5741 <a name="Flonum-specific-operations"></a>
5742 <table cellpadding="1" cellspacing="1" border="0">
5743 <tr><td valign="middle" align="left"><a href="#Fixnum-specific-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 9.5 Fixnum specific operations" align="middle" width="32"></a></td>
5744 <td valign="middle" align="left"><a href="#Pseudo-random-numbers" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 9.7 Pseudo random numbers" align="middle" width="32"></a></td>
5745 <td valign="middle" align="left"> &nbsp; </td>
5746 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5747 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5748 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5749 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5750 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5751 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5752 </tr></table>
5753 <a name="Flonum-specific-operations-1"></a>
5754 <h2 class="section">9.6 Flonum specific operations</h2>
5756 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5759 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fixnum-%3Eflonum">fixnum-&gt;flonum</a></b></code><i> <var>n</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
5762 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%2A">fl*</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5765 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%2B">fl+</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5768 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl-">fl-</a></b></code><i> <var>x1</var> <var>x2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5771 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5774 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3C">fl&lt;</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5777 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3C=">fl&lt;=</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5780 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl=">fl=</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5783 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3E">fl&gt;</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5786 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_fl%3E=">fl&gt;=</a></b></code><i> <var>x1</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5789 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5792 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5795 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5798 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5799 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5802 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5805 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5808 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5811 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5814 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5817 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5820 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5823 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5826 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5829 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5832 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5835 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flmax">flmax</a></b></code><i> <var>x1</var> <var>x2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5838 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_flmin">flmin</a></b></code><i> <var>x1</var> <var>x2</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
5841 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5844 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5847 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5850 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5853 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5856 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5859 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5862 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5865 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5868 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5871 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5874 <hr size="1">
5875 <a name="Pseudo-random-numbers"></a>
5876 <table cellpadding="1" cellspacing="1" border="0">
5877 <tr><td valign="middle" align="left"><a href="#Flonum-specific-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 9.6 Flonum specific operations" align="middle" width="32"></a></td>
5878 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5879 <td valign="middle" align="left"> &nbsp; </td>
5880 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
5881 <td valign="middle" align="left"><a href="#Numbers" title="Up section"><img src="button-up.png" border="0" alt="Up: 9. Numbers" align="middle" width="32"></a></td>
5882 <td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 10. Homogeneous vectors" align="middle" width="32"></a></td>
5883 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
5884 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
5885 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
5886 </tr></table>
5887 <a name="Pseudo-random-numbers-1"></a>
5888 <h2 class="section">9.7 Pseudo random numbers</h2>
5890 <p>The procedures and variables defined in this section are compatible
5891 with the &ldquo;Sources of Random Bits SRFI&rdquo; (SRFI 27). The
5892 implementation is based on Pierre L&rsquo;Ecuyer&rsquo;s MRG32k3a pseudo random
5893 number generator. At the heart of SRFI 27&rsquo;s interface is the random
5894 source type which encapsulates the state of a pseudo random number
5895 generator. The state of a random source object changes every time a
5896 pseudo random number is generated from this random source object.
5897 </p>
5898 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5900 <p>The global variable <code>default-random-source</code> is bound to the
5901 random source object which is used by the <code>random-integer</code>,
5902 <code>random-real</code>, <code>random-u8vector</code> and <code>random-f64vector</code>
5903 procedures.
5904 </p>
5907 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5909 <p>This procedure returns a pseudo random exact integer in the range 0 to
5910 <var>n</var>-1. The random source object in the global variable
5911 <code>default-random-source</code> is used to generate this number. The
5912 parameter <var>n</var> must be a positive exact integer.
5913 </p>
5914 <p>For example:
5915 </p>
5916 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(random-integer 100)</b>
5918 &gt; <b>(random-integer 100)</b>
5920 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
5921 6143360270902284438072426748425263488507
5922 </pre></td></tr></table>
5926 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_random-real">random-real</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
5928 <p>This procedure returns a pseudo random inexact real between, but not
5929 including, 0 and 1. The random source object in the global variable
5930 <code>default-random-source</code> is used to generate this number.
5931 </p>
5932 <p>For example:
5933 </p>
5934 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(random-real)</b>
5935 .24230672079133753
5936 &gt; <b>(random-real)</b>
5937 .02317001922506932
5938 </pre></td></tr></table>
5942 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5944 <p>This procedure returns a u8vector of length <var>n</var> containing pseudo
5945 random exact integers in the range 0 to 255. The random source object
5946 in the global variable <code>default-random-source</code> is used to
5947 generate these numbers. The parameter <var>n</var> must be a nonnegative
5948 exact integer.
5949 </p>
5950 <p>For example:
5951 </p>
5952 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(random-u8vector 10)</b>
5953 #u8(200 53 29 202 3 85 208 187 73 219)
5954 </pre></td></tr></table>
5958 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5960 <p>This procedure returns a f64vector of length <var>n</var> containing pseudo
5961 random inexact reals between, but not including, 0 and 1. The random
5962 source object in the global variable <code>default-random-source</code> is
5963 used to generate these numbers. The parameter <var>n</var> must be a nonnegative
5964 exact integer.
5965 </p>
5966 <p>For example:
5967 </p>
5968 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(random-f64vector 3)</b>
5969 #f64(.7145854494613069 .47089632669147946 .5400124875182746)
5970 </pre></td></tr></table>
5974 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5976 <p>This procedure returns a new random source object initialized to a
5977 predetermined state (to initialize to a pseudo random state the
5978 procedure <code>random-source-randomize!</code> should be called).
5979 </p>
5980 <p>For example:
5981 </p>
5982 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rs (make-random-source))</b>
5983 &gt; <b>((random-source-make-integers rs) 10000000)</b>
5984 8583952
5985 </pre></td></tr></table>
5989 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
5991 <p>This procedure returns <code>#t</code> when <var>obj</var> is a random source
5992 object and <code>#f</code> otherwise.
5993 </p>
5994 <p>For example:
5995 </p>
5996 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(random-source? default-random-source)</b>
5998 &gt; <b>(random-source? 123)</b>
6000 </pre></td></tr></table>
6004 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6005 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6007 <p>The procedure <code>random-source-state-ref</code> extracts the state of
6008 the random source object <var>random-source</var> and returns a vector
6009 containing the state.
6010 </p>
6011 <p>The procedure <code>random-source-state-set!</code> restores the state of
6012 the random source object <var>random-source</var> to <var>state</var> which must
6013 be a vector returned from a call to the procedure
6014 <code>random-source-state-ref</code>.
6015 </p>
6016 <p>For example:
6017 </p>
6018 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (random-source-state-ref default-random-source))</b>
6019 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6020 7583880188903074396261960585615270693321
6021 &gt; <b>(random-source-state-set! default-random-source s)</b>
6022 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6023 7583880188903074396261960585615270693321
6024 </pre></td></tr></table>
6028 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6029 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6031 <p>These procedures change the state of the random source object
6032 <var>random-source</var>. The procedure <code>random-source-randomize!</code>
6033 sets the random source object to a state that depends on the current
6034 time (which for typical uses can be considered to randomly initialize
6035 the state). The procedure <code>random-source-pseudo-randomize!</code>
6036 sets the random source object to a state that is determined only by
6037 the current state and the nonnegative exact integers <var>i</var> and
6038 <var>j</var>. For both procedures the value returned is unspecified.
6039 </p>
6040 <p>For example:
6041 </p>
6042 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (random-source-state-ref default-random-source))</b>
6043 &gt; <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
6044 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6045 9816755163910623041601722050112674079767
6046 &gt; <b>(random-source-state-set! default-random-source s)</b>
6047 &gt; <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
6048 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6049 9816755163910623041601722050112674079767
6050 &gt; <b>(random-source-pseudo-randomize! default-random-source 5 99)</b>
6051 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6052 9816755163910623041601722050112674079767
6053 &gt; <b>(random-source-state-set! default-random-source s)</b>
6054 &gt; <b>(random-source-randomize! default-random-source)</b>
6055 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6056 2271441220851914333384493143687768110622
6057 &gt; <b>(random-source-state-set! default-random-source s)</b>
6058 &gt; <b>(random-source-randomize! default-random-source)</b>
6059 &gt; <b>(random-integer 10000000000000000000000000000000000000000)</b>
6060 6247966138948323029033944059178072366895
6061 </pre></td></tr></table>
6065 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6067 <p>This procedure returns a procedure for generating pseudo random exact
6068 integers using the random source object <var>random-source</var>. The
6069 returned procedure accepts a single parameter <var>n</var>, a positive
6070 exact integer, and returns a pseudo random exact integer in the range
6071 0 to <var>n</var>-1.
6072 </p>
6073 <p>For example:
6074 </p>
6075 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rs (make-random-source))</b>
6076 &gt; <b>(define ri (random-source-make-integers rs))</b>
6077 &gt; <b>(ri 10000000)</b>
6078 8583952
6079 &gt; <b>(ri 10000000)</b>
6080 2879793
6081 </pre></td></tr></table>
6085 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6087 <p>This procedure returns a procedure for generating pseudo random
6088 inexact reals using the random source object <var>random-source</var>. The
6089 returned procedure accepts no parameters and returns a pseudo random
6090 inexact real between, but not including, 0 and 1. The optional parameter
6091 <var>precision</var> specifies an upper bound on the minimum amount by which two
6092 generated pseudo-random numbers can be separated.
6093 </p>
6094 <p>For example:
6095 </p>
6096 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rs (make-random-source))</b>
6097 &gt; <b>(define rr (random-source-make-reals rs))</b>
6098 &gt; <b>(rr)</b>
6099 .857402537562821
6100 &gt; <b>(rr)</b>
6101 .2876463473845367
6102 </pre></td></tr></table>
6106 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6108 <p>This procedure returns a procedure for generating pseudo random
6109 u8vectors using the random source object <var>random-source</var>. The
6110 returned procedure accepts a single parameter <var>n</var>, a nonnegative
6111 exact integer, and returns a u8vector of length <var>n</var> containing
6112 pseudo random exact integers in the range 0 to 255.
6113 </p>
6114 <p>For example:
6115 </p>
6116 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rs (make-random-source))</b>
6117 &gt; <b>(define rv (random-source-make-u8vectors rs))</b>
6118 &gt; <b>(rv 10)</b>
6119 #u8(200 53 29 202 3 85 208 187 73 219)
6120 &gt; <b>(rv 10)</b>
6121 #u8(113 8 182 120 138 103 53 192 40 176)
6122 </pre></td></tr></table>
6126 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6128 <p>This procedure returns a procedure for generating pseudo random
6129 f64vectors using the random source object <var>random-source</var>. The
6130 returned procedure accepts a single parameter <var>n</var>, a nonnegative
6131 exact integer, and returns an f64vector of length <var>n</var> containing
6132 pseudo random inexact reals between, but not including, 0 and 1.
6133 The optional parameter <var>precision</var> specifies an upper bound on the
6134 minimum amount by which two generated pseudo-random numbers can be separated.
6135 </p>
6136 <p>For example:
6137 </p>
6138 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rs (make-random-source))</b>
6139 &gt; <b>(define rv (random-source-make-f64vectors rs))</b>
6140 &gt; <b>(rv 3)</b>
6141 #f64(.7342236104231586 .2876463473845367 .8574025375628211)
6142 &gt; <b>(rv 3)</b>
6143 #f64(.013863292728449427 .33449296573515447 .8162050798467028)
6144 </pre></td></tr></table>
6148 <hr size="1">
6149 <a name="Homogeneous-vectors"></a>
6150 <table cellpadding="1" cellspacing="1" border="0">
6151 <tr><td valign="middle" align="left"><a href="#Pseudo-random-numbers" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 9.7 Pseudo random numbers" align="middle" width="32"></a></td>
6152 <td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 11. Hashing and weak references" align="middle" width="32"></a></td>
6153 <td valign="middle" align="left"> &nbsp; </td>
6154 <td valign="middle" align="left"><a href="#Numbers" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 9. Numbers" align="middle" width="32"></a></td>
6155 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
6156 <td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 11. Hashing and weak references" align="middle" width="32"></a></td>
6157 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6158 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6159 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6160 </tr></table>
6161 <a name="Homogeneous-vectors-1"></a>
6162 <h1 class="chapter">10. Homogeneous vectors</h1>
6163 <a name="index-homogeneous-vectors"></a>
6165 <p>Homogeneous vectors are vectors containing raw numbers of the same
6166 type (signed or unsigned exact integers or inexact reals). There are
6167 10 types of homogeneous vectors:
6168 <samp>s8vector</samp> (vector of exact integers in the range -2^7 to 2^7-1),
6169 <samp>u8vector</samp> (vector of exact integers in the range 0 to 2^8-1),
6170 <samp>s16vector</samp> (vector of exact integers in the range -2^15 to 2^15-1),
6171 <samp>u16vector</samp> (vector of exact integers in the range 0 to 2^16-1),
6172 <samp>s32vector</samp> (vector of exact integers in the range -2^31 to 2^31-1),
6173 <samp>u32vector</samp> (vector of exact integers in the range 0 to 2^32-1),
6174 <samp>s64vector</samp> (vector of exact integers in the range -2^63 to 2^63-1),
6175 <samp>u64vector</samp> (vector of exact integers in the range 0 to 2^64-1),
6176 <samp>f32vector</samp> (vector of 32 bit floating point numbers),
6177 and <samp>f64vector</samp> (vector of 64 bit floating point numbers).
6178 </p>
6179 <p>The lexical syntax of homogeneous vectors is specified in
6180 <a href="#Homogeneous-vector-syntax">Homogeneous vector syntax</a>.
6181 </p>
6182 <p>The procedures available for homogeneous vectors, listed below, are
6183 the analog of the normal vector/string procedures for each of the
6184 homogeneous vector types.
6185 </p>
6186 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6187 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6188 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector">s8vector</a></b></code><i> <var>exact-int8</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6189 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6190 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6191 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6192 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-%3Elist">s8vector-&gt;list</a></b></code><i> <var>s8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6193 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es8vector">list-&gt;s8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6194 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6195 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6196 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6197 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6198 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s8vector-append">s8vector-append</a></b></code><i> <var>s8vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6199 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6200 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6201 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6204 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6205 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6206 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector">u8vector</a></b></code><i> <var>exact-int8</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6207 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6208 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6209 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6210 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-%3Elist">u8vector-&gt;list</a></b></code><i> <var>u8vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6211 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu8vector">list-&gt;u8vector</a></b></code><i> <var>list-of-exact-int8</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6212 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6213 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6214 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6215 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6216 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-append">u8vector-append</a></b></code><i> <var>u8vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6217 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6218 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6219 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6222 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6223 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6224 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector">s16vector</a></b></code><i> <var>exact-int16</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6225 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6226 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6227 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6228 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-%3Elist">s16vector-&gt;list</a></b></code><i> <var>s16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6229 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es16vector">list-&gt;s16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6230 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6231 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6232 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6233 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6234 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s16vector-append">s16vector-append</a></b></code><i> <var>s16vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6235 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6236 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6237 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6240 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6241 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6242 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector">u16vector</a></b></code><i> <var>exact-int16</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6243 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6244 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6245 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6246 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-%3Elist">u16vector-&gt;list</a></b></code><i> <var>u16vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6247 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu16vector">list-&gt;u16vector</a></b></code><i> <var>list-of-exact-int16</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6248 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6249 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6250 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6251 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6252 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u16vector-append">u16vector-append</a></b></code><i> <var>u16vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6253 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6254 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6255 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6258 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6259 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6260 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector">s32vector</a></b></code><i> <var>exact-int32</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6261 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6262 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6263 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6264 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-%3Elist">s32vector-&gt;list</a></b></code><i> <var>s32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6265 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es32vector">list-&gt;s32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6266 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6267 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6268 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6269 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6270 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s32vector-append">s32vector-append</a></b></code><i> <var>s32vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6271 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6272 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6273 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6276 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6277 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6278 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector">u32vector</a></b></code><i> <var>exact-int32</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6279 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6280 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6281 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6282 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-%3Elist">u32vector-&gt;list</a></b></code><i> <var>u32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6283 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu32vector">list-&gt;u32vector</a></b></code><i> <var>list-of-exact-int32</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6284 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6285 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6286 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6287 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6288 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u32vector-append">u32vector-append</a></b></code><i> <var>u32vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6289 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6290 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6291 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6294 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6295 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6296 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector">s64vector</a></b></code><i> <var>exact-int64</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6297 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6298 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6299 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6300 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-%3Elist">s64vector-&gt;list</a></b></code><i> <var>s64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6301 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Es64vector">list-&gt;s64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6302 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6303 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6304 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6305 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6306 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_s64vector-append">s64vector-append</a></b></code><i> <var>s64vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6307 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6308 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6309 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6312 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6313 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6314 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector">u64vector</a></b></code><i> <var>exact-int64</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6315 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6316 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6317 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6318 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-%3Elist">u64vector-&gt;list</a></b></code><i> <var>u64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6319 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Eu64vector">list-&gt;u64vector</a></b></code><i> <var>list-of-exact-int64</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6320 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6321 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6322 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6323 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6324 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u64vector-append">u64vector-append</a></b></code><i> <var>u64vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6325 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6326 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6327 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6330 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6331 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6332 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector">f32vector</a></b></code><i> <var>inexact-real</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6333 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6334 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6335 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6336 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-%3Elist">f32vector-&gt;list</a></b></code><i> <var>f32vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6337 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Ef32vector">list-&gt;f32vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6338 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6339 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6340 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6341 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6342 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f32vector-append">f32vector-append</a></b></code><i> <var>f32vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6343 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6344 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6345 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6348 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6349 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6350 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector">f64vector</a></b></code><i> <var>inexact-real</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6351 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6352 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6353 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6354 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-%3Elist">f64vector-&gt;list</a></b></code><i> <var>f64vector</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6355 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Ef64vector">list-&gt;f64vector</a></b></code><i> <var>list-of-inexact-real</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6356 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6357 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6358 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6359 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6360 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_f64vector-append">f64vector-append</a></b></code><i> <var>f64vector</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
6361 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6362 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6363 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6366 <p>For example:
6367 </p>
6368 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v (u8vector 10 255 13))</b>
6369 &gt; <b>(u8vector-set! v 2 99)</b>
6370 &gt; <b>v</b>
6371 #u8(10 255 99)
6372 &gt; <b>(u8vector-ref v 1)</b>
6374 &gt; <b>(u8vector-&gt;list v)</b>
6375 (10 255 99)
6376 &gt; <b>(u8vector-shrink! v 2)</b>
6377 &gt; <b>(v)</b>
6378 #u8(10 255)
6379 </pre></td></tr></table>
6381 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Eu8vector">object-&gt;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>
6382 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_u8vector-%3Eobject">u8vector-&gt;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>
6383 <a name="index-serialization"></a>
6384 <a name="index-deserialization"></a>
6386 <p>The procedure <code>object-&gt;u8vector</code> returns a u8vector that contains
6387 the sequence of bytes that encodes the object <var>obj</var>. The
6388 procedure <code>u8vector-&gt;object</code> decodes the sequence of bytes
6389 contained in the u8vector <var>u8vector</var>, which was produced by the
6390 procedure <code>object-&gt;u8vector</code>, and reconstructs an object
6391 structurally equal to the original object. In other words the
6392 procedures <code>object-&gt;u8vector</code> and <code>u8vector-&gt;object</code>
6393 respectively perform serialization and deserialization of Scheme
6394 objects. Note that some objects are non-serializable (e.g. threads,
6395 wills, some types of ports, and any object containing a
6396 non-serializable object).
6397 </p>
6398 <p>The optional <var>encoder</var> and <var>decoder</var> parameters are single
6399 parameter procedures which default to the identity function. The
6400 <var>encoder</var> procedure is called during serialization. As the
6401 serializer walks through <var>obj</var>, it calls the <var>encoder</var>
6402 procedure on each sub-object <var>X</var> that is encountered. The
6403 <var>encoder</var> transforms the object <var>X</var> into an object <var>Y</var>
6404 that will be serialized instead of <var>X</var>. Similarly the
6405 <var>decoder</var> procedure is called during deserialization. When an
6406 object <var>Y</var> is encountered, the <var>decoder</var> procedure is called
6407 to transform it into the object <var>X</var> that is the result of
6408 deserialization.
6409 </p>
6410 <p>The <var>encoder</var> and <var>decoder</var> procedures are useful to customize
6411 the serialized representation of objects. In particular, it can be
6412 used to define the semantics of serializing objects, such as threads
6413 and ports, that would otherwise not be serializable. The
6414 <var>decoder</var> procedure is typically the inverse of the <var>encoder</var>
6415 procedure, i.e. <code>(<var>decoder</var> (<var>encoder</var> <var>X</var>))</code> =
6416 <code><var>X</var></code>.
6417 </p>
6418 <p>For example:
6419 </p>
6420 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (make-adder x) (lambda (y) (+ x y)))</b>
6421 &gt; <b>(define f (make-adder 10))</b>
6422 &gt; <b>(define a (object-&gt;u8vector f))</b>
6423 &gt; <b>(define b (u8vector-&gt;object a))</b>
6424 &gt; <b>(u8vector-length a)</b>
6425 1639
6426 &gt; <b>(f 5)</b>
6428 &gt; <b>(b 5)</b>
6430 &gt; <b>(pp b)</b>
6431 (lambda (y) (+ x y))
6432 </pre></td></tr></table>
6436 <hr size="1">
6437 <a name="Hashing-and-weak-references"></a>
6438 <table cellpadding="1" cellspacing="1" border="0">
6439 <tr><td valign="middle" align="left"><a href="#Homogeneous-vectors" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 10. Homogeneous vectors" align="middle" width="32"></a></td>
6440 <td valign="middle" align="left"><a href="#Hashing" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 11.1 Hashing" align="middle" width="32"></a></td>
6441 <td valign="middle" align="left"> &nbsp; </td>
6442 <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" alt="FastBack: 10. Homogeneous vectors" align="middle" width="32"></a></td>
6443 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
6444 <td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 12. Records" align="middle" width="32"></a></td>
6445 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6446 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6447 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6448 </tr></table>
6449 <a name="Hashing-and-weak-references-1"></a>
6450 <h1 class="chapter">11. Hashing and weak references</h1>
6451 <a name="index-hashing"></a>
6452 <a name="index-weak-references"></a>
6453 <a name="index-tables"></a>
6455 <table class="menu" border="0" cellspacing="0">
6456 <tr><td align="left" valign="top"><a href="#Hashing">11.1 Hashing</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
6457 <tr><td align="left" valign="top"><a href="#Weak-references">11.2 Weak references</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
6458 </table>
6460 <hr size="1">
6461 <a name="Hashing"></a>
6462 <table cellpadding="1" cellspacing="1" border="0">
6463 <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" alt="Back: 11. Hashing and weak references" align="middle" width="32"></a></td>
6464 <td valign="middle" align="left"><a href="#Weak-references" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 11.2 Weak references" align="middle" width="32"></a></td>
6465 <td valign="middle" align="left"> &nbsp; </td>
6466 <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" alt="FastBack: 11. Hashing and weak references" align="middle" width="32"></a></td>
6467 <td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Up section"><img src="button-up.png" border="0" alt="Up: 11. Hashing and weak references" align="middle" width="32"></a></td>
6468 <td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 12. Records" align="middle" width="32"></a></td>
6469 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6470 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6471 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6472 </tr></table>
6473 <a name="Hashing-1"></a>
6474 <h2 class="section">11.1 Hashing</h2>
6476 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Eserial-number">object-&gt;serial-number</a></b></code><i> <var>obj</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
6477 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_serial-number-%3Eobject">serial-number-&gt;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>
6479 <p>All Scheme objects are uniquely identified with a serial number which
6480 is a nonnegative exact integer. The <code>object-&gt;serial-number</code> procedure
6481 returns the serial number of object <var>obj</var>. This serial number is
6482 only allocated the first time the <code>object-&gt;serial-number</code>
6483 procedure is called on that object. Objects which do not have an
6484 external textual representation that can be read by the <code>read</code>
6485 procedure, use an external textual representation that includes a
6486 serial number of the form <code>#<var>n</var></code>. Consequently, the
6487 procedures <code>write</code>, <code>pretty-print</code>, etc will call the
6488 <code>object-&gt;serial-number</code> procedure to get the serial number, and
6489 this may cause the serial number to be allocated.
6490 </p>
6491 <p>The <code>serial-number-&gt;object</code> procedure takes an exact integer
6492 parameter <var>n</var> and returns the object whose serial number is
6493 <var>n</var>. If no object currently exists with that serial number,
6494 <var>default</var> is returned if it is specified, otherwise an
6495 unbound-serial-number-exception object is raised. The reader defines
6496 the following abbreviation for calling <code>serial-number-&gt;object</code>:
6497 the syntax <code>#<var>n</var></code>, where <var>n</var> is a sequence of decimal
6498 digits and it is not followed by <samp><code>=</code></samp> or <samp><code>#</code></samp>,
6499 is equivalent to the list <code>(serial-number-&gt;object <var>n</var>)</code>.
6500 </p>
6501 <p>For example:
6502 </p>
6503 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define z (list (lambda (x) (* x x)) (lambda (y) (/ 1 y))))</b>
6504 &gt; <b>z</b>
6505 (#&lt;procedure #2&gt; #&lt;procedure #3&gt;)
6506 &gt; <b>(#3 10)</b>
6507 1/10
6508 &gt; <b>'(#3 10)</b>
6509 ((serial-number-&gt;object 3) 10)
6510 &gt; <b>car</b>
6511 #&lt;procedure #4 car&gt;
6512 &gt; <b>(#4 z)</b>
6513 #&lt;procedure #2&gt;
6514 </pre></td></tr></table>
6518 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6519 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6520 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6522 <p>Unbound-serial-number-exception objects are raised by the procedure
6523 <code>serial-number-&gt;object</code> when no object currently exists with that
6524 serial number. The parameter <var>exc</var> must be an
6525 unbound-serial-number-exception object.
6526 </p>
6527 <p>The procedure <code>unbound-serial-number-exception?</code> returns
6528 <code>#t</code> when <var>obj</var> is a unbound-serial-number-exception
6529 object and <code>#f</code> otherwise.
6530 </p>
6531 <p>The procedure <code>unbound-serial-number-exception-procedure</code>
6532 returns the procedure that raised <var>exc</var>.
6533 </p>
6534 <p>The procedure <code>unbound-serial-number-exception-arguments</code>
6535 returns the list of arguments of the procedure that raised <var>exc</var>.
6536 </p>
6537 <p>For example:
6538 </p>
6539 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
6540 (if (unbound-serial-number-exception? exc)
6541 (list (unbound-serial-number-exception-procedure exc)
6542 (unbound-serial-number-exception-arguments exc))
6543 'not-unbound-serial-number-exception))</b>
6544 &gt; <b>(with-exception-catcher
6545 handler
6546 (lambda () (serial-number-&gt;object 1000)))</b>
6547 (#&lt;procedure #2 serial-number-&gt;object&gt; (1000))
6548 </pre></td></tr></table>
6552 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6554 <p>The <code>symbol-hash</code> procedure returns the hash number of the symbol
6555 <var>symbol</var>. The hash number is a small exact integer (fixnum).
6556 When <var>symbol</var> is an interned symbol the value returned is the same
6557 as <code>(string=?-hash (symbol-&gt;string <var>symbol</var>))</code>.
6558 </p>
6559 <p>For example:
6560 </p>
6561 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(symbol-hash 'car)</b>
6562 444471047
6563 </pre></td></tr></table>
6567 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6569 <p>The <code>keyword-hash</code> procedure returns the hash number of the
6570 keyword <var>keyword</var>. The hash number is a small exact integer
6571 (fixnum). When <var>keyword</var> is an interned keyword the value
6572 returned is the same as <code>(string=?-hash (keyword-&gt;string
6573 <var>keyword</var>))</code>.
6574 </p>
6575 <p>For example:
6576 </p>
6577 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(keyword-hash car:)</b>
6578 444471047
6579 </pre></td></tr></table>
6583 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6585 <p>The <code>string=?-hash</code> procedure returns the hash number of the
6586 string <var>string</var>. The hash number is a small exact integer
6587 (fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string=?
6588 <var>s1</var> <var>s2</var>)</code> implies <code>(= (string=?-hash <var>s1</var>)
6589 (string=?-hash <var>s2</var>))</code>.
6590 </p>
6591 <p>For example:
6592 </p>
6593 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(string=?-hash &quot;car&quot;)</b>
6594 444471047
6595 </pre></td></tr></table>
6599 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6601 <p>The <code>string-ci=?-hash</code> procedure returns the hash number of the
6602 string <var>string</var>. The hash number is a small exact integer
6603 (fixnum). For any two strings <var>s1</var> and <var>s2</var>, <code>(string-ci=?
6604 <var>s1</var> <var>s2</var>)</code> implies <code>(= (string-ci=?-hash <var>s1</var>)
6605 (string-ci=?-hash <var>s2</var>))</code>.
6606 </p>
6607 <p>For example:
6608 </p>
6609 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(string-ci=?-hash &quot;CaR&quot;)</b>
6610 444471047
6611 </pre></td></tr></table>
6615 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6617 <p>The <code>eq?-hash</code> procedure returns the hash number of the object
6618 <var>obj</var>. The hash number is a small exact integer (fixnum). For
6619 any two objects <var>o1</var> and <var>o2</var>, <code>(eq? <var>o1</var> <var>o2</var>)</code>
6620 implies <code>(= (eq?-hash <var>o1</var>) (eq?-hash <var>o2</var>))</code>.
6621 </p>
6622 <p>For example:
6623 </p>
6624 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(eq?-hash #t)</b>
6625 536870910
6626 </pre></td></tr></table>
6630 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6632 <p>The <code>eqv?-hash</code> procedure returns the hash number of the object
6633 <var>obj</var>. The hash number is a small exact integer (fixnum). For
6634 any two objects <var>o1</var> and <var>o2</var>, <code>(eqv? <var>o1</var> <var>o2</var>)</code>
6635 implies <code>(= (eqv?-hash <var>o1</var>) (eqv?-hash <var>o2</var>))</code>.
6636 </p>
6637 <p>For example:
6638 </p>
6639 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(eqv?-hash 1.5)</b>
6640 496387656
6641 </pre></td></tr></table>
6645 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6647 <p>The <code>equal?-hash</code> procedure returns the hash number of the object
6648 <var>obj</var>. The hash number is a small exact integer (fixnum). For
6649 any two objects <var>o1</var> and <var>o2</var>, <code>(equal? <var>o1</var> <var>o2</var>)</code>
6650 implies <code>(= (equal?-hash <var>o1</var>) (equal?-hash <var>o2</var>))</code>.
6651 </p>
6652 <p>For example:
6653 </p>
6654 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(equal?-hash (list 1 2 3))</b>
6655 442438567
6656 </pre></td></tr></table>
6660 <hr size="1">
6661 <a name="Weak-references"></a>
6662 <table cellpadding="1" cellspacing="1" border="0">
6663 <tr><td valign="middle" align="left"><a href="#Hashing" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 11.1 Hashing" align="middle" width="32"></a></td>
6664 <td valign="middle" align="left"><a href="#Wills" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 11.2.1 Wills" align="middle" width="32"></a></td>
6665 <td valign="middle" align="left"> &nbsp; </td>
6666 <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" alt="FastBack: 11. Hashing and weak references" align="middle" width="32"></a></td>
6667 <td valign="middle" align="left"><a href="#Hashing-and-weak-references" title="Up section"><img src="button-up.png" border="0" alt="Up: 11. Hashing and weak references" align="middle" width="32"></a></td>
6668 <td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 12. Records" align="middle" width="32"></a></td>
6669 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6670 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6671 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6672 </tr></table>
6673 <a name="Weak-references-1"></a>
6674 <h2 class="section">11.2 Weak references</h2>
6676 <p>The garbage collector is responsible for reclaiming objects that are
6677 no longer needed by the program. This is done by analyzing the
6678 reachability graph of all objects from the roots (i.e. the global
6679 variables, the runnable threads, permanently allocated objects such as
6680 procedures defined in a compiled file, nonexecutable wills, etc). If
6681 a root or a reachable object <var>X</var> contains a reference to an object
6682 <var>Y</var> then <var>Y</var> is reachable. As a general rule, unreachable
6683 objects are reclaimed by the garbage collector.
6684 </p>
6685 <p>There are two types of references: strong references and weak
6686 references. Most objects, including pairs, vectors, records and
6687 closures, contain strong references. An object <var>X</var> is
6688 <em>strongly reachable</em> if there is a path from the roots to <var>X</var>
6689 that traverses only strong references. Weak references only occur in
6690 wills and tables. There are two types of weak references: will-weak
6691 references and table-weak references. If all paths from the roots to
6692 an object <var>Y</var> traverse at least one table-weak reference, then
6693 <var>Y</var> will be reclaimed by the garbage collector. The will-weak
6694 references are used for finalization and are explained in the next
6695 section.
6696 </p>
6697 <table class="menu" border="0" cellspacing="0">
6698 <tr><td align="left" valign="top"><a href="#Wills">11.2.1 Wills</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
6699 <tr><td align="left" valign="top"><a href="#Tables">11.2.2 Tables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
6700 </table>
6702 <hr size="1">
6703 <a name="Wills"></a>
6704 <table cellpadding="1" cellspacing="1" border="0">
6705 <tr><td valign="middle" align="left"><a href="#Weak-references" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 11.2 Weak references" align="middle" width="32"></a></td>
6706 <td valign="middle" align="left"><a href="#Tables" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 11.2.2 Tables" align="middle" width="32"></a></td>
6707 <td valign="middle" align="left"> &nbsp; </td>
6708 <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" alt="FastBack: 11. Hashing and weak references" align="middle" width="32"></a></td>
6709 <td valign="middle" align="left"><a href="#Weak-references" title="Up section"><img src="button-up.png" border="0" alt="Up: 11.2 Weak references" align="middle" width="32"></a></td>
6710 <td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 12. Records" align="middle" width="32"></a></td>
6711 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6712 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6713 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6714 </tr></table>
6715 <a name="Wills-1"></a>
6716 <h3 class="subsection">11.2.1 Wills</h3>
6718 <p>The following procedures implement the <em>will</em> data type. Will
6719 objects provide support for finalization. A will is an object that
6720 contains a will-weak reference to a <var>testator</var> object (the object
6721 attached to the will), and a strong reference to an <var>action</var>
6722 procedure which is a one parameter procedure which is called when the
6723 will is executed.
6724 </p>
6725 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6726 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6727 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6728 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6730 <p>The <code>make-will</code> procedure creates a will object with the given
6731 <var>testator</var> object and <var>action</var> procedure. The <code>will?</code>
6732 procedure tests if <var>obj</var> is a will object. The
6733 <code>will-testator</code> procedure gets the testator object attached to
6734 the <var>will</var>. The <code>will-execute!</code> procedure executes
6735 <var>will</var>.
6736 </p>
6737 <p>A will becomes <em>executable</em> when its <var>testator</var> object is not
6738 strongly reachable (i.e. the <var>testator</var> object is either
6739 unreachable or only reachable using paths from the roots that traverse
6740 at least one weak reference). Some objects, including symbols, small
6741 exact integers (fixnums), booleans and characters, are considered to
6742 be always strongly reachable.
6743 </p>
6744 <p>When the runtime system detects that a will has become executable the
6745 current computation is interrupted, the will&rsquo;s testator is set to
6746 <code>#f</code> and the will&rsquo;s action procedure is called with the will&rsquo;s
6747 testator as the sole argument. Currently only the garbage collector
6748 detects when wills become executable but this may change in future
6749 versions of Gambit (for example the compiler could perform an analysis
6750 to infer will executability at compile time). The garbage collector
6751 builds a list of all executable wills. Shortly after a garbage
6752 collection, the action procedures of these wills will be called. The
6753 link from the will to the action procedure is severed when the action
6754 procedure is called.
6755 </p>
6756 <p>Note that the testator object will not be reclaimed during the garbage
6757 collection that determined executability of the will. It is only when
6758 an object is not reachable from the roots that it is reclaimed by the
6759 garbage collector.
6760 </p>
6761 <p>A remarkable feature of wills is that an action procedure can
6762 &ldquo;resurrect&rdquo; an object. An action procedure could for example assign
6763 the testator object to a global variable or create a new will with the
6764 same testator object.
6765 </p>
6766 <p>For example:
6767 </p>
6768 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define a (list 123))</b>
6769 &gt; <b>(set-cdr! a a) <span class="roman"><i>; create a circular list</i></span></b>
6770 &gt; <b>(define b (vector a))</b>
6771 &gt; <b>(define c #f)</b>
6772 &gt; <b>(define w
6773 (let ((obj a))
6774 (make-will obj
6775 (lambda (x) ; x will be eq? to obj
6776 (display &quot;executing action procedure&quot;)
6777 (newline)
6778 (set! c x)))))</b>
6779 &gt; <b>(will? w)</b>
6781 &gt; <b>(car (will-testator w))</b>
6783 &gt; <b>(##gc)</b>
6784 &gt; <b>(set! a #f)</b>
6785 &gt; <b>(##gc)</b>
6786 &gt; <b>(set! b #f)</b>
6787 &gt; <b>(##gc)</b>
6788 executing action procedure
6789 &gt; <b>(will-testator w)</b>
6791 &gt; <b>(car c)</b>
6793 </pre></td></tr></table>
6797 <hr size="1">
6798 <a name="Tables"></a>
6799 <table cellpadding="1" cellspacing="1" border="0">
6800 <tr><td valign="middle" align="left"><a href="#Wills" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 11.2.1 Wills" align="middle" width="32"></a></td>
6801 <td valign="middle" align="left"><a href="#Records" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 12. Records" align="middle" width="32"></a></td>
6802 <td valign="middle" align="left"> &nbsp; </td>
6803 <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" alt="FastBack: 11. Hashing and weak references" align="middle" width="32"></a></td>
6804 <td valign="middle" align="left"><a href="#Weak-references" title="Up section"><img src="button-up.png" border="0" alt="Up: 11.2 Weak references" align="middle" width="32"></a></td>
6805 <td valign="middle" align="left"><a href="#Records" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 12. Records" align="middle" width="32"></a></td>
6806 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
6807 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
6808 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
6809 </tr></table>
6810 <a name="Tables-1"></a>
6811 <h3 class="subsection">11.2.2 Tables</h3>
6813 <p>The following procedures implement the <em>table</em> data type. Tables
6814 are heterogenous structures whose elements are indexed by keys which
6815 are arbitrary objects. Tables are similar to association lists but
6816 are abstract and the access time for large tables is typically smaller.
6817 Each key contained in the table is bound to a value. The length of
6818 the table is the number of key/value bindings it contains. New
6819 key/value bindings can be added to a table, the value bound to a key
6820 can be changed, and existing key/value bindings can be removed.
6821 </p>
6822 <p>The references to the keys can either be all strong or all table-weak
6823 and the references to the values can either be all strong or all
6824 table-weak. The garbage collector removes key/value bindings from a
6825 table when 1) the key is a table-weak reference and the key is
6826 unreachable or only reachable using paths from the roots that traverse
6827 at least one table-weak reference, or 2) the value is a table-weak
6828 reference and the value is unreachable or only reachable using paths
6829 from the roots that traverse at least one table-weak reference.
6830 Key/value bindings that are removed by the garbage collector are
6831 reclaimed immediately.
6832 </p>
6833 <p>Although there are several possible ways of implementing tables, the
6834 current implementation uses hashing with open-addressing. This is
6835 space efficient and provides constant-time access. Hash tables are
6836 automatically resized to maintain the load within specified bounds.
6837 The load is the number of active entries (the length of the table)
6838 divided by the total number of entries in the hash table.
6839 </p>
6840 <p>Tables are parameterized with a key comparison procedure. By default
6841 the <code>equal?</code> procedure is used, but <code>eq?</code>, <code>eqv?</code>,
6842 <code>string=?</code>, <code>string-ci=?</code>, or a user defined procedure can
6843 also be used. To support arbitrary key comparison procedures, tables
6844 are also parameterized with a hashing procedure accepting a key as its
6845 single parameter and returning a fixnum result. The hashing procedure
6846 <var>hash</var> must be consistent with the key comparison procedure
6847 <var>test</var>, that is, for any two keys <var>k1</var> and <var>k2</var> in the
6848 table, <code>(<var>test</var> <var>k1</var> <var>k2</var>)</code> implies <code>(=
6849 (<var>hash</var> <var>k1</var>) (<var>hash</var> <var>k2</var>))</code>. A default hashing
6850 procedure consistent with the key comparison procedure is provided by
6851 the system. The default hashing procedure generally gives good
6852 performance when the key comparison procedure is <code>eq?</code>,
6853 <code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, and <code>string-ci=?</code>.
6854 However, for user defined key comparison procedures, the default
6855 hashing procedure always returns 0. This degrades the performance of
6856 the table to a linear search.
6857 </p>
6858 <p>Tables can be compared for equality using the <code>equal?</code> procedure.
6859 Two tables <code><var>X</var></code> and <code><var>Y</var></code> are considered equal by
6860 <code>equal?</code> when they have the same weakness attributes, the same
6861 key comparison procedure, the same hashing procedure, the same length,
6862 and for all the keys <code><var>k</var></code> in <code><var>X</var></code>, <code>(equal?
6863 (table-ref <var>X</var> <var>k</var>) (table-ref <var>Y</var> <var>k</var>))</code>.
6864 </p>
6865 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6867 <p>The procedure <code>make-table</code> returns a new table. The optional keyword
6868 parameters specify various parameters of the table.
6869 </p>
6870 <p>The <var>size</var> parameter is a nonnegative exact integer indicating
6871 the expected length of the table. The system uses <var>size</var> to
6872 choose an appropriate initial size of the hash table so that it does not
6873 need to be resized too often.
6874 </p>
6875 <p>The <var>init</var> parameter indicates a value that is associated to keys
6876 that are not in the table. When <var>init</var> is not specified, no value
6877 is associated to keys that are not in the table.
6878 </p>
6879 <p>The <var>weak-keys</var> and <var>weak-values</var> parameters are extended
6880 booleans indicating respectively whether the keys and values are
6881 table-weak references (true) or strong references (false). By default
6882 the keys and values are strong references.
6883 </p>
6884 <p>The <var>test</var> parameter indicates the key comparison procedure. The
6885 default key comparison procedure is <code>equal?</code>. The key comparison
6886 procedures <code>eq?</code>, <code>eqv?</code>, <code>equal?</code>, <code>string=?</code>,
6887 and <code>string-ci=?</code> are special because the system will use a
6888 reasonably good hash procedure when none is specified.
6889 </p>
6890 <p>The <var>hash</var> parameter indicates the hash procedure. This procedure
6891 must accept a single key parameter, return a fixnum, and be consistent
6892 with the key comparison procedure. When <var>hash</var> is not specified, a
6893 default hash procedure is used. The default hash procedure is
6894 reasonably good when the key comparison procedure is <code>eq?</code>,
6895 <code>eqv?</code>, <code>equal?</code>, <code>string=?</code>, or <code>string-ci=?</code>.
6896 </p>
6897 <p>The <var>min-load</var> and <var>max-load</var> parameters are real numbers that
6898 indicate the minimum and maximum load of the table respectively. The
6899 table is resized when adding or deleting a key/value binding would
6900 bring the table&rsquo;s load outside of this range. The <var>min-load</var>
6901 parameter must be no less than 0.05 and the <var>max-load</var> parameter
6902 must be no greater than 0.95. Moreover the difference between
6903 <var>min-load</var> and <var>max-load</var> must be at least 0.20. When
6904 <var>min-load</var> is not specified, the value 0.45 is used. When
6905 <var>max-load</var> is not specified, the value 0.90 is used.
6906 </p>
6907 <p>For example:
6908 </p>
6909 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (make-table))</b>
6910 &gt; <b>(table? t)</b>
6912 &gt; <b>(table-length t)</b>
6914 &gt; <b>(table-set! t (list 1 2) 3)</b>
6915 &gt; <b>(table-set! t (list 4 5) 6)</b>
6916 &gt; <b>(table-ref t (list 1 2))</b>
6918 &gt; <b>(table-length t)</b>
6920 </pre></td></tr></table>
6924 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6926 <p>The procedure <code>table?</code> returns <code>#t</code> when <var>obj</var> is a
6927 table and <code>#f</code> otherwise.
6928 </p>
6929 <p>For example:
6930 </p>
6931 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(table? (make-table))</b>
6933 &gt; <b>(table? 123)</b>
6935 </pre></td></tr></table>
6939 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6941 <p>The procedure <code>table-length</code> returns the number of key/value
6942 bindings contained in the table <var>table</var>.
6943 </p>
6944 <p>For example:
6945 </p>
6946 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (make-table weak-keys: #t))</b>
6947 &gt; <b>(define x (list 1 2))</b>
6948 &gt; <b>(define y (list 3 4))</b>
6949 &gt; <b>(table-set! t x 111)</b>
6950 &gt; <b>(table-set! t y 222)</b>
6951 &gt; <b>(table-length t)</b>
6953 &gt; <b>(table-set! t x)</b>
6954 &gt; <b>(table-length t)</b>
6956 &gt; <b>(##gc)</b>
6957 &gt; <b>(table-length t)</b>
6959 &gt; <b>(set! y #f)</b>
6960 &gt; <b>(##gc)</b>
6961 &gt; <b>(table-length t)</b>
6963 </pre></td></tr></table>
6967 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6969 <p>The procedure <code>table-ref</code> returns the value bound to the object
6970 <var>key</var> in the table <var>table</var>. When <var>key</var> is not bound and
6971 <var>default</var> is specified, <var>default</var> is returned. When
6972 <var>default</var> is not specified but an <var>init</var> parameter was
6973 specified when <var>table</var> was created, <var>init</var> is returned.
6974 Otherwise an unbound-table-key-exception object is raised.
6975 </p>
6976 <p>For example:
6977 </p>
6978 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t1 (make-table init: 999))</b>
6979 &gt; <b>(table-set! t1 (list 1 2) 3)</b>
6980 &gt; <b>(table-ref t1 (list 1 2))</b>
6982 &gt; <b>(table-ref t1 (list 4 5))</b>
6984 &gt; <b>(table-ref t1 (list 4 5) #f)</b>
6986 &gt; <b>(define t2 (make-table))</b>
6987 &gt; <b>(table-ref t2 (list 4 5))</b>
6988 *** ERROR IN (console)@7.1 -- Unbound table key
6989 (table-ref '#&lt;table #2&gt; '(4 5))
6990 </pre></td></tr></table>
6994 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
6996 <p>The procedure <code>table-set!</code> binds the object <var>key</var> to
6997 <var>value</var> in the table <var>table</var>. When <var>value</var> is not
6998 specified, if <var>table</var> contains a binding for <var>key</var> then the
6999 binding is removed from <var>table</var>. The procedure <code>table-set!</code>
7000 returns an unspecified value.
7001 </p>
7002 <p>For example:
7003 </p>
7004 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (make-table))</b>
7005 &gt; <b>(table-set! t (list 1 2) 3)</b>
7006 &gt; <b>(table-set! t (list 4 5) 6)</b>
7007 &gt; <b>(table-set! t (list 4 5))</b>
7008 &gt; <b>(table-set! t (list 7 8))</b>
7009 &gt; <b>(table-ref t (list 1 2))</b>
7011 &gt; <b>(table-ref t (list 4 5))</b>
7012 *** ERROR IN (console)@7.1 -- Unbound table key
7013 (table-ref '#&lt;table #2&gt; '(4 5))
7014 </pre></td></tr></table>
7018 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7020 <p>The procedure <code>table-search</code> searches the table <var>table</var> for a
7021 key/value binding for which the two parameter procedure <var>proc</var>
7022 returns a non false result. For each key/value binding visited by
7023 <code>table-search</code> the procedure <var>proc</var> is called with the key as
7024 the first parameter and the value as the second parameter. The
7025 procedure <code>table-search</code> returns the first non false value
7026 returned by <var>proc</var>, or <code>#f</code> if <var>proc</var> returned <code>#f</code>
7027 for all key/value bindings in <var>table</var>.
7028 </p>
7029 <p>The order in which the key/value bindings are visited is unspecified
7030 and may vary from one call of <code>table-search</code> to the next. While
7031 a call to <code>table-search</code> is being performed on <var>table</var>, it is
7032 an error to call any of the following procedures on <var>table</var>:
7033 <code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>,
7034 <code>table-for-each</code>, <code>table-copy</code>, <code>table-merge</code>,
7035 <code>table-merge!</code>, and <code>table-&gt;list</code>. It is also an error to
7036 compare with <code>equal?</code> (directly or indirectly with <code>member</code>,
7037 <code>assoc</code>, <code>table-ref</code>, etc.) an object that contains
7038 <var>table</var>. All these procedures may cause <var>table</var> to be
7039 reordered and resized. This restriction allows a more efficient
7040 iteration over the key/value bindings.
7041 </p>
7042 <p>For example:
7043 </p>
7044 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define square (make-table))</b>
7045 &gt; <b>(table-set! square 2 4)</b>
7046 &gt; <b>(table-set! square 3 9)</b>
7047 &gt; <b>(table-search (lambda (k v) (and (odd? k) v)) square)</b>
7049 </pre></td></tr></table>
7053 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7055 <p>The procedure <code>table-for-each</code> calls the two parameter procedure
7056 <var>proc</var> for each key/value binding in the table <var>table</var>. The
7057 procedure <var>proc</var> is called with the key as the first parameter and
7058 the value as the second parameter. The procedure <code>table-for-each</code>
7059 returns an unspecified value.
7060 </p>
7061 <p>The order in which the key/value bindings are visited is unspecified
7062 and may vary from one call of <code>table-for-each</code> to the next.
7063 While a call to <code>table-for-each</code> is being performed on
7064 <var>table</var>, it is an error to call any of the following procedures on
7065 <var>table</var>: <code>table-ref</code>, <code>table-set!</code>, <code>table-search</code>,
7066 <code>table-for-each</code>, and <code>table-&gt;list</code>. It is also an error to
7067 compare with <code>equal?</code> (directly or indirectly with <code>member</code>,
7068 <code>assoc</code>, <code>table-ref</code>, etc.) an object that contains
7069 <var>table</var>. All these procedures may cause <var>table</var> to be
7070 reordered and resized. This restriction allows a more efficient
7071 iteration over the key/value bindings.
7072 </p>
7073 <p>For example:
7074 </p>
7075 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define square (make-table))</b>
7076 &gt; <b>(table-set! square 2 4)</b>
7077 &gt; <b>(table-set! square 3 9)</b>
7078 &gt; <b>(table-for-each (lambda (k v) (write (list k v)) (newline)) square)</b>
7079 (2 4)
7080 (3 9)
7081 </pre></td></tr></table>
7085 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_table-%3Elist">table-&gt;list</a></b></code><i> <var>table</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
7087 <p>The procedure <code>table-&gt;list</code> returns an association list
7088 containing the key/value bindings in the table <var>table</var>. Each
7089 key/value binding yields a pair whose car field is the key and whose
7090 cdr field is the value bound to that key. The order of the bindings
7091 in the list is unspecified.
7092 </p>
7093 <p>For example:
7094 </p>
7095 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define square (make-table))</b>
7096 &gt; <b>(table-set! square 2 4)</b>
7097 &gt; <b>(table-set! square 3 9)</b>
7098 &gt; <b>(table-&gt;list square)</b>
7099 ((3 . 9) (2 . 4))
7100 </pre></td></tr></table>
7104 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_list-%3Etable">list-&gt;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>
7106 <p>The procedure <code>list-&gt;table</code> returns a new table containing the
7107 key/value bindings in the association list <var>list</var>. The optional
7108 keyword parameters specify various parameters of the table and have
7109 the same meaning as for the <code>make-table</code> procedure.
7110 </p>
7111 <p>Each element of <var>list</var> is a pair whose car field is a key and
7112 whose cdr field is the value bound to that key. If a key appears more
7113 than once in <var>list</var> (tested using the table&rsquo;s key comparison
7114 procedure) it is the first key/value binding in <var>list</var> that has
7115 precedence.
7116 </p>
7117 <p>For example:
7118 </p>
7119 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (list-&gt;table '((b . 2) (a . 1) (c . 3) (a . 4))))</b>
7120 &gt; <b>(table-&gt;list t)</b>
7121 ((a . 1) (b . 2) (c . 3))
7122 </pre></td></tr></table>
7126 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7127 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7128 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7130 <p>Unbound-table-key-exception objects are raised by the procedure
7131 <code>table-ref</code> when the key does not have a binding in the table.
7132 The parameter <var>exc</var> must be an unbound-table-key-exception object.
7133 </p>
7134 <p>The procedure <code>unbound-table-key-exception?</code> returns
7135 <code>#t</code> when <var>obj</var> is a unbound-table-key-exception
7136 object and <code>#f</code> otherwise.
7137 </p>
7138 <p>The procedure <code>unbound-table-key-exception-procedure</code>
7139 returns the procedure that raised <var>exc</var>.
7140 </p>
7141 <p>The procedure <code>unbound-table-key-exception-arguments</code>
7142 returns the list of arguments of the procedure that raised <var>exc</var>.
7143 </p>
7144 <p>For example:
7145 </p>
7146 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (make-table))</b>
7147 &gt; <b>(define (handler exc)
7148 (if (unbound-table-key-exception? exc)
7149 (list (unbound-table-key-exception-procedure exc)
7150 (unbound-table-key-exception-arguments exc))
7151 'not-unbound-table-key-exception))</b>
7152 &gt; <b>(with-exception-catcher
7153 handler
7154 (lambda () (table-ref t '(1 2))))</b>
7155 (#&lt;procedure #2 table-ref&gt; (#&lt;table #3&gt; (1 2)))
7156 </pre></td></tr></table>
7160 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7162 <p>The procedure <code>table-copy</code> returns a new table containing the
7163 same key/value bindings as <var>table</var> and the same table parameters
7164 (i.e. hash procedure, key comparison procedure, key and value
7165 weakness, etc).
7166 </p>
7167 <p>For example:
7168 </p>
7169 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t (list-&gt;table '((b . 2) (a . 1) (c . 3))))</b>
7170 &gt; <b>(define x (table-copy t))</b>
7171 &gt; <b>(table-set! t 'b 99)</b>
7172 &gt; <b>(table-&gt;list t)</b>
7173 ((a . 1) (b . 99) (c . 3))
7174 &gt; <b>(table-&gt;list x)</b>
7175 ((a . 1) (b . 2) (c . 3))
7176 </pre></td></tr></table>
7180 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7182 <p>The procedure <code>table-merge!</code> returns <var>table1</var> after the
7183 key/value bindings contained in <var>table2</var> have been added to it.
7184 When a key exists both in <var>table1</var> and <var>table2</var>, then the
7185 parameter <var>table2-takes-precedence?</var> indicates which binding will
7186 be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is
7187 false, and the one in <var>table2</var> otherwise). If
7188 <var>table2-takes-precedence?</var> is not specified the binding in
7189 <var>table1</var> is kept.
7190 </p>
7191 <p>For example:
7192 </p>
7193 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t1 (list-&gt;table '((a . 1) (b . 2) (c . 3))))</b>
7194 &gt; <b>(define t2 (list-&gt;table '((a . 4) (b . 5) (z . 6))))</b>
7195 &gt; <b>(table-&gt;list (table-merge! t1 t2))</b>
7196 ((a . 1) (b . 2) (c . 3) (z . 6))
7197 &gt; <b>(define t1 (list-&gt;table '((a . 1) (b . 2) (c . 3))))</b>
7198 &gt; <b>(define t2 (list-&gt;table '((a . 4) (b . 5) (z . 6))))</b>
7199 &gt; <b>(table-&gt;list (table-merge! t1 t2 #t))</b>
7200 ((a . 4) (b . 5) (c . 3) (z . 6))
7201 </pre></td></tr></table>
7205 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7207 <p>The procedure <code>table-merge</code> returns a copy of <var>table1</var>
7208 (created with <code>table-copy</code>) to which the key/value bindings
7209 contained in <var>table2</var> have been added using <code>table-merge!</code>.
7210 When a key exists both in <var>table1</var> and <var>table2</var>, then the
7211 parameter <var>table2-takes-precedence?</var> indicates which binding will
7212 be kept (the one in <var>table1</var> if <var>table2-takes-precedence?</var> is
7213 false, and the one in <var>table2</var> otherwise). If
7214 <var>table2-takes-precedence?</var> is not specified the binding in
7215 <var>table1</var> is kept.
7216 </p>
7217 <p>For example:
7218 </p>
7219 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define t1 (list-&gt;table '((a . 1) (b . 2) (c . 3))))</b>
7220 &gt; <b>(define t2 (list-&gt;table '((a . 4) (b . 5) (z . 6))))</b>
7221 &gt; <b>(table-&gt;list (table-merge t1 t2))</b>
7222 ((a . 1) (b . 2) (c . 3) (z . 6))
7223 &gt; <b>(table-&gt;list (table-merge t1 t2 #t))</b>
7224 ((a . 4) (b . 5) (c . 3) (z . 6))
7225 </pre></td></tr></table>
7229 <hr size="1">
7230 <a name="Records"></a>
7231 <table cellpadding="1" cellspacing="1" border="0">
7232 <tr><td valign="middle" align="left"><a href="#Tables" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 11.2.2 Tables" align="middle" width="32"></a></td>
7233 <td valign="middle" align="left"><a href="#Threads" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13. Threads" align="middle" width="32"></a></td>
7234 <td valign="middle" align="left"> &nbsp; </td>
7235 <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" alt="FastBack: 11. Hashing and weak references" align="middle" width="32"></a></td>
7236 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
7237 <td valign="middle" align="left"><a href="#Threads" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 13. Threads" align="middle" width="32"></a></td>
7238 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7239 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7240 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7241 </tr></table>
7242 <a name="Records-1"></a>
7243 <h1 class="chapter">12. Records</h1>
7245 <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="http://dynamo.iro.umontreal.ca/~gambit/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>&hellip;</i><code>)</code></td><td align="right">special form</td></tr></table>
7247 <p>Record data types similar to Pascal records and C <code>struct</code>
7248 types can be defined using the <code>define-structure</code> special form.
7249 The identifier <i>name</i> specifies the name of the new data type. The
7250 structure name is followed by <var>k</var> identifiers naming each field of
7251 the record. The <code>define-structure</code> expands into a set of definitions
7252 of the following procedures:
7253 </p>
7254 <ul>
7255 <li>
7256 &lsquo;<tt>make-</tt><i>name</i>&rsquo; &ndash; A <var>k</var> argument procedure which constructs
7257 a new record from the value of its <var>k</var> fields.
7259 </li><li>
7260 &lsquo;<i>name</i><tt>?</tt>&rsquo; &ndash; A procedure which tests if its single argument
7261 is of the given record type.
7263 </li><li>
7264 &lsquo;<i>name</i><tt>-</tt><i>field</i>&rsquo; &ndash; For each field, a procedure taking
7265 as its single argument a value of the given record type and returning
7266 the content of the corresponding field of the record.
7268 </li><li>
7269 &lsquo;<i>name</i><tt>-</tt><i>field</i><tt>-set!</tt>&rsquo; &ndash; For each field, a two
7270 argument procedure taking as its first argument a value of the given
7271 record type. The second argument gets assigned to the corresponding
7272 field of the record and the void object is returned.
7274 </li></ul>
7276 <p>Record data types have a printed representation that includes the name
7277 of the type and the name and value of each field. Record data types
7278 can not be read by the <code>read</code> procedure.
7279 </p>
7280 <p>For example:
7281 </p>
7282 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define-structure point x y color)</b>
7283 &gt; <b>(define p (make-point 3 5 'red))</b>
7284 &gt; <b>p</b>
7285 #&lt;point #2 x: 3 y: 5 color: red&gt;
7286 &gt; <b>(point-x p)</b>
7288 &gt; <b>(point-color p)</b>
7290 &gt; <b>(point-color-set! p 'black)</b>
7291 &gt; <b>p</b>
7292 #&lt;point #2 x: 3 y: 5 color: black&gt;
7293 </pre></td></tr></table>
7297 <hr size="1">
7298 <a name="Threads"></a>
7299 <table cellpadding="1" cellspacing="1" border="0">
7300 <tr><td valign="middle" align="left"><a href="#Records" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 12. Records" align="middle" width="32"></a></td>
7301 <td valign="middle" align="left"><a href="#Introduction" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.1 Introduction" align="middle" width="32"></a></td>
7302 <td valign="middle" align="left"> &nbsp; </td>
7303 <td valign="middle" align="left"><a href="#Records" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 12. Records" align="middle" width="32"></a></td>
7304 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
7305 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7306 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7307 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7308 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7309 </tr></table>
7310 <a name="Threads-1"></a>
7311 <h1 class="chapter">13. Threads</h1>
7312 <a name="index-threads"></a>
7314 <p>Gambit supports the execution of multiple Scheme threads. These
7315 threads are managed entirely by Gambit&rsquo;s runtime and are not related
7316 to the host operating system&rsquo;s threads. Gambit&rsquo;s runtime does not
7317 currently take advantage of multiprocessors (i.e. at most one thread is
7318 running).
7319 </p>
7320 <table class="menu" border="0" cellspacing="0">
7321 <tr><td align="left" valign="top"><a href="#Introduction">13.1 Introduction</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7322 <tr><td align="left" valign="top"><a href="#Thread-objects">13.2 Thread objects</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7323 <tr><td align="left" valign="top"><a href="#Mutex-objects">13.3 Mutex objects</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7324 <tr><td align="left" valign="top"><a href="#Condition-variable-objects">13.4 Condition variable objects</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7325 <tr><td align="left" valign="top"><a href="#Fairness">13.5 Fairness</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7326 <tr><td align="left" valign="top"><a href="#Memory-coherency">13.6 Memory coherency</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7327 <tr><td align="left" valign="top"><a href="#Timeouts">13.7 Timeouts</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7328 <tr><td align="left" valign="top"><a href="#Primordial-thread">13.8 Primordial thread</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7329 <tr><td align="left" valign="top"><a href="#Procedures">13.9 Procedures</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
7330 </table>
7332 <hr size="1">
7333 <a name="Introduction"></a>
7334 <table cellpadding="1" cellspacing="1" border="0">
7335 <tr><td valign="middle" align="left"><a href="#Threads" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13. Threads" align="middle" width="32"></a></td>
7336 <td valign="middle" align="left"><a href="#Thread-objects" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.2 Thread objects" align="middle" width="32"></a></td>
7337 <td valign="middle" align="left"> &nbsp; </td>
7338 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7339 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7340 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7341 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7342 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7343 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7344 </tr></table>
7345 <a name="Introduction-1"></a>
7346 <h2 class="section">13.1 Introduction</h2>
7348 <p>Multithreading is a paradigm that is well suited for building complex
7349 systems such as: servers, GUIs, and high-level operating systems.
7350 Gambit&rsquo;s thread system offers mechanisms for creating threads of
7351 execution and for synchronizing them. The thread system also supports
7352 features which are useful in a real-time context, such as priorities,
7353 priority inheritance and timeouts.
7354 </p>
7355 <p>The thread system provides the following data types:
7356 </p>
7357 <ul>
7358 <li>
7359 Thread (a virtual processor which shares object space with all other
7360 threads)
7362 </li><li>
7363 Mutex (a mutual exclusion device, also known as a lock and binary
7364 semaphore)
7366 </li><li>
7367 Condition variable (a set of blocked threads)
7369 </li></ul>
7371 <hr size="1">
7372 <a name="Thread-objects"></a>
7373 <table cellpadding="1" cellspacing="1" border="0">
7374 <tr><td valign="middle" align="left"><a href="#Introduction" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.1 Introduction" align="middle" width="32"></a></td>
7375 <td valign="middle" align="left"><a href="#Mutex-objects" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.3 Mutex objects" align="middle" width="32"></a></td>
7376 <td valign="middle" align="left"> &nbsp; </td>
7377 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7378 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7379 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7380 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7381 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7382 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7383 </tr></table>
7384 <a name="Thread-objects-1"></a>
7385 <h2 class="section">13.2 Thread objects</h2>
7387 <p>A <em>running thread</em> is a thread that is currently executing. A
7388 <em>runnable thread</em> is a thread that is ready to execute or running.
7389 A thread is <em>blocked</em> if it is waiting for a mutex to become
7390 unlocked, an I/O operation to become possible, the end of a &ldquo;sleep&rdquo;
7391 period, etc. A <em>new thread</em> is a thread that has been allocated
7392 but has not yet been initialized. An <em>initialized thread</em> is a
7393 thread that can be made runnable. A new thread becomes runnable when
7394 it is started by calling <code>thread-start!</code>. A <em>terminated
7395 thread</em> is a thread that can no longer become runnable (but
7396 <em>deadlocked threads</em> are not considered terminated). The only
7397 valid transitions between the thread states are from new to
7398 initialized, from initialized to runnable, between runnable and
7399 blocked, and from any state except new to terminated as indicated in
7400 the following diagram:
7401 </p>
7402 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> <b>unblock</b>
7403 <b>start</b> &lt;-------
7404 NEW -------&gt; INITIALIZED -------&gt; RUNNABLE -------&gt; BLOCKED
7405 \ | <b>block</b> /
7406 \ v /
7407 +-----&gt; TERMINATED &lt;----+
7408 </pre></td></tr></table>
7410 <p>Each thread has a <em>base priority</em>, which is a real number (where a
7411 higher numerical value means a higher priority), a <em>priority boost</em>,
7412 which is a nonnegative real number representing the priority increase
7413 applied to a thread when it blocks, and a <em>quantum</em>, which is a
7414 nonnegative real number representing a duration in seconds.
7415 </p>
7416 <p>Each thread has a <em>specific field</em> which can be used in an
7417 application specific way to associate data with the thread (some thread
7418 systems call this &ldquo;thread local storage&rdquo;).
7419 </p>
7420 <p>Each thread has a <em>mailbox</em> which is used for inter-thread
7421 communication.
7422 </p>
7423 <hr size="1">
7424 <a name="Mutex-objects"></a>
7425 <table cellpadding="1" cellspacing="1" border="0">
7426 <tr><td valign="middle" align="left"><a href="#Thread-objects" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.2 Thread objects" align="middle" width="32"></a></td>
7427 <td valign="middle" align="left"><a href="#Condition-variable-objects" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.4 Condition variable objects" align="middle" width="32"></a></td>
7428 <td valign="middle" align="left"> &nbsp; </td>
7429 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7430 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7431 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7432 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7433 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7434 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7435 </tr></table>
7436 <a name="Mutex-objects-1"></a>
7437 <h2 class="section">13.3 Mutex objects</h2>
7439 <p>A mutex can be in one of four states: <em>locked</em> (either <em>owned</em>
7440 or <em>not owned</em>) and <em>unlocked</em> (either <em>abandoned</em> or
7441 <em>not abandoned</em>).
7442 </p>
7443 <p>An attempt to lock a mutex only succeeds if the mutex is in an unlocked
7444 state, otherwise the current thread will wait. A mutex in the
7445 locked/owned state has an associated <em>owner thread</em>, which by
7446 convention is the thread that is responsible for unlocking the mutex
7447 (this case is typical of critical sections implemented as &ldquo;lock mutex,
7448 perform operation, unlock mutex&rdquo;). A mutex in the locked/not-owned
7449 state is not linked to a particular thread.
7450 </p>
7451 <p>A mutex becomes locked when a thread locks it using the
7452 <samp>mutex-lock!</samp> primitive. A mutex becomes unlocked/abandoned when
7453 the owner of a locked/owned mutex terminates. A mutex becomes
7454 unlocked/not-abandoned when a thread unlocks it using the
7455 <samp>mutex-unlock!</samp> primitive.
7456 </p>
7457 <p>The mutex primitives do not implement <em>recursive mutex semantics</em>.
7458 An attempt to lock a mutex that is locked implies that the current
7459 thread waits even if the mutex is owned by the current thread (this can
7460 lead to a deadlock if no other thread unlocks the mutex).
7461 </p>
7462 <p>Each mutex has a <em>specific field</em> which can be used in an
7463 application specific way to associate data with the mutex.
7464 </p>
7465 <hr size="1">
7466 <a name="Condition-variable-objects"></a>
7467 <table cellpadding="1" cellspacing="1" border="0">
7468 <tr><td valign="middle" align="left"><a href="#Mutex-objects" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.3 Mutex objects" align="middle" width="32"></a></td>
7469 <td valign="middle" align="left"><a href="#Fairness" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.5 Fairness" align="middle" width="32"></a></td>
7470 <td valign="middle" align="left"> &nbsp; </td>
7471 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7472 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7473 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7474 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7475 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7476 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7477 </tr></table>
7478 <a name="Condition-variable-objects-1"></a>
7479 <h2 class="section">13.4 Condition variable objects</h2>
7481 <p>A condition variable represents a set of blocked threads. These blocked
7482 threads are waiting for a certain condition to become true. When a
7483 thread modifies some program state that might make the condition true,
7484 the thread unblocks some number of threads (one or all depending on the
7485 primitive used) so they can check if the condition is now true. This
7486 allows complex forms of interthread synchronization to be expressed more
7487 conveniently than with mutexes alone.
7488 </p>
7489 <p>Each condition variable has a <em>specific field</em> which can be used in
7490 an application specific way to associate data with the condition
7491 variable.
7492 </p>
7493 <hr size="1">
7494 <a name="Fairness"></a>
7495 <table cellpadding="1" cellspacing="1" border="0">
7496 <tr><td valign="middle" align="left"><a href="#Condition-variable-objects" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.4 Condition variable objects" align="middle" width="32"></a></td>
7497 <td valign="middle" align="left"><a href="#Memory-coherency" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.6 Memory coherency" align="middle" width="32"></a></td>
7498 <td valign="middle" align="left"> &nbsp; </td>
7499 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7500 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7501 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7502 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7503 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7504 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7505 </tr></table>
7506 <a name="Fairness-1"></a>
7507 <h2 class="section">13.5 Fairness</h2>
7509 <p>In various situations the scheduler must select one thread from a set of
7510 threads (e.g. which thread to run when a running thread blocks or
7511 expires its quantum, which thread to unblock when a mutex becomes
7512 unlocked or a condition variable is signaled). The constraints on the
7513 selection process determine the scheduler&rsquo;s <em>fairness</em>. The
7514 selection depends on the order in which threads become runnable or
7515 blocked and on the <em>priority</em> attached to the threads.
7516 </p>
7517 <p>The definition of fairness requires the notion of time ordering,
7518 i.e. &ldquo;event <var>A</var> occured before event <var>B</var>&rdquo;. For the purpose of
7519 establishing time ordering, the scheduler uses a clock with a discrete,
7520 usually variable, resolution (a &ldquo;tick&rdquo;). Events occuring in a given
7521 tick can be considered to be simultaneous (i.e. if event <var>A</var> occured
7522 before event <var>B</var> in real time, then the scheduler will claim that
7523 event <var>A</var> occured before event <var>B</var> unless both events fall
7524 within the same tick, in which case the scheduler arbitrarily chooses a
7525 time ordering).
7526 </p>
7527 <p>Each thread <var>T</var> has three priorities which affect fairness; the
7528 <em>base priority</em>, the <em>boosted priority</em>, and the <em>effective
7529 priority</em>.
7530 </p>
7531 <ul>
7532 <li>
7533 The <em>base priority</em> is the value contained in <var>T</var>&rsquo;s <em>base
7534 priority</em> field (which is set with the <samp>thread-base-priority-set!</samp>
7535 primitive).
7537 </li><li>
7538 <var>T</var>&rsquo;s <em>boosted flag</em> field contains a boolean that affects
7539 <var>T</var>&rsquo;s <em>boosted priority</em>. When the boosted flag field is false,
7540 the boosted priority is equal to the base priority, otherwise the
7541 boosted priority is equal to the base priority plus the value contained
7542 in <var>T</var>&rsquo;s <em>priority boost</em> field (which is set with the
7543 <samp>thread-priority-boost-set!</samp> primitive). The boosted flag field is
7544 set to false when a thread is created, when its quantum expires, and
7545 when <em>thread-yield!</em> is called. The boosted flag field is set to
7546 true when a thread blocks. By carefully choosing the base priority and
7547 priority boost, relatively to the other threads, it is possible to set
7548 up an interactive thread so that it has good I/O response time without
7549 being a CPU hog when it performs long computations.
7551 </li><li>
7552 The <em>effective priority</em> is equal to the maximum of <var>T</var>&rsquo;s
7553 boosted priority and the effective priority of all the threads that are
7554 blocked on a mutex owned by <var>T</var>. This <em>priority inheritance</em>
7555 avoids priority inversion problems that would prevent a high priority
7556 thread blocked at the entry of a critical section to progress because a
7557 low priority thread inside the critical section is preempted for an
7558 arbitrary long time by a medium priority thread.
7560 </li></ul>
7562 <p>Let <var>P</var>(<var>T</var>) be the effective priority of thread <var>T</var> and
7563 let <var>R</var>(<var>T</var>) be the most recent time when one of the following
7564 events occurred for thread <var>T</var>, thus making it runnable: <var>T</var>
7565 was started by calling <samp>thread-start!</samp>, <var>T</var> called
7566 <samp>thread-yield!</samp>, <var>T</var> expired its quantum, or <var>T</var> became
7567 unblocked. Let the relation <var>NL</var>(<var>T1</var>,<var>T2</var>), &ldquo;<var>T1</var>
7568 no later than <var>T2</var>&rdquo;, be true if
7569 <var>P</var>(<var>T1</var>)&lt;<var>P</var>(<var>T2</var>) or
7570 <var>P</var>(<var>T1</var>)=<var>P</var>(<var>T2</var>) and
7571 <var>R</var>(<var>T1</var>)&gt;<var>R</var>(<var>T2</var>), and false otherwise. The
7572 scheduler will schedule the execution of threads in such a way that
7573 whenever there is at least one runnable thread, 1) within a finite
7574 time at least one thread will be running, and 2) there is never a pair
7575 of runnable threads <var>T1</var> and <var>T2</var> for which
7576 <var>NL</var>(<var>T1</var>,<var>T2</var>) is true and <var>T1</var> is not running and
7577 <var>T2</var> is running.
7578 </p>
7579 <p>A thread <var>T</var> expires its quantum when an amount of time equal to
7580 <var>T</var>&rsquo;s quantum has elapsed since <var>T</var> entered the running state
7581 and <var>T</var> did not block, terminate or call <samp>thread-yield!</samp>.
7582 At that point <var>T</var> exits the running state to allow other threads to
7583 run. A thread&rsquo;s quantum is thus an indication of the rate of progress
7584 of the thread relative to the other threads of the same priority.
7585 Moreover, the resolution of the timer measuring the running time may
7586 cause a certain deviation from the quantum, so a thread&rsquo;s quantum should
7587 only be viewed as an approximation of the time it can run before
7588 yielding to another thread.
7589 </p>
7590 <p>Threads blocked on a given mutex or condition variable will unblock in
7591 an order which is consistent with decreasing priority and increasing
7592 blocking time (i.e. the highest priority thread unblocks first, and
7593 among equal priority threads the one that blocked first unblocks first).
7594 </p>
7595 <hr size="1">
7596 <a name="Memory-coherency"></a>
7597 <table cellpadding="1" cellspacing="1" border="0">
7598 <tr><td valign="middle" align="left"><a href="#Fairness" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.5 Fairness" align="middle" width="32"></a></td>
7599 <td valign="middle" align="left"><a href="#Timeouts" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.7 Timeouts" align="middle" width="32"></a></td>
7600 <td valign="middle" align="left"> &nbsp; </td>
7601 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7602 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7603 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7604 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7605 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7606 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7607 </tr></table>
7608 <a name="Memory-coherency-1"></a>
7609 <h2 class="section">13.6 Memory coherency</h2>
7611 <p>Read and write operations on the store (such as reading and writing a
7612 variable, an element of a vector or a string) are not atomic. It is
7613 an error for a thread to write a location in the store while some
7614 other thread reads or writes that same location. It is the
7615 responsibility of the application to avoid write/read and write/write
7616 races through appropriate uses of the synchronization primitives.
7617 </p>
7618 <p>Concurrent reads and writes to ports are allowed. It is the
7619 responsibility of the implementation to serialize accesses to a given
7620 port using the appropriate synchronization primitives.
7621 </p>
7622 <hr size="1">
7623 <a name="Timeouts"></a>
7624 <table cellpadding="1" cellspacing="1" border="0">
7625 <tr><td valign="middle" align="left"><a href="#Memory-coherency" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.6 Memory coherency" align="middle" width="32"></a></td>
7626 <td valign="middle" align="left"><a href="#Primordial-thread" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.8 Primordial thread" align="middle" width="32"></a></td>
7627 <td valign="middle" align="left"> &nbsp; </td>
7628 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7629 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7630 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7631 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7632 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7633 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7634 </tr></table>
7635 <a name="Timeouts-1"></a>
7636 <h2 class="section">13.7 Timeouts</h2>
7638 <p>All synchronization primitives which take a timeout parameter accept
7639 three types of values as a timeout, with the following meaning:
7640 </p>
7641 <ul>
7642 <li>
7643 a time object represents an absolute point in time
7645 </li><li>
7646 an exact or inexact real number represents a relative time in
7647 seconds from the moment the primitive was called
7649 </li><li>
7650 <samp>#f</samp> means that there is no timeout
7652 </li></ul>
7654 <p>When a timeout denotes the current time or a time in the past, the
7655 synchronization primitive claims that the timeout has been reached
7656 only after the other synchronization conditions have been checked.
7657 Moreover the thread remains running (it does not enter the blocked
7658 state). For example, <code>(mutex-lock! m 0)</code> will lock mutex
7659 <code>m</code> and return <samp>#t</samp> if <code>m</code> is
7660 currently unlocked, otherwise <samp>#f</samp> is returned because the
7661 timeout is reached.
7662 </p>
7663 <hr size="1">
7664 <a name="Primordial-thread"></a>
7665 <table cellpadding="1" cellspacing="1" border="0">
7666 <tr><td valign="middle" align="left"><a href="#Timeouts" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.7 Timeouts" align="middle" width="32"></a></td>
7667 <td valign="middle" align="left"><a href="#Procedures" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 13.9 Procedures" align="middle" width="32"></a></td>
7668 <td valign="middle" align="left"> &nbsp; </td>
7669 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7670 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7671 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7672 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7673 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7674 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7675 </tr></table>
7676 <a name="Primordial-thread-1"></a>
7677 <h2 class="section">13.8 Primordial thread</h2>
7679 <p>The execution of a program is initially under the control of a single
7680 thread known as the <em>primordial thread</em>. The primordial thread has an
7681 unspecified
7682 base priority, priority boost, boosted flag, quantum,
7683 name, specific field, dynamic environment, <samp>dynamic-wind</samp>
7684 stack, and exception-handler. All threads are terminated when the
7685 primordial thread terminates (normally or not).
7686 </p>
7687 <hr size="1">
7688 <a name="Procedures"></a>
7689 <table cellpadding="1" cellspacing="1" border="0">
7690 <tr><td valign="middle" align="left"><a href="#Primordial-thread" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.8 Primordial thread" align="middle" width="32"></a></td>
7691 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 14. Dynamic environment" align="middle" width="32"></a></td>
7692 <td valign="middle" align="left"> &nbsp; </td>
7693 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
7694 <td valign="middle" align="left"><a href="#Threads" title="Up section"><img src="button-up.png" border="0" alt="Up: 13. Threads" align="middle" width="32"></a></td>
7695 <td valign="middle" align="left"><a href="#Dynamic-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 14. Dynamic environment" align="middle" width="32"></a></td>
7696 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
7697 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
7698 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
7699 </tr></table>
7700 <a name="Procedures-1"></a>
7701 <h2 class="section">13.9 Procedures</h2>
7703 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-thread">current-thread</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
7705 <p>This procedure returns the current thread. For example:
7706 </p>
7707 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(current-thread)</b>
7708 #&lt;thread #1 primordial&gt;
7709 &gt; <b>(eq? (current-thread) (current-thread))</b>
7711 </pre></td></tr></table>
7715 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7717 <p>This procedure returns <code>#t</code> when <var>obj</var> is a thread object and
7718 <code>#f</code> otherwise.
7719 </p>
7720 <p>For example:
7721 </p>
7722 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread? (current-thread))</b>
7724 &gt; <b>(thread? 'foo)</b>
7726 </pre></td></tr></table>
7730 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7731 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7733 <p>The <code>make-thread</code> procedure creates and returns an initialized
7734 thread. This thread is not automatically made runnable (the procedure
7735 <code>thread-start!</code> must be used for this). A thread has the
7736 following fields: base priority, priority boost, boosted flag,
7737 quantum, name, specific, end-result, end-exception, and a list of
7738 locked/owned mutexes it owns. The thread&rsquo;s execution consists of a
7739 call to <var>thunk</var> with the <em>initial continuation</em>. This
7740 continuation causes the (then) current thread to store the result in
7741 its end-result field, abandon all mutexes it owns, and finally
7742 terminate. The <samp>dynamic-wind</samp> stack of the initial continuation
7743 is empty. The optional <var>name</var> is an arbitrary Scheme object which
7744 identifies the thread (useful for debugging); it defaults to an
7745 unspecified value. The specific field is set to an unspecified value.
7746 The optional <var>thread-group</var> indicates which thread group this
7747 thread belongs to; it defaults to the thread group of the current
7748 thread. The base priority, priority boost, and quantum of the thread
7749 are set to the same value as the current thread and the boosted flag
7750 is set to false. The thread&rsquo;s mailbox is initially empty. The thread
7751 inherits the dynamic environment from the current thread. Moreover, in
7752 this dynamic environment the exception-handler is bound to the
7753 <em>initial exception-handler</em> which is a unary procedure which
7754 causes the (then) current thread to store in its end-exception field
7755 an uncaught-exception object whose &ldquo;reason&rdquo; is the argument of the
7756 handler, abandon all mutexes it owns, and finally terminate.
7757 </p>
7758 <p>The <code>make-root-thread</code> procedure behaves like the
7759 <code>make-thread</code> procedure except the created thread does not
7760 inherit the dynamic environment from the current thread and the base
7761 priority is set to 0, the priority boost is set to 1.0e-6, and the
7762 quantum is set to 0.02. The dynamic environment of the thread has the
7763 global bindings of the parameter objects, except
7764 <code>current-input-port</code> which is bound to <var>input-port</var>,
7765 <code>current-output-port</code> which is bound to <var>output-port</var>, and
7766 <code>current-directory</code> which is bound to the initial current working
7767 directory of the current process. If <var>input-port</var> is not
7768 specified it defaults to a port corresponding to the standard input
7769 (<samp>stdin</samp>). If <var>output-port</var> is not specified it defaults to
7770 a port corresponding to the standard output (<samp>stdout</samp>).
7771 </p>
7772 <p>For example:
7773 </p>
7774 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(make-thread (lambda () (write 'hello)))</b>
7775 #&lt;thread #2&gt;
7776 &gt; <b>(make-root-thread (lambda () (write 'world)) 'a-name)</b>
7777 #&lt;thread #3 a-name&gt;
7778 </pre></td></tr></table>
7782 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7784 <p>This procedure returns the name of the <var>thread</var>. For example:
7785 </p>
7786 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-name (make-thread (lambda () #f) 'foo))</b>
7788 </pre></td></tr></table>
7792 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7793 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7795 <p>The <code>thread-specific</code> procedure returns the content of the
7796 <var>thread</var>&rsquo;s specific field.
7797 </p>
7798 <p>The <code>thread-specific-set!</code> procedure stores <var>obj</var> into the
7799 <var>thread</var>&rsquo;s specific field and returns an unspecified value.
7800 </p>
7801 <p>For example:
7802 </p>
7803 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-specific-set! (current-thread) &quot;hello&quot;)</b>
7804 &gt; <b>(thread-specific (current-thread))</b>
7805 &quot;hello&quot;
7806 </pre></td></tr></table>
7810 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7811 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7813 <p>The procedure <code>thread-base-priority</code> returns a real number which
7814 corresponds to the base priority of the <var>thread</var>.
7815 </p>
7816 <p>The procedure <code>thread-base-priority-set!</code> changes the base
7817 priority of the <var>thread</var> to <var>priority</var> and returns an
7818 unspecified value. The <var>priority</var> must be a real number.
7819 </p>
7820 <p>For example:
7821 </p>
7822 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-base-priority-set! (current-thread) 12.3)</b>
7823 &gt; <b>(thread-base-priority (current-thread))</b>
7824 12.3
7825 </pre></td></tr></table>
7829 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7830 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7832 <p>The procedure <code>thread-priority-boost</code> returns a real number which
7833 corresponds to the priority boost of the <var>thread</var>.
7834 </p>
7835 <p>The procedure <code>thread-priority-boost-set!</code> changes the priority
7836 boost of the <var>thread</var> to <var>priority-boost</var> and returns an
7837 unspecified value. The <var>priority-boost</var> must be a nonnegative
7838 real.
7839 </p>
7840 <p>For example:
7841 </p>
7842 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-priority-boost-set! (current-thread) 2.5)</b>
7843 &gt; <b>(thread-priority-boost (current-thread))</b>
7845 </pre></td></tr></table>
7849 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7850 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7852 <p>The procedure <code>thread-quantum</code> returns a real number which
7853 corresponds to the quantum of the <var>thread</var>.
7854 </p>
7855 <p>The procedure <code>thread-quantum-set!</code> changes the quantum of the
7856 <var>thread</var> to <var>quantum</var> and returns an unspecified value. The
7857 <var>quantum</var> must be a nonnegative real. A value of zero selects the
7858 smallest quantum supported by the implementation.
7859 </p>
7860 <p>For example:
7861 </p>
7862 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-quantum-set! (current-thread) 1.5)</b>
7863 &gt; <b>(thread-quantum (current-thread))</b>
7865 &gt; <b>(thread-quantum-set! (current-thread) 0)</b>
7866 &gt; <b>(thread-quantum (current-thread))</b>
7868 </pre></td></tr></table>
7872 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7874 <p>This procedure makes <var>thread</var> runnable and returns the
7875 <var>thread</var>. The <var>thread</var> must be an initialized thread.
7876 </p>
7877 <p>For example:
7878 </p>
7879 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(let ((t (thread-start! (make-thread (lambda () (write 'a))))))
7880 (write 'b)
7881 (thread-join! t))</b>
7882 ab&gt; <span class="roman"><i>or</i></span> ba&gt;
7883 </pre></td></tr></table>
7885 <p>NOTE: It is useful to separate thread creation and thread activation
7886 to avoid the race condition that would occur if the created thread
7887 tries to examine a table in which the current thread stores the
7888 created thread. See the last example of the <code>thread-terminate!</code>
7889 procedure which contains mutually recursive threads.
7890 </p>
7893 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_thread-yield!">thread-yield!</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
7895 <p>This procedure causes the current thread to exit the running state as
7896 if its quantum had expired and returns an unspecified value.
7897 </p>
7898 <p>For example:
7899 </p>
7900 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b><span class="roman"><i>; a busy loop that avoids being too wasteful of the CPU</i></span>
7902 (let loop ()
7903 (if (mutex-lock! m 0) <span class="roman"><i>; try to lock m but don't block</i></span>
7904 (begin
7905 (display &quot;locked mutex m&quot;)
7906 (mutex-unlock! m))
7907 (begin
7908 (do-something-else)
7909 (thread-yield!) <span class="roman"><i>; relinquish rest of quantum</i></span>
7910 (loop))))
7911 </pre></td></tr></table>
7915 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7917 <p>This procedure causes the current thread to wait until the timeout is
7918 reached and returns an unspecified value. This blocks the thread only
7919 if <var>timeout</var> represents a point in the future. It is an error for
7920 <var>timeout</var> to be <samp>#f</samp>.
7921 </p>
7922 <p>For example:
7923 </p>
7924 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b><span class="roman"><i>; a clock with a gradual drift:</i></span>
7926 (let loop ((x 1))
7927 (thread-sleep! 1)
7928 (write x)
7929 (loop (+ x 1)))
7931 <span class="roman"><i>; a clock with no drift:</i></span>
7933 (let ((start (time-&gt;seconds (current-time)))
7934 (let loop ((x 1))
7935 (thread-sleep! (seconds-&gt;time (+ x start)))
7936 (write x)
7937 (loop (+ x 1))))
7938 </pre></td></tr></table>
7942 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
7944 <p>This procedure causes an abnormal termination of the <var>thread</var>. If
7945 the <var>thread</var> is not already terminated, all mutexes owned by the
7946 <var>thread</var> become unlocked/abandoned and a
7947 terminated-thread-exception object is stored in the <var>thread</var>&rsquo;s
7948 end-exception field. If <var>thread</var> is the current thread,
7949 <code>thread-terminate!</code> does not return. Otherwise
7950 <code>thread-terminate!</code> returns an unspecified value; the termination
7951 of the <var>thread</var> will occur at some point between the calling of
7952 <code>thread-terminate!</code> and a finite time in the future (an explicit
7953 thread synchronization is needed to detect termination, see
7954 <code>thread-join!</code>).
7955 </p>
7956 <p>For example:
7957 </p>
7958 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define (amb thunk1 thunk2)
7959 (let ((result #f)
7960 (result-mutex (make-mutex))
7961 (done-mutex (make-mutex)))
7962 (letrec ((child1
7963 (make-thread
7964 (lambda ()
7965 (let ((x (thunk1)))
7966 (mutex-lock! result-mutex #f #f)
7967 (set! result x)
7968 (thread-terminate! child2)
7969 (mutex-unlock! done-mutex)))))
7970 (child2
7971 (make-thread
7972 (lambda ()
7973 (let ((x (thunk2)))
7974 (mutex-lock! result-mutex #f #f)
7975 (set! result x)
7976 (thread-terminate! child1)
7977 (mutex-unlock! done-mutex))))))
7978 (mutex-lock! done-mutex #f #f)
7979 (thread-start! child1)
7980 (thread-start! child2)
7981 (mutex-lock! done-mutex #f #f)
7982 result)))
7983 </pre></td></tr></table>
7985 <p>NOTE: This operation must be used carefully because it terminates a
7986 thread abruptly and it is impossible for that thread to perform any
7987 kind of cleanup. This may be a problem if the thread is in the middle
7988 of a critical section where some structure has been put in an
7989 inconsistent state. However, another thread attempting to enter this
7990 critical section will raise an abandoned-mutex-exception object
7991 because the mutex is unlocked/abandoned. This helps avoid observing
7992 an inconsistent state. Clean termination can be obtained by polling,
7993 as shown in the example below.
7994 </p>
7995 <p>For example:
7996 </p>
7997 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define (spawn thunk)
7998 (let ((t (make-thread thunk)))
7999 (thread-specific-set! t #t)
8000 (thread-start! t)
8003 (define (stop! thread)
8004 (thread-specific-set! thread #f)
8005 (thread-join! thread))
8007 (define (keep-going?)
8008 (thread-specific (current-thread)))
8010 (define count!
8011 (let ((m (make-mutex))
8012 (i 0))
8013 (lambda ()
8014 (mutex-lock! m)
8015 (let ((x (+ i 1)))
8016 (set! i x)
8017 (mutex-unlock! m)
8018 x))))
8020 (define (increment-forever!)
8021 (let loop () (count!) (if (keep-going?) (loop))))
8023 (let ((t1 (spawn increment-forever!))
8024 (t2 (spawn increment-forever!)))
8025 (thread-sleep! 1)
8026 (stop! t1)
8027 (stop! t2)
8028 (count!)) ==&gt; 377290
8029 </pre></td></tr></table>
8033 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8035 <p>This procedure causes the current thread to wait until the
8036 <var>thread</var> terminates (normally or not) or until the timeout is
8037 reached if <var>timeout</var> is supplied. If the timeout is reached,
8038 <var>thread-join!</var> returns <var>timeout-val</var> if it is supplied,
8039 otherwise a join-timeout-exception object is raised. If the
8040 <var>thread</var> terminated normally, the content of the end-result field
8041 is returned, otherwise the content of the end-exception field is
8042 raised.
8043 </p>
8044 <p>For example:
8045 </p>
8046 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(let ((t (thread-start! (make-thread (lambda () (expt 2 100))))))
8047 (do-something-else)
8048 (thread-join! t)) ==&gt; 1267650600228229401496703205376
8050 (let ((t (thread-start! (make-thread (lambda () (raise 123))))))
8051 (do-something-else)
8052 (with-exception-handler
8053 (lambda (exc)
8054 (if (uncaught-exception? exc)
8055 (* 10 (uncaught-exception-reason exc))
8056 99999))
8057 (lambda ()
8058 (+ 1 (thread-join! t))))) ==&gt; 1231
8060 (define thread-alive?
8061 (let ((unique (list 'unique)))
8062 (lambda (thread)
8063 ; Note: this procedure raises an exception if
8064 ; the thread terminated abnormally.
8065 (eq? (thread-join! thread 0 unique) unique))))
8067 (define (wait-for-termination! thread)
8068 (let ((eh (current-exception-handler)))
8069 (with-exception-handler
8070 (lambda (exc)
8071 (if (not (or (terminated-thread-exception? exc)
8072 (uncaught-exception? exc)))
8073 (eh exc))) ; unexpected exceptions are handled by eh
8074 (lambda ()
8075 ; The following call to thread-join! will wait until the
8076 ; thread terminates. If the thread terminated normally
8077 ; thread-join! will return normally. If the thread
8078 ; terminated abnormally then one of these two exception
8079 ; objects is raised by thread-join!:
8080 ; - terminated-thread-exception object
8081 ; - uncaught-exception object
8082 (thread-join! thread)
8083 #f)))) ; ignore result of thread-join!
8084 </pre></td></tr></table>
8088 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8090 <p>Each thread has a mailbox which stores messages delivered to the
8091 thread in the order delivered.
8092 </p>
8093 <p>The procedure <code>thread-send</code> adds the message <var>msg</var> at the end
8094 of the mailbox of thread <var>thread</var> and returns an unspecified
8095 value.
8096 </p>
8097 <p>For example:
8098 </p>
8099 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-send (current-thread) 111)</b>
8100 &gt; <b>(thread-send (current-thread) 222)</b>
8101 &gt; <b>(thread-receive)</b>
8103 &gt; <b>(thread-receive)</b>
8105 </pre></td></tr></table>
8109 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8110 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8111 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8112 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8114 <p>To allow a thread to examine the messages in its mailbox without
8115 removing them from the mailbox, each thread has a <em>mailbox cursor</em>
8116 which normally points to the last message accessed in the mailbox.
8117 When a mailbox cursor is rewound using the procedure
8118 <code>thread-mailbox-rewind</code> or
8119 <code>thread-mailbox-extract-and-rewind</code> or <code>thread-receive</code>, the
8120 cursor does not point to a message, but the next call to
8121 <code>thread-receive</code> and <code>thread-mailbox-next</code> will set the
8122 cursor to the oldest message in the mailbox.
8123 </p>
8124 <p>The procedure <code>thread-receive</code> advances the mailbox cursor of the
8125 current thread to the next message, removes that message from the
8126 mailbox, rewinds the mailbox cursor, and returns the message. When
8127 <var>timeout</var> is not specified, the current thread will wait until a
8128 message is available in the mailbox. When <var>timeout</var> is specified
8129 and <var>default</var> is not specified, a
8130 mailbox-receive-timeout-exception object is raised if the timeout is
8131 reached before a message is available. When <var>timeout</var> is
8132 specified and <var>default</var> is specified, <var>default</var> is returned if
8133 the timeout is reached before a message is available.
8134 </p>
8135 <p>The procedure <code>thread-mailbox-next</code> behaves like
8136 <code>thread-receive</code> except that the message remains in the mailbox
8137 and the mailbox cursor is not rewound.
8138 </p>
8139 <p>The procedures <code>thread-mailbox-rewind</code> or
8140 <code>thread-mailbox-extract-and-rewind</code> rewind the mailbox cursor of
8141 the current thread so that the next call to <code>thread-mailbox-next</code>
8142 and <code>thread-receive</code> will access the oldest message in the
8143 mailbox. Additionally the procedure
8144 <code>thread-mailbox-extract-and-rewind</code> will remove from the mailbox
8145 the message most recently accessed by a call to
8146 <code>thread-mailbox-next</code>. When <code>thread-mailbox-next</code> has not
8147 been called since the last call to <code>thread-receive</code> or
8148 <code>thread-mailbox-rewind</code> or
8149 <code>thread-mailbox-extract-and-rewind</code>, a call to
8150 <code>thread-mailbox-extract-and-rewind</code> only resets the mailbox
8151 cursor (no message is removed).
8152 </p>
8153 <p>For example:
8154 </p>
8155 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(thread-send (current-thread) 111)</b>
8156 &gt; <b>(thread-receive 1 999)</b>
8158 &gt; <b>(thread-send (current-thread) 222)</b>
8159 &gt; <b>(thread-send (current-thread) 333)</b>
8160 &gt; <b>(thread-mailbox-next 1 999)</b>
8162 &gt; <b>(thread-mailbox-next 1 999)</b>
8164 &gt; <b>(thread-mailbox-next 1 999)</b>
8166 &gt; <b>(thread-mailbox-extract-and-rewind)</b>
8167 &gt; <b>(thread-receive 1 999)</b>
8169 &gt; <b>(thread-receive 1 999)</b>
8171 </pre></td></tr></table>
8175 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8176 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8177 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8179 <p>Mailbox-receive-timeout-exception objects are raised by the procedures
8180 <code>thread-receive</code> and <code>thread-mailbox-next</code> when a timeout
8181 expires before a message is available and no default value is
8182 specified. The parameter <var>exc</var> must be a
8183 mailbox-receive-timeout-exception object.
8184 </p>
8185 <p>The procedure <code>mailbox-receive-timeout-exception?</code> returns
8186 <code>#t</code> when <var>obj</var> is a mailbox-receive-timeout-exception
8187 object and <code>#f</code> otherwise.
8188 </p>
8189 <p>The procedure <code>mailbox-receive-timeout-exception-procedure</code>
8190 returns the procedure that raised <var>exc</var>.
8191 </p>
8192 <p>The procedure <code>mailbox-receive-timeout-exception-arguments</code>
8193 returns the list of arguments of the procedure that raised <var>exc</var>.
8194 </p>
8195 <p>For example:
8196 </p>
8197 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
8198 (if (mailbox-receive-timeout-exception? exc)
8199 (list (mailbox-receive-timeout-exception-procedure exc)
8200 (mailbox-receive-timeout-exception-arguments exc))
8201 'not-mailbox-receive-timeout-exception))</b>
8202 &gt; <b>(with-exception-catcher
8203 handler
8204 (lambda () (thread-receive 1)))</b>
8205 (#&lt;procedure #2 thread-receive&gt; (1))
8206 </pre></td></tr></table>
8210 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8212 <p>This procedure returns <code>#t</code> when <var>obj</var> is a mutex object and
8213 <code>#f</code> otherwise.
8214 </p>
8215 <p>For example:
8216 </p>
8217 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(mutex? (make-mutex))</b>
8219 &gt; <b>(mutex? 'foo)</b>
8221 </pre></td></tr></table>
8225 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8227 <p>This procedure returns a new mutex in the unlocked/not-abandoned
8228 state. The optional <var>name</var> is an arbitrary Scheme object which
8229 identifies the mutex (useful for debugging); it defaults to an
8230 unspecified value. The mutex&rsquo;s specific field is set to an
8231 unspecified value.
8232 </p>
8233 <p>For example:
8234 </p>
8235 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(make-mutex)</b>
8236 #&lt;mutex #2&gt;
8237 &gt; <b>(make-mutex 'foo)</b>
8238 #&lt;mutex #3 foo&gt;
8239 </pre></td></tr></table>
8243 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8245 <p>Returns the name of the <var>mutex</var>. For example:
8246 </p>
8247 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(mutex-name (make-mutex 'foo))</b>
8249 </pre></td></tr></table>
8253 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8254 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8256 <p>The <code>mutex-specific</code> procedure returns the content of the
8257 <var>mutex</var>&rsquo;s specific field.
8258 </p>
8259 <p>The <code>mutex-specific-set!</code> procedure stores <var>obj</var> into the
8260 <var>mutex</var>&rsquo;s specific field and returns an unspecified value.
8261 </p>
8262 <p>For example:
8263 </p>
8264 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define m (make-mutex))</b>
8265 &gt; <b>(mutex-specific-set! m &quot;hello&quot;)</b>
8266 &gt; <b>(mutex-specific m)</b>
8267 &quot;hello&quot;
8268 &gt; <b>(define (mutex-lock-recursively! mutex)
8269 (if (eq? (mutex-state mutex) (current-thread))
8270 (let ((n (mutex-specific mutex)))
8271 (mutex-specific-set! mutex (+ n 1)))
8272 (begin
8273 (mutex-lock! mutex)
8274 (mutex-specific-set! mutex 0))))</b>
8275 &gt; <b>(define (mutex-unlock-recursively! mutex)
8276 (let ((n (mutex-specific mutex)))
8277 (if (= n 0)
8278 (mutex-unlock! mutex)
8279 (mutex-specific-set! mutex (- n 1)))))</b>
8280 &gt; <b>(mutex-lock-recursively! m)</b>
8281 &gt; <b>(mutex-lock-recursively! m)</b>
8282 &gt; <b>(mutex-lock-recursively! m)</b>
8283 &gt; <b>(mutex-specific m)</b>
8285 </pre></td></tr></table>
8289 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8291 <p>Thos procedure returns information about the state of the <var>mutex</var>.
8292 The possible results are:
8293 </p>
8294 <ul>
8295 <li> thread <var>T</var>:
8296 the <var>mutex</var> is in the locked/owned state
8297 and thread <var>T</var> is the owner of the <var>mutex</var>
8299 </li><li> symbol <code>not-owned</code>:
8300 the <var>mutex</var> is in the locked/not-owned state
8302 </li><li> symbol <code>abandoned</code>:
8303 the <var>mutex</var> is in the unlocked/abandoned
8304 state
8306 </li><li> symbol <code>not-abandoned</code>:
8307 the <var>mutex</var> is in the unlocked/not-abandoned
8308 state
8310 </li></ul>
8312 <p>For example:
8313 </p>
8314 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(mutex-state (make-mutex)) ==&gt; not-abandoned
8316 (define (thread-alive? thread)
8317 (let ((mutex (make-mutex)))
8318 (mutex-lock! mutex #f thread)
8319 (let ((state (mutex-state mutex)))
8320 (mutex-unlock! mutex) ; avoid space leak
8321 (eq? state thread))))
8322 </pre></td></tr></table>
8326 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8328 <p>This procedure locks <var>mutex</var>. If the <var>mutex</var> is currently
8329 locked, the current thread waits until the <var>mutex</var> is unlocked, or
8330 until the timeout is reached if <var>timeout</var> is supplied. If the
8331 timeout is reached, <code>mutex-lock!</code> returns <samp>#f</samp>. Otherwise,
8332 the state of the <var>mutex</var> is changed as follows:
8333 </p>
8334 <ul>
8335 <li> if <var>thread</var> is <samp>#f</samp> the
8336 <var>mutex</var> becomes locked/not-owned,
8338 </li><li> otherwise, let <var>T</var> be <var>thread</var> (or the
8339 current thread if <var>thread</var> is not
8340 supplied),
8342 <ul>
8343 <li> if <var>T</var> is terminated the <var>mutex</var>
8344 becomes unlocked/abandoned,
8346 </li><li> otherwise <var>mutex</var> becomes locked/owned
8347 with <var>T</var> as the owner.
8349 </li></ul>
8351 </li></ul>
8353 <p>After changing the state of the <var>mutex</var>, an
8354 abandoned-mutex-exception object is raised if the <var>mutex</var> was
8355 unlocked/abandoned before the state change, otherwise
8356 <code>mutex-lock!</code> returns <samp>#t</samp>. It is not an error if the
8357 <var>mutex</var> is owned by the current thread (but the current thread
8358 will have to wait).
8359 </p>
8360 <p>For example:
8361 </p>
8362 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this
8363 ; implementation does not behave well in the presence of forced
8364 ; thread terminations using thread-terminate! (deadlock can occur
8365 ; if a thread is terminated in the middle of a put! or get! operation)
8367 (define (make-empty-mailbox)
8368 (let ((put-mutex (make-mutex)) ; allow put! operation
8369 (get-mutex (make-mutex))
8370 (cell #f))
8372 (define (put! obj)
8373 (mutex-lock! put-mutex #f #f) ; prevent put! operation
8374 (set! cell obj)
8375 (mutex-unlock! get-mutex)) ; allow get! operation
8377 (define (get!)
8378 (mutex-lock! get-mutex #f #f) ; wait until object in mailbox
8379 (let ((result cell))
8380 (set! cell #f) ; prevent space leaks
8381 (mutex-unlock! put-mutex) ; allow put! operation
8382 result))
8384 (mutex-lock! get-mutex #f #f) ; prevent get! operation
8386 (lambda (msg)
8387 (case msg
8388 ((put!) put!)
8389 ((get!) get!)
8390 (else (error &quot;unknown message&quot;))))))
8392 (define (mailbox-put! m obj) ((m 'put!) obj))
8393 (define (mailbox-get! m) ((m 'get!)))
8395 ; an alternate implementation of thread-sleep!
8397 (define (sleep! timeout)
8398 (let ((m (make-mutex)))
8399 (mutex-lock! m #f #f)
8400 (mutex-lock! m timeout #f)))
8402 ; a procedure that waits for one of two mutexes to unlock
8404 (define (lock-one-of! mutex1 mutex2)
8405 ; this procedure assumes that neither mutex1 or mutex2
8406 ; are owned by the current thread
8407 (let ((ct (current-thread))
8408 (done-mutex (make-mutex)))
8409 (mutex-lock! done-mutex #f #f)
8410 (let ((t1 (thread-start!
8411 (make-thread
8412 (lambda ()
8413 (mutex-lock! mutex1 #f ct)
8414 (mutex-unlock! done-mutex)))))
8415 (t2 (thread-start!
8416 (make-thread
8417 (lambda ()
8418 (mutex-lock! mutex2 #f ct)
8419 (mutex-unlock! done-mutex))))))
8420 (mutex-lock! done-mutex #f #f)
8421 (thread-terminate! t1)
8422 (thread-terminate! t2)
8423 (if (eq? (mutex-state mutex1) ct)
8424 (begin
8425 (if (eq? (mutex-state mutex2) ct)
8426 (mutex-unlock! mutex2)) ; don't lock both
8427 mutex1)
8428 mutex2))))
8429 </pre></td></tr></table>
8433 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8435 <p>This procedure unlocks the <var>mutex</var> by making it
8436 unlocked/not-abandoned. It is not an error to unlock an unlocked
8437 mutex and a mutex that is owned by any thread. If
8438 <var>condition-variable</var> is supplied, the current thread is blocked
8439 and added to the <var>condition-variable</var> before unlocking
8440 <var>mutex</var>; the thread can unblock at any time but no later than when
8441 an appropriate call to <code>condition-variable-signal!</code> or
8442 <code>condition-variable-broadcast!</code> is performed (see below), and no
8443 later than the timeout (if <var>timeout</var> is supplied). If there are
8444 threads waiting to lock this <var>mutex</var>, the scheduler selects a
8445 thread, the mutex becomes locked/owned or locked/not-owned, and the
8446 thread is unblocked. <code>mutex-unlock!</code> returns <samp>#f</samp> when the
8447 timeout is reached, otherwise it returns <samp>#t</samp>.
8448 </p>
8449 <p>NOTE: The reason the thread can unblock at any time (when
8450 <var>condition-variable</var> is supplied) is that the scheduler, when it
8451 detects a serious problem such as a deadlock, must interrupt one of
8452 the blocked threads (such as the primordial thread) so that it can
8453 perform some appropriate action. After a thread blocked on a
8454 condition-variable has handled such an interrupt it would be wrong for
8455 the scheduler to return the thread to the blocked state, because any
8456 calls to <code>condition-variable-broadcast!</code> during the interrupt
8457 will have gone unnoticed. It is necessary for the thread to remain
8458 runnable and return from the call to <code>mutex-unlock!</code> with a
8459 result of <samp>#t</samp>.
8460 </p>
8461 <p>NOTE: <code>mutex-unlock!</code> is related to the &ldquo;wait&rdquo; operation on
8462 condition variables available in other thread systems. The main
8463 difference is that &ldquo;wait&rdquo; automatically locks <var>mutex</var> just
8464 after the thread is unblocked. This operation is not performed by
8465 <code>mutex-unlock!</code> and so must be done by an explicit call to
8466 <code>mutex-lock!</code>. This has the advantages that a different timeout
8467 and exception-handler can be specified on the <code>mutex-lock!</code> and
8468 <code>mutex-unlock!</code> and the location of all the mutex operations is
8469 clearly apparent.
8470 </p>
8471 <p>For example:
8472 </p>
8473 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(let loop ()
8474 (mutex-lock! m)
8475 (if (condition-is-true?)
8476 (begin
8477 (do-something-when-condition-is-true)
8478 (mutex-unlock! m))
8479 (begin
8480 (mutex-unlock! m cv)
8481 (loop))))
8482 </pre></td></tr></table>
8486 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8488 <p>This procedure returns <code>#t</code> when <var>obj</var> is a
8489 condition-variable object and <code>#f</code> otherwise.
8490 </p>
8491 <p>For example:
8492 </p>
8493 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(condition-variable? (make-condition-variable))</b>
8495 &gt; <b>(condition-variable? 'foo)</b>
8497 </pre></td></tr></table>
8501 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8503 <p>This procedure returns a new empty condition variable. The optional
8504 <var>name</var> is an arbitrary Scheme object which identifies the
8505 condition variable (useful for debugging); it defaults to an
8506 unspecified value. The condition variable&rsquo;s specific field is set to
8507 an unspecified value.
8508 </p>
8509 <p>For example:
8510 </p>
8511 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(make-condition-variable)</b>
8512 #&lt;condition-variable #2&gt;
8513 </pre></td></tr></table>
8517 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8519 <p>This procedure returns the name of the <var>condition-variable</var>. For
8520 example:
8521 </p>
8522 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(condition-variable-name (make-condition-variable 'foo))</b>
8524 </pre></td></tr></table>
8528 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8529 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8531 <p>The <code>condition-variable-specific</code> procedure returns the content
8532 of the <var>condition-variable</var>&rsquo;s specific field.
8533 </p>
8534 <p>The <code>condition-variable-specific-set!</code> procedure stores <var>obj</var>
8535 into the <var>condition-variable</var>&rsquo;s specific field and returns
8536 an unspecified value.
8537 </p>
8538 <p>For example:
8539 </p>
8540 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define cv (make-condition-variable))</b>
8541 &gt; <b>(condition-variable-specific-set! cv &quot;hello&quot;)</b>
8542 &gt; <b>(condition-variable-specific cv)</b>
8543 &quot;hello&quot;
8544 </pre></td></tr></table>
8548 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8550 <p>This procedure unblocks a thread blocked on the
8551 <var>condition-variable</var> (if there is at least one) and returns an
8552 unspecified value.
8553 </p>
8554 <p>For example:
8555 </p>
8556 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>; an implementation of a mailbox object of depth one; this
8557 ; implementation behaves gracefully when threads are forcibly
8558 ; terminated using thread-terminate! (an abandoned-mutex-exception
8559 ; object will be raised when a put! or get! operation is attempted
8560 ; after a thread is terminated in the middle of a put! or get!
8561 ; operation)
8563 (define (make-empty-mailbox)
8564 (let ((mutex (make-mutex))
8565 (put-condvar (make-condition-variable))
8566 (get-condvar (make-condition-variable))
8567 (full? #f)
8568 (cell #f))
8570 (define (put! obj)
8571 (mutex-lock! mutex)
8572 (if full?
8573 (begin
8574 (mutex-unlock! mutex put-condvar)
8575 (put! obj))
8576 (begin
8577 (set! cell obj)
8578 (set! full? #t)
8579 (condition-variable-signal! get-condvar)
8580 (mutex-unlock! mutex))))
8582 (define (get!)
8583 (mutex-lock! mutex)
8584 (if (not full?)
8585 (begin
8586 (mutex-unlock! mutex get-condvar)
8587 (get!))
8588 (let ((result cell))
8589 (set! cell #f) ; avoid space leaks
8590 (set! full? #f)
8591 (condition-variable-signal! put-condvar)
8592 (mutex-unlock! mutex)
8593 result)))
8595 (lambda (msg)
8596 (case msg
8597 ((put!) put!)
8598 ((get!) get!)
8599 (else (error &quot;unknown message&quot;))))))
8601 (define (mailbox-put! m obj) ((m 'put!) obj))
8602 (define (mailbox-get! m) ((m 'get!)))
8603 </pre></td></tr></table>
8607 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8609 <p>This procedure unblocks all the thread blocked on the
8610 <var>condition-variable</var> and returns an unspecified value.
8611 </p>
8612 <p>For example:
8613 </p>
8614 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define (make-semaphore n)
8615 (vector n (make-mutex) (make-condition-variable)))
8617 (define (semaphore-wait! sema)
8618 (mutex-lock! (vector-ref sema 1))
8619 (let ((n (vector-ref sema 0)))
8620 (if (&gt; n 0)
8621 (begin
8622 (vector-set! sema 0 (- n 1))
8623 (mutex-unlock! (vector-ref sema 1)))
8624 (begin
8625 (mutex-unlock! (vector-ref sema 1) (vector-ref sema 2))
8626 (semaphore-wait! sema))))
8628 (define (semaphore-signal-by! sema increment)
8629 (mutex-lock! (vector-ref sema 1))
8630 (let ((n (+ (vector-ref sema 0) increment)))
8631 (vector-set! sema 0 n)
8632 (if (&gt; n 0)
8633 (condition-variable-broadcast! (vector-ref sema 2)))
8634 (mutex-unlock! (vector-ref sema 1))))
8635 </pre></td></tr></table>
8639 <hr size="1">
8640 <a name="Dynamic-environment"></a>
8641 <table cellpadding="1" cellspacing="1" border="0">
8642 <tr><td valign="middle" align="left"><a href="#Procedures" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 13.9 Procedures" align="middle" width="32"></a></td>
8643 <td valign="middle" align="left"><a href="#Exceptions" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 15. Exceptions" align="middle" width="32"></a></td>
8644 <td valign="middle" align="left"> &nbsp; </td>
8645 <td valign="middle" align="left"><a href="#Threads" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 13. Threads" align="middle" width="32"></a></td>
8646 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
8647 <td valign="middle" align="left"><a href="#Exceptions" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 15. Exceptions" align="middle" width="32"></a></td>
8648 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
8649 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
8650 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
8651 </tr></table>
8652 <a name="Dynamic-environment-1"></a>
8653 <h1 class="chapter">14. Dynamic environment</h1>
8655 <p>The <em>dynamic environment</em> is the structure which allows the system
8656 to find the value returned by the standard procedures
8657 <code>current-input-port</code> and <code>current-output-port</code>. The
8658 standard procedures <code>with-input-from-file</code> and
8659 <code>with-output-to-file</code> extend the dynamic environment to produce a
8660 new dynamic environment which is in effect for the dynamic extent of
8661 the call to the thunk passed as their last argument. These procedures
8662 are essentially special purpose dynamic binding operations on hidden
8663 dynamic variables (one for <code>current-input-port</code> and one for
8664 <code>current-output-port</code>). Gambit generalizes this dynamic binding
8665 mechanism to allow the user to introduce new dynamic variables, called
8666 <em>parameter objects</em>, and dynamically bind them. The parameter
8667 objects implemented by Gambit are compatible with the specification of
8668 the &ldquo;Parameter objects SRFI&rdquo; (SRFI 39).
8669 </p>
8670 <p>One important issue is the relationship between the dynamic
8671 environments of the parent and child threads when a thread is created.
8672 Each thread has its own dynamic environment that is accessed when
8673 looking up the value bound to a parameter object by that thread. When
8674 a thread&rsquo;s dynamic environment is extended it does not affect the
8675 dynamic environment of other threads. When a thread is created it is
8676 given a dynamic environment whose bindings are inherited from the
8677 parent thread. In this inherited dynamic environment the parameter
8678 objects are bound to the same cells as the parent&rsquo;s dynamic
8679 environment (in other words an assignment of a new value to a
8680 parameter object is visible in the other thread).
8681 </p>
8682 <p>Another important issue is the interaction between the
8683 <code>dynamic-wind</code> procedure and dynamic environments. When a thread
8684 creates a continuation, the thread&rsquo;s dynamic environment and the
8685 <samp>dynamic-wind</samp> stack are saved within the continuation (an
8686 alternate but equivalent point of view is that the <samp>dynamic-wind</samp>
8687 stack is part of the dynamic environment). When this continuation is
8688 invoked the required <samp>dynamic-wind</samp> before and after thunks are
8689 called and the saved dynamic environment is reinstated as the dynamic
8690 environment of the current thread. During the call to each required
8691 <samp>dynamic-wind</samp> before and after thunk, the dynamic environment
8692 and the <samp>dynamic-wind</samp> stack in effect when the corresponding
8693 <samp>dynamic-wind</samp> was executed are reinstated. Note that this
8694 specification precisely defines the semantics of calling
8695 <samp>call-with-current-continuation</samp> or invoking a continuation
8696 within a before or after thunk. The semantics are well defined even
8697 when a continuation created by another thread is invoked. Below is an
8698 example exercising the subtleties of this semantics.
8699 </p>
8700 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(with-output-to-file
8701 &quot;foo&quot;
8702 (lambda ()
8703 (let ((k (call-with-current-continuation
8704 (lambda (exit)
8705 (with-output-to-file
8706 &quot;bar&quot;
8707 (lambda ()
8708 (dynamic-wind
8709 (lambda ()
8710 (write '(b1))
8711 (force-output))
8712 (lambda ()
8713 (let ((x (call-with-current-continuation
8714 (lambda (cont) (exit cont)))))
8715 (write '(t1))
8716 (force-output)
8718 (lambda ()
8719 (write '(a1))
8720 (force-output)))))))))
8721 (if k
8722 (dynamic-wind
8723 (lambda ()
8724 (write '(b2))
8725 (force-output))
8726 (lambda ()
8727 (with-output-to-file
8728 &quot;baz&quot;
8729 (lambda ()
8730 (write '(t2))
8731 (force-output)
8732 ; go back inside (with-output-to-file &quot;bar&quot; ...)
8733 (k #f))))
8734 (lambda ()
8735 (write '(a2))
8736 (force-output)))))))
8737 </pre></td></tr></table>
8739 <p>The following actions will occur when this code is executed:
8740 <code>(b1)(a1)</code> is written to &ldquo;bar&rdquo;, <code>(b2)</code> is then written to
8741 &ldquo;foo&rdquo;, <code>(t2)</code> is then written to &ldquo;baz&rdquo;, <code>(a2)</code> is then
8742 written to &ldquo;foo&rdquo;, and finally <code>(b1)(t1)(a1)</code> is written to
8743 &ldquo;bar&rdquo;.
8744 </p>
8745 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8747 <p>The dynamic environment is composed of two parts: the <em>local
8748 dynamic environment</em> and the <em>global dynamic environment</em>. There
8749 is a single global dynamic environment, and it is used to lookup
8750 parameter objects that can&rsquo;t be found in the local dynamic
8751 environment.
8752 </p>
8753 <p>The <code>make-parameter</code> procedure returns a new <em>parameter
8754 object</em>. The <var>filter</var> argument is a one argument conversion
8755 procedure. If it is not specified, <var>filter</var> defaults to the
8756 identity function.
8757 </p>
8758 <p>The global dynamic environment is updated to associate the parameter
8759 object to a new cell. The initial content of the cell is the result
8760 of applying the conversion procedure to <var>obj</var>.
8761 </p>
8762 <p>A parameter object is a procedure which accepts zero or one argument.
8763 The cell bound to a particular parameter object in the dynamic
8764 environment is accessed by calling the parameter object. When no
8765 argument is passed, the content of the cell is returned. When one
8766 argument is passed the content of the cell is updated with the result
8767 of applying the parameter object&rsquo;s conversion procedure to the
8768 argument. Note that the conversion procedure can be used for
8769 guaranteeing the type of the parameter object&rsquo;s binding and/or to
8770 perform some conversion of the value.
8771 </p>
8772 <p>For example:
8773 </p>
8774 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define radix (make-parameter 10))</b>
8775 &gt; <b>(radix)</b>
8777 &gt; <b>(radix 2)</b>
8778 &gt; <b>(radix)</b>
8780 &gt; <b>(define prompt
8781 (make-parameter
8783 (lambda (x)
8784 (if (string? x)
8786 (object-&gt;string x)))))</b>
8787 &gt; <b>(prompt)</b>
8788 &quot;123&quot;
8789 &gt; <b>(prompt &quot;$&quot;)</b>
8790 &gt; <b>(prompt)</b>
8791 &quot;$&quot;
8792 &gt; <b>(define write-shared
8793 (make-parameter
8795 (lambda (x)
8796 (if (boolean? x)
8798 (error &quot;only booleans are accepted by write-shared&quot;)))))</b>
8799 &gt; <b>(write-shared 123)</b>
8800 *** ERROR IN ##make-parameter -- only booleans are accepted by write-shared
8801 </pre></td></tr></table>
8805 <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="http://dynamo.iro.umontreal.ca/~gambit/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>)&hellip;) <span class="roman"><i>body</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
8807 <p>The <code>parameterize</code> form, evaluates all <i>procedure</i> and
8808 <i>value</i> expressions in an unspecified order. All the
8809 <i>procedure</i> expressions must evaluate to procedures, either parameter
8810 objects or procedures accepting zero and one argument. Then,
8811 for each procedure <i>p</i> and in an unspecified order:
8812 </p>
8813 <ul>
8814 <li>
8815 If <i>p</i> is a parameter object a new cell is created, initialized, and
8816 bound to the parameter object in the local dynamic environment. The
8817 value contained in the cell is the result of applying the parameter
8818 object&rsquo;s conversion procedure to <i>value</i>. The resulting dynamic
8819 environment is then used for processing the remaining bindings (or the
8820 evaluation of <i>body</i> if there are no other bindings).
8822 </li><li>
8823 Otherwise <i>p</i> will be used according to the following protocol: we
8824 say that the call <code>(<span class="roman"><i>p</i></span>)</code> &ldquo;gets <i>p</i>&rsquo;s value&rdquo; and that
8825 the call <code>(<span class="roman"><i>p</i></span> <span class="roman"><i>x</i></span>)</code> &ldquo;sets <i>p</i>&rsquo;s value to <i>x</i>&rdquo;.
8826 First, the <code>parameterize</code> form gets <i>p</i>&rsquo;s value and saves it in
8827 a local variable. It then sets <i>p</i>&rsquo;s value to <i>value</i>. It then
8828 processes the remaining bindings (or evaluates <i>body</i> if there are
8829 no other bindings). Then it sets <i>p</i>&rsquo;s value to the saved value.
8830 These steps are performed in a <code>dynamic-wind</code> so that it is
8831 possible to use continuations to jump into and out of the body
8832 (i.e. the <code>dynamic-wind</code>&rsquo;s before thunk sets <i>p</i>&rsquo;s value to
8833 <i>value</i> and the after thunk sets <i>p</i>&rsquo;s value to the saved value).
8835 </li></ul>
8837 <p>The result(s) of the <code>parameterize</code> form are the result(s) of the
8838 <i>body</i>.
8839 </p>
8840 <p>Note that using procedures instead of parameter objects may lead to
8841 unexpected results in multithreaded programs because the before and
8842 after thunks of the <code>dynamic-wind</code> are not called when control
8843 switches between threads.
8844 </p>
8845 <p>For example:
8846 </p>
8847 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define radix (make-parameter 2))</b>
8848 &gt; <b>(define prompt
8849 (make-parameter
8851 (lambda (x)
8852 (if (string? x)
8854 (object-&gt;string x)))))</b>
8855 &gt; <b>(radix)</b>
8857 &gt; <b>(parameterize ((radix 16)) (radix))</b>
8859 &gt; <b>(radix)</b>
8861 &gt; <b>(define (f n) (number-&gt;string n (radix)))</b>
8862 &gt; <b>(f 10)</b>
8863 &quot;1010&quot;
8864 &gt; <b>(parameterize ((radix 8)) (f 10))</b>
8865 &quot;12&quot;
8866 &gt; <b>(parameterize ((radix 8) (prompt (f 10))) (prompt))</b>
8867 &quot;1010&quot;
8868 &gt; <b>(define p
8869 (let ((x 1))
8870 (lambda args
8871 (if (null? args) x (set! x (car args))))))</b>
8872 &gt; <b>(let* ((a (p))
8873 (b (parameterize ((p 2)) (list (p))))
8874 (c (p)))
8875 (list a b c))</b>
8876 (1 (2) 1)
8877 </pre></td></tr></table>
8881 <hr size="1">
8882 <a name="Exceptions"></a>
8883 <table cellpadding="1" cellspacing="1" border="0">
8884 <tr><td valign="middle" align="left"><a href="#Dynamic-environment" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 14. Dynamic environment" align="middle" width="32"></a></td>
8885 <td valign="middle" align="left"><a href="#Exception_002dhandling" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 15.1 Exception-handling" align="middle" width="32"></a></td>
8886 <td valign="middle" align="left"> &nbsp; </td>
8887 <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" alt="FastBack: 14. Dynamic environment" align="middle" width="32"></a></td>
8888 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
8889 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
8890 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
8891 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
8892 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
8893 </tr></table>
8894 <a name="Exceptions-1"></a>
8895 <h1 class="chapter">15. Exceptions</h1>
8897 <table class="menu" border="0" cellspacing="0">
8898 <tr><td align="left" valign="top"><a href="#Exception_002dhandling">15.1 Exception-handling</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8899 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8900 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8901 <tr><td align="left" valign="top"><a href="#Exception-objects-related-to-threads">15.4 Exception objects related to threads</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8902 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8903 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8904 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8905 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8906 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8907 <tr><td align="left" valign="top"><a href="#Other-exception-objects">15.10 Other exception objects</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
8908 </table>
8910 <hr size="1">
8911 <a name="Exception_002dhandling"></a>
8912 <table cellpadding="1" cellspacing="1" border="0">
8913 <tr><td valign="middle" align="left"><a href="#Exceptions" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 15. Exceptions" align="middle" width="32"></a></td>
8914 <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" alt="Forward: 15.2 Exception objects related to memory management" align="middle" width="32"></a></td>
8915 <td valign="middle" align="left"> &nbsp; </td>
8916 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
8917 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
8918 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
8919 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
8920 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
8921 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
8922 </tr></table>
8923 <a name="Exception_002dhandling-1"></a>
8924 <h2 class="section">15.1 Exception-handling</h2>
8926 <p>Gambit&rsquo;s exception-handling model is inspired from the withdrawn
8927 &ldquo;Exception Handling SRFI&rdquo; (SRFI 12), the &ldquo;Multithreading support
8928 SRFI&rdquo; (SRFI 18), and the &ldquo;Exception Handling for Programs SRFI&rdquo;
8929 (SRFI 34). The two fundamental operations are the dynamic binding of
8930 an exception handler (i.e. the procedure
8931 <code>with-exception-handler</code>) and the invocation of the exception
8932 handler (i.e. the procedure <code>raise</code>).
8933 </p>
8934 <p>All predefined procedures which check for errors (including type
8935 errors, memory allocation errors, host operating-system errors, etc)
8936 report these errors using the exception-handling system (i.e. they
8937 &ldquo;raise&rdquo; an exception that can be handled in a user-defined exception
8938 handler). When an exception is raised and the exception is not
8939 handled by a user-defined exception handler, the predefined exception
8940 handler will display an error message (if the primordial thread raised
8941 the exception) or the thread will silently terminate with no error
8942 message (if it is not the primordial thread that raised the
8943 exception). This default behavior can be changed through the
8944 <samp>-:d</samp> runtime option (see section <a href="#Runtime-options">Runtime options</a>).
8945 </p>
8946 <p>Predefined procedures normally raise exceptions by performing a
8947 tail-call to the exception handler (the exceptions are &ldquo;complex&rdquo;
8948 procedures such as <code>eval</code>, <code>compile-file</code>, <code>read</code>,
8949 <code>write</code>, etc). This means that the continuation of the exception
8950 handler and of the REPL that may be started due to this is normally
8951 the continuation of the predefined procedure that raised the
8952 exception. By exiting the REPL with the <code>,(c <var>expression</var>)</code>
8953 command it is thus possible to resume the program as though the call
8954 to the predefined procedure returned the value of <var>expression</var>.
8955 For example:
8956 </p>
8957 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (f x) (+ (car x) 1))</b>
8958 &gt; <b>(f 2) <span class="roman"><i>; typo... we meant to say (f '(2))</i></span></b>
8959 *** ERROR IN f, (console)@1.18 -- (Argument 1) PAIR expected
8960 (car 2)
8961 1&gt; <b>,(c 2)</b>
8963 </pre></td></tr></table>
8965 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8967 <a name="index-current-exception_002dhandler"></a>
8968 <p>The parameter object <code>current-exception-handler</code> is bound to the
8969 current exception-handler. Calling this procedure with no argument
8970 returns the current exception-handler and calling this procedure with
8971 one argument sets the current exception-handler to
8972 <var>new-exception-handler</var>.
8973 </p>
8974 <p>For example:
8975 </p>
8976 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(current-exception-handler)</b>
8977 #&lt;procedure #2 primordial-exception-handler&gt;
8978 &gt; <b>(current-exception-handler (lambda (exc) (pp exc) 999))</b>
8979 &gt; <b>(/ 1 0)</b>
8980 #&lt;divide-by-zero-exception #3&gt;
8982 </pre></td></tr></table>
8986 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
8988 <p>Returns the result(s) of calling <var>thunk</var> with no arguments. The
8989 <var>handler</var>, which must be a procedure, is installed as the current
8990 exception-handler in the dynamic environment in effect during the call
8991 to <var>thunk</var>. Note that the dynamic environment in effect during
8992 the call to <var>handler</var> has <var>handler</var> as the exception-handler.
8993 Consequently, an exception raised during the call to <var>handler</var> may
8994 lead to an infinite loop.
8995 </p>
8996 <p>For example:
8997 </p>
8998 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(with-exception-handler
8999 (lambda (e) (write e) 5)
9000 (lambda () (+ 1 (* 2 3) 4)))</b>
9002 &gt; <b>(with-exception-handler
9003 (lambda (e) (write e) 5)
9004 (lambda () (+ 1 (* 'foo 3) 4)))</b>
9005 #&lt;type-exception #2&gt;10
9006 &gt; <b>(with-exception-handler
9007 (lambda (e) (write e 9))
9008 (lambda () (+ 1 (* 'foo 3) 4)))</b>
9009 <var>infinite loop</var>
9010 </pre></td></tr></table>
9014 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9016 <p>Returns the result(s) of calling <var>thunk</var> with no arguments. A new
9017 exception-handler is installed as the current exception-handler in the
9018 dynamic environment in effect during the call to <var>thunk</var>. This
9019 new exception-handler will call the <var>handler</var>, which must be a
9020 procedure, with the exception object as an argument and with the same
9021 continuation as the call to <code>with-exception-catcher</code>. This
9022 implies that the dynamic environment in effect during the call to
9023 <var>handler</var> is the same as the one in effect at the call to
9024 <code>with-exception-catcher</code>. Consequently, an exception raised
9025 during the call to <var>handler</var> will not lead to an infinite loop.
9026 </p>
9027 <p>For example:
9028 </p>
9029 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(with-exception-catcher
9030 (lambda (e) (write e) 5)
9031 (lambda () (+ 1 (* 2 3) 4)))</b>
9033 &gt; <b>(with-exception-catcher
9034 (lambda (e) (write e) 5)
9035 (lambda () (+ 1 (* 'foo 3) 4)))</b>
9036 #&lt;type-exception #2&gt;5
9037 &gt; <b>(with-exception-catcher
9038 (lambda (e) (write e 9))
9039 (lambda () (+ 1 (* 'foo 3) 4)))</b>
9040 *** ERROR IN (console)@7.1 -- (Argument 2) OUTPUT PORT expected
9041 (write '#&lt;type-exception #3&gt; 9)
9042 </pre></td></tr></table>
9046 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9048 <p>This procedure tail-calls the current exception-handler with <var>obj</var>
9049 as the sole argument. If the exception-handler returns, the
9050 continuation of the call to <code>raise</code> is invoked.
9051 </p>
9052 <p>For example:
9053 </p>
9054 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(with-exception-handler
9055 (lambda (exc)
9056 (pp exc)
9057 100)
9058 (lambda ()
9059 (+ 1 (raise &quot;hello&quot;))))</b>
9060 &quot;hello&quot;
9062 </pre></td></tr></table>
9066 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9067 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9068 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9070 <p>The procedure <code>abort</code> calls the current exception-handler with
9071 <var>obj</var> as the sole argument. If the exception-handler returns, the
9072 procedure <code>abort</code> will be tail-called with a
9073 noncontinuable-exception object, whose reason field is <var>obj</var>, as
9074 sole argument.
9075 </p>
9076 <p>Noncontinuable-exception objects are raised by the <code>abort</code>
9077 procedure when the exception-handler returns. The parameter <var>exc</var>
9078 must be a noncontinuable-exception object.
9079 </p>
9080 <p>The procedure <code>noncontinuable-exception?</code> returns
9081 <code>#t</code> when <var>obj</var> is a noncontinuable-exception
9082 object and <code>#f</code> otherwise.
9083 </p>
9084 <p>The procedure <code>noncontinuable-exception-reason</code> returns the
9085 argument of the call to <code>abort</code> that raised <var>exc</var>.
9086 </p>
9087 <p>For example:
9088 </p>
9089 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-current-continuation
9090 (lambda (k)
9091 (with-exception-handler
9092 (lambda (exc)
9093 (pp exc)
9094 (if (noncontinuable-exception? exc)
9095 (k (list (noncontinuable-exception-reason exc)))
9096 100))
9097 (lambda ()
9098 (+ 1 (abort &quot;hello&quot;))))))</b>
9099 &quot;hello&quot;
9100 #&lt;noncontinuable-exception #2&gt;
9101 (&quot;hello&quot;)
9102 </pre></td></tr></table>
9106 <hr size="1">
9107 <a name="Exception-objects-related-to-memory-management"></a>
9108 <table cellpadding="1" cellspacing="1" border="0">
9109 <tr><td valign="middle" align="left"><a href="#Exception_002dhandling" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 15.1 Exception-handling" align="middle" width="32"></a></td>
9110 <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" alt="Forward: 15.3 Exception objects related to the host environment" align="middle" width="32"></a></td>
9111 <td valign="middle" align="left"> &nbsp; </td>
9112 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9113 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9114 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9115 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9116 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9117 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9118 </tr></table>
9119 <a name="Exception-objects-related-to-memory-management-1"></a>
9120 <h2 class="section">15.2 Exception objects related to memory management</h2>
9122 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9124 <p>Heap-overflow-exception objects are raised when the allocation of an
9125 object would cause the heap to use more memory space than is available.
9126 </p>
9127 <p>The procedure <code>heap-overflow-exception?</code> returns
9128 <code>#t</code> when <var>obj</var> is a heap-overflow-exception
9129 object and <code>#f</code> otherwise.
9130 </p>
9131 <p>For example:
9132 </p>
9133 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9134 (if (heap-overflow-exception? exc)
9136 'not-heap-overflow-exception))</b>
9137 &gt; <b>(with-exception-catcher
9138 handler
9139 (lambda ()
9140 (define (f x) (f (cons 1 x)))
9141 (f '())))</b>
9142 #&lt;heap-overflow-exception #2&gt;
9143 </pre></td></tr></table>
9147 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9149 <p>Stack-overflow-exception objects are raised when the allocation of a
9150 continuation frame would cause the heap to use more memory space than
9151 is available.
9152 </p>
9153 <p>The procedure <code>stack-overflow-exception?</code> returns
9154 <code>#t</code> when <var>obj</var> is a stack-overflow-exception
9155 object and <code>#f</code> otherwise.
9156 </p>
9157 <p>For example:
9158 </p>
9159 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9160 (if (stack-overflow-exception? exc)
9162 'not-stack-overflow-exception))</b>
9163 &gt; <b>(with-exception-catcher
9164 handler
9165 (lambda ()
9166 (define (f) (+ 1 (f)))
9167 (f)))</b>
9168 #&lt;stack-overflow-exception #2&gt;
9169 </pre></td></tr></table>
9173 <hr size="1">
9174 <a name="Exception-objects-related-to-the-host-environment"></a>
9175 <table cellpadding="1" cellspacing="1" border="0">
9176 <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" alt="Back: 15.2 Exception objects related to memory management" align="middle" width="32"></a></td>
9177 <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" alt="Forward: 15.4 Exception objects related to threads" align="middle" width="32"></a></td>
9178 <td valign="middle" align="left"> &nbsp; </td>
9179 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9180 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9181 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9182 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9183 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9184 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9185 </tr></table>
9186 <a name="Exception-objects-related-to-the-host-environment-1"></a>
9187 <h2 class="section">15.3 Exception objects related to the host environment</h2>
9189 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9190 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9191 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9192 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9193 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9195 <p>Os-exception objects are raised by procedures which access the host
9196 operating-system&rsquo;s services when the requested operation fails. The
9197 parameter <var>exc</var> must be a os-exception object.
9198 </p>
9199 <p>The procedure <code>os-exception?</code> returns
9200 <code>#t</code> when <var>obj</var> is a os-exception
9201 object and <code>#f</code> otherwise.
9202 </p>
9203 <p>The procedure <code>os-exception-procedure</code>
9204 returns the procedure that raised <var>exc</var>.
9205 </p>
9206 <p>The procedure <code>os-exception-arguments</code>
9207 returns the list of arguments of the procedure that raised <var>exc</var>.
9208 </p>
9209 <p>The procedure <code>os-exception-code</code> returns an exact integer error
9210 code that can be converted to a string by the <code>err-code-&gt;string</code>
9211 procedure. Note that the error code is operating-system dependent.
9212 </p>
9213 <p>The procedure <code>os-exception-message</code> returns
9214 <code>#f</code> or a string giving details of the exception in a
9215 human-readable form.
9216 </p>
9217 <p>For example:
9218 </p>
9219 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9220 (if (os-exception? exc)
9221 (list (os-exception-procedure exc)
9222 (os-exception-arguments exc)
9223 (err-code-&gt;string (os-exception-code exc))
9224 (os-exception-message exc))
9225 'not-os-exception))</b>
9226 &gt; <b>(with-exception-catcher
9227 handler
9228 (lambda () (host-info &quot;x.y.z&quot;)))</b>
9229 (#&lt;procedure #2 host-info&gt; (&quot;x.y.z&quot;) &quot;Unknown host&quot; #f)
9230 </pre></td></tr></table>
9234 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9235 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9236 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9238 <p>No-such-file-or-directory-exception objects are raised by procedures
9239 which access the filesystem (such as <code>open-input-file</code> and
9240 <code>directory-files</code>) when the path specified can&rsquo;t be found on the
9241 filesystem. The parameter <var>exc</var> must be a
9242 no-such-file-or-directory-exception object.
9243 </p>
9244 <p>The procedure <code>no-such-file-or-directory-exception?</code> returns
9245 <code>#t</code> when <var>obj</var> is a no-such-file-or-directory-exception
9246 object and <code>#f</code> otherwise.
9247 </p>
9248 <p>The procedure <code>no-such-file-or-directory-exception-procedure</code>
9249 returns the procedure that raised <var>exc</var>.
9250 </p>
9251 <p>The procedure <code>no-such-file-or-directory-exception-arguments</code>
9252 returns the list of arguments of the procedure that raised <var>exc</var>.
9253 </p>
9254 <p>For example:
9255 </p>
9256 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9257 (if (no-such-file-or-directory-exception? exc)
9258 (list (no-such-file-or-directory-exception-procedure exc)
9259 (no-such-file-or-directory-exception-arguments exc))
9260 'not-no-such-file-or-directory-exception))</b>
9261 &gt; <b>(with-exception-catcher
9262 handler
9263 (lambda () (with-input-from-file &quot;nofile&quot; read)))</b>
9264 (#&lt;procedure #2 with-input-from-file&gt; (&quot;nofile&quot; #&lt;procedure #3 read&gt;))
9265 </pre></td></tr></table>
9269 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9270 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9271 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9273 <p>Unbound-os-environment-variable-exception objects are raised when an
9274 unbound operating-system environment variable is accessed by the
9275 procedures <code>getenv</code> and <code>setenv</code>. The parameter <var>exc</var>
9276 must be an unbound-os-environment-variable-exception object.
9277 </p>
9278 <p>The procedure <code>unbound-os-environment-variable-exception?</code> returns
9279 <code>#t</code> when <var>obj</var> is an unbound-os-environment-variable-exception
9280 object and <code>#f</code> otherwise.
9281 </p>
9282 <p>The procedure <code>unbound-os-environment-variable-exception-procedure</code>
9283 returns the procedure that raised <var>exc</var>.
9284 </p>
9285 <p>The procedure <code>unbound-os-environment-variable-exception-arguments</code>
9286 returns the list of arguments of the procedure that raised <var>exc</var>.
9287 </p>
9288 <p>For example:
9289 </p>
9290 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9291 (if (unbound-os-environment-variable-exception? exc)
9292 (list (unbound-os-environment-variable-exception-procedure exc)
9293 (unbound-os-environment-variable-exception-arguments exc))
9294 'not-unbound-os-environment-variable-exception))</b>
9295 &gt; <b>(with-exception-catcher
9296 handler
9297 (lambda () (getenv &quot;DOES_NOT_EXIST&quot;)))</b>
9298 (#&lt;procedure #2 getenv&gt; (&quot;DOES_NOT_EXIST&quot;))
9299 </pre></td></tr></table>
9303 <hr size="1">
9304 <a name="Exception-objects-related-to-threads"></a>
9305 <table cellpadding="1" cellspacing="1" border="0">
9306 <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" alt="Back: 15.3 Exception objects related to the host environment" align="middle" width="32"></a></td>
9307 <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" alt="Forward: 15.5 Exception objects related to C-interface" align="middle" width="32"></a></td>
9308 <td valign="middle" align="left"> &nbsp; </td>
9309 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9310 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9311 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9312 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9313 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9314 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9315 </tr></table>
9316 <a name="Exception-objects-related-to-threads-1"></a>
9317 <h2 class="section">15.4 Exception objects related to threads</h2>
9319 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9320 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9322 <p>Scheduler-exception objects are raised by the scheduler when some
9323 operation requested from the host operating system failed
9324 (e.g. checking the status of the devices in order to wake up threads
9325 waiting to perform I/O on these devices). The parameter <var>exc</var>
9326 must be a scheduler-exception object.
9327 </p>
9328 <p>The procedure <code>scheduler-exception?</code> returns
9329 <code>#t</code> when <var>obj</var> is a scheduler-exception
9330 object and <code>#f</code> otherwise.
9331 </p>
9332 <p>The procedure <code>scheduler-exception-reason</code> returns the
9333 os-exception object that describes the failure detected by the
9334 scheduler.
9335 </p>
9338 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9340 <p>Deadlock-exception objects are raised when the scheduler discovers
9341 that all threads are blocked and can make no further progress. In
9342 that case the scheduler unblocks the primordial-thread and forces it
9343 to raise a deadlock-exception object.
9344 </p>
9345 <p>The procedure <code>deadlock-exception?</code> returns <code>#t</code> when
9346 <var>obj</var> is a deadlock-exception object and <code>#f</code> otherwise.
9347 </p>
9348 <p>For example:
9349 </p>
9350 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9351 (if (deadlock-exception? exc)
9353 'not-deadlock-exception))</b>
9354 &gt; <b>(with-exception-catcher
9355 handler
9356 (lambda () (read (open-vector))))</b>
9357 #&lt;deadlock-exception #2&gt;
9358 </pre></td></tr></table>
9362 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9364 <p>Abandoned-mutex-exception objects are raised when the current thread
9365 locks a mutex that was owned by a thread which terminated (see
9366 <code>mutex-lock!</code>).
9367 </p>
9368 <p>The procedure <code>abandoned-mutex-exception?</code> returns
9369 <code>#t</code> when <var>obj</var> is a abandoned-mutex-exception
9370 object and <code>#f</code> otherwise.
9371 </p>
9372 <p>For example:
9373 </p>
9374 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9375 (if (abandoned-mutex-exception? exc)
9377 'not-abandoned-mutex-exception))</b>
9378 &gt; <b>(with-exception-catcher
9379 handler
9380 (lambda ()
9381 (let ((m (make-mutex)))
9382 (thread-join!
9383 (thread-start!
9384 (make-thread
9385 (lambda () (mutex-lock! m)))))
9386 (mutex-lock! m))))</b>
9387 #&lt;abandoned-mutex-exception #2&gt;
9388 </pre></td></tr></table>
9392 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9393 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9394 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9396 <p>Join-timeout-exception objects are raised when a call to the
9397 <code>thread-join!</code> procedure reaches its timeout before the target
9398 thread terminates and a timeout-value parameter is not specified. The
9399 parameter <var>exc</var> must be a join-timeout-exception object.
9400 </p>
9401 <p>The procedure <code>join-timeout-exception?</code> returns
9402 <code>#t</code> when <var>obj</var> is a join-timeout-exception
9403 object and <code>#f</code> otherwise.
9404 </p>
9405 <p>The procedure <code>join-timeout-exception-procedure</code>
9406 returns the procedure that raised <var>exc</var>.
9407 </p>
9408 <p>The procedure <code>join-timeout-exception-arguments</code>
9409 returns the list of arguments of the procedure that raised <var>exc</var>.
9410 </p>
9411 <p>For example:
9412 </p>
9413 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9414 (if (join-timeout-exception? exc)
9415 (list (join-timeout-exception-procedure exc)
9416 (join-timeout-exception-arguments exc))
9417 'not-join-timeout-exception))</b>
9418 &gt; <b>(with-exception-catcher
9419 handler
9420 (lambda ()
9421 (thread-join!
9422 (thread-start!
9423 (make-thread
9424 (lambda () (thread-sleep! 10))))
9425 5)))</b>
9426 (#&lt;procedure #2 thread-join!&gt; (#&lt;thread #3&gt; 5))
9427 </pre></td></tr></table>
9431 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9432 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9433 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9435 <p>Started-thread-exception objects are raised when the target thread of
9436 a call to the procedure <code>thread-start!</code> is already started. The
9437 parameter <var>exc</var> must be a started-thread-exception object.
9438 </p>
9439 <p>The procedure <code>started-thread-exception?</code> returns
9440 <code>#t</code> when <var>obj</var> is a started-thread-exception
9441 object and <code>#f</code> otherwise.
9442 </p>
9443 <p>The procedure <code>started-thread-exception-procedure</code>
9444 returns the procedure that raised <var>exc</var>.
9445 </p>
9446 <p>The procedure <code>started-thread-exception-arguments</code>
9447 returns the list of arguments of the procedure that raised <var>exc</var>.
9448 </p>
9449 <p>For example:
9450 </p>
9451 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9452 (if (started-thread-exception? exc)
9453 (list (started-thread-exception-procedure exc)
9454 (started-thread-exception-arguments exc))
9455 'not-started-thread-exception))</b>
9456 &gt; <b>(with-exception-catcher
9457 handler
9458 (lambda ()
9459 (let ((t (make-thread (lambda () (expt 2 1000)))))
9460 (thread-start! t)
9461 (thread-start! t))))</b>
9462 (#&lt;procedure #2 thread-start!&gt; (#&lt;thread #3&gt;))
9463 </pre></td></tr></table>
9467 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9468 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9469 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9471 <p>Terminated-thread-exception objects are raised when the
9472 <code>thread-join!</code> procedure is called and the target thread has
9473 terminated as a result of a call to the <code>thread-terminate!</code>
9474 procedure. The parameter <var>exc</var> must be a
9475 terminated-thread-exception object.
9476 </p>
9477 <p>The procedure <code>terminated-thread-exception?</code> returns
9478 <code>#t</code> when <var>obj</var> is a terminated-thread-exception
9479 object and <code>#f</code> otherwise.
9480 </p>
9481 <p>The procedure <code>terminated-thread-exception-procedure</code>
9482 returns the procedure that raised <var>exc</var>.
9483 </p>
9484 <p>The procedure <code>terminated-thread-exception-arguments</code>
9485 returns the list of arguments of the procedure that raised <var>exc</var>.
9486 </p>
9487 <p>For example:
9488 </p>
9489 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9490 (if (terminated-thread-exception? exc)
9491 (list (terminated-thread-exception-procedure exc)
9492 (terminated-thread-exception-arguments exc))
9493 'not-terminated-thread-exception))</b>
9494 &gt; <b>(with-exception-catcher
9495 handler
9496 (lambda ()
9497 (thread-join!
9498 (thread-start!
9499 (make-thread
9500 (lambda () (thread-terminate! (current-thread))))))))</b>
9501 (#&lt;procedure #2 thread-join!&gt; (#&lt;thread #3&gt;))
9502 </pre></td></tr></table>
9506 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9507 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9508 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9509 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9511 <p>Uncaught-exception objects are raised when an object is raised in a
9512 thread and that thread does not handle it (i.e. the thread terminated
9513 because it did not catch an exception it raised). The parameter
9514 <var>exc</var> must be an uncaught-exception object.
9515 </p>
9516 <p>The procedure <code>uncaught-exception?</code> returns
9517 <code>#t</code> when <var>obj</var> is an uncaught-exception
9518 object and <code>#f</code> otherwise.
9519 </p>
9520 <p>The procedure <code>uncaught-exception-procedure</code>
9521 returns the procedure that raised <var>exc</var>.
9522 </p>
9523 <p>The procedure <code>uncaught-exception-arguments</code>
9524 returns the list of arguments of the procedure that raised <var>exc</var>.
9525 </p>
9526 <p>The procedure <code>uncaught-exception-reason</code> returns the object that
9527 was raised by the thread and not handled by that thread.
9528 </p>
9529 <p>For example:
9530 </p>
9531 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9532 (if (uncaught-exception? exc)
9533 (list (uncaught-exception-procedure exc)
9534 (uncaught-exception-arguments exc)
9535 (uncaught-exception-reason exc))
9536 'not-uncaught-exception))</b>
9537 &gt; <b>(with-exception-catcher
9538 handler
9539 (lambda ()
9540 (thread-join!
9541 (thread-start!
9542 (make-thread
9543 (lambda () (open-input-file &quot;data&quot; 99)))))))</b>
9544 (#&lt;procedure #2 thread-join!&gt;
9545 (#&lt;thread #3&gt;)
9546 #&lt;wrong-number-of-arguments-exception #4&gt;)
9547 </pre></td></tr></table>
9551 <hr size="1">
9552 <a name="Exception-objects-related-to-C_002dinterface"></a>
9553 <table cellpadding="1" cellspacing="1" border="0">
9554 <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" alt="Back: 15.4 Exception objects related to threads" align="middle" width="32"></a></td>
9555 <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" alt="Forward: 15.6 Exception objects related to the reader" align="middle" width="32"></a></td>
9556 <td valign="middle" align="left"> &nbsp; </td>
9557 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9558 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9559 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9560 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9561 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9562 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9563 </tr></table>
9564 <a name="Exception-objects-related-to-C_002dinterface-1"></a>
9565 <h2 class="section">15.5 Exception objects related to C-interface</h2>
9567 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9568 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9569 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9570 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9571 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9573 <p>Cfun-conversion-exception objects are raised by the C-interface when
9574 converting between the Scheme representation and the C representation
9575 of a value during a call from Scheme to C. The parameter <var>exc</var>
9576 must be a cfun-conversion-exception object.
9577 </p>
9578 <p>The procedure <code>cfun-conversion-exception?</code> returns <code>#t</code> when
9579 <var>obj</var> is a cfun-conversion-exception object and <code>#f</code>
9580 otherwise.
9581 </p>
9582 <p>The procedure <code>cfun-conversion-exception-procedure</code> returns the
9583 procedure that raised <var>exc</var>.
9584 </p>
9585 <p>The procedure <code>cfun-conversion-exception-arguments</code> returns the
9586 list of arguments of the procedure that raised <var>exc</var>.
9587 </p>
9588 <p>The procedure <code>cfun-conversion-exception-code</code> returns an exact
9589 integer error code that can be converted to a string by the
9590 <code>err-code-&gt;string</code> procedure.
9591 </p>
9592 <p>The procedure <code>cfun-conversion-exception-message</code> returns
9593 <code>#f</code> or a string giving details of the exception in a
9594 human-readable form.
9595 </p>
9596 <p>For example:
9597 </p>
9598 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat test1.scm</b>
9599 (define weird
9600 (c-lambda (char-string) nonnull-char-string
9601 &quot;___result = ___arg1;&quot;))
9602 $ <b>gsc test1.scm</b>
9603 $ <b>gsi</b>
9604 Gambit v4.6.1
9606 &gt; <b>(load &quot;test1&quot;)</b>
9607 &quot;/Users/feeley/gambit/doc/test1.o1&quot;
9608 &gt; <b>(weird &quot;hello&quot;)</b>
9609 &quot;hello&quot;
9610 &gt; <b>(define (handler exc)
9611 (if (cfun-conversion-exception? exc)
9612 (list (cfun-conversion-exception-procedure exc)
9613 (cfun-conversion-exception-arguments exc)
9614 (err-code-&gt;string (cfun-conversion-exception-code exc))
9615 (cfun-conversion-exception-message exc))
9616 'not-cfun-conversion-exception))</b>
9617 &gt; <b>(with-exception-catcher
9618 handler
9619 (lambda () (weird 'not-a-string)))</b>
9620 (#&lt;procedure #2 weird&gt;
9621 (not-a-string)
9622 &quot;(Argument 1) Can't convert to C char-string&quot;
9624 &gt; <b>(with-exception-catcher
9625 handler
9626 (lambda () (weird #f)))</b>
9627 (#&lt;procedure #2 weird&gt;
9628 (#f)
9629 &quot;Can't convert result from C nonnull-char-string&quot;
9631 </pre></td></tr></table>
9635 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9636 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9637 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9638 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9639 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9641 <p>Sfun-conversion-exception objects are raised by the C-interface when
9642 converting between the Scheme representation and the C representation
9643 of a value during a call from C to Scheme. The parameter <var>exc</var>
9644 must be a sfun-conversion-exception object.
9645 </p>
9646 <p>The procedure <code>sfun-conversion-exception?</code> returns <code>#t</code> when
9647 <var>obj</var> is a sfun-conversion-exception object and <code>#f</code>
9648 otherwise.
9649 </p>
9650 <p>The procedure <code>sfun-conversion-exception-procedure</code> returns the
9651 procedure that raised <var>exc</var>.
9652 </p>
9653 <p>The procedure <code>sfun-conversion-exception-arguments</code> returns the
9654 list of arguments of the procedure that raised <var>exc</var>.
9655 </p>
9656 <p>The procedure <code>sfun-conversion-exception-code</code> returns an exact
9657 integer error code that can be converted to a string by the
9658 <code>err-code-&gt;string</code> procedure.
9659 </p>
9660 <p>The procedure <code>sfun-conversion-exception-message</code> returns
9661 <code>#f</code> or a string giving details of the exception in a
9662 human-readable form.
9663 </p>
9664 <p>For example:
9665 </p>
9666 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat test2.scm</b>
9667 (c-define (f str) (nonnull-char-string) int &quot;f&quot; &quot;&quot;
9668 (string-&gt;number str))
9669 (define t1 (c-lambda () int &quot;___result = f (\&quot;123\&quot;);&quot;))
9670 (define t2 (c-lambda () int &quot;___result = f (0);&quot;))
9671 (define t3 (c-lambda () int &quot;___result = f (\&quot;1.5\&quot;);&quot;))
9672 $ <b>gsc test2.scm</b>
9673 $ <b>gsi</b>
9674 Gambit v4.6.1
9676 &gt; <b>(load &quot;test2&quot;)</b>
9677 &quot;/u/feeley/test2.o1&quot;
9678 &gt; <b>(t1)</b>
9680 &gt; <b>(define (handler exc)
9681 (if (sfun-conversion-exception? exc)
9682 (list (sfun-conversion-exception-procedure exc)
9683 (sfun-conversion-exception-arguments exc)
9684 (err-code-&gt;string (sfun-conversion-exception-code exc))
9685 (sfun-conversion-exception-message exc))
9686 'not-sfun-conversion-exception))</b>
9687 &gt; <b>(with-exception-catcher handler t2)</b>
9688 (#&lt;procedure #2 f&gt;
9690 &quot;(Argument 1) Can't convert from C nonnull-char-string&quot;
9692 &gt; <b>(with-exception-catcher handler t3)</b>
9693 (#&lt;procedure #2 f&gt; () &quot;Can't convert result to C int&quot; #f)
9694 </pre></td></tr></table>
9698 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9700 <p>Multiple-c-return-exception objects are raised by the C-interface when
9701 a C to Scheme procedure call returns and that call&rsquo;s stack frame is no
9702 longer on the C stack because the call has already returned, or has
9703 been removed from the C stack by a <code>longjump</code>.
9704 </p>
9705 <p>The procedure <code>multiple-c-return-exception?</code> returns <code>#t</code>
9706 when <var>obj</var> is a multiple-c-return-exception object and <code>#f</code>
9707 otherwise.
9708 </p>
9709 <p>For example:
9710 </p>
9711 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>cat test3.scm</b>
9712 (c-define (f str) (char-string) scheme-object &quot;f&quot; &quot;&quot;
9713 (pp (list 'entry 'str= str))
9714 (let ((k (call-with-current-continuation (lambda (k) k))))
9715 (pp (list 'exit 'k= k))
9717 (define scheme-to-c-to-scheme-and-back
9718 (c-lambda (char-string) scheme-object
9719 &quot;___result = f (___arg1);&quot;))
9720 $ <b>gsc test3.scm</b>
9721 $ <b>gsi</b>
9722 Gambit v4.6.1
9724 &gt; <b>(load &quot;test3&quot;)</b>
9725 &quot;/Users/feeley/gambit/doc/test3.o1&quot;
9726 &gt; <b>(define (handler exc)
9727 (if (multiple-c-return-exception? exc)
9729 'not-multiple-c-return-exception))</b>
9730 &gt; <b>(with-exception-catcher
9731 handler
9732 (lambda ()
9733 (let ((c (scheme-to-c-to-scheme-and-back &quot;hello&quot;)))
9734 (pp c)
9735 (c 999))))</b>
9736 (entry str= &quot;hello&quot;)
9737 (exit k= #&lt;procedure #2&gt;)
9738 #&lt;procedure #2&gt;
9739 (exit k= 999)
9740 #&lt;multiple-c-return-exception #3&gt;
9741 </pre></td></tr></table>
9745 <hr size="1">
9746 <a name="Exception-objects-related-to-the-reader"></a>
9747 <table cellpadding="1" cellspacing="1" border="0">
9748 <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" alt="Back: 15.5 Exception objects related to C-interface" align="middle" width="32"></a></td>
9749 <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" alt="Forward: 15.7 Exception objects related to evaluation and compilation" align="middle" width="32"></a></td>
9750 <td valign="middle" align="left"> &nbsp; </td>
9751 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9752 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9753 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9754 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9755 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9756 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9757 </tr></table>
9758 <a name="Exception-objects-related-to-the-reader-1"></a>
9759 <h2 class="section">15.6 Exception objects related to the reader</h2>
9761 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9762 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9763 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9764 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9766 <p>Datum-parsing-exception objects are raised by the reader (i.e. the
9767 <code>read</code> procedure) when the input does not conform to the grammar
9768 for datum. The parameter <var>exc</var> must be a datum-parsing-exception
9769 object.
9770 </p>
9771 <p>The procedure <code>datum-parsing-exception?</code> returns <code>#t</code> when
9772 <var>obj</var> is a datum-parsing-exception object and <code>#f</code>
9773 otherwise.
9774 </p>
9775 <p>The procedure <code>datum-parsing-exception-kind</code> returns a symbol
9776 denoting the kind of parsing error that was encountered by the
9777 reader when it raised <var>exc</var>. Here is a table of the possible
9778 return values:
9779 </p>
9780 <table>
9781 <tr><td width="50%"><code>datum-or-eof-expected</code></td><td width="50%">Datum or EOF expected</td></tr>
9782 <tr><td width="50%"><code>datum-expected</code></td><td width="50%">Datum expected</td></tr>
9783 <tr><td width="50%"><code>improperly-placed-dot</code></td><td width="50%">Improperly placed dot</td></tr>
9784 <tr><td width="50%"><code>incomplete-form-eof-reached</code></td><td width="50%">Incomplete form, EOF reached</td></tr>
9785 <tr><td width="50%"><code>incomplete-form</code></td><td width="50%">Incomplete form</td></tr>
9786 <tr><td width="50%"><code>character-out-of-range</code></td><td width="50%">Character out of range</td></tr>
9787 <tr><td width="50%"><code>invalid-character-name</code></td><td width="50%">Invalid &rsquo;#\&rsquo; name</td></tr>
9788 <tr><td width="50%"><code>illegal-character</code></td><td width="50%">Illegal character</td></tr>
9789 <tr><td width="50%"><code>s8-expected</code></td><td width="50%">Signed 8 bit exact integer expected</td></tr>
9790 <tr><td width="50%"><code>u8-expected</code></td><td width="50%">Unsigned 8 bit exact integer expected</td></tr>
9791 <tr><td width="50%"><code>s16-expected</code></td><td width="50%">Signed 16 bit exact integer expected</td></tr>
9792 <tr><td width="50%"><code>u16-expected</code></td><td width="50%">Unsigned 16 bit exact integer expected</td></tr>
9793 <tr><td width="50%"><code>s32-expected</code></td><td width="50%">Signed 32 bit exact integer expected</td></tr>
9794 <tr><td width="50%"><code>u32-expected</code></td><td width="50%">Unsigned 32 bit exact integer expected</td></tr>
9795 <tr><td width="50%"><code>s64-expected</code></td><td width="50%">Signed 64 bit exact integer expected</td></tr>
9796 <tr><td width="50%"><code>u64-expected</code></td><td width="50%">Unsigned 64 bit exact integer expected</td></tr>
9797 <tr><td width="50%"><code>inexact-real-expected</code></td><td width="50%">Inexact real expected</td></tr>
9798 <tr><td width="50%"><code>invalid-hex-escape</code></td><td width="50%">Invalid hexadecimal escape</td></tr>
9799 <tr><td width="50%"><code>invalid-escaped-character</code></td><td width="50%">Invalid escaped character</td></tr>
9800 <tr><td width="50%"><code>open-paren-expected</code></td><td width="50%">&rsquo;(&rsquo; expected</td></tr>
9801 <tr><td width="50%"><code>invalid-token</code></td><td width="50%">Invalid token</td></tr>
9802 <tr><td width="50%"><code>invalid-sharp-bang-name</code></td><td width="50%">Invalid &rsquo;#!&rsquo; name</td></tr>
9803 <tr><td width="50%"><code>duplicate-label-definition</code></td><td width="50%">Duplicate definition for label</td></tr>
9804 <tr><td width="50%"><code>missing-label-definition</code></td><td width="50%">Missing definition for label</td></tr>
9805 <tr><td width="50%"><code>illegal-label-definition</code></td><td width="50%">Illegal definition of label</td></tr>
9806 <tr><td width="50%"><code>invalid-infix-syntax-character</code></td><td width="50%">Invalid infix syntax character</td></tr>
9807 <tr><td width="50%"><code>invalid-infix-syntax-number</code></td><td width="50%">Invalid infix syntax number</td></tr>
9808 <tr><td width="50%"><code>invalid-infix-syntax</code></td><td width="50%">Invalid infix syntax</td></tr>
9809 </table>
9811 <p>The procedure <code>datum-parsing-exception-parameters</code> returns a list
9812 of the parameters associated with the parsing error that was
9813 encountered by the reader when it raised <var>exc</var>.
9814 </p>
9815 <p>For example:
9816 </p>
9817 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9818 (if (datum-parsing-exception? exc)
9819 (list (datum-parsing-exception-kind exc)
9820 (datum-parsing-exception-parameters exc))
9821 'not-datum-parsing-exception))</b>
9822 &gt; <b>(with-exception-catcher
9823 handler
9824 (lambda ()
9825 (with-input-from-string &quot;(s #\\pace)&quot; read)))</b>
9826 (invalid-character-name (&quot;pace&quot;))
9827 </pre></td></tr></table>
9831 <hr size="1">
9832 <a name="Exception-objects-related-to-evaluation-and-compilation"></a>
9833 <table cellpadding="1" cellspacing="1" border="0">
9834 <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" alt="Back: 15.6 Exception objects related to the reader" align="middle" width="32"></a></td>
9835 <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" alt="Forward: 15.8 Exception objects related to type checking" align="middle" width="32"></a></td>
9836 <td valign="middle" align="left"> &nbsp; </td>
9837 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9838 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9839 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9840 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9841 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9842 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9843 </tr></table>
9844 <a name="Exception-objects-related-to-evaluation-and-compilation-1"></a>
9845 <h2 class="section">15.7 Exception objects related to evaluation and compilation</h2>
9847 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9848 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9849 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9850 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9852 <p>Expression-parsing-exception objects are raised by the evaluator and
9853 compiler (i.e. the procedures <code>eval</code>, <code>compile-file</code>, etc)
9854 when the input does not conform to the grammar for expression. The
9855 parameter <var>exc</var> must be a expression-parsing-exception object.
9856 </p>
9857 <p>The procedure <code>expression-parsing-exception?</code> returns <code>#t</code> when
9858 <var>obj</var> is a expression-parsing-exception object and <code>#f</code>
9859 otherwise.
9860 </p>
9861 <p>The procedure <code>expression-parsing-exception-kind</code> returns a
9862 symbol denoting the kind of parsing error that was encountered by the
9863 evaluator or compiler when it raised <var>exc</var>. Here is a table of
9864 the possible return values:
9865 </p>
9866 <table>
9867 <tr><td width="50%"><code>id-expected</code></td><td width="50%">Identifier expected</td></tr>
9868 <tr><td width="50%"><code>ill-formed-namespace</code></td><td width="50%">Ill-formed namespace</td></tr>
9869 <tr><td width="50%"><code>ill-formed-namespace-prefix</code></td><td width="50%">Ill-formed namespace prefix</td></tr>
9870 <tr><td width="50%"><code>namespace-prefix-must-be-string</code></td><td width="50%">Namespace prefix must be a string</td></tr>
9871 <tr><td width="50%"><code>macro-used-as-variable</code></td><td width="50%">Macro name can&rsquo;t be used as a variable</td></tr>
9872 <tr><td width="50%"><code>variable-is-immutable</code></td><td width="50%">Variable is immutable</td></tr>
9873 <tr><td width="50%"><code>ill-formed-macro-transformer</code></td><td width="50%">Macro transformer must be a lambda expression</td></tr>
9874 <tr><td width="50%"><code>reserved-used-as-variable</code></td><td width="50%">Reserved identifier can&rsquo;t be used as a variable</td></tr>
9875 <tr><td width="50%"><code>ill-formed-special-form</code></td><td width="50%">Ill-formed special form</td></tr>
9876 <tr><td width="50%"><code>cannot-open-file</code></td><td width="50%">Can&rsquo;t open file</td></tr>
9877 <tr><td width="50%"><code>filename-expected</code></td><td width="50%">Filename expected</td></tr>
9878 <tr><td width="50%"><code>ill-placed-define</code></td><td width="50%">Ill-placed &rsquo;define&rsquo;</td></tr>
9879 <tr><td width="50%"><code>ill-placed-**include</code></td><td width="50%">Ill-placed &rsquo;##include&rsquo;</td></tr>
9880 <tr><td width="50%"><code>ill-placed-**define-macro</code></td><td width="50%">Ill-placed &rsquo;##define-macro&rsquo;</td></tr>
9881 <tr><td width="50%"><code>ill-placed-**declare</code></td><td width="50%">Ill-placed &rsquo;##declare&rsquo;</td></tr>
9882 <tr><td width="50%"><code>ill-placed-**namespace</code></td><td width="50%">Ill-placed &rsquo;##namespace&rsquo;</td></tr>
9883 <tr><td width="50%"><code>ill-formed-expression</code></td><td width="50%">Ill-formed expression</td></tr>
9884 <tr><td width="50%"><code>unsupported-special-form</code></td><td width="50%">Interpreter does not support</td></tr>
9885 <tr><td width="50%"><code>ill-placed-unquote</code></td><td width="50%">Ill-placed &rsquo;unquote&rsquo;</td></tr>
9886 <tr><td width="50%"><code>ill-placed-unquote-splicing</code></td><td width="50%">Ill-placed &rsquo;unquote-splicing&rsquo;</td></tr>
9887 <tr><td width="50%"><code>parameter-must-be-id</code></td><td width="50%">Parameter must be an identifier</td></tr>
9888 <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>
9889 <tr><td width="50%"><code>duplicate-parameter</code></td><td width="50%">Duplicate parameter in parameter list</td></tr>
9890 <tr><td width="50%"><code>ill-placed-dotted-rest-parameter</code></td><td width="50%">Ill-placed dotted rest parameter</td></tr>
9891 <tr><td width="50%"><code>parameter-expected-after-rest</code></td><td width="50%">#!rest must be followed by a parameter</td></tr>
9892 <tr><td width="50%"><code>ill-formed-default</code></td><td width="50%">Ill-formed default binding</td></tr>
9893 <tr><td width="50%"><code>ill-placed-optional</code></td><td width="50%">Ill-placed #!optional</td></tr>
9894 <tr><td width="50%"><code>ill-placed-rest</code></td><td width="50%">Ill-placed #!rest</td></tr>
9895 <tr><td width="50%"><code>ill-placed-key</code></td><td width="50%">Ill-placed #!key</td></tr>
9896 <tr><td width="50%"><code>key-expected-after-rest</code></td><td width="50%">#!key expected after rest parameter</td></tr>
9897 <tr><td width="50%"><code>ill-placed-default</code></td><td width="50%">Ill-placed default binding</td></tr>
9898 <tr><td width="50%"><code>duplicate-variable-definition</code></td><td width="50%">Duplicate definition of a variable</td></tr>
9899 <tr><td width="50%"><code>empty-body</code></td><td width="50%">Body must contain at least one expression</td></tr>
9900 <tr><td width="50%"><code>variable-must-be-id</code></td><td width="50%">Defined variable must be an identifier</td></tr>
9901 <tr><td width="50%"><code>else-clause-not-last</code></td><td width="50%">Else clause must be last</td></tr>
9902 <tr><td width="50%"><code>ill-formed-selector-list</code></td><td width="50%">Ill-formed selector list</td></tr>
9903 <tr><td width="50%"><code>duplicate-variable-binding</code></td><td width="50%">Duplicate variable in bindings</td></tr>
9904 <tr><td width="50%"><code>ill-formed-binding-list</code></td><td width="50%">Ill-formed binding list</td></tr>
9905 <tr><td width="50%"><code>ill-formed-call</code></td><td width="50%">Ill-formed procedure call</td></tr>
9906 <tr><td width="50%"><code>ill-formed-cond-expand</code></td><td width="50%">Ill-formed &rsquo;cond-expand&rsquo;</td></tr>
9907 <tr><td width="50%"><code>unfulfilled-cond-expand</code></td><td width="50%">Unfulfilled &rsquo;cond-expand&rsquo;</td></tr>
9908 </table>
9910 <p>The procedure <code>expression-parsing-exception-parameters</code> returns a list
9911 of the parameters associated with the parsing error that was
9912 encountered by the evaluator or compiler when it raised <var>exc</var>.
9913 </p>
9914 <p>For example:
9915 </p>
9916 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9917 (if (expression-parsing-exception? exc)
9918 (list (expression-parsing-exception-kind exc)
9919 (expression-parsing-exception-parameters exc))
9920 'not-expression-parsing-exception))</b>
9921 &gt; <b>(with-exception-catcher
9922 handler
9923 (lambda ()
9924 (eval '(+ do 1))))</b>
9925 (reserved-used-as-variable (do))
9926 </pre></td></tr></table>
9930 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9931 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9932 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9933 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9935 <p>Unbound-global-exception objects are raised when an unbound global
9936 variable is accessed. The parameter <var>exc</var> must be an
9937 unbound-global-exception object.
9938 </p>
9939 <p>The procedure <code>unbound-global-exception?</code> returns
9940 <code>#t</code> when <var>obj</var> is an unbound-global-exception
9941 object and <code>#f</code> otherwise.
9942 </p>
9943 <p>The procedure <code>unbound-global-exception-variable</code> returns a
9944 symbol identifying the unbound global variable.
9945 </p>
9946 <p>For example:
9947 </p>
9948 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
9949 (if (unbound-global-exception? exc)
9950 (list 'variable= (unbound-global-exception-variable exc))
9951 'not-unbound-global-exception))</b>
9952 &gt; <b>(with-exception-catcher
9953 handler
9954 (lambda () foo))</b>
9955 (variable= foo)
9956 </pre></td></tr></table>
9960 <hr size="1">
9961 <a name="Exception-objects-related-to-type-checking"></a>
9962 <table cellpadding="1" cellspacing="1" border="0">
9963 <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" alt="Back: 15.7 Exception objects related to evaluation and compilation" align="middle" width="32"></a></td>
9964 <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" alt="Forward: 15.9 Exception objects related to procedure call" align="middle" width="32"></a></td>
9965 <td valign="middle" align="left"> &nbsp; </td>
9966 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
9967 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
9968 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
9969 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
9970 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
9971 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
9972 </tr></table>
9973 <a name="Exception-objects-related-to-type-checking-1"></a>
9974 <h2 class="section">15.8 Exception objects related to type checking</h2>
9976 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9977 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9978 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9979 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9980 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
9982 <p>Type-exception objects are raised when a primitive procedure is called
9983 with an argument of incorrect type (i.e. when a run time type-check
9984 fails). The parameter <var>exc</var> must be a type-exception object.
9985 </p>
9986 <p>The procedure <code>type-exception?</code> returns
9987 <code>#t</code> when <var>obj</var> is a type-exception
9988 object and <code>#f</code> otherwise.
9989 </p>
9990 <p>The procedure <code>type-exception-procedure</code>
9991 returns the procedure that raised <var>exc</var>.
9992 </p>
9993 <p>The procedure <code>type-exception-arguments</code>
9994 returns the list of arguments of the procedure that raised <var>exc</var>.
9995 </p>
9996 <p>The procedure <code>type-exception-arg-num</code> returns the position of the
9997 argument whose type is incorrect. Position 1 is the first argument.
9998 </p>
9999 <p>The procedure <code>type-exception-type-id</code> returns an identifier of
10000 the type expected. The type-id can be a symbol, such as <code>number</code>
10001 and <code>string-or-nonnegative-fixnum</code>, or a record type descriptor.
10002 </p>
10003 <p>For example:
10004 </p>
10005 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10006 (if (type-exception? exc)
10007 (list (type-exception-procedure exc)
10008 (type-exception-arguments exc)
10009 (type-exception-arg-num exc)
10010 (type-exception-type-id exc))
10011 'not-type-exception))</b>
10012 &gt; <b>(with-exception-catcher
10013 handler
10014 (lambda () (vector-ref '#(a b c) 'foo)))</b>
10015 (#&lt;procedure #2 vector-ref&gt; (#(a b c) foo) 2 exact-integer)
10016 &gt; <b>(with-exception-catcher
10017 handler
10018 (lambda () (time-&gt;seconds 'foo)))</b>
10019 (#&lt;procedure #3 time-&gt;seconds&gt; (foo) 1 #&lt;type #4 time&gt;)
10020 </pre></td></tr></table>
10024 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10025 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10026 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10027 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10029 <p>Range-exception objects are raised when a numeric parameter is not in
10030 the allowed range. The parameter <var>exc</var> must be a range-exception
10031 object.
10032 </p>
10033 <p>The procedure <code>range-exception?</code> returns <code>#t</code> when <var>obj</var>
10034 is a range-exception object and <code>#f</code> otherwise.
10035 </p>
10036 <p>The procedure <code>range-exception-procedure</code>
10037 returns the procedure that raised <var>exc</var>.
10038 </p>
10039 <p>The procedure <code>range-exception-arguments</code>
10040 returns the list of arguments of the procedure that raised <var>exc</var>.
10041 </p>
10042 <p>The procedure <code>range-exception-arg-num</code> returns the position of
10043 the argument which is not in the allowed range. Position 1 is the
10044 first argument.
10045 </p>
10046 <p>For example:
10047 </p>
10048 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10049 (if (range-exception? exc)
10050 (list (range-exception-procedure exc)
10051 (range-exception-arguments exc)
10052 (range-exception-arg-num exc))
10053 'not-range-exception))</b>
10054 &gt; <b>(with-exception-catcher
10055 handler
10056 (lambda () (string-ref &quot;abcde&quot; 10)))</b>
10057 (#&lt;procedure #2 string-ref&gt; (&quot;abcde&quot; 10) 2)
10058 </pre></td></tr></table>
10062 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10063 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10064 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10066 <p>Divide-by-zero-exception objects are raised when a division by zero is
10067 attempted. The parameter <var>exc</var> must be a divide-by-zero-exception
10068 object.
10069 </p>
10070 <p>The procedure <code>divide-by-zero-exception?</code> returns
10071 <code>#t</code> when <var>obj</var> is a divide-by-zero-exception
10072 object and <code>#f</code> otherwise.
10073 </p>
10074 <p>The procedure <code>divide-by-zero-exception-procedure</code>
10075 returns the procedure that raised <var>exc</var>.
10076 </p>
10077 <p>The procedure <code>divide-by-zero-exception-arguments</code>
10078 returns the list of arguments of the procedure that raised <var>exc</var>.
10079 </p>
10080 <p>For example:
10081 </p>
10082 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10083 (if (divide-by-zero-exception? exc)
10084 (list (divide-by-zero-exception-procedure exc)
10085 (divide-by-zero-exception-arguments exc))
10086 'not-divide-by-zero-exception))</b>
10087 &gt; <b>(with-exception-catcher
10088 handler
10089 (lambda () (/ 5 0 7)))</b>
10090 (#&lt;procedure #2 /&gt; (5 0 7))
10091 </pre></td></tr></table>
10095 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10096 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10097 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10098 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10100 <p>Improper-length-list-exception objects are raised by the <code>map</code>
10101 and <code>for-each</code> procedures when they are called with two or more
10102 list arguments and the lists are not of the same length. The
10103 parameter <var>exc</var> must be an improper-length-list-exception object.
10104 </p>
10105 <p>The procedure <code>improper-length-list-exception?</code> returns
10106 <code>#t</code> when <var>obj</var> is an improper-length-list-exception
10107 object and <code>#f</code> otherwise.
10108 </p>
10109 <p>The procedure <code>improper-length-list-exception-procedure</code>
10110 returns the procedure that raised <var>exc</var>.
10111 </p>
10112 <p>The procedure <code>improper-length-list-exception-arguments</code>
10113 returns the list of arguments of the procedure that raised <var>exc</var>.
10114 </p>
10115 <p>The procedure <code>improper-length-list-exception-arg-num</code> returns
10116 the position of the argument whose length is the shortest. Position 1
10117 is the first argument.
10118 </p>
10119 <p>For example:
10120 </p>
10121 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10122 (if (improper-length-list-exception? exc)
10123 (list (improper-length-list-exception-procedure exc)
10124 (improper-length-list-exception-arguments exc)
10125 (improper-length-list-exception-arg-num exc))
10126 'not-improper-length-list-exception))</b>
10127 &gt; <b>(with-exception-catcher
10128 handler
10129 (lambda () (map + '(1 2) '(3) '(4 5))))</b>
10130 (#&lt;procedure #2 map&gt; (#&lt;procedure #3 +&gt; (1 2) (3) (4 5)) 3)
10131 </pre></td></tr></table>
10135 <hr size="1">
10136 <a name="Exception-objects-related-to-procedure-call"></a>
10137 <table cellpadding="1" cellspacing="1" border="0">
10138 <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" alt="Back: 15.8 Exception objects related to type checking" align="middle" width="32"></a></td>
10139 <td valign="middle" align="left"><a href="#Other-exception-objects" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 15.10 Other exception objects" align="middle" width="32"></a></td>
10140 <td valign="middle" align="left"> &nbsp; </td>
10141 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
10142 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
10143 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
10144 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10145 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10146 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10147 </tr></table>
10148 <a name="Exception-objects-related-to-procedure-call-1"></a>
10149 <h2 class="section">15.9 Exception objects related to procedure call</h2>
10151 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10152 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10153 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10155 <p>Wrong-number-of-arguments-exception objects are raised when a
10156 procedure is called with the wrong number of arguments. The parameter
10157 <var>exc</var> must be a wrong-number-of-arguments-exception object.
10158 </p>
10159 <p>The procedure <code>wrong-number-of-arguments-exception?</code> returns
10160 <code>#t</code> when <var>obj</var> is a wrong-number-of-arguments-exception
10161 object and <code>#f</code> otherwise.
10162 </p>
10163 <p>The procedure <code>wrong-number-of-arguments-exception-procedure</code>
10164 returns the procedure that raised <var>exc</var>.
10165 </p>
10166 <p>The procedure <code>wrong-number-of-arguments-exception-arguments</code>
10167 returns the list of arguments of the procedure that raised <var>exc</var>.
10168 </p>
10169 <p>For example:
10170 </p>
10171 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10172 (if (wrong-number-of-arguments-exception? exc)
10173 (list (wrong-number-of-arguments-exception-procedure exc)
10174 (wrong-number-of-arguments-exception-arguments exc))
10175 'not-wrong-number-of-arguments-exception))</b>
10176 &gt; <b>(with-exception-catcher
10177 handler
10178 (lambda () (open-input-file &quot;data&quot; 99)))</b>
10179 (#&lt;procedure #2 open-input-file&gt; (&quot;data&quot; 99))
10180 </pre></td></tr></table>
10184 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10185 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10186 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10188 <p>Number-of-arguments-limit-exception objects are raised by the
10189 <code>apply</code> procedure when the procedure being called is passed more
10190 than 8192 arguments. The parameter <var>exc</var> must be a
10191 number-of-arguments-limit-exception object.
10192 </p>
10193 <p>The procedure <code>number-of-arguments-limit-exception?</code> returns
10194 <code>#t</code> when <var>obj</var> is a number-of-arguments-limit-exception
10195 object and <code>#f</code> otherwise.
10196 </p>
10197 <p>The procedure <code>number-of-arguments-limit-exception-procedure</code>
10198 returns the target procedure of the call to <code>apply</code> that raised
10199 <var>exc</var>.
10200 </p>
10201 <p>The procedure <code>number-of-arguments-limit-exception-arguments</code>
10202 returns the list of arguments of the target procedure of the call to
10203 <code>apply</code> that raised <var>exc</var>.
10204 </p>
10205 <p>For example:
10206 </p>
10207 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (iota n) (if (= n 0) '() (cons n (iota (- n 1)))))</b>
10208 &gt; <b>(define (handler exc)
10209 (if (number-of-arguments-limit-exception? exc)
10210 (list (number-of-arguments-limit-exception-procedure exc)
10211 (length (number-of-arguments-limit-exception-arguments exc)))
10212 'not-number-of-arguments-limit-exception))</b>
10213 &gt; <b>(with-exception-catcher
10214 handler
10215 (lambda () (apply + 1 2 3 (iota 8190))))</b>
10216 (#&lt;procedure #2 +&gt; 8193)
10217 </pre></td></tr></table>
10221 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10222 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10223 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10224 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10225 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10227 <p>Nonprocedure-operator-exception objects are raised when a procedure
10228 call is executed and the operator position is not a procedure. The
10229 parameter <var>exc</var> must be an nonprocedure-operator-exception object.
10230 </p>
10231 <p>The procedure <code>nonprocedure-operator-exception?</code> returns
10232 <code>#t</code> when <var>obj</var> is an nonprocedure-operator-exception
10233 object and <code>#f</code> otherwise.
10234 </p>
10235 <p>The procedure <code>nonprocedure-operator-exception-operator</code> returns
10236 the value in operator position of the procedure call that raised
10237 <var>exc</var>.
10238 </p>
10239 <p>The procedure <code>nonprocedure-operator-exception-arguments</code> returns
10240 the list of arguments of the procedure call that raised <var>exc</var>.
10241 </p>
10242 <p>For example:
10243 </p>
10244 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10245 (if (nonprocedure-operator-exception? exc)
10246 (list (nonprocedure-operator-exception-operator exc)
10247 (nonprocedure-operator-exception-arguments exc))
10248 'not-nonprocedure-operator-exception))</b>
10249 &gt; <b>(with-exception-catcher
10250 handler
10251 (lambda () (11 22 33)))</b>
10252 (11 (22 33))
10253 </pre></td></tr></table>
10257 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10258 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10259 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10261 <p>Unknown-keyword-argument-exception objects are raised when a procedure
10262 accepting keyword arguments is called and one of the keywords supplied
10263 is not among those that are expected. The parameter <var>exc</var> must be
10264 an unknown-keyword-argument-exception object.
10265 </p>
10266 <p>The procedure <code>unknown-keyword-argument-exception?</code> returns
10267 <code>#t</code> when <var>obj</var> is an unknown-keyword-argument-exception
10268 object and <code>#f</code> otherwise.
10269 </p>
10270 <p>The procedure <code>unknown-keyword-argument-exception-procedure</code>
10271 returns the procedure that raised <var>exc</var>.
10272 </p>
10273 <p>The procedure <code>unknown-keyword-argument-exception-arguments</code>
10274 returns the list of arguments of the procedure that raised <var>exc</var>.
10275 </p>
10276 <p>For example:
10277 </p>
10278 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10279 (if (unknown-keyword-argument-exception? exc)
10280 (list (unknown-keyword-argument-exception-procedure exc)
10281 (unknown-keyword-argument-exception-arguments exc))
10282 'not-unknown-keyword-argument-exception))</b>
10283 &gt; <b>(with-exception-catcher
10284 handler
10285 (lambda () ((lambda (#!key (foo 5)) foo) bar: 11)))</b>
10286 (#&lt;procedure #2&gt; (bar: 11))
10287 </pre></td></tr></table>
10291 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10292 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10293 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10295 <p>Keyword-expected-exception objects are raised when a procedure
10296 accepting keyword arguments is called and a nonkeyword was supplied
10297 where a keyword was expected. The parameter <var>exc</var> must be an
10298 keyword-expected-exception object.
10299 </p>
10300 <p>The procedure <code>keyword-expected-exception?</code> returns
10301 <code>#t</code> when <var>obj</var> is an keyword-expected-exception
10302 object and <code>#f</code> otherwise.
10303 </p>
10304 <p>The procedure <code>keyword-expected-exception-procedure</code>
10305 returns the procedure that raised <var>exc</var>.
10306 </p>
10307 <p>The procedure <code>keyword-expected-exception-arguments</code>
10308 returns the list of arguments of the procedure that raised <var>exc</var>.
10309 </p>
10310 <p>For example:
10311 </p>
10312 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10313 (if (keyword-expected-exception? exc)
10314 (list (keyword-expected-exception-procedure exc)
10315 (keyword-expected-exception-arguments exc))
10316 'not-keyword-expected-exception))</b>
10317 &gt; <b>(with-exception-catcher
10318 handler
10319 (lambda () ((lambda (#!key (foo 5)) foo) 11 22)))</b>
10320 (#&lt;procedure #2&gt; (11 22))
10321 </pre></td></tr></table>
10325 <hr size="1">
10326 <a name="Other-exception-objects"></a>
10327 <table cellpadding="1" cellspacing="1" border="0">
10328 <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" alt="Back: 15.9 Exception objects related to procedure call" align="middle" width="32"></a></td>
10329 <td valign="middle" align="left"><a href="#Host-environment" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16. Host environment" align="middle" width="32"></a></td>
10330 <td valign="middle" align="left"> &nbsp; </td>
10331 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
10332 <td valign="middle" align="left"><a href="#Exceptions" title="Up section"><img src="button-up.png" border="0" alt="Up: 15. Exceptions" align="middle" width="32"></a></td>
10333 <td valign="middle" align="left"><a href="#Host-environment" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 16. Host environment" align="middle" width="32"></a></td>
10334 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10335 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10336 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10337 </tr></table>
10338 <a name="Other-exception-objects-1"></a>
10339 <h2 class="section">15.10 Other exception objects</h2>
10341 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10342 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10343 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10344 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_error">error</a></b></code><i> <var>message</var> <var>obj</var>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
10346 <p>Error-exception objects are raised when the <code>error</code> procedure is
10347 called. The parameter <var>exc</var> must be an error-exception
10348 object.
10349 </p>
10350 <p>The procedure <code>error-exception?</code> returns
10351 <code>#t</code> when <var>obj</var> is an error-exception
10352 object and <code>#f</code> otherwise.
10353 </p>
10354 <p>The procedure <code>error-exception-message</code> returns the first
10355 argument of the call to <code>error</code> that raised <var>exc</var>.
10356 </p>
10357 <p>The procedure <code>error-exception-parameters</code> returns the list of
10358 arguments, starting with the second argument, of the call to
10359 <code>error</code> that raised <var>exc</var>.
10360 </p>
10361 <p>The <code>error</code> procedure raises an error-exception object whose
10362 message field is <var>message</var> and parameters field is the list of
10363 values <var>obj</var>&hellip;.
10364 </p>
10365 <p>For example:
10366 </p>
10367 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
10368 (if (error-exception? exc)
10369 (list (error-exception-message exc)
10370 (error-exception-parameters exc))
10371 'not-error-exception))</b>
10372 &gt; <b>(with-exception-catcher
10373 handler
10374 (lambda () (error &quot;unexpected object:&quot; 123)))</b>
10375 (&quot;unexpected object:&quot; (123))
10376 </pre></td></tr></table>
10380 <hr size="1">
10381 <a name="Host-environment"></a>
10382 <table cellpadding="1" cellspacing="1" border="0">
10383 <tr><td valign="middle" align="left"><a href="#Other-exception-objects" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 15.10 Other exception objects" align="middle" width="32"></a></td>
10384 <td valign="middle" align="left"><a href="#Handling-of-file-names" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.1 Handling of file names" align="middle" width="32"></a></td>
10385 <td valign="middle" align="left"> &nbsp; </td>
10386 <td valign="middle" align="left"><a href="#Exceptions" title="Beginning of this chapter or previous chapter"><img src="button-left-left.png" border="0" alt="FastBack: 15. Exceptions" align="middle" width="32"></a></td>
10387 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
10388 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10389 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10390 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10391 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10392 </tr></table>
10393 <a name="Host-environment-1"></a>
10394 <h1 class="chapter">16. Host environment</h1>
10396 <p>The host environment is the set of resources, such as the filesystem,
10397 network and processes, that are managed by the operating system within
10398 which the Scheme program is executing. This chapter specifies how the
10399 host environment can be accessed from within the Scheme program.
10400 </p>
10401 <p>In this chapter we say that the Scheme program being executed is a
10402 process, even though the concept of process does not exist in some
10403 operating systems supported by Gambit (e.g. MSDOS).
10404 </p>
10405 <table class="menu" border="0" cellspacing="0">
10406 <tr><td align="left" valign="top"><a href="#Handling-of-file-names">16.1 Handling of file names</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10407 <tr><td align="left" valign="top"><a href="#Filesystem-operations">16.2 Filesystem operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10408 <tr><td align="left" valign="top"><a href="#Shell-command-execution">16.3 Shell command execution</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10409 <tr><td align="left" valign="top"><a href="#Process-termination">16.4 Process termination</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10410 <tr><td align="left" valign="top"><a href="#Command-line-arguments">16.5 Command line arguments</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10411 <tr><td align="left" valign="top"><a href="#Environment-variables">16.6 Environment variables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10412 <tr><td align="left" valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10413 <tr><td align="left" valign="top"><a href="#File-information">16.8 File information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10414 <tr><td align="left" valign="top"><a href="#Group-information">16.9 Group information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10415 <tr><td align="left" valign="top"><a href="#User-information">16.10 User information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10416 <tr><td align="left" valign="top"><a href="#Host-information">16.11 Host information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10417 <tr><td align="left" valign="top"><a href="#Service-information">16.12 Service information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10418 <tr><td align="left" valign="top"><a href="#Protocol-information">16.13 Protocol information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10419 <tr><td align="left" valign="top"><a href="#Network-information">16.14 Network information</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
10420 </table>
10422 <hr size="1">
10423 <a name="Handling-of-file-names"></a>
10424 <table cellpadding="1" cellspacing="1" border="0">
10425 <tr><td valign="middle" align="left"><a href="#Host-environment" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16. Host environment" align="middle" width="32"></a></td>
10426 <td valign="middle" align="left"><a href="#Filesystem-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.2 Filesystem operations" align="middle" width="32"></a></td>
10427 <td valign="middle" align="left"> &nbsp; </td>
10428 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10429 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10430 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10431 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10432 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10433 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10434 </tr></table>
10435 <a name="Handling-of-file-names-1"></a>
10436 <h2 class="section">16.1 Handling of file names</h2>
10437 <a name="index-file-names"></a>
10438 <a name="index-current-working-directory"></a>
10439 <a name="index-absolute-path"></a>
10440 <a name="index-relative-path"></a>
10441 <a name="index-home-directory"></a>
10442 <a name="index-central-installation-directory"></a>
10443 <a name="index-installation-directories"></a>
10445 <p>Gambit uses a naming convention for files that is compatible with
10446 the one used by the host environment but extended to allow
10447 referring to the <em>home directory</em> of the current user or some
10448 specific user and the <em>installation directories</em>.
10449 </p>
10450 <p>A <em>path</em> is a string that denotes a file, for example
10451 <code>&quot;src/readme.txt&quot;</code>. Each component of a path is separated by a
10452 <samp>/</samp> under UNIX and Mac OS X and by a <samp>/</samp> or <samp>\</samp> under
10453 MSDOS and Microsoft Windows. A leading separator indicates an
10454 absolute path under UNIX, Mac OS X, MSDOS and Microsoft Windows. A
10455 path which does not contain a path separator is relative to the
10456 <em>current working directory</em> on all operating systems. A volume
10457 specifier such as <samp>C:</samp> may prefix a file name under MSDOS and
10458 Microsoft Windows.
10459 </p>
10460 <a name="index-_007e_007e"></a>
10461 <p>A path which starts with the characters <samp>~~</samp> denotes a file in an
10462 installation directory. If nothing follows the <samp>~~</samp> then the
10463 directory denoted is the central installation directory. Otherwise
10464 what follows the <samp>~~</samp> is the name of the installation directory,
10465 for example <samp>~~lib</samp> denotes the <samp>lib</samp> installation
10466 directory. Note that the location of the installation directories may
10467 be overridden by using the <samp>-:=<var>DIRECTORY</var></samp> and
10468 <samp>-:~~<var>DIR</var>=<var>DIRECTORY</var></samp> runtime options or by defining
10469 the <samp>GAMBCOPT</samp> environment variable.
10470 </p>
10471 <a name="index-_007e"></a>
10472 <p>A path which starts with the character <samp>~</samp> not followed by
10473 <samp>~</samp> denotes a file in the user&rsquo;s home directory. The user&rsquo;s home
10474 directory is contained in the <samp>HOME</samp> environment variable under
10475 UNIX, Mac OS X, MSDOS and Microsoft Windows. Under MSDOS and
10476 Microsoft Windows, if the <samp>HOME</samp> environment variable is not
10477 defined, the environment variables <samp>HOMEDRIVE</samp> and
10478 <samp>HOMEPATH</samp> are concatenated if they are defined. If this fails
10479 to yield a home directory, the central installation directory is used
10480 instead.
10481 </p>
10482 <a name="index-_007eusername"></a>
10483 <p>A path which starts with the characters <samp>~<var>username</var></samp>
10484 denotes a file in the home directory of the given user. Under UNIX
10485 and Mac OS X this is found using the password file. There is no
10486 equivalent under MSDOS and Microsoft Windows.
10487 </p>
10488 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10490 <a name="index-current-working-directory-1"></a>
10491 <p>The parameter object <code>current-directory</code> is bound to the current
10492 working directory. Calling this procedure with no argument returns
10493 the absolute <em>normalized path</em> of the directory and calling this
10494 procedure with one argument sets the directory to
10495 <var>new-current-directory</var>. The initial binding of this parameter
10496 object is the current working directory of the current process. The
10497 path returned by <code>current-directory</code> always contains a trailing
10498 directory separator. Modifications of the parameter object do not
10499 change the current working directory of the current process (i.e.
10500 that is accessible with the UNIX <code>getcwd()</code> function and the
10501 Microsoft Windows <code>GetCurrentDirectory</code> function). It is an
10502 error to mutate the string returned by <code>current-directory</code>.
10503 </p>
10504 <p>For example under UNIX:
10505 </p>
10506 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(current-directory)</b>
10507 &quot;/Users/feeley/gambit/doc/&quot;
10508 &gt; <b>(current-directory &quot;..&quot;)</b>
10509 &gt; <b>(current-directory)</b>
10510 &quot;/Users/feeley/gambit/&quot;
10511 &gt; <b>(path-expand &quot;foo&quot; &quot;~~&quot;)</b>
10512 &quot;/usr/local/Gambit-C/foo&quot;
10513 &gt; <b>(parameterize ((current-directory &quot;~~&quot;)) (path-expand &quot;foo&quot;))</b>
10514 &quot;/usr/local/Gambit-C/foo&quot;
10515 </pre></td></tr></table>
10519 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10521 <a name="index-absolute-path-1"></a>
10522 <a name="index-relative-path-1"></a>
10523 <p>The procedure <code>path-expand</code> takes the path of a file or directory
10524 and returns an expanded path, which is an absolute path when
10525 <var>path</var> or <var>origin-directory</var> are absolute paths.
10526 The optional <var>origin-directory</var> parameter, which defaults
10527 to the current working directory, is the directory used to resolve
10528 relative paths. Components of the paths <var>path</var> and
10529 <var>origin-directory</var> need not exist.
10530 </p>
10531 <p>For example under UNIX:
10532 </p>
10533 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(path-expand &quot;foo&quot;)</b>
10534 &quot;/Users/feeley/gambit/doc/foo&quot;
10535 &gt; <b>(path-expand &quot;~/foo&quot;)</b>
10536 &quot;/Users/feeley/foo&quot;
10537 &gt; <b>(path-expand &quot;~~lib/foo&quot;)</b>
10538 &quot;/usr/local/Gambit-C/lib/foo&quot;
10539 &gt; <b>(path-expand &quot;../foo&quot;)</b>
10540 &quot;/Users/feeley/gambit/doc/../foo&quot;
10541 &gt; <b>(path-expand &quot;foo&quot; &quot;&quot;)</b>
10542 &quot;foo&quot;
10543 &gt; <b>(path-expand &quot;foo&quot; &quot;/tmp&quot;)</b>
10544 &quot;/tmp/foo&quot;
10545 &gt; <b>(path-expand &quot;this/file/does/not/exist&quot;)</b>
10546 &quot;/Users/feeley/gambit/doc/this/file/does/not/exist&quot;
10547 &gt; <b>(path-expand &quot;&quot;)</b>
10548 &quot;/Users/feeley/gambit/doc/&quot;
10549 </pre></td></tr></table>
10553 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10555 <a name="index-normalized-path"></a>
10556 <p>The procedure <code>path-normalize</code> takes a path of a file or
10557 directory and returns its normalized path. The optional
10558 <var>origin-directory</var> parameter, which defaults to the current
10559 working directory, is the directory used to resolve relative paths.
10560 All components of the paths <var>path</var> and
10561 <var>origin-directory</var> must exist, except possibly the last
10562 component of <var>path</var>. A normalized path is a path
10563 containing no redundant parts and which is consistent with the current
10564 structure of the filesystem. A normalized path of a directory will
10565 always end with a path separator (i.e. <samp>/</samp>, <samp>\</samp>, or <samp>:</samp>
10566 depending on the operating system). The optional
10567 <var>allow-relative?</var> parameter, which defaults to <code>#f</code>,
10568 indicates if the path returned can be expressed relatively to
10569 <var>origin-directory</var>: a <code>#f</code> requests an absolute path,
10570 the symbol <code>shortest</code> requests the shortest of the absolute and
10571 relative paths, and any other value requests the relative path. The
10572 shortest path is useful for interaction with the user because short
10573 relative paths are typically easier to read than long absolute paths.
10574 </p>
10575 <p>For example under UNIX:
10576 </p>
10577 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(path-expand &quot;../foo&quot;)</b>
10578 &quot;/Users/feeley/gambit/doc/../foo&quot;
10579 &gt; <b>(path-normalize &quot;../foo&quot;)</b>
10580 &quot;/Users/feeley/gambit/foo&quot;
10581 &gt; <b>(path-normalize &quot;this/file/does/not/exist&quot;)</b>
10582 *** ERROR IN (console)@3.1 -- No such file or directory
10583 (path-normalize &quot;this/file/does/not/exist&quot;)
10584 </pre></td></tr></table>
10588 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10589 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10590 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10591 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10592 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10593 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10594 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10596 <p>These procedures extract various parts of a path, which need not be a
10597 normalized path. The procedure <code>path-extension</code> returns the file
10598 extension (including the period) or the empty string if there is no
10599 extension. The procedure <code>path-strip-extension</code> returns the path
10600 with the extension stripped off. The procedure <code>path-directory</code>
10601 returns the file&rsquo;s directory (including the last path separator) or
10602 the empty string if no directory is specified in the path. The
10603 procedure <code>path-strip-directory</code> returns the path with the
10604 directory stripped off. The procedure
10605 <code>path-strip-trailing-directory-separator</code> returns the path with
10606 the directory separator stripped off if one is at the end of the path.
10607 The procedure <code>path-volume</code> returns the file&rsquo;s volume (including
10608 the last path separator) or the empty string if no volume is specified
10609 in the path. The procedure <code>path-strip-volume</code> returns the path
10610 with the volume stripped off.
10611 </p>
10612 <p>For example under UNIX:
10613 </p>
10614 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(path-extension &quot;/tmp/foo&quot;)</b>
10615 &quot;&quot;
10616 &gt; <b>(path-extension &quot;/tmp/foo.txt&quot;)</b>
10617 &quot;.txt&quot;
10618 &gt; <b>(path-strip-extension &quot;/tmp/foo.txt&quot;)</b>
10619 &quot;/tmp/foo&quot;
10620 &gt; <b>(path-directory &quot;/tmp/foo.txt&quot;)</b>
10621 &quot;/tmp/&quot;
10622 &gt; <b>(path-strip-directory &quot;/tmp/foo.txt&quot;)</b>
10623 &quot;foo.txt&quot;
10624 &gt; <b>(path-strip-trailing-directory-separator &quot;/usr/local/bin/&quot;)</b>
10625 &quot;/usr/local/bin&quot;
10626 &gt; <b>(path-strip-trailing-directory-separator &quot;/usr/local/bin&quot;)</b>
10627 &quot;/usr/local/bin&quot;
10628 &gt; <b>(path-volume &quot;/tmp/foo.txt&quot;)</b>
10629 &quot;&quot;
10630 &gt; <b>(path-volume &quot;C:/tmp/foo.txt&quot;)</b>
10631 &quot;&quot; <span class="roman"><i>; result is</i></span> &quot;C:&quot; <span class="roman"><i>under Microsoft Windows</i></span>
10632 &gt; <b>(path-strip-volume &quot;C:/tmp/foo.txt&quot;)</b>
10633 &quot;C:/tmp/foo.txt&quot; <span class="roman"><i>; result is</i></span> &quot;/tmp/foo.txt&quot; <span class="roman"><i>under Microsoft Windows</i></span>
10634 </pre></td></tr></table>
10638 <hr size="1">
10639 <a name="Filesystem-operations"></a>
10640 <table cellpadding="1" cellspacing="1" border="0">
10641 <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" alt="Back: 16.1 Handling of file names" align="middle" width="32"></a></td>
10642 <td valign="middle" align="left"><a href="#Shell-command-execution" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.3 Shell command execution" align="middle" width="32"></a></td>
10643 <td valign="middle" align="left"> &nbsp; </td>
10644 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10645 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10646 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10647 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10648 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10649 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10650 </tr></table>
10651 <a name="Filesystem-operations-1"></a>
10652 <h2 class="section">16.2 Filesystem operations</h2>
10654 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10656 <p>This procedure creates a directory. The argument
10657 <var>path-or-settings</var> is either a string denoting a filesystem path
10658 or a list of port settings which must contain a <code>path:</code> setting.
10659 Here are the settings allowed:
10660 </p>
10661 <ul>
10662 <li>
10663 <code>path:</code> <var>string</var>
10665 <p>This setting indicates the location of the directory to create in the
10666 filesystem. There is no default value for this setting.
10667 </p>
10668 </li><li>
10669 <code>permissions:</code> <var>12-bit-exact-integer</var>
10671 <p>This setting controls the UNIX permissions that will be attached to
10672 the file if it is created. The default value of this setting is
10673 <code>#o777</code>.
10674 </p>
10675 </li></ul>
10677 <p>For example:
10678 </p>
10679 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(create-directory &quot;newdir&quot;)</b>
10680 &gt; <b>(create-directory &quot;newdir&quot;)</b>
10681 *** ERROR IN (console)@2.1 -- File exists
10682 (create-directory &quot;newdir&quot;)
10683 </pre></td></tr></table>
10687 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10689 <p>This procedure creates a FIFO. The argument <var>path-or-settings</var> is
10690 either a string denoting a filesystem path or a list of port settings
10691 which must contain a <code>path:</code> setting. Here are the settings
10692 allowed:
10693 </p>
10694 <ul>
10695 <li>
10696 <code>path:</code> <var>string</var>
10698 <p>This setting indicates the location of the FIFO to create in the
10699 filesystem. There is no default value for this setting.
10700 </p>
10701 </li><li>
10702 <code>permissions:</code> <var>12-bit-exact-integer</var>
10704 <p>This setting controls the UNIX permissions that will be attached to
10705 the file if it is created. The default value of this setting is
10706 <code>#o666</code>.
10707 </p>
10708 </li></ul>
10710 <p>For example:
10711 </p>
10712 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(create-fifo &quot;fifo&quot;)</b>
10713 &gt; <b>(define a (open-input-file &quot;fifo&quot;))</b>
10714 &gt; <b>(define b (open-output-file &quot;fifo&quot;))</b>
10715 &gt; <b>(display &quot;1 22 333&quot; b)</b>
10716 &gt; <b>(force-output b)</b>
10717 &gt; <b>(read a)</b>
10719 &gt; <b>(read a)</b>
10721 </pre></td></tr></table>
10725 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10727 <p>This procedure creates a hard link between <var>source-path</var> and
10728 <var>destination-path</var>. The argument <var>source-path</var> must be a
10729 string denoting the path of an existing file. The argument
10730 <var>destination-path</var> must be a string denoting the path of the link
10731 to create.
10732 </p>
10735 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10737 <p>This procedure creates a symbolic link between <var>source-path</var> and
10738 <var>destination-path</var>. The argument <var>source-path</var> must be a
10739 string denoting the path of an existing file. The argument
10740 <var>destination-path</var> must be a string denoting the path of the
10741 symbolic link to create.
10742 </p>
10745 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10747 <p>This procedure renames the file <var>source-path</var> to
10748 <var>destination-path</var>. The argument <var>source-path</var> must be a
10749 string denoting the path of an existing file. The argument
10750 <var>destination-path</var> must be a string denoting the new path of the
10751 file.
10752 </p>
10755 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10757 <p>This procedure copies the file <var>source-path</var> to
10758 <var>destination-path</var>. The argument <var>source-path</var> must be a
10759 string denoting the path of an existing file. The argument
10760 <var>destination-path</var> must be a string denoting the path of the
10761 file to create.
10762 </p>
10765 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10767 <p>This procedure deletes the file <var>path</var>. The argument <var>path</var>
10768 must be a string denoting the path of an existing file.
10769 </p>
10772 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10774 <p>This procedure deletes the directory <var>path</var>. The argument
10775 <var>path</var> must be a string denoting the path of an existing
10776 directory.
10777 </p>
10780 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10782 <p>This procedure returns the list of the files in a directory. The
10783 argument <var>path-or-settings</var> is either a string denoting a
10784 filesystem path to a directory or a list of settings which must
10785 contain a <code>path:</code> setting. If it is not specified,
10786 <var>path-or-settings</var> defaults to the current directory (the value
10787 bound to the <code>current-directory</code> parameter object). Here are the
10788 settings allowed:
10789 </p>
10790 <ul>
10791 <li>
10792 <code>path:</code> <var>string</var>
10794 <p>This setting indicates the location of the directory in the filesystem.
10795 There is no default value for this setting.
10796 </p>
10797 </li><li>
10798 <code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> )
10800 <p>This setting controls whether hidden-files will be returned. Under
10801 UNIX and Mac OS X hidden-files are those that start with a period
10802 (such as <samp>.</samp>, <samp>..</samp>, and <samp>.profile</samp>). Under Microsoft
10803 Windows hidden files are the <samp>.</samp> and <samp>..</samp> entries and the
10804 files whose &ldquo;hidden file&rdquo; attribute is set. A setting of <code>#f</code>
10805 will enumerate all the files. A setting of <code>#t</code> will only
10806 enumerate the files that are not hidden. A setting of
10807 <code>dot-and-dot-dot</code> will enumerate all the files except for the
10808 <samp>.</samp> and <samp>..</samp> hidden files. The default value of this
10809 setting is <code>#t</code>.
10810 </p>
10811 </li></ul>
10813 <p>For example:
10814 </p>
10815 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(directory-files)</b>
10816 (&quot;complex&quot; &quot;README&quot; &quot;simple&quot;)
10817 &gt; <b>(directory-files &quot;../include&quot;)</b>
10818 (&quot;config.h&quot; &quot;config.h.in&quot; &quot;gambit.h&quot; &quot;makefile&quot; &quot;makefile.in&quot;)
10819 &gt; <b>(directory-files (list path: &quot;../include&quot; ignore-hidden: #f))</b>
10820 (&quot;.&quot; &quot;..&quot; &quot;config.h&quot; &quot;config.h.in&quot; &quot;gambit.h&quot; &quot;makefile&quot; &quot;makefile.in&quot;)
10821 </pre></td></tr></table>
10825 <hr size="1">
10826 <a name="Shell-command-execution"></a>
10827 <table cellpadding="1" cellspacing="1" border="0">
10828 <tr><td valign="middle" align="left"><a href="#Filesystem-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.2 Filesystem operations" align="middle" width="32"></a></td>
10829 <td valign="middle" align="left"><a href="#Process-termination" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.4 Process termination" align="middle" width="32"></a></td>
10830 <td valign="middle" align="left"> &nbsp; </td>
10831 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10832 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10833 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10834 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10835 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10836 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10837 </tr></table>
10838 <a name="Shell-command-execution-1"></a>
10839 <h2 class="section">16.3 Shell command execution</h2>
10841 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10843 <p>The procedure <code>shell-command</code> calls up the shell to execute
10844 <var>command</var> which must be a string. This procedure returns
10845 the exit status of the shell in the form that the C library&rsquo;s
10846 <code>system</code> routine returns.
10847 </p>
10848 <p>For example under UNIX:
10849 </p>
10850 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(shell-command &quot;ls -sk f*.scm&quot;)</b>
10851 4 fact.scm 4 fib.scm
10853 </pre></td></tr></table>
10857 <hr size="1">
10858 <a name="Process-termination"></a>
10859 <table cellpadding="1" cellspacing="1" border="0">
10860 <tr><td valign="middle" align="left"><a href="#Shell-command-execution" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.3 Shell command execution" align="middle" width="32"></a></td>
10861 <td valign="middle" align="left"><a href="#Command-line-arguments" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.5 Command line arguments" align="middle" width="32"></a></td>
10862 <td valign="middle" align="left"> &nbsp; </td>
10863 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10864 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10865 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10866 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10867 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10868 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10869 </tr></table>
10870 <a name="Process-termination-1"></a>
10871 <h2 class="section">16.4 Process termination</h2>
10873 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10875 <p>The procedure <code>exit</code> causes the process to terminate with the
10876 status <var>status</var> which must be an exact integer in the range 0 to
10877 255. If it is not specified, <var>status</var> defaults to 0.
10878 </p>
10879 <p>For example under UNIX:
10880 </p>
10881 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi</b>
10882 Gambit v4.6.1
10884 &gt; <b>(exit 42)</b>
10885 $ <b>echo $?</b>
10887 </pre></td></tr></table>
10891 <hr size="1">
10892 <a name="Command-line-arguments"></a>
10893 <table cellpadding="1" cellspacing="1" border="0">
10894 <tr><td valign="middle" align="left"><a href="#Process-termination" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.4 Process termination" align="middle" width="32"></a></td>
10895 <td valign="middle" align="left"><a href="#Environment-variables" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.6 Environment variables" align="middle" width="32"></a></td>
10896 <td valign="middle" align="left"> &nbsp; </td>
10897 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10898 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10899 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10900 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10901 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10902 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10903 </tr></table>
10904 <a name="Command-line-arguments-1"></a>
10905 <h2 class="section">16.5 Command line arguments</h2>
10907 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_command-line">command-line</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
10909 <p>This procedure returns a list of strings corresponding to the command
10910 line arguments, including the program file name as the first element
10911 of the list. When the interpreter executes a Scheme script, the list
10912 returned by <code>command-line</code> contains the script&rsquo;s absolute path
10913 followed by the remaining command line arguments.
10914 </p>
10915 <p>For example under UNIX:
10916 </p>
10917 <table><tr><td>&nbsp;</td><td><pre class="smallexample">$ <b>gsi -:d -e &quot;(pretty-print (command-line))&quot;</b>
10918 (&quot;gsi&quot; &quot;-e&quot; &quot;(pretty-print (command-line))&quot;)
10919 $ <b>cat foo</b>
10920 #!/usr/local/Gambit-C/bin/gsi-script
10921 (pretty-print (command-line))
10922 $ <b>./foo 1 2 &quot;3 4&quot;</b>
10923 (&quot;/u/feeley/./foo&quot; &quot;1&quot; &quot;2&quot; &quot;3 4&quot;)
10924 </pre></td></tr></table>
10928 <hr size="1">
10929 <a name="Environment-variables"></a>
10930 <table cellpadding="1" cellspacing="1" border="0">
10931 <tr><td valign="middle" align="left"><a href="#Command-line-arguments" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.5 Command line arguments" align="middle" width="32"></a></td>
10932 <td valign="middle" align="left"><a href="#Measuring-time" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.7 Measuring time" align="middle" width="32"></a></td>
10933 <td valign="middle" align="left"> &nbsp; </td>
10934 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10935 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10936 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10937 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10938 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10939 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10940 </tr></table>
10941 <a name="Environment-variables-1"></a>
10942 <h2 class="section">16.6 Environment variables</h2>
10944 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10945 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
10947 <p>The procedure <code>getenv</code> returns the value of the environment
10948 variable <var>name</var> of the current process. Variable names are
10949 denoted with strings. A string is returned if the environment
10950 variable is bound, otherwise <var>default</var> is returned if it is
10951 specified, otherwise an exception is raised.
10952 </p>
10953 <p>The procedure <code>setenv</code> changes the binding of the environment
10954 variable <var>name</var> to <var>new-value</var> which must be a string.
10955 If <var>new-value</var> is not specified the binding is removed.
10956 </p>
10957 <p>For example under UNIX:
10958 </p>
10959 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(getenv &quot;HOME&quot;)</b>
10960 &quot;/Users/feeley&quot;
10961 &gt; <b>(getenv &quot;DOES_NOT_EXIST&quot; #f)</b>
10963 &gt; <b>(setenv &quot;DOES_NOT_EXIST&quot; &quot;it does now&quot;)</b>
10964 &gt; <b>(getenv &quot;DOES_NOT_EXIST&quot; #f)</b>
10965 &quot;it does now&quot;
10966 &gt; <b>(setenv &quot;DOES_NOT_EXIST&quot;)</b>
10967 &gt; <b>(getenv &quot;DOES_NOT_EXIST&quot; #f)</b>
10969 &gt; <b>(getenv &quot;DOES_NOT_EXIST&quot;)</b>
10970 *** ERROR IN (console)@7.1 -- Unbound OS environment variable
10971 (getenv &quot;DOES_NOT_EXIST&quot;)
10972 </pre></td></tr></table>
10976 <hr size="1">
10977 <a name="Measuring-time"></a>
10978 <table cellpadding="1" cellspacing="1" border="0">
10979 <tr><td valign="middle" align="left"><a href="#Environment-variables" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.6 Environment variables" align="middle" width="32"></a></td>
10980 <td valign="middle" align="left"><a href="#File-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.8 File information" align="middle" width="32"></a></td>
10981 <td valign="middle" align="left"> &nbsp; </td>
10982 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
10983 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
10984 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
10985 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
10986 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
10987 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
10988 </tr></table>
10989 <a name="Measuring-time-1"></a>
10990 <h2 class="section">16.7 Measuring time</h2>
10992 <p>Procedures are available for measuring real time (aka &ldquo;wall&rdquo; time)
10993 and cpu time (the amount of time the cpu has been executing the
10994 process). The resolution of the real time and cpu time clock is
10995 operating system dependent. Typically the resolution of the cpu time
10996 clock is rather coarse (measured in &ldquo;ticks&rdquo; of 1/60th or 1/100th of
10997 a second). Real time is internally computed relative to some
10998 arbitrary point in time using floating point numbers, which means that
10999 there is a gradual loss of resolution as time elapses. Moreover, some
11000 operating systems report time in number of ticks using a 32 bit
11001 integer so the value returned by the time related procedures may
11002 wraparound much before any significant loss of resolution occurs (for
11003 example 2.7 years if ticks are 1/50th of a second).
11004 </p>
11005 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_current-time">current-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11006 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11007 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_time-%3Eseconds">time-&gt;seconds</a></b></code><i> <var>time</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
11008 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_seconds-%3Etime">seconds-&gt;time</a></b></code><i> <var>x</var></i><code>)</code></td><td align="right">procedure</td></tr></table>
11010 <p>The procedure <code>current-time</code> returns a <em>time object</em>
11011 representing the current point in real time.
11012 </p>
11013 <p>The procedure <code>time?</code> returns <code>#t</code> when <var>obj</var> is a time
11014 object and <code>#f</code> otherwise.
11015 </p>
11016 <p>The procedure <code>time-&gt;seconds</code> converts the time object <var>time</var>
11017 into an inexact real number representing the number of seconds elapsed
11018 since the &ldquo;epoch&rdquo; (which is 00:00:00 Coordinated Universal Time
11019 01-01-1970).
11020 </p>
11021 <p>The procedure <code>seconds-&gt;time</code> converts the real number <var>x</var>
11022 representing the number of seconds elapsed since the &ldquo;epoch&rdquo; into a
11023 time object.
11024 </p>
11025 <p>For example:
11026 </p>
11027 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(current-time)</b>
11028 #&lt;time #2&gt;
11029 &gt; <b>(time? (current-time))</b>
11031 &gt; <b>(time? 123)</b>
11033 &gt; <b>(time-&gt;seconds (current-time))</b>
11034 1083118758.63973
11035 &gt; <b>(time-&gt;seconds (current-time))</b>
11036 1083118759.909163
11037 &gt; <b>(seconds-&gt;time (+ 10 (time-&gt;seconds (current-time))</b>
11038 #&lt;time #3&gt; <span class="roman"><i>; a time object representing 10 seconds in the future</i></span>
11039 </pre></td></tr></table>
11043 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_process-times">process-times</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11044 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_cpu-time">cpu-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11045 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_real-time">real-time</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11047 <p>The procedure <code>process-times</code> returns a three element f64vector
11048 containing the cpu time that has been used by the program and the real
11049 time that has elapsed since it was started. The first element
11050 corresponds to &ldquo;user&rdquo; time in seconds, the second element
11051 corresponds to &ldquo;system&rdquo; time in seconds and the third element is the
11052 elapsed real time in seconds. On operating systems that can&rsquo;t
11053 differentiate user and system time, the system time is zero. On
11054 operating systems that can&rsquo;t measure cpu time, the user time is equal
11055 to the elapsed real time and the system time is zero.
11056 </p>
11057 <p>The procedure <code>cpu-time</code> returns the cpu time in seconds that has
11058 been used by the program (user time plus system time).
11059 </p>
11060 <p>The procedure <code>real-time</code> returns the real time that has elapsed
11061 since the program was started.
11062 </p>
11063 <p>For example:
11064 </p>
11065 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(process-times)</b>
11066 #f64(.02794 .021754 .159926176071167)
11067 &gt; <b>(cpu-time)</b>
11068 .051223
11069 &gt; <b>(real-time)</b>
11070 .40660619735717773
11071 </pre></td></tr></table>
11075 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_time">time</a></b></code><i> <span class="roman"><i>expr</i></span></i><code>)</code></td><td align="right">special form</td></tr></table>
11077 <p>The <code>time</code> special form evaluates <i>expr</i> and returns the
11078 result. As a side effect it displays a message on the interaction
11079 channel which indicates how long the evaluation took (in real time and
11080 cpu time), how much time was spent in the garbage collector, how much
11081 memory was allocated during the evaluation and how many minor and
11082 major page faults occured (0 is reported if not running under UNIX).
11083 </p>
11084 <p>For example:
11085 </p>
11086 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (f x)
11087 (let loop ((x x) (lst '()))
11088 (if (= x 0)
11090 (loop (- x 1) (cons x lst)))))</b>
11091 &gt; <b>(length (time (f 100000)))</b>
11092 (time (f 100000))
11093 683 ms real time
11094 558 ms cpu time (535 user, 23 system)
11095 8 collections accounting for 102 ms real time (70 user, 5 system)
11096 6400160 bytes allocated
11097 no minor faults
11098 no major faults
11099 100000
11100 </pre></td></tr></table>
11104 <hr size="1">
11105 <a name="File-information"></a>
11106 <table cellpadding="1" cellspacing="1" border="0">
11107 <tr><td valign="middle" align="left"><a href="#Measuring-time" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.7 Measuring time" align="middle" width="32"></a></td>
11108 <td valign="middle" align="left"><a href="#Group-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.9 Group information" align="middle" width="32"></a></td>
11109 <td valign="middle" align="left"> &nbsp; </td>
11110 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
11111 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
11112 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
11113 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
11114 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
11115 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
11116 </tr></table>
11117 <a name="File-information-1"></a>
11118 <h2 class="section">16.8 File information</h2>
11120 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11122 <p>The <var>path</var> argument must be a string. This procedure returns
11123 <code>#t</code> when a file by that name exists, and returns <code>#f</code>
11124 otherwise.
11125 </p>
11126 <p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be
11127 chased, in other words if <var>path</var> refers to a symbolic link,
11128 <code>file-exists?</code> will return <code>#t</code> whether or not it points to
11129 an existing file.
11130 </p>
11131 <p>For example:
11132 </p>
11133 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-exists? &quot;nofile&quot;)</b>
11135 </pre></td></tr></table>
11139 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11141 <p>This procedure accesses the filesystem to get information about the
11142 file whose location is given by the string <var>path</var>. A
11143 file-information record is returned that contains the file&rsquo;s type, the
11144 device number, the inode number, the mode (permission bits), the
11145 number of links, the file&rsquo;s user id, the file&rsquo;s group id, the file&rsquo;s
11146 size in bytes, the times of last-access, last-modification and
11147 last-change, the attributes, and the creation time.
11148 </p>
11149 <p>When <var>chase?</var> is present and <code>#f</code>, symbolic links will not be
11150 chased, in other words if <var>path</var> refers to a symbolic link the
11151 <code>file-info</code> procedure will return information about the link
11152 rather than the file it links to.
11153 </p>
11154 <p>For example:
11155 </p>
11156 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info &quot;/dev/tty&quot;)</b>
11157 #&lt;file-info #2
11158 type: character-special
11159 device: 19513156
11160 inode: 20728196
11161 mode: 438
11162 number-of-links: 1
11163 owner: 0
11164 group: 0
11165 size: 0
11166 last-access-time: #&lt;time #3&gt;
11167 last-modification-time: #&lt;time #4&gt;
11168 last-change-time: #&lt;time #5&gt;
11169 attributes: 128
11170 creation-time: #&lt;time #6&gt;&gt;
11171 </pre></td></tr></table>
11175 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11177 <p>This procedure returns <code>#t</code> when <var>obj</var> is a file-information
11178 record and <code>#f</code> otherwise.
11179 </p>
11180 <p>For example:
11181 </p>
11182 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info? (file-info &quot;/dev/tty&quot;))</b>
11184 &gt; <b>(file-info? 123)</b>
11186 </pre></td></tr></table>
11190 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11192 <p>Returns the type field of the file-information record
11193 <var>file-info</var>. The type is denoted by a symbol.
11194 The following types are possible:
11195 </p>
11196 <dl compact="compact">
11197 <dt> <code>regular</code></dt>
11198 <dd><p>Regular file
11199 </p></dd>
11200 <dt> <code>directory</code></dt>
11201 <dd><p>Directory
11202 </p></dd>
11203 <dt> <code>character-special</code></dt>
11204 <dd><p>Character special device
11205 </p></dd>
11206 <dt> <code>block-special</code></dt>
11207 <dd><p>Block special device
11208 </p></dd>
11209 <dt> <code>fifo</code></dt>
11210 <dd><p>FIFO
11211 </p></dd>
11212 <dt> <code>symbolic-link</code></dt>
11213 <dd><p>Symbolic link
11214 </p></dd>
11215 <dt> <code>socket</code></dt>
11216 <dd><p>Socket
11217 </p></dd>
11218 <dt> <code>unknown</code></dt>
11219 <dd><p>File is of an unknown type
11220 </p></dd>
11221 </dl>
11223 <p>For example:
11224 </p>
11225 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-type (file-info &quot;/dev/tty&quot;))</b>
11226 character-special
11227 &gt; <b>(file-info-type (file-info &quot;/dev&quot;))</b>
11228 directory
11229 </pre></td></tr></table>
11233 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11235 <p>Returns the device field of the file-information record
11236 <var>file-info</var>.
11237 </p>
11238 <p>For example:
11239 </p>
11240 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-device (file-info &quot;/dev/tty&quot;))</b>
11241 19513156
11242 </pre></td></tr></table>
11246 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11248 <p>Returns the inode field of the file-information record
11249 <var>file-info</var>.
11250 </p>
11251 <p>For example:
11252 </p>
11253 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-inode (file-info &quot;/dev/tty&quot;))</b>
11254 20728196
11255 </pre></td></tr></table>
11259 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11261 <p>Returns the mode field of the file-information record
11262 <var>file-info</var>.
11263 </p>
11264 <p>For example:
11265 </p>
11266 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-mode (file-info &quot;/dev/tty&quot;))</b>
11268 </pre></td></tr></table>
11272 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11274 <p>Returns the number-of-links field of the file-information record
11275 <var>file-info</var>.
11276 </p>
11277 <p>For example:
11278 </p>
11279 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-number-of-links (file-info &quot;/dev/tty&quot;))</b>
11281 </pre></td></tr></table>
11285 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11287 <p>Returns the owner field of the file-information record
11288 <var>file-info</var>.
11289 </p>
11290 <p>For example:
11291 </p>
11292 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-owner (file-info &quot;/dev/tty&quot;))</b>
11294 </pre></td></tr></table>
11298 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11300 <p>Returns the group field of the file-information record
11301 <var>file-info</var>.
11302 </p>
11303 <p>For example:
11304 </p>
11305 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-group (file-info &quot;/dev/tty&quot;))</b>
11307 </pre></td></tr></table>
11311 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11313 <p>Returns the size field of the file-information record
11314 <var>file-info</var>.
11315 </p>
11316 <p>For example:
11317 </p>
11318 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-size (file-info &quot;/dev/tty&quot;))</b>
11320 </pre></td></tr></table>
11324 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11326 <p>Returns the last-access-time field of the file-information record
11327 <var>file-info</var>.
11328 </p>
11329 <p>For example:
11330 </p>
11331 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-last-access-time (file-info &quot;/dev/tty&quot;))</b>
11332 #&lt;time #2&gt;
11333 </pre></td></tr></table>
11337 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11339 <p>Returns the last-modification-time field of the file-information record
11340 <var>file-info</var>.
11341 </p>
11342 <p>For example:
11343 </p>
11344 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-last-modification-time (file-info &quot;/dev/tty&quot;))</b>
11345 #&lt;time #2&gt;
11346 </pre></td></tr></table>
11350 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11352 <p>Returns the last-change-time field of the file-information record
11353 <var>file-info</var>.
11354 </p>
11355 <p>For example:
11356 </p>
11357 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-last-change-time (file-info &quot;/dev/tty&quot;))</b>
11358 #&lt;time #2&gt;
11359 </pre></td></tr></table>
11363 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11365 <p>Returns the attributes field of the file-information record
11366 <var>file-info</var>.
11367 </p>
11368 <p>For example:
11369 </p>
11370 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-attributes (file-info &quot;/dev/tty&quot;))</b>
11372 </pre></td></tr></table>
11376 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11378 <p>Returns the creation-time field of the file-information record
11379 <var>file-info</var>.
11380 </p>
11381 <p>For example:
11382 </p>
11383 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(file-info-creation-time (file-info &quot;/dev/tty&quot;))</b>
11384 #&lt;time #2&gt;
11385 </pre></td></tr></table>
11389 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11390 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11391 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11392 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11393 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11394 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11395 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11396 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11397 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11398 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11399 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11400 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11401 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11403 <p>These procedures combine a call to the <code>file-info</code> procedure and
11404 a call to a file-information record field accessor. For instance
11405 <code>(file-type <var>path</var>)</code> is equivalent to <code>(file-info-type
11406 (file-info <var>path</var>))</code>.
11407 </p>
11410 <hr size="1">
11411 <a name="Group-information"></a>
11412 <table cellpadding="1" cellspacing="1" border="0">
11413 <tr><td valign="middle" align="left"><a href="#File-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.8 File information" align="middle" width="32"></a></td>
11414 <td valign="middle" align="left"><a href="#User-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.10 User information" align="middle" width="32"></a></td>
11415 <td valign="middle" align="left"> &nbsp; </td>
11416 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
11417 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
11418 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
11419 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
11420 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
11421 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
11422 </tr></table>
11423 <a name="Group-information-1"></a>
11424 <h2 class="section">16.9 Group information</h2>
11426 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11428 <p>This procedure accesses the group database to get information about the
11429 group identified by <var>group-name-or-id</var>, which is the group&rsquo;s symbolic
11430 name (string) or the group&rsquo;s GID (exact integer). A group-information
11431 record is returned that contains the group&rsquo;s symbolic name, the group&rsquo;s
11432 id (GID), and the group&rsquo;s members (list of symbolic user names).
11433 </p>
11434 <p>For example:
11435 </p>
11436 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(group-info &quot;staff&quot;)</b>
11437 #&lt;group-info #2 name: &quot;staff&quot; gid: 20 members: (&quot;root&quot;)&gt;
11438 &gt; <b>(group-info 29)</b>
11439 #&lt;group-info #3
11440 name: &quot;certusers&quot;
11441 gid: 29
11442 members: (&quot;root&quot; &quot;jabber&quot; &quot;postfix&quot; &quot;cyrusimap&quot;)&gt;
11443 &gt; <b>(group-info 5000)</b>
11444 *** ERROR IN (console)@3.1 -- Resource temporarily unavailable
11445 (group-info 5000)
11446 </pre></td></tr></table>
11450 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11452 <p>This procedure returns <code>#t</code> when <var>obj</var> is a group-information
11453 record and <code>#f</code> otherwise.
11454 </p>
11455 <p>For example:
11456 </p>
11457 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(group-info? (group-info &quot;daemon&quot;))</b>
11459 &gt; <b>(group-info? 123)</b>
11461 </pre></td></tr></table>
11465 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11467 <p>Returns the symbolic name field of the group-information record
11468 <var>group-info</var>.
11469 </p>
11470 <p>For example:
11471 </p>
11472 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(group-info-name (group-info 29))</b>
11473 &quot;certusers&quot;
11474 </pre></td></tr></table>
11478 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11480 <p>Returns the group id field of the group-information record
11481 <var>group-info</var>.
11482 </p>
11483 <p>For example:
11484 </p>
11485 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(group-info-gid (group-info &quot;staff&quot;))</b>
11487 </pre></td></tr></table>
11491 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11493 <p>Returns the members field of the group-information record
11494 <var>group-info</var>.
11495 </p>
11496 <p>For example:
11497 </p>
11498 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(group-info-members (group-info &quot;staff&quot;))</b>
11499 (&quot;root&quot;)
11500 </pre></td></tr></table>
11504 <hr size="1">
11505 <a name="User-information"></a>
11506 <table cellpadding="1" cellspacing="1" border="0">
11507 <tr><td valign="middle" align="left"><a href="#Group-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.9 Group information" align="middle" width="32"></a></td>
11508 <td valign="middle" align="left"><a href="#Host-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.11 Host information" align="middle" width="32"></a></td>
11509 <td valign="middle" align="left"> &nbsp; </td>
11510 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
11511 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
11512 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
11513 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
11514 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
11515 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
11516 </tr></table>
11517 <a name="User-information-1"></a>
11518 <h2 class="section">16.10 User information</h2>
11520 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_user-name">user-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11522 <p>This procedure returns the user&rsquo;s name as a string.
11523 </p>
11524 <p>For example:
11525 </p>
11526 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-name)</b>
11527 &quot;feeley&quot;
11528 </pre></td></tr></table>
11532 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11534 <p>This procedure accesses the user database to get information about the
11535 user identified by <var>user-name-or-id</var>, which is the user&rsquo;s symbolic
11536 name (string) or the user&rsquo;s UID (exact integer). A user-information
11537 record is returned that contains the user&rsquo;s symbolic name, the user&rsquo;s
11538 id (UID), the user&rsquo;s group id (GID), the path to the user&rsquo;s home
11539 directory, and the user&rsquo;s login shell.
11540 </p>
11541 <p>For example:
11542 </p>
11543 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info &quot;feeley&quot;)</b>
11544 #&lt;user-info #2
11545 name: &quot;feeley&quot;
11546 uid: 506
11547 gid: 506
11548 home: &quot;/Users/feeley&quot;
11549 shell: &quot;/bin/bash&quot;&gt;
11550 &gt; <b>(user-info 0)</b>
11551 #&lt;user-info #3 name: &quot;root&quot; uid: 0 gid: 0 home: &quot;/var/root&quot; shell: &quot;/bin/sh&quot;&gt;
11552 &gt; <b>(user-info 5000)</b>
11553 *** ERROR IN (console)@3.1 -- Resource temporarily unavailable
11554 (user-info 5000)
11555 </pre></td></tr></table>
11559 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11561 <p>This procedure returns <code>#t</code> when <var>obj</var> is a user-information
11562 record and <code>#f</code> otherwise.
11563 </p>
11564 <p>For example:
11565 </p>
11566 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info? (user-info &quot;feeley&quot;))</b>
11568 &gt; <b>(user-info? 123)</b>
11570 </pre></td></tr></table>
11574 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11576 <p>Returns the symbolic name field of the user-information record
11577 <var>user-info</var>.
11578 </p>
11579 <p>For example:
11580 </p>
11581 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info-name (user-info 0))</b>
11582 &quot;root&quot;
11583 </pre></td></tr></table>
11587 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11589 <p>Returns the user id field of the user-information record
11590 <var>user-info</var>.
11591 </p>
11592 <p>For example:
11593 </p>
11594 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info-uid (user-info &quot;feeley&quot;))</b>
11596 </pre></td></tr></table>
11600 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11602 <p>Returns the group id field of the user-information record
11603 <var>user-info</var>.
11604 </p>
11605 <p>For example:
11606 </p>
11607 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info-gid (user-info &quot;feeley&quot;))</b>
11609 </pre></td></tr></table>
11613 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11615 <p>Returns the home directory field of the user-information record
11616 <var>user-info</var>.
11617 </p>
11618 <p>For example:
11619 </p>
11620 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info-home (user-info 0))</b>
11621 &quot;/var/root&quot;
11622 </pre></td></tr></table>
11626 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11628 <p>Returns the shell field of the user-information record
11629 <var>user-info</var>.
11630 </p>
11631 <p>For example:
11632 </p>
11633 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(user-info-shell (user-info 0))</b>
11634 &quot;/bin/sh&quot;
11635 </pre></td></tr></table>
11639 <hr size="1">
11640 <a name="Host-information"></a>
11641 <table cellpadding="1" cellspacing="1" border="0">
11642 <tr><td valign="middle" align="left"><a href="#User-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.10 User information" align="middle" width="32"></a></td>
11643 <td valign="middle" align="left"><a href="#Service-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.12 Service information" align="middle" width="32"></a></td>
11644 <td valign="middle" align="left"> &nbsp; </td>
11645 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
11646 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
11647 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
11648 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
11649 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
11650 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
11651 </tr></table>
11652 <a name="Host-information-1"></a>
11653 <h2 class="section">16.11 Host information</h2>
11655 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_host-name">host-name</a></b></code><code>)</code></td><td align="right">procedure</td></tr></table>
11657 <p>This procedure returns the machine&rsquo;s host name as a string.
11658 </p>
11659 <p>For example:
11660 </p>
11661 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-name)</b>
11662 &quot;mega.iro.umontreal.ca&quot;
11663 </pre></td></tr></table>
11667 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11669 <p>This procedure accesses the internet host database to get information
11670 about the machine whose name is denoted by the string <var>host-name</var>.
11671 A host-information record is returned that contains the official name
11672 of the machine, a list of aliases (alternative names), and a non-empty
11673 list of IP addresses for this machine. An exception is raised when
11674 <var>host-name</var> does not appear in the database.
11675 </p>
11676 <p>For example:
11677 </p>
11678 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-info &quot;www.google.com&quot;)</b>
11679 #&lt;host-info #2
11680 name: &quot;www.l.google.com&quot;
11681 aliases: (&quot;www.google.com&quot;)
11682 addresses: (#u8(66 249 85 99) #u8(66 249 85 104))&gt;
11683 &gt; <b>(host-info &quot;unknown.domain&quot;)</b>
11684 *** ERROR IN (console)@2.1 -- Unknown host
11685 (host-info &quot;unknown.domain&quot;)
11686 </pre></td></tr></table>
11690 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11692 <p>This procedure returns <code>#t</code> when <var>obj</var> is a host-information
11693 record and <code>#f</code> otherwise.
11694 </p>
11695 <p>For example:
11696 </p>
11697 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-info? (host-info &quot;www.google.com&quot;))</b>
11699 &gt; <b>(host-info? 123)</b>
11701 </pre></td></tr></table>
11705 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11707 <p>Returns the official name field of the host-information record
11708 <var>host-info</var>.
11709 </p>
11710 <p>For example:
11711 </p>
11712 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-info-name (host-info &quot;www.google.com&quot;))</b>
11713 &quot;www.l.google.com&quot;
11714 </pre></td></tr></table>
11718 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11720 <p>Returns the aliases field of the host-information record
11721 <var>host-info</var>. This field is a possibly empty list of strings.
11722 </p>
11723 <p>For example:
11724 </p>
11725 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-info-aliases (host-info &quot;www.google.com&quot;))</b>
11726 (&quot;www.google.com&quot;)
11727 </pre></td></tr></table>
11731 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11733 <p>Returns the addresses field of the host-information record
11734 <var>host-info</var>. This field is a non-empty list of u8vectors
11735 denoting IP addresses.
11736 </p>
11737 <p>For example:
11738 </p>
11739 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(host-info-addresses (host-info &quot;www.google.com&quot;))</b>
11740 (#u8(66 249 85 99) #u8(66 249 85 104))
11741 </pre></td></tr></table>
11745 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11747 <p>This procedure is an interface to the <code>getaddrinfo</code> system call.
11748 It accesses the internet host database to get information about the
11749 machine whose name is denoted by the string <var>host</var> and service is
11750 denoted by the string <var>service</var> and network address family is
11751 <var>family</var> (<code>INET</code> or <code>INET6</code>) and network socket-type is
11752 <var>socket-type</var> (<code>STREAM</code> or <code>DGRAM</code> or <code>RAW</code>) and
11753 network protocol is <var>socket-type</var> (<code>TCP</code> or <code>UDP</code>). A
11754 list of address-information records is returned.
11755 </p>
11756 <p>For example:
11757 </p>
11758 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(address-infos host: &quot;ftp.at.debian.org&quot;)</b>
11759 (#&lt;address-info #2
11760 family: INET6
11761 socket-type: DGRAM
11762 protocol: UDP
11763 socket-info:
11764 #&lt;socket-info #3
11765 family: INET6
11766 port-number: 0
11767 address: #u16(8193 2136 2 1 0 0 0 16)&gt;&gt;
11768 #&lt;address-info #4
11769 family: INET6
11770 socket-type: STREAM
11771 protocol: TCP
11772 socket-info:
11773 #&lt;socket-info #5
11774 family: INET6
11775 port-number: 0
11776 address: #u16(8193 2136 2 1 0 0 0 16)&gt;&gt;
11777 #&lt;address-info #6
11778 family: INET
11779 socket-type: DGRAM
11780 protocol: UDP
11781 socket-info:
11782 #&lt;socket-info #7
11783 family: INET
11784 port-number: 0
11785 address: #u8(213 129 232 18)&gt;&gt;
11786 #&lt;address-info #8
11787 family: INET
11788 socket-type: STREAM
11789 protocol: TCP
11790 socket-info:
11791 #&lt;socket-info #9
11792 family: INET
11793 port-number: 0
11794 address: #u8(213 129 232 18)&gt;&gt;)
11795 &gt; <b>(address-infos host: &quot;ftp.at.debian.org&quot;
11796 family: 'INET
11797 protocol: 'TCP)</b>
11798 (#&lt;address-info #10
11799 family: INET
11800 socket-type: STREAM
11801 protocol: TCP
11802 socket-info:
11803 #&lt;socket-info #11
11804 family: INET
11805 port-number: 0
11806 address: #u8(213 129 232 18)&gt;&gt;)
11807 &gt; <b>(address-infos host: &quot;unknown.domain&quot;)</b>
11808 *** ERROR IN (console)@5.1 -- nodename nor servname provided, or not known
11809 (address-infos host: &quot;unknown.domain&quot;)
11810 </pre></td></tr></table>
11814 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11816 <p>This procedure returns <code>#t</code> when <var>obj</var> is an address-information
11817 record and <code>#f</code> otherwise.
11818 </p>
11819 <p>For example:
11820 </p>
11821 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map address-info?
11822 (address-infos host: &quot;ftp.at.debian.org&quot;))</b>
11823 (#t #t #t #t)
11824 &gt; <b>(address-info? 123)</b>
11826 </pre></td></tr></table>
11830 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11832 <p>Returns the family field of the address-information record
11833 <var>address-info</var>.
11834 </p>
11835 <p>For example:
11836 </p>
11837 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map address-info-family
11838 (address-infos host: &quot;ftp.at.debian.org&quot;))</b>
11839 (INET6 INET6 INET INET)
11840 </pre></td></tr></table>
11844 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11846 <p>Returns the socket-type field of the address-information record
11847 <var>address-info</var>.
11848 </p>
11849 <p>For example:
11850 </p>
11851 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map address-info-socket-type
11852 (address-infos host: &quot;ftp.at.debian.org&quot;))</b>
11853 (DGRAM STREAM DGRAM STREAM)
11854 </pre></td></tr></table>
11858 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11860 <p>Returns the protocol field of the address-information record
11861 <var>address-info</var>.
11862 </p>
11863 <p>For example:
11864 </p>
11865 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map address-info-protocol
11866 (address-infos host: &quot;ftp.at.debian.org&quot;))</b>
11867 (UDP TCP UDP TCP)
11868 </pre></td></tr></table>
11872 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11874 <p>Returns the socket-info field of the address-information record
11875 <var>address-info</var>.
11876 </p>
11877 <p>For example:
11878 </p>
11879 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(map address-info-socket-info
11880 (address-infos host: &quot;ftp.at.debian.org&quot;))</b>
11881 (#&lt;socket-info #2
11882 family: INET6
11883 port-number: 0
11884 address: #u16(8193 2136 2 1 0 0 0 16)&gt;
11885 #&lt;socket-info #3
11886 family: INET6
11887 port-number: 0
11888 address: #u16(8193 2136 2 1 0 0 0 16)&gt;
11889 #&lt;socket-info #4
11890 family: INET
11891 port-number: 0
11892 address: #u8(213 129 232 18)&gt;
11893 #&lt;socket-info #5
11894 family: INET
11895 port-number: 0
11896 address: #u8(213 129 232 18)&gt;)
11897 </pre></td></tr></table>
11901 <hr size="1">
11902 <a name="Service-information"></a>
11903 <table cellpadding="1" cellspacing="1" border="0">
11904 <tr><td valign="middle" align="left"><a href="#Host-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.11 Host information" align="middle" width="32"></a></td>
11905 <td valign="middle" align="left"><a href="#Protocol-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.13 Protocol information" align="middle" width="32"></a></td>
11906 <td valign="middle" align="left"> &nbsp; </td>
11907 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
11908 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
11909 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
11910 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
11911 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
11912 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
11913 </tr></table>
11914 <a name="Service-information-1"></a>
11915 <h2 class="section">16.12 Service information</h2>
11917 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11919 <p>This procedure accesses the service database to get information about
11920 the service identified by <var>service-name-or-id</var>, which is the
11921 service&rsquo;s symbolic name (string) or the service&rsquo;s port number (exact
11922 integer). A service-information record is returned that contains the
11923 service&rsquo;s symbolic name, a list of aliases (alternative names), the
11924 port number (exact integer), and the protocol name (string). An
11925 exception is raised when <var>service-name-or-id</var> does not appear in
11926 the database.
11927 </p>
11928 <p>For example:
11929 </p>
11930 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info &quot;http&quot;)</b>
11931 #&lt;service-info #2
11932 name: &quot;http&quot;
11933 aliases: (&quot;www&quot; &quot;www-http&quot;)
11934 port-number: 80
11935 protocol: &quot;udp&quot;&gt;
11936 &gt; <b>(service-info 80)</b>
11937 #&lt;service-info #3
11938 name: &quot;http&quot;
11939 aliases: (&quot;www&quot; &quot;www-http&quot;)
11940 port-number: 80
11941 protocol: &quot;udp&quot;&gt;
11942 </pre></td></tr></table>
11946 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11948 <p>This procedure returns <code>#t</code> when <var>obj</var> is a service-information
11949 record and <code>#f</code> otherwise.
11950 </p>
11951 <p>For example:
11952 </p>
11953 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info? (service-info &quot;http&quot;))</b>
11955 &gt; <b>(service-info? 123)</b>
11957 </pre></td></tr></table>
11961 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11963 <p>Returns the symbolic name field of the service-information record
11964 <var>service-info</var>.
11965 </p>
11966 <p>For example:
11967 </p>
11968 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info-name (service-info 80))</b>
11969 &quot;http&quot;
11970 </pre></td></tr></table>
11974 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11976 <p>Returns the aliases field of the service-information record
11977 <var>service-info</var>. This field is a possibly empty list of strings.
11978 </p>
11979 <p>For example:
11980 </p>
11981 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info-aliases (service-info &quot;http&quot;))</b>
11982 (&quot;www&quot; &quot;www-http&quot;)
11983 </pre></td></tr></table>
11987 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
11989 <p>Returns the service port number field of the service-information
11990 record <var>service-info</var>.
11991 </p>
11992 <p>For example:
11993 </p>
11994 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info-port-number (service-info &quot;http&quot;))</b>
11996 </pre></td></tr></table>
12000 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12002 <p>Returns the service protocol name field of the service-information
12003 record <var>service-info</var>.
12004 </p>
12005 <p>For example:
12006 </p>
12007 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(service-info-protocol (service-info &quot;http&quot;))</b>
12008 &quot;udp&quot;
12009 </pre></td></tr></table>
12013 <hr size="1">
12014 <a name="Protocol-information"></a>
12015 <table cellpadding="1" cellspacing="1" border="0">
12016 <tr><td valign="middle" align="left"><a href="#Service-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.12 Service information" align="middle" width="32"></a></td>
12017 <td valign="middle" align="left"><a href="#Network-information" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 16.14 Network information" align="middle" width="32"></a></td>
12018 <td valign="middle" align="left"> &nbsp; </td>
12019 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
12020 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
12021 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
12022 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12023 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12024 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12025 </tr></table>
12026 <a name="Protocol-information-1"></a>
12027 <h2 class="section">16.13 Protocol information</h2>
12029 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12031 <p>This procedure accesses the protocol database to get information about
12032 the protocol identified by <var>protocol-name-or-id</var>, which is the
12033 protocol&rsquo;s symbolic name (string) or the protocol&rsquo;s number (exact
12034 integer). A protocol-information record is returned that contains the
12035 protocol&rsquo;s symbolic name, a list of aliases (alternative names), and
12036 the protocol number (32 bit unsigned exact integer). An exception is
12037 raised when <var>protocol-name-or-id</var> does not appear in the database.
12038 </p>
12039 <p>For example:
12040 </p>
12041 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(protocol-info &quot;tcp&quot;)</b>
12042 #&lt;protocol-info #2 name: &quot;tcp&quot; aliases: (&quot;TCP&quot;) number: 6&gt;
12043 &gt; <b>(protocol-info 6)</b>
12044 #&lt;protocol-info #2 name: &quot;tcp&quot; aliases: (&quot;TCP&quot;) number: 6&gt;
12045 </pre></td></tr></table>
12049 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12051 <p>This procedure returns <code>#t</code> when <var>obj</var> is a protocol-information
12052 record and <code>#f</code> otherwise.
12053 </p>
12054 <p>For example:
12055 </p>
12056 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(protocol-info? (protocol-info &quot;tcp&quot;))</b>
12058 &gt; <b>(protocol-info? 123)</b>
12060 </pre></td></tr></table>
12064 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12066 <p>Returns the symbolic name field of the protocol-information record
12067 <var>protocol-info</var>.
12068 </p>
12069 <p>For example:
12070 </p>
12071 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(protocol-info-name (protocol-info 6))</b>
12072 &quot;tcp&quot;
12073 </pre></td></tr></table>
12077 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12079 <p>Returns the aliases field of the protocol-information record
12080 <var>protocol-info</var>. This field is a possibly empty list of strings.
12081 </p>
12082 <p>For example:
12083 </p>
12084 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(protocol-info-aliases (protocol-info &quot;tcp&quot;))</b>
12085 (&quot;TCP&quot;)
12086 </pre></td></tr></table>
12090 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12092 <p>Returns the protocol number field of the protocol-information record
12093 <var>protocol-info</var>.
12094 </p>
12095 <p>For example:
12096 </p>
12097 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(protocol-info-number (protocol-info &quot;tcp&quot;))</b>
12099 </pre></td></tr></table>
12103 <hr size="1">
12104 <a name="Network-information"></a>
12105 <table cellpadding="1" cellspacing="1" border="0">
12106 <tr><td valign="middle" align="left"><a href="#Protocol-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.13 Protocol information" align="middle" width="32"></a></td>
12107 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17. I/O and ports" align="middle" width="32"></a></td>
12108 <td valign="middle" align="left"> &nbsp; </td>
12109 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
12110 <td valign="middle" align="left"><a href="#Host-environment" title="Up section"><img src="button-up.png" border="0" alt="Up: 16. Host environment" align="middle" width="32"></a></td>
12111 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 17. I/O and ports" align="middle" width="32"></a></td>
12112 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12113 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12114 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12115 </tr></table>
12116 <a name="Network-information-1"></a>
12117 <h2 class="section">16.14 Network information</h2>
12119 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12121 <p>This procedure accesses the network database to get information about
12122 the network identified by <var>network-name-or-id</var>, which is the
12123 network&rsquo;s symbolic name (string) or the network&rsquo;s number (exact
12124 integer). A network-information record is returned that contains the
12125 network&rsquo;s symbolic name, a list of aliases (alternative names), and
12126 the network number (32 bit unsigned exact integer). An exception is
12127 raised when <var>network-name-or-id</var> does not appear in the database.
12128 </p>
12129 <p>For example:
12130 </p>
12131 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(network-info &quot;loopback&quot;)</b>
12132 #&lt;network-info #2
12133 name: &quot;loopback&quot;
12134 aliases: (&quot;loopback-net&quot;)
12135 number: 127&gt;
12136 &gt; <b>(network-info 127)</b>
12137 #&lt;network-info #3
12138 name: &quot;loopback&quot;
12139 aliases: (&quot;loopback-net&quot;)
12140 number: 127&gt;
12141 </pre></td></tr></table>
12145 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12147 <p>This procedure returns <code>#t</code> when <var>obj</var> is a network-information
12148 record and <code>#f</code> otherwise.
12149 </p>
12150 <p>For example:
12151 </p>
12152 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(network-info? (network-info &quot;loopback&quot;))</b>
12154 &gt; <b>(network-info? 123)</b>
12156 </pre></td></tr></table>
12160 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12162 <p>Returns the symbolic name field of the network-information record
12163 <var>network-info</var>.
12164 </p>
12165 <p>For example:
12166 </p>
12167 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(network-info-name (network-info 127))</b>
12168 &quot;loopback&quot;
12169 </pre></td></tr></table>
12173 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12175 <p>Returns the aliases field of the network-information record
12176 <var>network-info</var>. This field is a possibly empty list of strings.
12177 </p>
12178 <p>For example:
12179 </p>
12180 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(network-info-aliases (network-info &quot;loopback&quot;))</b>
12181 (&quot;loopback-net&quot;)
12182 </pre></td></tr></table>
12186 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12188 <p>Returns the network number field of the network-information record
12189 <var>network-info</var>.
12190 </p>
12191 <p>For example:
12192 </p>
12193 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(network-info-number (network-info &quot;loopback&quot;))</b>
12195 </pre></td></tr></table>
12199 <hr size="1">
12200 <a name="I_002fO-and-ports"></a>
12201 <table cellpadding="1" cellspacing="1" border="0">
12202 <tr><td valign="middle" align="left"><a href="#Network-information" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 16.14 Network information" align="middle" width="32"></a></td>
12203 <td valign="middle" align="left"><a href="#Unidirectional-and-bidirectional-ports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.1 Unidirectional and bidirectional ports" align="middle" width="32"></a></td>
12204 <td valign="middle" align="left"> &nbsp; </td>
12205 <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" alt="FastBack: 16. Host environment" align="middle" width="32"></a></td>
12206 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
12207 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12208 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12209 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12210 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12211 </tr></table>
12212 <a name="I_002fO-and-ports-1"></a>
12213 <h1 class="chapter">17. I/O and ports</h1>
12215 <table class="menu" border="0" cellspacing="0">
12216 <tr><td align="left" valign="top"><a href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12217 <tr><td align="left" valign="top"><a href="#Port-classes">17.2 Port classes</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12218 <tr><td align="left" valign="top"><a href="#Port-settings">17.3 Port settings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12219 <tr><td align="left" valign="top"><a href="#Object_002dports">17.4 Object-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12220 <tr><td align="left" valign="top"><a href="#Character_002dports">17.5 Character-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12221 <tr><td align="left" valign="top"><a href="#Byte_002dports">17.6 Byte-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12222 <tr><td align="left" valign="top"><a href="#Device_002dports">17.7 Device-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12223 <tr><td align="left" valign="top"><a href="#Directory_002dports">17.8 Directory-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12224 <tr><td align="left" valign="top"><a href="#Vector_002dports">17.9 Vector-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12225 <tr><td align="left" valign="top"><a href="#String_002dports">17.10 String-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12226 <tr><td align="left" valign="top"><a href="#U8vector_002dports">17.11 U8vector-ports</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12227 <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>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12228 </table>
12230 <hr size="1">
12231 <a name="Unidirectional-and-bidirectional-ports"></a>
12232 <table cellpadding="1" cellspacing="1" border="0">
12233 <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" alt="Back: 17. I/O and ports" align="middle" width="32"></a></td>
12234 <td valign="middle" align="left"><a href="#Port-classes" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.2 Port classes" align="middle" width="32"></a></td>
12235 <td valign="middle" align="left"> &nbsp; </td>
12236 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12237 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12238 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12239 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12240 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12241 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12242 </tr></table>
12243 <a name="Unidirectional-and-bidirectional-ports-1"></a>
12244 <h2 class="section">17.1 Unidirectional and bidirectional ports</h2>
12246 <p>Unidirectional ports allow communication between a producer of
12247 information and a consumer. An input-port&rsquo;s producer is typically a
12248 resource managed by the operating system (such as a file, a process or
12249 a network connection) and the consumer is the Scheme program. The
12250 roles are reversed for an output-port.
12251 </p>
12252 <p>Associated with each port are settings that affect I/O operations on
12253 that port (encoding of characters to bytes, end-of-line encoding, type
12254 of buffering, etc). Port settings are specified when the port is
12255 created. Some port settings can be changed after a port is created.
12256 </p>
12257 <p>Bidirectional ports, also called input-output-ports, allow
12258 communication in both directions. They are best viewed as an object
12259 that groups two separate unidirectional ports (one in each direction).
12260 Each direction has its own port settings and can be closed
12261 independently from the other direction.
12262 </p>
12263 <hr size="1">
12264 <a name="Port-classes"></a>
12265 <table cellpadding="1" cellspacing="1" border="0">
12266 <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" alt="Back: 17.1 Unidirectional and bidirectional ports" align="middle" width="32"></a></td>
12267 <td valign="middle" align="left"><a href="#Port-settings" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.3 Port settings" align="middle" width="32"></a></td>
12268 <td valign="middle" align="left"> &nbsp; </td>
12269 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12270 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12271 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12272 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12273 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12274 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12275 </tr></table>
12276 <a name="Port-classes-1"></a>
12277 <h2 class="section">17.2 Port classes</h2>
12279 <p>The four classes of ports listed below form an inheritance hierarchy.
12280 Operations possible for a certain class of port are also possible for
12281 the subclasses. Only device-ports are connected to a device managed
12282 by the operating system. For instance it is possible to create ports
12283 that behave as a FIFO where the Scheme program is both the producer
12284 and consumer of information (possibly one thread is the producer and
12285 another thread is the consumer).
12286 </p>
12287 <ol>
12288 <li>
12289 An <em>object-port</em> (or simply a port) provides operations to read
12290 and write Scheme data (i.e. any Scheme object) to/from the port. It
12291 also provides operations to force output to occur, to change the way
12292 threads block on the port, and to close the port. Note that the class
12293 of objects for which write/read invariance is guaranteed depends on
12294 the particular class of port.
12296 </li><li>
12297 A <em>character-port</em> provides all the operations of an object-port,
12298 and also operations to read and write individual characters to/from
12299 the port. When a Scheme object is written to a character-port, it is
12300 converted into the sequence of characters that corresponds to its
12301 external-representation. When reading a Scheme object, an inverse
12302 conversion occurs. Note that some Scheme objects do not have an
12303 external textual representation that can be read back.
12305 </li><li>
12306 A <em>byte-port</em> provides all the operations of a character-port, and
12307 also operations to read and write individual bytes to/from the port.
12308 When a character is written to a byte-port, some encoding of that
12309 character into a sequence of bytes will occur (for example,
12310 <code>#\newline</code> will be encoded as the 2 bytes CR-LF when using
12311 ISO-8859-1 character encoding and <code>cr-lf</code> end-of-line encoding, and
12312 a non-ASCII character will generate more than 1 byte when using UTF-8
12313 character encoding). When reading a character, a similar decoding
12314 occurs.
12316 </li><li>
12317 A <em>device-port</em> provides all the operations of a byte-port, and
12318 also operations to control the operating system managed device (file,
12319 network connection, terminal, etc) that is connected to the port.
12321 </li></ol>
12323 <hr size="1">
12324 <a name="Port-settings"></a>
12325 <table cellpadding="1" cellspacing="1" border="0">
12326 <tr><td valign="middle" align="left"><a href="#Port-classes" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.2 Port classes" align="middle" width="32"></a></td>
12327 <td valign="middle" align="left"><a href="#Object_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.4 Object-ports" align="middle" width="32"></a></td>
12328 <td valign="middle" align="left"> &nbsp; </td>
12329 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12330 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12331 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12332 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12333 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12334 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12335 </tr></table>
12336 <a name="Port-settings-1"></a>
12337 <h2 class="section">17.3 Port settings</h2>
12339 <p>Some port settings are only valid for specific port classes whereas
12340 some others are valid for all ports. Port settings are specified when
12341 a port is created. The settings that are not specified will default
12342 to some reasonable values. Keyword objects are used to name the
12343 settings to be set. As a simple example, a device-port connected to
12344 the file <code>&quot;foo&quot;</code> can be created using the call
12345 </p>
12346 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(open-input-file &quot;foo&quot;)
12347 </pre></td></tr></table>
12349 <p>This will use default settings for the character encoding, buffering,
12350 etc. If the UTF-8 character encoding is desired, then the port could
12351 be opened using the call
12352 </p>
12353 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(open-input-file (list path: &quot;foo&quot; char-encoding: 'UTF-8))
12354 </pre></td></tr></table>
12356 <p>Here the argument of the procedure <code>open-input-file</code> has been
12357 replaced by a <em>port settings list</em> which specifies the value of
12358 each port setting that should not be set to the default value. Note
12359 that some port settings have no useful default and it is therefore
12360 required to specify a value for them, such as the <code>path:</code> in the
12361 case of the file opening procedures. All port creation procedures
12362 (i.e. named <code>open-...</code>) take a single argument that can either
12363 be a port settings list or a value of a type that depends on the kind
12364 of port being created (a path string for files, an IP port number for
12365 socket servers, etc).
12366 </p>
12367 <hr size="1">
12368 <a name="Object_002dports"></a>
12369 <table cellpadding="1" cellspacing="1" border="0">
12370 <tr><td valign="middle" align="left"><a href="#Port-settings" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.3 Port settings" align="middle" width="32"></a></td>
12371 <td valign="middle" align="left"><a href="#Object_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.4.1 Object-port settings" align="middle" width="32"></a></td>
12372 <td valign="middle" align="left"> &nbsp; </td>
12373 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12374 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12375 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12376 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12377 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12378 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12379 </tr></table>
12380 <a name="Object_002dports-1"></a>
12381 <h2 class="section">17.4 Object-ports</h2>
12383 <table class="menu" border="0" cellspacing="0">
12384 <tr><td align="left" valign="top"><a href="#Object_002dport-settings">17.4.1 Object-port settings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12385 <tr><td align="left" valign="top"><a href="#Object_002dport-operations">17.4.2 Object-port operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12386 </table>
12388 <hr size="1">
12389 <a name="Object_002dport-settings"></a>
12390 <table cellpadding="1" cellspacing="1" border="0">
12391 <tr><td valign="middle" align="left"><a href="#Object_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.4 Object-ports" align="middle" width="32"></a></td>
12392 <td valign="middle" align="left"><a href="#Object_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.4.2 Object-port operations" align="middle" width="32"></a></td>
12393 <td valign="middle" align="left"> &nbsp; </td>
12394 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12395 <td valign="middle" align="left"><a href="#Object_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.4 Object-ports" align="middle" width="32"></a></td>
12396 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12397 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12398 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12399 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12400 </tr></table>
12401 <a name="Object_002dport-settings-1"></a>
12402 <h3 class="subsection">17.4.1 Object-port settings</h3>
12404 <p>The following is a list of port settings that are valid for all types
12405 of ports.
12406 </p>
12407 <ul>
12408 <li>
12409 <code>direction:</code> ( <code>input</code> | <code>output</code> | <code>input-output</code> )
12411 <p>This setting controls the direction of the port. The symbol
12412 <code>input</code> indicates a unidirectional input-port, the symbol
12413 <code>output</code> indicates a unidirectional output-port, and the symbol
12414 <code>input-output</code> indicates a bidirectional port. The default
12415 value of this setting depends on the port creation procedure.
12416 </p>
12417 </li><li>
12418 <code>buffering:</code> ( <code>#f</code> | <code>#t</code> | <code>line</code> )
12420 <p>This setting controls the buffering of the port. To set each
12421 direction separately the keywords <code>input-buffering:</code> and
12422 <code>output-buffering:</code> must be used instead of <code>buffering:</code>.
12423 The value <code>#f</code> selects unbuffered I/O, the value <code>#t</code>
12424 selects fully buffered I/O, and the symbol <code>line</code> selects line
12425 buffered I/O (the output buffer is drained when a <code>#\newline</code>
12426 character is written). Line buffered I/O only applies to
12427 character-ports. The default value of this setting is operating
12428 system dependent except consoles which are unbuffered.
12429 </p>
12430 </li></ul>
12432 <hr size="1">
12433 <a name="Object_002dport-operations"></a>
12434 <table cellpadding="1" cellspacing="1" border="0">
12435 <tr><td valign="middle" align="left"><a href="#Object_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.4.1 Object-port settings" align="middle" width="32"></a></td>
12436 <td valign="middle" align="left"><a href="#Character_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.5 Character-ports" align="middle" width="32"></a></td>
12437 <td valign="middle" align="left"> &nbsp; </td>
12438 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12439 <td valign="middle" align="left"><a href="#Object_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.4 Object-ports" align="middle" width="32"></a></td>
12440 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12441 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12442 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12443 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12444 </tr></table>
12445 <a name="Object_002dport-operations-1"></a>
12446 <h3 class="subsection">17.4.2 Object-port operations</h3>
12448 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12449 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12450 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12452 <p>The procedure <code>input-port?</code> returns <code>#t</code> when <var>obj</var> is a
12453 unidirectional input-port or a bidirectional port and <code>#f</code>
12454 otherwise.
12455 </p>
12456 <p>The procedure <code>output-port?</code> returns <code>#t</code> when <var>obj</var> is a
12457 unidirectional output-port or a bidirectional port and <code>#f</code>
12458 otherwise.
12459 </p>
12460 <p>The procedure <code>port?</code> returns <code>#t</code> when <var>obj</var> is a port
12461 (either unidirectional or bidirectional) and <code>#f</code> otherwise.
12462 </p>
12463 <p>For example:
12464 </p>
12465 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(input-port? (current-input-port))</b>
12467 &gt; <b>(call-with-input-string &quot;some text&quot; output-port?)</b>
12469 &gt; <b>(port? (current-output-port))</b>
12471 </pre></td></tr></table>
12475 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12477 <p>This procedure reads and returns the next Scheme datum from the
12478 input-port <var>port</var>. The end-of-file object is returned when the
12479 end of the stream is reached. If it is not specified, <var>port</var>
12480 defaults to the current input-port.
12481 </p>
12482 <p>For example:
12483 </p>
12484 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-input-string &quot;some text&quot; read)</b>
12485 some
12486 &gt; <b>(call-with-input-string &quot;&quot; read)</b>
12487 #!eof
12488 </pre></td></tr></table>
12492 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12494 <p>This procedure repeatedly calls the procedure <var>reader</var> with
12495 <var>port</var> as the sole argument and accumulates a list of each value
12496 returned up to the end-of-file object. The procedure <code>read-all</code>
12497 returns the accumulated list without the end-of-file object. If it is
12498 not specified, <var>port</var> defaults to the current input-port. If it
12499 is not specified, <var>reader</var> defaults to the procedure <code>read</code>.
12500 </p>
12501 <p>For example:
12502 </p>
12503 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-input-string &quot;3,2,1\ngo!&quot; read-all)</b>
12504 (3 ,2 ,1 go!)
12505 &gt; <b>(call-with-input-string &quot;3,2,1\ngo!&quot;
12506 (lambda (p) (read-all p read-char)))</b>
12507 (#\3 #\, #\2 #\, #\1 #\newline #\g #\o #\!)
12508 &gt; <b>(call-with-input-string &quot;3,2,1\ngo!&quot;
12509 (lambda (p) (read-all p read-line)))</b>
12510 (&quot;3,2,1&quot; &quot;go!&quot;)
12511 </pre></td></tr></table>
12515 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12517 <p>This procedure writes the Scheme datum <var>obj</var> to the output-port
12518 <var>port</var> and the value returned is unspecified. If it is not
12519 specified, <var>port</var> defaults to the current output-port.
12520 </p>
12521 <p>For example:
12522 </p>
12523 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(write (list 'compare (list 'quote '@x) 'and (list 'unquote '@x))) </b>
12524 (compare '@x and , @x)&gt;
12525 </pre></td></tr></table>
12529 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12531 <p>This procedure writes an &ldquo;object separator&rdquo; to the output-port
12532 <var>port</var> and the value returned is unspecified. The separator
12533 ensures that the next Scheme datum written with the <code>write</code>
12534 procedure will not be confused with the latest datum that was written.
12535 On character-ports this is done by writing the character
12536 <code>#\newline</code>. On ports where successive objects are implicitly
12537 distinct (such as &ldquo;vector ports&rdquo;) this procedure does nothing.
12538 </p>
12539 <p>Regardless of the class of a port <var>p</var> and assuming that the
12540 external textual representation of the object <var>x</var> is readable, the
12541 expression <code>(begin (write <var>x</var> <var>p</var>) (newline <var>p</var>))</code>
12542 will write to <var>p</var> a representation of <var>x</var> that can be read
12543 back with the procedure <code>read</code>. If it is not specified,
12544 <var>port</var> defaults to the current output-port.
12545 </p>
12546 <p>For example:
12547 </p>
12548 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(begin (write 123) (newline) (write 456) (newline))</b>
12551 </pre></td></tr></table>
12555 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12557 <p>The procedure <code>force-output</code> causes the data that was written to
12558 the output-port <var>port</var> to be moved closer to its destination
12559 according to <var>level</var>, an exact integer in the range 0 to 2. If
12560 <var>port</var> is not specified, the current output-port is used. If
12561 <var>level</var> is not specified, it defaults to 0. Values of <var>level</var>
12562 above 0 are equivalent to <var>level</var> = 0 except for device ports as
12563 explained below.
12564 </p>
12565 <p>When <var>level</var> is 0, the output buffers of <var>port</var> which are
12566 managed in the Scheme process are drained (i.e. the output operation
12567 that was delayed due to buffering is actually performed). In the case
12568 of a device port the data is passed to the operating system and it
12569 becomes its responsibility to transmit the data to the device. The
12570 operating system may implement its own buffering approach which delays
12571 the transmission of the data to the device.
12572 </p>
12573 <p>When <var>level</var> is 1, in addition to the operations for <var>level</var> =
12574 0 and if the operating system supports the functionality, the
12575 operating system is requested to transmit the data to the device. On
12576 UNIX this corresponds to a <code>fsync</code> system call.
12577 </p>
12578 <p>When <var>level</var> is 2, in addition to the operations for <var>level</var> =
12579 1 and if the operating system supports the functionality, the
12580 operating system is requested to wait until the device reports that
12581 the data was saved by the device (e.g. actually written to disk in the
12582 case of a file). This operation can take a long time on some
12583 operating systems. On Mac OS X this corresponds to a <code>fcntl</code>
12584 system call with operation <code>F_FULLFSYNC</code>.
12585 </p>
12586 <p>For example:
12587 </p>
12588 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-tcp-client &quot;www.iro.umontreal.ca:80&quot;))</b>
12589 &gt; <b>(display &quot;GET /\n&quot; p)</b>
12590 &gt; <b>(force-output p)</b>
12591 &gt; <b>(read-line p)</b>
12592 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.01 Transitional//EN\&quot;&quot;
12593 </pre></td></tr></table>
12597 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12598 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12599 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12601 <p>The <var>port</var> argument of these procedures must be a unidirectional
12602 or a bidirectional port. For all three procedures the value returned
12603 is unspecified.
12604 </p>
12605 <p>The procedure <code>close-input-port</code> closes the input-port side of
12606 <var>port</var>, which must not be a unidirectional output-port.
12607 </p>
12608 <p>The procedure <code>close-output-port</code> closes the output-port side of
12609 <var>port</var>, which must not be a unidirectional input-port. The ouput
12610 buffers are drained before <var>port</var> is closed.
12611 </p>
12612 <p>The procedure <code>close-port</code> closes all sides of the <var>port</var>.
12613 Unless <var>port</var> is a unidirectional input-port, the output buffers
12614 are drained before <var>port</var> is closed.
12615 </p>
12616 <p>For example:
12617 </p>
12618 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-tcp-client &quot;www.iro.umontreal.ca:80&quot;))</b>
12619 &gt; <b>(display &quot;GET /\n&quot; p)</b>
12620 &gt; <b>(close-output-port p)</b>
12621 &gt; <b>(read-line p)</b>
12622 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.01 Transitional//EN\&quot;&quot;
12623 </pre></td></tr></table>
12627 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12628 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12630 <p>When a thread tries to perform an I/O operation on a port, the
12631 requested operation may not be immediately possible and the thread
12632 must wait. For example, the thread may be trying to read a line of
12633 text from the console and the user has not typed anything yet, or the
12634 thread may be trying to write to a network connection faster than the
12635 network can handle. In such situations the thread normally blocks
12636 until the operation becomes possible.
12637 </p>
12638 <p>It is sometimes necessary to guarantee that the thread will not block
12639 too long. For this purpose, to each input-port and output-port is
12640 attached a <em>timeout</em> and <em>timeout-thunk</em>. The timeout
12641 indicates the point in time beyond which the thread should stop
12642 waiting on an input and output operation respectively. When the
12643 timeout is reached, the thread calls the port&rsquo;s timeout-thunk. If the
12644 timeout-thunk returns <code>#f</code> the thread abandons trying to perform
12645 the operation (in the case of an input operation an end-of-file is
12646 read and in the case of an output operation an exception is raised).
12647 Otherwise, the thread will block again waiting for the operation to
12648 become possible (note that if the port&rsquo;s timeout has not changed the
12649 thread will immediately call the timeout-thunk again).
12650 </p>
12651 <p>The procedure <code>input-port-timeout-set!</code> sets the timeout of the
12652 input-port <var>port</var> to <var>timeout</var> and the timeout-thunk to
12653 <var>thunk</var>. The procedure <code>output-port-timeout-set!</code> sets the
12654 timeout of the output-port <var>port</var> to <var>timeout</var> and the
12655 timeout-thunk to <var>thunk</var>. If it is not specified, the <var>thunk</var>
12656 defaults to a thunk that returns <code>#f</code>. The <var>timeout</var> is
12657 either a time object indicating an absolute point in time, or it is a
12658 real number which indicates the number of seconds relative to the
12659 moment the procedure is called. For both procedures the value
12660 returned is unspecified.
12661 </p>
12662 <p>When a port is created the timeout is set to infinity (<code>+inf.0</code>).
12663 This causes the thread to wait as long as needed for the operation to
12664 become possible. Setting the timeout to a point in the past
12665 (<code>-inf.0</code>) will cause the thread to attempt the I/O operation and
12666 never block (i.e. the timeout-thunk is called if the operation is not
12667 immediately possible).
12668 </p>
12669 <p>The following example shows how to cause the REPL to terminate
12670 when the user does not enter an expression within the next 60 seconds.
12671 </p>
12672 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(input-port-timeout-set! (repl-input-port) 60)</b>
12673 &gt;
12674 *** EOF again to exit
12675 </pre></td></tr></table>
12679 <hr size="1">
12680 <a name="Character_002dports"></a>
12681 <table cellpadding="1" cellspacing="1" border="0">
12682 <tr><td valign="middle" align="left"><a href="#Object_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.4.2 Object-port operations" align="middle" width="32"></a></td>
12683 <td valign="middle" align="left"><a href="#Character_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.5.1 Character-port settings" align="middle" width="32"></a></td>
12684 <td valign="middle" align="left"> &nbsp; </td>
12685 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12686 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12687 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12688 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12689 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12690 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12691 </tr></table>
12692 <a name="Character_002dports-1"></a>
12693 <h2 class="section">17.5 Character-ports</h2>
12695 <table class="menu" border="0" cellspacing="0">
12696 <tr><td align="left" valign="top"><a href="#Character_002dport-settings">17.5.1 Character-port settings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12697 <tr><td align="left" valign="top"><a href="#Character_002dport-operations">17.5.2 Character-port operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12698 </table>
12700 <hr size="1">
12701 <a name="Character_002dport-settings"></a>
12702 <table cellpadding="1" cellspacing="1" border="0">
12703 <tr><td valign="middle" align="left"><a href="#Character_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.5 Character-ports" align="middle" width="32"></a></td>
12704 <td valign="middle" align="left"><a href="#Character_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.5.2 Character-port operations" align="middle" width="32"></a></td>
12705 <td valign="middle" align="left"> &nbsp; </td>
12706 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12707 <td valign="middle" align="left"><a href="#Character_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.5 Character-ports" align="middle" width="32"></a></td>
12708 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12709 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12710 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12711 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12712 </tr></table>
12713 <a name="Character_002dport-settings-1"></a>
12714 <h3 class="subsection">17.5.1 Character-port settings</h3>
12716 <p>The following is a list of port settings that are valid for
12717 character-ports.
12718 </p>
12719 <ul>
12720 <li>
12721 <code>readtable:</code> <var>readtable</var>
12723 <p>This setting determines the readtable attached to the character-port.
12724 To set each direction separately the keywords <code>input-readtable:</code>
12725 and <code>output-readtable:</code> must be used instead of
12726 <code>readtable:</code>. Readtables control the external textual
12727 representation of Scheme objects, that is the encoding of Scheme
12728 objects using characters. The behavior of the <code>read</code> procedure
12729 depends on the port&rsquo;s input-readtable and the behavior of the
12730 procedures <code>write</code>, <code>pretty-print</code>, and related procedures
12731 is affected by the port&rsquo;s output-readtable. The default value of this
12732 setting is the value bound to the parameter object
12733 <code>current-readtable</code>.
12734 </p>
12735 </li><li>
12736 <code>output-width:</code> <var>positive-integer</var>
12738 <p>This setting indicates the width of the character output-port in
12739 number of characters. This information is used by the pretty-printer.
12740 The default value of this setting is 80.
12741 </p>
12742 </li></ul>
12744 <hr size="1">
12745 <a name="Character_002dport-operations"></a>
12746 <table cellpadding="1" cellspacing="1" border="0">
12747 <tr><td valign="middle" align="left"><a href="#Character_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.5.1 Character-port settings" align="middle" width="32"></a></td>
12748 <td valign="middle" align="left"><a href="#Byte_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.6 Byte-ports" align="middle" width="32"></a></td>
12749 <td valign="middle" align="left"> &nbsp; </td>
12750 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12751 <td valign="middle" align="left"><a href="#Character_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.5 Character-ports" align="middle" width="32"></a></td>
12752 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12753 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12754 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12755 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12756 </tr></table>
12757 <a name="Character_002dport-operations-1"></a>
12758 <h3 class="subsection">17.5.2 Character-port operations</h3>
12760 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12761 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12762 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12763 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12765 <p>The current character location of a character input-port is the
12766 location of the next character to read. The current character
12767 location of a character output-port is the location of the next
12768 character to write. Location is denoted by a line number (the first
12769 line is line 1) and a column number, that is the location on the
12770 current line (the first column is column 1). The procedures
12771 <code>input-port-line</code> and <code>input-port-column</code> return the line
12772 location and the column location respectively of the character
12773 input-port <var>port</var>. The procedures <code>output-port-line</code> and
12774 <code>output-port-column</code> return the line location and the column
12775 location respectively of the character output-port <var>port</var>.
12776 </p>
12777 <p>For example:
12778 </p>
12779 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-output-string
12781 (lambda (p)
12782 (display &quot;abc\n123def&quot; p)
12783 (write (list (output-port-line p) (output-port-column p))
12784 p)))</b>
12785 &quot;abc\n123def(2 7)&quot;
12786 </pre></td></tr></table>
12790 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12792 <p>This procedure returns the width, in characters, of the character
12793 output-port <var>port</var>. The value returned is the port&rsquo;s output-width
12794 setting.
12795 </p>
12796 <p>For example:
12797 </p>
12798 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(output-port-width (repl-output-port))</b>
12800 </pre></td></tr></table>
12804 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12806 <p>This procedure reads the character input-port <var>port</var> and returns
12807 the character at the current character location and advances the
12808 current character location to the next character, unless the
12809 <var>port</var> is already at end-of-file in which case <code>read-char</code>
12810 returns the end-of-file object. If it is not specified, <var>port</var>
12811 defaults to the current input-port.
12812 </p>
12813 <p>For example:
12814 </p>
12815 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-input-string
12816 &quot;some text&quot;
12817 (lambda (p)
12818 (let ((a (read-char p))) (list a (read-char p)))))</b>
12819 (#\s #\o)
12820 &gt; <b>(call-with-input-string &quot;&quot; read-char)</b>
12821 #!eof
12822 </pre></td></tr></table>
12826 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12828 <p>This procedure returns the same result as <code>read-char</code> but it does
12829 not advance the current character location of the input-port
12830 <var>port</var>. If it is not specified, <var>port</var> defaults to the
12831 current input-port.
12832 </p>
12833 <p>For example:
12834 </p>
12835 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-input-string
12836 &quot;some text&quot;
12837 (lambda (p)
12838 (let ((a (peek-char p))) (list a (read-char p)))))</b>
12839 (#\s #\s)
12840 &gt; <b>(call-with-input-string &quot;&quot; peek-char)</b>
12841 #!eof
12842 </pre></td></tr></table>
12846 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12848 <p>This procedure writes the character <var>char</var> to the character
12849 output-port <var>port</var> and advances the current character location of
12850 that output-port. The value returned is unspecified. If it is not
12851 specified, <var>port</var> defaults to the current output-port.
12852 </p>
12853 <p>For example:
12854 </p>
12855 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(write-char #\=)</b>
12856 =&gt;
12857 </pre></td></tr></table>
12861 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12863 <p>This procedure reads characters from the character input-port
12864 <var>port</var> until a specific <var>separator</var> or the end-of-file is
12865 encountered and returns a string containing the sequence of characters
12866 read. If it is specified, <var>max-length</var> must be a nonnegative
12867 exact integer and it places an upper limit on the number of characters
12868 that are read.
12869 </p>
12870 <p>The <var>separator</var> is included at the end of the string only
12871 if it was the last character read and <var>include-separator?</var> is not
12872 <code>#f</code>. The <var>separator</var> must be a character or <code>#f</code> (in
12873 which case all the characters until the end-of-file are read). If it
12874 is not specified, <var>port</var> defaults to the current input-port. If
12875 it is not specified, <var>separator</var> defaults to <code>#\newline</code>. If
12876 it is not specified, <var>include-separator?</var> defaults to <code>#f</code>.
12877 </p>
12878 <p>For example:
12879 </p>
12880 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (split sep)
12881 (lambda (str)
12882 (call-with-input-string
12884 (lambda (p)
12885 (read-all p (lambda (p) (read-line p sep)))))))</b>
12886 &gt; <b>((split #\,) &quot;a,b,c&quot;)</b>
12887 (&quot;a&quot; &quot;b&quot; &quot;c&quot;)
12888 &gt; <b>(map (split #\,)
12889 (call-with-input-string &quot;1,2,3\n4,5&quot;
12890 (lambda (p) (read-all p read-line))))</b>
12891 ((&quot;1&quot; &quot;2&quot; &quot;3&quot;) (&quot;4&quot; &quot;5&quot;))
12892 &gt; <b>(read-line (current-input-port) #\newline #f 2)1234</b>
12893 &quot;12&quot;
12894 &gt; 34
12895 </pre></td></tr></table>
12899 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12900 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12902 <p>These procedures support bulk character I/O. The part of the string
12903 <var>string</var> starting at index <var>start</var> and ending just before
12904 index <var>end</var> is used as a character buffer that will be the target
12905 of <code>read-substring</code> or the source of the <code>write-substring</code>.
12906 The <code>read-substring</code> also accepts a <var>need</var> parameter which
12907 must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> characters
12908 will be transferred. The number of characters transferred, possibly
12909 zero, is returned by these procedures. Fewer characters will be read
12910 by <code>read-substring</code> if an end-of-file is read, or a timeout
12911 occurs before all the requested characters are transferred and the
12912 timeout thunk returns <code>#f</code> (see the procedure
12913 <code>input-port-timeout-set!</code>), or <var>need</var> is specified and at
12914 least that many characters have been read (in other words the
12915 procedure does not block for more characters but may transfer more
12916 characters if they are immediately available). Fewer characters will
12917 be written by <code>write-substring</code> if a timeout occurs before all
12918 the requested characters are transferred and the timeout thunk returns
12919 <code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it
12920 is not specified, <var>port</var> defaults to the current input-port and
12921 current output-port respectively.
12922 </p>
12923 <p>For example:
12924 </p>
12925 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (make-string 10 #\x))</b>
12926 &gt; <b>(read-substring s 2 5)123456789</b>
12928 &gt; 456789
12929 &gt; <b>s</b>
12930 &quot;xx123xxxxx&quot;
12931 &gt; <b>(read-substring s 2 10 (current-input-port) 3)abcd</b>
12933 &gt; <b>s</b>
12934 &quot;xxabcd\nxxx&quot;
12935 </pre></td></tr></table>
12939 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12940 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12942 <p>These procedures return the readtable attached to the character-port
12943 <var>port</var>. The <var>port</var> parameter of <code>input-port-readtable</code>
12944 must be an input-port. The <var>port</var> parameter of
12945 <code>output-port-readtable</code> must be an output-port.
12946 </p>
12949 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12950 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
12952 <p>These procedures change the readtable attached to the character-port
12953 <var>port</var> to the readtable <var>readtable</var>. The <var>port</var> parameter
12954 of <code>input-port-readtable-set!</code> must be an input-port. The
12955 <var>port</var> parameter of <code>output-port-readtable-set!</code> must be an
12956 output-port. The value returned is unspecified.
12957 </p>
12960 <hr size="1">
12961 <a name="Byte_002dports"></a>
12962 <table cellpadding="1" cellspacing="1" border="0">
12963 <tr><td valign="middle" align="left"><a href="#Character_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.5.2 Character-port operations" align="middle" width="32"></a></td>
12964 <td valign="middle" align="left"><a href="#Byte_002dport-settings" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.6.1 Byte-port settings" align="middle" width="32"></a></td>
12965 <td valign="middle" align="left"> &nbsp; </td>
12966 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12967 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
12968 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12969 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12970 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12971 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12972 </tr></table>
12973 <a name="Byte_002dports-1"></a>
12974 <h2 class="section">17.6 Byte-ports</h2>
12976 <table class="menu" border="0" cellspacing="0">
12977 <tr><td align="left" valign="top"><a href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12978 <tr><td align="left" valign="top"><a href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
12979 </table>
12981 <hr size="1">
12982 <a name="Byte_002dport-settings"></a>
12983 <table cellpadding="1" cellspacing="1" border="0">
12984 <tr><td valign="middle" align="left"><a href="#Byte_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.6 Byte-ports" align="middle" width="32"></a></td>
12985 <td valign="middle" align="left"><a href="#Byte_002dport-operations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.6.2 Byte-port operations" align="middle" width="32"></a></td>
12986 <td valign="middle" align="left"> &nbsp; </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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
12988 <td valign="middle" align="left"><a href="#Byte_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.6 Byte-ports" align="middle" width="32"></a></td>
12989 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
12990 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
12991 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
12992 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
12993 </tr></table>
12994 <a name="Byte_002dport-settings-1"></a>
12995 <h3 class="subsection">17.6.1 Byte-port settings</h3>
12997 <p>The following is a list of port settings that are valid for
12998 byte-ports.
12999 </p>
13000 <ul>
13001 <li>
13002 <code>char-encoding:</code> <var>encoding</var>
13004 <p>This setting controls the character encoding of the byte-port. For
13005 bidirectional byte-ports, the character encoding for input and output
13006 is set. To set each direction separately the keywords
13007 <code>input-char-encoding:</code> and <code>output-char-encoding:</code> must be
13008 used instead of <code>char-encoding:</code>. The default value of this
13009 setting is operating system dependent, but this can be overridden
13010 through the runtime options (see section <a href="#Runtime-options">Runtime options</a>). The following
13011 encodings are supported:
13012 </p>
13013 <dl compact="compact">
13014 <dt> <code>ISO-8859-1</code></dt>
13015 <dd><p>ISO-8859-1 character encoding. Each character is encoded by a single byte.
13016 Only Unicode characters with a code in the range 0 to 255 are allowed.
13017 </p>
13018 </dd>
13019 <dt> <code>ASCII</code></dt>
13020 <dd><p>ASCII character encoding. Each character is encoded by a single byte.
13021 In principle only Unicode characters with a code in the range 0 to 127
13022 are allowed but most types of ports treat this exactly like <code>ISO-8859-1</code>.
13023 </p>
13024 </dd>
13025 <dt> <code>UTF-8</code></dt>
13026 <dd><p>UTF-8 character encoding. Each character is encoded by a sequence of one
13027 to four bytes. The minimum length UTF-8 encoding is used. If a BOM is
13028 needed at the beginning of the stream then it must be explicitly
13029 written.
13030 </p>
13031 </dd>
13032 <dt> <code>UTF-16</code></dt>
13033 <dd><p>UTF-16 character encoding. Each character is encoded by one or two 16
13034 bit integers (2 or 4 bytes). The 16 bit integers may be encoded using
13035 little-endian encoding or big-endian encoding. If the port is an
13036 input-port and the first two bytes read are a BOM (&ldquo;Byte Order Mark&rdquo;
13037 character with hexadecimal code FEFF) then the BOM will be discarded
13038 and the endianness will be set accordingly, otherwise the endianness
13039 depends on the operating system and how the Gambit runtime was
13040 compiled. If the port is an output-port then a BOM will be output at
13041 the beginning of the stream and the endianness depends on the
13042 operating system and how the Gambit runtime was compiled.
13043 </p>
13044 </dd>
13045 <dt> <code>UTF-16LE</code></dt>
13046 <dd><p>UTF-16 character encoding with little-endian endianness. It is like
13047 <code>UTF-16</code> except the endianness is set to little-endian and there is no
13048 BOM processing. If a BOM is needed at the beginning of the stream
13049 then it must be explicitly written.
13050 </p>
13051 </dd>
13052 <dt> <code>UTF-16BE</code></dt>
13053 <dd><p>UTF-16 character encoding with big-endian endianness. It is like
13054 <code>UTF-16LE</code> except the endianness is set to big-endian.
13055 </p>
13056 </dd>
13057 <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>
13058 <dd><p>These encodings combine the UTF-8 and UTF-16 encodings. When one of
13059 these character encodings is used for an output port, characters will
13060 be encoded using the UTF-8 encoding. The first character, if there is
13061 one, is prefixed with a UTF-8 BOM (the three byte sequence EF BB BF in
13062 hexadecimal). When one of these character encodings is used for an
13063 input port, the character encoding depends on the first few bytes. If
13064 the first bytes of the stream are a UTF-16LE BOM (FF FE in
13065 hexadecimal), or a UTF-16BE BOM (FE FF in hexadecimal), or a UTF-8 BOM
13066 (EF BB BF in hexadecimal), then the BOM is discarded and the remaining
13067 bytes of the stream are decoded using the corresponding character
13068 encoding. If a BOM is not present, then the stream is decoded using
13069 the fallback encoding specified. The encoding <code>UTF</code> is a synonym
13070 for <code>UTF-fallback-UTF-8</code>. Note that the <code>UTF</code> character
13071 encoding for input will correctly handle streams produced using the
13072 encodings <code>UTF</code>, <code>UTF-8</code>, <code>UTF-16</code>, <code>ASCII</code>, and
13073 if an explicit BOM is output, the encodings <code>UTF-16LE</code>, and
13074 <code>UTF-16BE</code>.
13075 </p>
13076 </dd>
13077 <dt> <code>UCS-2</code></dt>
13078 <dd><p>UCS-2 character encoding. Each character is encoded by a 16 bit
13079 integer (2 bytes). The 16 bit integers may be encoded using
13080 little-endian encoding or big-endian encoding. If the port is an
13081 input-port and the first two bytes read are a BOM (&ldquo;Byte Order Mark&rdquo;
13082 character with hexadecimal code FEFF) then the BOM will be discarded
13083 and the endianness will be set accordingly, otherwise the endianness
13084 depends on the operating system and how the Gambit runtime was
13085 compiled. If the port is an output-port then a BOM will be output at
13086 the beginning of the stream and the endianness depends on the
13087 operating system and how the Gambit runtime was compiled.
13088 </p>
13089 </dd>
13090 <dt> <code>UCS-2LE</code></dt>
13091 <dd><p>UCS-2 character encoding with little-endian endianness. It is like
13092 <code>UCS-2</code> except the endianness is set to little-endian and there is no
13093 BOM processing. If a BOM is needed at the beginning of the stream
13094 then it must be explicitly written.
13095 </p>
13096 </dd>
13097 <dt> <code>UCS-2BE</code></dt>
13098 <dd><p>UCS-2 character encoding with big-endian endianness. It is like
13099 <code>UCS-2LE</code> except the endianness is set to big-endian.
13100 </p>
13101 </dd>
13102 <dt> <code>UCS-4</code></dt>
13103 <dd><p>UCS-4 character encoding. Each character is encoded by a 32 integer
13104 (4 bytes). The 32 bit integers may be encoded using little-endian
13105 encoding or big-endian encoding. If the port is an input-port and the
13106 first four bytes read are a BOM (&ldquo;Byte Order Mark&rdquo; character with
13107 hexadecimal code 0000FEFF) then the BOM will be discarded and the
13108 endianness will be set accordingly, otherwise the endianness depends
13109 on the operating system and how the Gambit runtime was compiled. If
13110 the port is an output-port then a BOM will be output at the beginning
13111 of the stream and the endianness depends on the operating system and
13112 how the Gambit runtime was compiled.
13113 </p>
13114 </dd>
13115 <dt> <code>UCS-4LE</code></dt>
13116 <dd><p>UCS-4 character encoding with little-endian endianness. It is like
13117 <code>UCS-4</code> except the endianness is set to little-endian and there is no
13118 BOM processing. If a BOM is needed at the beginning of the stream
13119 then it must be explicitly written.
13120 </p>
13121 </dd>
13122 <dt> <code>UCS-4BE</code></dt>
13123 <dd><p>UCS-4 character encoding with big-endian endianness. It is like
13124 <code>UCS-4LE</code> except the endianness is set to big-endian.
13125 </p>
13126 </dd>
13127 </dl>
13129 </li><li>
13130 <code>char-encoding-errors:</code> ( <code>#f</code> | <code>#t</code> )
13132 <p>This setting controls whether illegal character encodings are silently
13133 replaced with the Unicode character #xfffd (replacement character) or
13134 raise an error. To set each direction separately the keywords
13135 <code>input-char-encoding-errors:</code> and
13136 <code>output-char-encoding-errors:</code> must be used instead of
13137 <code>char-encoding-errors:</code>. The default value of this setting is
13138 <code>#t</code>.
13139 </p>
13140 </li><li>
13141 <code>eol-encoding:</code> <var>encoding</var>
13143 <p>This setting controls the end-of-line encoding of the byte-port. To
13144 set each direction separately the keywords <code>input-eol-encoding:</code>
13145 and <code>output-eol-encoding:</code> must be used instead of
13146 <code>eol-encoding:</code>. The default value of this setting is operating
13147 system dependent, but this can be overridden through the runtime
13148 options (see section <a href="#Runtime-options">Runtime options</a>). Note that for output-ports the
13149 end-of-line encoding is applied before the character encoding, and for
13150 input-ports it is applied after. The following encodings are
13151 supported:
13152 </p>
13153 <dl compact="compact">
13154 <dt> <code>lf</code></dt>
13155 <dd><p>For an output-port, writing a <code>#\newline</code> character outputs a
13156 <code>#\linefeed</code> character to the stream (Unicode character code 10).
13157 For an input-port, a <code>#\newline</code> character is read when a
13158 <code>#\linefeed</code> character is encountered on the stream. Note that
13159 <code>#\linefeed</code> and <code>#\newline</code> are two names for the same
13160 character, so this end-of-line encoding is actually the identity
13161 function. Text files created by UNIX applications typically use this
13162 end-of-line encoding.
13163 </p>
13164 </dd>
13165 <dt> <code>cr</code></dt>
13166 <dd><p>For an output-port, writing a <code>#\newline</code> character outputs a
13167 <code>#\return</code> character to the stream (Unicode character code 13).
13168 For an input-port, a <code>#\newline</code> character is read when a
13169 <code>#\linefeed</code> character or a <code>#\return</code> character is
13170 encountered on the stream. Text files created by Classic Mac OS
13171 applications typically use this end-of-line encoding.
13172 </p>
13173 </dd>
13174 <dt> <code>cr-lf</code></dt>
13175 <dd><p>For an output-port, writing a <code>#\newline</code> character outputs to
13176 the stream a <code>#\return</code> character followed by a <code>#\linefeed</code>
13177 character. For an input-port, a <code>#\newline</code> character is read
13178 when a <code>#\linefeed</code> character or a <code>#\return</code> character is
13179 encountered on the stream. Moreover, if this character is immediately
13180 followed by the opposite character (<code>#\linefeed</code> followed by
13181 <code>#\return</code> or <code>#\return</code> followed by <code>#\linefeed</code>) then
13182 the second character is ignored. In other words, all four possible
13183 end-of-line encodings are read as a single <code>#\newline</code> character.
13184 Text files created by DOS and Microsoft Windows applications typically
13185 use this end-of-line encoding.
13186 </p>
13187 </dd>
13188 </dl>
13190 </li></ul>
13192 <hr size="1">
13193 <a name="Byte_002dport-operations"></a>
13194 <table cellpadding="1" cellspacing="1" border="0">
13195 <tr><td valign="middle" align="left"><a href="#Byte_002dport-settings" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.6.1 Byte-port settings" align="middle" width="32"></a></td>
13196 <td valign="middle" align="left"><a href="#Device_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.7 Device-ports" align="middle" width="32"></a></td>
13197 <td valign="middle" align="left"> &nbsp; </td>
13198 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13199 <td valign="middle" align="left"><a href="#Byte_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.6 Byte-ports" align="middle" width="32"></a></td>
13200 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13201 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13202 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13203 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13204 </tr></table>
13205 <a name="Byte_002dport-operations-1"></a>
13206 <h3 class="subsection">17.6.2 Byte-port operations</h3>
13208 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13210 <p>This procedure reads the byte input-port <var>port</var> and returns the
13211 byte at the current byte location and advances the current byte
13212 location to the next byte, unless the <var>port</var> is already at
13213 end-of-file in which case <code>read-u8</code> returns the end-of-file
13214 object. If it is not specified, <var>port</var> defaults to the current
13215 input-port.
13216 </p>
13217 <p>This procedure must be called when the port&rsquo;s input character buffer
13218 is empty otherwise the character-stream and byte-stream may be out of
13219 sync due to buffering. The input character buffer is used for bulk
13220 decoding of encoded characters (i.e. to translate the byte-stream into
13221 a character-stream). The input character buffer is initially empty.
13222 It is only when characters are read that it is filled with characters
13223 obtained by decoding the byte-stream.
13224 </p>
13225 <p>One way to ensure that the port&rsquo;s input character buffer is empty is
13226 to call <code>read-u8</code> strictly before any use of the port in a character
13227 input operation (i.e. a call to the procedures <code>read</code>,
13228 <code>read-char</code>, <code>peek-char</code>, etc). Alternatively
13229 <code>input-port-characters-buffered</code> can be used to get the number of
13230 characters in the port&rsquo;s input character buffer, and to empty the
13231 buffer with calls to <code>read-char</code> or <code>read-substring</code>.
13232 </p>
13233 <p>For example:
13234 </p>
13235 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-input-u8vector
13236 '#u8(11 22 33 44)
13237 (lambda (p)
13238 (let ((a (read-u8 p))) (list a (read-u8 p)))))</b>
13239 (11 22)
13240 &gt; <b>(call-with-input-u8vector '#u8() read-u8)</b>
13241 #!eof
13242 </pre></td></tr></table>
13246 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13248 <p>This procedure writes the byte <var>n</var> to the byte output-port
13249 <var>port</var> and advances the current byte location of that output-port.
13250 The value returned is unspecified. If it is not specified, <var>port</var>
13251 defaults to the current output-port.
13252 </p>
13253 <p>For example:
13254 </p>
13255 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(call-with-output-u8vector '() (lambda (p) (write-u8 33 p)))</b>
13256 #u8(33)
13257 </pre></td></tr></table>
13261 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13262 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13264 <p>These procedures support bulk byte I/O. The part of the u8vector
13265 <var>u8vector</var> starting at index <var>start</var> and ending just before
13266 index <var>end</var> is used as a byte buffer that will be the target of
13267 <code>read-subu8vector</code> or the source of the <code>write-subu8vector</code>.
13268 The <code>read-subu8vector</code> also accepts a <var>need</var> parameter which
13269 must be a nonnegative fixnum. Up to <var>end</var>-<var>start</var> bytes will
13270 be transferred. The number of bytes transferred, possibly zero, is
13271 returned by these procedures. Fewer bytes will be read by
13272 <code>read-subu8vector</code> if an end-of-file is read, or a timeout occurs
13273 before all the requested bytes are transferred and the timeout thunk
13274 returns <code>#f</code> (see the procedure <code>input-port-timeout-set!</code>),
13275 or <var>need</var> is specified and at least that many bytes have been read
13276 (in other words the procedure does not block for more bytes but may
13277 transfer more bytes if they are immediately available). Fewer bytes
13278 will be written by <code>write-subu8vector</code> if a timeout occurs before
13279 all the requested bytes are transferred and the timeout thunk returns
13280 <code>#f</code> (see the procedure <code>output-port-timeout-set!</code>). If it
13281 is not specified, <var>port</var> defaults to the current input-port and
13282 current output-port respectively.
13283 </p>
13284 <p>The procedure <code>read-subu8vector</code> must be called before any use of
13285 the port in a character input operation (i.e. a call to the procedures
13286 <code>read</code>, <code>read-char</code>, <code>peek-char</code>, etc) because
13287 otherwise the character-stream and byte-stream may be out of sync due
13288 to the port buffering.
13289 </p>
13290 <p>For example:
13291 </p>
13292 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define v (make-u8vector 10))</b>
13293 &gt; <b>(read-subu8vector v 2 5)123456789</b>
13295 &gt; 456789
13296 &gt; <b>v</b>
13297 #u8(0 0 49 50 51 0 0 0 0 0)
13298 &gt; <b>(read-subu8vector v 2 10 (current-input-port) 3)abcd</b>
13300 &gt; <b>v</b>
13301 #u8(0 0 97 98 99 100 10 0 0 0)
13302 </pre></td></tr></table>
13306 <hr size="1">
13307 <a name="Device_002dports"></a>
13308 <table cellpadding="1" cellspacing="1" border="0">
13309 <tr><td valign="middle" align="left"><a href="#Byte_002dport-operations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.6.2 Byte-port operations" align="middle" width="32"></a></td>
13310 <td valign="middle" align="left"><a href="#Filesystem-devices" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.7.1 Filesystem devices" align="middle" width="32"></a></td>
13311 <td valign="middle" align="left"> &nbsp; </td>
13312 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13313 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
13314 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13315 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13316 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13317 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13318 </tr></table>
13319 <a name="Device_002dports-1"></a>
13320 <h2 class="section">17.7 Device-ports</h2>
13322 <table class="menu" border="0" cellspacing="0">
13323 <tr><td align="left" valign="top"><a href="#Filesystem-devices">17.7.1 Filesystem devices</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
13324 <tr><td align="left" valign="top"><a href="#Process-devices">17.7.2 Process devices</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
13325 <tr><td align="left" valign="top"><a href="#Network-devices">17.7.3 Network devices</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
13326 </table>
13328 <hr size="1">
13329 <a name="Filesystem-devices"></a>
13330 <table cellpadding="1" cellspacing="1" border="0">
13331 <tr><td valign="middle" align="left"><a href="#Device_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.7 Device-ports" align="middle" width="32"></a></td>
13332 <td valign="middle" align="left"><a href="#Process-devices" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.7.2 Process devices" align="middle" width="32"></a></td>
13333 <td valign="middle" align="left"> &nbsp; </td>
13334 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13335 <td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.7 Device-ports" align="middle" width="32"></a></td>
13336 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13337 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13338 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13339 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13340 </tr></table>
13341 <a name="Filesystem-devices-1"></a>
13342 <h3 class="subsection">17.7.1 Filesystem devices</h3>
13344 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13345 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13346 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13347 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13348 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13349 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13350 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13352 <p>All of these procedures create a port to interface to a byte-stream
13353 device (such as a file, console, serial port, named pipe, etc) whose
13354 name is given by a path of the filesystem. The <code>direction:</code>
13355 setting will default to the value <code>input</code> for the procedures
13356 <code>open-input-file</code>, <code>call-with-input-file</code> and
13357 <code>with-input-from-file</code>, to the value <code>output</code> for the
13358 procedures <code>open-output-file</code>, <code>call-with-output-file</code> and
13359 <code>with-output-to-file</code>, and to the value <code>input-output</code> for
13360 the procedure <code>open-file</code>.
13361 </p>
13362 <p>The procedures <code>open-file</code>, <code>open-input-file</code> and
13363 <code>open-output-file</code> return the port that is created. The
13364 procedures <code>call-with-input-file</code> and
13365 <code>call-with-output-file</code> call the procedure <var>proc</var> with the
13366 port as single argument, and then return the value(s) of this call
13367 after closing the port. The procedures <code>with-input-from-file</code>
13368 and <code>with-output-to-file</code> dynamically bind the current input-port
13369 and current output-port respectively to the port created for the
13370 duration of a call to the procedure <var>thunk</var> with no argument. The
13371 value(s) of the call to <var>thunk</var> are returned after closing the
13372 port.
13373 </p>
13374 <p>The first argument of these procedures is either a string denoting a
13375 filesystem path or a list of port settings which must contain a
13376 <code>path:</code> setting. Here are the settings allowed in addition to
13377 the generic settings of byte-ports:
13378 </p>
13379 <ul>
13380 <li>
13381 <code>path:</code> <var>string</var>
13383 <p>This setting indicates the location of the file in the filesystem.
13384 There is no default value for this setting.
13385 </p>
13386 </li><li>
13387 <code>append:</code> ( <code>#f</code> | <code>#t</code> )
13389 <p>This setting controls whether output will be added to the end of the
13390 file. This is useful for writing to log files that might be open by
13391 more than one process. The default value of this setting is
13392 <code>#f</code>.
13393 </p>
13394 </li><li>
13395 <code>create:</code> ( <code>#f</code> | <code>#t</code> | <code>maybe</code> )
13397 <p>This setting controls whether the file will be created when it is
13398 opened. A setting of <code>#f</code> requires that the file exist
13399 (otherwise an exception is raised). A setting of <code>#t</code> requires
13400 that the file does not exist (otherwise an exception is raised). A
13401 setting of <code>maybe</code> will create the file if it does not exist.
13402 The default value of this setting is <code>maybe</code> for output-ports and
13403 <code>#f</code> for input-ports and bidirectional ports.
13404 </p>
13405 </li><li>
13406 <code>permissions:</code> <var>12-bit-exact-integer</var>
13408 <p>This setting controls the UNIX permissions that will be attached to
13409 the file if it is created. The default value of this setting is
13410 <code>#o666</code>.
13411 </p>
13412 </li><li>
13413 <code>truncate:</code> ( <code>#f</code> | <code>#t</code> )
13415 <p>This setting controls whether the file will be truncated when it is
13416 opened. For input-ports, the default value of this setting is
13417 <code>#f</code>. For output-ports, the default value of this setting is
13418 <code>#t</code> when the <code>append:</code> setting is <code>#f</code>, and <code>#f</code>
13419 otherwise.
13420 </p>
13421 </li></ul>
13423 <p>For example:
13424 </p>
13425 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(with-output-to-file
13426 (list path: &quot;nofile&quot;
13427 create: #f)
13428 (lambda ()
13429 (display &quot;hello world!\n&quot;)))</b>
13430 *** ERROR IN (console)@1.1 -- No such file or directory
13431 (with-output-to-file '(path: &quot;nofile&quot; create: #f) '#&lt;procedure #2&gt;)
13432 </pre></td></tr></table>
13436 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13437 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13439 <p>When called with a single argument these procedures return the byte
13440 position where the next I/O operation would take place in the file
13441 attached to the given <var>port</var> (relative to the beginning of the
13442 file). When called with two or three arguments, the byte position for
13443 subsequent I/O operations on the given <var>port</var> is changed to
13444 <var>position</var>, which must be an exact integer. When <var>whence</var> is
13445 omitted or is 0, the <var>position</var> is relative to the beginning of
13446 the file. When <var>whence</var> is 1, the <var>position</var> is relative to
13447 the current byte position of the file. When <var>whence</var> is 2, the
13448 <var>position</var> is relative to the end of the file. The return value
13449 is the new byte position. On most operating systems the byte position
13450 for reading and writing of a given bidirectional port are the same.
13451 </p>
13452 <p>When <code>input-port-byte-position</code> is called to change the byte
13453 position of an input-port, all input buffers will be flushed so that
13454 the next byte read will be the one at the given position.
13455 </p>
13456 <p>When <code>output-port-byte-position</code> is called to change the byte
13457 position of an output-port, there is an implicit call to
13458 <code>force-output</code> before the position is changed.
13459 </p>
13460 <p>For example:
13461 </p>
13462 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p <span class="roman"><i>; p is an input-output-port</i></span>
13463 (open-file '(path: &quot;test&quot; char-encoding: ISO-8859-1 create: maybe)))</b>
13464 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13465 (0 0)
13466 &gt; <b>(display &quot;abcdefghij\n&quot; p)</b>
13467 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13468 (0 0)
13469 &gt; <b>(force-output p)</b>
13470 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13471 (11 11)
13472 &gt; <b>(input-port-byte-position p 2)</b>
13474 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13475 (2 2)
13476 &gt; <b>(peek-char p)</b>
13478 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13479 (11 11)
13480 &gt; <b>(output-port-byte-position p -7 2)</b>
13482 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13483 (4 4)
13484 &gt; <b>(write-char #\! p)</b>
13485 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13486 (4 4)
13487 &gt; <b>(force-output p)</b>
13488 &gt; <b>(list (input-port-byte-position p) (output-port-byte-position p))</b>
13489 (5 5)
13490 &gt; <b>(input-port-byte-position p 1)</b>
13492 &gt; <b>(read p)</b>
13493 bcd!fghij
13494 </pre></td></tr></table>
13498 <hr size="1">
13499 <a name="Process-devices"></a>
13500 <table cellpadding="1" cellspacing="1" border="0">
13501 <tr><td valign="middle" align="left"><a href="#Filesystem-devices" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.7.1 Filesystem devices" align="middle" width="32"></a></td>
13502 <td valign="middle" align="left"><a href="#Network-devices" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.7.3 Network devices" align="middle" width="32"></a></td>
13503 <td valign="middle" align="left"> &nbsp; </td>
13504 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13505 <td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.7 Device-ports" align="middle" width="32"></a></td>
13506 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13507 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13508 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13509 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13510 </tr></table>
13511 <a name="Process-devices-1"></a>
13512 <h3 class="subsection">17.7.2 Process devices</h3>
13514 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13515 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13516 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13517 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13518 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13519 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13520 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13522 <p>All of these procedures start a new operating system process and
13523 create a bidirectional port which allows communication with that
13524 process on its standard input and standard output. The
13525 <code>direction:</code> setting will default to the value <code>input</code> for
13526 the procedures <code>open-input-process</code>,
13527 <code>call-with-input-process</code> and <code>with-input-from-process</code>, to
13528 the value <code>output</code> for the procedures <code>open-output-process</code>,
13529 <code>call-with-output-process</code> and <code>with-output-to-process</code>, and
13530 to the value <code>input-output</code> for the procedure
13531 <code>open-process</code>. If the <code>direction:</code> setting is
13532 <code>input</code>, the output-port side is closed. If the
13533 <code>direction:</code> setting is <code>output</code>, the input-port side is
13534 closed.
13535 </p>
13536 <p>The procedures <code>open-process</code>, <code>open-input-process</code> and
13537 <code>open-output-process</code> return the port that is created. The
13538 procedures <code>call-with-input-process</code> and
13539 <code>call-with-output-process</code> call the procedure <var>proc</var> with the
13540 port as single argument, and then return the value(s) of this call
13541 after closing the port and waiting for the process to terminate. The
13542 procedures <code>with-input-from-process</code> and
13543 <code>with-output-to-process</code> dynamically bind the current input-port
13544 and current output-port respectively to the port created for the
13545 duration of a call to the procedure <var>thunk</var> with no argument. The
13546 value(s) of the call to <var>thunk</var> are returned after closing the
13547 port and waiting for the process to terminate.
13548 </p>
13549 <p>The first argument of this procedure is either a string denoting a
13550 filesystem path of an executable program or a list of port settings
13551 which must contain a <code>path:</code> setting. Here are the settings
13552 allowed in addition to the generic settings of byte-ports:
13553 </p>
13554 <ul>
13555 <li>
13556 <code>path:</code> <var>string</var>
13558 <p>This setting indicates the location of the executable program in the
13559 filesystem. There is no default value for this setting.
13560 </p>
13561 </li><li>
13562 <code>arguments:</code> <var>list-of-strings</var>
13564 <p>This setting indicates the string arguments that are passed to the
13565 program. The default value of this setting is the empty list (i.e. no
13566 arguments).
13567 </p>
13568 </li><li>
13569 <code>environment:</code> <var>list-of-strings</var>
13571 <p>This setting indicates the set of environment variable bindings that
13572 the process receives. Each element of the list is a string of the
13573 form &ldquo;<code><var>VAR</var>=<var>VALUE</var></code>&rdquo;, where <code><var>VAR</var></code> is the
13574 name of the variable and <code><var>VALUE</var></code> is its binding. When
13575 <var>list-of-strings</var> is <code>#f</code>, the process inherits the
13576 environment variable bindings of the Scheme program. The default
13577 value of this setting is <code>#f</code>.
13578 </p>
13579 </li><li>
13580 <code>directory:</code> <var>dir</var>
13582 <p>This setting indicates the current working directory of the process.
13583 When <var>dir</var> is <code>#f</code>, the process uses the value of
13584 <code>(current-directory)</code>. The default value of this setting is
13585 <code>#f</code>.
13586 </p>
13587 </li><li>
13588 <code>stdin-redirection:</code> ( <code>#f</code> | <code>#t</code> )
13590 <p>This setting indicates how the standard input of the process is
13591 redirected. A setting of <code>#t</code> will redirect the standard input
13592 from the process-port (i.e. what is written to the process-port will
13593 be available on the standard input). A setting of <code>#f</code> will
13594 leave the standard input as-is, which typically results in input
13595 coming from the console. The default value of this setting is
13596 <code>#t</code>.
13597 </p>
13598 </li><li>
13599 <code>stdout-redirection:</code> ( <code>#f</code> | <code>#t</code> )
13601 <p>This setting indicates how the standard output of the process is
13602 redirected. A setting of <code>#t</code> will redirect the standard output
13603 to the process-port (i.e. all output to standard output can be read
13604 from the process-port). A setting of <code>#f</code> will leave the
13605 standard output as-is, which typically results in the output going to
13606 the console. The default value of this setting is <code>#t</code>.
13607 </p>
13608 </li><li>
13609 <code>stderr-redirection:</code> ( <code>#f</code> | <code>#t</code> )
13611 <p>This setting indicates how the standard error of the process is
13612 redirected. A setting of <code>#t</code> will redirect the standard error
13613 to the process-port (i.e. all output to standard error can be read
13614 from the process-port). A setting of <code>#f</code> will leave the
13615 standard error as-is, which typically results in error messages being
13616 output to the console. The default value of this setting is
13617 <code>#f</code>.
13618 </p>
13619 </li><li>
13620 <code>pseudo-terminal:</code> ( <code>#f</code> | <code>#t</code> )
13622 <p>This setting applies to UNIX. It indicates what type of device will
13623 be bound to the process&rsquo; standard input and standard output. A
13624 setting of <code>#t</code> will use a pseudo-terminal device (this is a
13625 device that behaves like a tty device even though there is no real
13626 terminal or user directly involved). A setting of <code>#f</code> will use
13627 a pair of pipes. The difference is important for programs which
13628 behave differently when they are used interactively, for example
13629 shells. The default value of this setting is <code>#f</code>.
13630 </p>
13631 </li><li>
13632 <code>show-console:</code> ( <code>#f</code> | <code>#t</code> )
13634 <p>This setting applies to Microsoft Windows. It controls whether the
13635 process&rsquo; console window will be hidden or visible. The default value
13636 of this setting is <code>#t</code> (i.e. show the console window).
13637 </p>
13638 </li></ul>
13640 <p>For example:
13641 </p>
13642 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(with-input-from-process &quot;date&quot; read-line)</b>
13643 &quot;Sun Jun 14 15:06:41 EDT 2009&quot;
13644 &gt; <b>(define p (open-process (list path: &quot;ls&quot;
13645 arguments: '(&quot;../examples&quot;))))</b>
13646 &gt; <b>(read-line p)</b>
13647 &quot;README&quot;
13648 &gt; <b>(read-line p)</b>
13649 &quot;Xlib-simple&quot;
13650 &gt; <b>(close-port p)</b>
13651 &gt; <b>(define p (open-process &quot;/usr/bin/dc&quot;))</b>
13652 &gt; <b>(display &quot;2 100 ^ p\n&quot; p)</b>
13653 &gt; <b>(force-output p)</b>
13654 &gt; <b>(read-line p)</b>
13655 &quot;1267650600228229401496703205376&quot;
13656 </pre></td></tr></table>
13660 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13662 <p>This procedure returns the PID (Process Identifier) of the process of
13663 <var>process-port</var>. The PID is a small exact integer.
13664 </p>
13665 <p>For example:
13666 </p>
13667 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(let ((p (open-process &quot;sort&quot;)))
13668 (process-pid p))</b>
13670 </pre></td></tr></table>
13674 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13676 <p>This procedure causes the current thread to wait until the process of
13677 <var>process-port</var> terminates (normally or not) or until the timeout
13678 is reached if <var>timeout</var> is supplied. If the timeout is reached,
13679 <var>process-status</var> returns <var>timeout-val</var> if it is supplied,
13680 otherwise an unterminated-process-exception object is raised. The
13681 procedure returns the process exit status as encoded by the operating
13682 system. Typically, if the process exited normally the return value is
13683 the process exit status multiplied by 256.
13684 </p>
13685 <p>For example:
13686 </p>
13687 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(let ((p (open-process &quot;sort&quot;)))
13688 (for-each (lambda (x) (pretty-print x p))
13689 '(22 11 33))
13690 (close-output-port p)
13691 (let ((r (read-all p)))
13692 (close-input-port p)
13693 (list (process-status p) r)))</b>
13694 (0 (11 22 33))
13695 </pre></td></tr></table>
13699 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13700 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13701 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13703 <p>Unterminated-process-exception objects are raised when a call to the
13704 <code>process-status</code> procedure reaches its timeout before the target
13705 process terminates and a timeout-value parameter is not specified.
13706 The parameter <var>exc</var> must be an unterminated-process-exception
13707 object.
13708 </p>
13709 <p>The procedure <code>unterminated-process-exception?</code> returns
13710 <code>#t</code> when <var>obj</var> is an unterminated-process-exception
13711 object and <code>#f</code> otherwise.
13712 </p>
13713 <p>The procedure <code>unterminated-process-exception-procedure</code>
13714 returns the procedure that raised <var>exc</var>.
13715 </p>
13716 <p>The procedure <code>unterminated-process-exception-arguments</code>
13717 returns the list of arguments of the procedure that raised <var>exc</var>.
13718 </p>
13719 <p>For example:
13720 </p>
13721 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (handler exc)
13722 (if (unterminated-process-exception? exc)
13723 (list (unterminated-process-exception-procedure exc)
13724 (unterminated-process-exception-arguments exc))
13725 'not-unterminated-process-exception))</b>
13726 &gt; <b>(with-exception-catcher
13727 handler
13728 (lambda ()
13729 (let ((p (open-process &quot;sort&quot;)))
13730 (process-status p 1))))</b>
13731 (#&lt;procedure #2 process-status&gt; (#&lt;input-output-port #3 (process &quot;sort&quot;)&gt;))
13732 </pre></td></tr></table>
13736 <hr size="1">
13737 <a name="Network-devices"></a>
13738 <table cellpadding="1" cellspacing="1" border="0">
13739 <tr><td valign="middle" align="left"><a href="#Process-devices" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.7.2 Process devices" align="middle" width="32"></a></td>
13740 <td valign="middle" align="left"><a href="#Directory_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.8 Directory-ports" align="middle" width="32"></a></td>
13741 <td valign="middle" align="left"> &nbsp; </td>
13742 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13743 <td valign="middle" align="left"><a href="#Device_002dports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17.7 Device-ports" align="middle" width="32"></a></td>
13744 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13745 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13746 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13747 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13748 </tr></table>
13749 <a name="Network-devices-1"></a>
13750 <h3 class="subsection">17.7.3 Network devices</h3>
13752 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13754 <p>This procedure opens a network connection to a socket server and
13755 returns a tcp-client-port (a subtype of device-port) that represents
13756 this connection and allows communication with that server. The
13757 default value of the <code>direction:</code> setting is <code>input-output</code>,
13758 i.e. the Scheme program can send information to the server and receive
13759 information from the server. The sending direction can be
13760 &ldquo;shutdown&rdquo; using the <code>close-output-port</code> procedure and the
13761 receiving direction can be &ldquo;shutdown&rdquo; using the
13762 <code>close-input-port</code> procedure. The <code>close-port</code> procedure
13763 closes both directions of the connection.
13764 </p>
13765 <p>The parameter of this procedure is an IP port number (16-bit nonnegative
13766 exact integer), a string of the form <code>&quot;<var>HOST</var>:<var>PORT</var>&quot;</code> or
13767 a list of port settings. When the parameter is the number <var>PORT</var>
13768 it is handled as if it was the setting <code>port-number:</code> <var>PORT</var>.
13769 When the parameter is the string <code>&quot;<var>HOST</var>:<var>PORT</var>&quot;</code> it is
13770 handled as if it was the setting <code>server-address:</code>
13771 <code>&quot;<var>HOST</var>:<var>PORT</var>&quot;</code>.
13772 </p>
13773 <p>Here are the settings allowed in addition to the generic settings of
13774 byte-ports:
13775 </p>
13776 <ul>
13777 <li>
13778 <code>server-address:</code> <var>string-or-ip-address</var>
13780 <p>This setting indicates the internet address of the server, and
13781 possibly the IP port number. When this parameter is not specified or
13782 is <code>&quot;&quot;</code>, the connection requests are sent to the loopback
13783 interface (with IP address 127.0.0.1). The parameter can be a string
13784 denoting a host name, which will be translated to an IP address by the
13785 <code>host-info</code> procedure, or a 4 element u8vector which contains the
13786 32-bit IPv4 address or an 8 element u16vector which contains the
13787 128-bit IPv6 address. A string of the form
13788 <code>&quot;<var>HOST</var>:<var>PORT</var>&quot;</code> is handled as if it was the combination
13789 of settings <code>server-address:</code> <code>&quot;<var>HOST</var>&quot;</code>
13790 <code>port-number:</code> <var>PORT</var>.
13791 </p>
13792 </li><li>
13793 <code>port-number:</code> <var>16-bit-exact-integer</var>
13795 <p>This setting indicates the IP port number of the server to connect
13796 to (e.g. 80 for the standard HTTP server, 23 for the standard telnet
13797 server). There is no default value for this setting.
13798 </p>
13799 </li><li>
13800 <code>keep-alive:</code> ( <code>#f</code> | <code>#t</code> )
13802 <p>This setting controls the use of the &ldquo;keep alive&rdquo; option on the
13803 connection. The &ldquo;keep alive&rdquo; option will periodically send control
13804 packets on otherwise idle network connections to ensure that the
13805 server host is active and reachable. The default value of this
13806 setting is <code>#f</code>.
13807 </p>
13808 </li><li>
13809 <code>coalesce:</code> ( <code>#f</code> | <code>#t</code> )
13811 <p>This setting controls the use of TCP&rsquo;s &ldquo;Nagle algorithm&rdquo; which
13812 reduces the number of small packets by delaying their transmission and
13813 coalescing them into larger packets. A setting of <code>#t</code> will
13814 coalesce small packets into larger ones. A setting of <code>#f</code> will
13815 transmit packets as soon as possible. The default value of this
13816 setting is <code>#t</code>. Note that this setting does not affect the
13817 buffering of the port.
13818 </p>
13819 </li></ul>
13821 <p>Below is an example of the client-side code that opens a connection to
13822 an HTTP server on port 8080 of the loopback interface (with IP address
13823 127.0.0.1). For the server-side code see the example for the
13824 procedure <code>open-tcp-server</code>.
13825 </p>
13826 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-tcp-client (list port-number: 8080
13827 eol-encoding: 'cr-lf)))</b>
13828 &gt; <b>p</b>
13829 #&lt;input-output-port #2 (tcp-client #u8(127 0 0 1) 8080)&gt;
13830 &gt; <b>(display &quot;GET /\n&quot; p)</b>
13831 &gt; <b>(force-output p)</b>
13832 &gt; <b>(read-line p)</b>
13833 &quot;&lt;HTML&gt;&quot;
13834 </pre></td></tr></table>
13838 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13840 <p>This procedure sets up a socket to accept network connection requests
13841 from clients and returns a tcp-server-port from which network
13842 connections to clients are obtained. Tcp-server-ports are a direct
13843 subtype of object-ports (i.e. they are not character-ports) and are
13844 input-ports. Reading from a tcp-server-port with the <code>read</code>
13845 procedure will block until a network connection request is received
13846 from a client. The <code>read</code> procedure will then return a
13847 tcp-client-port (a subtype of device-port) that represents this
13848 connection and allows communication with that client. Closing a
13849 tcp-server-port with either the <code>close-input-port</code> or
13850 <code>close-port</code> procedures will cause the network subsystem to stop
13851 accepting connections on that socket.
13852 </p>
13853 <p>The parameter of this procedure is an IP port number (16-bit nonnegative
13854 exact integer), a string of the form <code>&quot;<var>INTF</var>:<var>PORT</var>&quot;</code> or
13855 a list of port settings which must contain a <code>port-number:</code>
13856 setting. When the parameter is the number <var>PORT</var> it is handled as
13857 if it was the setting <code>port-number:</code> <var>PORT</var>. When the
13858 parameter is the string <code>&quot;<var>INTF</var>:<var>PORT</var>&quot;</code> it is handled
13859 as if it was the setting <code>server-address:</code>
13860 <code>&quot;<var>INTF</var>:<var>PORT</var>&quot;</code>.
13861 </p>
13862 <p>Below is a list of the settings allowed in addition to the settings
13863 <code>keep-alive:</code> and <code>coalesce:</code> allowed by the
13864 <code>open-tcp-client</code> procedure and the generic settings of
13865 byte-ports. The settings which are not listed below apply to the
13866 tcp-client-port that is returned by <code>read</code> when a connection is
13867 accepted and have the same meaning as if they were used in a call to
13868 the <code>open-tcp-client</code> procedure.
13869 </p>
13870 <ul>
13871 <li>
13872 <code>server-address:</code> <var>string-or-ip-address</var>
13874 <p>This setting indicates the internet address of the network interface
13875 on which connections requests are accepted, and possibly the IP port
13876 number. When this parameter is not specified or is <code>&quot;&quot;</code>, the
13877 connection requests are accepted only on the loopback interface (with
13878 IP address 127.0.0.1). When this parameter is <code>&quot;*&quot;</code>, the
13879 connection requests are accepted on all network interfaces
13880 (i.e. address INADDR_ANY). The parameter can be a string denoting a
13881 host name, which will be translated to an IP address by the
13882 <code>host-info</code> procedure, or a 4 element u8vector which contains the
13883 32-bit IPv4 address or an 8 element u16vector which contains the
13884 128-bit IPv6 address. A string of the form
13885 <code>&quot;<var>INTF</var>:<var>PORT</var>&quot;</code> is handled as if it was the combination
13886 of settings <code>server-address:</code> <code>&quot;<var>INTF</var>&quot;</code>
13887 <code>port-number:</code> <var>PORT</var>.
13888 </p>
13889 </li><li>
13890 <code>port-number:</code> <var>16-bit-exact-integer</var>
13892 <p>This setting indicates the IP port number assigned to the socket which
13893 accepts connection requests from clients. So called &ldquo;well-known
13894 ports&rdquo;, which are reserved for standard services, have a port number
13895 below 1024 and can only be assigned to a socket by a process with
13896 superuser priviledges (e.g. 80 for the HTTP service, 23 for the telnet
13897 service). No special priviledges are needed to assign higher
13898 port numbers to a socket. The special value 0 requests that a
13899 currently unused port number be assigned to the socket (the port
13900 number assigned can be retrieved using the procedure
13901 <code>tcp-server-socket-info</code>). There is no default value for this
13902 setting.
13903 </p>
13904 </li><li>
13905 <code>backlog:</code> <var>positive-exact-integer</var>
13907 <p>This setting indicates the maximum number of connection requests that
13908 can be waiting to be accepted by a call to <code>read</code> (technically it
13909 is the value passed as the second argument of the UNIX <code>listen()</code>
13910 function). The default value of this setting is 128.
13911 </p>
13912 </li><li>
13913 <code>reuse-address:</code> ( <code>#f</code> | <code>#t</code> )
13915 <p>This setting controls whether it is possible to assign a port number
13916 that is currently active. Note that when a server process terminates,
13917 the socket it was using to accept connection requests does not become
13918 inactive immediately. Instead it remains active for a few minutes to
13919 ensure clean termination of the connections. A setting of <code>#f</code>
13920 will cause an exception to be raised in that case. A setting of
13921 <code>#t</code> will allow a port number to be used even if it is active.
13922 The default value of this setting is <code>#t</code>.
13923 </p>
13924 </li></ul>
13926 <p>Below is an example of the server-side code that accepts connections
13927 on port 8080 of any network interface. For the client-side code see
13928 the example for the procedure <code>open-tcp-client</code>.
13929 </p>
13930 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define s (open-tcp-server (list server-address: &quot;*&quot;
13931 port-number: 8080
13932 eol-encoding: 'cr-lf)))</b>
13933 &gt; <b>(define p (read s)) <span class="roman"><i>; blocks until client connects</i></span></b>
13934 &gt; <b>p</b>
13935 #&lt;input-output-port #2 (tcp-client 8080)&gt;
13936 &gt; <b>(read-line p)</b>
13937 &quot;GET /&quot;
13938 &gt; <b>(display &quot;&lt;HTML&gt;\n&quot; p)</b>
13939 &gt; <b>(force-output p)</b>
13940 </pre></td></tr></table>
13944 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13945 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13947 <p>The procedure <code>tcp-service-register!</code> sets up a socket to accept
13948 network connection requests from clients and creates a &ldquo;service&rdquo;
13949 thread which processes the incoming connections. The parameter
13950 <var>port-number-or-address-or-settings</var> has the same meaning as for
13951 the procedure <code>open-tcp-server</code>.
13952 </p>
13953 <p>For each connection established the service thread creates a
13954 &ldquo;handler&rdquo; thread which executes a call to the procedure <var>thunk</var>
13955 with no argument. The handler thread&rsquo;s current input-port and current
13956 output-port are both set to the tcp-client-port created for the
13957 connection. There is no need for the <var>thunk</var> to close the
13958 tcp-client-port, as this is done by the handler thread when the
13959 <var>thunk</var> returns normally.
13960 </p>
13961 <p>The procedure <code>tcp-service-unregister!</code> terminates the service
13962 thread which was registered by <code>tcp-service-register!</code> with the
13963 same network interface and port number (if a service thread is still
13964 registered). The procedure <code>tcp-service-register!</code> implicitly
13965 calls <code>tcp-service-unregister!</code> before registering the new
13966 service thread.
13967 </p>
13968 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(tcp-service-register!
13969 8000
13970 (lambda () (display &quot;hello\n&quot;)))</b>
13971 &gt; <b>(define p (open-tcp-client 8000))</b>
13972 &gt; <b>(read-line p)</b>
13973 &quot;hello&quot;
13974 &gt; <b>(tcp-service-unregister! 8000)</b>
13975 </pre></td></tr></table>
13979 <hr size="1">
13980 <a name="Directory_002dports"></a>
13981 <table cellpadding="1" cellspacing="1" border="0">
13982 <tr><td valign="middle" align="left"><a href="#Network-devices" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.7.3 Network devices" align="middle" width="32"></a></td>
13983 <td valign="middle" align="left"><a href="#Vector_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.9 Vector-ports" align="middle" width="32"></a></td>
13984 <td valign="middle" align="left"> &nbsp; </td>
13985 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
13986 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
13987 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
13988 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
13989 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
13990 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
13991 </tr></table>
13992 <a name="Directory_002dports-1"></a>
13993 <h2 class="section">17.8 Directory-ports</h2>
13995 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
13997 <p>This procedure opens a directory of the filesystem for reading its
13998 entries and returns a directory-port from which the entries can be
13999 enumerated. Directory-ports are a direct subtype of object-ports
14000 (i.e. they are not character-ports) and are input-ports. Reading from
14001 a directory-port with the <code>read</code> procedure returns the next file
14002 name in the directory as a string. The end-of-file object is returned
14003 when all the file names have been enumerated. Another way to get the
14004 list of all files in a directory is the <code>directory-files</code>
14005 procedure which returns a list of the files in the directory. The
14006 advantage of using directory-ports is that it allows iterating over
14007 the files in a directory in constant space, which is interesting when
14008 the number of files in the directory is not known in advance and may
14009 be large. Note that the order in which the names are returned is
14010 operating-system dependent.
14011 </p>
14012 <p>The parameter of this procedure is either a string denoting a
14013 filesystem path to a directory or a list of port settings which must
14014 contain a <code>path:</code> setting. Here are the settings allowed in
14015 addition to the generic settings of object-ports:
14016 </p>
14017 <ul>
14018 <li>
14019 <code>path:</code> <var>string</var>
14021 <p>This setting indicates the location of the directory in the filesystem.
14022 There is no default value for this setting.
14023 </p>
14024 </li><li>
14025 <code>ignore-hidden:</code> ( <code>#f</code> | <code>#t</code> | <code>dot-and-dot-dot</code> )
14027 <p>This setting controls whether hidden-files will be returned. Under
14028 UNIX and Mac OS X hidden-files are those that start with a period
14029 (such as <samp>.</samp>, <samp>..</samp>, and <samp>.profile</samp>). Under Microsoft
14030 Windows hidden files are the <samp>.</samp> and <samp>..</samp> entries and the
14031 files whose &ldquo;hidden file&rdquo; attribute is set. A setting of <code>#f</code>
14032 will enumerate all the files. A setting of <code>#t</code> will only
14033 enumerate the files that are not hidden. A setting of
14034 <code>dot-and-dot-dot</code> will enumerate all the files except for the
14035 <samp>.</samp> and <samp>..</samp> hidden files. The default value of this
14036 setting is <code>#t</code>.
14037 </p>
14038 </li></ul>
14040 <p>For example:
14041 </p>
14042 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(let ((p (open-directory (list path: &quot;../examples&quot;
14043 ignore-hidden: #f))))
14044 (let loop ()
14045 (let ((fn (read p)))
14046 (if (string? fn)
14047 (begin
14048 (pp (path-expand fn))
14049 (loop)))))
14050 (close-input-port p))</b>
14051 &quot;/u/feeley/examples/.&quot;
14052 &quot;/u/feeley/examples/..&quot;
14053 &quot;/u/feeley/examples/complex&quot;
14054 &quot;/u/feeley/examples/README&quot;
14055 &quot;/u/feeley/examples/simple&quot;
14056 &gt; <b>(define x (open-directory &quot;../examples&quot;))</b>
14057 &gt; <b>(read-all x)</b>
14058 (&quot;complex&quot; &quot;README&quot; &quot;simple&quot;)
14059 </pre></td></tr></table>
14063 <hr size="1">
14064 <a name="Vector_002dports"></a>
14065 <table cellpadding="1" cellspacing="1" border="0">
14066 <tr><td valign="middle" align="left"><a href="#Directory_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.8 Directory-ports" align="middle" width="32"></a></td>
14067 <td valign="middle" align="left"><a href="#String_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.10 String-ports" align="middle" width="32"></a></td>
14068 <td valign="middle" align="left"> &nbsp; </td>
14069 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
14070 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
14071 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14072 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14073 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14074 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14075 </tr></table>
14076 <a name="Vector_002dports-1"></a>
14077 <h2 class="section">17.9 Vector-ports</h2>
14079 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14080 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14081 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14082 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14083 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14084 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14085 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14087 <p>Vector-ports represent streams of Scheme objects. They are a direct
14088 subtype of object-ports (i.e. they are not character-ports). All of
14089 these procedures create vector-ports that are either unidirectional or
14090 bidirectional. The <code>direction:</code> setting will default to the
14091 value <code>input</code> for the procedures <code>open-input-vector</code>,
14092 <code>call-with-input-vector</code> and <code>with-input-from-vector</code>, to
14093 the value <code>output</code> for the procedures <code>open-output-vector</code>,
14094 <code>call-with-output-vector</code> and <code>with-output-to-vector</code>, and
14095 to the value <code>input-output</code> for the procedure <code>open-vector</code>.
14096 Bidirectional vector-ports behave like FIFOs: data written to the port
14097 is added to the end of the stream that is read. It is only when a
14098 bidirectional vector-port&rsquo;s output-side is closed with a call to the
14099 <code>close-output-port</code> procedure that the stream&rsquo;s end is known
14100 (when the stream&rsquo;s end is reached, reading the port returns the
14101 end-of-file object).
14102 </p>
14103 <p>The procedures <code>open-vector</code>, <code>open-input-vector</code> and
14104 <code>open-output-vector</code> return the port that is created. The
14105 procedures <code>call-with-input-vector</code> and
14106 <code>call-with-output-vector</code> create a vector port, call the
14107 procedure <var>proc</var> with the port as single argument and then close
14108 the port. The procedures <code>with-input-from-vector</code> and
14109 <code>with-output-to-vector</code> create a vector port, dynamically bind
14110 the current input-port and current output-port respectively to the
14111 port created for the duration of a call to the procedure <var>thunk</var>
14112 with no argument, and then close the port. The procedures
14113 <code>call-with-input-vector</code> and <code>with-input-from-vector</code> return
14114 the value returned by the procedures <var>proc</var> and <var>thunk</var>
14115 respectively. The procedures <code>call-with-output-vector</code> and
14116 <code>with-output-to-vector</code> return the vector accumulated in the port
14117 (see <code>get-output-vector</code>).
14118 </p>
14119 <p>The first parameter of these procedures is either a vector of the
14120 elements used to initialize the stream or a list of port settings. If
14121 it is not specified, the parameter of the <code>open-vector</code>,
14122 <code>open-input-vector</code>, and <code>open-output-vector</code> procedures
14123 defaults to an empty list of port settings. Here are the settings
14124 allowed in addition to the generic settings of object-ports:
14125 </p>
14126 <ul>
14127 <li>
14128 <code>init:</code> <var>vector</var>
14130 <p>This setting indicates the initial content of the stream. The default
14131 value of this setting is an empty vector.
14132 </p>
14133 </li><li>
14134 <code>permanent-close:</code> ( <code>#f</code> | <code>#t</code> )
14136 <p>This setting controls whether a call to the procedures
14137 <code>close-output-port</code> will close the output-side of a bidirectional
14138 vector-port permanently or not. A permanently closed bidirectional
14139 vector-port whose end-of-file has been reached on the input-side will
14140 return the end-of-file object for all subsequent calls to the
14141 <code>read</code> procedure. A non-permanently closed bidirectional
14142 vector-port will return to its opened state when its end-of-file is
14143 read. The default value of this setting is <code>#t</code>.
14144 </p>
14145 </li></ul>
14147 <p>For example:
14148 </p>
14149 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-vector))</b>
14150 &gt; <b>(write 1 p)</b>
14151 &gt; <b>(write 2 p)</b>
14152 &gt; <b>(write 3 p)</b>
14153 &gt; <b>(force-output p)</b>
14154 &gt; <b>(read p)</b>
14156 &gt; <b>(read p)</b>
14158 &gt; <b>(close-output-port p)</b>
14159 &gt; <b>(read p)</b>
14161 &gt; <b>(read p)</b>
14162 #!eof
14163 &gt; <b>(with-output-to-vector '() (lambda () (write 1) (write 2)))</b>
14164 #(1 2)
14165 </pre></td></tr></table>
14169 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14171 <p>The procedure <code>open-vector-pipe</code> creates two vector-ports and
14172 returns these two ports. The two ports are interrelated as follows:
14173 the first port&rsquo;s output-side is connected to the second port&rsquo;s
14174 input-side and the first port&rsquo;s input-side is connected to the second
14175 port&rsquo;s output-side. The value <var>vector-or-settings1</var> is used to
14176 setup the first vector-port and <var>vector-or-settings2</var> is used to
14177 setup the second vector-port. The same settings as for
14178 <code>open-vector</code> are allowed. The default <code>direction:</code> setting
14179 is <code>input-output</code> (i.e. a bidirectional port is created). If it
14180 is not specified <var>vector-or-settings1</var> defaults to the empty list.
14181 If it is not specified <var>vector-or-settings2</var> defaults to
14182 <var>vector-or-settings1</var> but with the <code>init:</code> setting set to the
14183 empty vector and with the input and output settings exchanged (e.g. if
14184 the first port is an input-port then the second port is an
14185 output-port, if the first port&rsquo;s input-side is non-buffered then the
14186 second port&rsquo;s output-side is non-buffered).
14187 </p>
14188 <p>For example:
14189 </p>
14190 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (server op)
14191 (receive (c s) (open-vector-pipe) <span class="roman"><i>; client-side and server-side ports</i></span>
14192 (thread-start!
14193 (make-thread
14194 (lambda ()
14195 (let loop ()
14196 (let ((request (read s)))
14197 (if (not (eof-object? request))
14198 (begin
14199 (write (op request) s)
14200 (newline s)
14201 (force-output s)
14202 (loop))))))))
14203 c))</b>
14204 &gt; <b>(define a (server (lambda (x) (expt 2 x))))</b>
14205 &gt; <b>(define b (server (lambda (x) (expt 10 x))))</b>
14206 &gt; <b>(write 100 a)</b>
14207 &gt; <b>(write 30 b)</b>
14208 &gt; <b>(read a)</b>
14209 1267650600228229401496703205376
14210 &gt; <b>(read b)</b>
14211 1000000000000000000000000000000
14212 </pre></td></tr></table>
14216 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14218 <p>The procedure <code>get-output-vector</code> takes an output vector-port or
14219 a bidirectional vector-port as parameter and removes all the objects
14220 currently on the output-side, returning them in a vector. The port
14221 remains open and subsequent output to the port and calls to the
14222 procedure <code>get-output-vector</code> are possible.
14223 </p>
14224 <p>For example:
14225 </p>
14226 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-vector '#(1 2 3)))</b>
14227 &gt; <b>(write 4 p)</b>
14228 &gt; <b>(get-output-vector p)</b>
14229 #(1 2 3 4)
14230 &gt; <b>(write 5 p)</b>
14231 &gt; <b>(write 6 p)</b>
14232 &gt; <b>(get-output-vector p)</b>
14233 #(5 6)
14234 </pre></td></tr></table>
14238 <hr size="1">
14239 <a name="String_002dports"></a>
14240 <table cellpadding="1" cellspacing="1" border="0">
14241 <tr><td valign="middle" align="left"><a href="#Vector_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.9 Vector-ports" align="middle" width="32"></a></td>
14242 <td valign="middle" align="left"><a href="#U8vector_002dports" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 17.11 U8vector-ports" align="middle" width="32"></a></td>
14243 <td valign="middle" align="left"> &nbsp; </td>
14244 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
14245 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
14246 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14247 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14248 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14249 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14250 </tr></table>
14251 <a name="String_002dports-1"></a>
14252 <h2 class="section">17.10 String-ports</h2>
14254 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14255 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14256 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14257 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14258 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14259 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14260 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14261 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14262 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14264 <p>String-ports represent streams of characters. They are a direct
14265 subtype of character-ports. These procedures are the string-port
14266 analog of the procedures specified in the vector-ports section. Note
14267 that these procedures are a superset of the procedures specified in
14268 the &ldquo;Basic String Ports SRFI&rdquo; (SRFI 6).
14269 </p>
14270 <p>For example:
14271 </p>
14272 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-string))</b>
14273 &gt; <b>(write 1 p)</b>
14274 &gt; <b>(write 2 p)</b>
14275 &gt; <b>(write 3 p)</b>
14276 &gt; <b>(force-output p)</b>
14277 &gt; <b>(read-char p)</b>
14279 &gt; <b>(read-char p)</b>
14281 &gt; <b>(close-output-port p)</b>
14282 &gt; <b>(read-char p)</b>
14284 &gt; <b>(read-char p)</b>
14285 #!eof
14286 &gt; <b>(with-output-to-string '() (lambda () (write 1) (write 2)))</b>
14287 &quot;12&quot;
14288 </pre></td></tr></table>
14292 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_object-%3Estring">object-&gt;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>
14294 <p>This procedure converts the object <var>obj</var> to its external
14295 representation and returns it in a string. The parameter <var>n</var>
14296 specifies the maximal width of the resulting string. If the external
14297 representation is wider than <var>n</var>, the resulting string will be
14298 truncated to <var>n</var> characters and the last 3 characters will be set
14299 to periods. Note that the current readtable is used.
14300 </p>
14301 <p>For example:
14302 </p>
14303 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(object-&gt;string (expt 2 100))</b>
14304 &quot;1267650600228229401496703205376&quot;
14305 &gt; <b>(object-&gt;string (expt 2 100) 30)</b>
14306 &quot;126765060022822940149670320...&quot;
14307 &gt; <b>(object-&gt;string (cons car cdr))</b>
14308 &quot;(#&lt;procedure #2 car&gt; . #&lt;procedure #3 cdr&gt;)&quot;
14309 </pre></td></tr></table>
14313 <hr size="1">
14314 <a name="U8vector_002dports"></a>
14315 <table cellpadding="1" cellspacing="1" border="0">
14316 <tr><td valign="middle" align="left"><a href="#String_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.10 String-ports" align="middle" width="32"></a></td>
14317 <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" alt="Forward: 17.12 Other procedures related to I/O" align="middle" width="32"></a></td>
14318 <td valign="middle" align="left"> &nbsp; </td>
14319 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
14320 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
14321 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14322 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14323 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14324 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14325 </tr></table>
14326 <a name="U8vector_002dports-1"></a>
14327 <h2 class="section">17.11 U8vector-ports</h2>
14329 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14330 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14331 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14332 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14333 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14334 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14335 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14336 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14337 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14339 <p>U8vector-ports represent streams of bytes. They are a direct subtype
14340 of byte-ports. These procedures are the u8vector-port analog of the
14341 procedures specified in the vector-ports section.
14342 </p>
14343 <p>For example:
14344 </p>
14345 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define p (open-u8vector))</b>
14346 &gt; <b>(write 1 p)</b>
14347 &gt; <b>(write 2 p)</b>
14348 &gt; <b>(write 3 p)</b>
14349 &gt; <b>(force-output p)</b>
14350 &gt; <b>(read-u8 p)</b>
14352 &gt; <b>(read-u8 p)</b>
14354 &gt; <b>(close-output-port p)</b>
14355 &gt; <b>(read-u8 p)</b>
14357 &gt; <b>(read-u8 p)</b>
14358 #!eof
14359 &gt; <b>(with-output-to-u8vector '() (lambda () (write 1) (write 2)))</b>
14360 #u8(49 50)
14361 </pre></td></tr></table>
14365 <hr size="1">
14366 <a name="Other-procedures-related-to-I_002fO"></a>
14367 <table cellpadding="1" cellspacing="1" border="0">
14368 <tr><td valign="middle" align="left"><a href="#U8vector_002dports" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 17.11 U8vector-ports" align="middle" width="32"></a></td>
14369 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14370 <td valign="middle" align="left"> &nbsp; </td>
14371 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
14372 <td valign="middle" align="left"><a href="#I_002fO-and-ports" title="Up section"><img src="button-up.png" border="0" alt="Up: 17. I/O and ports" align="middle" width="32"></a></td>
14373 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14374 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14375 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14376 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14377 </tr></table>
14378 <a name="Other-procedures-related-to-I_002fO-1"></a>
14379 <h2 class="section">17.12 Other procedures related to I/O</h2>
14381 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14382 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14383 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14384 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14386 <p>These procedures are parameter objects which represent respectively:
14387 the current input-port, the current output-port, the current
14388 error-port, and the current readtable.
14389 </p>
14392 <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="http://dynamo.iro.umontreal.ca/~gambit/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>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
14393 <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="http://dynamo.iro.umontreal.ca/~gambit/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>&hellip;</i><code>)</code></td><td align="right">procedure</td></tr></table>
14395 <p>The <code>print</code> procedure writes a representation of each <var>obj</var>,
14396 from left to right, to <var>port</var>. When a compound object is
14397 encountered (pair, list, vector, box) the elements of that object are
14398 recursively written without the surrounding tokens (parentheses,
14399 spaces, dots, etc). Strings, symbols, keywords and characters are
14400 written like the <code>display</code> procedure. If there are more than one
14401 <var>obj</var>, the first <var>obj</var> must not be a keyword object. If it is
14402 not specified, <var>port</var> defaults to the current output-port. The
14403 procedure <code>print</code> returns an unspecified value.
14404 </p>
14405 <p>The <code>println</code> procedure does the same thing as the <code>print</code>
14406 procedure and then writes an end of line to <var>port</var>.
14407 </p>
14408 <p>For example:
14409 </p>
14410 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(println &quot;2*2 is &quot; (* 2 2) &quot; and 2+2 is &quot; (+ 2 2))</b>
14411 2*2 is 4 and 2+2 is 4
14412 &gt; <b>(define x (list &quot;&lt;i&gt;&quot; (list &quot;&lt;tt&gt;&quot; 123 &quot;&lt;/tt&gt;&quot;) &quot;&lt;/i&gt;&quot;))</b>
14413 &gt; <b>(println x)</b>
14414 &lt;i&gt;&lt;tt&gt;123&lt;/tt&gt;&lt;/i&gt;
14415 &gt; <b>(define p (open-output-string))</b>
14416 &gt; <b>(print port: p 1 #\2 &quot;345&quot;)</b>
14417 &gt; <b>(get-output-string p)</b>
14418 &quot;12345&quot;
14419 </pre></td></tr></table>
14423 <hr size="1">
14424 <a name="Lexical-syntax-and-readtables"></a>
14425 <table cellpadding="1" cellspacing="1" border="0">
14426 <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" alt="Back: 17.12 Other procedures related to I/O" align="middle" width="32"></a></td>
14427 <td valign="middle" align="left"><a href="#Readtables" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.1 Readtables" align="middle" width="32"></a></td>
14428 <td valign="middle" align="left"> &nbsp; </td>
14429 <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" alt="FastBack: 17. I/O and ports" align="middle" width="32"></a></td>
14430 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
14431 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
14432 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14433 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14434 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14435 </tr></table>
14436 <a name="Lexical-syntax-and-readtables-1"></a>
14437 <h1 class="chapter">18. Lexical syntax and readtables</h1>
14439 <table class="menu" border="0" cellspacing="0">
14440 <tr><td align="left" valign="top"><a href="#Readtables">18.1 Readtables</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14441 <tr><td align="left" valign="top"><a href="#Boolean-syntax">18.2 Boolean syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14442 <tr><td align="left" valign="top"><a href="#Character-syntax">18.3 Character syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14443 <tr><td align="left" valign="top"><a href="#String-syntax">18.4 String syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14444 <tr><td align="left" valign="top"><a href="#Symbol-syntax">18.5 Symbol syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14445 <tr><td align="left" valign="top"><a href="#Keyword-syntax">18.6 Keyword syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14446 <tr><td align="left" valign="top"><a href="#Box-syntax">18.7 Box syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14447 <tr><td align="left" valign="top"><a href="#Number-syntax">18.8 Number syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14448 <tr><td align="left" valign="top"><a href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14449 <tr><td align="left" valign="top"><a href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"> Special #! syntax
14450 </td></tr>
14451 <tr><td align="left" valign="top"><a href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14452 <tr><td align="left" valign="top"><a href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
14453 </table>
14455 <hr size="1">
14456 <a name="Readtables"></a>
14457 <table cellpadding="1" cellspacing="1" border="0">
14458 <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" alt="Back: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14459 <td valign="middle" align="left"><a href="#Boolean-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.2 Boolean syntax" align="middle" width="32"></a></td>
14460 <td valign="middle" align="left"> &nbsp; </td>
14461 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14462 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14463 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
14464 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14465 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14466 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14467 </tr></table>
14468 <a name="Readtables-1"></a>
14469 <h2 class="section">18.1 Readtables</h2>
14471 <p>Readtables control the external textual representation of Scheme
14472 objects, that is the encoding of Scheme objects using characters.
14473 Readtables affect the behavior of the reader (i.e. the <code>read</code>
14474 procedure and the parser used by the <code>load</code> procedure and the
14475 interpreter and compiler) and the printer (i.e. the procedures
14476 <code>write</code>, <code>display</code>, <code>print</code>, <code>println</code>,
14477 <code>pretty-print</code>, and <code>pp</code>, and the procedure used by the REPL
14478 to print results). To preserve write/read invariance the printer and
14479 reader must be using compatible readtables. For example a symbol
14480 which contains upper case letters will be printed with special escapes
14481 if the readtable indicates that the reader is case-insensitive.
14482 </p>
14483 <p>Readtables are immutable records whose fields specify various textual
14484 representation aspects. There are accessor procedures to retrieve the
14485 content of specific fields. There are also functional update
14486 procedures that create a copy of a readtable, with a specific field
14487 set to a new value.
14488 </p>
14489 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14491 <p>This procedure returns <code>#t</code> when <var>obj</var> is a readtable and
14492 <code>#f</code> otherwise.
14493 </p>
14494 <p>For example:
14495 </p>
14496 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(readtable? (current-readtable))</b>
14498 &gt; <b>(readtable? 123)</b>
14500 </pre></td></tr></table>
14504 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14505 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14507 <p>The procedure <code>readtable-case-conversion?</code> returns the content of
14508 the <samp>case-conversion?</samp> field of <var>readtable</var>. When the
14509 content of this field is <code>#f</code>, the reader preserves the case of
14510 symbols and keyword objects that are read (i.e. <code>Ice</code> and
14511 <code>ice</code> are distinct symbols). When the content of this field is
14512 the symbol <code>upcase</code>, the reader converts lowercase letters to
14513 uppercase when reading symbols and keywords (i.e. <code>Ice</code> is read
14514 as the symbol <code>(string-&gt;symbol &quot;ICE&quot;)</code>). Otherwise the reader
14515 converts uppercase letters to lowercase when reading symbols and
14516 keywords (i.e. <code>Ice</code> is read as the symbol <code>(string-&gt;symbol
14517 &quot;ice&quot;)</code>).
14518 </p>
14519 <p>The procedure <code>readtable-case-conversion?-set</code> returns a copy
14520 of <var>readtable</var> where only the <samp>case-conversion?</samp> field
14521 has been changed to <var>new-value</var>.
14522 </p>
14523 <p>For example:
14524 </p>
14525 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(output-port-readtable-set!
14526 (repl-output-port)
14527 (readtable-case-conversion?-set
14528 (output-port-readtable (repl-output-port))
14529 #f))</b>
14530 &gt; <b>(input-port-readtable-set!
14531 (repl-input-port)
14532 (readtable-case-conversion?-set
14533 (input-port-readtable (repl-input-port))
14534 #f))</b>
14535 &gt; <b>'Ice</b>
14537 &gt; <b>(input-port-readtable-set!
14538 (repl-input-port)
14539 (readtable-case-conversion?-set
14540 (input-port-readtable (repl-input-port))
14541 #t))</b>
14542 &gt; <b>'Ice</b>
14544 &gt; <b>(input-port-readtable-set!
14545 (repl-input-port)
14546 (readtable-case-conversion?-set
14547 (input-port-readtable (repl-input-port))
14548 'upcase))</b>
14549 &gt; <b>'Ice</b>
14551 </pre></td></tr></table>
14555 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14556 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14558 <p>The procedure <code>readtable-keywords-allowed?</code> returns the content
14559 of the <samp>keywords-allowed?</samp> field of <var>readtable</var>. When the
14560 content of this field is <code>#f</code>, the reader does not recognize
14561 keyword objects (i.e. <code>:foo</code> and <code>foo:</code> are read as the
14562 symbols <code>(string-&gt;symbol &quot;:foo&quot;)</code> and <code>(string-&gt;symbol
14563 &quot;foo:&quot;)</code> respectively). When the content of this field is the symbol
14564 <code>prefix</code>, the reader recognizes keyword objects that start with a
14565 colon, as in Common Lisp (i.e. <code>:foo</code> is read as the keyword
14566 <code>(string-&gt;keyword &quot;foo&quot;)</code>). Otherwise the reader recognizes
14567 keyword objects that end with a colon, as in DSSSL (i.e. <code>foo:</code>
14568 is read as the symbol <code>(string-&gt;symbol &quot;foo&quot;)</code>).
14569 </p>
14570 <p>The procedure <code>readtable-keywords-allowed?-set</code> returns a copy
14571 of <var>readtable</var> where only the <samp>keywords-allowed?</samp> field
14572 has been changed to <var>new-value</var>.
14573 </p>
14574 <p>For example:
14575 </p>
14576 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(input-port-readtable-set!
14577 (repl-input-port)
14578 (readtable-keywords-allowed?-set
14579 (input-port-readtable (repl-input-port))
14580 #f))</b>
14581 &gt; <b>(map keyword? '(foo :foo foo:))</b>
14582 (#f #f #f)
14583 &gt; <b>(input-port-readtable-set!
14584 (repl-input-port)
14585 (readtable-keywords-allowed?-set
14586 (input-port-readtable (repl-input-port))
14587 #t))</b>
14588 &gt; <b>(map keyword? '(foo :foo foo:))</b>
14589 (#f #f #t)
14590 &gt; <b>(input-port-readtable-set!
14591 (repl-input-port)
14592 (readtable-keywords-allowed?-set
14593 (input-port-readtable (repl-input-port))
14594 'prefix))</b>
14595 &gt; <b>(map keyword? '(foo :foo foo:))</b>
14596 (#f #t #f)
14597 </pre></td></tr></table>
14601 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14602 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14603 <a name="index-serialization-1"></a>
14604 <a name="index-deserialization-1"></a>
14606 <p>The procedure <code>readtable-sharing-allowed?</code> returns the content of
14607 the <samp>sharing-allowed?</samp> field of <var>readtable</var>. The reader
14608 recognizes the <code>#<var>n</var>#</code> and <code>#<var>n</var>=<var>datum</var></code>
14609 notation for circular structures and the printer uses this notation if
14610 and only if the content of the <samp>sharing-allowed?</samp> field is not
14611 <code>#f</code>. Moreover when the content of the <samp>sharing-allowed?</samp>
14612 field is the symbol <code>serialize</code>, the printer uses a special
14613 external representation that the reader understands and that extends
14614 write/read invariance to the following types: records, procedures and
14615 continuations. Note that an object can be serialized and deserialized
14616 if and only if all of its components are serializable.
14617 </p>
14618 <p>The procedure <code>readtable-sharing-allowed?-set</code> returns a copy
14619 of <var>readtable</var> where only the <samp>sharing-allowed?</samp> field
14620 has been changed to <var>new-value</var>.
14621 </p>
14622 <p>Here is a simple example:
14623 </p>
14624 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (wr obj allow?)
14625 (call-with-output-string
14627 (lambda (p)
14628 (output-port-readtable-set!
14630 (readtable-sharing-allowed?-set
14631 (output-port-readtable p)
14632 allow?))
14633 (write obj p))))</b>
14634 &gt; <b>(define (rd str allow?)
14635 (call-with-input-string
14637 (lambda (p)
14638 (input-port-readtable-set!
14640 (readtable-sharing-allowed?-set
14641 (input-port-readtable p)
14642 allow?))
14643 (read p))))</b>
14644 &gt; <b>(define x (list 1 2 3))</b>
14645 &gt; <b>(set-car! (cdr x) (cddr x))</b>
14646 &gt; <b>(wr x #f)</b>
14647 &quot;(1 (3) 3)&quot;
14648 &gt; <b>(wr x #t)</b>
14649 &quot;(1 #0=(3) . #0#)&quot;
14650 &gt; <b>(define y (rd (wr x #t) #t))</b>
14651 &gt; <b>y</b>
14652 (1 (3) 3)
14653 &gt; <b>(eq? (cadr y) (cddr y))</b>
14655 &gt; <b>(define f #f)</b>
14656 &gt; <b>(let ((free (expt 2 10)))
14657 (set! f (lambda (x) (+ x free))))</b>
14658 &gt; <b>(define s (wr f 'serialize))</b>
14659 &gt; <b>(string-length s)</b>
14660 4196
14661 &gt; <b>(define g (rd s 'serialize))</b>
14662 &gt; <b>(eq? f g)</b>
14664 &gt; <b>(g 4)</b>
14665 1028
14666 </pre></td></tr></table>
14668 <p>Continuations are tricky to serialize because they contain a dynamic
14669 environment and this dynamic environment may contain non-serializable
14670 objects, in particular ports attached to operating-system streams such
14671 as files, the console or standard input/output. Indeed, all dynamic
14672 environments contain a binding for the <code>current-input-port</code> and
14673 <code>current-output-port</code>. Moreover, any thread that has started a
14674 REPL has a continuation which refers to the <em>repl-context</em> object
14675 in its dynamic environment. A repl-context object contains the
14676 interaction channel, which is typically connected to a
14677 non-serializable port, such as the console. Another problem is that
14678 the <code>parameterize</code> form saves the old binding of the parameter in
14679 the continuation, so it is not possible to eliminate the references to
14680 these ports in the continuation by using the <code>parameterize</code> form
14681 alone.
14682 </p>
14683 <p>Serialization of continuations can be achieved dependably by taking
14684 advantage of string-ports, which are serializable objects (unless
14685 there is a blocked thread), and the following features of threads:
14686 they inherit the dynamic environment of the parent thread and they
14687 start with an initial continuation that contains only serializable
14688 objects. So a thread created in a dynamic environment where
14689 <code>current-input-port</code> and <code>current-output-port</code> are bound to
14690 a dummy string-port has a serializable continuation.
14691 </p>
14692 <p>Here is an example where continuations are serialized:
14693 </p>
14694 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (wr obj)
14695 (call-with-output-string
14697 (lambda (p)
14698 (output-port-readtable-set!
14700 (readtable-sharing-allowed?-set
14701 (output-port-readtable p)
14702 'serialize))
14703 (write obj p))))</b>
14704 &gt; <b>(define (rd str)
14705 (call-with-input-string
14707 (lambda (p)
14708 (input-port-readtable-set!
14710 (readtable-sharing-allowed?-set
14711 (input-port-readtable p)
14712 'serialize))
14713 (read p))))</b>
14714 &gt; <b>(define fifo (open-vector))</b>
14715 &gt; <b>(define (suspend-and-die!)
14716 (call-with-current-continuation
14717 (lambda (k)
14718 (write (wr k) fifo)
14719 (newline fifo)
14720 (force-output fifo)
14721 (thread-terminate! (current-thread)))))</b>
14722 &gt; <b>(let ((dummy-port (open-string)))
14723 (parameterize ((current-input-port dummy-port)
14724 (current-output-port dummy-port))
14725 (thread-start!
14726 (make-thread
14727 (lambda ()
14728 (* 100
14729 (suspend-and-die!)))))))</b>
14730 #&lt;thread #2&gt;
14731 &gt; <b>(define s (read fifo))</b>
14732 &gt; <b>(thread-join!
14733 (thread-start!
14734 (make-thread
14735 (lambda ()
14736 ((rd s) 111)))))</b>
14737 11100
14738 &gt; <b>(thread-join!
14739 (thread-start!
14740 (make-thread
14741 (lambda ()
14742 ((rd s) 222)))))</b>
14743 22200
14744 &gt; <b>(string-length s)</b>
14745 13114
14746 </pre></td></tr></table>
14750 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14751 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14753 <p>The procedure <code>readtable-eval-allowed?</code> returns the content of
14754 the <samp>eval-allowed?</samp> field of <var>readtable</var>. The reader
14755 recognizes the <code>#.<var>expression</var></code> notation for read-time
14756 evaluation if and only if the content of the <samp>eval-allowed?</samp>
14757 field is not <code>#f</code>.
14758 </p>
14759 <p>The procedure <code>readtable-eval-allowed?-set</code> returns a copy
14760 of <var>readtable</var> where only the <samp>eval-allowed?</samp> field
14761 has been changed to <var>new-value</var>.
14762 </p>
14763 <p>For example:
14764 </p>
14765 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(input-port-readtable-set!
14766 (repl-input-port)
14767 (readtable-eval-allowed?-set
14768 (input-port-readtable (repl-input-port))
14769 #t))</b>
14770 &gt; <b>'(5 plus 7 is #.(+ 5 7))</b>
14771 (5 plus 7 is 12)
14772 &gt; <b>'(buf = #.(make-u8vector 25))</b>
14773 (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))
14774 </pre></td></tr></table>
14778 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14779 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14780 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14781 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14783 <p>The procedure <code>readtable-write-cdr-read-macros?</code> returns the
14784 content of the <samp>write-cdr-read-macros?</samp> field of <var>readtable</var>.
14785 The procedure <code>readtable-write-extended-read-macros?</code> returns the
14786 content of the <samp>write-extended-read-macros?</samp> field of
14787 <var>readtable</var>.
14788 </p>
14789 <p>At all times the printer uses read-macros in its output for datums of
14790 the form <code>(quote <var>datum</var>)</code>, <code>(quasiquote <var>datum</var>)</code>,
14791 <code>(unquote <var>datum</var>)</code>, and <code>(unquote-splicing
14792 <var>datum</var>)</code>. That is the following read-macro notations will be
14793 used respectively: <code>'<var>datum</var></code>, <code>`<var>datum</var></code>,
14794 <code>,<var>datum</var></code>, and <code>,@<var>datum</var></code>. Moreover, normally
14795 the read-macros will not be used when the form appears in the cdr of a
14796 list, for example <code>(foo quote bar)</code>, <code>(foo . (quote bar))</code>
14797 and <code>(foo . 'bar)</code> will all be printed as <code>(foo quote bar)</code>.
14798 </p>
14799 <p>When the content of the <samp>write-cdr-read-macros?</samp> field is not
14800 <code>#f</code>, the printer will use read-macros when the forms appear in
14801 the cdr of a list. For example <code>(foo quote bar)</code> will be printed
14802 as <code>(foo . 'bar)</code>. When the content of the
14803 <samp>write-extended-read-macros?</samp> field is not <code>#f</code>, the printer
14804 will also use extended read-macros, for example <code>#'<var>datum</var></code>
14805 in place of <code>(syntax <var>datum</var>)</code>.
14806 </p>
14807 <p>The procedure <code>readtable-write-cdr-read-macros?-set</code> returns a
14808 copy of <var>readtable</var> where only the <samp>write-cdr-read-macros?</samp>
14809 field has been changed to <var>new-value</var>. The procedure
14810 <code>readtable-write-extended-read-macros?-set</code> returns a copy of
14811 <var>readtable</var> where only the <samp>write-extended-read-macros?</samp>
14812 field has been changed to <var>new-value</var>.
14813 </p>
14814 <p>For example:
14815 </p>
14816 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(output-port-readtable-set!
14817 (repl-output-port)
14818 (readtable-write-extended-read-macros?-set
14819 (output-port-readtable (repl-output-port))
14820 #t))</b>
14821 &gt; <b>'(foo (syntax bar))</b>
14822 (foo #'bar)
14823 &gt; <b>'(foo syntax bar)</b>
14824 (foo syntax bar)
14825 &gt; <b>(output-port-readtable-set!
14826 (repl-output-port)
14827 (readtable-write-cdr-read-macros?-set
14828 (output-port-readtable (repl-output-port))
14829 #t))</b>
14830 &gt; <b>'(foo syntax bar)</b>
14831 (foo . #'bar)
14832 </pre></td></tr></table>
14836 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14837 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14839 <p>The procedure <code>readtable-max-write-level</code> returns the content of
14840 the <samp>max-write-level</samp> field of <var>readtable</var>. The printer will
14841 display an ellipsis for the elements of lists and vectors that are
14842 nested deeper than this level.
14843 </p>
14844 <p>The procedure <code>readtable-max-write-level-set</code> returns a copy
14845 of <var>readtable</var> where only the <samp>max-write-level</samp> field
14846 has been changed to <var>new-value</var>, which must be an nonnegative
14847 fixnum.
14848 </p>
14849 <p>For example:
14850 </p>
14851 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (wr obj n)
14852 (call-with-output-string
14854 (lambda (p)
14855 (output-port-readtable-set!
14857 (readtable-max-write-level-set
14858 (output-port-readtable p)
14860 (write obj p))))</b>
14861 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 3)</b>
14862 &quot;(a #(b (c c) #u8(9 9 9) b) a)&quot;
14863 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 2)</b>
14864 &quot;(a #(b (...) #u8(...) b) a)&quot;
14865 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 1)</b>
14866 &quot;(a #(...) a)&quot;
14867 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) a) 0)</b>
14868 &quot;(...)&quot;
14869 &gt; <b>(wr 'hello 0)</b>
14870 &quot;hello&quot;
14871 </pre></td></tr></table>
14875 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14876 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14877 <p>The procedure <code>readtable-max-write-length</code> returns the content of
14878 the <samp>max-write-length</samp> field of <var>readtable</var>. The printer will
14879 display an ellipsis for the elements of lists and vectors that are at
14880 an index beyond that length.
14881 </p>
14882 <p>The procedure <code>readtable-max-write-length-set</code> returns a copy
14883 of <var>readtable</var> where only the <samp>max-write-length</samp> field
14884 has been changed to <var>new-value</var>, which must be an nonnegative
14885 fixnum.
14886 </p>
14887 <p>For example:
14888 </p>
14889 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define (wr obj n)
14890 (call-with-output-string
14892 (lambda (p)
14893 (output-port-readtable-set!
14895 (readtable-max-write-length-set
14896 (output-port-readtable p)
14898 (write obj p))))</b>
14899 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 4)</b>
14900 &quot;(a #(b (c c) #u8(9 9 9) b) . a)&quot;
14901 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 3)</b>
14902 &quot;(a #(b (c c) #u8(9 9 9) ...) . a)&quot;
14903 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 2)</b>
14904 &quot;(a #(b (c c) ...) . a)&quot;
14905 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 1)</b>
14906 &quot;(a ...)&quot;
14907 &gt; <b>(wr '(a #(b (c c) #u8(9 9 9) b) . a) 0)</b>
14908 &quot;(...)&quot;
14909 </pre></td></tr></table>
14913 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14914 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14916 <p>The procedure <code>readtable-max-unescaped-char</code> returns the content
14917 of the <samp>max-unescaped-char</samp> field of <var>readtable</var>. The
14918 printer will display using an escape sequence any character within
14919 symbols, strings and character objects greater than
14920 <samp>max-unescaped-char</samp>
14921 </p>
14922 <p>The procedure <code>readtable-max-unescaped-char-set</code> returns a copy
14923 of <var>readtable</var> where only the <samp>max-unescaped-char</samp> field
14924 has been changed to <var>new-value</var>, which must be a character.
14925 </p>
14926 <p>For example:
14927 </p>
14928 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(define rt (output-port-readtable (repl-output-port)))</b>
14929 &gt; <b>(readtable-max-unescaped-char rt)</b>
14930 #\delete
14931 &gt; <b>(string (integer-&gt;char 233))</b>
14932 &quot;\351&quot;
14933 &gt; <b>(define (f c)
14934 (with-output-to-string
14935 (list readtable: (readtable-max-unescaped-char-set rt c))
14936 (lambda () (write (string (integer-&gt;char 233))))))</b>
14937 &gt; <b>(f #\delete)</b>
14938 &quot;\&quot;\\351\&quot;&quot;
14939 &gt; <b>(string-length (f #\delete))</b>
14941 &gt; <b>(f #\U0010ffff)</b>
14942 &quot;\&quot;\351\&quot;&quot;
14943 &gt; <b>(string-length (f #\U0010ffff))</b>
14945 &gt; <b>(output-port-readtable-set!
14946 (repl-output-port)
14947 (readtable-max-unescaped-char-set rt #\U0010ffff))</b>
14948 &gt; <b>(string (integer-&gt;char 233))</b>
14949 &quot;é&quot;
14950 </pre></td></tr></table>
14954 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14955 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
14957 <p>The procedure <code>readtable-start-syntax</code> returns the content of the
14958 <samp>start-syntax</samp> field of <var>readtable</var>. The reader uses this
14959 field to determine in which syntax to start parsing the input. When
14960 the content of this field is the symbol <code>six</code>, the reader starts
14961 in the infix syntax. Otherwise the reader starts in the prefix
14962 syntax.
14963 </p>
14964 <p>The procedure <code>readtable-start-syntax-set</code> returns a copy
14965 of <var>readtable</var> where only the <samp>start-syntax</samp> field
14966 has been changed to <var>new-value</var>.
14967 </p>
14968 <p>For example:
14969 </p>
14970 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(+ 2 3)</b>
14972 &gt; <b>(input-port-readtable-set!
14973 (repl-input-port)
14974 (readtable-start-syntax-set
14975 (input-port-readtable (repl-input-port))
14976 'six))</b>
14977 &gt; <b>2+3;</b>
14979 &gt; <b>exit();</b>
14980 </pre></td></tr></table>
14984 <hr size="1">
14985 <a name="Boolean-syntax"></a>
14986 <table cellpadding="1" cellspacing="1" border="0">
14987 <tr><td valign="middle" align="left"><a href="#Readtables" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.1 Readtables" align="middle" width="32"></a></td>
14988 <td valign="middle" align="left"><a href="#Character-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.3 Character syntax" align="middle" width="32"></a></td>
14989 <td valign="middle" align="left"> &nbsp; </td>
14990 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14991 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
14992 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
14993 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
14994 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
14995 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
14996 </tr></table>
14997 <a name="Boolean-syntax-1"></a>
14998 <h2 class="section">18.2 Boolean syntax</h2>
15000 <p>Booleans are required to be followed by a delimiter
15001 (i.e. <code>#f64()</code> is not the boolean <code>#f</code> followed by the
15002 number <code>64</code> and the empty list).
15003 </p>
15004 <hr size="1">
15005 <a name="Character-syntax"></a>
15006 <table cellpadding="1" cellspacing="1" border="0">
15007 <tr><td valign="middle" align="left"><a href="#Boolean-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.2 Boolean syntax" align="middle" width="32"></a></td>
15008 <td valign="middle" align="left"><a href="#String-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.4 String syntax" align="middle" width="32"></a></td>
15009 <td valign="middle" align="left"> &nbsp; </td>
15010 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15011 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15012 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15013 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15014 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15015 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15016 </tr></table>
15017 <a name="Character-syntax-1"></a>
15018 <h2 class="section">18.3 Character syntax</h2>
15020 <p>Characters are required to be followed by a delimiter
15021 (i.e. <code>#\spaceballs</code> is not the character <code>#\space</code> followed
15022 by the symbol <code>balls</code>). The lexical syntax of characters is
15023 extended to allow the following:
15024 </p>
15025 <dl compact="compact">
15026 <dt> <code>#\nul</code></dt>
15027 <dd><p>Unicode character 0
15028 </p></dd>
15029 <dt> <code>#\alarm</code></dt>
15030 <dd><p>Unicode character 7
15031 </p></dd>
15032 <dt> <code>#\backspace</code></dt>
15033 <dd><p>Unicode character 8
15034 </p></dd>
15035 <dt> <code>#\tab</code></dt>
15036 <dd><p>Unicode character 9
15037 </p></dd>
15038 <dt> <code>#\newline</code></dt>
15039 <dd><p>Unicode character 10 (newline character)
15040 </p></dd>
15041 <dt> <code>#\linefeed</code></dt>
15042 <dd><p>Unicode character 10
15043 </p></dd>
15044 <dt> <code>#\vtab</code></dt>
15045 <dd><p>Unicode character 11
15046 </p></dd>
15047 <dt> <code>#\page</code></dt>
15048 <dd><p>Unicode character 12
15049 </p></dd>
15050 <dt> <code>#\return</code></dt>
15051 <dd><p>Unicode character 13
15052 </p></dd>
15053 <dt> <code>#\esc</code></dt>
15054 <dd><p>Unicode character 27
15055 </p></dd>
15056 <dt> <code>#\space</code></dt>
15057 <dd><p>Unicode character 32 (space character)
15058 </p></dd>
15059 <dt> <code>#\delete</code></dt>
15060 <dd><p>Unicode character 127
15061 </p></dd>
15062 <dt> <code>#\x<var>hh</var></code></dt>
15063 <dd><p>character encoded in hexadecimal (&gt;= 1 hexadecimal digit)
15064 </p></dd>
15065 <dt> <code>#\u<var>hhhh</var></code></dt>
15066 <dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits)
15067 </p></dd>
15068 <dt> <code>#\U<var>hhhhhhhh</var></code></dt>
15069 <dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits)
15070 </p></dd>
15071 </dl>
15073 <hr size="1">
15074 <a name="String-syntax"></a>
15075 <table cellpadding="1" cellspacing="1" border="0">
15076 <tr><td valign="middle" align="left"><a href="#Character-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.3 Character syntax" align="middle" width="32"></a></td>
15077 <td valign="middle" align="left"><a href="#Symbol-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.5 Symbol syntax" align="middle" width="32"></a></td>
15078 <td valign="middle" align="left"> &nbsp; </td>
15079 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15080 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15081 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15082 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15083 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15084 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15085 </tr></table>
15086 <a name="String-syntax-1"></a>
15087 <h2 class="section">18.4 String syntax</h2>
15089 <p>The lexical syntax of quoted strings is extended to allow the following
15090 escape codes:
15091 </p>
15092 <dl compact="compact">
15093 <dt> <code>\a</code></dt>
15094 <dd><p>Unicode character 7
15095 </p></dd>
15096 <dt> <code>\b</code></dt>
15097 <dd><p>Unicode character 8
15098 </p></dd>
15099 <dt> <code>\t</code></dt>
15100 <dd><p>Unicode character 9
15101 </p></dd>
15102 <dt> <code>\n</code></dt>
15103 <dd><p>Unicode character 10 (newline character)
15104 </p></dd>
15105 <dt> <code>\v</code></dt>
15106 <dd><p>Unicode character 11
15107 </p></dd>
15108 <dt> <code>\f</code></dt>
15109 <dd><p>Unicode character 12
15110 </p></dd>
15111 <dt> <code>\r</code></dt>
15112 <dd><p>Unicode character 13
15113 </p></dd>
15114 <dt> <code>\&quot;</code></dt>
15115 <dd><p><code>&quot;</code>
15116 </p></dd>
15117 <dt> <code>\\</code></dt>
15118 <dd><p><code>\</code>
15119 </p></dd>
15120 <dt> <code>\|</code></dt>
15121 <dd><p><code>|</code>
15122 </p></dd>
15123 <dt> <code>\?</code></dt>
15124 <dd><p><code>?</code>
15125 </p></dd>
15126 <dt> <code>\<var>ooo</var></code></dt>
15127 <dd><p>character encoded in octal (1 to 3 octal digits, first digit must be less
15128 than 4 when there are 3 octal digits)
15129 </p></dd>
15130 <dt> <code>\x<var>hh</var></code></dt>
15131 <dd><p>character encoded in hexadecimal (&gt;= 1 hexadecimal digit)
15132 </p></dd>
15133 <dt> <code>\u<var>hhhh</var></code></dt>
15134 <dd><p>character encoded in hexadecimal (exactly 4 hexadecimal digits)
15135 </p></dd>
15136 <dt> <code>\U<var>hhhhhhhh</var></code></dt>
15137 <dd><p>character encoded in hexadecimal (exactly 8 hexadecimal digits)
15138 </p></dd>
15139 <dt> <code>\&lt;space&gt;</code></dt>
15140 <dd><p>Unicode character 32 (space character)
15141 </p></dd>
15142 <dt> <code>\&lt;newline&gt;&lt;whitespace-except-newline&gt;*</code></dt>
15143 <dd><p>This sequence expands to nothing (it is useful for splitting a long
15144 string literal on multiple lines while respecting proper indentation
15145 of the source code)
15146 </p></dd>
15147 </dl>
15149 <p>Gambit also supports a &ldquo;here string&rdquo; syntax that is similar
15150 to shell &ldquo;here documents&rdquo;. For example:
15151 </p>
15152 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(pretty-print #&lt;&lt;THE-END
15153 hello
15154 world
15155 THE-END
15156 )</b>
15157 &quot;hello\nworld&quot;
15158 </pre></td></tr></table>
15160 <p>The here string starts with the sequence <samp>#&lt;&lt;</samp>. The part of the
15161 line after the <samp>#&lt;&lt;</samp> up to and including the newline character is
15162 the key. The first line afterward that matches the key marks the end
15163 of the here string. The string contains all the characters between
15164 the start key and the end key, with the exception of the newline
15165 character before the end key.
15166 </p>
15167 <hr size="1">
15168 <a name="Symbol-syntax"></a>
15169 <table cellpadding="1" cellspacing="1" border="0">
15170 <tr><td valign="middle" align="left"><a href="#String-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.4 String syntax" align="middle" width="32"></a></td>
15171 <td valign="middle" align="left"><a href="#Keyword-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.6 Keyword syntax" align="middle" width="32"></a></td>
15172 <td valign="middle" align="left"> &nbsp; </td>
15173 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15174 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15175 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15176 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15177 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15178 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15179 </tr></table>
15180 <a name="Symbol-syntax-1"></a>
15181 <h2 class="section">18.5 Symbol syntax</h2>
15183 <p>The lexical syntax of symbols is extended to allow a leading and
15184 trailing vertical bar (e.g. <code>|a\|b&quot;c:|</code>). The symbol&rsquo;s name
15185 corresponds verbatim to the characters between the vertical bars
15186 except for escaped characters. The same escape sequences as for
15187 strings are permitted except that <samp>&quot;</samp> does not need to be escaped
15188 and <samp>|</samp> needs to be escaped.
15189 </p>
15190 <p>For example:
15191 </p>
15192 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(symbol-&gt;string '|a\|b&quot;c:|)</b>
15193 &quot;a|b\&quot;c:&quot;
15194 </pre></td></tr></table>
15196 <hr size="1">
15197 <a name="Keyword-syntax"></a>
15198 <table cellpadding="1" cellspacing="1" border="0">
15199 <tr><td valign="middle" align="left"><a href="#Symbol-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.5 Symbol syntax" align="middle" width="32"></a></td>
15200 <td valign="middle" align="left"><a href="#Box-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.7 Box syntax" align="middle" width="32"></a></td>
15201 <td valign="middle" align="left"> &nbsp; </td>
15202 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15203 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15204 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15205 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15206 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15207 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15208 </tr></table>
15209 <a name="Keyword-syntax-1"></a>
15210 <h2 class="section">18.6 Keyword syntax</h2>
15212 <p>The lexical syntax of keywords is like symbols, but with a colon at
15213 the end (note that this can be changed to a leading colon by setting
15214 the <samp>keywords-allowed?</samp> field of the readtable to the symbol
15215 <code>prefix</code>). A colon by itself is not a keyword, it is a symbol.
15216 Vertical bars can be used like symbols but the colon must be outside
15217 the vertical bars. Note that the string returned by the
15218 <code>keyword-&gt;string</code> procedure does not include the colon.
15219 </p>
15220 <p>For example:
15221 </p>
15222 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(keyword-&gt;string 'foo:)</b>
15223 &quot;foo&quot;
15224 &gt; <b>(map keyword? '(|ab()cd:| |ab()cd|: : ||:))</b>
15225 (#f #t #f #t)
15226 </pre></td></tr></table>
15228 <hr size="1">
15229 <a name="Box-syntax"></a>
15230 <table cellpadding="1" cellspacing="1" border="0">
15231 <tr><td valign="middle" align="left"><a href="#Keyword-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.6 Keyword syntax" align="middle" width="32"></a></td>
15232 <td valign="middle" align="left"><a href="#Number-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.8 Number syntax" align="middle" width="32"></a></td>
15233 <td valign="middle" align="left"> &nbsp; </td>
15234 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15235 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15236 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15237 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15238 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15239 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15240 </tr></table>
15241 <a name="Box-syntax-1"></a>
15242 <h2 class="section">18.7 Box syntax</h2>
15244 <p>The lexical syntax of boxes is <code>#&amp;<var>obj</var></code> where <var>obj</var> is the
15245 content of the box.
15246 </p>
15247 <p>For example:
15248 </p>
15249 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(list '#&amp;&quot;hello&quot; '#&amp;123)</b>
15250 (#&amp;&quot;hello&quot; #&amp;123)
15251 &gt; <b>(box (box (+ 10 20)))</b>
15252 #&amp;#&amp;30
15253 </pre></td></tr></table>
15255 <hr size="1">
15256 <a name="Number-syntax"></a>
15257 <table cellpadding="1" cellspacing="1" border="0">
15258 <tr><td valign="middle" align="left"><a href="#Box-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.7 Box syntax" align="middle" width="32"></a></td>
15259 <td valign="middle" align="left"><a href="#Homogeneous-vector-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.9 Homogeneous vector syntax" align="middle" width="32"></a></td>
15260 <td valign="middle" align="left"> &nbsp; </td>
15261 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15262 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15263 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15264 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15265 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15266 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15267 </tr></table>
15268 <a name="Number-syntax-1"></a>
15269 <h2 class="section">18.8 Number syntax</h2>
15271 <p>The lexical syntax of the special inexact real numbers is as follows:
15272 </p>
15273 <dl compact="compact">
15274 <dt> <code>+inf.0</code></dt>
15275 <dd><p>positive infinity
15276 </p></dd>
15277 <dt> <code>-inf.0</code></dt>
15278 <dd><p>negative infinity
15279 </p></dd>
15280 <dt> <code>+nan.0</code></dt>
15281 <dd><p>&ldquo;not a number&rdquo;
15282 </p></dd>
15283 <dt> <code>-0.</code></dt>
15284 <dd><p>negative zero (<samp>0.</samp> is the positive zero)
15285 </p></dd>
15286 </dl>
15288 <hr size="1">
15289 <a name="Homogeneous-vector-syntax"></a>
15290 <table cellpadding="1" cellspacing="1" border="0">
15291 <tr><td valign="middle" align="left"><a href="#Number-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.8 Number syntax" align="middle" width="32"></a></td>
15292 <td valign="middle" align="left"><a href="#Special-_0023_0021-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.10 Special #! syntax" align="middle" width="32"></a></td>
15293 <td valign="middle" align="left"> &nbsp; </td>
15294 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15295 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15296 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15297 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15298 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15299 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15300 </tr></table>
15301 <a name="Homogeneous-vector-syntax-1"></a>
15302 <h2 class="section">18.9 Homogeneous vector syntax</h2>
15303 <a name="index-homogeneous-vectors-1"></a>
15305 <p>Homogeneous vectors are vectors containing raw numbers of the same
15306 type (signed or unsigned exact integers or inexact reals). There are
15307 10 types of homogeneous vectors:
15308 <samp>s8vector</samp> (vector of 8 bit signed integers),
15309 <samp>u8vector</samp> (vector of 8 bit unsigned integers),
15310 <samp>s16vector</samp> (vector of 16 bit signed integers),
15311 <samp>u16vector</samp> (vector of 16 bit unsigned integers),
15312 <samp>s32vector</samp> (vector of 32 bit signed integers),
15313 <samp>u32vector</samp> (vector of 32 bit unsigned integers),
15314 <samp>s64vector</samp> (vector of 64 bit signed integers),
15315 <samp>u64vector</samp> (vector of 64 bit unsigned integers),
15316 <samp>f32vector</samp> (vector of 32 bit floating point numbers),
15317 and <samp>f64vector</samp> (vector of 64 bit floating point numbers).
15318 </p>
15319 <p>The external representation of homogeneous vectors is similar to
15320 normal vectors but with the <samp>#(</samp> prefix replaced respectively
15321 with
15322 <samp>#s8(</samp>, <samp>#u8(</samp>,
15323 <samp>#s16(</samp>, <samp>#u16(</samp>,
15324 <samp>#s32(</samp>, <samp>#u32(</samp>,
15325 <samp>#s64(</samp>, <samp>#u64(</samp>,
15326 <samp>#f32(</samp>, and <samp>#f64(</samp>.
15327 </p>
15328 <p>The elements of the integer homogeneous vectors must be exact integers
15329 fitting in the given precision. The elements of the floating point
15330 homogeneous vectors must be inexact reals.
15331 </p>
15332 <hr size="1">
15333 <a name="Special-_0023_0021-syntax"></a>
15334 <table cellpadding="1" cellspacing="1" border="0">
15335 <tr><td valign="middle" align="left"><a href="#Homogeneous-vector-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.9 Homogeneous vector syntax" align="middle" width="32"></a></td>
15336 <td valign="middle" align="left"><a href="#Multiline-comment-syntax" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.11 Multiline comment syntax" align="middle" width="32"></a></td>
15337 <td valign="middle" align="left"> &nbsp; </td>
15338 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15339 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15340 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15341 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15342 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15343 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15344 </tr></table>
15345 <a name="Special-_0023_0021-syntax-1"></a>
15346 <h2 class="section">18.10 Special <code>#!</code> syntax</h2>
15348 <p>The lexical syntax of the special <code>#!</code> objects is as follows:
15349 </p>
15350 <dl compact="compact">
15351 <dt> <code>#!eof</code></dt>
15352 <dd><p>end-of-file object
15353 </p></dd>
15354 <dt> <code>#!void</code></dt>
15355 <dd><p>void object
15356 </p></dd>
15357 <dt> <code>#!optional</code></dt>
15358 <dd><p>optional object
15359 </p></dd>
15360 <dt> <code>#!rest</code></dt>
15361 <dd><p>rest object
15362 </p></dd>
15363 <dt> <code>#!key</code></dt>
15364 <dd><p>key object
15365 </p></dd>
15366 </dl>
15368 <hr size="1">
15369 <a name="Multiline-comment-syntax"></a>
15370 <table cellpadding="1" cellspacing="1" border="0">
15371 <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" alt="Back: 18.10 Special #! syntax" align="middle" width="32"></a></td>
15372 <td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.12 Scheme infix syntax extension" align="middle" width="32"></a></td>
15373 <td valign="middle" align="left"> &nbsp; </td>
15374 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15375 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15376 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15377 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15378 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15379 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15380 </tr></table>
15381 <a name="Multiline-comment-syntax-1"></a>
15382 <h2 class="section">18.11 Multiline comment syntax</h2>
15384 <p>Multiline comments are delimited by the tokens <samp>#|</samp> and <samp>|#</samp>.
15385 These comments can be nested.
15386 </p>
15387 <hr size="1">
15388 <a name="Scheme-infix-syntax-extension"></a>
15389 <table cellpadding="1" cellspacing="1" border="0">
15390 <tr><td valign="middle" align="left"><a href="#Multiline-comment-syntax" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.11 Multiline comment syntax" align="middle" width="32"></a></td>
15391 <td valign="middle" align="left"><a href="#SIX-grammar" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.12.1 SIX grammar" align="middle" width="32"></a></td>
15392 <td valign="middle" align="left"> &nbsp; </td>
15393 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15394 <td valign="middle" align="left"><a href="#Lexical-syntax-and-readtables" title="Up section"><img src="button-up.png" border="0" alt="Up: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15395 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15396 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15397 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15398 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15399 </tr></table>
15400 <a name="Scheme-infix-syntax-extension-1"></a>
15401 <h2 class="section">18.12 Scheme infix syntax extension</h2>
15403 <p>The reader supports an infix syntax extension which is called SIX
15404 (Scheme Infix eXtension). This extension is both supported by the
15405 <samp>read</samp> procedure and in program source code.
15406 </p>
15407 <p>The backslash character is a delimiter that marks the beginning of a
15408 single datum expressed in the infix syntax (the details are given
15409 below). One way to think about it is that the backslash character
15410 escapes the prefix syntax temporarily to use the infix syntax. For
15411 example a three element list could be written as <samp>(<var>X</var>
15412 \<var>Y</var> <var>Z</var>)</samp>, the elements <var>X</var> and <var>Z</var> are expressed
15413 using the normal prefix syntax and <var>Y</var> is expressed using the
15414 infix syntax.
15415 </p>
15416 <p>When the reader encounters an infix datum, it constructs a syntax tree
15417 for that particular datum. Each node of this tree is represented with
15418 a list whose first element is a symbol indicating the type of node.
15419 For example, <samp>(six.identifier abc)</samp> is the representation of the
15420 infix identifier <samp>abc</samp> and <samp>(six.index (six.identifier abc)
15421 (six.identifier i))</samp> is the representation of the infix datum
15422 <samp>abc[i];</samp>.
15423 </p>
15424 <hr size="1">
15425 <a name="SIX-grammar"></a>
15426 <table cellpadding="1" cellspacing="1" border="0">
15427 <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" alt="Back: 18.12 Scheme infix syntax extension" align="middle" width="32"></a></td>
15428 <td valign="middle" align="left"><a href="#SIX-semantics" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 18.12.2 SIX semantics" align="middle" width="32"></a></td>
15429 <td valign="middle" align="left"> &nbsp; </td>
15430 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15431 <td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Up section"><img src="button-up.png" border="0" alt="Up: 18.12 Scheme infix syntax extension" align="middle" width="32"></a></td>
15432 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15433 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15434 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15435 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15436 </tr></table>
15437 <h3 class="subsection">18.12.1 SIX grammar</h3>
15439 <p>The SIX grammar is given below. On the left hand side are the
15440 production rules. On the right hand side is the datum that is
15441 constructed by the reader. The notation <var>$i</var> denotes the datum
15442 that is constructed by the reader for the <var>i</var>th part of the
15443 production rule.
15444 </p>
15449 <table>
15450 <tr><td width="60%"><em>&lt;</em>infix datum<em>&gt;</em> ::=</td></tr>
15451 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15452 <tr><td width="60%"><em>&lt;</em>stat<em>&gt;</em> ::=</td></tr>
15453 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>if stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15454 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>for stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15455 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>while stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15456 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>do stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15457 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>switch stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15458 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>case stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15459 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>break stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15460 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>continue stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15461 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>label stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15462 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>goto stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15463 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>return stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15464 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expression stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15465 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>procedure definition<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15466 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>variable definition<em>&gt;</em> <code>;</code></td><td width="40%"><var>$1</var></td></tr>
15467 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>clause stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15468 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>compound stat<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15469 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>;</code></td><td width="40%"><code>(six.compound)</code></td></tr>
15470 <tr><td width="60%"><em>&lt;</em>if stat<em>&gt;</em> ::=</td></tr>
15471 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>if</code> <code>(</code> <em>&lt;</em>pexpr<em>&gt;</em> <code>)</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var>)</code></td></tr>
15472 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>if</code> <code>(</code> <em>&lt;</em>pexpr<em>&gt;</em> <code>)</code> <em>&lt;</em>stat<em>&gt;</em> <code>else</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.if <var>$3</var> <var>$5</var> <var>$7</var>)</code></td></tr>
15473 <tr><td width="60%"><em>&lt;</em>for stat<em>&gt;</em> ::=</td></tr>
15474 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>for</code> <code>(</code> <em>&lt;</em>stat<em>&gt;</em> <code>;</code> <em>&lt;</em>oexpr<em>&gt;</em> <code>;</code> <em>&lt;</em>oexpr<em>&gt;</em> <code>)</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.for <var>$3</var> <var>$5</var> <var>$7</var> <var>$9</var>)</code></td></tr>
15475 <tr><td width="60%"><em>&lt;</em>while stat<em>&gt;</em> ::=</td></tr>
15476 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>while</code> <code>(</code> <em>&lt;</em>pexpr<em>&gt;</em> <code>)</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.while <var>$3</var> <var>$5</var>)</code></td></tr>
15477 <tr><td width="60%"><em>&lt;</em>do stat<em>&gt;</em> ::=</td></tr>
15478 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>do</code> <em>&lt;</em>stat<em>&gt;</em> <code>while</code> <code>(</code> <em>&lt;</em>pexpr<em>&gt;</em> <code>)</code> <code>;</code></td><td width="40%"><code>(six.do-while <var>$2</var> <var>$5</var>)</code></td></tr>
15479 <tr><td width="60%"><em>&lt;</em>switch stat<em>&gt;</em> ::=</td></tr>
15480 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>switch</code> <code>(</code> <em>&lt;</em>pexpr<em>&gt;</em> <code>)</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.switch <var>$3</var> <var>$5</var>)</code></td></tr>
15481 <tr><td width="60%"><em>&lt;</em>case stat<em>&gt;</em> ::=</td></tr>
15482 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>case</code> <em>&lt;</em>expr<em>&gt;</em> <code>:</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.case <var>$2</var> <var>$4</var>)</code></td></tr>
15483 <tr><td width="60%"><em>&lt;</em>break stat<em>&gt;</em> ::=</td></tr>
15484 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>break</code> <code>;</code></td><td width="40%"><code>(six.break)</code></td></tr>
15485 <tr><td width="60%"><em>&lt;</em>continue stat<em>&gt;</em> ::=</td></tr>
15486 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>continue</code> <code>;</code></td><td width="40%"><code>(six.continue)</code></td></tr>
15487 <tr><td width="60%"><em>&lt;</em>label stat<em>&gt;</em> ::=</td></tr>
15488 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>identifier<em>&gt;</em> <code>:</code> <em>&lt;</em>stat<em>&gt;</em></td><td width="40%"><code>(six.label <var>$1</var> <var>$3</var>)</code></td></tr>
15489 <tr><td width="60%"><em>&lt;</em>goto stat<em>&gt;</em> ::=</td></tr>
15490 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>goto</code> <em>&lt;</em>expr<em>&gt;</em> <code>;</code></td><td width="40%"><code>(six.goto <var>$2</var>)</code></td></tr>
15491 <tr><td width="60%"><em>&lt;</em>return stat<em>&gt;</em> ::=</td></tr>
15492 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>return</code> <code>;</code></td><td width="40%"><code>(six.return)</code></td></tr>
15493 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>return</code> <em>&lt;</em>expr<em>&gt;</em> <code>;</code></td><td width="40%"><code>(six.return <var>$2</var>)</code></td></tr>
15494 <tr><td width="60%"><em>&lt;</em>expression stat<em>&gt;</em> ::=</td></tr>
15495 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr<em>&gt;</em> <code>;</code></td><td width="40%"><var>$1</var></td></tr>
15496 <tr><td width="60%"><em>&lt;</em>clause stat<em>&gt;</em> ::=</td></tr>
15497 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr<em>&gt;</em> <code>.</code></td><td width="40%"><code>(six.clause <var>$1</var>)</code></td></tr>
15498 <tr><td width="60%"><em>&lt;</em>pexpr<em>&gt;</em> ::=</td></tr>
15499 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>procedure definition<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15500 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>variable definition<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15501 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15502 <tr><td width="60%"><em>&lt;</em>procedure definition<em>&gt;</em> ::=</td></tr>
15503 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>type<em>&gt;</em> <em>&lt;</em>id-or-prefix<em>&gt;</em> <code>(</code> <em>&lt;</em>parameters<em>&gt;</em> <code>)</code> <em>&lt;</em>body<em>&gt;</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>
15504 <tr><td width="60%"><em>&lt;</em>variable definition<em>&gt;</em> ::=</td></tr>
15505 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>type<em>&gt;</em> <em>&lt;</em>id-or-prefix<em>&gt;</em> <em>&lt;</em>dimensions<em>&gt;</em> <em>&lt;</em>iexpr<em>&gt;</em></td><td width="40%"><code>(six.define-variable <var>$2</var> <var>$1</var> <var>$3</var> <var>$4</var>)</code></td></tr>
15506 <tr><td width="60%"><em>&lt;</em>iexpr<em>&gt;</em> ::=</td></tr>
15507 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>=</code> <em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><var>$2</var></td></tr>
15508 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>#f</code></td></tr>
15509 <tr><td width="60%"><em>&lt;</em>dimensions<em>&gt;</em> ::=</td></tr>
15510 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>[</code> <em>&lt;</em>expr<em>&gt;</em> <code>]</code> <em>&lt;</em>dimensions<em>&gt;</em></td><td width="40%"><code>(<var>$2</var> . <var>$4</var>)</code></td></tr>
15511 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>()</code></td></tr>
15512 <tr><td width="60%"><em>&lt;</em>oexpr<em>&gt;</em> ::=</td></tr>
15513 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15514 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>#f</code></td></tr>
15515 <tr><td width="60%"><em>&lt;</em>expr<em>&gt;</em> ::=</td></tr>
15516 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr18<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15517 <tr><td width="60%"><em>&lt;</em>expr18<em>&gt;</em> ::=</td></tr>
15518 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr17<em>&gt;</em> <code>:-</code> <em>&lt;</em>expr18<em>&gt;</em></td><td width="40%"><code>(six.x:-y <var>$1</var> <var>$3</var>)</code></td></tr>
15519 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr17<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15520 <tr><td width="60%"><em>&lt;</em>expr17<em>&gt;</em> ::=</td></tr>
15521 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr17<em>&gt;</em> <code>,</code> <em>&lt;</em>expr16<em>&gt;</em></td><td width="40%"><code>(|six.x,y| <var>$1</var> <var>$3</var>)</code></td></tr>
15522 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr16<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15523 <tr><td width="60%"><em>&lt;</em>expr16<em>&gt;</em> ::=</td></tr>
15524 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr15<em>&gt;</em> <code>:=</code> <em>&lt;</em>expr16<em>&gt;</em></td><td width="40%"><code>(six.x:=y <var>$1</var> <var>$3</var>)</code></td></tr>
15525 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15526 <tr><td width="60%"><em>&lt;</em>expr15<em>&gt;</em> ::=</td></tr>
15527 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>%=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x%=y <var>$1</var> <var>$3</var>)</code></td></tr>
15528 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>&amp;=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x&amp;=y <var>$1</var> <var>$3</var>)</code></td></tr>
15529 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>*=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x*=y <var>$1</var> <var>$3</var>)</code></td></tr>
15530 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>+=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x+=y <var>$1</var> <var>$3</var>)</code></td></tr>
15531 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>-=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x-=y <var>$1</var> <var>$3</var>)</code></td></tr>
15532 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>/=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x/=y <var>$1</var> <var>$3</var>)</code></td></tr>
15533 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>&lt;&lt;=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x&lt;&lt;=y <var>$1</var> <var>$3</var>)</code></td></tr>
15534 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x=y <var>$1</var> <var>$3</var>)</code></td></tr>
15535 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>&gt;&gt;=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x&gt;&gt;=y <var>$1</var> <var>$3</var>)</code></td></tr>
15536 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>^=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(six.x^=y <var>$1</var> <var>$3</var>)</code></td></tr>
15537 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em> <code>|=</code> <em>&lt;</em>expr15<em>&gt;</em></td><td width="40%"><code>(|six.x\|=y| <var>$1</var> <var>$3</var>)</code></td></tr>
15538 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr14<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15539 <tr><td width="60%"><em>&lt;</em>expr14<em>&gt;</em> ::=</td></tr>
15540 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr13<em>&gt;</em> <code>:</code> <em>&lt;</em>expr14<em>&gt;</em></td><td width="40%"><code>(six.x:y <var>$1</var> <var>$3</var>)</code></td></tr>
15541 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr13<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15542 <tr><td width="60%"><em>&lt;</em>expr13<em>&gt;</em> ::=</td></tr>
15543 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr12<em>&gt;</em> <code>?</code> <em>&lt;</em>expr<em>&gt;</em> <code>:</code> <em>&lt;</em>expr13<em>&gt;</em></td><td width="40%"><code>(six.x?y:z <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr>
15544 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr12<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15545 <tr><td width="60%"><em>&lt;</em>expr12<em>&gt;</em> ::=</td></tr>
15546 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr12<em>&gt;</em> <code>||</code> <em>&lt;</em>expr11<em>&gt;</em></td><td width="40%"><code>(|six.x\|\|y| <var>$1</var> <var>$3</var>)</code></td></tr>
15547 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr11<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15548 <tr><td width="60%"><em>&lt;</em>expr11<em>&gt;</em> ::=</td></tr>
15549 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr11<em>&gt;</em> <code>&amp;&amp;</code> <em>&lt;</em>expr10<em>&gt;</em></td><td width="40%"><code>(six.x&amp;&amp;y <var>$1</var> <var>$3</var>)</code></td></tr>
15550 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr10<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15551 <tr><td width="60%"><em>&lt;</em>expr10<em>&gt;</em> ::=</td></tr>
15552 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr10<em>&gt;</em> <code>|</code> <em>&lt;</em>expr9<em>&gt;</em></td><td width="40%"><code>(|six.x\|y| <var>$1</var> <var>$3</var>)</code></td></tr>
15553 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr9<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15554 <tr><td width="60%"><em>&lt;</em>expr9<em>&gt;</em> ::=</td></tr>
15555 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr9<em>&gt;</em> <code>^</code> <em>&lt;</em>expr8<em>&gt;</em></td><td width="40%"><code>(six.x^y <var>$1</var> <var>$3</var>)</code></td></tr>
15556 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr8<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15557 <tr><td width="60%"><em>&lt;</em>expr8<em>&gt;</em> ::=</td></tr>
15558 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr8<em>&gt;</em> <code>&amp;</code> <em>&lt;</em>expr7<em>&gt;</em></td><td width="40%"><code>(six.x&amp;y <var>$1</var> <var>$3</var>)</code></td></tr>
15559 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr7<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15560 <tr><td width="60%"><em>&lt;</em>expr7<em>&gt;</em> ::=</td></tr>
15561 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr7<em>&gt;</em> <code>!=</code> <em>&lt;</em>expr6<em>&gt;</em></td><td width="40%"><code>(six.x!=y <var>$1</var> <var>$3</var>)</code></td></tr>
15562 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr7<em>&gt;</em> <code>==</code> <em>&lt;</em>expr6<em>&gt;</em></td><td width="40%"><code>(six.x==y <var>$1</var> <var>$3</var>)</code></td></tr>
15563 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr6<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15564 <tr><td width="60%"><em>&lt;</em>expr6<em>&gt;</em> ::=</td></tr>
15565 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr6<em>&gt;</em> <code>&lt;</code> <em>&lt;</em>expr5<em>&gt;</em></td><td width="40%"><code>(six.x&lt;y <var>$1</var> <var>$3</var>)</code></td></tr>
15566 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr6<em>&gt;</em> <code>&lt;=</code> <em>&lt;</em>expr5<em>&gt;</em></td><td width="40%"><code>(six.x&lt;=y <var>$1</var> <var>$3</var>)</code></td></tr>
15567 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr6<em>&gt;</em> <code>&gt;</code> <em>&lt;</em>expr5<em>&gt;</em></td><td width="40%"><code>(six.x&gt;y <var>$1</var> <var>$3</var>)</code></td></tr>
15568 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr6<em>&gt;</em> <code>&gt;=</code> <em>&lt;</em>expr5<em>&gt;</em></td><td width="40%"><code>(six.x&gt;=y <var>$1</var> <var>$3</var>)</code></td></tr>
15569 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr5<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15570 <tr><td width="60%"><em>&lt;</em>expr5<em>&gt;</em> ::=</td></tr>
15571 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr5<em>&gt;</em> <code>&lt;&lt;</code> <em>&lt;</em>expr4<em>&gt;</em></td><td width="40%"><code>(six.x&lt;&lt;y <var>$1</var> <var>$3</var>)</code></td></tr>
15572 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr5<em>&gt;</em> <code>&gt;&gt;</code> <em>&lt;</em>expr4<em>&gt;</em></td><td width="40%"><code>(six.x&gt;&gt;y <var>$1</var> <var>$3</var>)</code></td></tr>
15573 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr4<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15574 <tr><td width="60%"><em>&lt;</em>expr4<em>&gt;</em> ::=</td></tr>
15575 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr4<em>&gt;</em> <code>+</code> <em>&lt;</em>expr3<em>&gt;</em></td><td width="40%"><code>(six.x+y <var>$1</var> <var>$3</var>)</code></td></tr>
15576 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr4<em>&gt;</em> <code>-</code> <em>&lt;</em>expr3<em>&gt;</em></td><td width="40%"><code>(six.x-y <var>$1</var> <var>$3</var>)</code></td></tr>
15577 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr3<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15578 <tr><td width="60%"><em>&lt;</em>expr3<em>&gt;</em> ::=</td></tr>
15579 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr3<em>&gt;</em> <code>%</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.x%y <var>$1</var> <var>$3</var>)</code></td></tr>
15580 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr3<em>&gt;</em> <code>*</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.x*y <var>$1</var> <var>$3</var>)</code></td></tr>
15581 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr3<em>&gt;</em> <code>/</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.x/y <var>$1</var> <var>$3</var>)</code></td></tr>
15582 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15583 <tr><td width="60%"><em>&lt;</em>expr2<em>&gt;</em> ::=</td></tr>
15584 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>&amp;</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.&amp;x <var>$2</var>)</code></td></tr>
15585 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>+</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.+x <var>$2</var>)</code></td></tr>
15586 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>-</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.-x <var>$2</var>)</code></td></tr>
15587 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>*</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.*x <var>$2</var>)</code></td></tr>
15588 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>!</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.!x <var>$2</var>)</code></td></tr>
15589 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>!</code></td><td width="40%"><code>(six.!)</code></td></tr>
15590 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>++</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.++x <var>$2</var>)</code></td></tr>
15591 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>--</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.--x <var>$2</var>)</code></td></tr>
15592 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>~</code> <em>&lt;</em>expr2<em>&gt;</em></td><td width="40%"><code>(six.~x <var>$2</var>)</code></td></tr>
15593 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>new</code> <em>&lt;</em>id-or-prefix<em>&gt;</em> <code>(</code> <em>&lt;</em>arguments<em>&gt;</em> <code>)</code></td><td width="40%"><code>(six.new <var>$2</var> . <var>$4</var>)</code></td></tr>
15594 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15595 <tr><td width="60%"><em>&lt;</em>expr1<em>&gt;</em> ::=</td></tr>
15596 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>++</code></td><td width="40%"><code>(six.x++ <var>$1</var>)</code></td></tr>
15597 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>--</code></td><td width="40%"><code>(six.x-- <var>$1</var>)</code></td></tr>
15598 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>(</code> <em>&lt;</em>arguments<em>&gt;</em> <code>)</code></td><td width="40%"><code>(six.call <var>$1</var> . <var>$3</var>)</code></td></tr>
15599 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>[</code> <em>&lt;</em>expr<em>&gt;</em> <code>]</code></td><td width="40%"><code>(six.index <var>$1</var> <var>$3</var>)</code></td></tr>
15600 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>-&gt;</code> <em>&lt;</em>id-or-prefix<em>&gt;</em></td><td width="40%"><code>(six.arrow <var>$1</var> <var>$3</var>)</code></td></tr>
15601 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr1<em>&gt;</em> <code>.</code> <em>&lt;</em>id-or-prefix<em>&gt;</em></td><td width="40%"><code>(six.dot <var>$1</var> <var>$3</var>)</code></td></tr>
15602 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr0<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15603 <tr><td width="60%"><em>&lt;</em>expr0<em>&gt;</em> ::=</td></tr>
15604 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>id-or-prefix<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15605 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>string<em>&gt;</em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
15606 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>char<em>&gt;</em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
15607 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>number<em>&gt;</em></td><td width="40%"><code>(six.literal <var>$1</var>)</code></td></tr>
15608 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>(</code> <em>&lt;</em>expr<em>&gt;</em> <code>)</code></td><td width="40%"><var>$2</var></td></tr>
15609 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>(</code> <em>&lt;</em>block stat<em>&gt;</em> <code>)</code></td><td width="40%"><var>$2</var></td></tr>
15610 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>datum-starting-with-#-or-backquote<em>&gt;</em></td><td width="40%"><code>(six.prefix <var>$1</var>)</code></td></tr>
15611 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>[</code> <em>&lt;</em>elements<em>&gt;</em> <code>]</code></td><td width="40%"><var>$2</var></td></tr>
15612 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>type<em>&gt;</em> <code>(</code> <em>&lt;</em>parameters<em>&gt;</em> <code>)</code> <em>&lt;</em>body<em>&gt;</em></td><td width="40%"><code>(six.procedure <var>$1</var> <var>$3</var> <var>$5</var>)</code></td></tr>
15613 <tr><td width="60%"><em>&lt;</em>block stat<em>&gt;</em> ::=</td></tr>
15614 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>{</code> <em>&lt;</em>stat list<em>&gt;</em> <code>}</code></td><td width="40%"><code>(six.compound . <var>$2</var>)</code></td></tr>
15615 <tr><td width="60%"><em>&lt;</em>body<em>&gt;</em> ::=</td></tr>
15616 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>{</code> <em>&lt;</em>stat list<em>&gt;</em> <code>}</code></td><td width="40%"><code>(six.procedure-body . <var>$2</var>)</code></td></tr>
15617 <tr><td width="60%"><em>&lt;</em>stat list<em>&gt;</em> ::=</td></tr>
15618 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>stat<em>&gt;</em> <em>&lt;</em>stat list<em>&gt;</em></td><td width="40%"><code>(<var>$1</var> . <var>$2</var>)</code></td></tr>
15619 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>()</code></td></tr>
15620 <tr><td width="60%"><em>&lt;</em>parameters<em>&gt;</em> ::=</td></tr>
15621 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>nonempty parameters<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15622 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>()</code></td></tr>
15623 <tr><td width="60%"><em>&lt;</em>nonempty parameters<em>&gt;</em> ::=</td></tr>
15624 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>parameter<em>&gt;</em> <code>,</code> <em>&lt;</em>nonempty parameters<em>&gt;</em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr>
15625 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>parameter<em>&gt;</em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr>
15626 <tr><td width="60%"><em>&lt;</em>parameter<em>&gt;</em> ::=</td></tr>
15627 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>type<em>&gt;</em> <em>&lt;</em>id-or-prefix<em>&gt;</em></td><td width="40%"><code>(<var>$2</var> <var>$1</var>)</code></td></tr>
15628 <tr><td width="60%"><em>&lt;</em>arguments<em>&gt;</em> ::=</td></tr>
15629 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>nonempty arguments<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15630 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>()</code></td></tr>
15631 <tr><td width="60%"><em>&lt;</em>nonempty arguments<em>&gt;</em> ::=</td></tr>
15632 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr<em>&gt;</em> <code>,</code> <em>&lt;</em>nonempty arguments<em>&gt;</em></td><td width="40%"><code>(<var>$1</var> . <var>$3</var>)</code></td></tr>
15633 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><code>(<var>$1</var>)</code></td></tr>
15634 <tr><td width="60%"><em>&lt;</em>elements<em>&gt;</em> ::=</td></tr>
15635 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>nonempty elements<em>&gt;</em></td><td width="40%"><var>$1</var></td></tr>
15636 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;</td><td width="40%"><code>(six.null)</code></td></tr>
15637 <tr><td width="60%"><em>&lt;</em>nonempty elements<em>&gt;</em> ::=</td></tr>
15638 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><code>(six.list <var>$1</var> (six.null))</code></td></tr>
15639 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr<em>&gt;</em> <code>,</code> <em>&lt;</em>nonempty elements<em>&gt;</em></td><td width="40%"><code>(six.list <var>$1</var> <var>$3</var>)</code></td></tr>
15640 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<em>&lt;</em>expr<em>&gt;</em> <code>|</code> <em>&lt;</em>expr<em>&gt;</em></td><td width="40%"><code>(six.cons <var>$1</var> <var>$3</var>)</code></td></tr>
15641 <tr><td width="60%"><em>&lt;</em>id-or-prefix<em>&gt;</em> ::=</td></tr>
15642 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<em>&lt;</em>identifier<em>&gt;</em></td><td width="40%"><code>(six.identifier <var>$1</var>)</code></td></tr>
15643 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>\</code> <em>&lt;</em>datum<em>&gt;</em></td><td width="40%"><code>(six.prefix <var>$2</var>)</code></td></tr>
15644 <tr><td width="60%"><em>&lt;</em>type<em>&gt;</em> ::=</td></tr>
15645 <tr><td width="60%">&nbsp;&nbsp;&nbsp;&nbsp;<code>int</code></td><td width="40%"><code>int</code></td></tr>
15646 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>char</code></td><td width="40%"><code>char</code></td></tr>
15647 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>bool</code></td><td width="40%"><code>bool</code></td></tr>
15648 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>void</code></td><td width="40%"><code>void</code></td></tr>
15649 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>float</code></td><td width="40%"><code>float</code></td></tr>
15650 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>double</code></td><td width="40%"><code>double</code></td></tr>
15651 <tr><td width="60%">&nbsp;&nbsp;|&nbsp;<code>obj</code></td><td width="40%"><code>obj</code></td></tr>
15652 </table>
15654 <hr size="1">
15655 <a name="SIX-semantics"></a>
15656 <table cellpadding="1" cellspacing="1" border="0">
15657 <tr><td valign="middle" align="left"><a href="#SIX-grammar" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.12.1 SIX grammar" align="middle" width="32"></a></td>
15658 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19. C-interface" align="middle" width="32"></a></td>
15659 <td valign="middle" align="left"> &nbsp; </td>
15660 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15661 <td valign="middle" align="left"><a href="#Scheme-infix-syntax-extension" title="Up section"><img src="button-up.png" border="0" alt="Up: 18.12 Scheme infix syntax extension" align="middle" width="32"></a></td>
15662 <td valign="middle" align="left"><a href="#C_002dinterface" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 19. C-interface" align="middle" width="32"></a></td>
15663 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15664 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15665 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15666 </tr></table>
15667 <h3 class="subsection">18.12.2 SIX semantics</h3>
15669 <p>The semantics of SIX depends on the definition of the
15670 <code>six.<var>XXX</var></code> identifiers (as functions and macros). Many of
15671 these identifiers are predefined macros which give SIX a semantics
15672 that is close to C&rsquo;s. The user may override these definitions to
15673 change the semantics either globally or locally. For example,
15674 <code>six.x^y</code> is a predefined macro that expands <code>(six.x^y x y)</code>
15675 into <code>(bitwise-xor x y)</code>. If the user prefers the <samp>^</samp>
15676 operator to express exponentiation in a specific function, then in
15677 that function <code>six.x^y</code> can be redefined as a macro that expands
15678 <code>(six.x^y x y)</code> into <code>(expt x y)</code>. Note that the
15679 associativity and precedence of operators cannot be changed as that is
15680 a syntactic issue.
15681 </p>
15682 <p>Note that the following identifiers are not predefined, and
15683 consequently they do not have a predefined semantics:
15684 <code>six.label</code>, <code>six.goto</code>, <code>six.switch</code>, <code>six.case</code>,
15685 <code>six.break</code>, <code>six.continue</code>, <code>six.return</code>,
15686 <code>six.clause</code>, <code>six.x:-y</code>, and <code>six.!</code>.
15687 </p>
15688 <p>The following is an example showing some of the predefined semantics
15689 of SIX:
15690 </p>
15691 <table><tr><td>&nbsp;</td><td><pre class="smallexample">&gt; <b>(list (+ 1 2) \3+4; (+ 5 6))</b>
15692 (3 7 11)
15693 &gt; <b>\[ 1+2, \(+ 3 4), 5+6 ];</b>
15694 (3 7 11)
15695 &gt; <b>(map (lambda (x) \(x*x-1)/log(x+1);) '(1 2 3 4))</b>
15696 (0 2.730717679880512 5.7707801635558535 9.320024018394177)
15697 &gt; <b>\obj n = expt(10,5);</b>
15698 &gt; <b>n</b>
15699 100000
15700 &gt; <b>\obj t[3][10] = 88;</b>
15701 &gt; <b>\t[0][9] = t[2][1] = 11;</b>
15703 &gt; <b>t</b>
15704 #(#(88 88 88 88 88 88 88 88 88 11)
15705 #(88 88 88 88 88 88 88 88 88 88)
15706 #(88 11 88 88 88 88 88 88 88 88))
15707 &gt; <b>\obj radix = new parameter (10);</b>
15708 &gt; <b>\radix(2);</b>
15709 &gt; <b>\radix();</b>
15711 &gt; <b>\for (int i=0; i&lt;5; i++) pp(1&lt;&lt;i*8);</b>
15714 65536
15715 16777216
15716 4294967296
15717 &gt; <b>\obj \make-adder (obj x) { obj (obj y) { x+y; }; }</b>
15718 &gt; <b>\map (new adder (100), [1,2,3,4]);</b>
15719 (101 102 103 104)
15720 &gt; <b>(map (make-adder 100) (list 1 2 3 4))</b>
15721 (101 102 103 104)
15722 </pre></td></tr></table>
15724 <hr size="1">
15725 <a name="C_002dinterface"></a>
15726 <table cellpadding="1" cellspacing="1" border="0">
15727 <tr><td valign="middle" align="left"><a href="#SIX-semantics" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 18.12.2 SIX semantics" align="middle" width="32"></a></td>
15728 <td valign="middle" align="left"><a href="#mapping-of-types" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.1 The mapping of types between C and Scheme" align="middle" width="32"></a></td>
15729 <td valign="middle" align="left"> &nbsp; </td>
15730 <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" alt="FastBack: 18. Lexical syntax and readtables" align="middle" width="32"></a></td>
15731 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
15732 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
15733 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15734 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15735 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15736 </tr></table>
15737 <a name="C_002dinterface-1"></a>
15738 <h1 class="chapter">19. C-interface</h1>
15739 <a name="index-FFI"></a>
15740 <a name="index-foreign-function-interface"></a>
15742 <p>The Gambit Scheme system offers a mechanism for interfacing Scheme code
15743 and C code called the &ldquo;C-interface&rdquo;. A Scheme program indicates which
15744 C functions it needs to have access to and which Scheme procedures can
15745 be called from C, and the C interface automatically constructs the
15746 corresponding Scheme procedures and C functions. The conversions needed
15747 to transform data from the Scheme representation to the C representation
15748 (and back), are generated automatically in accordance with the argument
15749 and result types of the C function or Scheme procedure.
15750 </p>
15751 <p>The C-interface places some restrictions on the types of data that can
15752 be exchanged between C and Scheme. The mapping of data types between C
15753 and Scheme is discussed in the next section. The remaining sections of
15754 this chapter describe each special form of the C-interface.
15755 </p>
15756 <table class="menu" border="0" cellspacing="0">
15757 <tr><td align="left" valign="top"><a href="#mapping-of-types">19.1 The mapping of types between C and Scheme</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15758 <tr><td align="left" valign="top"><a href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15759 <tr><td align="left" valign="top"><a href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15760 <tr><td align="left" valign="top"><a href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15761 <tr><td align="left" valign="top"><a href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15762 <tr><td align="left" valign="top"><a href="#c_002ddefine_002dtype">19.6 The <code>c-define-type</code> special form</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15763 <tr><td align="left" valign="top"><a href="#continuations">19.7 Continuations and the C-interface</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top"></td></tr>
15764 </table>
15766 <hr size="1">
15767 <a name="mapping-of-types"></a>
15768 <table cellpadding="1" cellspacing="1" border="0">
15769 <tr><td valign="middle" align="left"><a href="#C_002dinterface" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19. C-interface" align="middle" width="32"></a></td>
15770 <td valign="middle" align="left"><a href="#c_002ddeclare" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.2 The c-declare special form" align="middle" width="32"></a></td>
15771 <td valign="middle" align="left"> &nbsp; </td>
15772 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
15773 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
15774 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
15775 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
15776 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
15777 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
15778 </tr></table>
15779 <a name="The-mapping-of-types-between-C-and-Scheme"></a>
15780 <h2 class="section">19.1 The mapping of types between C and Scheme</h2>
15782 <p>Scheme and C do not provide the same set of built-in data types so it is
15783 important to understand which Scheme type is compatible with which C
15784 type and how values get mapped from one environment to the other. To
15785 improve compatibility a new type is added to Scheme, the <samp>foreign</samp>
15786 object type, and the following data types are added to C:
15787 </p>
15788 <dl compact="compact">
15789 <dt> <code>scheme-object</code></dt>
15790 <dd><p>denotes the universal type of Scheme objects
15791 (type <code>___SCMOBJ</code> defined in <samp>gambit.h</samp>)
15792 </p></dd>
15793 <dt> <code>bool</code></dt>
15794 <dd><p>denotes the C++ <samp>bool</samp> type or the C <samp>int</samp> type
15795 (type <code>___BOOL</code> defined in <samp>gambit.h</samp>)
15796 </p></dd>
15797 <dt> <code>int8</code></dt>
15798 <dd><p>8 bit signed integer (type <code>___S8</code> defined in <samp>gambit.h</samp>)
15799 </p></dd>
15800 <dt> <code>unsigned-int8</code></dt>
15801 <dd><p>8 bit unsigned integer (type <code>___U8</code> defined in <samp>gambit.h</samp>)
15802 </p></dd>
15803 <dt> <code>int16</code></dt>
15804 <dd><p>16 bit signed integer (type <code>___S16</code> defined in <samp>gambit.h</samp>)
15805 </p></dd>
15806 <dt> <code>unsigned-int16</code></dt>
15807 <dd><p>16 bit unsigned integer (type <code>___U16</code> defined in <samp>gambit.h</samp>)
15808 </p></dd>
15809 <dt> <code>int32</code></dt>
15810 <dd><p>32 bit signed integer (type <code>___S32</code> defined in <samp>gambit.h</samp>)
15811 </p></dd>
15812 <dt> <code>unsigned-int32</code></dt>
15813 <dd><p>32 bit unsigned integer (type <code>___U32</code> defined in <samp>gambit.h</samp>)
15814 </p></dd>
15815 <dt> <code>int64</code></dt>
15816 <dd><p>64 bit signed integer (type <code>___S64</code> defined in <samp>gambit.h</samp>)
15817 </p></dd>
15818 <dt> <code>unsigned-int64</code></dt>
15819 <dd><p>64 bit unsigned integer (type <code>___U64</code> defined in <samp>gambit.h</samp>)
15820 </p></dd>
15821 <dt> <code>float32</code></dt>
15822 <dd><p>32 bit floating point number (type <code>___F32</code> defined in <samp>gambit.h</samp>)
15823 </p></dd>
15824 <dt> <code>float64</code></dt>
15825 <dd><p>64 bit floating point number (type <code>___F64</code> defined in <samp>gambit.h</samp>)
15826 </p></dd>
15827 <dt> <code>ISO-8859-1</code></dt>
15828 <dd><p>denotes ISO-8859-1 encoded characters
15829 (8 bit unsigned integer, type <code>___ISO_8859_1</code> defined in <samp>gambit.h</samp>)
15830 </p></dd>
15831 <dt> <code>UCS-2</code></dt>
15832 <dd><p>denotes UCS-2 encoded characters
15833 (16 bit unsigned integer, type <code>___UCS_2</code> defined in <samp>gambit.h</samp>)
15834 </p></dd>
15835 <dt> <code>UCS-4</code></dt>
15836 <dd><p>denotes UCS-4 encoded characters
15837 (32 bit unsigned integer, type <code>___UCS_4</code> defined in <samp>gambit.h</samp>)
15838 </p></dd>
15839 <dt> <code>char-string</code></dt>
15840 <dd><p>denotes the C <samp>char*</samp> type when used as a null terminated string
15841 </p></dd>
15842 <dt> <code>nonnull-char-string</code></dt>
15843 <dd><p>denotes the nonnull C <samp>char*</samp> type when used as a null terminated string
15844 </p></dd>
15845 <dt> <code>nonnull-char-string-list</code></dt>
15846 <dd><p>denotes an array of nonnull C <samp>char*</samp> terminated with a null pointer
15847 </p></dd>
15848 <dt> <code>ISO-8859-1-string</code></dt>
15849 <dd><p>denotes ISO-8859-1 encoded strings
15850 (null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>)
15851 </p></dd>
15852 <dt> <code>nonnull-ISO-8859-1-string</code></dt>
15853 <dd><p>denotes nonnull ISO-8859-1 encoded strings
15854 (null terminated string of 8 bit unsigned integers, i.e. <code>___ISO_8859_1*</code>)
15855 </p></dd>
15856 <dt> <code>nonnull-ISO-8859-1-stringlist</code></dt>
15857 <dd><p>denotes an array of nonnull ISO-8859-1 encoded strings terminated with a null pointer
15858 </p></dd>
15859 <dt> <code>UTF-8-string</code></dt>
15860 <dd><p>denotes UTF-8 encoded strings
15861 (null terminated string of <code>char</code>, i.e. <code>char*</code>)
15862 </p></dd>
15863 <dt> <code>nonnull-UTF-8-string</code></dt>
15864 <dd><p>denotes nonnull UTF-8 encoded strings
15865 (null terminated string of <code>char</code>, i.e. <code>char*</code>)
15866 </p></dd>
15867 <dt> <code>nonnull-UTF-8-string-list</code></dt>
15868 <dd><p>denotes an array of nonnull UTF-8 encoded strings terminated with a null pointer
15869 </p></dd>
15870 <dt> <code>UTF-16-string</code></dt>
15871 <dd><p>denotes UTF-16 encoded strings
15872 (null terminated string of <code>char</code>, i.e. <code>char*</code>)
15873 </p></dd>
15874 <dt> <code>nonnull-UTF-16-string</code></dt>
15875 <dd><p>denotes nonnull UTF-16 encoded strings
15876 (null terminated string of <code>char</code>, i.e. <code>char*</code>)
15877 </p></dd>
15878 <dt> <code>nonnull-UTF-16-string-list</code></dt>
15879 <dd><p>denotes an array of nonnull UTF-16 encoded strings terminated with a null pointer
15880 </p></dd>
15881 <dt> <code>UCS-2-string</code></dt>
15882 <dd><p>denotes UCS-2 encoded strings
15883 (null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>)
15884 </p></dd>
15885 <dt> <code>nonnull-UCS-2-string</code></dt>
15886 <dd><p>denotes nonnull UCS-2 encoded strings
15887 (null terminated string of 16 bit unsigned integers, i.e. <code>___UCS_2*</code>)
15888 </p></dd>
15889 <dt> <code>nonnull-UCS-2-string-list</code></dt>
15890 <dd><p>denotes an array of nonnull UCS-2 encoded strings terminated with a null pointer
15891 </p></dd>
15892 <dt> <code>UCS-4-string</code></dt>
15893 <dd><p>denotes UCS-4 encoded strings
15894 (null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>)
15895 </p></dd>
15896 <dt> <code>nonnull-UCS-4-string</code></dt>
15897 <dd><p>denotes nonnull UCS-4 encoded strings
15898 (null terminated string of 32 bit unsigned integers, i.e. <code>___UCS_4*</code>)
15899 </p></dd>
15900 <dt> <code>nonnull-UCS-4-string-list</code></dt>
15901 <dd><p>denotes an array of nonnull UCS-4 encoded strings terminated with a null pointer
15902 </p></dd>
15903 <dt> <code>wchar_t-string</code></dt>
15904 <dd><p>denotes <code>wchar_t</code> encoded strings
15905 (null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>)
15906 </p></dd>
15907 <dt> <code>nonnull-wchar_t-string</code></dt>
15908 <dd><p>denotes nonnull <code>wchar_t</code> encoded strings
15909 (null terminated string of <code>wchar_t</code>, i.e. <code>wchar_t*</code>)
15910 </p></dd>
15911 <dt> <code>nonnull-wchar_t-string-list</code></dt>
15912 <dd><p>denotes an array of nonnull <code>wchar_t</code> encoded strings terminated with a null pointer
15913 </p></dd>
15914 </dl>
15916 <p>To specify a particular C type inside the <code>c-lambda</code>,
15917 <code>c-define</code> and <code>c-define-type</code> forms, the following &ldquo;Scheme
15918 notation&rdquo; is used:
15919 </p>
15920 <dl compact="compact">
15921 <dt> <code><span class="roman">Scheme notation</span></code></dt>
15922 <dd><p>C type
15923 </p></dd>
15924 <dt> <code>void</code></dt>
15925 <dd><p><code>void</code>
15926 </p></dd>
15927 <dt> <code>bool</code></dt>
15928 <dd><p><code>bool</code>
15929 </p></dd>
15930 <dt> <code>char</code></dt>
15931 <dd><p><code>char</code> (may be signed or unsigned depending on the C compiler)
15932 </p></dd>
15933 <dt> <code>signed-char</code></dt>
15934 <dd><p><code>signed char</code>
15935 </p></dd>
15936 <dt> <code>unsigned-char</code></dt>
15937 <dd><p><code>unsigned char</code>
15938 </p></dd>
15939 <dt> <code>ISO-8859-1</code></dt>
15940 <dd><p><code>ISO-8859-1</code>
15941 </p></dd>
15942 <dt> <code>UCS-2</code></dt>
15943 <dd><p><code>UCS-2</code>
15944 </p></dd>
15945 <dt> <code>UCS-4</code></dt>
15946 <dd><p><code>UCS-4</code>
15947 </p></dd>
15948 <dt> <code>wchar_t</code></dt>
15949 <dd><p><code>wchar_t</code>
15950 </p></dd>
15951 <dt> <code>short</code></dt>
15952 <dd><p><code>short</code>
15953 </p></dd>
15954 <dt> <code>unsigned-short</code></dt>
15955 <dd><p><code>unsigned short</code>
15956 </p></dd>
15957 <dt> <code>int</code></dt>
15958 <dd><p><code>int</code>
15959 </p></dd>
15960 <dt> <code>unsigned-int</code></dt>
15961 <dd><p><code>unsigned int</code>
15962 </p></dd>
15963 <dt> <code>long</code></dt>
15964 <dd><p><code>long</code>
15965 </p></dd>
15966 <dt> <code>unsigned-long</code></dt>
15967 <dd><p><code>unsigned long</code>
15968 </p></dd>
15969 <dt> <code>long-long</code></dt>
15970 <dd><p><code>long long</code>
15971 </p></dd>
15972 <dt> <code>unsigned-long-long</code></dt>
15973 <dd><p><code>unsigned long long</code>
15974 </p></dd>
15975 <dt> <code>float</code></dt>
15976 <dd><p><code>float</code>
15977 </p></dd>
15978 <dt> <code>double</code></dt>
15979 <dd><p><code>double</code>
15980 </p></dd>
15981 <dt> <code>int8</code></dt>
15982 <dd><p><code>int8</code>
15983 </p></dd>
15984 <dt> <code>unsigned-int8</code></dt>
15985 <dd><p><code>unsigned-int8</code>
15986 </p></dd>
15987 <dt> <code>int16</code></dt>
15988 <dd><p><code>int16</code>
15989 </p></dd>
15990 <dt> <code>unsigned-int16</code></dt>
15991 <dd><p><code>unsigned-int16</code>
15992 </p></dd>
15993 <dt> <code>int32</code></dt>
15994 <dd><p><code>int32</code>
15995 </p></dd>
15996 <dt> <code>unsigned-int32</code></dt>
15997 <dd><p><code>unsigned-int32</code>
15998 </p></dd>
15999 <dt> <code>int64</code></dt>
16000 <dd><p><code>int64</code>
16001 </p></dd>
16002 <dt> <code>unsigned-int64</code></dt>
16003 <dd><p><code>unsigned-int64</code>
16004 </p></dd>
16005 <dt> <code>float32</code></dt>
16006 <dd><p><code>float32</code>
16007 </p></dd>
16008 <dt> <code>float64</code></dt>
16009 <dd><p><code>float64</code>
16010 </p></dd>
16011 <dt> <code>(struct &quot;<var>c-struct-id</var>&quot; <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>
16012 <dd><p><code>struct <var>c-struct-id</var></code> (where <var>c-struct-id</var> is the name of a
16013 C structure; see below for the meaning of <var>tags</var> and <var>release-function</var>)
16014 </p></dd>
16015 <dt> <code>(union &quot;<var>c-union-id</var>&quot; <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>
16016 <dd><p><code>union <var>c-union-id</var></code> (where <var>c-union-id</var> is the name of a
16017 C union; see below for the meaning of <var>tags</var> and <var>release-function</var>)
16018 </p></dd>
16019 <dt> <code>(type &quot;<var>c-type-id</var>&quot; <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>
16020 <dd><p><code><var>c-type-id</var></code> (where <var>c-type-id</var> is an identifier naming a
16021 C type; see below for the meaning of <var>tags</var> and <var>release-function</var>)
16022 </p></dd>
16023 <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>
16024 <dd><p><code><var>T</var>*</code> (where <var>T</var> is the C equivalent of <var>type</var>
16025 which must be the Scheme notation of a C type; see below for the meaning
16026 of <var>tags</var> and <var>release-function</var>)
16027 </p></dd>
16028 <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>
16029 <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>
16030 except the <code>NULL</code> pointer is not allowed
16031 </p></dd>
16032 <dt> <code>(function (<var>type1</var>&hellip;) <var>result-type</var>)</code></dt>
16033 <dd><p>function with the given argument types and result type
16034 </p></dd>
16035 <dt> <code>(nonnull-function (<var>type1</var>&hellip;) <var>result-type</var>)</code></dt>
16036 <dd><p>same as <code>(function (<var>type1</var>&hellip;) <var>result-type</var>)</code>
16037 except the <code>NULL</code> pointer is not allowed
16038 </p></dd>
16039 <dt> <code>char-string</code></dt>
16040 <dd><p><code>char-string</code>
16041 </p></dd>
16042 <dt> <code>nonnull-char-string</code></dt>
16043 <dd><p><code>nonnull-char-string</code>
16044 </p></dd>
16045 <dt> <code>nonnull-char-string-list</code></dt>
16046 <dd><p><code>nonnull-char-string-list</code>
16047 </p></dd>
16048 <dt> <code>ISO-8859-1-string</code></dt>
16049 <dd><p><code>ISO-8859-1-string</code>
16050 </p></dd>
16051 <dt> <code>nonnull-ISO-8859-1-string</code></dt>
16052 <dd><p><code>nonnull-ISO-8859-1-string</code>
16053 </p></dd>
16054 <dt> <code>nonnull-ISO-8859-1-string-list</code></dt>
16055 <dd><p><code>nonnull-ISO-8859-1-string-list</code>
16056 </p></dd>
16057 <dt> <code>UTF-8-string</code></dt>
16058 <dd><p><code>UTF-8-string</code>
16059 </p></dd>
16060 <dt> <code>nonnull-UTF-8-string</code></dt>
16061 <dd><p><code>nonnull-UTF-8-string</code>
16062 </p></dd>
16063 <dt> <code>nonnull-UTF-8-string-list</code></dt>
16064 <dd><p><code>nonnull-UTF-8-string-list</code>
16065 </p></dd>
16066 <dt> <code>UTF-16-string</code></dt>
16067 <dd><p><code>UTF-16-string</code>
16068 </p></dd>
16069 <dt> <code>nonnull-UTF-16-string</code></dt>
16070 <dd><p><code>nonnull-UTF-16-string</code>
16071 </p></dd>
16072 <dt> <code>nonnull-UTF-16-string-list</code></dt>
16073 <dd><p><code>nonnull-UTF-16-string-list</code>
16074 </p></dd>
16075 <dt> <code>UCS-2-string</code></dt>
16076 <dd><p><code>UCS-2-string</code>
16077 </p></dd>
16078 <dt> <code>nonnull-UCS-2-string</code></dt>
16079 <dd><p><code>nonnull-UCS-2-string</code>
16080 </p></dd>
16081 <dt> <code>nonnull-UCS-2-string-list</code></dt>
16082 <dd><p><code>nonnull-UCS-2-string-list</code>
16083 </p></dd>
16084 <dt> <code>UCS-4-string</code></dt>
16085 <dd><p><code>UCS-4-string</code>
16086 </p></dd>
16087 <dt> <code>nonnull-UCS-4-string</code></dt>
16088 <dd><p><code>nonnull-UCS-4-string</code>
16089 </p></dd>
16090 <dt> <code>nonnull-UCS-4-string-list</code></dt>
16091 <dd><p><code>nonnull-UCS-4-string-list</code>
16092 </p></dd>
16093 <dt> <code>wchar_t-string</code></dt>
16094 <dd><p><code>wchar_t-string</code>
16095 </p></dd>
16096 <dt> <code>nonnull-wchar_t-string</code></dt>
16097 <dd><p><code>nonnull-wchar_t-string</code>
16098 </p></dd>
16099 <dt> <code>nonnull-wchar_t-string-list</code></dt>
16100 <dd><p><code>nonnull-wchar_t-string-list</code>
16101 </p></dd>
16102 <dt> <code>scheme-object</code></dt>
16103 <dd><p><code>scheme-object</code>
16104 </p></dd>
16105 <dt> <code><var>name</var></code></dt>
16106 <dd><p>appropriate translation of <var>name</var> (where <var>name</var>
16107 is a C type defined with <code>c-define-type</code>)
16108 </p></dd>
16109 <dt> <code>&quot;<var>c-type-id</var>&quot;</code></dt>
16110 <dd><p><var>c-type-id</var> (this form is equivalent to <code>(type &quot;<var>c-type-id</var>&quot;)</code>)
16111 </p></dd>
16112 </dl>
16114 <p>The <code>struct</code>, <code>union</code>, <code>type</code>, <code>pointer</code> and
16115 <code>nonnull-pointer</code> types are &ldquo;foreign types&rdquo; and they are
16116 represented on the Scheme side as &ldquo;foreign objects&rdquo;. A foreign object
16117 is internally represented as a pointer. This internal pointer is
16118 identical to the C pointer being represented in the case of the
16119 <code>pointer</code> and <code>nonnull-pointer</code> types.
16120 </p>
16121 <p>In the case of the <code>struct</code>, <code>union</code> and <code>type</code> types,
16122 the internal pointer points to a copy of the C data type being
16123 represented. When an instance of one of these types is converted from C
16124 to Scheme, a block of memory is allocated from the C heap and
16125 initialized with the instance and then a foreign object is allocated
16126 from the Scheme heap and initialized with the pointer to this copy.
16127 This approach may appear overly complex, but it allows the conversion of
16128 C++ classes that do not have a zero parameter constructor or an
16129 assignment method (i.e. when compiling with a C++ compiler an instance
16130 is copied using <samp>new <var>type</var> (<var>instance</var>)</samp>, which calls the
16131 copy-constructor of <var>type</var> if it is a class; <var>type</var>&rsquo;s assignment
16132 operator is never used). Conversion from Scheme to C simply
16133 dereferences the internal pointer (no allocation from the C heap is
16134 performed). Deallocation of the copy on the C heap is under the control
16135 of the release function attached to the foreign object (see below).
16136 </p>
16137 <p>The optional <var>tags</var> field of foreign type specifications is used
16138 for type checking on the Scheme side. The <var>tags</var> field must be
16139 <code>#f</code>, a symbol or a non-empty list of symbols. When it is not
16140 specified the <var>tags</var> field defaults to a symbol whose name, as
16141 returned by <code>symbol-&gt;string</code>, is the C type declaration for that
16142 type. For example the symbol <samp>char**</samp> is the default for the
16143 type <samp>(pointer (pointer char))</samp>. A <var>tags</var> field that is a
16144 single symbol is equivalent to a list containing only that symbol.
16145 The first symbol in the list of tags is the primary tag. For example
16146 the primary tag of the type <samp>(pointer char)</samp> is <samp>char*</samp> and
16147 the primary tag of the type <samp>(pointer char (foo bar))</samp> is
16148 <samp>foo</samp>.
16149 </p>
16150 <p>Type compatibility between two foreign types depends on their tags.
16151 An instance of a foreign type <var>T</var> can be used where a foreign type
16152 <var>E</var> is expected if and only if
16153 </p>
16154 <ul>
16155 <li>
16156 <var>T</var>&rsquo;s <var>tags</var> field is <code>#f</code>, or
16158 </li><li>
16159 <var>E</var>&rsquo;s <var>tags</var> field is <code>#f</code>, or
16161 </li><li>
16162 <var>T</var>&rsquo;s primary tag is a member of <var>E</var>&rsquo;s tags.
16164 </li></ul>
16166 <p>For the safest code a <var>tags</var> field of <code>#f</code> should be used
16167 sparingly, as it completely bypasses type checking. The external
16168 representation of Scheme foreign objects (used by the <code>write</code>
16169 procedure) contains the primary tag (if the <var>tags</var> field is not
16170 <code>#f</code>), and the hexadecimal address denoted by the internal
16171 pointer, for example <samp>#&lt;char** #2 0x2AAC535C&gt;</samp>. Note that the
16172 hexadecimal address is in C notation, which can be easily transferred
16173 to a C debugger with a &ldquo;cut-and-paste&rdquo;.
16174 </p>
16175 <p>A <var>release-function</var> can also be specified within a foreign type
16176 specification. The <var>release-function</var> must be <code>#f</code> or a string
16177 naming a C function with a single parameter of type <samp>void*</samp> (in
16178 which the internal pointer is passed) and with a result of type
16179 <samp>___SCMOBJ</samp> (for returning an error code). When the
16180 <var>release-function</var> is not specified or is <code>#f</code> a default
16181 function is constructed by the C-interface. This default function does
16182 nothing in the case of the <code>pointer</code> and <code>nonnull-pointer</code>
16183 types (deallocation is not the responsibility of the C-interface) and
16184 returns the fixnum <samp>___FIX(___NO_ERR)</samp> to indicate no error. In
16185 the case of the <code>struct</code>, <code>union</code> and <code>type</code> types, the
16186 default function reclaims the copy on the C heap referenced by the
16187 internal pointer (when using a C++ compiler this is done using
16188 <samp>delete (<var>type</var>*)<var>internal-pointer</var></samp>, which calls the
16189 destructor of <var>type</var> if it is a class) and returns
16190 <samp>___FIX(___NO_ERR)</samp>. In many situations the default
16191 <var>release-function</var> will perform the appropriate cleanup for the
16192 foreign type. However, in certain cases special operations (such as
16193 decrementing a reference count, removing the object from a table, etc)
16194 must be performed. For such cases a user supplied
16195 <var>release-function</var> is needed.
16196 </p>
16197 <p>The <var>release-function</var> is invoked at most once for any foreign
16198 object. After the <var>release-function</var> is invoked, the foreign
16199 object is considered &ldquo;released&rdquo; and can no longer be used in a
16200 foreign type conversion. When the garbage collector detects that a
16201 foreign object is no longer reachable by the program, it will invoke
16202 the <var>release-function</var> if the foreign object is not yet released.
16203 When there is a need to release the foreign object promptly, the
16204 program can explicitly call <code>(foreign-release! <var>obj</var>)</code> which
16205 invokes the <var>release-function</var> if the foreign object is not yet
16206 released, and does nothing otherwise. The call
16207 <code>(foreign-released? <var>obj</var>)</code> returns a boolean indicating
16208 whether the foreign object <var>obj</var> has been released yet or not.
16209 The call <code>(foreign-address <var>obj</var>)</code> returns the address
16210 denoted by the internal pointer of foreign object <var>obj</var> or 0 if it
16211 has been released. The call <code>(foreign? <var>obj</var>)</code> tests that
16212 <var>obj</var> is a foreign object. Finally the call <code>(foreign-tags
16213 <var>obj</var>)</code> returns the list of tags of foreign object <var>obj</var>, or
16214 <code>#f</code>.
16215 </p>
16216 <p>The following table gives the C types to which each Scheme type
16217 can be converted:
16218 </p>
16219 <dl compact="compact">
16220 <dt> Scheme type</dt>
16221 <dd><p>Allowed target C types
16222 </p></dd>
16223 <dt> boolean <code>#f</code></dt>
16224 <dd><p><code>scheme-object</code>; <code>bool</code>;
16225 <code>pointer</code>;
16226 <code>function</code>;
16227 <code>char-string</code>;
16228 <code>ISO-8859-1-string</code>;
16229 <code>UTF-8-string</code>;
16230 <code>UTF-16-string</code>;
16231 <code>UCS-2-string</code>;
16232 <code>UCS-4-string</code>;
16233 <code>wchar_t-string</code>
16234 </p></dd>
16235 <dt> boolean <code>#t</code></dt>
16236 <dd><p><code>scheme-object</code>; <code>bool</code>
16237 </p></dd>
16238 <dt> character</dt>
16239 <dd><p><code>scheme-object</code>; <code>bool</code>;
16240 <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>;
16241 <code>UCS-4</code>; <code>wchar_t</code>
16242 </p></dd>
16243 <dt> exact integer</dt>
16244 <dd><p><code>scheme-object</code>; <code>bool</code>; <span class="roman">[</span><code>unsigned-</code><span class="roman">]</span>
16245 <code>int8</code>/<code>int16</code>/<code>int32</code>/<code>int64</code>; <span class="roman">[</span><code>unsigned</code><span class="roman">]</span>
16246 <code>short</code>/<code>int</code>/<code>long</code>
16247 </p></dd>
16248 <dt> inexact real</dt>
16249 <dd><p><code>scheme-object</code>; <code>bool</code>; <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code>
16250 </p></dd>
16251 <dt> string</dt>
16252 <dd><p><code>scheme-object</code>; <code>bool</code>;
16253 <code>char-string</code>;
16254 <code>nonnull-char-string</code>;
16255 <code>ISO-8859-1-string</code>;
16256 <code>nonnull-ISO-8859-1-string</code>;
16257 <code>UTF-8-string</code>;
16258 <code>nonnull-UTF-8-string</code>;
16259 <code>UTF-16-string</code>;
16260 <code>nonnull-UTF-16-string</code>;
16261 <code>UCS-2-string</code>;
16262 <code>nonnull-UCS-2-string</code>;
16263 <code>UCS-4-string</code>;
16264 <code>nonnull-UCS-4-string</code>;
16265 <code>wchar_t-string</code>;
16266 <code>nonnull-wchar_t-string</code>
16267 </p></dd>
16268 <dt> foreign object</dt>
16269 <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
16270 </p></dd>
16271 <dt> vector</dt>
16272 <dd><p><code>scheme-object</code>; <code>bool</code>
16273 </p></dd>
16274 <dt> symbol</dt>
16275 <dd><p><code>scheme-object</code>; <code>bool</code>
16276 </p></dd>
16277 <dt> procedure</dt>
16278 <dd><p><code>scheme-object</code>; <code>bool</code>;
16279 <code>function</code>;
16280 <code>nonnull-function</code>
16281 </p></dd>
16282 <dt> other objects</dt>
16283 <dd><p><code>scheme-object</code>; <code>bool</code>
16284 </p></dd>
16285 </dl>
16287 <p>The following table gives the Scheme types to which each C type
16288 will be converted:
16289 </p>
16290 <dl compact="compact">
16291 <dt> C type</dt>
16292 <dd><p>Resulting Scheme type
16293 </p></dd>
16294 <dt> scheme-object</dt>
16295 <dd><p>the Scheme object encoded
16296 </p></dd>
16297 <dt> bool</dt>
16298 <dd><p>boolean
16299 </p></dd>
16300 <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>
16301 <dd><p>character
16302 </p></dd>
16303 <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></dt>
16304 <dd><p>exact integer
16305 </p></dd>
16306 <dt> <code>float</code>; <code>double</code>; <code>float32</code>; <code>float64</code></dt>
16307 <dd><p>inexact real
16308 </p></dd>
16309 <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>
16310 <dd><p>string or <code>#f</code> if it is equal to <samp>NULL</samp>
16311 </p></dd>
16312 <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>
16313 <dd><p>string
16314 </p></dd>
16315 <dt> <code>struct</code>/<code>union</code>/<code>type</code>/<code>pointer</code>/<code>nonnull-pointer</code></dt>
16316 <dd><p>foreign object with the appropriate tags
16317 or <code>#f</code> in the case of a <code>pointer</code> equal to <samp>NULL</samp>
16318 </p></dd>
16319 <dt> <code>function</code></dt>
16320 <dd><p>procedure or <code>#f</code> if it is equal to <samp>NULL</samp>
16321 </p></dd>
16322 <dt> <code>nonnull-function</code></dt>
16323 <dd><p>procedure
16324 </p></dd>
16325 <dt> <code>void</code></dt>
16326 <dd><p>void object
16327 </p></dd>
16328 </dl>
16330 <p>All Scheme types are compatible with the C types <code>scheme-object</code>
16331 and <code>bool</code>. Conversion to and from the C type
16332 <code>scheme-object</code> is the identity function on the object encoding.
16333 This provides a low-level mechanism for accessing Scheme&rsquo;s object
16334 representation from C (with the help of the macros in the
16335 <samp>gambit.h</samp> header file). When a C <code>bool</code> type is expected,
16336 an extended Scheme boolean can be passed (<code>#f</code> is converted to 0
16337 and all other values are converted to 1).
16338 </p>
16339 <p>The Scheme boolean <code>#f</code> can be passed to the C environment where
16340 a <code>char-string</code>, <code>ISO-8859-1-string</code>, <code>UTF-8-string</code>,
16341 <code>UTF-16-string</code>, <code>UCS-2-string</code>, <code>UCS-4-string</code>,
16342 <code>wchar_t-string</code>, <code>pointer</code> or <code>function</code> type is
16343 expected. In this case, <code>#f</code> is converted to the <samp>NULL</samp>
16344 pointer. C <code>bool</code>s are extended booleans so any value different
16345 from 0 represents true. Thus, a C <code>bool</code> passed to the Scheme
16346 environment is mapped as follows: 0 to <code>#f</code> and all other values
16347 to <code>#t</code>.
16348 </p>
16349 <p>A Scheme character passed to the C environment where any C character
16350 type is expected is converted to the corresponding character in the C
16351 environment. An error is signaled if the Scheme character does not fit
16352 in the C character. Any C character type passed to Scheme is converted
16353 to the corresponding Scheme character. An error is signaled if the C
16354 character does not fit in the Scheme character.
16355 </p>
16356 <p>A Scheme exact integer passed to the C environment where a C integer
16357 type (other than <code>char</code>) is expected is converted to the
16358 corresponding integral value. An error is signaled if the value falls
16359 outside of the range representable by that integral type. C integer
16360 values passed to the Scheme environment are mapped to the same Scheme
16361 exact integer. If the value is outside the fixnum range, a bignum is
16362 created.
16363 </p>
16364 <p>A Scheme inexact real passed to the C environment is converted to the
16365 corresponding <code>float</code>, <code>double</code>, <code>float32</code> or
16366 <code>float64</code> value. C <code>float</code>, <code>double</code>, <code>float32</code> and
16367 <code>float64</code> values passed to the Scheme environment are mapped to the
16368 closest Scheme inexact real.
16369 </p>
16370 <p>Scheme&rsquo;s rational numbers and complex numbers are not compatible with
16371 any C numeric type.
16372 </p>
16373 <p>A Scheme string passed to the C environment where any C string type is
16374 expected is converted to a null terminated string using the appropriate
16375 encoding. The C string is a fresh copy of the Scheme string. If the C
16376 string was created for an argument of a <code>c-lambda</code>, the C string
16377 will be reclaimed when the <code>c-lambda</code> returns. If the C string was
16378 created for returning the result of a <code>c-define</code> to C, the caller
16379 is responsible for reclaiming the C string with a call to the
16380 <code>___release_string</code> function (see below for an example). Any C
16381 string type passed to the Scheme environment causes the creation of a
16382 fresh Scheme string containing a copy of the C string (unless the C
16383 string is equal to <code>NULL</code>, in which case it is converted to
16384 <code>#f</code>).
16385 </p>
16386 <p>A foreign type passed to the Scheme environment causes the creation
16387 and initialization of a Scheme foreign object with the appropriate
16388 tags (except for the case of a <code>pointer</code> equal to <code>NULL</code>
16389 which is converted to <code>#f</code>). A Scheme foreign object can be
16390 passed where a foreign type is expected, on the condition that the
16391 tags are compatible and the Scheme foreign object is not yet released.
16392 The value <code>#f</code> is also acceptable for a <code>pointer</code> type, and
16393 is converted to <code>NULL</code>.
16394 </p>
16395 <p>Scheme procedures defined with the <code>c-define</code> special form can be
16396 passed where the <code>function</code> and <code>nonnull-function</code> types are
16397 expected. The value <code>#f</code> is also acceptable for a <code>function</code>
16398 type, and is converted to <code>NULL</code>. No other Scheme procedures are
16399 acceptable. Conversion from the <code>function</code> and
16400 <code>nonnull-function</code> types to Scheme procedures is not currently
16401 implemented.
16402 </p>
16403 <hr size="1">
16404 <a name="c_002ddeclare"></a>
16405 <table cellpadding="1" cellspacing="1" border="0">
16406 <tr><td valign="middle" align="left"><a href="#mapping-of-types" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.1 The mapping of types between C and Scheme" align="middle" width="32"></a></td>
16407 <td valign="middle" align="left"><a href="#c_002dinitialize" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.3 The c-initialize special form" align="middle" width="32"></a></td>
16408 <td valign="middle" align="left"> &nbsp; </td>
16409 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
16410 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
16411 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
16412 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
16413 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
16414 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
16415 </tr></table>
16416 <a name="The-c_002ddeclare-special-form"></a>
16417 <h2 class="section">19.2 The <code>c-declare</code> special form</h2>
16418 <a name="index-c_002ddeclare"></a>
16420 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
16422 <p>Initially, the C file produced by <code>gsc</code> contains only an
16423 <samp>#include</samp> of <samp>gambit.h</samp>. This header file provides a
16424 number of macro and procedure declarations to access the Scheme object
16425 representation. The special form <code>c-declare</code> adds
16426 <i>c-declaration</i> (which must be a string containing the C
16427 declarations) to the C file. This string is copied to the C file on a
16428 new line so it can start with preprocessor directives. All types of C
16429 declarations are allowed (including type declarations, variable
16430 declarations, function declarations, <samp>#include</samp> directives,
16431 <samp>#define</samp>s, and so on). These declarations are visible to
16432 subsequent <code>c-declare</code>s, <code>c-initialize</code>s, and
16433 <code>c-lambda</code>s, and <code>c-define</code>s in the same module. The most
16434 common use of this special form is to declare the external functions
16435 that are referenced in <code>c-lambda</code> special forms. Such functions
16436 must either be declared explicitly or by including a header file which
16437 contains the appropriate C declarations.
16438 </p>
16439 <p>The <code>c-declare</code> special form does not return a value.
16440 It can only appear at top level.
16441 </p>
16442 <p>For example:
16443 </p>
16444 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-declare #&lt;&lt;c-declare-end
16446 #include &lt;stdio.h&gt;
16448 extern char *getlogin ();
16450 #ifdef sparc
16451 char *host = &quot;sparc&quot;;
16452 #else
16453 char *host = &quot;unknown&quot;;
16454 #endif
16456 FILE *tfile;
16458 c-declare-end
16460 </pre></td></tr></table>
16464 <hr size="1">
16465 <a name="c_002dinitialize"></a>
16466 <table cellpadding="1" cellspacing="1" border="0">
16467 <tr><td valign="middle" align="left"><a href="#c_002ddeclare" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.2 The c-declare special form" align="middle" width="32"></a></td>
16468 <td valign="middle" align="left"><a href="#c_002dlambda" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.4 The c-lambda special form" align="middle" width="32"></a></td>
16469 <td valign="middle" align="left"> &nbsp; </td>
16470 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
16471 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
16472 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
16473 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
16474 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
16475 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
16476 </tr></table>
16477 <a name="The-c_002dinitialize-special-form"></a>
16478 <h2 class="section">19.3 The <code>c-initialize</code> special form</h2>
16479 <a name="index-c_002dinitialize"></a>
16481 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
16483 <p>Just after the program is loaded and before control is passed to the
16484 Scheme code, each C file is initialized by calling its associated
16485 initialization function. The body of this function is normally empty
16486 but it can be extended by using the <code>c-initialize</code> form. Each
16487 occurence of the <code>c-initialize</code> form adds code to the body of the
16488 initialization function in the order of appearance in the source file.
16489 <i>c-code</i> must be a string containing the C code to execute. This
16490 string is copied to the C file on a new line so it can start with
16491 preprocessor directives.
16492 </p>
16493 <p>The <code>c-initialize</code> special form does not return a value.
16494 It can only appear at top level.
16495 </p>
16496 <p>For example:
16497 </p>
16498 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-initialize &quot;tfile = tmpfile ();&quot;)
16499 </pre></td></tr></table>
16503 <hr size="1">
16504 <a name="c_002dlambda"></a>
16505 <table cellpadding="1" cellspacing="1" border="0">
16506 <tr><td valign="middle" align="left"><a href="#c_002dinitialize" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.3 The c-initialize special form" align="middle" width="32"></a></td>
16507 <td valign="middle" align="left"><a href="#c_002ddefine" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.5 The c-define special form" align="middle" width="32"></a></td>
16508 <td valign="middle" align="left"> &nbsp; </td>
16509 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
16510 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
16511 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
16512 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
16513 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
16514 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
16515 </tr></table>
16516 <a name="The-c_002dlambda-special-form"></a>
16517 <h2 class="section">19.4 The <code>c-lambda</code> special form</h2>
16518 <a name="index-c_002dlambda"></a>
16520 <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="http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Special_form_c-lambda">c-lambda</a></b></code><i> (<span class="roman"><i>type1</i></span>&hellip;) <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>
16522 <p>The <code>c-lambda</code> special form makes it possible to create a Scheme
16523 procedure that will act as a representative of some C function or C code
16524 sequence. The first subform is a list containing the type of each
16525 argument. The type of the function&rsquo;s result is given next. Finally,
16526 the last subform is a string that either contains the name of the C
16527 function to call or some sequence of C code to execute. Variadic C
16528 functions are not supported. The resulting Scheme procedure takes
16529 exactly the number of arguments specified and delivers them in the same
16530 order to the C function. When the Scheme procedure is called, the
16531 arguments will be converted to their C representation and then the C
16532 function will be called. The result returned by the C function will be
16533 converted to its Scheme representation and this value will be returned
16534 from the Scheme procedure call. An error will be signaled if some
16535 conversion is not possible. The temporary memory allocated from the C
16536 heap for the conversion of the arguments and result will be reclaimed
16537 whether there is an error or not.
16538 </p>
16539 <p>When <i>c-name-or-code</i> is not a valid C identifier, it is treated
16540 as an arbitrary piece of C code. Within the C code the variables
16541 <samp>___arg1</samp>, <samp>___arg2</samp>, etc. can be referenced to access the
16542 converted arguments. Similarly, the result to be returned from the
16543 call should be assigned to the variable <samp>___result</samp> except when
16544 the result is of type <code>struct</code>, <code>union</code>, <code>type</code>,
16545 <code>pointer</code>, <code>nonnull-pointer</code>, <code>function</code> or
16546 <code>nonnull-function</code> in which case a pointer must be assigned to
16547 the variable <samp>___result_voidstar</samp> which is of type <samp>void*</samp>.
16548 For results of type <code>pointer</code>, <code>nonnull-pointer</code>,
16549 <code>function</code> and <code>nonnull-function</code>, the value assigned to the
16550 variable <samp>___result_voidstar</samp> must be the pointer or function
16551 cast to <samp>void*</samp>. For results of type <code>struct</code>,
16552 <code>union</code>, and <code>type</code>, the value assigned to the variable
16553 <samp>___result_voidstar</samp> must be a pointer to a memory allocated
16554 block containing a copy of the result. Note that this block will be
16555 reclaimed by the <var>release-function</var> associated with the type.
16556 If no result needs to be returned, the <i>result-type</i> should be
16557 <code>void</code> and no assignment to the variable <samp>___result</samp> or
16558 <samp>___result_voidstar</samp> should take place. Note that the C code
16559 should not contain <code>return</code> statements as this is meaningless.
16560 Control must always fall off the end of the C code. The C code is
16561 copied to the C file on a new line so it can start with preprocessor
16562 directives. Moreover the C code is always placed at the head of a
16563 compound statement whose lifetime encloses the C to Scheme conversion of
16564 the result. Consequently, temporary storage (strings in particular)
16565 declared at the head of the C code can be returned by assigning them to
16566 <samp>___result</samp> or <samp>___result_voidstar</samp>. In the
16567 <i>c-name-or-code</i>, the macro <samp>___AT_END</samp> may be defined as the
16568 piece of C code to execute before control is returned to Scheme but
16569 after the result is converted to its Scheme representation. This is
16570 mainly useful to deallocate temporary storage contained in the result.
16571 </p>
16572 <p>When passed to the Scheme environment, the C <code>void</code> type is
16573 converted to the void object.
16574 </p>
16575 <p>For example:
16576 </p>
16577 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(define fopen
16578 (c-lambda (nonnull-char-string nonnull-char-string)
16579 (pointer &quot;FILE&quot;)
16580 &quot;fopen&quot;))
16582 (define fgetc
16583 (c-lambda ((pointer &quot;FILE&quot;))
16585 &quot;fgetc&quot;))
16587 (let ((f (fopen &quot;datafile&quot; &quot;r&quot;)))
16588 (if f (write (fgetc f))))
16590 (define char-code
16591 (c-lambda (char) int &quot;___result = ___arg1;&quot;))
16593 (define host
16594 ((c-lambda () nonnull-char-string &quot;___result = host;&quot;)))
16596 (define stdin
16597 ((c-lambda () (pointer &quot;FILE&quot;) &quot;___result_voidstar = stdin;&quot;)))
16599 ((c-lambda () void
16600 #&lt;&lt;c-lambda-end
16601 printf( &quot;hello\n&quot; );
16602 printf( &quot;world\n&quot; );
16603 c-lambda-end
16606 (define pack-1-char
16607 (c-lambda (char)
16608 nonnull-char-string
16609 #&lt;&lt;c-lambda-end
16610 ___result = malloc (2);
16611 if (___result != NULL) { ___result[0] = ___arg1; ___result[1] = 0; }
16612 #define ___AT_END if (___result != NULL) free (___result);
16613 c-lambda-end
16616 (define pack-2-chars
16617 (c-lambda (char char)
16618 nonnull-char-string
16619 #&lt;&lt;c-lambda-end
16620 char s[3];
16621 s[0] = ___arg1;
16622 s[1] = ___arg2;
16623 s[2] = 0;
16624 ___result = s;
16625 c-lambda-end
16627 </pre></td></tr></table>
16631 <hr size="1">
16632 <a name="c_002ddefine"></a>
16633 <table cellpadding="1" cellspacing="1" border="0">
16634 <tr><td valign="middle" align="left"><a href="#c_002dlambda" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.4 The c-lambda special form" align="middle" width="32"></a></td>
16635 <td valign="middle" align="left"><a href="#c_002ddefine_002dtype" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.6 The c-define-type special form" align="middle" width="32"></a></td>
16636 <td valign="middle" align="left"> &nbsp; </td>
16637 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
16638 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
16639 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
16640 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
16641 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
16642 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
16643 </tr></table>
16644 <a name="The-c_002ddefine-special-form"></a>
16645 <h2 class="section">19.5 The <code>c-define</code> special form</h2>
16646 <a name="index-c_002ddefine"></a>
16648 <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="http://dynamo.iro.umontreal.ca/~gambit/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>&hellip;) <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>
16650 <p>The <code>c-define</code> special form makes it possible to create a C
16651 function that will act as a representative of some Scheme procedure. A
16652 C function named <i>c-name</i> as well as a Scheme procedure bound to the
16653 variable <i>variable</i> are defined. The parameters of the Scheme
16654 procedure are <i>define-formals</i> and its body is at the end of the
16655 form. The type of each argument of the C function, its result type and
16656 <i>c-name</i> (which must be a string) are specified after the parameter
16657 specification of the Scheme procedure. When the C function <i>c-name</i>
16658 is called from C, its arguments are converted to their Scheme
16659 representation and passed to the Scheme procedure. The result of the
16660 Scheme procedure is then converted to its C representation and the C
16661 function <i>c-name</i> returns it to its caller.
16662 </p>
16663 <p>The scope of the C function can be changed with the <i>scope</i>
16664 parameter, which must be a string. This string is placed immediately
16665 before the declaration of the C function. So if <i>scope</i> is the
16666 string <code>&quot;static&quot;</code>, the scope of <i>c-name</i> is local to the module
16667 it is in, whereas if <i>scope</i> is the empty string, <i>c-name</i> is
16668 visible from other modules.
16669 </p>
16670 <p>The <code>c-define</code> special form does not return a value.
16671 It can only appear at top level.
16672 </p>
16673 <p>For example:
16674 </p>
16675 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-define (proc x #!optional (y x) #!rest z) (int int char float) int &quot;f&quot; &quot;&quot;
16676 (write (cons x (cons y z)))
16677 (newline)
16678 (+ x y))
16680 (proc 1 2 #\x 1.5) =&gt; 3 and prints (1 2 #\x 1.5)
16681 (proc 1) =&gt; 2 and prints (1 1)
16683 ; if f is called from C with the call f (1, 2, 'x', 1.5)
16684 ; the value 3 is returned and (1 2 #\x 1.5) is printed.
16685 ; f has to be called with 4 arguments.
16686 </pre></td></tr></table>
16688 <a name="index-_005f_005f_005fsetup"></a>
16689 <a name="index-_005f_005f_005fcleanup"></a>
16690 <p>The <code>c-define</code> special form is particularly useful when the
16691 driving part of an application is written in C and Scheme procedures
16692 are called directly from C. The Scheme part of the application is in
16693 a sense a &ldquo;server&rdquo; that is providing services to the C part. The
16694 Scheme procedures that are to be called from C need to be defined
16695 using the <code>c-define</code> special form. Before it can be used, the
16696 Scheme part must be initialized with a call to the function
16697 <samp>___setup</samp>. Before the program terminates, it must call the
16698 function <samp>___cleanup</samp> so that the Scheme part may do final
16699 cleanup. A sample application is given in the file
16700 <samp>tests/server.scm</samp>.
16701 </p>
16704 <hr size="1">
16705 <a name="c_002ddefine_002dtype"></a>
16706 <table cellpadding="1" cellspacing="1" border="0">
16707 <tr><td valign="middle" align="left"><a href="#c_002ddefine" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.5 The c-define special form" align="middle" width="32"></a></td>
16708 <td valign="middle" align="left"><a href="#continuations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 19.7 Continuations and the C-interface" align="middle" width="32"></a></td>
16709 <td valign="middle" align="left"> &nbsp; </td>
16710 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
16711 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
16712 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
16713 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
16714 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
16715 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
16716 </tr></table>
16717 <a name="The-c_002ddefine_002dtype-special-form"></a>
16718 <h2 class="section">19.6 The <code>c-define-type</code> special form</h2>
16719 <a name="index-c_002ddefine_002dtype"></a>
16721 <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="http://dynamo.iro.umontreal.ca/~gambit/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>
16723 <p>This form associates the type identifier <i>name</i> to the C type
16724 <i>type</i>. The <i>name</i> must not clash with predefined types
16725 (e.g. <code>char-string</code>, <code>ISO-8859-1</code>, etc.) or with types previously
16726 defined with <code>c-define-type</code> in the same file. The
16727 <code>c-define-type</code> special form does not return a value. It can only
16728 appear at top level.
16729 </p>
16730 <p>If only the two parameters <i>name</i> and <i>type</i> are supplied then
16731 after this definition, the use of <i>name</i> in a type specification is
16732 synonymous to <i>type</i>.
16733 </p>
16734 <p>For example:
16735 </p>
16736 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-define-type FILE &quot;FILE&quot;)
16737 (c-define-type FILE* (pointer FILE))
16738 (c-define-type time-struct-ptr (pointer (struct &quot;tms&quot;)))
16739 (define fopen (c-lambda (char-string char-string) FILE* &quot;fopen&quot;))
16740 (define fgetc (c-lambda (FILE*) int &quot;fgetc&quot;))
16741 </pre></td></tr></table>
16743 <p>Note that identifiers are not case-sensitive in standard Scheme but it
16744 is good programming practice to use a <i>name</i> with the same case as
16745 in C.
16746 </p>
16747 <p>If four or more parameters are supplied, then <i>type</i> must be a
16748 string naming the C type, <i>c-to-scheme</i> and <i>scheme-to-c</i> must
16749 be strings suffixing the C macros that convert data of that type between
16750 C and Scheme. If <i>cleanup</i> is supplied it must be a boolean
16751 indicating whether it is necessary to perform a cleanup operation (such
16752 as freeing memory) when data of that type is converted from Scheme to C
16753 (it defaults to <code>#t</code>). The cleanup information is used when the C
16754 stack is unwound due to a continuation invocation (see
16755 <a href="#continuations">Continuations and the C-interface</a>). Although it is safe to always specify <code>#t</code>,
16756 it is more efficient in time and space to specify <code>#f</code> because the
16757 unwinding mechanism can skip C-interface frames which only contain
16758 conversions of data types requiring no cleanup. Two pairs of C macros
16759 need to be defined for conversions performed by <code>c-lambda</code> forms
16760 and two pairs for conversions performed by <code>c-define</code> forms:
16761 </p>
16762 <table><tr><td>&nbsp;</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)
16763 ___END_CFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>, int)
16765 ___BEGIN_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ)
16766 ___END_CFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ)
16768 ___BEGIN_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int)
16769 ___END_SFUN_<span class="roman"><i>c-to-scheme</i></span>(<span class="roman"><i>type</i></span>, ___SCMOBJ, int)
16771 ___BEGIN_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>)
16772 ___END_SFUN_<span class="roman"><i>scheme-to-c</i></span>(___SCMOBJ, <span class="roman"><i>type</i></span>)
16773 </pre></td></tr></table>
16775 <p>The macros prefixed with <code>___BEGIN</code> perform the conversion and
16776 those prefixed with <code>___END</code> perform any cleanup necessary (such as
16777 freeing memory temporarily allocated for the conversion). The macro
16778 <code>___END_CFUN_<span class="roman"><i>scheme-to-c</i></span></code> must free the result of the
16779 conversion if it is memory allocated, and
16780 <code>___END_SFUN_<span class="roman"><i>scheme-to-c</i></span></code> must not (i.e. it is the
16781 responsibility of the caller to free the result).
16782 </p>
16783 <p>The first parameter of these macros is the C variable that contains the
16784 value to be converted, and the second parameter is the C variable in
16785 which to store the converted value. The third parameter, when present,
16786 is the index (starting at 1) of the parameter of the <code>c-lambda</code> or
16787 <code>c-define</code> form that is being converted (this is useful for
16788 reporting precise error information when a conversion is impossible).
16789 </p>
16790 <p>To allow for type checking, the first three <code>___BEGIN</code> macros must
16791 expand to an unterminated compound statement prefixed by an <code>if</code>,
16792 conditional on the absence of type check error:
16793 </p>
16794 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>if ((___err = <var>conversion_operation</var>) == ___FIX(___NO_ERR)) {
16795 </pre></td></tr></table>
16797 <p>The last <code>___BEGIN</code> macro must expand to an unterminated compound
16798 statement:
16799 </p>
16800 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>{ ___err = <var>conversion_operation</var>;
16801 </pre></td></tr></table>
16803 <p>If type check errors are impossible then a <code>___BEGIN</code> macro can
16804 simply expand to an unterminated compound statement performing the
16805 conversion:
16806 </p>
16807 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>{ <var>conversion_operation</var>;
16808 </pre></td></tr></table>
16810 <p>The <code>___END</code> macros must expand to a statement, or to nothing if no
16811 cleanup is required, followed by a closing brace (to terminate the
16812 compound statement started at the corresponding <code>___BEGIN</code> macro).
16813 </p>
16814 <p>The <var>conversion_operation</var> is typically a function call that returns
16815 an error code value of type <code>___SCMOBJ</code> (the error codes are defined in
16816 <samp>gambit.h</samp>, and the error code <code>___FIX(___UNKNOWN_ERR)</code> is available
16817 for generic errors). <var>conversion_operation</var> can also set the
16818 variable <code>___errmsg</code> of type <code>___SCMOBJ</code> to a specific Scheme
16819 string error message.
16820 </p>
16821 <p>Below is a simple example showing how to interface to an <samp>EBCDIC</samp>
16822 character type. Memory allocation is not needed for conversion and type
16823 check errors are impossible when converting EBCDIC to Scheme characters,
16824 but they are possible when converting from Scheme characters to EBCDIC
16825 since Gambit supports Unicode characters.
16826 </p>
16827 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-declare #&lt;&lt;c-declare-end
16829 typedef char EBCDIC; /* EBCDIC encoded characters */
16831 void put_char (EBCDIC c) { ... } /* EBCDIC I/O functions */
16832 EBCDIC get_char (void) { ... }
16834 char EBCDIC_to_ISO_8859_1[256] = { ... }; /* conversion tables */
16835 char ISO_8859_1_to_EBCDIC[256] = { ... };
16837 ___SCMOBJ SCMOBJ_to_EBCDIC (___SCMOBJ src, EBCDIC *dst)
16839 int x = ___INT(src); /* convert from Scheme character to int */
16840 if (x &gt; 255) return ___FIX(___UNKNOWN_ERR);
16841 *dst = ISO_8859_1_to_EBCDIC[x];
16842 return ___FIX(___NO_ERR);
16845 #define ___BEGIN_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) \
16846 if ((___err = SCMOBJ_to_EBCDIC (src, &amp;dst)) == ___FIX(___NO_ERR)) {
16847 #define ___END_CFUN_SCMOBJ_to_EBCDIC(src,dst,i) }
16849 #define ___BEGIN_CFUN_EBCDIC_to_SCMOBJ(src,dst) \
16850 { dst = ___CHR(EBCDIC_to_ISO_8859_1[src]);
16851 #define ___END_CFUN_EBCDIC_to_SCMOBJ(src,dst) }
16853 #define ___BEGIN_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) \
16854 { dst = ___CHR(EBCDIC_to_ISO_8859_1[src]);
16855 #define ___END_SFUN_EBCDIC_to_SCMOBJ(src,dst,i) }
16857 #define ___BEGIN_SFUN_SCMOBJ_to_EBCDIC(src,dst) \
16858 { ___err = SCMOBJ_to_EBCDIC (src, &amp;dst);
16859 #define ___END_SFUN_SCMOBJ_to_EBCDIC(src,dst) }
16861 c-declare-end
16864 (c-define-type EBCDIC &quot;EBCDIC&quot; &quot;EBCDIC_to_SCMOBJ&quot; &quot;SCMOBJ_to_EBCDIC&quot; #f)
16866 (define put-char (c-lambda (EBCDIC) void &quot;put_char&quot;))
16867 (define get-char (c-lambda () EBCDIC &quot;get_char&quot;))
16869 (c-define (write-EBCDIC c) (EBCDIC) void &quot;write_EBCDIC&quot; &quot;&quot;
16870 (write-char c))
16872 (c-define (read-EBCDIC) () EBCDIC &quot;read_EBCDIC&quot; &quot;&quot;
16873 (read-char))
16874 </pre></td></tr></table>
16876 <p>Below is a more complex example that requires memory allocation when
16877 converting from C to Scheme. It is an interface to a 2D <samp>point</samp>
16878 type which is represented in Scheme by a pair of integers. The
16879 conversion of the <code>x</code> and <code>y</code> components is done by calls to
16880 the conversion macros for the <code>int</code> type (defined in
16881 <samp>gambit.h</samp>). Note that no cleanup is necessary when converting
16882 from Scheme to C (i.e. the last parameter of the <code>c-define-type</code> is
16883 <code>#f</code>).
16884 </p>
16885 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-declare #&lt;&lt;c-declare-end
16887 typedef struct { int x, y; } point;
16889 void line_to (point p) { ... }
16890 point get_mouse (void) { ... }
16891 point add_points (point p1, point p2) { ... }
16893 ___SCMOBJ SCMOBJ_to_POINT (___SCMOBJ src, point *dst, int arg_num)
16895 ___SCMOBJ ___err = ___FIX(___NO_ERR);
16896 if (!___PAIRP(src))
16897 ___err = ___FIX(___UNKNOWN_ERR);
16898 else
16900 ___SCMOBJ car = ___CAR(src);
16901 ___SCMOBJ cdr = ___CDR(src);
16902 ___BEGIN_CFUN_SCMOBJ_TO_INT(car,dst-&gt;x,arg_num)
16903 ___BEGIN_CFUN_SCMOBJ_TO_INT(cdr,dst-&gt;y,arg_num)
16904 ___END_CFUN_SCMOBJ_TO_INT(cdr,dst-&gt;y,arg_num)
16905 ___END_CFUN_SCMOBJ_TO_INT(car,dst-&gt;x,arg_num)
16907 return ___err;
16910 ___SCMOBJ POINT_to_SCMOBJ (point src, ___SCMOBJ *dst, int arg_num)
16912 ___SCMOBJ ___err = ___FIX(___NO_ERR);
16913 ___SCMOBJ x_scmobj;
16914 ___SCMOBJ y_scmobj;
16915 ___BEGIN_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num)
16916 ___BEGIN_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num)
16917 *dst = ___EXT(___make_pair) (x_scmobj, y_scmobj, ___STILL);
16918 if (___FIXNUMP(*dst))
16919 ___err = *dst; /* return allocation error */
16920 ___END_SFUN_INT_TO_SCMOBJ(src.y,y_scmobj,arg_num)
16921 ___END_SFUN_INT_TO_SCMOBJ(src.x,x_scmobj,arg_num)
16922 return ___err;
16925 #define ___BEGIN_CFUN_SCMOBJ_to_POINT(src,dst,i) \
16926 if ((___err = SCMOBJ_to_POINT (src, &amp;dst, i)) == ___FIX(___NO_ERR)) {
16927 #define ___END_CFUN_SCMOBJ_to_POINT(src,dst,i) }
16929 #define ___BEGIN_CFUN_POINT_to_SCMOBJ(src,dst) \
16930 if ((___err = POINT_to_SCMOBJ (src, &amp;dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) {
16931 #define ___END_CFUN_POINT_to_SCMOBJ(src,dst) \
16932 ___EXT(___release_scmobj) (dst); }
16934 #define ___BEGIN_SFUN_POINT_to_SCMOBJ(src,dst,i) \
16935 if ((___err = POINT_to_SCMOBJ (src, &amp;dst, i)) == ___FIX(___NO_ERR)) {
16936 #define ___END_SFUN_POINT_to_SCMOBJ(src,dst,i) \
16937 ___EXT(___release_scmobj) (dst); }
16939 #define ___BEGIN_SFUN_SCMOBJ_to_POINT(src,dst) \
16940 { ___err = SCMOBJ_to_POINT (src, &amp;dst, ___RETURN_POS);
16941 #define ___END_SFUN_SCMOBJ_to_POINT(src,dst) }
16943 c-declare-end
16946 (c-define-type point &quot;point&quot; &quot;POINT_to_SCMOBJ&quot; &quot;SCMOBJ_to_POINT&quot; #f)
16948 (define line-to (c-lambda (point) void &quot;line_to&quot;))
16949 (define get-mouse (c-lambda () point &quot;get_mouse&quot;))
16950 (define add-points (c-lambda (point point) point &quot;add_points&quot;))
16952 (c-define (write-point p) (point) void &quot;write_point&quot; &quot;&quot;
16953 (write p))
16955 (c-define (read-point) () point &quot;read_point&quot; &quot;&quot;
16956 (read))
16957 </pre></td></tr></table>
16959 <p>An example that requires memory allocation when converting from C to
16960 Scheme and Scheme to C is shown below. It is an interface to a
16961 &ldquo;null-terminated array of strings&rdquo; type which is represented in Scheme
16962 by a list of strings. Note that some cleanup is necessary when
16963 converting from Scheme to C.
16964 </p>
16965 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-declare #&lt;&lt;c-declare-end
16967 #include &lt;stdlib.h&gt;
16968 #include &lt;unistd.h&gt;
16970 extern char **environ;
16972 char **get_environ (void) { return environ; }
16974 void free_strings (char **strings)
16976 char **ptr = strings;
16977 while (*ptr != NULL)
16979 ___EXT(___release_string) (*ptr);
16980 ptr++;
16982 free (strings);
16985 ___SCMOBJ SCMOBJ_to_STRINGS (___SCMOBJ src, char ***dst, int arg_num)
16988 * Src is a list of Scheme strings. Dst will be a null terminated
16989 * array of C strings.
16992 int i;
16993 ___SCMOBJ lst = src;
16994 int len = 4; /* start with a small result array */
16995 char **result = (char**) malloc (len * sizeof (char*));
16997 if (result == NULL)
16998 return ___FIX(___HEAP_OVERFLOW_ERR);
17000 i = 0;
17001 result[i] = NULL; /* always keep array null terminated */
17003 while (___PAIRP(lst))
17005 ___SCMOBJ scm_str = ___CAR(lst);
17006 char *c_str;
17007 ___SCMOBJ ___err;
17009 if (i &gt;= len-1) /* need to grow the result array? */
17011 char **new_result;
17012 int j;
17014 len = len * 3 / 2;
17015 new_result = (char**) malloc (len * sizeof (char*));
17016 if (new_result == NULL)
17018 free_strings (result);
17019 return ___FIX(___HEAP_OVERFLOW_ERR);
17021 for (j=i; j&gt;=0; j--)
17022 new_result[j] = result[j];
17023 free (result);
17024 result = new_result;
17027 ___err = ___EXT(___SCMOBJ_to_CHARSTRING) (scm_str, &amp;c_str, arg_num);
17029 if (___err != ___FIX(___NO_ERR))
17031 free_strings (result);
17032 return ___err;
17035 result[i++] = c_str;
17036 result[i] = NULL;
17037 lst = ___CDR(lst);
17040 if (!___NULLP(lst))
17042 free_strings (result);
17043 return ___FIX(___UNKNOWN_ERR);
17047 * Note that the caller is responsible for calling free_strings
17048 * when it is done with the result.
17051 *dst = result;
17052 return ___FIX(___NO_ERR);
17055 ___SCMOBJ STRINGS_to_SCMOBJ (char **src, ___SCMOBJ *dst, int arg_num)
17057 ___SCMOBJ ___err = ___FIX(___NO_ERR);
17058 ___SCMOBJ result = ___NUL; /* start with the empty list */
17059 int i = 0;
17061 while (src[i] != NULL)
17062 i++;
17064 /* build the list of strings starting at the tail */
17066 while (--i &gt;= 0)
17068 ___SCMOBJ scm_str;
17069 ___SCMOBJ new_result;
17072 * Invariant: result is either the empty list or a ___STILL pair
17073 * with reference count equal to 1. This is important because
17074 * it is possible that ___CHARSTRING_to_SCMOBJ and ___make_pair
17075 * will invoke the garbage collector and we don't want the
17076 * reference in result to become invalid (which would be the
17077 * case if result was a ___MOVABLE pair or if it had a zero
17078 * reference count).
17081 ___err = ___EXT(___CHARSTRING_to_SCMOBJ) (src[i], &amp;scm_str, arg_num);
17083 if (___err != ___FIX(___NO_ERR))
17085 ___EXT(___release_scmobj) (result); /* allow GC to reclaim result */
17086 return ___FIX(___UNKNOWN_ERR);
17090 * Note that scm_str will be a ___STILL object with reference
17091 * count equal to 1, so there is no risk that it will be
17092 * reclaimed or moved if ___make_pair invokes the garbage
17093 * collector.
17096 new_result = ___EXT(___make_pair) (scm_str, result, ___STILL);
17099 * We can zero the reference count of scm_str and result (if
17100 * not the empty list) because the pair now references these
17101 * objects and the pair is reachable (it can't be reclaimed
17102 * or moved by the garbage collector).
17105 ___EXT(___release_scmobj) (scm_str);
17106 ___EXT(___release_scmobj) (result);
17108 result = new_result;
17110 if (___FIXNUMP(result))
17111 return result; /* allocation failed */
17115 * Note that result is either the empty list or a ___STILL pair
17116 * with a reference count equal to 1. There will be a call to
17117 * ___release_scmobj later on (in ___END_CFUN_STRINGS_to_SCMOBJ
17118 * or ___END_SFUN_STRINGS_to_SCMOBJ) that will allow the garbage
17119 * collector to reclaim the whole list of strings when the Scheme
17120 * world no longer references it.
17123 *dst = result;
17124 return ___FIX(___NO_ERR);
17127 #define ___BEGIN_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \
17128 if ((___err = SCMOBJ_to_STRINGS (src, &amp;dst, i)) == ___FIX(___NO_ERR)) {
17129 #define ___END_CFUN_SCMOBJ_to_STRINGS(src,dst,i) \
17130 free_strings (dst); }
17132 #define ___BEGIN_CFUN_STRINGS_to_SCMOBJ(src,dst) \
17133 if ((___err = STRINGS_to_SCMOBJ (src, &amp;dst, ___RETURN_POS)) == ___FIX(___NO_ERR)) {
17134 #define ___END_CFUN_STRINGS_to_SCMOBJ(src,dst) \
17135 ___EXT(___release_scmobj) (dst); }
17137 #define ___BEGIN_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \
17138 if ((___err = STRINGS_to_SCMOBJ (src, &amp;dst, i)) == ___FIX(___NO_ERR)) {
17139 #define ___END_SFUN_STRINGS_to_SCMOBJ(src,dst,i) \
17140 ___EXT(___release_scmobj) (dst); }
17142 #define ___BEGIN_SFUN_SCMOBJ_to_STRINGS(src,dst) \
17143 { ___err = SCMOBJ_to_STRINGS (src, &amp;dst, ___RETURN_POS);
17144 #define ___END_SFUN_SCMOBJ_to_STRINGS(src,dst) }
17146 c-declare-end
17149 (c-define-type char** &quot;char**&quot; &quot;STRINGS_to_SCMOBJ&quot; &quot;SCMOBJ_to_STRINGS&quot;)
17151 (define execv (c-lambda (char-string char**) int &quot;execv&quot;))
17152 (define get-environ (c-lambda () char** &quot;get_environ&quot;))
17154 (c-define (write-strings x) (char**) void &quot;write_strings&quot; &quot;&quot;
17155 (write x))
17157 (c-define (read-strings) () char** &quot;read_strings&quot; &quot;&quot;
17158 (read))
17159 </pre></td></tr></table>
17163 <hr size="1">
17164 <a name="continuations"></a>
17165 <table cellpadding="1" cellspacing="1" border="0">
17166 <tr><td valign="middle" align="left"><a href="#c_002ddefine_002dtype" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.6 The c-define-type special form" align="middle" width="32"></a></td>
17167 <td valign="middle" align="left"><a href="#System-limitations" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 20. System limitations" align="middle" width="32"></a></td>
17168 <td valign="middle" align="left"> &nbsp; </td>
17169 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
17170 <td valign="middle" align="left"><a href="#C_002dinterface" title="Up section"><img src="button-up.png" border="0" alt="Up: 19. C-interface" align="middle" width="32"></a></td>
17171 <td valign="middle" align="left"><a href="#System-limitations" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 20. System limitations" align="middle" width="32"></a></td>
17172 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
17173 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
17174 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
17175 </tr></table>
17176 <a name="Continuations-and-the-C_002dinterface"></a>
17177 <h2 class="section">19.7 Continuations and the C-interface</h2>
17178 <a name="index-continuations"></a>
17180 <p>The C-interface allows C to Scheme calls to be nested. This means
17181 that during a call from C to Scheme another call from C to Scheme
17182 can be performed. This case occurs in the following program:
17183 </p>
17184 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>(c-declare #&lt;&lt;c-declare-end
17186 int p (char *); /* forward declarations */
17187 int q (void);
17189 int a (char *x) { return 2 * p (x+1); }
17190 int b (short y) { return y + q (); }
17192 c-declare-end
17195 (define a (c-lambda (char-string) int &quot;a&quot;))
17196 (define b (c-lambda (short) int &quot;b&quot;))
17198 (c-define (p z) (char-string) int &quot;p&quot; &quot;&quot;
17199 (+ (b 10) (string-length z)))
17201 (c-define (q) () int &quot;q&quot; &quot;&quot;
17202 123)
17204 (write (a &quot;hello&quot;))
17205 </pre></td></tr></table>
17207 <p>In this example, the main Scheme program calls the C function <samp>a</samp>
17208 which calls the Scheme procedure <samp>p</samp> which in turn calls the C
17209 function <samp>b</samp> which finally calls the Scheme procedure <samp>q</samp>.
17210 </p>
17211 <p>Gambit-C maintains the Scheme continuation separately from the C stack,
17212 thus allowing the Scheme continuation to be unwound independently from
17213 the C stack. The C stack frame created for the C function <samp>f</samp> is
17214 only removed from the C stack when control returns from <samp>f</samp> or when
17215 control returns to a C function &ldquo;above&rdquo; <samp>f</samp>. Special care is
17216 required for programs which escape to Scheme (using first-class
17217 continuations) from a Scheme to C (to Scheme) call because the C stack
17218 frame will remain on the stack. The C stack may overflow if this
17219 happens in a loop with no intervening return to a C function. To avoid
17220 this problem make sure the C stack gets cleaned up by executing a normal
17221 return from a Scheme to C call.
17222 </p>
17223 <hr size="1">
17224 <a name="System-limitations"></a>
17225 <table cellpadding="1" cellspacing="1" border="0">
17226 <tr><td valign="middle" align="left"><a href="#continuations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 19.7 Continuations and the C-interface" align="middle" width="32"></a></td>
17227 <td valign="middle" align="left"><a href="#Copyright-and-license" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: 21. Copyright and license" align="middle" width="32"></a></td>
17228 <td valign="middle" align="left"> &nbsp; </td>
17229 <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" alt="FastBack: 19. C-interface" align="middle" width="32"></a></td>
17230 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
17231 <td valign="middle" align="left"><a href="#Copyright-and-license" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: 21. Copyright and license" align="middle" width="32"></a></td>
17232 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
17233 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
17234 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
17235 </tr></table>
17236 <a name="System-limitations-1"></a>
17237 <h1 class="chapter">20. System limitations</h1>
17238 <a name="index-limitations"></a>
17240 <ul>
17241 <li>
17242 <a name="index-floating-point-overflow"></a>
17243 <a name="index-overflow_002c-floating-point"></a>
17244 On some systems floating point overflows will cause the program to
17245 terminate with a floating point exception.
17247 </li><li>
17248 On some systems floating point operations involving <samp>+nan.0</samp>
17249 <samp>+inf.0</samp>, <samp>-inf.0</samp>, or <samp>-0.</samp> do not return the
17250 value required by the IEEE 754 floating point standard.
17252 </li><li>
17253 <a name="index-define-1"></a>
17254 <a name="index-set_0021"></a>
17255 The compiler will not properly compile files with more than one
17256 definition (with <code>define</code>) of the same procedure. Replace all
17257 but the first <code>define</code> with assignments (<code>set!</code>).
17259 </li><li>
17260 The maximum number of arguments that can be passed to a procedure by
17261 the <code>apply</code> procedure is 8192.
17263 </li></ul>
17265 <hr size="1">
17266 <a name="Copyright-and-license"></a>
17267 <table cellpadding="1" cellspacing="1" border="0">
17268 <tr><td valign="middle" align="left"><a href="#System-limitations" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 20. System limitations" align="middle" width="32"></a></td>
17269 <td valign="middle" align="left"><a href="#General-index" title="Next section in reading order"><img src="button-right.png" border="0" alt="Forward: General index" align="middle" width="32"></a></td>
17270 <td valign="middle" align="left"> &nbsp; </td>
17271 <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" alt="FastBack: 20. System limitations" align="middle" width="32"></a></td>
17272 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
17273 <td valign="middle" align="left"><a href="#General-index" title="Next chapter"><img src="button-right-right.png" border="0" alt="FastForward: General index" align="middle" width="32"></a></td>
17274 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
17275 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
17276 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
17277 </tr></table>
17278 <a name="Copyright-and-license-1"></a>
17279 <h1 class="chapter">21. Copyright and license</h1>
17281 <p>The Gambit-C system release v4.6.1 is Copyright &copy;
17282 1994-2009 by Marc Feeley, all rights reserved. The Gambit-C system
17283 release v4.6.1 is licensed under two licenses: the Apache
17284 License, Version 2.0, and the GNU LESSER GENERAL PUBLIC LICENSE,
17285 Version 2.1. You have the option to choose which of these two
17286 licenses to abide by. The licenses are copied below.
17287 </p>
17290 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b>
17291 Apache License
17292 Version 2.0, January 2004
17293 http://www.apache.org/licenses/
17295 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
17297 1. Definitions.
17299 &quot;License&quot; shall mean the terms and conditions for use, reproduction,
17300 and distribution as defined by Sections 1 through 9 of this document.
17302 &quot;Licensor&quot; shall mean the copyright owner or entity authorized by
17303 the copyright owner that is granting the License.
17305 &quot;Legal Entity&quot; shall mean the union of the acting entity and all
17306 other entities that control, are controlled by, or are under common
17307 control with that entity. For the purposes of this definition,
17308 &quot;control&quot; means (i) the power, direct or indirect, to cause the
17309 direction or management of such entity, whether by contract or
17310 otherwise, or (ii) ownership of fifty percent (50%) or more of the
17311 outstanding shares, or (iii) beneficial ownership of such entity.
17313 &quot;You&quot; (or &quot;Your&quot;) shall mean an individual or Legal Entity
17314 exercising permissions granted by this License.
17316 &quot;Source&quot; form shall mean the preferred form for making modifications,
17317 including but not limited to software source code, documentation
17318 source, and configuration files.
17320 &quot;Object&quot; form shall mean any form resulting from mechanical
17321 transformation or translation of a Source form, including but
17322 not limited to compiled object code, generated documentation,
17323 and conversions to other media types.
17325 &quot;Work&quot; shall mean the work of authorship, whether in Source or
17326 Object form, made available under the License, as indicated by a
17327 copyright notice that is included in or attached to the work
17328 (an example is provided in the Appendix below).
17330 &quot;Derivative Works&quot; shall mean any work, whether in Source or Object
17331 form, that is based on (or derived from) the Work and for which the
17332 editorial revisions, annotations, elaborations, or other modifications
17333 represent, as a whole, an original work of authorship. For the purposes
17334 of this License, Derivative Works shall not include works that remain
17335 separable from, or merely link (or bind by name) to the interfaces of,
17336 the Work and Derivative Works thereof.
17338 &quot;Contribution&quot; shall mean any work of authorship, including
17339 the original version of the Work and any modifications or additions
17340 to that Work or Derivative Works thereof, that is intentionally
17341 submitted to Licensor for inclusion in the Work by the copyright owner
17342 or by an individual or Legal Entity authorized to submit on behalf of
17343 the copyright owner. For the purposes of this definition, &quot;submitted&quot;
17344 means any form of electronic, verbal, or written communication sent
17345 to the Licensor or its representatives, including but not limited to
17346 communication on electronic mailing lists, source code control systems,
17347 and issue tracking systems that are managed by, or on behalf of, the
17348 Licensor for the purpose of discussing and improving the Work, but
17349 excluding communication that is conspicuously marked or otherwise
17350 designated in writing by the copyright owner as &quot;Not a Contribution.&quot;
17352 &quot;Contributor&quot; shall mean Licensor and any individual or Legal Entity
17353 on behalf of whom a Contribution has been received by Licensor and
17354 subsequently incorporated within the Work.
17356 2. Grant of Copyright License. Subject to the terms and conditions of
17357 this License, each Contributor hereby grants to You a perpetual,
17358 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
17359 copyright license to reproduce, prepare Derivative Works of,
17360 publicly display, publicly perform, sublicense, and distribute the
17361 Work and such Derivative Works in Source or Object form.
17363 3. Grant of Patent License. Subject to the terms and conditions of
17364 this License, each Contributor hereby grants to You a perpetual,
17365 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
17366 (except as stated in this section) patent license to make, have made,
17367 use, offer to sell, sell, import, and otherwise transfer the Work,
17368 where such license applies only to those patent claims licensable
17369 by such Contributor that are necessarily infringed by their
17370 Contribution(s) alone or by combination of their Contribution(s)
17371 with the Work to which such Contribution(s) was submitted. If You
17372 institute patent litigation against any entity (including a
17373 cross-claim or counterclaim in a lawsuit) alleging that the Work
17374 or a Contribution incorporated within the Work constitutes direct
17375 or contributory patent infringement, then any patent licenses
17376 granted to You under this License for that Work shall terminate
17377 as of the date such litigation is filed.
17379 4. Redistribution. You may reproduce and distribute copies of the
17380 Work or Derivative Works thereof in any medium, with or without
17381 modifications, and in Source or Object form, provided that You
17382 meet the following conditions:
17384 (a) You must give any other recipients of the Work or
17385 Derivative Works a copy of this License; and
17387 (b) You must cause any modified files to carry prominent notices
17388 stating that You changed the files; and
17390 (c) You must retain, in the Source form of any Derivative Works
17391 that You distribute, all copyright, patent, trademark, and
17392 attribution notices from the Source form of the Work,
17393 excluding those notices that do not pertain to any part of
17394 the Derivative Works; and
17396 (d) If the Work includes a &quot;NOTICE&quot; text file as part of its
17397 distribution, then any Derivative Works that You distribute must
17398 include a readable copy of the attribution notices contained
17399 within such NOTICE file, excluding those notices that do not
17400 pertain to any part of the Derivative Works, in at least one
17401 of the following places: within a NOTICE text file distributed
17402 as part of the Derivative Works; within the Source form or
17403 documentation, if provided along with the Derivative Works; or,
17404 within a display generated by the Derivative Works, if and
17405 wherever such third-party notices normally appear. The contents
17406 of the NOTICE file are for informational purposes only and
17407 do not modify the License. You may add Your own attribution
17408 notices within Derivative Works that You distribute, alongside
17409 or as an addendum to the NOTICE text from the Work, provided
17410 that such additional attribution notices cannot be construed
17411 as modifying the License.
17413 You may add Your own copyright statement to Your modifications and
17414 may provide additional or different license terms and conditions
17415 for use, reproduction, or distribution of Your modifications, or
17416 for any such Derivative Works as a whole, provided Your use,
17417 reproduction, and distribution of the Work otherwise complies with
17418 the conditions stated in this License.
17420 5. Submission of Contributions. Unless You explicitly state otherwise,
17421 any Contribution intentionally submitted for inclusion in the Work
17422 by You to the Licensor shall be under the terms and conditions of
17423 this License, without any additional terms or conditions.
17424 Notwithstanding the above, nothing herein shall supersede or modify
17425 the terms of any separate license agreement you may have executed
17426 with Licensor regarding such Contributions.
17428 6. Trademarks. This License does not grant permission to use the trade
17429 names, trademarks, service marks, or product names of the Licensor,
17430 except as required for reasonable and customary use in describing the
17431 origin of the Work and reproducing the content of the NOTICE file.
17433 7. Disclaimer of Warranty. Unless required by applicable law or
17434 agreed to in writing, Licensor provides the Work (and each
17435 Contributor provides its Contributions) on an &quot;AS IS&quot; BASIS,
17436 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17437 implied, including, without limitation, any warranties or conditions
17438 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
17439 PARTICULAR PURPOSE. You are solely responsible for determining the
17440 appropriateness of using or redistributing the Work and assume any
17441 risks associated with Your exercise of permissions under this License.
17443 8. Limitation of Liability. In no event and under no legal theory,
17444 whether in tort (including negligence), contract, or otherwise,
17445 unless required by applicable law (such as deliberate and grossly
17446 negligent acts) or agreed to in writing, shall any Contributor be
17447 liable to You for damages, including any direct, indirect, special,
17448 incidental, or consequential damages of any character arising as a
17449 result of this License or out of the use or inability to use the
17450 Work (including but not limited to damages for loss of goodwill,
17451 work stoppage, computer failure or malfunction, or any and all
17452 other commercial damages or losses), even if such Contributor
17453 has been advised of the possibility of such damages.
17455 9. Accepting Warranty or Additional Liability. While redistributing
17456 the Work or Derivative Works thereof, You may choose to offer,
17457 and charge a fee for, acceptance of support, warranty, indemnity,
17458 or other liability obligations and/or rights consistent with this
17459 License. However, in accepting such obligations, You may act only
17460 on Your own behalf and on Your sole responsibility, not on behalf
17461 of any other Contributor, and only if You agree to indemnify,
17462 defend, and hold each Contributor harmless for any liability
17463 incurred by, or claims asserted against, such Contributor by reason
17464 of your accepting any such warranty or additional liability.
17466 END OF TERMS AND CONDITIONS
17468 APPENDIX: How to apply the Apache License to your work.
17470 To apply the Apache License to your work, attach the following
17471 boilerplate notice, with the fields enclosed by brackets &quot;[]&quot;
17472 replaced with your own identifying information. (Don't include
17473 the brackets!) The text should be enclosed in the appropriate
17474 comment syntax for the file format. We also recommend that a
17475 file or class name and description of purpose be included on the
17476 same &quot;printed page&quot; as the copyright notice for easier
17477 identification within third-party archives.
17479 Copyright [yyyy] [name of copyright owner]
17481 Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
17482 you may not use this file except in compliance with the License.
17483 You may obtain a copy of the License at
17485 http://www.apache.org/licenses/LICENSE-2.0
17487 Unless required by applicable law or agreed to in writing, software
17488 distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
17489 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17490 See the License for the specific language governing permissions and
17491 limitations under the License.
17492 </pre></td></tr></table>
17496 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE
17497 Version 2.1, February 1999
17499 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
17500 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17501 Everyone is permitted to copy and distribute verbatim copies
17502 of this license document, but changing it is not allowed.
17504 [This is the first released version of the Lesser GPL. It also counts
17505 as the successor of the GNU Library Public License, version 2, hence
17506 the version number 2.1.]
17508 Preamble
17510 The licenses for most software are designed to take away your
17511 freedom to share and change it. By contrast, the GNU General Public
17512 Licenses are intended to guarantee your freedom to share and change
17513 free software--to make sure the software is free for all its users.
17515 This license, the Lesser General Public License, applies to some
17516 specially designated software packages--typically libraries--of the
17517 Free Software Foundation and other authors who decide to use it. You
17518 can use it too, but we suggest you first think carefully about whether
17519 this license or the ordinary General Public License is the better
17520 strategy to use in any particular case, based on the explanations below.
17522 When we speak of free software, we are referring to freedom of use,
17523 not price. Our General Public Licenses are designed to make sure that
17524 you have the freedom to distribute copies of free software (and charge
17525 for this service if you wish); that you receive source code or can get
17526 it if you want it; that you can change the software and use pieces of
17527 it in new free programs; and that you are informed that you can do
17528 these things.
17530 To protect your rights, we need to make restrictions that forbid
17531 distributors to deny you these rights or to ask you to surrender these
17532 rights. These restrictions translate to certain responsibilities for
17533 you if you distribute copies of the library or if you modify it.
17535 For example, if you distribute copies of the library, whether gratis
17536 or for a fee, you must give the recipients all the rights that we gave
17537 you. You must make sure that they, too, receive or can get the source
17538 code. If you link other code with the library, you must provide
17539 complete object files to the recipients, so that they can relink them
17540 with the library after making changes to the library and recompiling
17541 it. And you must show them these terms so they know their rights.
17543 We protect your rights with a two-step method: (1) we copyright the
17544 library, and (2) we offer you this license, which gives you legal
17545 permission to copy, distribute and/or modify the library.
17547 To protect each distributor, we want to make it very clear that
17548 there is no warranty for the free library. Also, if the library is
17549 modified by someone else and passed on, the recipients should know
17550 that what they have is not the original version, so that the original
17551 author's reputation will not be affected by problems that might be
17552 introduced by others.
17553 </pre></td></tr></table>
17557 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> Finally, software patents pose a constant threat to the existence of
17558 any free program. We wish to make sure that a company cannot
17559 effectively restrict the users of a free program by obtaining a
17560 restrictive license from a patent holder. Therefore, we insist that
17561 any patent license obtained for a version of the library must be
17562 consistent with the full freedom of use specified in this license.
17564 Most GNU software, including some libraries, is covered by the
17565 ordinary GNU General Public License. This license, the GNU Lesser
17566 General Public License, applies to certain designated libraries, and
17567 is quite different from the ordinary General Public License. We use
17568 this license for certain libraries in order to permit linking those
17569 libraries into non-free programs.
17571 When a program is linked with a library, whether statically or using
17572 a shared library, the combination of the two is legally speaking a
17573 combined work, a derivative of the original library. The ordinary
17574 General Public License therefore permits such linking only if the
17575 entire combination fits its criteria of freedom. The Lesser General
17576 Public License permits more lax criteria for linking other code with
17577 the library.
17579 We call this license the &quot;Lesser&quot; General Public License because it
17580 does Less to protect the user's freedom than the ordinary General
17581 Public License. It also provides other free software developers Less
17582 of an advantage over competing non-free programs. These disadvantages
17583 are the reason we use the ordinary General Public License for many
17584 libraries. However, the Lesser license provides advantages in certain
17585 special circumstances.
17587 For example, on rare occasions, there may be a special need to
17588 encourage the widest possible use of a certain library, so that it becomes
17589 a de-facto standard. To achieve this, non-free programs must be
17590 allowed to use the library. A more frequent case is that a free
17591 library does the same job as widely used non-free libraries. In this
17592 case, there is little to gain by limiting the free library to free
17593 software only, so we use the Lesser General Public License.
17595 In other cases, permission to use a particular library in non-free
17596 programs enables a greater number of people to use a large body of
17597 free software. For example, permission to use the GNU C Library in
17598 non-free programs enables many more people to use the whole GNU
17599 operating system, as well as its variant, the GNU/Linux operating
17600 system.
17602 Although the Lesser General Public License is Less protective of the
17603 users' freedom, it does ensure that the user of a program that is
17604 linked with the Library has the freedom and the wherewithal to run
17605 that program using a modified version of the Library.
17607 The precise terms and conditions for copying, distribution and
17608 modification follow. Pay close attention to the difference between a
17609 &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The
17610 former contains code derived from the library, whereas the latter must
17611 be combined with the library in order to run.
17612 </pre></td></tr></table>
17616 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> GNU LESSER GENERAL PUBLIC LICENSE
17617 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
17619 0. This License Agreement applies to any software library or other
17620 program which contains a notice placed by the copyright holder or
17621 other authorized party saying it may be distributed under the terms of
17622 this Lesser General Public License (also called &quot;this License&quot;).
17623 Each licensee is addressed as &quot;you&quot;.
17625 A &quot;library&quot; means a collection of software functions and/or data
17626 prepared so as to be conveniently linked with application programs
17627 (which use some of those functions and data) to form executables.
17629 The &quot;Library&quot;, below, refers to any such software library or work
17630 which has been distributed under these terms. A &quot;work based on the
17631 Library&quot; means either the Library or any derivative work under
17632 copyright law: that is to say, a work containing the Library or a
17633 portion of it, either verbatim or with modifications and/or translated
17634 straightforwardly into another language. (Hereinafter, translation is
17635 included without limitation in the term &quot;modification&quot;.)
17637 &quot;Source code&quot; for a work means the preferred form of the work for
17638 making modifications to it. For a library, complete source code means
17639 all the source code for all modules it contains, plus any associated
17640 interface definition files, plus the scripts used to control compilation
17641 and installation of the library.
17643 Activities other than copying, distribution and modification are not
17644 covered by this License; they are outside its scope. The act of
17645 running a program using the Library is not restricted, and output from
17646 such a program is covered only if its contents constitute a work based
17647 on the Library (independent of the use of the Library in a tool for
17648 writing it). Whether that is true depends on what the Library does
17649 and what the program that uses the Library does.
17651 1. You may copy and distribute verbatim copies of the Library's
17652 complete source code as you receive it, in any medium, provided that
17653 you conspicuously and appropriately publish on each copy an
17654 appropriate copyright notice and disclaimer of warranty; keep intact
17655 all the notices that refer to this License and to the absence of any
17656 warranty; and distribute a copy of this License along with the
17657 Library.
17659 You may charge a fee for the physical act of transferring a copy,
17660 and you may at your option offer warranty protection in exchange for a
17661 fee.
17662 </pre></td></tr></table>
17666 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> 2. You may modify your copy or copies of the Library or any portion
17667 of it, thus forming a work based on the Library, and copy and
17668 distribute such modifications or work under the terms of Section 1
17669 above, provided that you also meet all of these conditions:
17671 a) The modified work must itself be a software library.
17673 b) You must cause the files modified to carry prominent notices
17674 stating that you changed the files and the date of any change.
17676 c) You must cause the whole of the work to be licensed at no
17677 charge to all third parties under the terms of this License.
17679 d) If a facility in the modified Library refers to a function or a
17680 table of data to be supplied by an application program that uses
17681 the facility, other than as an argument passed when the facility
17682 is invoked, then you must make a good faith effort to ensure that,
17683 in the event an application does not supply such function or
17684 table, the facility still operates, and performs whatever part of
17685 its purpose remains meaningful.
17687 (For example, a function in a library to compute square roots has
17688 a purpose that is entirely well-defined independent of the
17689 application. Therefore, Subsection 2d requires that any
17690 application-supplied function or table used by this function must
17691 be optional: if the application does not supply it, the square
17692 root function must still compute square roots.)
17694 These requirements apply to the modified work as a whole. If
17695 identifiable sections of that work are not derived from the Library,
17696 and can be reasonably considered independent and separate works in
17697 themselves, then this License, and its terms, do not apply to those
17698 sections when you distribute them as separate works. But when you
17699 distribute the same sections as part of a whole which is a work based
17700 on the Library, the distribution of the whole must be on the terms of
17701 this License, whose permissions for other licensees extend to the
17702 entire whole, and thus to each and every part regardless of who wrote
17705 Thus, it is not the intent of this section to claim rights or contest
17706 your rights to work written entirely by you; rather, the intent is to
17707 exercise the right to control the distribution of derivative or
17708 collective works based on the Library.
17710 In addition, mere aggregation of another work not based on the Library
17711 with the Library (or with a work based on the Library) on a volume of
17712 a storage or distribution medium does not bring the other work under
17713 the scope of this License.
17715 3. You may opt to apply the terms of the ordinary GNU General Public
17716 License instead of this License to a given copy of the Library. To do
17717 this, you must alter all the notices that refer to this License, so
17718 that they refer to the ordinary GNU General Public License, version 2,
17719 instead of to this License. (If a newer version than version 2 of the
17720 ordinary GNU General Public License has appeared, then you can specify
17721 that version instead if you wish.) Do not make any other change in
17722 these notices.
17723 </pre></td></tr></table>
17727 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> Once this change is made in a given copy, it is irreversible for
17728 that copy, so the ordinary GNU General Public License applies to all
17729 subsequent copies and derivative works made from that copy.
17731 This option is useful when you wish to copy part of the code of
17732 the Library into a program that is not a library.
17734 4. You may copy and distribute the Library (or a portion or
17735 derivative of it, under Section 2) in object code or executable form
17736 under the terms of Sections 1 and 2 above provided that you accompany
17737 it with the complete corresponding machine-readable source code, which
17738 must be distributed under the terms of Sections 1 and 2 above on a
17739 medium customarily used for software interchange.
17741 If distribution of object code is made by offering access to copy
17742 from a designated place, then offering equivalent access to copy the
17743 source code from the same place satisfies the requirement to
17744 distribute the source code, even though third parties are not
17745 compelled to copy the source along with the object code.
17747 5. A program that contains no derivative of any portion of the
17748 Library, but is designed to work with the Library by being compiled or
17749 linked with it, is called a &quot;work that uses the Library&quot;. Such a
17750 work, in isolation, is not a derivative work of the Library, and
17751 therefore falls outside the scope of this License.
17753 However, linking a &quot;work that uses the Library&quot; with the Library
17754 creates an executable that is a derivative of the Library (because it
17755 contains portions of the Library), rather than a &quot;work that uses the
17756 library&quot;. The executable is therefore covered by this License.
17757 Section 6 states terms for distribution of such executables.
17759 When a &quot;work that uses the Library&quot; uses material from a header file
17760 that is part of the Library, the object code for the work may be a
17761 derivative work of the Library even though the source code is not.
17762 Whether this is true is especially significant if the work can be
17763 linked without the Library, or if the work is itself a library. The
17764 threshold for this to be true is not precisely defined by law.
17766 If such an object file uses only numerical parameters, data
17767 structure layouts and accessors, and small macros and small inline
17768 functions (ten lines or less in length), then the use of the object
17769 file is unrestricted, regardless of whether it is legally a derivative
17770 work. (Executables containing this object code plus portions of the
17771 Library will still fall under Section 6.)
17773 Otherwise, if the work is a derivative of the Library, you may
17774 distribute the object code for the work under the terms of Section 6.
17775 Any executables containing that work also fall under Section 6,
17776 whether or not they are linked directly with the Library itself.
17777 </pre></td></tr></table>
17781 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> 6. As an exception to the Sections above, you may also combine or
17782 link a &quot;work that uses the Library&quot; with the Library to produce a
17783 work containing portions of the Library, and distribute that work
17784 under terms of your choice, provided that the terms permit
17785 modification of the work for the customer's own use and reverse
17786 engineering for debugging such modifications.
17788 You must give prominent notice with each copy of the work that the
17789 Library is used in it and that the Library and its use are covered by
17790 this License. You must supply a copy of this License. If the work
17791 during execution displays copyright notices, you must include the
17792 copyright notice for the Library among them, as well as a reference
17793 directing the user to the copy of this License. Also, you must do one
17794 of these things:
17796 a) Accompany the work with the complete corresponding
17797 machine-readable source code for the Library including whatever
17798 changes were used in the work (which must be distributed under
17799 Sections 1 and 2 above); and, if the work is an executable linked
17800 with the Library, with the complete machine-readable &quot;work that
17801 uses the Library&quot;, as object code and/or source code, so that the
17802 user can modify the Library and then relink to produce a modified
17803 executable containing the modified Library. (It is understood
17804 that the user who changes the contents of definitions files in the
17805 Library will not necessarily be able to recompile the application
17806 to use the modified definitions.)
17808 b) Use a suitable shared library mechanism for linking with the
17809 Library. A suitable mechanism is one that (1) uses at run time a
17810 copy of the library already present on the user's computer system,
17811 rather than copying library functions into the executable, and (2)
17812 will operate properly with a modified version of the library, if
17813 the user installs one, as long as the modified version is
17814 interface-compatible with the version that the work was made with.
17816 c) Accompany the work with a written offer, valid for at
17817 least three years, to give the same user the materials
17818 specified in Subsection 6a, above, for a charge no more
17819 than the cost of performing this distribution.
17821 d) If distribution of the work is made by offering access to copy
17822 from a designated place, offer equivalent access to copy the above
17823 specified materials from the same place.
17825 e) Verify that the user has already received a copy of these
17826 materials or that you have already sent this user a copy.
17828 For an executable, the required form of the &quot;work that uses the
17829 Library&quot; must include any data and utility programs needed for
17830 reproducing the executable from it. However, as a special exception,
17831 the materials to be distributed need not include anything that is
17832 normally distributed (in either source or binary form) with the major
17833 components (compiler, kernel, and so on) of the operating system on
17834 which the executable runs, unless that component itself accompanies
17835 the executable.
17837 It may happen that this requirement contradicts the license
17838 restrictions of other proprietary libraries that do not normally
17839 accompany the operating system. Such a contradiction means you cannot
17840 use both them and the Library together in an executable that you
17841 distribute.
17843 7. You may place library facilities that are a work based on the
17844 Library side-by-side in a single library together with other library
17845 facilities not covered by this License, and distribute such a combined
17846 library, provided that the separate distribution of the work based on
17847 the Library and of the other library facilities is otherwise
17848 permitted, and provided that you do these two things:
17850 a) Accompany the combined library with a copy of the same work
17851 based on the Library, uncombined with any other library
17852 facilities. This must be distributed under the terms of the
17853 Sections above.
17855 b) Give prominent notice with the combined library of the fact
17856 that part of it is a work based on the Library, and explaining
17857 where to find the accompanying uncombined form of the same work.
17859 8. You may not copy, modify, sublicense, link with, or distribute
17860 the Library except as expressly provided under this License. Any
17861 attempt otherwise to copy, modify, sublicense, link with, or
17862 distribute the Library is void, and will automatically terminate your
17863 rights under this License. However, parties who have received copies,
17864 or rights, from you under this License will not have their licenses
17865 terminated so long as such parties remain in full compliance.
17867 9. You are not required to accept this License, since you have not
17868 signed it. However, nothing else grants you permission to modify or
17869 distribute the Library or its derivative works. These actions are
17870 prohibited by law if you do not accept this License. Therefore, by
17871 modifying or distributing the Library (or any work based on the
17872 Library), you indicate your acceptance of this License to do so, and
17873 all its terms and conditions for copying, distributing or modifying
17874 the Library or works based on it.
17876 10. Each time you redistribute the Library (or any work based on the
17877 Library), the recipient automatically receives a license from the
17878 original licensor to copy, distribute, link with or modify the Library
17879 subject to these terms and conditions. You may not impose any further
17880 restrictions on the recipients' exercise of the rights granted herein.
17881 You are not responsible for enforcing compliance by third parties with
17882 this License.
17883 </pre></td></tr></table>
17887 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> 11. If, as a consequence of a court judgment or allegation of patent
17888 infringement or for any other reason (not limited to patent issues),
17889 conditions are imposed on you (whether by court order, agreement or
17890 otherwise) that contradict the conditions of this License, they do not
17891 excuse you from the conditions of this License. If you cannot
17892 distribute so as to satisfy simultaneously your obligations under this
17893 License and any other pertinent obligations, then as a consequence you
17894 may not distribute the Library at all. For example, if a patent
17895 license would not permit royalty-free redistribution of the Library by
17896 all those who receive copies directly or indirectly through you, then
17897 the only way you could satisfy both it and this License would be to
17898 refrain entirely from distribution of the Library.
17900 If any portion of this section is held invalid or unenforceable under any
17901 particular circumstance, the balance of the section is intended to apply,
17902 and the section as a whole is intended to apply in other circumstances.
17904 It is not the purpose of this section to induce you to infringe any
17905 patents or other property right claims or to contest validity of any
17906 such claims; this section has the sole purpose of protecting the
17907 integrity of the free software distribution system which is
17908 implemented by public license practices. Many people have made
17909 generous contributions to the wide range of software distributed
17910 through that system in reliance on consistent application of that
17911 system; it is up to the author/donor to decide if he or she is willing
17912 to distribute software through any other system and a licensee cannot
17913 impose that choice.
17915 This section is intended to make thoroughly clear what is believed to
17916 be a consequence of the rest of this License.
17918 12. If the distribution and/or use of the Library is restricted in
17919 certain countries either by patents or by copyrighted interfaces, the
17920 original copyright holder who places the Library under this License may add
17921 an explicit geographical distribution limitation excluding those countries,
17922 so that distribution is permitted only in or among countries not thus
17923 excluded. In such case, this License incorporates the limitation as if
17924 written in the body of this License.
17926 13. The Free Software Foundation may publish revised and/or new
17927 versions of the Lesser General Public License from time to time.
17928 Such new versions will be similar in spirit to the present version,
17929 but may differ in detail to address new problems or concerns.
17931 Each version is given a distinguishing version number. If the Library
17932 specifies a version number of this License which applies to it and
17933 &quot;any later version&quot;, you have the option of following the terms and
17934 conditions either of that version or of any later version published by
17935 the Free Software Foundation. If the Library does not specify a
17936 license version number, you may choose any version ever published by
17937 the Free Software Foundation.
17938 </pre></td></tr></table>
17942 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> 14. If you wish to incorporate parts of the Library into other free
17943 programs whose distribution conditions are incompatible with these,
17944 write to the author to ask for permission. For software which is
17945 copyrighted by the Free Software Foundation, write to the Free
17946 Software Foundation; we sometimes make exceptions for this. Our
17947 decision will be guided by the two goals of preserving the free status
17948 of all derivatives of our free software and of promoting the sharing
17949 and reuse of software generally.
17951 NO WARRANTY
17953 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
17954 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
17955 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
17956 OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT WARRANTY OF ANY
17957 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
17958 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17959 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
17960 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
17961 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
17963 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
17964 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
17965 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
17966 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
17967 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
17968 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
17969 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
17970 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
17971 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17972 DAMAGES.
17974 END OF TERMS AND CONDITIONS
17975 </pre></td></tr></table>
17979 <table><tr><td>&nbsp;</td><td><pre class="smallexample"><b></b> How to Apply These Terms to Your New Libraries
17981 If you develop a new library, and you want it to be of the greatest
17982 possible use to the public, we recommend making it free software that
17983 everyone can redistribute and change. You can do so by permitting
17984 redistribution under these terms (or, alternatively, under the terms of the
17985 ordinary General Public License).
17987 To apply these terms, attach the following notices to the library. It is
17988 safest to attach them to the start of each source file to most effectively
17989 convey the exclusion of warranty; and each file should have at least the
17990 &quot;copyright&quot; line and a pointer to where the full notice is found.
17992 &lt;one line to give the library's name and a brief idea of what it does.&gt;
17993 Copyright (C) &lt;year&gt; &lt;name of author&gt;
17995 This library is free software; you can redistribute it and/or
17996 modify it under the terms of the GNU Lesser General Public
17997 License as published by the Free Software Foundation; either
17998 version 2.1 of the License, or (at your option) any later version.
18000 This library is distributed in the hope that it will be useful,
18001 but WITHOUT ANY WARRANTY; without even the implied warranty of
18002 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18003 Lesser General Public License for more details.
18005 You should have received a copy of the GNU Lesser General Public
18006 License along with this library; if not, write to the Free Software
18007 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18009 Also add information on how to contact you by electronic and paper mail.
18011 You should also get your employer (if you work as a programmer) or your
18012 school, if any, to sign a &quot;copyright disclaimer&quot; for the library, if
18013 necessary. Here is a sample; alter the names:
18015 Yoyodyne, Inc., hereby disclaims all copyright interest in the
18016 library `Frob' (a library for tweaking knobs) written by James Random Hacker.
18018 &lt;signature of Ty Coon&gt;, 1 April 1990
18019 Ty Coon, President of Vice
18021 That's all there is to it!
18022 </pre></td></tr></table>
18026 <hr size="1">
18027 <a name="General-index"></a>
18028 <table cellpadding="1" cellspacing="1" border="0">
18029 <tr><td valign="middle" align="left"><a href="#Copyright-and-license" title="Previous section in reading order"><img src="button-left.png" border="0" alt="Back: 21. Copyright and license" align="middle" width="32"></a></td>
18030 <td valign="middle" align="left"><img src="button-empty.png" border="0" alt="Forward: General index" align="middle" width="32"></td>
18031 <td valign="middle" align="left"> &nbsp; </td>
18032 <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" alt="FastBack: 21. Copyright and license" align="middle" width="32"></a></td>
18033 <td valign="middle" align="left"><a href="#Top" title="Up section"><img src="button-up.png" border="0" alt="Up: Gambit-C" align="middle" width="32"></a></td>
18034 <td valign="middle" align="left"><img src="button-empty.png" border="0" alt="FastForward: General index" align="middle" width="32"></td>
18035 <td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
18036 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
18037 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
18038 </tr></table>
18039 <a name="General-index-1"></a>
18040 <h1 class="unnumbered">General index</h1>
18042 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
18043 &nbsp;
18044 <a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a>
18045 &nbsp;
18046 <a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a>
18047 &nbsp;
18048 <a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a>
18049 &nbsp;
18050 <a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a>
18051 &nbsp;
18052 <a href="#General-index-1_cp_symbol-6" class="summary-letter"><b>&lt;</b></a>
18053 &nbsp;
18054 <a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a>
18055 &nbsp;
18056 <a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>&gt;</b></a>
18057 &nbsp;
18058 <a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a>
18059 &nbsp;
18060 <a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a>
18061 &nbsp;
18062 <a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a>
18063 &nbsp;
18064 <a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a>
18065 &nbsp;
18066 <br>
18067 <a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
18068 &nbsp;
18069 <a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
18070 &nbsp;
18071 <a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
18072 &nbsp;
18073 <a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
18074 &nbsp;
18075 <a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
18076 &nbsp;
18077 <a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
18078 &nbsp;
18079 <a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
18080 &nbsp;
18081 <a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
18082 &nbsp;
18083 <a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
18084 &nbsp;
18085 <a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a>
18086 &nbsp;
18087 <a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
18088 &nbsp;
18089 <a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
18090 &nbsp;
18091 <a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
18092 &nbsp;
18093 <a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
18094 &nbsp;
18095 <a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
18096 &nbsp;
18097 <a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
18098 &nbsp;
18099 <a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
18100 &nbsp;
18101 <a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
18102 &nbsp;
18103 <a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
18104 &nbsp;
18105 <a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
18106 &nbsp;
18107 <a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
18108 &nbsp;
18109 <a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
18110 &nbsp;
18111 </td></tr></table>
18112 <table border="0" class="index-cp">
18113 <tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr>
18114 <tr><td colspan="3"> <hr></td></tr>
18115 <tr><th><a name="General-index-1_cp_symbol-1">#</a></th><td></td><td></td></tr>
18116 <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>
18117 <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>
18118 <tr><td colspan="3"> <hr></td></tr>
18119 <tr><th><a name="General-index-1_cp_symbol-2">+</a></th><td></td><td></td></tr>
18120 <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>
18121 <tr><td colspan="3"> <hr></td></tr>
18122 <tr><th><a name="General-index-1_cp_symbol-3">,</a></th><td></td><td></td></tr>
18123 <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>
18124 <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>
18125 <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>
18126 <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>
18127 <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>
18128 <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>
18129 <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>
18130 <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>
18131 <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>
18132 <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>
18133 <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>
18134 <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>
18135 <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>
18136 <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>
18137 <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>
18138 <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>
18139 <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>
18140 <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>
18141 <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>
18142 <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>
18143 <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>
18144 <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>
18145 <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>
18146 <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>
18147 <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>
18148 <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>
18149 <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>
18150 <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>
18151 <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>
18152 <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>
18153 <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>
18154 <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>
18155 <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>
18156 <tr><td colspan="3"> <hr></td></tr>
18157 <tr><th><a name="General-index-1_cp_symbol-4">-</a></th><td></td><td></td></tr>
18158 <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>
18159 <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>
18160 <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>
18161 <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>
18162 <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>
18163 <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>
18164 <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>
18165 <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>
18166 <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>
18167 <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>
18168 <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>
18169 <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>
18170 <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>
18171 <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>
18172 <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>
18173 <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>
18174 <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>
18175 <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>
18176 <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>
18177 <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>
18178 <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>
18179 <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>
18180 <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>
18181 <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>
18182 <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>
18183 <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>
18184 <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>
18185 <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>
18186 <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>
18187 <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>
18188 <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>
18189 <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>
18190 <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>
18191 <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>
18192 <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>
18193 <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>
18194 <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>
18195 <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>
18196 <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>
18197 <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>
18198 <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>
18199 <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>
18200 <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>
18201 <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>
18202 <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>
18203 <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>
18204 <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>
18205 <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>
18206 <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>
18207 <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>
18208 <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>
18209 <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>
18210 <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>
18211 <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>
18212 <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>
18213 <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>
18214 <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>
18215 <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>
18216 <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>
18217 <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>
18218 <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>
18219 <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>
18220 <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>
18221 <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>
18222 <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>
18223 <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>
18224 <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>
18225 <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>
18226 <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>
18227 <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>
18228 <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>
18229 <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>
18230 <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>
18231 <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>
18232 <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>
18233 <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>
18234 <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>
18235 <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>
18236 <tr><td colspan="3"> <hr></td></tr>
18237 <tr><th><a name="General-index-1_cp_symbol-5">.</a></th><td></td><td></td></tr>
18238 <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>
18239 <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>
18240 <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>
18241 <tr><td colspan="3"> <hr></td></tr>
18242 <tr><th><a name="General-index-1_cp_symbol-6">&lt;</a></th><td></td><td></td></tr>
18243 <tr><td></td><td valign="top"><a href="#index-_003c"><code>&lt;</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
18244 <tr><td></td><td valign="top"><a href="#index-_003c_003d"><code>&lt;=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
18245 <tr><td colspan="3"> <hr></td></tr>
18246 <tr><th><a name="General-index-1_cp_symbol-7">=</a></th><td></td><td></td></tr>
18247 <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>
18248 <tr><td colspan="3"> <hr></td></tr>
18249 <tr><th><a name="General-index-1_cp_symbol-8">&gt;</a></th><td></td><td></td></tr>
18250 <tr><td></td><td valign="top"><a href="#index-_003e"><code>&gt;</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
18251 <tr><td></td><td valign="top"><a href="#index-_003e_003d"><code>&gt;=</code></a></td><td valign="top"><a href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></td></tr>
18252 <tr><td colspan="3"> <hr></td></tr>
18253 <tr><th><a name="General-index-1_cp_symbol-9">^</a></th><td></td><td></td></tr>
18254 <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>
18255 <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>
18256 <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>
18257 <tr><td colspan="3"> <hr></td></tr>
18258 <tr><th><a name="General-index-1_cp_symbol-10">_</a></th><td></td><td></td></tr>
18259 <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>
18260 <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>
18261 <tr><td colspan="3"> <hr></td></tr>
18262 <tr><th><a name="General-index-1_cp_symbol-11">|</a></th><td></td><td></td></tr>
18263 <tr><td></td><td valign="top"><a href="#index-_007csix_002ex"><code>|six.x,y|</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
18264 <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>
18265 <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>
18266 <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>
18267 <tr><td colspan="3"> <hr></td></tr>
18268 <tr><th><a name="General-index-1_cp_symbol-12">~</a></th><td></td><td></td></tr>
18269 <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>
18270 <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>
18271 <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>
18272 <tr><td colspan="3"> <hr></td></tr>
18273 <tr><th><a name="General-index-1_cp_letter-A">A</a></th><td></td><td></td></tr>
18274 <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>
18275 <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>
18276 <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>
18277 <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>
18278 <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>
18279 <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>
18280 <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>
18281 <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>
18282 <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>
18283 <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>
18284 <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>
18285 <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>
18286 <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>
18287 <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>
18288 <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>
18289 <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>
18290 <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>
18291 <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>
18292 <tr><td></td><td valign="top"><a href="#index-append_002dstrings"><code>append-strings</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
18293 <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>
18294 <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>
18295 <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>
18296 <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>
18297 <tr><td></td><td valign="top"><a href="#index-append_002dvectors"><code>append-vectors</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
18298 <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>
18299 <tr><td colspan="3"> <hr></td></tr>
18300 <tr><th><a name="General-index-1_cp_letter-B">B</a></th><td></td><td></td></tr>
18301 <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>
18302 <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>
18303 <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>
18304 <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>
18305 <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>
18306 <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>
18307 <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>
18308 <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>
18309 <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>
18310 <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>
18311 <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>
18312 <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>
18313 <tr><td colspan="3"> <hr></td></tr>
18314 <tr><th><a name="General-index-1_cp_letter-C">C</a></th><td></td><td></td></tr>
18315 <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>
18316 <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>
18317 <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>
18318 <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>
18319 <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>
18320 <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>
18321 <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>
18322 <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>
18323 <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>
18324 <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>
18325 <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>
18326 <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>
18327 <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>
18328 <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>
18329 <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>
18330 <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>
18331 <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>
18332 <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>
18333 <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>
18334 <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>
18335 <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>
18336 <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>
18337 <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>
18338 <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>
18339 <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>
18340 <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>
18341 <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>
18342 <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>
18343 <tr><td></td><td valign="top"><a href="#index-char_002d_003einteger"><code>char-&gt;integer</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18344 <tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003d_003f"><code>char-ci&lt;=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18345 <tr><td></td><td valign="top"><a href="#index-char_002dci_003c_003f"><code>char-ci&lt;?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18346 <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>
18347 <tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003d_003f"><code>char-ci&gt;=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18348 <tr><td></td><td valign="top"><a href="#index-char_002dci_003e_003f"><code>char-ci&gt;?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18349 <tr><td></td><td valign="top"><a href="#index-char_003c_003d_003f"><code>char&lt;=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18350 <tr><td></td><td valign="top"><a href="#index-char_003c_003f"><code>char&lt;?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18351 <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>
18352 <tr><td></td><td valign="top"><a href="#index-char_003e_003d_003f"><code>char&gt;=?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18353 <tr><td></td><td valign="top"><a href="#index-char_003e_003f"><code>char&gt;?</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18354 <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>
18355 <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>
18356 <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>
18357 <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>
18358 <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>
18359 <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>
18360 <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>
18361 <tr><td></td><td valign="top"><a href="#index-compile_002dfile_002dto_002dc"><code>compile-file-to-c</code></a></td><td valign="top"><a href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></td></tr>
18362 <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>
18363 <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>
18364 <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>
18365 <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>
18366 <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>
18367 <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>
18368 <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>
18369 <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>
18370 <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>
18371 <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>
18372 <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>
18373 <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>
18374 <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>
18375 <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>
18376 <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>
18377 <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>
18378 <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>
18379 <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>
18380 <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>
18381 <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>
18382 <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>
18383 <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>
18384 <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>
18385 <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>
18386 <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>
18387 <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>
18388 <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>
18389 <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>
18390 <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>
18391 <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>
18392 <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>
18393 <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>
18394 <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>
18395 <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>
18396 <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>
18397 <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>
18398 <tr><td colspan="3"> <hr></td></tr>
18399 <tr><th><a name="General-index-1_cp_letter-D">D</a></th><td></td><td></td></tr>
18400 <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>
18401 <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>
18402 <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>
18403 <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>
18404 <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>
18405 <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>
18406 <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>
18407 <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>
18408 <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>
18409 <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>
18410 <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>
18411 <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>
18412 <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>
18413 <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>
18414 <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>
18415 <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>
18416 <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>
18417 <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>
18418 <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>
18419 <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>
18420 <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>
18421 <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>
18422 <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>
18423 <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>
18424 <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>
18425 <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>
18426 <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>
18427 <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>
18428 <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>
18429 <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>
18430 <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>
18431 <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>
18432 <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>
18433 <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>
18434 <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>
18435 <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>
18436 <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>
18437 <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>
18438 <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>
18439 <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>
18440 <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>
18441 <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>
18442 <tr><td colspan="3"> <hr></td></tr>
18443 <tr><th><a name="General-index-1_cp_letter-E">E</a></th><td></td><td></td></tr>
18444 <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>
18445 <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>
18446 <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>
18447 <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>
18448 <tr><td></td><td valign="top"><a href="#index-err_002dcode_002d_003estring"><code>err-code-&gt;string</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
18449 <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>
18450 <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>
18451 <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>
18452 <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>
18453 <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>
18454 <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>
18455 <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>
18456 <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>
18457 <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>
18458 <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>
18459 <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>
18460 <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>
18461 <tr><td colspan="3"> <hr></td></tr>
18462 <tr><th><a name="General-index-1_cp_letter-F">F</a></th><td></td><td></td></tr>
18463 <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>
18464 <tr><td></td><td valign="top"><a href="#index-f32vector_002d_003elist"><code>f32vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18465 <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>
18466 <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>
18467 <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>
18468 <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>
18469 <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>
18470 <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>
18471 <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>
18472 <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>
18473 <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>
18474 <tr><td></td><td valign="top"><a href="#index-f64vector_002d_003elist"><code>f64vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18475 <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>
18476 <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>
18477 <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>
18478 <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>
18479 <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>
18480 <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>
18481 <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>
18482 <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>
18483 <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>
18484 <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>
18485 <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>
18486 <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>
18487 <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>
18488 <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>
18489 <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>
18490 <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>
18491 <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>
18492 <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>
18493 <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>
18494 <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>
18495 <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>
18496 <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>
18497 <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>
18498 <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>
18499 <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>
18500 <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>
18501 <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>
18502 <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>
18503 <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>
18504 <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>
18505 <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>
18506 <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>
18507 <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>
18508 <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>
18509 <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>
18510 <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>
18511 <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>
18512 <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>
18513 <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>
18514 <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>
18515 <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>
18516 <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>
18517 <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>
18518 <tr><td></td><td valign="top"><a href="#index-first_002dbit_002dset"><code>first-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>
18519 <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>
18520 <tr><td></td><td valign="top"><a href="#index-fixnum_002d_003eflonum"><code>fixnum-&gt;flonum</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
18521 <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>
18522 <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>
18523 <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>
18524 <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>
18525 <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>
18526 <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>
18527 <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>
18528 <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>
18529 <tr><td></td><td valign="top"><a href="#index-fl_003c"><code>fl&lt;</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
18530 <tr><td></td><td valign="top"><a href="#index-fl_003c_003d"><code>fl&lt;=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
18531 <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>
18532 <tr><td></td><td valign="top"><a href="#index-fl_003e"><code>fl&gt;</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
18533 <tr><td></td><td valign="top"><a href="#index-fl_003e_003d"><code>fl&gt;=</code></a></td><td valign="top"><a href="#Flonum-specific-operations">9.6 Flonum specific operations</a></td></tr>
18534 <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>
18535 <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>
18536 <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>
18537 <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>
18538 <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>
18539 <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>
18540 <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>
18541 <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>
18542 <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>
18543 <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>
18544 <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>
18545 <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>
18546 <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>
18547 <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>
18548 <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>
18549 <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>
18550 <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>
18551 <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>
18552 <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>
18553 <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>
18554 <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>
18555 <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>
18556 <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>
18557 <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>
18558 <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>
18559 <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>
18560 <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>
18561 <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>
18562 <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>
18563 <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>
18564 <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>
18565 <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>
18566 <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>
18567 <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>
18568 <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>
18569 <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>
18570 <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>
18571 <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>
18572 <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>
18573 <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>
18574 <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>
18575 <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>
18576 <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>
18577 <tr><td></td><td valign="top"><a href="#index-fx_003c"><code>fx&lt;</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
18578 <tr><td></td><td valign="top"><a href="#index-fx_003c_003d"><code>fx&lt;=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
18579 <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>
18580 <tr><td></td><td valign="top"><a href="#index-fx_003e"><code>fx&gt;</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
18581 <tr><td></td><td valign="top"><a href="#index-fx_003e_003d"><code>fx&gt;=</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
18582 <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>
18583 <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>
18584 <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>
18585 <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>
18586 <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>
18587 <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>
18588 <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>
18589 <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>
18590 <tr><td></td><td valign="top"><a href="#index-fxfirst_002dbit_002dset"><code>fxfirst-bit-set</code></a></td><td valign="top"><a href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></td></tr>
18591 <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>
18592 <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>
18593 <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>
18594 <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>
18595 <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>
18596 <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>
18597 <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>
18598 <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>
18599 <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>
18600 <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>
18601 <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>
18602 <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>
18603 <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>
18604 <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>
18605 <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>
18606 <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>
18607 <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>
18608 <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>
18609 <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>
18610 <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>
18611 <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>
18612 <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>
18613 <tr><td colspan="3"> <hr></td></tr>
18614 <tr><th><a name="General-index-1_cp_letter-G">G</a></th><td></td><td></td></tr>
18615 <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>
18616 <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>
18617 <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>
18618 <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>
18619 <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>
18620 <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>
18621 <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>
18622 <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>
18623 <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>
18624 <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>
18625 <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>
18626 <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>
18627 <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>
18628 <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>
18629 <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>
18630 <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>
18631 <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>
18632 <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>
18633 <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>
18634 <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>
18635 <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>
18636 <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>
18637 <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>
18638 <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>
18639 <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>
18640 <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>
18641 <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>
18642 <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>
18643 <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>
18644 <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>
18645 <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>
18646 <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>
18647 <tr><td colspan="3"> <hr></td></tr>
18648 <tr><th><a name="General-index-1_cp_letter-H">H</a></th><td></td><td></td></tr>
18649 <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>
18650 <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>
18651 <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>
18652 <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>
18653 <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>
18654 <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>
18655 <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>
18656 <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>
18657 <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>
18658 <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>
18659 <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>
18660 <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>
18661 <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>
18662 <tr><td colspan="3"> <hr></td></tr>
18663 <tr><th><a name="General-index-1_cp_letter-I">I</a></th><td></td><td></td></tr>
18664 <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>
18665 <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>
18666 <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>
18667 <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>
18668 <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>
18669 <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>
18670 <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>
18671 <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>
18672 <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>
18673 <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>
18674 <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>
18675 <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>
18676 <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>
18677 <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>
18678 <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>
18679 <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>
18680 <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>
18681 <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>
18682 <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>
18683 <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>
18684 <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>
18685 <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>
18686 <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>
18687 <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>
18688 <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>
18689 <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>
18690 <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>
18691 <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>
18692 <tr><td></td><td valign="top"><a href="#index-integer_002d_003echar"><code>integer-&gt;char</code></a></td><td valign="top"><a href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></td></tr>
18693 <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>
18694 <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>
18695 <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>
18696 <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>
18697 <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>
18698 <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>
18699 <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>
18700 <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>
18701 <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>
18702 <tr><td colspan="3"> <hr></td></tr>
18703 <tr><th><a name="General-index-1_cp_letter-J">J</a></th><td></td><td></td></tr>
18704 <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>
18705 <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>
18706 <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>
18707 <tr><td colspan="3"> <hr></td></tr>
18708 <tr><th><a name="General-index-1_cp_letter-K">K</a></th><td></td><td></td></tr>
18709 <tr><td></td><td valign="top"><a href="#index-keyword_002d_003estring"><code>keyword-&gt;string</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
18710 <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>
18711 <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>
18712 <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>
18713 <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>
18714 <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>
18715 <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>
18716 <tr><td colspan="3"> <hr></td></tr>
18717 <tr><th><a name="General-index-1_cp_letter-L">L</a></th><td></td><td></td></tr>
18718 <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>
18719 <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>
18720 <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>
18721 <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>
18722 <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>
18723 <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>
18724 <tr><td></td><td valign="top"><a href="#index-list_002d_003ef32vector"><code>list-&gt;f32vector</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-list_002d_003ef64vector"><code>list-&gt;f64vector</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-list_002d_003es16vector"><code>list-&gt;s16vector</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-list_002d_003es32vector"><code>list-&gt;s32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18728 <tr><td></td><td valign="top"><a href="#index-list_002d_003es64vector"><code>list-&gt;s64vector</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-list_002d_003es8vector"><code>list-&gt;s8vector</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-list_002d_003etable"><code>list-&gt;table</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
18731 <tr><td></td><td valign="top"><a href="#index-list_002d_003eu16vector"><code>list-&gt;u16vector</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-list_002d_003eu32vector"><code>list-&gt;u32vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18733 <tr><td></td><td valign="top"><a href="#index-list_002d_003eu64vector"><code>list-&gt;u64vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18734 <tr><td></td><td valign="top"><a href="#index-list_002d_003eu8vector"><code>list-&gt;u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18735 <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>
18736 <tr><td colspan="3"> <hr></td></tr>
18737 <tr><th><a name="General-index-1_cp_letter-M">M</a></th><td></td><td></td></tr>
18738 <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>
18739 <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>
18740 <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>
18741 <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>
18742 <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>
18743 <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>
18744 <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>
18745 <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>
18746 <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>
18747 <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>
18748 <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>
18749 <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>
18750 <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>
18751 <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>
18752 <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>
18753 <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>
18754 <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>
18755 <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>
18756 <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>
18757 <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>
18758 <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>
18759 <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>
18760 <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>
18761 <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>
18762 <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>
18763 <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>
18764 <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>
18765 <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>
18766 <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>
18767 <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>
18768 <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>
18769 <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>
18770 <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>
18771 <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>
18772 <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>
18773 <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>
18774 <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>
18775 <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>
18776 <tr><td colspan="3"> <hr></td></tr>
18777 <tr><th><a name="General-index-1_cp_letter-N">N</a></th><td></td><td></td></tr>
18778 <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>
18779 <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>
18780 <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>
18781 <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>
18782 <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>
18783 <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>
18784 <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>
18785 <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>
18786 <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>
18787 <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>
18788 <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>
18789 <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>
18790 <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>
18791 <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>
18792 <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>
18793 <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>
18794 <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>
18795 <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>
18796 <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>
18797 <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>
18798 <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>
18799 <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>
18800 <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>
18801 <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>
18802 <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>
18803 <tr><td colspan="3"> <hr></td></tr>
18804 <tr><th><a name="General-index-1_cp_letter-O">O</a></th><td></td><td></td></tr>
18805 <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>
18806 <tr><td></td><td valign="top"><a href="#index-object_002d_003eserial_002dnumber"><code>object-&gt;serial-number</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
18807 <tr><td></td><td valign="top"><a href="#index-object_002d_003estring"><code>object-&gt;string</code></a></td><td valign="top"><a href="#String_002dports">17.10 String-ports</a></td></tr>
18808 <tr><td></td><td valign="top"><a href="#index-object_002d_003eu8vector"><code>object-&gt;u8vector</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18809 <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>
18810 <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>
18811 <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>
18812 <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>
18813 <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>
18814 <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>
18815 <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>
18816 <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>
18817 <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>
18818 <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>
18819 <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>
18820 <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>
18821 <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>
18822 <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>
18823 <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>
18824 <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>
18825 <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>
18826 <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>
18827 <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>
18828 <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>
18829 <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>
18830 <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>
18831 <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>
18832 <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>
18833 <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>
18834 <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>
18835 <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>
18836 <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>
18837 <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>
18838 <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>
18839 <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>
18840 <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>
18841 <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>
18842 <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>
18843 <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>
18844 <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>
18845 <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>
18846 <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>
18847 <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>
18848 <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>
18849 <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>
18850 <tr><td colspan="3"> <hr></td></tr>
18851 <tr><th><a name="General-index-1_cp_letter-P">P</a></th><td></td><td></td></tr>
18852 <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>
18853 <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>
18854 <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>
18855 <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>
18856 <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>
18857 <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>
18858 <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>
18859 <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>
18860 <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>
18861 <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>
18862 <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>
18863 <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>
18864 <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>
18865 <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>
18866 <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>
18867 <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>
18868 <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>
18869 <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>
18870 <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>
18871 <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>
18872 <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>
18873 <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>
18874 <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>
18875 <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>
18876 <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>
18877 <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>
18878 <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>
18879 <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>
18880 <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>
18881 <tr><td colspan="3"> <hr></td></tr>
18882 <tr><th><a name="General-index-1_cp_letter-R">R</a></th><td></td><td></td></tr>
18883 <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>
18884 <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>
18885 <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>
18886 <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>
18887 <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>
18888 <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>
18889 <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>
18890 <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>
18891 <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>
18892 <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>
18893 <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>
18894 <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>
18895 <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>
18896 <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>
18897 <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>
18898 <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>
18899 <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>
18900 <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>
18901 <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>
18902 <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>
18903 <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>
18904 <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>
18905 <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>
18906 <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>
18907 <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>
18908 <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>
18909 <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>
18910 <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>
18911 <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>
18912 <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>
18913 <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>
18914 <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>
18915 <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>
18916 <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>
18917 <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>
18918 <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>
18919 <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>
18920 <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>
18921 <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>
18922 <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>
18923 <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>
18924 <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>
18925 <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>
18926 <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>
18927 <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>
18928 <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>
18929 <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>
18930 <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>
18931 <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>
18932 <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>
18933 <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>
18934 <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>
18935 <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>
18936 <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>
18937 <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>
18938 <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>
18939 <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>
18940 <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>
18941 <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>
18942 <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>
18943 <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>
18944 <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>
18945 <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>
18946 <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>
18947 <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>
18948 <tr><td colspan="3"> <hr></td></tr>
18949 <tr><th><a name="General-index-1_cp_letter-S">S</a></th><td></td><td></td></tr>
18950 <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>
18951 <tr><td></td><td valign="top"><a href="#index-s16vector_002d_003elist"><code>s16vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18952 <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>
18953 <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>
18954 <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>
18955 <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>
18956 <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>
18957 <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>
18958 <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>
18959 <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>
18960 <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>
18961 <tr><td></td><td valign="top"><a href="#index-s32vector_002d_003elist"><code>s32vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18962 <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>
18963 <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>
18964 <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>
18965 <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>
18966 <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>
18967 <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>
18968 <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>
18969 <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>
18970 <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>
18971 <tr><td></td><td valign="top"><a href="#index-s64vector_002d_003elist"><code>s64vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18972 <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>
18973 <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>
18974 <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>
18975 <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>
18976 <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>
18977 <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>
18978 <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>
18979 <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>
18980 <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>
18981 <tr><td></td><td valign="top"><a href="#index-s8vector_002d_003elist"><code>s8vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
18982 <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>
18983 <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>
18984 <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>
18985 <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>
18986 <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>
18987 <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>
18988 <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>
18989 <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>
18990 <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>
18991 <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>
18992 <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>
18993 <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>
18994 <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>
18995 <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>
18996 <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>
18997 <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>
18998 <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>
18999 <tr><td></td><td valign="top"><a href="#index-seconds_002d_003etime"><code>seconds-&gt;time</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
19000 <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>
19001 <tr><td></td><td valign="top"><a href="#index-serial_002dnumber_002d_003eobject"><code>serial-number-&gt;object</code></a></td><td valign="top"><a href="#Hashing">11.1 Hashing</a></td></tr>
19002 <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>
19003 <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>
19004 <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>
19005 <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>
19006 <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>
19007 <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>
19008 <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>
19009 <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>
19010 <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>
19011 <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>
19012 <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>
19013 <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>
19014 <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>
19015 <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>
19016 <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>
19017 <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>
19018 <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>
19019 <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>
19020 <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>
19021 <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>
19022 <tr><td></td><td valign="top"><a href="#index-six_002e_0026x"><code>six.&amp;x</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19023 <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>
19024 <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>
19025 <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>
19026 <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>
19027 <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>
19028 <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>
19029 <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>
19030 <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>
19031 <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>
19032 <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>
19033 <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>
19034 <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>
19035 <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>
19036 <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>
19037 <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>
19038 <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>
19039 <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>
19040 <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>
19041 <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>
19042 <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>
19043 <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>
19044 <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>
19045 <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>
19046 <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>
19047 <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>
19048 <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>
19049 <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>
19050 <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>
19051 <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>
19052 <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>
19053 <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>
19054 <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>
19055 <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>
19056 <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>
19057 <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>
19058 <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>
19059 <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>
19060 <tr><td></td><td valign="top"><a href="#index-six_002ex_0026_0026y"><code>six.x&amp;&amp;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19061 <tr><td></td><td valign="top"><a href="#index-six_002ex_0026_003dy"><code>six.x&amp;=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19062 <tr><td></td><td valign="top"><a href="#index-six_002ex_0026y"><code>six.x&amp;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19063 <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>
19064 <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>
19065 <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>
19066 <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>
19067 <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>
19068 <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>
19069 <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>
19070 <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>
19071 <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>
19072 <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>
19073 <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>
19074 <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>
19075 <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>
19076 <tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003c_003dy"><code>six.x&lt;&lt;=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19077 <tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003cy"><code>six.x&lt;&lt;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19078 <tr><td></td><td valign="top"><a href="#index-six_002ex_003c_003dy"><code>six.x&lt;=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19079 <tr><td></td><td valign="top"><a href="#index-six_002ex_003cy"><code>six.x&lt;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19080 <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>
19081 <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>
19082 <tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003dy"><code>six.x&gt;=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19083 <tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003e_003dy"><code>six.x&gt;&gt;=y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19084 <tr><td></td><td valign="top"><a href="#index-six_002ex_003e_003ey"><code>six.x&gt;&gt;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19085 <tr><td></td><td valign="top"><a href="#index-six_002ex_003ey"><code>six.x&gt;y</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19086 <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>
19087 <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>
19088 <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>
19089 <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>
19090 <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>
19091 <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>
19092 <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>
19093 <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>
19094 <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>
19095 <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>
19096 <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>
19097 <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>
19098 <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>
19099 <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>
19100 <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>
19101 <tr><td></td><td valign="top"><a href="#index-string_002d_003ekeyword"><code>string-&gt;keyword</code></a></td><td valign="top"><a href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></td></tr>
19102 <tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003d_003f"><code>string-ci&lt;=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19103 <tr><td></td><td valign="top"><a href="#index-string_002dci_003c_003f"><code>string-ci&lt;?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19104 <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>
19105 <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>
19106 <tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003d_003f"><code>string-ci&gt;=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19107 <tr><td></td><td valign="top"><a href="#index-string_002dci_003e_003f"><code>string-ci&gt;?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19108 <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>
19109 <tr><td></td><td valign="top"><a href="#index-string_003c_003d_003f"><code>string&lt;=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19110 <tr><td></td><td valign="top"><a href="#index-string_003c_003f"><code>string&lt;?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19111 <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>
19112 <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>
19113 <tr><td></td><td valign="top"><a href="#index-string_003e_003d_003f"><code>string&gt;=?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19114 <tr><td></td><td valign="top"><a href="#index-string_003e_003f"><code>string&gt;?</code></a></td><td valign="top"><a href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></td></tr>
19115 <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>
19116 <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>
19117 <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>
19118 <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>
19119 <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>
19120 <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>
19121 <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>
19122 <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>
19123 <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>
19124 <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>
19125 <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>
19126 <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>
19127 <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>
19128 <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>
19129 <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>
19130 <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>
19131 <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>
19132 <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>
19133 <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>
19134 <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>
19135 <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>
19136 <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>
19137 <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>
19138 <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>
19139 <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>
19140 <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>
19141 <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>
19142 <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>
19143 <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>
19144 <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>
19145 <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>
19146 <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>
19147 <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>
19148 <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>
19149 <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>
19150 <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>
19151 <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>
19152 <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>
19153 <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>
19154 <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>
19155 <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>
19156 <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>
19157 <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>
19158 <tr><td colspan="3"> <hr></td></tr>
19159 <tr><th><a name="General-index-1_cp_letter-T">T</a></th><td></td><td></td></tr>
19160 <tr><td></td><td valign="top"><a href="#index-table_002d_003elist"><code>table-&gt;list</code></a></td><td valign="top"><a href="#Tables">11.2.2 Tables</a></td></tr>
19161 <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>
19162 <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>
19163 <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>
19164 <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>
19165 <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>
19166 <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>
19167 <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>
19168 <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>
19169 <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>
19170 <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>
19171 <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>
19172 <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>
19173 <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>
19174 <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>
19175 <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>
19176 <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>
19177 <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>
19178 <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>
19179 <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>
19180 <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>
19181 <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>
19182 <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>
19183 <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>
19184 <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>
19185 <tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dlist"><code>thread-group-&gt;thread-group-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19186 <tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dgroup_002dvector"><code>thread-group-&gt;thread-group-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19187 <tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dlist"><code>thread-group-&gt;thread-list</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19188 <tr><td></td><td valign="top"><a href="#index-thread_002dgroup_002d_003ethread_002dvector"><code>thread-group-&gt;thread-vector</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19189 <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>
19190 <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>
19191 <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>
19192 <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>
19193 <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>
19194 <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>
19195 <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>
19196 <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>
19197 <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>
19198 <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>
19199 <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>
19200 <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>
19201 <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>
19202 <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>
19203 <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>
19204 <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>
19205 <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>
19206 <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>
19207 <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>
19208 <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>
19209 <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>
19210 <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>
19211 <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>
19212 <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>
19213 <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>
19214 <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>
19215 <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>
19216 <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>
19217 <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>
19218 <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>
19219 <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>
19220 <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>
19221 <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>
19222 <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>
19223 <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>
19224 <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>
19225 <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>
19226 <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>
19227 <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>
19228 <tr><td></td><td valign="top"><a href="#index-threads">threads</a></td><td valign="top"><a href="#Threads">13. Threads</a></td></tr>
19229 <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>
19230 <tr><td></td><td valign="top"><a href="#index-time_002d_003eseconds"><code>time-&gt;seconds</code></a></td><td valign="top"><a href="#Measuring-time">16.7 Measuring time</a></td></tr>
19231 <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>
19232 <tr><td></td><td valign="top"><a href="#index-timeout_002d_003etime"><code>timeout-&gt;time</code></a></td><td valign="top"><a href="#Undocumented-extensions">6.4 Undocumented extensions</a></td></tr>
19233 <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>
19234 <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>
19235 <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>
19236 <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>
19237 <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>
19238 <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>
19239 <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>
19240 <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>
19241 <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>
19242 <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>
19243 <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>
19244 <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>
19245 <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>
19246 <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>
19247 <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>
19248 <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>
19249 <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>
19250 <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>
19251 <tr><td colspan="3"> <hr></td></tr>
19252 <tr><th><a name="General-index-1_cp_letter-U">U</a></th><td></td><td></td></tr>
19253 <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>
19254 <tr><td></td><td valign="top"><a href="#index-u16vector_002d_003elist"><code>u16vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
19255 <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>
19256 <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>
19257 <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>
19258 <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>
19259 <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>
19260 <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>
19261 <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>
19262 <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>
19263 <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>
19264 <tr><td></td><td valign="top"><a href="#index-u32vector_002d_003elist"><code>u32vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
19265 <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>
19266 <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>
19267 <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>
19268 <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>
19269 <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>
19270 <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>
19271 <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>
19272 <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>
19273 <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>
19274 <tr><td></td><td valign="top"><a href="#index-u64vector_002d_003elist"><code>u64vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
19275 <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>
19276 <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>
19277 <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>
19278 <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>
19279 <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>
19280 <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>
19281 <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>
19282 <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>
19283 <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>
19284 <tr><td></td><td valign="top"><a href="#index-u8vector_002d_003elist"><code>u8vector-&gt;list</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
19285 <tr><td></td><td valign="top"><a href="#index-u8vector_002d_003eobject"><code>u8vector-&gt;object</code></a></td><td valign="top"><a href="#Homogeneous-vectors">10. Homogeneous vectors</a></td></tr>
19286 <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>
19287 <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>
19288 <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>
19289 <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>
19290 <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>
19291 <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>
19292 <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>
19293 <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>
19294 <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>
19295 <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>
19296 <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>
19297 <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>
19298 <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>
19299 <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>
19300 <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>
19301 <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>
19302 <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>
19303 <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>
19304 <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>
19305 <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>
19306 <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>
19307 <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>
19308 <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>
19309 <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>
19310 <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>
19311 <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>
19312 <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>
19313 <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>
19314 <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>
19315 <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>
19316 <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>
19317 <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>
19318 <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>
19319 <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>
19320 <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>
19321 <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>
19322 <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>
19323 <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>
19324 <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>
19325 <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>
19326 <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>
19327 <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>
19328 <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>
19329 <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>
19330 <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>
19331 <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>
19332 <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>
19333 <tr><td colspan="3"> <hr></td></tr>
19334 <tr><th><a name="General-index-1_cp_letter-V">V</a></th><td></td><td></td></tr>
19335 <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>
19336 <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>
19337 <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>
19338 <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>
19339 <tr><td colspan="3"> <hr></td></tr>
19340 <tr><th><a name="General-index-1_cp_letter-W">W</a></th><td></td><td></td></tr>
19341 <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>
19342 <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>
19343 <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>
19344 <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>
19345 <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>
19346 <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>
19347 <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>
19348 <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>
19349 <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>
19350 <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>
19351 <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>
19352 <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>
19353 <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>
19354 <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>
19355 <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>
19356 <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>
19357 <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>
19358 <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>
19359 <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>
19360 <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>
19361 <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>
19362 <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>
19363 <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>
19364 <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>
19365 <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>
19366 <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>
19367 <tr><td colspan="3"> <hr></td></tr>
19368 </table>
19369 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a href="#General-index-1_cp_symbol-1" class="summary-letter"><b>#</b></a>
19370 &nbsp;
19371 <a href="#General-index-1_cp_symbol-2" class="summary-letter"><b>+</b></a>
19372 &nbsp;
19373 <a href="#General-index-1_cp_symbol-3" class="summary-letter"><b>,</b></a>
19374 &nbsp;
19375 <a href="#General-index-1_cp_symbol-4" class="summary-letter"><b>-</b></a>
19376 &nbsp;
19377 <a href="#General-index-1_cp_symbol-5" class="summary-letter"><b>.</b></a>
19378 &nbsp;
19379 <a href="#General-index-1_cp_symbol-6" class="summary-letter"><b>&lt;</b></a>
19380 &nbsp;
19381 <a href="#General-index-1_cp_symbol-7" class="summary-letter"><b>=</b></a>
19382 &nbsp;
19383 <a href="#General-index-1_cp_symbol-8" class="summary-letter"><b>&gt;</b></a>
19384 &nbsp;
19385 <a href="#General-index-1_cp_symbol-9" class="summary-letter"><b>^</b></a>
19386 &nbsp;
19387 <a href="#General-index-1_cp_symbol-10" class="summary-letter"><b>_</b></a>
19388 &nbsp;
19389 <a href="#General-index-1_cp_symbol-11" class="summary-letter"><b>|</b></a>
19390 &nbsp;
19391 <a href="#General-index-1_cp_symbol-12" class="summary-letter"><b>~</b></a>
19392 &nbsp;
19393 <br>
19394 <a href="#General-index-1_cp_letter-A" class="summary-letter"><b>A</b></a>
19395 &nbsp;
19396 <a href="#General-index-1_cp_letter-B" class="summary-letter"><b>B</b></a>
19397 &nbsp;
19398 <a href="#General-index-1_cp_letter-C" class="summary-letter"><b>C</b></a>
19399 &nbsp;
19400 <a href="#General-index-1_cp_letter-D" class="summary-letter"><b>D</b></a>
19401 &nbsp;
19402 <a href="#General-index-1_cp_letter-E" class="summary-letter"><b>E</b></a>
19403 &nbsp;
19404 <a href="#General-index-1_cp_letter-F" class="summary-letter"><b>F</b></a>
19405 &nbsp;
19406 <a href="#General-index-1_cp_letter-G" class="summary-letter"><b>G</b></a>
19407 &nbsp;
19408 <a href="#General-index-1_cp_letter-H" class="summary-letter"><b>H</b></a>
19409 &nbsp;
19410 <a href="#General-index-1_cp_letter-I" class="summary-letter"><b>I</b></a>
19411 &nbsp;
19412 <a href="#General-index-1_cp_letter-J" class="summary-letter"><b>J</b></a>
19413 &nbsp;
19414 <a href="#General-index-1_cp_letter-K" class="summary-letter"><b>K</b></a>
19415 &nbsp;
19416 <a href="#General-index-1_cp_letter-L" class="summary-letter"><b>L</b></a>
19417 &nbsp;
19418 <a href="#General-index-1_cp_letter-M" class="summary-letter"><b>M</b></a>
19419 &nbsp;
19420 <a href="#General-index-1_cp_letter-N" class="summary-letter"><b>N</b></a>
19421 &nbsp;
19422 <a href="#General-index-1_cp_letter-O" class="summary-letter"><b>O</b></a>
19423 &nbsp;
19424 <a href="#General-index-1_cp_letter-P" class="summary-letter"><b>P</b></a>
19425 &nbsp;
19426 <a href="#General-index-1_cp_letter-R" class="summary-letter"><b>R</b></a>
19427 &nbsp;
19428 <a href="#General-index-1_cp_letter-S" class="summary-letter"><b>S</b></a>
19429 &nbsp;
19430 <a href="#General-index-1_cp_letter-T" class="summary-letter"><b>T</b></a>
19431 &nbsp;
19432 <a href="#General-index-1_cp_letter-U" class="summary-letter"><b>U</b></a>
19433 &nbsp;
19434 <a href="#General-index-1_cp_letter-V" class="summary-letter"><b>V</b></a>
19435 &nbsp;
19436 <a href="#General-index-1_cp_letter-W" class="summary-letter"><b>W</b></a>
19437 &nbsp;
19438 </td></tr></table>
19440 <hr size="1">
19441 <a name="SEC_Contents"></a>
19442 <table cellpadding="1" cellspacing="1" border="0">
19443 <tr><td valign="middle" align="left"><a href="#Top" title="Cover (top) of document"><img src="button-up-arrow.png" border="0" alt="Top: Gambit-C" align="middle" width="32"></a></td>
19444 <td valign="middle" align="left"><a href="#SEC_Contents" title="Table of contents"><img src="button-compass.png" border="0" alt="Contents: Table of Contents" align="middle" width="32"></a></td>
19445 <td valign="middle" align="left"><a href="#General-index" title="Index"><img src="button-abc.png" border="0" alt="Index: General index" align="middle" width="32"></a></td>
19446 </tr></table>
19447 <h1>Table of Contents</h1>
19448 <div class="contents">
19450 <ul class="toc">
19451 <li><a name="toc-The-Gambit_002dC-system-1" href="#The-Gambit_002dC-system">1. The Gambit-C system</a>
19452 <ul class="toc">
19453 <li><a name="toc-Accessing-the-system-files-1" href="#Accessing-the-system-files">1.1 Accessing the system files</a></li>
19454 </ul></li>
19455 <li><a name="toc-The-Gambit-Scheme-interpreter" href="#GSI">2. The Gambit Scheme interpreter</a>
19456 <ul class="toc">
19457 <li><a name="toc-Interactive-mode-1" href="#GSI-interactive-mode">2.1 Interactive mode</a></li>
19458 <li><a name="toc-Batch-mode-1" href="#GSI-batch-mode">2.2 Batch mode</a></li>
19459 <li><a name="toc-Customization-1" href="#GSI-customization">2.3 Customization</a></li>
19460 <li><a name="toc-Process-exit-status" href="#GSI-exit-status">2.4 Process exit status</a></li>
19461 <li><a name="toc-Scheme-scripts-1" href="#Scheme-scripts">2.5 Scheme scripts</a>
19462 <ul class="toc">
19463 <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>
19464 <li><a name="toc-Scripts-under-Microsoft-Windows-1" href="#Scripts-under-Microsoft-Windows">2.5.2 Scripts under Microsoft Windows</a></li>
19465 <li><a name="toc-Compiling-scripts-1" href="#Compiling-scripts">2.5.3 Compiling scripts</a></li>
19466 </ul>
19467 </li>
19468 </ul></li>
19469 <li><a name="toc-The-Gambit-Scheme-compiler" href="#GSC">3. The Gambit Scheme compiler</a>
19470 <ul class="toc">
19471 <li><a name="toc-Interactive-mode" href="#GSC-interactive-mode">3.1 Interactive mode</a></li>
19472 <li><a name="toc-Customization" href="#GSC-customization">3.2 Customization</a></li>
19473 <li><a name="toc-Batch-mode" href="#GSC-batch-mode">3.3 Batch mode</a></li>
19474 <li><a name="toc-Link-files-1" href="#Link-files">3.4 Link files</a>
19475 <ul class="toc">
19476 <li><a name="toc-Building-an-executable-program-1" href="#Building-an-executable-program">3.4.1 Building an executable program</a></li>
19477 <li><a name="toc-Building-a-loadable-library-1" href="#Building-a-loadable-library">3.4.2 Building a loadable library</a></li>
19478 <li><a name="toc-Building-a-shared_002dlibrary-1" href="#Building-a-shared_002dlibrary">3.4.3 Building a shared-library</a></li>
19479 <li><a name="toc-Other-compilation-options-1" href="#Other-compilation-options">3.4.4 Other compilation options</a></li>
19480 </ul></li>
19481 <li><a name="toc-Procedures-specific-to-compiler-1" href="#Procedures-specific-to-compiler">3.5 Procedures specific to compiler</a></li>
19482 </ul></li>
19483 <li><a name="toc-Runtime-options-1" href="#Runtime-options">4. Runtime options</a></li>
19484 <li><a name="toc-Debugging-1" href="#Debugging">5. Debugging</a>
19485 <ul class="toc">
19486 <li><a name="toc-Debugging-model-1" href="#Debugging-model">5.1 Debugging model</a></li>
19487 <li><a name="toc-Debugging-commands-1" href="#Debugging-commands">5.2 Debugging commands</a></li>
19488 <li><a name="toc-Debugging-example-1" href="#Debugging-example">5.3 Debugging example</a></li>
19489 <li><a name="toc-Procedures-related-to-debugging-1" href="#Procedures-related-to-debugging">5.4 Procedures related to debugging</a></li>
19490 <li><a name="toc-Console-line_002dediting-1" href="#Console-line_002dediting">5.5 Console line-editing</a></li>
19491 <li><a name="toc-Emacs-interface-1" href="#Emacs-interface">5.6 Emacs interface</a></li>
19492 <li><a name="toc-GUIDE-1" href="#GUIDE">5.7 GUIDE</a></li>
19493 </ul></li>
19494 <li><a name="toc-Scheme-extensions-1" href="#Scheme-extensions">6. Scheme extensions</a>
19495 <ul class="toc">
19496 <li><a name="toc-Extensions-to-standard-procedures-1" href="#Extensions-to-standard-procedures">6.1 Extensions to standard procedures</a></li>
19497 <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>
19498 <li><a name="toc-Miscellaneous-extensions-1" href="#Miscellaneous-extensions">6.3 Miscellaneous extensions</a></li>
19499 <li><a name="toc-Undocumented-extensions-1" href="#Undocumented-extensions">6.4 Undocumented extensions</a></li>
19500 </ul></li>
19501 <li><a name="toc-Namespaces-1" href="#Namespaces">7. Namespaces</a></li>
19502 <li><a name="toc-Characters-and-strings-1" href="#Characters-and-strings">8. Characters and strings</a>
19503 <ul class="toc">
19504 <li><a name="toc-Extensions-to-character-procedures-1" href="#Extensions-to-character-procedures">8.1 Extensions to character procedures</a></li>
19505 <li><a name="toc-Extensions-to-string-procedures-1" href="#Extensions-to-string-procedures">8.2 Extensions to string procedures</a></li>
19506 </ul></li>
19507 <li><a name="toc-Numbers-1" href="#Numbers">9. Numbers</a>
19508 <ul class="toc">
19509 <li><a name="toc-Extensions-to-numeric-procedures-1" href="#Extensions-to-numeric-procedures">9.1 Extensions to numeric procedures</a></li>
19510 <li><a name="toc-IEEE-floating-point-arithmetic-1" href="#IEEE-floating-point-arithmetic">9.2 IEEE floating point arithmetic</a></li>
19511 <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>
19512 <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>
19513 <li><a name="toc-Fixnum-specific-operations-1" href="#Fixnum-specific-operations">9.5 Fixnum specific operations</a></li>
19514 <li><a name="toc-Flonum-specific-operations-1" href="#Flonum-specific-operations">9.6 Flonum specific operations</a></li>
19515 <li><a name="toc-Pseudo-random-numbers-1" href="#Pseudo-random-numbers">9.7 Pseudo random numbers</a></li>
19516 </ul></li>
19517 <li><a name="toc-Homogeneous-vectors-1" href="#Homogeneous-vectors">10. Homogeneous vectors</a></li>
19518 <li><a name="toc-Hashing-and-weak-references-1" href="#Hashing-and-weak-references">11. Hashing and weak references</a>
19519 <ul class="toc">
19520 <li><a name="toc-Hashing-1" href="#Hashing">11.1 Hashing</a></li>
19521 <li><a name="toc-Weak-references-1" href="#Weak-references">11.2 Weak references</a>
19522 <ul class="toc">
19523 <li><a name="toc-Wills-1" href="#Wills">11.2.1 Wills</a></li>
19524 <li><a name="toc-Tables-1" href="#Tables">11.2.2 Tables</a></li>
19525 </ul>
19526 </li>
19527 </ul></li>
19528 <li><a name="toc-Records-1" href="#Records">12. Records</a></li>
19529 <li><a name="toc-Threads-1" href="#Threads">13. Threads</a>
19530 <ul class="toc">
19531 <li><a name="toc-Introduction-1" href="#Introduction">13.1 Introduction</a></li>
19532 <li><a name="toc-Thread-objects-1" href="#Thread-objects">13.2 Thread objects</a></li>
19533 <li><a name="toc-Mutex-objects-1" href="#Mutex-objects">13.3 Mutex objects</a></li>
19534 <li><a name="toc-Condition-variable-objects-1" href="#Condition-variable-objects">13.4 Condition variable objects</a></li>
19535 <li><a name="toc-Fairness-1" href="#Fairness">13.5 Fairness</a></li>
19536 <li><a name="toc-Memory-coherency-1" href="#Memory-coherency">13.6 Memory coherency</a></li>
19537 <li><a name="toc-Timeouts-1" href="#Timeouts">13.7 Timeouts</a></li>
19538 <li><a name="toc-Primordial-thread-1" href="#Primordial-thread">13.8 Primordial thread</a></li>
19539 <li><a name="toc-Procedures-1" href="#Procedures">13.9 Procedures</a></li>
19540 </ul></li>
19541 <li><a name="toc-Dynamic-environment-1" href="#Dynamic-environment">14. Dynamic environment</a></li>
19542 <li><a name="toc-Exceptions-1" href="#Exceptions">15. Exceptions</a>
19543 <ul class="toc">
19544 <li><a name="toc-Exception_002dhandling-1" href="#Exception_002dhandling">15.1 Exception-handling</a></li>
19545 <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>
19546 <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>
19547 <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>
19548 <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>
19549 <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>
19550 <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>
19551 <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>
19552 <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>
19553 <li><a name="toc-Other-exception-objects-1" href="#Other-exception-objects">15.10 Other exception objects</a></li>
19554 </ul></li>
19555 <li><a name="toc-Host-environment-1" href="#Host-environment">16. Host environment</a>
19556 <ul class="toc">
19557 <li><a name="toc-Handling-of-file-names-1" href="#Handling-of-file-names">16.1 Handling of file names</a></li>
19558 <li><a name="toc-Filesystem-operations-1" href="#Filesystem-operations">16.2 Filesystem operations</a></li>
19559 <li><a name="toc-Shell-command-execution-1" href="#Shell-command-execution">16.3 Shell command execution</a></li>
19560 <li><a name="toc-Process-termination-1" href="#Process-termination">16.4 Process termination</a></li>
19561 <li><a name="toc-Command-line-arguments-1" href="#Command-line-arguments">16.5 Command line arguments</a></li>
19562 <li><a name="toc-Environment-variables-1" href="#Environment-variables">16.6 Environment variables</a></li>
19563 <li><a name="toc-Measuring-time-1" href="#Measuring-time">16.7 Measuring time</a></li>
19564 <li><a name="toc-File-information-1" href="#File-information">16.8 File information</a></li>
19565 <li><a name="toc-Group-information-1" href="#Group-information">16.9 Group information</a></li>
19566 <li><a name="toc-User-information-1" href="#User-information">16.10 User information</a></li>
19567 <li><a name="toc-Host-information-1" href="#Host-information">16.11 Host information</a></li>
19568 <li><a name="toc-Service-information-1" href="#Service-information">16.12 Service information</a></li>
19569 <li><a name="toc-Protocol-information-1" href="#Protocol-information">16.13 Protocol information</a></li>
19570 <li><a name="toc-Network-information-1" href="#Network-information">16.14 Network information</a></li>
19571 </ul></li>
19572 <li><a name="toc-I_002fO-and-ports-1" href="#I_002fO-and-ports">17. I/O and ports</a>
19573 <ul class="toc">
19574 <li><a name="toc-Unidirectional-and-bidirectional-ports-1" href="#Unidirectional-and-bidirectional-ports">17.1 Unidirectional and bidirectional ports</a></li>
19575 <li><a name="toc-Port-classes-1" href="#Port-classes">17.2 Port classes</a></li>
19576 <li><a name="toc-Port-settings-1" href="#Port-settings">17.3 Port settings</a></li>
19577 <li><a name="toc-Object_002dports-1" href="#Object_002dports">17.4 Object-ports</a>
19578 <ul class="toc">
19579 <li><a name="toc-Object_002dport-settings-1" href="#Object_002dport-settings">17.4.1 Object-port settings</a></li>
19580 <li><a name="toc-Object_002dport-operations-1" href="#Object_002dport-operations">17.4.2 Object-port operations</a></li>
19581 </ul></li>
19582 <li><a name="toc-Character_002dports-1" href="#Character_002dports">17.5 Character-ports</a>
19583 <ul class="toc">
19584 <li><a name="toc-Character_002dport-settings-1" href="#Character_002dport-settings">17.5.1 Character-port settings</a></li>
19585 <li><a name="toc-Character_002dport-operations-1" href="#Character_002dport-operations">17.5.2 Character-port operations</a></li>
19586 </ul></li>
19587 <li><a name="toc-Byte_002dports-1" href="#Byte_002dports">17.6 Byte-ports</a>
19588 <ul class="toc">
19589 <li><a name="toc-Byte_002dport-settings-1" href="#Byte_002dport-settings">17.6.1 Byte-port settings</a></li>
19590 <li><a name="toc-Byte_002dport-operations-1" href="#Byte_002dport-operations">17.6.2 Byte-port operations</a></li>
19591 </ul></li>
19592 <li><a name="toc-Device_002dports-1" href="#Device_002dports">17.7 Device-ports</a>
19593 <ul class="toc">
19594 <li><a name="toc-Filesystem-devices-1" href="#Filesystem-devices">17.7.1 Filesystem devices</a></li>
19595 <li><a name="toc-Process-devices-1" href="#Process-devices">17.7.2 Process devices</a></li>
19596 <li><a name="toc-Network-devices-1" href="#Network-devices">17.7.3 Network devices</a></li>
19597 </ul></li>
19598 <li><a name="toc-Directory_002dports-1" href="#Directory_002dports">17.8 Directory-ports</a></li>
19599 <li><a name="toc-Vector_002dports-1" href="#Vector_002dports">17.9 Vector-ports</a></li>
19600 <li><a name="toc-String_002dports-1" href="#String_002dports">17.10 String-ports</a></li>
19601 <li><a name="toc-U8vector_002dports-1" href="#U8vector_002dports">17.11 U8vector-ports</a></li>
19602 <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>
19603 </ul></li>
19604 <li><a name="toc-Lexical-syntax-and-readtables-1" href="#Lexical-syntax-and-readtables">18. Lexical syntax and readtables</a>
19605 <ul class="toc">
19606 <li><a name="toc-Readtables-1" href="#Readtables">18.1 Readtables</a></li>
19607 <li><a name="toc-Boolean-syntax-1" href="#Boolean-syntax">18.2 Boolean syntax</a></li>
19608 <li><a name="toc-Character-syntax-1" href="#Character-syntax">18.3 Character syntax</a></li>
19609 <li><a name="toc-String-syntax-1" href="#String-syntax">18.4 String syntax</a></li>
19610 <li><a name="toc-Symbol-syntax-1" href="#Symbol-syntax">18.5 Symbol syntax</a></li>
19611 <li><a name="toc-Keyword-syntax-1" href="#Keyword-syntax">18.6 Keyword syntax</a></li>
19612 <li><a name="toc-Box-syntax-1" href="#Box-syntax">18.7 Box syntax</a></li>
19613 <li><a name="toc-Number-syntax-1" href="#Number-syntax">18.8 Number syntax</a></li>
19614 <li><a name="toc-Homogeneous-vector-syntax-1" href="#Homogeneous-vector-syntax">18.9 Homogeneous vector syntax</a></li>
19615 <li><a name="toc-Special-_0023_0021-syntax-1" href="#Special-_0023_0021-syntax">18.10 Special <code>#!</code> syntax</a></li>
19616 <li><a name="toc-Multiline-comment-syntax-1" href="#Multiline-comment-syntax">18.11 Multiline comment syntax</a></li>
19617 <li><a name="toc-Scheme-infix-syntax-extension-1" href="#Scheme-infix-syntax-extension">18.12 Scheme infix syntax extension</a>
19618 <ul class="toc">
19619 <li><a name="toc-SIX-grammar" href="#SIX-grammar">18.12.1 SIX grammar</a></li>
19620 <li><a name="toc-SIX-semantics" href="#SIX-semantics">18.12.2 SIX semantics</a></li>
19621 </ul>
19622 </li>
19623 </ul></li>
19624 <li><a name="toc-C_002dinterface-1" href="#C_002dinterface">19. C-interface</a>
19625 <ul class="toc">
19626 <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>
19627 <li><a name="toc-The-c_002ddeclare-special-form" href="#c_002ddeclare">19.2 The <code>c-declare</code> special form</a></li>
19628 <li><a name="toc-The-c_002dinitialize-special-form" href="#c_002dinitialize">19.3 The <code>c-initialize</code> special form</a></li>
19629 <li><a name="toc-The-c_002dlambda-special-form" href="#c_002dlambda">19.4 The <code>c-lambda</code> special form</a></li>
19630 <li><a name="toc-The-c_002ddefine-special-form" href="#c_002ddefine">19.5 The <code>c-define</code> special form</a></li>
19631 <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>
19632 <li><a name="toc-Continuations-and-the-C_002dinterface" href="#continuations">19.7 Continuations and the C-interface</a></li>
19633 </ul></li>
19634 <li><a name="toc-System-limitations-1" href="#System-limitations">20. System limitations</a></li>
19635 <li><a name="toc-Copyright-and-license-1" href="#Copyright-and-license">21. Copyright and license</a></li>
19636 <li><a name="toc-General-index-1" href="#General-index">General index</a></li>
19637 </ul>
19638 </div>
19640 </body>
19641 </html>