Debian Codegraph @

doc/impnotes.html

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation Notes for GNU CLISP</title><link rel="stylesheet" type="text/css" href="impnotes.css" /><link rev="made" href="mailto:[email protected]" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="description" content="This document describes the GNU CLISP - an implementation of the ANSI CL standard. See for instructions on how to report bugs (both in the software and the documentaion). See for information on CLISP support." /><meta name="keywords" content="Lisp, Common Lisp, CLISP" /><meta name="date" content="'generated: 2024-11-23 09:39:58+01:00'" /><link rel="author" title="Authors" href="#authors" /><link rel="contents" title="Table of Contents" href="index.html" /><link rel="glossary" href="#glossary" /><link rel="help" href="#faq-help" title="How do I ask for help?" /><link rel="home" title="Home" href="http://clisp.org" /><link rel="index" href="idx.html" /></head><body><div class="book"><div class="titlepage"><div><div><h1 class="title"><a id="impnotes-top"></a>Implementation Notes for <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h1></div><div><h2 class="subtitle">These notes document <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version 2.49.95+</h2></div><div><h3 class="corpauthor"><span class="inlinemediaobject"><img src="clisp.png" /></span></h3></div><div><div class="authorgroup"><a id="authors"></a><div class="author"><h3 class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></h3><span class="contrib">The original author and long-time maintainer.</span> </div><div class="author"><h3 class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></h3><span class="contrib">The original author.</span> </div><div class="author"><h3 class="author"><span class="firstname">Sam</span> <span class="surname">Steingold</span></h3><span class="contrib">Co-maintainer since 1998.</span> </div><div class="othercredit"><h3 class="othercredit"><span class="othername">Others</span></h3><span class="contrib">See
3 <span class="emphasis"><em><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/COPYRIGHT"><code class="filename">COPYRIGHT</code></a></em></span>
4 for the list of other contributors and the license.
5 </span> </div></div></div><div><p class="copyright">Copyright © 1992-2024 Bruno Haible</p></div><div><p class="copyright">Copyright © 1998-2018 Sam Steingold</p></div><div><div class="legalnotice"><a id="legalese"></a><p class="legalnotice-title"><strong>Legal Status of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
6 Implementation Notes</strong></p><p>These notes are dually licensed under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.
7 This means that you can redistribute this document under
8 either of these two licenses, at your choice.</p><p><strong>These notes are covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a>. </strong>Permission is granted to copy, distribute and/or modify this
9 document under the terms of the GNU Free Documentation License
10 (<a class="ulink" href="https://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a>), either version 1.2 of the License, or (at your option) any
11 later version published by the <a class="ulink" href="https://www.fsf.org" target="_top">Free Software Foundation (FSF)</a>;
12 with no Invariant Sections,
13 with no Front-Cover Text, and
14 with no Back-Cover Texts.
15 A copy of the license is included in <a class="xref" href="#fdl" title="Appendix B. GNU Free Documentation License">Appendix B, <em>GNU Free Documentation License</em></a>.
16 </p><p><strong>These notes are covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>. </strong>This document documents free software; you can redistribute it
17 and/or modify it under the terms of the GNU General Public License
18 (<a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>), either version 2 of the License, or (at your option) any
19 later version published by the <a class="ulink" href="https://www.fsf.org" target="_top">Free Software Foundation (FSF)</a>.
20 A copy of the license is included in <a class="xref" href="#gpl" title="Appendix C. GNU General Public License">Appendix C, <em>GNU General Public License</em></a>.
21 </p></div></div><div><div class="revhistory"><table style="border-style:solid; width:100%;" summary="Revision History"><tr><th align="left" valign="top" colspan="3"><strong>CLISP Release History</strong></th></tr><tr><td align="left">Release <span class="revnumber">1</span></td><td align="left"><span class="revdate">April 1987 - July 1992</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The project was
22 started when both original authors, <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span> and <span class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></span>, were
23 students in Germany.</li><li class="listitem">The original version was for <a class="ulink" href="http://www.atari.org/" target="_top"><span class="platform">Atari</span></a> ST only,
24 written in 68000 assembly language and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.0</span></td><td align="left"><span class="revdate">1992-10-09</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.os.linux">comp.os.linux</a>
25 announcement (<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> binaries only)</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.1</span></td><td align="left"><span class="revdate">1993-01-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The first portable
26 release, with source, released under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.</li><li class="listitem">Supported platforms: <a class="ulink" href="http://www.atari.org/" target="_top"><span class="platform">Atari</span></a> ST, <a class="ulink" href="http://www.amiga.org/" target="_top"><span class="platform">Amiga</span></a> 500-2000, <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>
27 (emx, djgpp), <a class="ulink" href="https://www.os2.org/" target="_top"><span class="platform">OS/2</span></a> (emx), Unix (<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>, Sun4, Sun386, HP9000/800).
28 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.1.1</span></td><td align="left"><span class="revdate">1993-01-11</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.1.2</span></td><td align="left"><span class="revdate">1993-02-01</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.1.3</span></td><td align="left"><span class="revdate">1993-02-03</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.2</span></td><td align="left"><span class="revdate">1993-02-21</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Add test suite.
29 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.2.1</span></td><td align="left"><span class="revdate">1993-03-04</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.2.2</span></td><td align="left"><span class="revdate">1993-03-19</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a>
30 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.3</span></td><td align="left"><span class="revdate">1993-03-30</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_load-time-value.html" target="_top"><code class="function">LOAD-TIME-VALUE</code></a></li><li class="listitem"><a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.3.1</span></td><td align="left"><span class="revdate">1993-04-05</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.4</span></td><td align="left"><span class="revdate">1993-05-24</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a></li><li class="listitem"><a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.5</span></td><td align="left"><span class="revdate">1993-06-29</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> function names.</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.5.1</span></td><td align="left"><span class="revdate">1993-07-17</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">immutable objects</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.6</span></td><td align="left"><span class="revdate">1993-08-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> package: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>,
31 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a>, <a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a>,
32 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-slots.html" target="_top"><code class="function">WITH-SLOTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-accessors.html" target="_top"><code class="function">WITH-ACCESSORS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>, (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>),
33 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_class-of.html" target="_top"><code class="function">CLASS-OF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>, (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>,
34 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-exists-p.html" target="_top"><code class="function">SLOT-EXISTS-P</code></a>,
35 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a>,
36 <a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_find-method.html" target="_top"><code class="function">FIND-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>,
37 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_com_able-methods.html" target="_top"><code class="function">COMPUTE-APPLICABLE-METHODS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a>,
38 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_fun_ion-keywords.html" target="_top"><code class="function">FUNCTION-KEYWORDS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-missing.html" target="_top"><code class="function">SLOT-MISSING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-unbound.html" target="_top"><code class="function">SLOT-UNBOUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>,
39 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_describe-object.html" target="_top"><code class="function">DESCRIBE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
40 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.6.1</span></td><td align="left"><span class="revdate">1993-09-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.7</span></td><td align="left"><span class="revdate">1993-09-27</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">top-level forms</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_declaim.html" target="_top"><code class="function">DECLAIM</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.8</span></td><td align="left"><span class="revdate">1993-11-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></li><li class="listitem">New module: STDWIN</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.9</span></td><td align="left"><span class="revdate">1994-01-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-condition.html" target="_top"><code class="function">DEFINE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_ignore-errors.html" target="_top"><code class="function">IGNORE-ERRORS</code></a>,
41 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-case.html" target="_top"><code class="function">HANDLER-CASE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>, <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a>,
42 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-simple-restart.html" target="_top"><code class="function">WITH-SIMPLE-RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-bind.html" target="_top"><code class="function">RESTART-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-cond_ion-restarts.html" target="_top"><code class="function">WITH-CONDITION-RESTARTS</code></a>,
43 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_serious-condition.html" target="_top"><code class="classname">SERIOUS-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>,
44 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_program-error.html" target="_top"><code class="classname">PROGRAM-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_control-error.html" target="_top"><code class="classname">CONTROL-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_arithmetic-error.html" target="_top"><code class="classname">ARITHMETIC-ERROR</code></a>,
45 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_division-by-zero.html" target="_top"><code class="classname">DIVISION-BY-ZERO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_int-overflow.html" target="_top"><code class="classname">FLOATING-POINT-OVERFLOW</code></a>,
46 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_cell-error.html" target="_top"><code class="classname">CELL-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_unbound-variable.html" target="_top"><code class="classname">UNBOUND-VARIABLE</code></a>,
47 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_undefined-function.html" target="_top"><code class="classname">UNDEFINED-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_package-error.html" target="_top"><code class="classname">PACKAGE-ERROR</code></a>,
48 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_stream-error.html" target="_top"><code class="classname">STREAM-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_end-of-file.html" target="_top"><code class="classname">END-OF-FILE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_file-error.html" target="_top"><code class="classname">FILE-ERROR</code></a>,
49 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_storage-condition.html" target="_top"><code class="classname">STORAGE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-condition.html" target="_top"><code class="classname">SIMPLE-CONDITION</code></a>,
50 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-error.html" target="_top"><code class="classname">SIMPLE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-type-error.html" target="_top"><code class="classname">SIMPLE-TYPE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-warning.html" target="_top"><code class="classname">SIMPLE-WARNING</code></a>,
51 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-condition.html" target="_top"><code class="function">MAKE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a>,
52 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-restart.html" target="_top"><code class="function">INVOKE-RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-re_nteractively.html" target="_top"><code class="function">INVOKE-RESTART-INTERACTIVELY</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">ABORT</code></a>,
53 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">MUFFLE-WARNING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">STORE-VALUE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">USE-VALUE</code></a>,
54 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-debugger.html" target="_top"><code class="function">INVOKE-DEBUGGER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_restart-name.html" target="_top"><code class="function">RESTART-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_arithmeti_or-operation.html" target="_top"><code class="function">ARITHMETIC-ERROR-OPERATION</code></a>,
55 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_arithmeti_or-operation.html" target="_top"><code class="function">ARITHMETIC-ERROR-OPERANDS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cell-error-name.html" target="_top"><code class="function">CELL-ERROR-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-DATUM</code></a>,
56 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_package-error-package.html" target="_top"><code class="function">PACKAGE-ERROR-PACKAGE</code></a>,
57 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-error-stream.html" target="_top"><code class="function">STREAM-ERROR-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-error-pathname.html" target="_top"><code class="function">FILE-ERROR-PATHNAME</code></a>,
58 <code class="function">EXT:SIMPLE-CONDITION-FORMAT-STRING</code>,
59 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_simple-co_at-arguments.html" target="_top"><code class="function">SIMPLE-CONDITION-FORMAT-ARGUMENTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a>,
60 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebugger-hookst.html" target="_top"><code class="varname">*DEBUGGER-HOOK*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.10</span></td><td align="left"><span class="revdate">1994-06-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>,
61 <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a></li><li class="listitem"><a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.11</span></td><td align="left"><span class="revdate">1994-07-04</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_loop-finish.html" target="_top"><code class="function">LOOP-FINISH</code></a>,
62 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_map-into.html" target="_top"><code class="function">MAP-INTO</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT</code></a>,
63 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT</code></a>,
64 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT</code></a>,
65 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT</code></a>,
66 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT</code></a>,
67 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT</code></a>,
68 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-LONG-FLOAT</code></a>,
69 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.12</span></td><td align="left"><span class="revdate">1994-08-23</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_destructuring-bind.html" target="_top"><code class="function">DESTRUCTURING-BIND</code></a></li><li class="listitem"><a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.12.1</span></td><td align="left"><span class="revdate">1994-09-01</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.13</span></td><td align="left"><span class="revdate">1994-10-26</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_wild-pathname-p.html" target="_top"><code class="function">WILD-PATHNAME-P</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>,
70 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a>,
71 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a>,
72 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a>
73 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.13.1</span></td><td align="left"><span class="revdate">1995-01-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.14</span></td><td align="left"><span class="revdate">1995-04-04</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_row-major-aref.html" target="_top"><code class="function">ROW-MAJOR-AREF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-package.html" target="_top"><code class="function">DELETE-PACKAGE</code></a>,
74 <a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a>, <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>, <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.15</span></td><td align="left"><span class="revdate">1995-04-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New modules: <code class="filename">wildcard</code>,
75 <span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_formatter.html" target="_top"><code class="function">FORMATTER</code></a>, <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>,
76 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>,
77 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a>,
78 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_synonym-stream-symbol.html" target="_top"><code class="function">SYNONYM-STREAM-SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_broadcast_ream-streams.html" target="_top"><code class="function">BROADCAST-STREAM-STREAMS</code></a>,
79 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatena_ream-streams.html" target="_top"><code class="function">CONCATENATED-STREAM-STREAMS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_two-way-s_utput-stream.html" target="_top"><code class="function">TWO-WAY-STREAM-INPUT-STREAM</code></a>,
80 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_two-way-s_utput-stream.html" target="_top"><code class="function">TWO-WAY-STREAM-OUTPUT-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_echo-stre_utput-stream.html" target="_top"><code class="function">ECHO-STREAM-INPUT-STREAM</code></a>,
81 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_echo-stre_utput-stream.html" target="_top"><code class="function">ECHO-STREAM-OUTPUT-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_print-not-readable.html" target="_top"><code class="classname">PRINT-NOT-READABLE</code></a>,
82 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_print-not_dable-object.html" target="_top"><code class="function">PRINT-NOT-READABLE-OBJECT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.16</span></td><td align="left"><span class="revdate">1995-06-23</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_complement.html" target="_top"><code class="function">COMPLEMENT</code></a>,
83 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_dynamic-extent.html" target="_top"><code class="literal">DYNAMIC-EXTENT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a>,
84 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ignorecm_ignorable.html" target="_top"><code class="literal">IGNORABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantly.html" target="_top"><code class="function">CONSTANTLY</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-hash_ble-iterator.html" target="_top"><code class="function">WITH-HASH-TABLE-ITERATOR</code></a>,
85 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-rehash-size.html" target="_top"><code class="function">HASH-TABLE-REHASH-SIZE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-tabl_sh-threshold.html" target="_top"><code class="function">HASH-TABLE-REHASH-THRESHOLD</code></a>,
86 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-size.html" target="_top"><code class="function">HASH-TABLE-SIZE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.17</span></td><td align="left"><span class="revdate">1996-07-21</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>, <a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a>, <a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a>, <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>,
87 <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a>, <a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>, <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a>, <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a>,
88 <code class="function">SOCKET:SOCKET-SERVICE-PORT</code>, <a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a>
89 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.18</span></td><td align="left"><span class="revdate">1997-05-03</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a>, <a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a>, <a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a></li><li class="listitem"><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.19</span></td><td align="left"><span class="revdate">1997-08-07</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="https://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.20</span></td><td align="left"><span class="revdate">1997-09-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-evalst.html" target="_top"><code class="varname">*READ-EVAL*</code></a></li><li class="listitem"><a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.20.1</span></td><td align="left"><span class="revdate">1997-12-06</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.21</span></td><td align="left"><span class="revdate">1998-09-09</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Removed module STDWIN.</li><li class="listitem"><a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a>, <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_oint-inexact.html" target="_top"><code class="classname">FLOATING-POINT-INEXACT</code></a>,
90 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_id-operation.html" target="_top"><code class="classname">FLOATING-POINT-INVALID-OPERATION</code></a></li><li class="listitem"><a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a>,
91 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ensure-di_tories-exist.html" target="_top"><code class="function">ENSURE-DIRECTORIES-EXIST</code></a></li><li class="listitem"> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-right-marginst.html" target="_top"><code class="varname">*PRINT-RIGHT-MARGIN*</code></a>,
92 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-displacement.html" target="_top"><code class="function">ARRAY-DISPLACEMENT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-structure.html" target="_top"><code class="function">COPY-STRUCTURE</code></a>,
93 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>,
94 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_special-operator-p.html" target="_top"><code class="function">SPECIAL-OPERATOR-P</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.22</span></td><td align="left"><span class="revdate">1999-01-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_extended-char.html" target="_top"><code class="classname">EXTENDED-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-string.html" target="_top"><code class="classname">BASE-STRING</code></a>,
95 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-base-string.html" target="_top"><code class="classname">SIMPLE-BASE-STRING</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a>,
96 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-setf-expander.html" target="_top"><code class="function">DEFINE-SETF-EXPANDER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_parse-error.html" target="_top"><code class="classname">PARSE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_reader-error.html" target="_top"><code class="classname">READER-ERROR</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unbound-slot-instance.html" target="_top"><code class="function">UNBOUND-SLOT-INSTANCE</code></a></li><li class="listitem"><a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a>, <a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.23</span></td><td align="left"><span class="revdate">1999-07-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New module:
97 <span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span></li><li class="listitem"><a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>, <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a>, <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>, <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>,
98 <a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>, <a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a> <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a>,
99 <code class="varname">AFFI:*FOREIGN-ENCODING*</code></li><li class="listitem"><a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-package-iterator.html" target="_top"><code class="function">WITH-PACKAGE-ITERATOR</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a></li><li class="listitem"><a class="xref" href="#weak-pointer" title="31.7.1. Weak Pointers">Section 31.7.1, “Weak Pointers”</a></li><li class="listitem"><a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a>, <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_simple-co_at-arguments.html" target="_top"><code class="function">SIMPLE-CONDITION-FORMAT-CONTROL</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.24</span></td><td align="left"><span class="revdate">2000-03-06</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a>,
100 <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a></li><li class="listitem"><a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>, <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-compilation-unit.html" target="_top"><code class="function">WITH-COMPILATION-UNIT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.25</span></td><td align="left"><span class="revdate">2001-03-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a>,
101 <code class="function">EXT:CLHS</code></li><li class="listitem"><a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-FROM-BYTES</code></a>,
102 <a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a></li><li class="listitem"><a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a>, <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a>, <a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a>, <a class="link" href="#rbwhp"><code class="function">GRAY:STREAM-READ-BYTE-WILL-HANG-P</code></a>, <a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a>,
103 <a class="link" href="#rbnh"><code class="function">GRAY:STREAM-READ-BYTE-NO-HANG</code></a></li><li class="listitem"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> improvements (UNC pathnames, registry,
104 screen)</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.25.1</span></td><td align="left"><span class="revdate">2001-04-06</span></td><td align="left">sds</td></tr><tr><td align="left">Release <span class="revnumber">2.26</span></td><td align="left"><span class="revdate">2001-05-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">dropped CLtL1,
105 added <code class="constant">:LISP=CL</code> to <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-compiler-macro.html" target="_top"><code class="function">DEFINE-COMPILER-MACRO</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a></li><li class="listitem"><a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> accept <code class="constant">:WAIT</code></li><li class="listitem">compiler checks function call signatures
106 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.27</span></td><td align="left"><span class="revdate">2001-07-17</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a>)</code></li><li class="listitem"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/install.bat"><code class="filename">src/install.bat</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.28</span></td><td align="left"><span class="revdate">2002-03-03</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] Pretty-Printer</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-load-form.html" target="_top"><code class="function">MAKE-LOAD-FORM</code></a>,
107 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-load_saving-slots.html" target="_top"><code class="function">MAKE-LOAD-FORM-SAVING-SLOTS</code></a></li><li class="listitem"><a class="xref" href="#weak-ht" title="31.7.9. Weak Hash Tables">Section 31.7.9, “Weak Hash Tables”</a></li><li class="listitem"><a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a></li><li class="listitem"><a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.29</span></td><td align="left"><span class="revdate">2002-07-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bug-fix/portability:
108 <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 3.1 etc</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.30</span></td><td align="left"><span class="revdate">2002-09-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Do not bundle
109 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libsigsegv/" target="_top">libsigsegv</a>.</li><li class="listitem"><a class="link" href="#charset-UCS-4"><code class="constant">CHARSET:UCS-4</code></a></li><li class="listitem"><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></li><li class="listitem"><a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a></li><li class="listitem"><a class="link" href="#stream-lock"><code class="function">POSIX:STREAM-LOCK</code></a>, <a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a>,
110 <a class="link" href="#dup-handle"><code class="function">POSIX:DUPLICATE-HANDLE</code></a></li><li class="listitem">New module: <span class="module"><a class="filename" href="#oracle" title="33.10. Oracle Interface"><code class="filename">oracle</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.31</span></td><td align="left"><span class="revdate">2003-09-01</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">New modules:
111 <span class="module"><a class="filename" href="#fastcgi" title="33.18. The FastCGI Interface"><code class="filename">fastcgi</code></a></span>, <span class="module"><a class="filename" href="#dir-key" title="33.8. Directory Access"><code class="filename">dirkey</code></a></span>, <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/win32/"><code class="filename">bindings/win32</code></a></span>,
112 <span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span>, <span class="module"><a class="filename" href="#netica" title="33.14. Netica Interface"><code class="filename">netica</code></a></span></li><li class="listitem">Support modules on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</li><li class="listitem"><a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> 3.2</li><li class="listitem">New backquote implementation.</li><li class="listitem">Many [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] compliance fixes.</li><li class="listitem">More <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> functionality.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.32</span></td><td align="left"><span class="revdate">2003-12-29</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">support
113 <a class="ulink" href="http://www.unix.org/version2/whatsnew/lfs.html" target="_top"><span class="platform">LFS</span></a></li><li class="listitem">New modules: <span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span>,
114 <span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span></li></ul></div>
115 </td></tr><tr><td align="left">Release <span class="revnumber">2.33</span></td><td align="left"><span class="revdate">2004-03-17</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a>,
116 <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>, <a class="link" href="#argv" title="25.3.5. Function EXT:ARGV"><code class="function">EXT:ARGV</code></a>, <a class="link" href="#st-position"><code class="function">GRAY:STREAM-POSITION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a></li><li class="listitem">Portability: removed <a class="ulink" href="https://en.wikipedia.org/wiki/Acorn_Computers" target="_top"><span class="platform">Acorn</span></a> and <a class="ulink" href="http://www.amiga.org/" target="_top"><span class="platform">Amiga</span></a> support,
117 fixed UNIXes.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.33.1</span></td><td align="left"><span class="revdate">2004-05-22</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bug-fixes, portability:
118 <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 3.4</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.33.2</span></td><td align="left"><span class="revdate">2004-06-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portability: RedHat Fedora
119 <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>/x86</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.34</span></td><td align="left"><span class="revdate">2005-07-20</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a></li><li class="listitem"><a class="xref" href="#weak" title="31.7. Weak Objects">Section 31.7, “Weak Objects”</a></li><li class="listitem"><a class="xref" href="#package-case" title="11.5. Package Case-Sensitivity">Section 11.5, “Package Case-Sensitivity”</a></li><li class="listitem"><a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>,
120 <a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a></li><li class="listitem">Portability: removed <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a> and <a class="ulink" href="https://www.os2.org/" target="_top"><span class="platform">OS/2</span></a>
121 support.</li><li class="listitem">New modules: <span class="module"><a class="filename" href="#matlab" title="33.13. Matlab Interface"><code class="filename">matlab</code></a></span>, <span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span>, <span class="module"><a class="filename" href="#zlib" title="33.16. Interface to zlib"><code class="filename">zlib</code></a></span>,
122 <span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span>, <span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.35</span></td><td align="left"><span class="revdate">2005-08-29</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a></li><li class="listitem"><a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a>, <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a>,
123 <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a></li><li class="listitem"><a class="link" href="#fcntl"><code class="function">POSIX:STREAM-OPTIONS</code></a></li><li class="listitem">Close all <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s before
124 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html"><code class="function">exec</code></a>.</li></ul></div>
125 </td></tr><tr><td align="left">Release <span class="revnumber">2.36</span></td><td align="left"><span class="revdate">2005-12-04</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a>, <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>,
126 <a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a>, <a class="link" href="#base64"><code class="constant">BASE64</code></a>
127 </li><li class="listitem"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/clx/new-clx/demos/koch.lisp"><code class="filename">modules/clx/new-clx/demos/koch.lisp</code></a></li><li class="listitem"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvw_sigterm.d"><code class="filename">src/spvw_sigterm.d</code></a></li></ul></div>
128 </td></tr><tr><td align="left">Release <span class="revnumber">2.37</span></td><td align="left"><span class="revdate">2006-01-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a> accepts
129 <code class="constant">:INTERFACE</code> and <code class="constant">:BACKLOG</code>.
130 </li><li class="listitem">Fixed <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a>)</code>.
131 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.38</span></td><td align="left"><span class="revdate">2006-01-24</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> creates standalone
132 executables.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.39</span></td><td align="left"><span class="revdate">2006-07-16</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Reliable stack
133 overflow detection and recovery.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.40</span></td><td align="left"><span class="revdate">2006-09-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Keep doc string and <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> in the closure object.
134 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.41</span></td><td align="left"><span class="revdate">2006-10-13</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a></li><li class="listitem">New module: <span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.42</span></td><td align="left"><span class="revdate">2007-10-16</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="#defstruct-mop" title="8.2. The structure Meta-Object Protocol">Section 8.2, “The structure Meta-Object Protocol”</a></li><li class="listitem"><a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a></li><li class="listitem">Many additions to
135 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/demos/"><code class="filename">modules/clx/new-clx/demos/</code></a>
136 </li><li class="listitem">New modules: <span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span>, <span class="module"><a class="filename" href="#gdbm" title="33.6. GDBM - The GNU database manager"><code class="filename">gdbm</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.43</span></td><td align="left"><span class="revdate">2007-11-18</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build process is now in compliance
137 with the GNU standards.</li><li class="listitem">Use <span class="command"><strong>gnulib-tool</strong></span> to sync
138 with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gnulib/" target="_top">Portability Library</a>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.44</span></td><td align="left"><span class="revdate">2008-02-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Do not bundle <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libffcall/" target="_top">libffcall</a>.
139 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.44.1</span></td><td align="left"><span class="revdate">2008-02-24</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portability: work around
140 <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> <a class="ulink" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34300" target="_top">bug
141 34300</a> present in <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 4.2 and 4.3.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.45</span></td><td align="left"><span class="revdate">2008-05-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Just-In-Time compilation (<span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>)
142 via <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/lightning/" target="_top">lightning</a>.</li><li class="listitem"><a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> accept <code class="constant">:VERSION</code>.
143 </li><li class="listitem"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> commands accept arguments.</li><li class="listitem"><a class="xref" href="#stdio" title="33.2.14. Standard file input and output">Section 33.2.14, “Standard file input and output”</a>.</li><li class="listitem">Fixed cross-compilation.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.46</span></td><td align="left"><span class="revdate">2008-07-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="constant">:WORD-SIZE=64</code> in
144 <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> on 64-bit platforms.</li><li class="listitem"><a class="xref" href="#errno" title="33.2.15. Error handling">Section 33.2.15, “Error handling”</a>.</li><li class="listitem">Macro <code class="function">XLIB:WITH-OPEN-DISPLAY</code>.
145 </li><li class="listitem">Fixed the remaining bugs in
146 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> bindings in evaluated code on <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> platforms.
147 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.47</span></td><td align="left"><span class="revdate">2008-10-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New module: <span class="module"><a class="filename" href="#dbus" title="33.19. Interface to D-Bus"><code class="filename">dbus</code></a></span></li><li class="listitem"><a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a></li><li class="listitem"><a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a></li><li class="listitem"><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></li><li class="listitem"><a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.48</span></td><td align="left"><span class="revdate">2009-07-28</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Thread support
148 (<span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>), see <a class="xref" href="#mt" title="32.5. Multiple Threads of Execution">Section 32.5, “Multiple Threads of Execution”</a></li><li class="listitem"><a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a>
149 </li><li class="listitem">
150 <a class="link" href="#trim-if" title="17.1.1. Function EXT:TRIM-IF"><code class="function">EXT:TRIM-IF</code></a>
151 </li><li class="listitem">
152 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/m4/clisp.m4"><code class="filename">src/m4/clisp.m4</code></a>
153 </li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.49</span></td><td align="left"><span class="revdate">2010-07-07</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a>; <a class="link" href="#mod-dynload" title="32.2.5. Dynamic module loading">dynamic
154 modules</a> are now the default build option</li><li class="listitem"><code class="option"><a href="clisp.html#opt-norl" class="olink">-disable-readline</a></code></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss065.html" target="_top">COMPILER-DIAGNOSTICS:USE-HANDLER</a></li><li class="listitem">Updated <span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span></li></ul></div></td></tr></table></div></div><div><div class="abstract"><a id="clisp-abstract"></a><p class="title"><strong>Abstract</strong></p><p>This document describes the
155 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> - an implementation of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p><p>See <a href="clisp.html#bugs" class="olink">the section called “Bugs”</a> for instructions
156 on how to report bugs (both in the software and the documentaion).</p><p>See <a href="impnotes.html#faq-help" class="olink">Q: A.1.1.5</a> for
157 information on <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> support.</p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="preface"><a href="#overview">Overview</a></span></dt><dt><span class="preface"><a href="#conventions">Conventions</a></span></dt><dt><span class="part"><a href="#clhs-chapters">I. Chapters or the Common Lisp HyperSpec</a></span></dt><dd><dl><dt><span class="chapter"><a href="#intro">1. Introduction chap-1</a></span></dt><dd><dl><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></dd><dt><span class="chapter"><a href="#syntax">2. Syntax chap-2</a></span></dt><dd><dl><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt></dl></dd><dt><span class="chapter"><a href="#eval">3. Evaluation and Compilation chap-3</a></span></dt><dd><dl><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#types-classes">4. Types and Classes chap-4</a></span></dt><dd><dl><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></dd><dt><span class="chapter"><a href="#data">5. Data and Control Flow chap-5</a></span></dt><dd><dl><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#iteration">6. Iteration chap-6</a></span></dt><dd><dl><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#objects">7. Objects chap-7</a></span></dt><dd><dl><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#structures">8. Structures chap-8</a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conditions">9. Conditions chap-9</a></span></dt><dd><dl><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></dd><dt><span class="chapter"><a href="#symbols">10. Symbols chap-10</a></span></dt><dt><span class="chapter"><a href="#packages">11. Packages chap-11</a></span></dt><dd><dl><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt></dl></dd><dt><span class="chapter"><a href="#numbers">12. Numbers chap-12</a></span></dt><dd><dl><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#characters">13. Characters chap-13</a></span></dt><dd><dl><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conses">14. Conses chap-14</a></span></dt><dd><dl><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#arrays">15. Arrays chap-15</a></span></dt><dd><dl><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#strings">16. Strings chap-16</a></span></dt><dd><dl><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#sequences">17. Sequences chap-17</a></span></dt><dd><dl><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> &amp; <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> &amp; <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> &amp; <code class="function">STABLE-SORT</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#hash">18. Hash Tables chap-18</a></span></dt><dd><dl><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#filenames">19. Filenames chap-19</a></span></dt><dd><dl><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#files">20. Files chap-20</a></span></dt><dd><dl><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt></dl></dd><dt><span class="chapter"><a href="#streams">21. Streams chap-21</a></span></dt><dd><dl><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
158 and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
159 </a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#printer">22. Printer chap-22</a></span></dt><dd><dl><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> &amp; <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></dd><dt><span class="chapter"><a href="#reader">23. Reader chap-23</a></span></dt><dd><dl><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#system">24. System Construction chap-24</a></span></dt><dd><dl><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></dd><dt><span class="chapter"><a href="#environment">25. Environment chap-25</a></span></dt><dd><dl><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">26. Glossary chap-26</a></span></dt><dt><span class="chapter"><a href="#appendix">27. Appendix chap-a</a></span></dt><dt><span class="chapter"><a href="#issues">28. X3J13 Issue Index [CLHS-ic]</a></span></dt></dl></dd><dt><span class="part"><a href="#ext-standard">II. Common Portable Extensions</a></span></dt><dd><dl><dt><span class="chapter"><a href="#mop-chap">29. Meta-Object Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt></dl></dd><dt><span class="chapter"><a href="#gray">30. Gray streams</a></span></dt><dd><dl><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#ext-clisp">III. Extensions Specific to <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="chapter"><a href="#ext-p-indep">31. Platform Independent Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-platform">32. Platform Specific Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dt><span class="section"><a href="#os-env">32.8. Operating System Environment</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-modules">33. Extensions Implemented as Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#internals">IV. Internals of the <span class="command"><strong>CLISP</strong></span> Implementation</a></span></dt><dd><dl><dt><span class="chapter"><a href="#source-files">34. The source files of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#gc">35. Overview of <span class="command"><strong>CLISP</strong></span>'s Garbage Collection</a></span></dt><dd><dl><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></dd><dt><span class="chapter"><a href="#extend">36. Extending <span class="command"><strong>CLISP</strong></span> Core</a></span></dt><dd><dl><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bytecode">37. The <span class="command"><strong>CLISP</strong></span> bytecode specification</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#appendices">V. Appendices</a></span></dt><dd><dl><dt><span class="appendix"><a href="#faq">A. Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="appendix"><a href="#fdl">B. GNU Free Documentation License</a></span></dt><dt><span class="appendix"><a href="#gpl">C. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></dd></dl></dd><dt><span class="index"><a href="#idx">Index</a></span></dt><dt><span class="bibliography"><a href="#references">References</a></span></dt></dl></div><div class="list-of-figures"><p><strong>List of Figures</strong></p><dl><dt>29.1. <a href="#mop-mo-cl-inheritance-fig">Inheritance structure of metaobject classes</a></dt><dt>29.2. <a href="#mop-cl-Inheritance-fig">Inheritance structure of class metaobject classes</a></dt><dt>29.3. <a href="#mop-sd-inheritance-fig">Inheritance structure of slot definition metaobject classes</a></dt><dt>29.4. <a href="#mop-gf-inheritance-fig">Inheritance structure of generic function metaobject classes</a></dt><dt>29.5. <a href="#mop-meth-inheritance-fig">Inheritance structure of method metaobject classes</a></dt><dt>29.6. <a href="#mop-specializers-inheritance-fig">Inheritance structure of specializer metaobject classes</a></dt><dt>29.7. <a href="#mop-meth-comb-inheritance-fig">Inheritance structure of method combination metaobject classes</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1. <a href="#conventions-tab">Mark-up conventions</a></dt><dt>3.1. <a href="#eval-limits-table">Function call limits</a></dt><dt>12.1. <a href="#bool-op-table">Boolean operations</a></dt><dt>12.2. <a href="#fixnum-lim-table">Fixnum limits</a></dt><dt>13.1. <a href="#char-code-limit-table">Number of characters</a></dt><dt>13.2. <a href="#standard-char-table">Standard characters</a></dt><dt>13.3. <a href="#semi-standard-char-table">Semi-standard characters</a></dt><dt>13.4. <a href="#extra-named-chars-table">Additional Named Characters</a></dt><dt>13.5. <a href="#ctrl-char-table">Additional syntax for characters with code from <span class="keycode">#x00</span> to <span class="keycode">#x1F</span>:</a></dt><dt>13.6. <a href="#dos-win32-chars-table">Additional characters (<span class="platform">Win32</span> platform only.)</a></dt><dt>13.7. <a href="#unix-chars-table">Additional characters (<span class="strong"><strong>UNIX</strong></span> platform only.)</a></dt><dt>13.8. <a href="#char-bits-table">Character bit constants (obsolete)</a></dt><dt>15.1. <a href="#array-limit-table">Array limits</a></dt><dt>19.1. <a href="#min-filename-syntax-table">The minimum filename syntax that may be used portably</a></dt><dt>25.1. <a href="#debugger-main-deb-step">Commands common to the main loop, the debugger and the stepper</a></dt><dt>25.2. <a href="#debugger-deb-step">Commands common to the debugger and the stepper</a></dt><dt>25.3. <a href="#debugger-deb-step-1">Commands common to the debugger and the stepper</a></dt><dt>25.4. <a href="#debugger-eval-apply">Commands specific to <code class="function">EVAL</code>/<code class="function">APPLY</code></a></dt><dt>25.5. <a href="#debugger-deb">Commands specific to the debugger</a></dt><dt>25.6. <a href="#debugger-step">Commands specific to the stepper</a></dt><dt>25.7. <a href="#internal-time-units-table">Time granularity</a></dt><dt>29.1. <a href="#mop-inherit-struct">Direct Superclass Relationships Among The Specified Metaobject Classes</a></dt><dt>29.2. <a href="#class-mo-initargs">Initialization arguments and accessors for class metaobjects</a></dt><dt>29.3. <a href="#slotd-mo-initargs">Initialization arguments and accessors for slot definition metaobjects</a></dt><dt>29.4. <a href="#gf-mo-initargs">Initialization arguments and accessors for generic function metaobjects</a></dt><dt>29.5. <a href="#mop-meth-initargs">Initialization arguments and accessors for method metaobjects</a></dt><dt>29.6. <a href="#mop-sa-instance-struct-table">The correspondence between slot access function and underlying slot access generic function</a></dt><dt>35.1. <a href="#mem-models-comb-typecodes">Memory models with <span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a></dt><dt>35.2. <a href="#mem-models-comb-heapcodes">Memory models with <span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>21.1. <a href="#readline-extend-ex">Dialog with user using completion</a></dt><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt><dt>30.1. <a href="#ex-fill-stream">Example of <code class="classname">EXT:FILL-STREAM</code> usage</a></dt><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt><dt>33.1. <a href="#ex-re-match"><code class="function">REGEXP:MATCH</code></a></dt><dt>33.2. <a href="#ex-re-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></dt><dt>33.3. <a href="#re-count-shell-users">Count unix shell users</a></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="overview"></a>Overview</h1></div></div></div><p>These notes discuss the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> by <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span>
160 and <span class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></span>. The current maintainers are <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span> and <span class="author"><span class="firstname">Sam</span> <span class="surname">Steingold</span></span>.</p><p>This implementation is mostly conforming to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
161 available on-line as the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] (but the printed <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> document
162 remains the authoritative source of information). [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] supersedes
163 the earlier specifications <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> and <a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a>.</p><p>The first part of these notes, <a class="xref" href="#clhs-chapters" title="Part I. Chapters or the Common Lisp HyperSpec">Part I, “Chapters or the Common Lisp HyperSpec”</a>,
164 is indexed in parallel to the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] and documents how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
165 implements the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p><p>The second part, <a class="xref" href="#ext-standard" title="Part II. Common Portable Extensions">Part II, “Common Portable Extensions”</a>, documents the
166 common extensions to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], specifically <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> and <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>
167 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p><p>The third part, <a class="xref" href="#ext-clisp" title="Part III. Extensions Specific to CLISP">Part III, “Extensions Specific to <span class="command"><strong>CLISP</strong></span>”</a>, documents the
168 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific extensions, e.g., <a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a>.</p><p>The fourth part, <a class="xref" href="#internals" title="Part IV. Internals of the CLISP Implementation">Part IV, “Internals of the <span class="command"><strong>CLISP</strong></span> Implementation”</a>, is intended mostly
169 for developers as it documents the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internals, e.g., <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion,
170 adding new built-ins, and the <a href="impnotes.html#bytecode" class="olink">bytecode</a>s generated by the compiler
171 (i.e., what is printed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>).</p></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="conventions"></a>Conventions</h1></div></div></div><p>The following is the mark-up notations used in this document:
172 </p><div class="table"><a id="conventions-tab"></a><p class="title"><strong>Table 1. Mark-up conventions</strong></p><div class="table-contents"><table class="table" summary="Mark-up conventions" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Object Kind</th><th align="center">Example</th></tr></thead><tbody><tr><td align="center">Function</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a></td></tr><tr><td align="center">Variable</td><td align="center"><a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a></td></tr><tr><td align="center">Formal Argument</td><td align="center"><em class="replaceable"><code>x</code></em></td></tr><tr><td align="center">Keyword</td><td align="center"><code class="constant">:EOF</code></td></tr><tr><td align="center">Number</td><td align="center"><code class="literal">0</code></td></tr><tr><td align="center">Character</td><td align="center"><span class="keysym">#\Newline</span></td></tr><tr><td align="center">Class, type</td><td align="center"><a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction</td><td align="center"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a></td></tr><tr><td align="center">Standard <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> keyword</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a></td></tr><tr><td align="center">Declaration</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ftype.html" target="_top"><code class="literal">FTYPE</code></a></td></tr><tr><td align="center">Package</td><td align="center"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></td></tr><tr><td align="center">Real file</td><td align="center"><a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a></td></tr><tr><td align="center">Abstract file</td><td align="center"><code class="filename">#P".c"</code></td></tr><tr><td align="center">Code (you are likely to type it)</td><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> 1 2)</code></td></tr><tr><td align="center">Data (<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is likely to print it)</td><td align="center"><span class="data"><code class="literal">#(1 2 3)</code></span></td></tr><tr><td align="center">Program listing</td><td align="center"><pre class="programlisting">
173 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> cycle-length (n <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (len 1) (top 0))
174 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> n 1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> len top))
175 ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_evenpcm_oddp.html" target="_top"><code class="function">EVENP</code></a> n) (cycle-length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ash.html" target="_top"><code class="function">ASH</code></a> n -1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> len) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maxcm_min.html" target="_top"><code class="function">MAX</code></a> top n)))
176 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((next (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_st.html" target="_top"><code class="function">*</code></a> 3 n))))
177 (cycle-length next (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> len) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maxcm_min.html" target="_top"><code class="function">MAX</code></a> top next))))))</pre></td></tr><tr><td align="center">Bytecode instruction</td><td align="center"><span class="byte"><code class="literal">(STOREV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td></tr><tr><td align="center">First mention of an entity</td><td align="center"><strong class="first"><em class="firstterm">firstterm</em></strong></td></tr><tr><td align="center">External <a href="impnotes.html#modules" class="olink">module</a></td><td align="center"><span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span>, <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span></td></tr><tr><td align="center">Command line argument</td><td align="center"><code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code></td></tr><tr><td align="center">Interaction</td><td align="center"><pre class="screen">Computer output
178 <strong><code class="prompt">Prompt:</code></strong> <big><strong class="userinput"><code>user input</code></strong></big></pre>
179 </td></tr></tbody></table></div></div><p><br class="table-break" /></p></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="clhs-chapters"></a>Part I. Chapters or the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>]</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#intro">1. Introduction chap-1</a></span></dt><dd><dl><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></dd><dt><span class="chapter"><a href="#syntax">2. Syntax chap-2</a></span></dt><dd><dl><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt><dd><dl><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#eval">3. Evaluation and Compilation chap-3</a></span></dt><dd><dl><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> &amp; <code class="function">DEFMACRO</code></a></span></dt></dl></dd><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></dd><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dd><dl><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt><dd><dl><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#types-classes">4. Types and Classes chap-4</a></span></dt><dd><dl><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dd><dl><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></dd><dt><span class="chapter"><a href="#data">5. Data and Control Flow chap-5</a></span></dt><dd><dl><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#iteration">6. Iteration chap-6</a></span></dt><dd><dl><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dd><dl><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></dd><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#objects">7. Objects chap-7</a></span></dt><dd><dl><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#structures">8. Structures chap-8</a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></dd><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conditions">9. Conditions chap-9</a></span></dt><dd><dl><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></dd><dt><span class="chapter"><a href="#symbols">10. Symbols chap-10</a></span></dt><dt><span class="chapter"><a href="#packages">11. Packages chap-11</a></span></dt><dd><dl><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></dd><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt><dd><dl><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#numbers">12. Numbers chap-12</a></span></dt><dd><dl><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt><dd><dl><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#characters">13. Characters chap-13</a></span></dt><dd><dl><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dd><dl><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></dd><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></dd><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dd><dl><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></dd><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conses">14. Conses chap-14</a></span></dt><dd><dl><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#arrays">15. Arrays chap-15</a></span></dt><dd><dl><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#strings">16. Strings chap-16</a></span></dt><dd><dl><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sequences">17. Sequences chap-17</a></span></dt><dd><dl><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></dd><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></dd><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> &amp; <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> &amp; <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> &amp; <code class="function">STABLE-SORT</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#hash">18. Hash Tables chap-18</a></span></dt><dd><dl><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></dd><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#filenames">19. Filenames chap-19</a></span></dt><dd><dl><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></dd><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#files">20. Files chap-20</a></span></dt><dd><dl><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></dd><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#streams">21. Streams chap-21</a></span></dt><dd><dl><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></dd><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dd><dl><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> &amp; <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> &amp; <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></dd><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dd><dl><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></dd><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
180 and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
181 </a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#printer">22. Printer chap-22</a></span></dt><dd><dl><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dd><dl><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></dd><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dd><dl><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></dd><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> &amp; <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></dd><dt><span class="chapter"><a href="#reader">23. Reader chap-23</a></span></dt><dd><dl><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#system">24. System Construction chap-24</a></span></dt><dd><dl><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></dd><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></dd><dt><span class="chapter"><a href="#environment">25. Environment chap-25</a></span></dt><dd><dl><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></dd><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> &amp; <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
182 </a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></dd><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">26. Glossary chap-26</a></span></dt><dt><span class="chapter"><a href="#appendix">27. Appendix chap-a</a></span></dt><dt><span class="chapter"><a href="#issues">28. X3J13 Issue Index [CLHS-ic]</a></span></dt></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="intro"></a>Chapter 1. Introduction
183 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-1.html">[chap-1]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spec-symb"></a>1.1. Special Symbols
184 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-4-1-3.html">[sec_1-4-1-3]</a></h2></div></div></div><p>The <strong class="first"><em class="firstterm">final delimiter
185 <a id="fin-delim" class="indexterm"></a></em></strong>
186 of an interactive stream:
187 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></span></dt><dd>type <span class="keycap"><strong>Control</strong></span>+<span class="keysym">D</span>
188 at the beginning of a line</dd><dt><span class="term"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a></span></dt><dd>type <span class="keycap"><strong>Control</strong></span>+<span class="keysym">Z</span>,
189 followed by <span class="keycap"><strong>Enter</strong></span></dd></dl></div><p>
190 This final delimiter is never actually seen by programs; no need to
191 test for <span class="keysym">#\^D</span> or <span class="keysym">#\^Z</span> - use
192 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a> to check for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>.</p><p>A newline character can be entered by the user by pressing the
193 <span class="keycap"><strong>Enter</strong></span> key.</p><p>See also <a class="xref" href="#clear-input" title="21.13. Function CLEAR-INPUT">Section 21.13, “Function <code class="function">CLEAR-INPUT</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="error-terms"></a>1.2. Error Terminology
194 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-4-2.html">[sec_1-4-2]</a></h2></div></div></div><p>Safety settings are ignored by the interpreted code;
195 therefore where the standard uses the phrase <span class="quote">“<span class="quote">should signal an
196 error</span>”</span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
197 See <a class="xref" href="#safety-decl" title="3.3.5. Declaration SAFETY">Section 3.3.5, “Declaration <code class="literal">SAFETY</code>”</a> for the safety of compiled code.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cl-symb"></a>1.3. Symbols in the Package <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>
198 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-9.html">[sec_1-9]</a></h2></div></div></div><p>All 978 symbols in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> package specified by the
199 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] are implemented.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="syntax"></a>Chapter 2. Syntax <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-2.html">[chap-2]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt><dd><dl><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std-char"></a>2.1. Standard Characters
200 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-3.html">[sec_2-1-3]</a></h2></div></div></div><p>The standard characters are <span class="keysym">#\Newline</span> and the
201 <a class="link" href="#graph-char" title="13.5. Graphic Characters sec_13-1-4-1">graphic characters</a>
202 with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> between 32 and 126 (inclusive).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="reader-alg"></a>2.2. Reader Algorithm
203 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-2.html">[sec_2-2]</a></h2></div></div></div><p>The requirement of step 4 that a <span class="quote">“<span class="quote"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#reader_macro_function">reader
204 macro function</a> may return zero values or one value</span>”</span>
205 <span class="strong"><strong>is</strong></span> enforced. You can use the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> to control the
206 number of values returned.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="tokens"></a>2.3. Symbols as Tokens
207 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-3-4.html">[sec_2-3-4]</a></h2></div></div></div><p>A <strong class="first"><em class="firstterm">reserved token
208 <a id="res-token" class="indexterm"></a></em></strong>,
209 i.e., a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#token">token</a> that has
210 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#potential_number">potential number</a> syntax but cannot be
211 interpreted as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, is interpreted as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> when being
212 read.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="valid-patterns"></a>2.4. Valid Patterns for Tokens
213 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-3-5.html">[sec_2-3-5]</a></h2></div></div></div><p>When a token with package markers is read, then no checking is
214 done whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-package.html" target="_top"><code class="function">SYMBOL-PACKAGE</code></a> part and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> part do
215 not have number syntax. (What would the purpose of this check be?)
216 So we consider tokens like <span class="token">USER::</span> or <span class="token">:1</span> or
217 <span class="token">LISP::4711</span> or <span class="token">21:3</span> as symbols.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="backquote"></a>2.5. Backquote
218 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-6.html">[sec_2-4-6]</a></h2></div></div></div><p>The backquote read macro also works when nested. Example:
219 <a id="bq-nested"></a></p><pre class="programlisting">
220 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> ``(,#'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',a) ,#'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',b)))
221 ≡ (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> `(list #'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',a) #'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',b)))
222 ≡ (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> (list 'list (list 'function (list 'lambda nil (list 'quote a)))
223 (list 'function (list 'lambda nil (list 'quote b)))))
224 </pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sharpsign"></a>2.6. Sharpsign
225 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8.html">[sec_2-4-8]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></div><p>Reader macros are also defined for the following:
226 </p><div class="variablelist"><a id="extra-read-macro-table"></a><p class="title"><strong>Additional reader macros</strong></p><dl class="variablelist"><dt><span class="term"><span class="data"><code class="literal">#,</code></span></span></dt><dd>load-time evaluation, kept despite the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
227 issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss315.html" target="_top">SHARP-COMMA-CONFUSION:REMOVE</a>.</dd><dt><span class="term"><span class="data"><code class="literal">#Y</code></span></span></dt><dd>compiled <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> objects and <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>'s <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s
228 </dd><dt><span class="term"><span class="data"><code class="literal">#""</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>: <code class="filename">#"test.lisp"</code>
229 is the value of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname.html" target="_top"><code class="function">PATHNAME</code></a> "test.lisp")</code></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sharpsign-backslash"></a>2.6.1. Sharpsign Backslash
230 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-1.html">[sec_2-4-8-1]</a></h3></div></div></div><p><span class="keysym">#\Code</span> allows input of characters of arbitrary code:
231 e.g., <span class="keysym">#\Code231</span> reads as the character
232 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> 231)</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sharpsign-less-than"></a>2.6.2. Sharpsign Less-Than-Sign
233 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">[sec_2-4-8-20]</a></h3></div></div></div><p>This is the list of objects whose external representation cannot
234 be meaningfully read in:</p><div class="variablelist"><a id="unreadable-objects"></a><p class="title"><strong>Unreadable objects</strong></p><dl class="variablelist"><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a><em class="replaceable"><code>type</code></em> ...&gt;</code></span></span></dt><dd>all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>s lacking a keyword
235 constructor</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>ARRAY <em class="replaceable"><code>type</code></em>
236 <em class="replaceable"><code>dimensions</code></em>&gt;</code></span></span></dt><dd>all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s except <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, if
237 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>SYSTEM-FUNCTION <em class="replaceable"><code>name</code></em>&gt;</code></span></span></dt><dd>built-in function written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
238 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>ADD-ON-SYSTEM-FUNCTION
239 <em class="replaceable"><code>name</code></em>&gt;</code></span></span></dt><dd><a href="impnotes.html#modules" class="olink">module</a> function written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
240 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>SPECIAL-OPERATOR
241 <em class="replaceable"><code>name</code></em>&gt;</code></span></span></dt><dd>special operator handler</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>COMPILED-FUNCTION
242 <em class="replaceable"><code>name</code></em>&gt;</code></span></span></dt><dd>compiled function, if <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
243 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>FUNCTION <em class="replaceable"><code>name</code></em> ...&gt;</code></span></span></dt><dd>interpreted function, , if <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
244 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>FRAME-POINTER #x...&gt;</code></span></span></dt><dd>pointer to a stack frame</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>DISABLED POINTER&gt;</code></span></span></dt><dd>frame pointer which has become invalid on exit from the
245 corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>...STREAM...&gt;</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>PACKAGE <em class="replaceable"><code>name</code></em>&gt;</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>HASH-TABLE #x...&gt;</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
246 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>READTABLE #x...&gt;</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>SYMBOL-MACRO <em class="replaceable"><code>form</code></em>&gt;</code></span></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> handler</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>MACRO <em class="replaceable"><code>function</code></em>&gt;</code></span></span></dt><dd>macro expander (defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> and friends)
247 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a><a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
248 #x...&gt;</code></span></span></dt><dd>foreign pointer (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
249 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a><a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
250 #x...&gt;</code></span></span></dt><dd>foreign address
251 (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a><a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>name</code></em>
252 #x...&gt;</code></span></span></dt><dd>foreign variable (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
253 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> <em class="replaceable"><code>name</code></em>
254 #x...&gt;</code></span></span></dt><dd>foreign function (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
255 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>UNBOUND&gt;</code></span></span></dt><dd><span class="quote">“<span class="quote">value</span>”</span> of an unbound symbol, an unsupplied
256 optional or keyword argument</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>SPECIAL REFERENCE&gt;</code></span></span></dt><dd>environment marker for variables declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>
257 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>DOT&gt;</code></span></span></dt><dd>internal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result for <span class="quote">“<span class="quote">.</span>”</span>
258 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>END OF FILE&gt;</code></span></span></dt><dd>internal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result, when the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached
259 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>READ-LABEL ...&gt;</code></span></span></dt><dd>intermediate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-16.html"><span class="data"><code class="literal">#n#</code></span></a>
260 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>ADDRESS #x...&gt;</code></span></span></dt><dd>machine address, should not occur
261 </dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>SYSTEM-POINTER #x...&gt;</code></span></span></dt><dd>should not occur</dd></dl></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="eval"></a>Chapter 3. Evaluation and Compilation
262 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-3.html">[chap-3]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></dd><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dd><dl><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> &amp; <code class="function">DEFMACRO</code></a></span></dt></dl></dd><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></dd><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></dd><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dd><dl><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt><dd><dl><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></dd></dl></div><p>All the functions built by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and the like are
263 atoms. There are built-in functions written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, compiled
264 functions (both of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a>) and interpreted
265 functions (of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>).</p><div class="table"><a id="eval-limits-table"></a><p class="title"><strong>Table 3.1. Function call limits</strong></p><div class="table-contents"><table class="table" summary="Function call limits" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_call-a_uments-limit.html" target="_top"><code class="constant">CALL-ARGUMENTS-LIMIT</code></a></td><td align="center">2<sup>12</sup>=4096</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_multip_values-limit.html" target="_top"><code class="constant">MULTIPLE-VALUES-LIMIT</code></a></td><td align="center">2<sup>7</sup>=128</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_lambda_meters-limit.html" target="_top"><code class="constant">LAMBDA-PARAMETERS-LIMIT</code></a></td><td align="center">2<sup>12</sup>=4096</td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="evaluation"></a>3.1. Evaluation
266 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1.html">[sec_3-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></dd><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dd><dl><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> &amp; <code class="function">DEFMACRO</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="eval-environ"></a>3.1.1. Introduction to Environments
267 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1.html">[sec_3-1-1]</a></h3></div></div></div><p><a id="the-env"></a><strong>Macro <a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a>. </strong>As in Scheme, the macro <code class="code">(<a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a>)</code>
268 returns the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. This works only in interpreted code and
269 is not compilable!</p><p><a id="eval-env"></a><strong>Function <code class="code">(EXT:EVAL-ENV
270 <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>. </strong>evaluates a form in a given <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>, just as if the
271 form had been a part of the program that the <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> came from.
272 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sym-forms"></a>3.1.2. Symbols as Forms
273 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1.html">[sec_3-1-2-1-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="def-sym-mac"></a>3.1.2.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html" target="_top"><code class="function">DEFINE-SYMBOL-MACRO</code></a></h4></div></div></div><p>The macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html" target="_top"><code class="function">DEFINE-SYMBOL-MACRO</code></a> establishes <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s with
274 global scope (as opposed to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s defined with
275 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a>, which have local scope).</p><p>The function
276 <strong class="first"><em class="firstterm"><a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a><a id="symbol-mex" class="indexterm"></a></em></strong>
277 tests for a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>: If <em class="replaceable"><code>symbol</code></em> is defined as a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
278 in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>, <code class="code">(<a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns two
279 values, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> and the expansion; otherwise it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p><a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a> is a special case of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_macroexpa_acroexpand-1.html" target="_top"><code class="function">MACROEXPAND-1</code></a>. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_macroexpa_acroexpand-1.html" target="_top"><code class="function">MACROEXPAND-1</code></a>
280 can also test whether a symbol is defined as a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> in <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>s
281 other than the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dyn-var"></a>3.1.2.2. Dynamic Variables
282 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">[sec_3-1-2-1-1-2]</a></h4></div></div></div><p><span class="quote">“<span class="quote">Undefined variables</span>”</span>, i.e. <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1.html">variable</a>s which are
283 referenced outside any lexical binding for a variable of the same name
284 and which are not declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>, are treated like <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>s
285 in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>. The compiler <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> when it
286 encounters an undefined variable.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cons-forms"></a>3.1.3. Conses as Forms
287 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2.html">[sec_3-1-2-1-2]</a></h3></div></div></div><p>Lists of the form <code class="code">((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>) ...)</code> are also
288 treated as function forms. This makes the syntax
289 <code class="code">(<em class="replaceable"><code>function-name</code></em> <em class="replaceable"><code>arguments</code></em> ...)</code> consistent with the syntax
290 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> #'<em class="replaceable"><code>function-name</code></em> <em class="replaceable"><code>arguments</code></em> ...)</code>.
291 It implements the item 7 of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss174.html" target="_top">FUNCTION-NAME:LARGE</a> and the
292 definition of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_form">function form</a>s,
293 and is consistent with the use of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>s elsewhere in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.
294 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="specforms"></a>3.1.4. Special Forms
295 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-1.html">[sec_3-1-2-1-2-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="eval-when"></a>3.1.4.1. Special operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> also accepts the situations <code class="code">(NOT EVAL)</code>
296 and <code class="code">(NOT COMPILE)</code>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The situations <code class="constant">EVAL</code>,
297 <code class="constant">LOAD</code> and <code class="constant">COMPILE</code> are
298 deprecated by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], and they are <span class="strong"><strong>not</strong></span> equivalent to the new
299 standard situations <code class="constant">:EXECUTE</code>,
300 <code class="constant">:LOAD-TOPLEVEL</code>
301 and <code class="constant">:COMPILE-TOPLEVEL</code> in that they ignore the
302 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-3-1.html">top-level form</a> versus non-<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-3-1.html">top-level form</a> distinction.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="speop-the"></a>3.1.4.2. Special operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a></h4></div></div></div><p>The special form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a> <em class="replaceable"><code>value-type</code></em> <em class="replaceable"><code>form</code></em>)</code> is
303 similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_check-type.html" target="_top"><code class="function">CHECK-TYPE</code></a> but does a type check only in interpreted
304 code (no type check is done in compiled code - but see the <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a>
305 macro) and does not allow interactive error correction by the user.
306 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="funforms"></a>3.1.5. Function Forms
307 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-3.html">[sec_3-1-2-1-2-3]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></div><p><strong>Constant <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_lambda_ist-keywords.html" target="_top"><code class="constant">LAMBDA-LIST-KEYWORDS</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>
308 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;AUX</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;WHOLE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;ENVIRONMENT</code></a>)</code></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sym-fun"></a>3.1.5.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a></h4></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a> <em class="replaceable"><code>symbol</code></em>) <em class="replaceable"><code>object</code></em>)</code>
309 requires <em class="replaceable"><code>object</code></em> to be either a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>
310 return value, or a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>. The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> is thereby
311 immediately converted to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defun"></a>3.1.6. Macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> are allowed in non-toplevel positions. As
312 an example, consider the old (<a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a>) definition of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gensym.html" target="_top"><code class="function">GENSYM</code></a>:</p><pre class="programlisting">
313 (let ((gensym-prefix "G")
314 (gensym-count 1))
315 (defun gensym (&amp;optional (x nil s))
316 (when s
317 (cond ((stringp x) (setq gensym-prefix x))
318 ((integerp x)
319 (if (minusp x)
320 (error "~S: index ~S is negative" 'gensym x)
321 (setq gensym-count x)))
322 (t (error "~S: argument ~S of wrong type" 'gensym x))))
323 (prog1
324 (make-symbol
325 (concatenate 'string
326 gensym-prefix
327 (write-to-string gensym-count :base 10 :radix nil)))
328 (incf gensym-count))))
329 </pre><p>See also <a class="xref" href="#minimal-compilation" title="3.2.2.2. Minimal Compilation sec_3-2-2-2">Section 3.2.2.2, “Minimal Compilation sec_3-2-2-2”</a>.</p><p><a id="arglist"></a><strong>Function <a class="link" href="#arglist" title="Function EXT:ARGLIST"><code class="function">EXT:ARGLIST</code></a>. </strong>Function <code class="code">(<a class="link" href="#arglist" title="Function EXT:ARGLIST"><code class="function">EXT:ARGLIST</code></a> <em class="replaceable"><code>name</code></em>)</code> returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of
330 the function or macro that <em class="replaceable"><code>name</code></em> names and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>name</code></em> is
331 not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fboundp.html" target="_top"><code class="function">FBOUNDP</code></a>. It also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when the macro <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is not
332 available due to the compiler optimization settings
333 (see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>).</p><p><a id="suppress-check-redef"></a><strong>Variable <a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a>. </strong>When <strong class="first"><em class="firstterm"><a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a></em></strong> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
334 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> when a function (macro, variable, class,
335 etc) is redefined in a different file than its original definition.
336 It is <span class="strong"><strong>not</strong></span> a good idea to set this variable to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
337 </p><p><a id="defun-accept-spelalist"></a><strong>Variable <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a>. </strong>When <strong class="first"><em class="firstterm"><a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a></em></strong> is
338 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> accepts <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a>s, converting type-parameter
339 associations to type <a class="link" href="#declarations" title="3.3. Declarations sec_3-3">declarations</a>:
340 </p><pre class="programlisting">(defun f ((x list) (y integer)) ...)</pre><p>
341 is equivalent to
342 </p><pre class="programlisting">(defun f (x y) (declare (type list x) (type integer y)) ...)</pre><p>
343 This extension is disabled by <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> and by setting <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
344 but can be re-enabled by setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> explicitly.
345 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compilation"></a>3.2. Compilation
346 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2.html">[sec_3-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></dd><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compiler-terms"></a>3.2.1. Compiler Terminology
347 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-1.html">[sec_3-2-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiles to platform-independent <a href="impnotes.html#bytecode" class="olink">bytecode</a>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compile-jit"></a>3.2.1.1. Just-In-Time Native Compilation</h4></div><div><h5 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span>
348 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/lightning/" target="_top">lightning</a></span></span></h5></div></div></div><p>The code compiled to <a href="impnotes.html#bytecode" class="olink">bytecode</a>s with optimization levels
349 </p><pre class="programlisting">
350 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&gt;=</code></a> 0 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&lt;=</code></a> 1 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPEED</code></a>))</pre><p>
351 (by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>, or <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>) will be
352 <span class="emphasis"><em>just-in-time</em></span> (i.e., on the first execution)
353 compiled to native code using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/lightning/" target="_top">lightning</a>.
354 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compilation-semantics"></a>3.2.2. Compilation Semantics
355 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2.html">[sec_3-2-2]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compiler-macros"></a>3.2.2.1. Compiler Macros
356 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-1.html">[sec_3-2-2-1]</a></h4></div></div></div><p>Compiler macros are expanded in the compiled code only, and
357 ignored by the interpreter.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="minimal-compilation"></a>3.2.2.2. Minimal Compilation
358 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-2.html">[sec_3-2-2-2]</a></h4></div></div></div><p>When a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> form is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated, the macros used there are
359 expanded, so they must be already defined, and their (re)definition
360 does <span class="strong"><strong>not</strong></span> affect functions which are already defined.</p><p>This means that even the interpreted code is <span class="emphasis"><em>minimally
361 compiled</em></span> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="semantic-constraints"></a>3.2.2.3. Semantic Constraints
362 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-3.html">[sec_3-2-2-3]</a></h4></div></div></div><p>Non-conforming code that does not follow the rule
363 </p><div class="blockquote"><blockquote class="blockquote"><p><span class="quote">“<span class="quote">Special proclamations for dynamic variables must
364 be made in the compilation environment.</span>”</span></p></blockquote></div><p>
365 can produce quite unexpected results, e.g., observable differences
366 between <span class="emphasis"><em>compiled</em></span> and <span class="emphasis"><em>interpreted</em></span>
367 programs:</p><pre class="programlisting">
368 (defun adder-c (value) (declare <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>) (lambda (x) (+ x value)))
369 ⇒ <code class="computeroutput">ADDER-C</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">compiled function; <em class="replaceable"><code>value</code></em> is lexical</span></em>
370 (defun adder-i (value) (lambda (x) (+ x value)))
371 ⇒ <code class="computeroutput">ADDER-I</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">interpreted function; <em class="replaceable"><code>value</code></em> is lexical</span></em>
372 (defparameter add-c-10 (adder-c 10))
373 ⇒ <code class="computeroutput">ADD-C-10</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">compiled function</span></em>
374 (defparameter add-i-10 (adder-i 10))
375 ⇒ <code class="computeroutput">ADD-I-10</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">interpreted function</span></em>
376 (funcall add-c-10 32)
377 ⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
378 (funcall add-i-10 32)
379 ⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
380 (defvar value 12)
381 ⇒ <code class="computeroutput">VALUE</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">affects <code class="function">ADDER-I</code> and <code class="function">ADD-I-10</code> but <span class="strong"><strong>not</strong></span> <code class="function">ADDER-C</code> and <code class="function">ADD-C-10</code></span></em>
382 (funcall add-c-10 32)
383 ⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as before</span></em>
384 (funcall add-i-10 32)
385 ⇒ <code class="computeroutput">44</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation"><em class="replaceable"><code>value</code></em> is now dynamic!</span></em>
386 </pre><p><a id="semantic-constraints-non-conf"></a><strong>Non-conformance. </strong>The code shown above has a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> proclamation (by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>)
387 for the variable <em class="replaceable"><code>value</code></em> in the execution environment
388 (before the last two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>s)
389 but not in the compilation environment: at the moment
390 the <code class="function">ADDER-I</code> function is defined,
391 <em class="replaceable"><code>value</code></em> is not known to be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> variable.
392 Therefore the code is not conforming.</p><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="semantic-constraints-rationale"></a>Rationale</h5></div></div></div><p>The function <code class="function">ADD-C-10</code> was compiled <span class="strong"><strong>before</strong></span>
393 <em class="replaceable"><code>value</code></em> was declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>, so the symbol <em class="replaceable"><code>value</code></em> was
394 eliminated from its code and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> declaration did
395 not affect the return value (i.e., <code class="code">(funcall
396 add-c-10 32)</code> always returned <span class="returnvalue">42</span>).</p><p>On the opposite, function <code class="function">ADDER-I</code> was <span class="strong"><strong>not</strong></span>
397 compiled, so <code class="function">ADD-I-10</code>
398 was <span class="emphasis"><em>interpreted</em></span>.
399 Whenever <code class="function">ADD-I-10</code> is executed, its definition is
400 interpreted all over again. Before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>, <em class="replaceable"><code>value</code></em> is evaluated as
401 a lexical (because it is <span class="strong"><strong>not</strong></span> declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> yet), but after
402 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>, we see a globally <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> symbol <em class="replaceable"><code>value</code></em> which
403 can have only a global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> (not a local binding), and thus
404 we are compelled to evaluate it to <span class="returnvalue">12</span>.</p><p>This behavior was implemented intentionally to ease interactive
405 development, because <span class="emphasis"><em>usually</em></span>
406 the <code class="function">ADDER-I</code> above would be followed by a
407 (forgotten) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>.</p><p>When a user compiles a program, the compiler is allowed to
408 remember the information whether a variable was <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> or not,
409 because that allows the compiler to generate more efficient code,
410 but in interpreted code, when the user changes the state of a variable,
411 he does <span class="strong"><strong>not</strong></span> want to re-evaluate all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>s that use the variable.</p><p>[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] gives the implementation freedom regarding
412 interpreted evaluation, how much it wants to remember / cache, and how
413 much it wants to re-evaluate according the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1.html">environment</a>,
414 if it has changed. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implements <span class="emphasis"><em>ad-hoc
415 look-up</em></span> for variables (but <span class="strong"><strong>not</strong></span> for macros, see
416 <a class="xref" href="#minimal-compilation" title="3.2.2.2. Minimal Compilation sec_3-2-2-2">Section 3.2.2.2, “Minimal Compilation sec_3-2-2-2”</a>).</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="similarity"></a>3.2.3. Definition of Similarity
417 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-4-2-2.html">[sec_3-2-4-2-2]</a></h3></div></div></div><p>Hash tables are <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-4-1.html">externalizable object</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-errors"></a>3.2.4. Exceptional Situations in the Compiler
418 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-5.html">[sec_3-2-5]</a></h3></div></div></div><p>Both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> the <a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="classname">EXT:SOURCE-PROGRAM-ERROR</code></a>
419 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> which derives from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_program-error.html" target="_top"><code class="classname">PROGRAM-ERROR</code></a> and which contains
420 additional slots with accessors </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="function">EXT:SOURCE-PROGRAM-ERROR-FORM</code></a></span></dt><dd>Returns the whole form in which the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> was
421 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed</dd><dt><span class="term"><a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="function">EXT:SOURCE-PROGRAM-ERROR-DETAIL</code></a></span></dt><dd>Returns the specific (usually small) part of the
422 above which triggered the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd></dl></div><p><a id="key-optional"></a><strong>Mixing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>. </strong>It is a bad design to have both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> in the
423 same <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>, especially if the number of optional arguments is even:
424 the users will often forget to supply optional arguments when supplying
425 keys, e.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> <em class="replaceable"><code>string</code></em> <code class="constant">:START</code> 5)</code>
426 instead of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> <em class="replaceable"><code>string</code></em> t nil <code class="constant">:START</code> 5)</code>.
427 This is why the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiler issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> in such cases:
428 </p><pre class="programlisting">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> foo (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> b) (cons a b))
429 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> 'foo)
430 WARNING: in FOO : Mixing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> in lambda list (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> B) is bad design
431 FOO ;
432 1 ;
433 NIL
434 </pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="declarations"></a>3.3. Declarations
435 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-3.html">[sec_3-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="decl-min"></a>3.3.1. Minimal Declaration Processing Requirements
436 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-3-1.html">[sec_3-3-1]</a></h3></div></div></div><p>The declaration <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_dynamic-extent.html" target="_top"><code class="literal">DYNAMIC-EXTENT</code></a> <em class="replaceable"><code>variable</code></em> ...)</code> is
437 ignored.</p><p>The type declarations <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_type.html" target="_top"><code class="literal">TYPE</code></a> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>variable</code></em> ...)</code>
438 and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ftype.html" target="_top"><code class="literal">FTYPE</code></a> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>function</code></em> ...)</code>
439 are ignored by both the interpreter and the compiler.
440 Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_check-type.html" target="_top"><code class="function">CHECK-TYPE</code></a> to force type checks.</p><p><strong>Rationale. </strong>When these declarations lie and a compiler respects them, the
441 generated code often results in a hard crash (segmentation fault).
442 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="spec-decl"></a>3.3.2. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a></h3></div></div></div><p><a id="notspec-decl"></a><strong>Declaration <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>. </strong>Declarations <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> <em class="replaceable"><code>variable</code></em>))</code>
443 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> are undone by the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> '(<a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>
444 <em class="replaceable"><code>variable</code></em>))</code> declaration. This declaration can be used only in
445 global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_declaim.html" target="_top"><code class="function">DECLAIM</code></a> forms, <span class="strong"><strong>not</strong></span> in local <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> forms.
446 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>You cannot expect miracles: functions compiled <span class="strong"><strong>before</strong></span>
447 the <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> proclamation was issued will still be treating <em class="replaceable"><code>variable</code></em> as
448 special even after the <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> proclamation. See also
449 <a class="xref" href="#semantic-constraints" title="3.2.2.3. Semantic Constraints sec_3-2-2-3">Section 3.2.2.3, “Semantic Constraints sec_3-2-2-3”</a>.</p></div><p><a id="spe-var-p"></a><strong>Function <a class="link" href="#spe-var-p" title="Function EXT:SPECIAL-VARIABLE-P"><code class="function">EXT:SPECIAL-VARIABLE-P</code></a>. </strong>You can use the function <code class="code">(<a class="link" href="#spe-var-p" title="Function EXT:SPECIAL-VARIABLE-P"><code class="function">EXT:SPECIAL-VARIABLE-P</code></a> <em class="replaceable"><code>symbol</code></em>
450 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code> to check whether the <em class="replaceable"><code>symbol</code></em> is a
451 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>. <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or omitted means use the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>.
452 You can also obtain the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> using the macro
453 <a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a> (interpreted code only).
454 This function will always return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for global special
455 variables and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="constant-notinline"></a>3.3.3. Declaration <a class="link" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE"><code class="literal">EXT:CONSTANT-NOTINLINE</code></a></h3></div></div></div><p>Constants defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> but proclaimed <a class="link" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE"><code class="literal">EXT:CONSTANT-NOTINLINE</code></a>
456 will not be inlined by the compiler. This is useful for variables
457 which remain constant within an a single Lisp process but may vary
458 between processes and machines (such as endianness or word size) thus
459 they should be written to <code class="filename">#P".fas"</code>s as symbols, not values.
460 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="constantp"></a>3.3.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a></h3></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> fully complies with [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
461 Additionally, some non-trivial forms are identified as constants, e.g.,
462 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1 2 3))</code> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> initial value forms are not
463 evaluated at compile time, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> will not report <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> of their
464 name within the same <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a> for the null <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.
465 This is consistent and matches questionable code using the pattern
466 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> <em class="replaceable"><code>form</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> <em class="replaceable"><code>form</code></em>))</code>.
467 Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> if you need recognition and the value during
468 compile-time. See also <a class="xref" href="#compile-time-value" title="31.11.5. Macro EXT:COMPILE-TIME-VALUE">Section 31.11.5, “Macro <code class="function">EXT:COMPILE-TIME-VALUE</code>”</a>.
469 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="safety-decl"></a>3.3.5. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SAFETY</code></a></h3></div></div></div><p>Declaration <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">OPTIMIZE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SAFETY</code></a> 3))</code>
470 results in <span class="quote">“<span class="quote">safe</span>”</span> compiled code: function calls are never
471 eliminated. This guarantees the semantics described in
472 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-5.html">[sec_3-5]</a>.
473 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-decl"></a>3.3.6. Declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a></h3></div></div></div><p>The declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a> has the effect that the current
474 form is compiled prior to execution. Examples:
475 </p><pre class="programlisting">
476 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile)) <em class="replaceable"><code>form</code></em>)</pre><p>
477 executes the compiled version of <em class="replaceable"><code>form</code></em>.</p><pre class="programlisting">
478 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((x 0))
479 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a> ((inc () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile)) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">INCF</code></a> x))
480 (dec () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">DECF</code></a> x)))
481 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> #'inc #'dec)))</pre><p>
482 returns two functions. The first is compiled and increments <em class="replaceable"><code>x</code></em>, the
483 second is interpreted (slower) and decrements the same <em class="replaceable"><code>x</code></em>.</p><p>This declaration can also be used to name the resulting compiled closure:
484 </p><pre class="programlisting">
485 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile ident)) x)
486 ⇒ <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html"><span class="data"><code class="literal">#&lt;</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a> IDENT&gt;</code>
487 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcm_ststcm_ststst.html" target="_top"><code class="varname">*</code></a>)
488 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">source is not preserved</span></em>
489 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
490 ⇒ <code class="computeroutput">IDENT</code>
491 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fboundp.html" target="_top"><code class="function">FBOUNDP</code></a> 'ident)
492 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">sic!</span></em>
493 </pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a> is ignored by the following
494 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_s.html#special_operator">special operator</a>s:
495 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">LABELS</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="space-decl"></a>3.3.7. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a></h3></div></div></div><p>The declaration determines what metadata is recorded in the
496 function object:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&gt;=</code></a> 2</span></dt><dd>documentation string is discarded
497 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&gt;=</code></a> 3</span></dt><dd>the original <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is also discarded (most
498 information is still available, see <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>, but the names of
499 the positional arguments are not).</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lalist"></a>3.4. Lambda Lists
500 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4.html">[sec_3-4]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="boa-lalist"></a>3.4.1. Boa Lambda Lists
501 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-6.html">[sec_3-4-6]</a></h3></div></div></div><p>The initial value of an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;AUX</code></a> variable in a boa <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is
502 the value of the corresponding slot's initial form.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="types-classes"></a>Chapter 4. Types and Classes
503 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-4.html">[chap-4]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dd><dl><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="types"></a>4.1. Types <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2.html">[sec_4-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="type-spec"></a>4.1.1. Type Specifiers
504 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2-3.html">[sec_4-2-3]</a></h3></div></div></div><p>The general form of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type-of-real-part</code></em>
505 <em class="replaceable"><code>type-of-imaginary-part</code></em>)</code></span>.
506 The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type</code></em>)</code></span>
507 is equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type</code></em>
508 <em class="replaceable"><code>type</code></em>)</code></span>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_deftype.html" target="_top"><code class="function">DEFTYPE</code></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s are subject to destructuring (nested <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s
509 are allowed, as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a>) and may contain a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;WHOLE</code></a> marker,
510 but not an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;ENVIRONMENT</code></a> marker.</p><p><strong>Function <code class="code">(<code class="function">EXT:TYPE-EXPAND</code>
511 <em class="replaceable"><code>type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>once-p</code></em>)</code>. </strong>If <em class="replaceable"><code>type</code></em> is a user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> this will expand it
512 recursively until it is no longer a user-defined type
513 (unless <em class="replaceable"><code>once-p</code></em> is supplied and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
514 Two values are returned - the expansion and an indicator (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
515 of whether the original <em class="replaceable"><code>type</code></em> was a user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a>.
516 </p><div class="itemizedlist"><p class="title"><strong>The possible results of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-of.html" target="_top"><code class="function">TYPE-OF</code></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>,
517 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> 0
518 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>)</code></span>,
519 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
520 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a> (0))</code></span>,
521 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
522 (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>))</code></span>,
523 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> *
524 (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a>))</code></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>,
525 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a>,
526 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_standard-char.html" target="_top"><code class="classname">STANDARD-CHAR</code></a></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> <em class="replaceable"><code>element-type</code></em>
527 <em class="replaceable"><code>dimensions</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-array.html" target="_top"><code class="classname">SIMPLE-ARRAY</code></a>
528 <em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>
529 <em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>
530 <em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
531 <em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>
532 <em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-string.html" target="_top"><code class="classname">BASE-STRING</code></a>
533 <em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-base-string.html" target="_top"><code class="classname">SIMPLE-BASE-STRING</code></a>
534 <em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a>
535 <em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-bit-vector.html" target="_top"><code class="classname">SIMPLE-BIT-VECTOR</code></a>
536 <em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a>,
537 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>,
538 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>,
539 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>,
540 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a>, <a class="link" href="#byte-type" title="12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2"><span class="type">BYTE</span></a></li><li class="listitem"><code class="classname">SPECIAL-OPERATOR</code>,
541 <code class="classname">LOAD-TIME-EVAL</code>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>,
542 <code class="classname">GLOBAL-SYMBOL-MACRO</code>, <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>,
543 <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>,
544 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a></li><li class="listitem"><a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>, <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>, <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>,
545 <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>, <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>, <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>,
546 <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>, <a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>,
547 <a class="link" href="#reader" title="Chapter 23. Reader chap-23"><code class="classname">READ-LABEL</code></a>,
548 <a class="link" href="#reader" title="Chapter 23. Reader chap-23"><code class="classname">FRAME-POINTER</code></a>,
549 <code class="classname">SYSTEM-INTERNAL</code></li><li class="listitem"><code class="classname">ADDRESS</code> (should not
550 occur)</li><li class="listitem">any other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (structure types or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
551 classes)</li><li class="listitem">a class object (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> classes without a
552 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a>)</li></ul></div><p><a id="fixnum-char-ansi"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#character_designator">character
553 designator</a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], although <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> provides an
554 obvious venue to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
555 When <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s to
556 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a>.
557 When <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s cannot be
558 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>d to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="classes"></a>4.2. Classes
559 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3.html">[sec_4-3]</a></h2></div></div></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> symbols are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed from the package <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>.
560 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> uses (as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a>) <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>s the
561 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] standard exported symbols (the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extensions, e.g.,
562 those described in <a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a>, are <span class="strong"><strong>not</strong></span> <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed).
563 Since <a class="link" href="#make-pack" title="11.1.1. Function MAKE-PACKAGE">the default <code class="constant">:USE</code> argument</a>
564 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> is <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>, the standard <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> symbols are normally
565 visible in all user-defined packages.
566 If you do not want them (for example, if you want to use the
567 <a class="ulink" href="https://ftp.gnu.org/pub/gnu/clisp/packages/pcl.sept92f.clisp.tar.gz" target="_top">PCL</a>
568 implementation of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> instead of the native one), do the following:
569 </p><pre class="programlisting">
570 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "CL-NO-CLOS" (:use "CL"))
571 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-EXTERNAL-SYMBOLS</code></a> (<em class="replaceable"><code>symbol</code></em> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>)
572 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadow.html" target="_top"><code class="function">SHADOW</code></a> <em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS"))
573 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-SYMBOLS</code></a> (<em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS")
574 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a> <em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS"))
575 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "CL-NO-CLOS")
576 (<a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> "pcl")<strong> ; </strong><em class="lineannotation"><span class="lineannotation">or whatever</span></em>
577 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "MY-USER" (:use "CL-NO-CLOS"))
578 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "MY-USER")
579 ;; your code which uses PCL goes here
580 </pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clos-diff"></a>4.3. Deviations from [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> supports the option <code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a>.
581 This option is necessary in order to define a subclass of a
582 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>-defined structure type using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> instead of
583 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>.</p><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is called with arguments, the rule that
584 the ordered set of applicable methods must be the same as for the
585 original arguments is enforced by the implementation only in
586 interpreted code.</p><p><strong class="first"><em class="firstterm"><a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a><a id="gen-flet" class="indexterm"></a></em></strong> and
587 <strong class="first"><em class="firstterm"><a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a><a id="gen-labels" class="indexterm"></a></em></strong>
588 are implemented as macros, not as special operators (as permitted by
589 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-2.html">[sec_3-1-2-1-2-2]</a>).
590 They are not imported into the packages <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> because
591 of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top">GENERIC-FLET-POORLY-DESIGNED:DELETE</a>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a> is only called on objects of type
592 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>.
593 It is not called on other objects, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es
594 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s, due to the performance concerns.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="metaclasses"></a>4.4. Standard Metaclasses
595 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-1-1.html">[sec_4-3-1-1]</a></h2></div></div></div><p>Among those classes listed in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-7.html#classtypecorrespondence" target="_top">Figure
596 4-8</a>, only the following are instances of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>:
597 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>,
598 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a>,
599 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>,
600 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>,
601 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>
602 </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="def-class"></a>4.5. Defining Classes
603 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-2.html">[sec_4-3-2]</a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> supports the <code class="constant">:METACLASS</code> option. Possible values are
604 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> (the default), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> (which creates
605 structure classes, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> does), and user-defined
606 meta-classes (see <a class="xref" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS">Section 29.3.6.7, “Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code>”</a>).</p><p>It is <span class="strong"><strong>not</strong></span> required that the superclasses of a class are
607 defined before the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form for the class is evaluated.
608 Use <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> generic functions <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> to check whether the
609 class has been finalized and thus its instances can be created,
610 and <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> to force class finalization.</p><p>See also <a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="redef-class"></a>4.6. Redefining Classes
611 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-6.html">[sec_4-3-6]</a></h2></div></div></div><p>Trivial changes, e.g., those that can occur when doubly loading
612 the same code, do not require updating the instances.
613 These are the changes that do not modify the set of local slots
614 accessible in instances, e.g., changes to slot options <code class="constant">:INITFORM</code>,
615 <code class="constant">:DOCUMENTATION</code>, and changes to class options
616 <code class="constant">:DEFAULT-INITARGS</code>, <code class="constant">:DOCUMENTATION</code>.</p><p>The instances are updated when they are first accessed, <span class="strong"><strong>not</strong></span> at
617 the time when the class is redefined or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_mak_ces-obsolete.html" target="_top"><code class="function">MAKE-INSTANCES-OBSOLETE</code></a> is
618 called. When the class has been redefined several times since the
619 instance was last accessed, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> is
620 still called just once.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="data"></a>Chapter 5. Data and Control Flow
621 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-5.html">[chap-5]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gen-ref"></a>5.1. Generalized Reference
622 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1.html">[sec_5-1]</a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> markers in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defsetf.html" target="_top"><code class="function">DEFSETF</code></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s are supported, but the
623 corresponding keywords must appear literally in the program text.</p><p>An attempt to modify read-only data <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
624 Program text and quoted constants loaded from files are considered
625 read-only data. This check is only performed for strings, not for
626 conses, other kinds of arrays, and user-defined data types.</p><p>See also <a class="xref" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*">Section 31.11.2, “Macros <code class="function">EXT:LETF</code> &amp; <code class="function">EXT:LETF*</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="setf-expansion"></a>5.2. Setf Expansions
627 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1-1-2.html">[sec_5-1-1-2]</a></h2></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a> <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>,
628 <code class="code">(EXT:GET-SETF-METHOD <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>, and
629 <code class="code">(EXT:GET-SETF-METHOD-MULTIPLE-VALUE <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
630 <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code> receive as optional argument <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> the environment
631 necessary for macro expansions. In <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-setf-expander.html" target="_top"><code class="function">DEFINE-SETF-EXPANDER</code></a>
632 and <code class="function">EXT:DEFINE-SETF-METHOD</code> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s, one can
633 specify <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;ENVIRONMENT</code></a> and a variable, which will be bound to the
634 environment. This environment should be passed to all calls of
635 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a>, <code class="function">EXT:GET-SETF-METHOD</code> and
636 <code class="function">EXT:GET-SETF-METHOD-MULTIPLE-VALUE</code>. If this is
637 done, even local macros will be interpreted as places correctly.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="extra-places"></a>5.3. Kinds of Places
638 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1-2.html">[sec_5-1-2]</a></h2></div></div></div><p>Additional <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s:
639 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> #'<em class="replaceable"><code>symbol</code></em> ...)
640 <em class="replaceable"><code>object</code></em>)</code> and
641 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> '<em class="replaceable"><code>symbol</code></em> ...) <em class="replaceable"><code>object</code></em>)</code>
642 are equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<em class="replaceable"><code>symbol</code></em> ...) <em class="replaceable"><code>object</code></em>)</code>.
643 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> <em class="replaceable"><code>form</code></em> ... <em class="replaceable"><code>place</code></em>)
644 <em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a> <em class="replaceable"><code>declaration</code></em> ...
645 <em class="replaceable"><code>form</code></em> ... <em class="replaceable"><code>place</code></em>) <em class="replaceable"><code>object</code></em>)</code>
646 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a> <em class="replaceable"><code>condition</code></em>
647 <em class="replaceable"><code>place<sub>1</sub></code></em>
648 <em class="replaceable"><code>place<sub>2</sub></code></em>)
649 <em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">GET-DISPATCH-MACRO-CHARACTER</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">GET-DISPATCH-MACRO-CHARACTER</code></a> ...)
650 ...)</code> calls <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">SET-DISPATCH-MACRO-CHARACTER</code></a>.
651 </dd><dt><span class="term"><a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>:</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>) <em class="replaceable"><code>digits</code></em>)</code> sets the
652 default mantissa length of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s to <em class="replaceable"><code>digits</code></em> bits.
653 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a></span></dt><dd><p class="simpara"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> <em class="replaceable"><code>list</code></em>) <em class="replaceable"><code>form</code></em>)</code>
654 is equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>list</code></em>
655 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-list.html" target="_top"><code class="function">MULTIPLE-VALUE-LIST</code></a> <em class="replaceable"><code>form</code></em>)))</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Note that this <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> is restricted: it can only be
656 used in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF*</code></a>, not in other positions.
657 </p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="misc-data"></a>5.4. Miscellaneous</h2></div></div></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="fle"></a>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a></h3></div></div></div><p>The <em class="replaceable"><code>name</code></em> of a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> is a <span class="emphasis"><em>string</em></span>
658 (the name of the underlying <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function), not a lisp <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>.
659 </p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="des-bind"></a>Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_destructuring-bind.html" target="_top"><code class="function">DESTRUCTURING-BIND</code></a></h3></div></div></div><p>This macro does not perform full error checking.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="macro-special"></a>Macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_prog1cm_prog2.html" target="_top"><code class="function">PROG1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_prog1cm_prog2.html" target="_top"><code class="function">PROG2</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_and.html" target="_top"><code class="function">AND</code></a>,
660 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_psetq.html" target="_top"><code class="function">PSETQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">UNLESS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_casecm_ccasecm_ecase.html" target="_top"><code class="function">CASE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-list.html" target="_top"><code class="function">MULTIPLE-VALUE-LIST</code></a>,
661 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-setq.html" target="_top"><code class="function">MULTIPLE-VALUE-SETQ</code></a></h3></div></div></div><p>These macros are implemented as special operators
662 (as permitted by <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-2.html">[sec_3-1-2-1-2-2]</a>)
663 and, as such, are rather efficient.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defconstant"></a>5.5. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></div><p>The initial value is <span class="strong"><strong>not</strong></span> evaluated at compile time,
664 just like with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>.
665 Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> if you need the value at compile time.</p><p><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s may not be bound dynamically or lexically.</p><p>See also <a class="xref" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE">Section 3.3.3, “Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code>”</a>.</p><p>If you need to undo the effects of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> form,
666 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> (to turn the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a> into a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>),
667 and then <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> it <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> (to turn the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a> into a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-1.html">lexical variable</a>).
668 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you follow the usual variable naming convention
669 (<code class="varname">*FOO*</code> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>,
670 <code class="constant">+BAR+</code> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a>, <code class="varname">ZOT</code>
671 for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>), you will save yourself a lot of trouble.
672 See also <a class="xref" href="#faq-scope" title="A.4.14.">Q: A.4.14</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defconstant-similar"></a>5.5.1. Variable <a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></h3></div></div></div><p>If the variable being defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> is already bound to
673 a value which is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> to the new value, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is issued.
674 If, however, the new value is <strong class="first"><em class="firstterm">visually similar
675 <a id="visually-similar" class="indexterm"></a></em></strong>
676 (prints to the same string, as is commonly the case when re-loading files)
677 to the old one, the warning can be suppressed by setting
678 <a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a> to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value.</p><p>The initial value of <a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
679 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcase"></a>5.6. Macro <a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a></h2></div></div></div><p>This macro allows specifying the test for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_casecm_ccasecm_ecase.html" target="_top"><code class="function">CASE</code></a>, e.g.,
680 </p><pre class="programlisting">
681 (fcase string= (subseq foo 0 (position #\Space foo))
682 ("first" 1)
683 (("second" "two") 2)
684 (("true" "yes") t)
685 (otherwise nil))
686 </pre><p>
687 is the same as
688 </p><pre class="programlisting">
689 (let ((var (subseq foo 0 (position #\Space foo))))
690 (cond ((string= var "first") 1)
691 ((or (string= var "second") (string= var "two")) 2)
692 ((or (string= var "true") (string= var "yes")) t)
693 (t nil)))
694 </pre><p>
695 If you use a built-in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> test (see <a class="xref" href="#ht-test" title="18.4. Function HASH-TABLE-TEST">Section 18.4, “Function <code class="function">HASH-TABLE-TEST</code>”</a>)
696 as the test (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> above, but not a test
697 defined using <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>), the compiler will be able to optimize the
698 <a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a> form better than the corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xor"></a>5.7. Function <code class="function">EXT:XOR</code></h2></div></div></div><p>This function checks that exactly one of its arguments is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
699 and, if this is the case, returns its value and index in the argument
700 list as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>, otherwise returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="eq"></a>5.8. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> compares <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> does.
701 No unnecessary copies are made of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s.
702 Nevertheless, one should use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> as it is more portable across <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>
703 implementations.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>)) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>x</code></em>))</code> always
704 returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for any Lisp object <em class="replaceable"><code>y</code></em>.
705 See also <a class="xref" href="#dffi-eq" title="Equality of foreign values">Equality of foreign values</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="func"></a>5.9. Special Operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a></h2></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns the local function
706 definition established by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">LABELS</code></a>, if it exists, otherwise
707 the global function definition.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_special-operator-p.html" target="_top"><code class="function">SPECIAL-OPERATOR-P</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or
708 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>. If it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, then <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>
709 <em class="replaceable"><code>symbol</code></em>)</code> returns the (useless) special operator handler.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="iteration"></a>Chapter 6. Iteration
710 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-6.html">[chap-6]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dd><dl><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></dd><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="loop"></a>6.1. The LOOP Facility
711 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1.html">[sec_6-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-termination"></a>6.1.1. Mixing Termination Test Clauses
712 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-4.html">[sec_6-1-4]</a></h3></div></div></div><p>Mixing termination test clauses with different default return
713 values is not allowed because it is not specifed whether
714 </p><pre class="programlisting">
715 (loop repeat 1 thereis nil never nil)
716 </pre><p> should return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (the default return value
717 from <code class="literal">NEVER</code>) of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (the default return value from
718 <code class="literal">THEREIS</code>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-inter-var-finally"></a>6.1.2. Iteration variables in the loop epilogue</h3></div></div></div><p>The standard is unambiguous in that the iteration variables do
719 still exist in the
720 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-7-2.html"><code class="literal">FINALLY</code></a>
721 clause, but <span class="strong"><strong>not</strong></span> as to what values these variables might have.
722 Therefore the code which relies on the values of such variables, e.g.,
723 </p><pre class="programlisting">(loop for x on y finally (return x))</pre><p>
724 is inherently non-portable across <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations,
725 and should be avoided.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-ansi"></a>6.1.3. Backward Compatibility</h3></div></div></div><p>There have been some tightening in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> syntax between
726 <a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a> and [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], e.g., the following form is legal in the
727 former but not the latter:</p><pre class="programlisting">
728 (loop initially for i from 1 to 5 do (print i) finally return i)
729 </pre><p>
730 When <strong class="first"><em class="firstterm"><a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a></em></strong> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, such forms are still
731 accepted in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> but elicit a warning at macro-expansion time.
732 When <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="iter-misc"></a>6.2. Miscellaneous</h2></div></div></div><p>The macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dotimes.html" target="_top"><code class="function">DOTIMES</code></a> establish a single binding for
733 the iteration variable and assign it on each iteration.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="objects"></a>Chapter 7. Objects <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html">[chap-7]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std-meth-combo"></a>7.1. Standard Method Combination
734 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6-2.html">[sec_7-6-6-2]</a></h2></div></div></div><p>Generic function
735 <strong class="first"><em class="firstterm"><a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a><a id="no-prim" class="indexterm"></a></em></strong>
736 (similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a>) is called when there is an
737 applicable method but no applicable <span class="emphasis"><em>primary</em></span>
738 method.</p><p>The default methods for <a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a> and
739 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
740 <strong class="first"><em class="firstterm"><a class="link" href="#meth-call-err"><code class="classname">CLOS:METHOD-CALL-ERROR</code></a>
741 <a id="meth-call-err" class="indexterm"></a></em></strong>.
742 You can find out more information about the error using functions
743 <code class="function">CLOS:METHOD-CALL-ERROR-GENERIC-FUNCTION</code>,
744 <code class="function">CLOS:METHOD-CALL-ERROR-ARGUMENT-LIST</code>, and
745 (only for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a>)
746 <code class="function">CLOS:METHOD-CALL-ERROR-METHOD</code>.
747 Moreover, when the generic function has only one <span class="emphasis"><em>dispatching
748 argument</em></span>, (i.e., such an argument that not all the
749 corresponding parameter specializers are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
750 <strong class="first"><em class="firstterm"><a class="link" href="#meth-call-type-err"><code class="classname">CLOS:METHOD-CALL-TYPE-ERROR</code></a>
751 <a id="meth-call-type-err" class="indexterm"></a></em></strong>
752 is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed, additionally making <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-DATUM</code></a> and
753 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a> available.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="structures"></a>Chapter 8. Structures
754 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-8.html">[chap-8]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></dd><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defstruct-options"></a>8.1. The options for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defstruct-print-function"></a>8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</h3></div></div></div><p>The <code class="constant">:PRINT-FUNCTION</code> option should contain a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>
755 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (object stream depth) (declare (ignore depth)) ...)</code>
756 This <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> names a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> whose task is to output the
757 external representation of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <em class="replaceable"><code>object</code></em> onto the
758 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>stream</code></em>. This may be done by outputting text onto the
759 stream using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-str_m_write-line.html" target="_top"><code class="function">WRITE-STRING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>,
760 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> and the like.
761 The following rules must be obeyed:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a> must be
762 respected.</li><li class="listitem">The treatment of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is up to you.
763 </li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> need not be
764 respected. This is managed by the system. (But the print-circle
765 mechanism handles only those objects that are direct or indirect
766 components of the structure.)</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a> is respected by
767 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions
768 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-3.html"><code class="literal">~W</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions
769 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-2.html"><code class="literal">~D</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-3.html"><code class="literal">~B</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-4.html"><code class="literal">~O</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-5.html"><code class="literal">~X</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>,
770 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> with not-numerical arguments.
771 Therefore the print-level mechanism works automatically if only these
772 functions are used for outputting objects and if they are not called
773 on objects with nesting level &gt; 1. (The print-level mechanism does
774 not recognize how many parentheses you have output. It only counts how
775 many times it was called recursively.)</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a> must be respected,
776 especially if you are outputting an arbitrary number of components.
777 </li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> must be
778 respected. Remember that the values of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a>,
779 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a> are ignored if
780 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true. The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is
781 respected by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>,
782 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>,
783 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-3.html"><code class="literal">~W</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-2.html"><code class="literal">~D</code></a>,
784 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-3.html"><code class="literal">~B</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-4.html"><code class="literal">~O</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-5.html"><code class="literal">~X</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>,
785 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> with not-numerical arguments. Therefore
786 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> will be respected automatically if only these
787 functions are used for printing objects.</li><li class="listitem">You need not worry about the values of
788 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-BASE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-RADIX*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a>,
789 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-gensymst.html" target="_top"><code class="varname">*PRINT-GENSYM*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a>, <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a>,
790 <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a>, <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a>.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defstruct-inherit"></a>8.1.2. The <code class="constant">:INHERIT</code> option</h3></div></div></div><p>The <code class="constant">:INHERIT</code> option is exactly like <code class="constant">:INCLUDE</code> except that it
791 does not create new accessors for the inherited slots (this is a
792 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defstruct-mop"></a>8.2. The structure <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a></h2></div></div></div><p>The following functions accept a structure <em class="replaceable"><code>name</code></em> as the only argument.
793 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> was given the <code class="constant">:TYPE</code> option (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> did
794 <span class="strong"><strong>not</strong></span> define a new type), then <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> <em class="replaceable"><code>name</code></em>)</code>
795 fails (and the regular <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is not applicable), but these
796 functions still work.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">EXT:STRUCTURE-SLOTS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
797 </dd><dt><span class="term"><code class="function">EXT:STRUCTURE-DIRECT-SLOTS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
798 </dd><dt><span class="term"><code class="function">EXT:STRUCTURE-KEYWORD-CONSTRUCTOR</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the keyword
799 constructor function for the structure, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the structure has
800 no keyword constructor.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-BOA-CONSTRUCTORS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of names (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s)
801 of BOA constructors for the structure.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-COPIER</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the copier for the
802 structure.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-PREDICATE</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the predicate for
803 the structure.</dd></dl></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="conditions"></a>Chapter 9. Conditions
804 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-9.html">[chap-9]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></div><p>When an error occurred, you are in a break loop. You can evaluate
805 forms as usual. The <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> command (or help key if there is one) lists
806 the available <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> commands.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cond-nl"></a>9.1. Embedded Newlines in Condition Reports
807 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-3-1-3.html">[sec_9-1-3-1-3]</a></h2></div></div></div><p>The error message prefix for the first line is <span class="quote">“<span class="quote">*** - </span>”</span>.
808 All subsequent lines are indented by 6 characters.
809 Long lines are broken on <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-4-7.html">whitespace</a>
810 (see <a class="xref" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM">Section 30.8, “Class <code class="classname">EXT:FILL-STREAM</code>”</a>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cond-fname"></a>9.2. Mentioning Containing Function in
811 Condition Reports <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-3-1-5.html">[sec_9-1-3-1-5]</a></h2></div></div></div><p>Contrary to the recommendation of the standard, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> usually
812 does print the name of the containing function to simplify debugging
813 in batch mode, see <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="restarts"></a>9.3. Interfaces to Restarts
814 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-4-2-2.html">[sec_9-1-4-2-2]</a></h2></div></div></div><p><a id="restart-case"></a><strong>Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>. </strong>In <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> <em class="replaceable"><code>form</code></em> {<em class="replaceable"><code>restart-clause</code></em>}*)</code>,
815 the argument list can also be specified after the keyword/value pairs
816 instead of before them, i.e., each <em class="replaceable"><code>restart-clause</code></em> can be either
817 <code class="code">(<code class="varname">restart-name</code> <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>
818 {<em class="replaceable"><code>keyword-value-pair</code></em>}* {<em class="replaceable"><code>form</code></em>}*)</code>
819 or <code class="code">(<em class="replaceable"><code>restart-name</code></em>
820 {<em class="replaceable"><code>keyword-value-pair</code></em>}* <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>.
821 </p><p><a id="with-restarts"></a><strong>Macro <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a>. </strong>The macro <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>, except that the
822 forms are specified after the restart clauses instead of before them,
823 and the restarts created are not implicitly associated with any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>.
824 <code class="code">(<a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a> ({<em class="replaceable"><code>restart-clause</code></em>}*) {<em class="replaceable"><code>form</code></em>}*)</code> is
825 therefore equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> {<em class="replaceable"><code>form</code></em>}*)
826 {<em class="replaceable"><code>restart-clause</code></em>}*)</code>.</p><p><a id="compute-restarts"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a> behave as specified in
827 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: If the optional <em class="replaceable"><code>condition</code></em> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
828 only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s associated with that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>
829 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s associated with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> at all are considered.
830 Therefore the effect of associating a restart to a condition is not to
831 activate it, but to hide it from other conditions.
832 This makes the syntax-dependent implicit association performed by
833 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> nearly obsolete.</p><p><a id="muffle-cerrors"></a><strong>Macro <a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a>. </strong>The macro <code class="code">(<a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
834 executes the <em class="replaceable"><code>form</code></em>s; when a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>
835 can be invoked non-interactively (this includes all <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s signaled
836 by the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>), no message is printed, instead, the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a>
837 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="appease-cerrors"></a><strong>Macro <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
838 executes the <em class="replaceable"><code>form</code></em>s; when a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>
839 can be invoked non-interactively (this includes all <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
840 by the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>), it is reported as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>, and the
841 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="abort-on-error"></a><strong>Macro <a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
842 executes the <em class="replaceable"><code>form</code></em>s; when an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs, or when a <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
843 interrupt occurs, the error message is printed and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_abort.html" target="_top"><code class="function">ABORT</code></a>
844 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="exit-on-error"></a><strong>Macro <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
845 executes the <em class="replaceable"><code>form</code></em>s; when an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs, or when a <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
846 interrupt occurs, the error message is printed and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> terminates
847 with an error status.</p><p><a id="err-pr-bt"></a><strong>Variable <a href="impnotes.html#err-pr-bt" class="olink"><code class="varname">CUSTOM:*REPORT-ERROR-PRINT-BACKTRACE*</code></a>. </strong>When this variable is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> the error message printed by
848 <a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> and <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a> includes the <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> (stack).
849 </p><p><a id="global-handler"></a><strong>Function <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>. </strong>The function <code class="code">(<a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> <em class="replaceable"><code>condition</code></em> handler)</code>
850 establishes a global handler for the <em class="replaceable"><code>condition</code></em>.
851 The <em class="replaceable"><code>handler</code></em> should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>able (a
852 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>).
853 If it returns, the next applicable handler is invoked, so if you do
854 <span class="strong"><strong>not</strong></span> want to land in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a>, it should <span class="strong"><strong>not</strong></span> return.
855 E.g., the option <code class="option"><a href="clisp.html#opt-on-error" class="olink">-on-error</a></code> <code class="option">abort</code> and the macro
856 <a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> are implemented by installing the following handler:
857 </p><pre class="programlisting">(defun sys::abortonerror (condition)
858 (sys::report-error condition)
859 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-restart.html" target="_top"><code class="function">INVOKE-RESTART</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">ABORT</code></a> condition)))</pre><p>
860 When <em class="replaceable"><code>handler</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the handler
861 for <em class="replaceable"><code>condition</code></em> is removed and returned.
862 When <em class="replaceable"><code>condition</code></em> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all global handlers are removed and returned
863 as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, which can then be passed to <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> as the
864 first argument and the handlers re-established.</p><p><a id="without-global-handlers"></a><strong>Macro <a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a>
865 <em class="replaceable"><code>body</code></em>)</code> removes all global handlers by <code class="code">(<a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>
866 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code>, executes <em class="replaceable"><code>body</code></em> (where unhandled conditions now
867 invoke the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a>), and then restores the handlers.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="assertions"></a>9.4. Assertions
868 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-5.html">[sec_9-1-5]</a></h2></div></div></div><p>The prompt for replacement values (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_store-value.html" target="_top"><code class="function">STORE-VALUE</code></a>,
869 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_use-value.html" target="_top"><code class="function">USE-VALUE</code></a> et al) is terminated with <a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a> to indicate that
870 the value entered is treated as usual for the Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>, i.e., it is
871 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="symbols"></a>Chapter 10. Symbols <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-10.html">[chap-10]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="packages"></a>Chapter 11. Packages
872 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-11.html">[chap-11]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></dd><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt><dd><dl><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></dd></dl></div><div class="variablelist"><p class="title"><strong>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] packages present in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><dl class="variablelist"><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a></span></dt><dd>with the nicknames <strong class="package"><span class="quote">“<span class="quote">CL</span>”</span></strong>
873 and <strong class="package"><span class="quote">“<span class="quote">LISP</span>”</span></strong></dd><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></span></dt><dd>with the nicknames <strong class="package"><span class="quote">“<span class="quote">CL-USER</span>”</span></strong>
874 and <strong class="package"><span class="quote">“<span class="quote">USER</span>”</span></strong></dd><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-3.html"><strong class="package"><span class="quote">“<span class="quote">KEYWORD</span>”</span></strong></a></span></dt><dd>with no nicknames
875 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pack-intro"></a>11.1. Introduction to Packages
876 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-1.html">[sec_11-1-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-pack"></a>11.1.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a></h3></div></div></div><p>The default value of the <code class="constant">:USE</code> argument is
877 <span class="data"><code class="literal">(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>)</code></span>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> accepts additional keyword arguments
878 <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> and <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> (but <span class="strong"><strong>not</strong></span> <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a>!)
879 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defpack"></a>11.1.2. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> accepts additional options <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
880 <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a>, and <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a>.</p><p>When the package being defined already exists, it is modified as
881 follows (and in this order):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a></span></dt><dd>adjusted with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P"><code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a>)</code>
882 (with a warning)</dd><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a></span></dt><dd>adjusted with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P"><code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a>)</code>
883 (with a warning)</dd><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a></span></dt><dd><p>if <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> is being used, it is un-used and
884 <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> is used instead; also, <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> is used instead of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>
885 throughout the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> form, e.g.,</p><pre class="programlisting">
886 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FOO"
887 (<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
888 (<code class="constant">:USE</code> "COMMON-LISP" "EXT"))
889 </pre><p>is equivalent to</p><pre class="programlisting">
890 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FOO"
891 (<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
892 (<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
893 (<code class="constant">:USE</code> "CS-COMMON-LISP" "EXT"))
894 </pre><p class="simpara"><code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> reverts the
895 effects of <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.</p></dd><dt><span class="term"><code class="constant">:NICKNAMES</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rename-package.html" target="_top"><code class="function">RENAME-PACKAGE</code></a>
896 </dd><dt><span class="term"><code class="constant">:DOCUMENTATION</code></span></dt><dd>reset to the new value with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
897 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a>)</code></dd><dt><span class="term"><code class="constant">:SHADOW</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadow.html" target="_top"><code class="function">SHADOW</code></a>
898 </dd><dt><span class="term"><code class="constant">:SHADOWING-IMPORT-FROM</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadowing-import.html" target="_top"><code class="function">SHADOWING-IMPORT</code></a>
899 </dd><dt><span class="term"><code class="constant">:USE</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unuse-package.html" target="_top"><code class="function">UNUSE-PACKAGE</code></a>
900 </dd><dt><span class="term"><code class="constant">:IMPORT-FROM</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_import.html" target="_top"><code class="function">IMPORT</code></a>
901 </dd><dt><span class="term"><code class="constant">:INTERN</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> (but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unintern.html" target="_top"><code class="function">UNINTERN</code></a>)
902 </dd><dt><span class="term"><code class="constant">:EXPORT</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a> (but <span class="strong"><strong>not</strong></span>
903 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unexport.html" target="_top"><code class="function">UNEXPORT</code></a>)</dd><dt><span class="term"><code class="constant">:SIZE</code></span></dt><dd>ignored</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="re-export"></a>11.1.3. Function <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a> <em class="replaceable"><code>FROM-PACK</code></em>
904 <em class="replaceable"><code>TO-PACK</code></em>)</code> re-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s all external
905 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s from <em class="replaceable"><code>FROM-PACK</code></em> also from
906 <em class="replaceable"><code>TO-PACK</code></em>, provided it already uses
907 <em class="replaceable"><code>FROM-PACK</code></em>; and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> otherwise.
908 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pack-inverted"></a>11.1.4. Function <a class="link" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P"><code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></h3></div></div></div><p>Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the argument is a
909 <a class="link" href="#pack-case-inverted">case-inverted package</a>.
910 This function is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able, although it is probably not a good idea
911 to change the case-inverted status of an existing package.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pack-sensitive"></a>11.1.5. Function <a class="link" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P"><code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></h3></div></div></div><p>Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the argument is a <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.
912 This function is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able, although it is probably not a good idea
913 to change the case-sensitive status of an existing package.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pack-lock"></a>11.2. Constraints on the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> Package
914 for Conforming Programs - package locking
915 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1-2.html">[sec_11-1-2-1-2]</a></h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Locking discussed in this section has nothing to do with
916 <a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a>.</p></div><p><strong>Function <strong class="first"><em class="firstterm"><a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a>
917 <a id="pack-lock-f" class="indexterm"></a></em></strong>. </strong>Packages can be <span class="quote">“<span class="quote">locked</span>”</span>.
918 When a package is locked, attempts to change its symbol table or
919 redefine its symbols (as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>,
920 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_deftype.html" target="_top"><code class="function">DEFTYPE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_declaration.html" target="_top"><code class="literal">DECLARATION</code></a>)
921 result in a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> (continuing overrides locking for this operation).
922 When <a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (<span class="strong"><strong>not</strong></span> a good idea!), the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
923 is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed for redefine operations.
924 Function <code class="code">(<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a> <em class="replaceable"><code>package</code></em>)</code>
925 returns the generalized boolean indicating whether the <em class="replaceable"><code>package</code></em> is locked.
926 A package (or a list thereof) can be locked using <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
927 (<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a> <em class="replaceable"><code>package-or-list</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
928 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> locks its system packages (specified in the variable
929 <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>).</p><p><strong>Macro <a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a>. </strong>If you want to evaluate some forms with certain packages unlocked,
930 you can use
931 <strong class="first"><em class="firstterm"><a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a>
932 <a id="without-pack-lock" class="indexterm"></a></em></strong>:
933 </p><pre class="programlisting">
934 (<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a> <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>)
935 (defun restart () ...))
936 </pre><p>
937 or
938 </p><pre class="programlisting">
939 (<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>) (trace read-line))
940 </pre><p>
941 <code class="code">(<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> () ...)</code>
942 temporarily unlocks all packages in <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>.</p><p><strong>Variable <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>. </strong>This variable specifies the default packages to be locked by <a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>
943 and unlocked by <a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> as a list of package names.
944 You may add names to this list, e.g., a module will add its package,
945 but you should <span class="strong"><strong>not</strong></span> remove <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internal packages from this list.
946 </p><p><strong>Discussion - see also
947 <a class="ulink" href="https://groups.google.com/forum/#!msg/comp.lang.lisp/L1xRYHBY2Gs/qjVNn9pEeNgJ" target="_top">the USENET posting</a> by
948 <span class="author"><span class="firstname">Steven M.</span> <span class="surname">Haflich</span></span>. </strong>This should prevent you from accidentally hosing yourself with
949 </p><pre class="programlisting">
950 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> instance ...)
951 </pre><p>
952 and allow enforcing modularity.
953 Note that you will also get the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when you try to
954 assign (with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_psetq.html" target="_top"><code class="function">PSETQ</code></a>, etc.) a value to an internal special
955 variable living in a locked package and not accessible in your current
956 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>, but only in the interpreted code and during compilation.
957 There is no check for package locks in compiled code because of the
958 performance considerations.
959 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clupack"></a>11.3. The
960 <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package
961 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html">[sec_11-1-2-2]</a></h2></div></div></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package uses the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> and <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a> packages.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="imppack"></a>11.4. Implementation-Defined Packages
962 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-4.html">[sec_11-1-2-4]</a></h2></div></div></div><p>The following additional packages exist:</p><div class="variablelist"><p class="title"><strong>Implementation-Defined Packages</strong></p><dl class="variablelist"><dt><span class="term"><a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s all <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>-specific symbols, including some
963 <a class="link" href="#clos-diff" title="4.3. Deviations from ANSI CL standard">additional symbols</a>.
964 </dd><dt><a id="sys-pac"></a><span class="term"><a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a></span></dt><dd>has the nickname <strong class="package"><span class="quote">“<span class="quote">SYS</span>”</span></strong>,
965 and has no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed symbols. It defines many system internals.
966 </dd><dt><a id="ext-pac"></a><span class="term"><a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a></span></dt><dd>
967 is the umbrella package for all extensions: it imports and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>s
968 all the external symbols in all <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extensions, so a simple
969 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> "EXT")</code> is enough to
970 make all the extensions available in the current package.
971 This package uses packages (in addition to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>):
972 <a class="link" href="#syscalls" title="33.2. System Calls"><strong class="package"><span class="quote">“<span class="quote">POSIX</span>”</span></strong></a>, <a class="link" href="#socket" title="32.4. Socket Streams"><strong class="package"><span class="quote">“<span class="quote">SOCKET</span>”</span></strong></a>, <a class="link" href="#gstream" title="31.6. Generic streams"><strong class="package"><span class="quote">“<span class="quote">GSTREAM</span>”</span></strong></a>, <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>,
973 <a class="link" href="#i18n" title="31.4. Internationalization of CLISP"><strong class="package"><span class="quote">“<span class="quote">I18N</span>”</span></strong></a>, <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a>.</dd><dt><span class="term"><a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a></span></dt><dd>defines and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s some character sets, for use with
974 <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> and as <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> argument.
975 </dd><dt><span class="term"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a></span></dt><dd>implements the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility">foreign function
976 interface</a>. Some platforms only.
977 </dd><dt><span class="term"><a class="link" href="#screen" title="32.1. Random Screen Access"><strong class="package"><span class="quote">“<span class="quote">SCREEN</span>”</span></strong></a></span></dt><dd>defines an API for <a class="link" href="#screen" title="32.1. Random Screen Access">random screen
978 access</a>. Some platforms only.
979 </dd><dt><span class="term"><a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a><br /></span><span class="term"><a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a></span></dt><dd><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> versions of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a>.
980 See <a class="xref" href="#package-case" title="11.5. Package Case-Sensitivity">Section 11.5, “Package Case-Sensitivity”</a>.</dd></dl></div><p>All pre-existing packages except <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> belong to the
981 implementation, in the sense that the programs that do not follow
982 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1-2.html">[sec_11-1-2-1-2]</a>
983 (<span class="quote">“<span class="quote">Constraints on the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">‘<span class="quote">COMMON-LISP</span>’</span></strong></a> Package for Conforming Programs</span>”</span>)
984 cause undefined behavior.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="package-case"></a>11.5. Package Case-Sensitivity</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports programs written with case sensitive symbols. For
985 example, with case sensitive symbols, the symbols <code class="literal">cdr</code>
986 (the function equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_rest.html" target="_top"><code class="function">REST</code></a>) and the symbol <code class="literal">CDR</code>
987 (a user-defined type denoting a Call Data Record) are different and unrelated.
988 </p><p>There are some incompatibilities between programs assuming case
989 sensitive symbols and programs assuming the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] case insensitive symbols.
990 For example, <code class="code">(eq 'KB 'Kb)</code> evaluates to false in a case
991 sensitive world and to true in a case insensitive world. However, unlike some
992 commercial <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> allows both kinds of programs to
993 coexist in the same process and interoperate with each other. Example:
994 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">OLD.lisp</code></span></dt><dd><pre class="programlisting">
995 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "OLD")
996 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> FOO () ...)
997 </pre></dd><dt><span class="term"><code class="filename">modern.lisp</code></span></dt><dd><pre class="programlisting">
998 (in-package "NEW")
999 (defun bar () (old:foo))
1000 (symbol-name 'bar) ; ⇒ <code class="computeroutput">"bar"</code>
1001 </pre></dd></dl></div><p>This is achieved through specification of the symbol case policy at
1002 the package level. A <strong class="first"><em class="firstterm">modern package
1003 <a id="pack-modern" class="indexterm"></a></em></strong>
1004 is one that is declared to be both case-sensitive and case-inverted and
1005 which use the symbols from the <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> package.</p><p>A <strong class="first"><em class="firstterm">case-sensitive package
1006 <a id="pack-case-sensitive" class="indexterm"></a></em></strong>
1007 is one whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> declaration (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a>
1008 creation form) has the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
1009 In a case-sensitive package, the reader does <span class="strong"><strong>not</strong></span> uppercase the
1010 symbol name before calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a>. Similarly, the printer, when
1011 printing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> part of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (i.e. the part after
1012 the package markers), behaves as if the readtable's case were set
1013 to <code class="constant">:PRESERVE</code>.
1014 See also <a class="xref" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P">Section 11.1.5, “Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code>”</a>.</p><p>A <strong class="first"><em class="firstterm">case-inverted package
1015 <a id="pack-case-inverted" class="indexterm"></a>
1016 </em></strong> is one whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> declaration (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a>
1017 creation form) has the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
1018 In the context of a case-inverted package, symbol names are
1019 case-inverted: upper case characters are mapped to lower case, lower
1020 case characters are mapped to upper case, and other characters are left
1021 untouched. Every symbol thus conceptually has two symbol names: an
1022 old-world symbol name and a modern-world symbol name, which is the
1023 case-inverted old-world name. The first symbol name is returned by the
1024 function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a>, the modern one by the
1025 function <code class="function">cs-cl:symbol-name</code>. The internal
1026 functions for creating or looking up symbols in a package, which
1027 traditionally took a string argument, now conceptually take two string
1028 arguments: old-style-string and inverted-string. Actually, a function
1029 like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> takes the old-style-string as argument and computes the
1030 inverted-string from it; whereas the
1031 function <code class="function">cs-cl:intern</code> takes the inverted-string as
1032 argument and computes the old-style-string from it.
1033 See also <a class="xref" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P">Section 11.1.4, “Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code>”</a>.</p><p>For a few built-in functions, a variant for the case-inverted
1034 world is defined in the <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> package, which has the nickname
1035 <strong class="package"><span class="quote">“<span class="quote">CS-CL</span>”</span></strong>:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">cs-cl:symbol-name</code></span></dt><dd>returns the case-inverted symbol name.
1036 </dd><dt><span class="term"><code class="function">cs-cl:intern</code><br /></span><span class="term"><code class="function">cs-cl:find-symbol</code></span></dt><dd>work consistently with
1037 <code class="function">cs-cl:symbol-name</code>.</dd><dt><span class="term"><code class="function">cs-cl:shadow</code><br /></span><span class="term"><code class="function">cs-cl:find-all-symbols</code><br /></span><span class="term"><code class="function">cs-cl:string=</code><br /></span><span class="term"><code class="function">cs-cl:string/=</code><br /></span><span class="term"><code class="function">cs-cl:string&lt;</code><br /></span><span class="term"><code class="function">cs-cl:string&gt;</code><br /></span><span class="term"><code class="function">cs-cl:string&lt;=</code><br /></span><span class="term"><code class="function">cs-cl:string&gt;=</code><br /></span><span class="term"><code class="function">cs-cl:string-trim</code><br /></span><span class="term"><code class="function">cs-cl:string-left-trim</code><br /></span><span class="term"><code class="function">cs-cl:string-right-trim</code></span></dt><dd>convert a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and therefore
1038 exist in a variant that uses <code class="function">cs-cl:symbol-name</code>
1039 instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a>.</dd><dt><span class="term"><code class="function">cs-cl:make-package</code></span></dt><dd>creates a case-inverted <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.
1040 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-clu"></a>11.5.1. User Package for the Case-sensitive World</h3></div></div></div><p>A package <a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a> is provided for the user to modify and work in.
1041 It plays the same role as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a>, but for the case-sensitive
1042 world.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-pack-name"></a>11.5.2. Package Names</h3></div></div></div><p>The handling of package names is unchanged. Package names are
1043 still usually uppercase. The package names are also subject to
1044 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_streadtablest.html" target="_top"><code class="varname">*READTABLE*</code></a>)</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-gensym-kwd"></a>11.5.3. Gensyms and Keywords</h3></div></div></div><p>Note that gensyms and keywords are still treated traditionally:
1045 even in a case-sensitive package,</p><pre class="programlisting">
1046 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> '#:FooBar '#:foobar)
1047 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
1048 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> ':KeyWord ':keyword)
1049 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code></pre><p>
1050 We believe this has a limited negative impact for the moment,
1051 but can be changed some time in the future.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="case-sensitive-migration"></a>11.5.4. Migration Tips</h3></div></div></div><p>The following practices will pose no problems when migrating to a
1052 modern case-sensitive world:
1053 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Using [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] symbols in lowercase.</li><li class="listitem">Macros that create symbols by suffixing or prefixing
1054 given symbols.</li><li class="listitem">Comparing symbol names as in
1055 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> <em class="replaceable"><code>x</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> <em class="replaceable"><code>y</code></em>))</code>.
1056 </li></ul></div><p>The following practices will not work in a case-sensitive world or
1057 can give problems:
1058 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Accessing the same symbol in both upper- and
1059 lowercase from the same source file.</li><li class="listitem">Macros that create symbols in other packages than the
1060 original symbols.</li><li class="listitem">Comparing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> return values with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.
1061 </li><li class="listitem">Comparing <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> x)</code> with
1062 <code class="code">(cs-cl:symbol-name y)</code>.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="case-sensitive-startup"></a>11.5.5. Using case-sensitive packages by default</h3></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports a command-line option <code class="option"><a href="clisp.html#opt-modern" class="olink">-modern</a></code> that
1063 sets the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> initially to the <a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a> package, and
1064 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a> to <code class="constant">:DOWNCASE</code>.</p><p>For packages to be located in the <span class="quote">“<span class="quote">modern</span>”</span>
1065 (case-sensitive) world, you need to augment their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a>
1066 declaration by adding the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>,
1067 see <a class="xref" href="#defpack" title="11.1.2. Macro DEFPACKAGE">Section 11.1.2, “Macro <code class="function">DEFPACKAGE</code>”</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="numbers"></a>Chapter 12. Numbers <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-12.html">[chap-12]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt><dd><dl><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></dd><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></dd><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dd><dl><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></dd><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-types"></a>12.1. Numeric Types</h2></div></div></div><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> is the disjoint union of the types
1068 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> (<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#exhaustive_partition">exhaustive
1069 partition</a>)</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> is the disjoint union of the types
1070 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> is the disjoint union of the types
1071 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> is the disjoint union of the types
1072 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> is the disjoint union of the types
1073 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> and
1074 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-concepts"></a>12.2. Number Concepts
1075 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1.html">[sec_12-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></dd><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></dd><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dd><dl><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></dd><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="num-ops"></a>12.2.1. Numeric Operations
1076 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-1.html">[sec_12-1-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="int-func-ext"></a>12.2.1.1. Additional Integer Functions</h4></div></div></div><p><a id="factorial"></a><strong>Function <code class="function">EXT:!</code> </strong><code class="code">(<code class="function">EXT:!</code> <em class="replaceable"><code>n</code></em>)</code> returns the
1077 factorial of <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>n</code></em> being a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p><a id="exquo"></a><strong>Function <code class="function">EXT:EXQUO</code>. </strong><code class="code">(<code class="function">EXT:EXQUO</code> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>)</code> returns
1078 the integer quotient <code class="varname">x/y</code> of two integers
1079 <em class="replaceable"><code>x</code></em>,<em class="replaceable"><code>y</code></em>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when the quotient is not
1080 integer. (This is more efficient than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sl.html" target="_top"><code class="function">/</code></a>.)</p><p><a id="xgcd"></a><strong>Function <code class="function">EXT:XGCD</code>. </strong><code class="code">(<code class="function">EXT:XGCD</code> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)</code>
1081 returns the values <em class="replaceable"><code>l</code></em>, <em class="replaceable"><code>k<sub>1</sub></code></em>, ..., <em class="replaceable"><code>k<sub>n</sub></code></em>, where <em class="replaceable"><code>l</code></em> is the
1082 greatest common divisor of the integers <em class="replaceable"><code>x<sub>1</sub></code></em>, ..., <em class="replaceable"><code>x<sub>n</sub></code></em>, and
1083 <em class="replaceable"><code>k<sub>1</sub></code></em>, ..., <em class="replaceable"><code>k<sub>n</sub></code></em> are the integer coefficients such that
1084 </p><pre class="programlisting">
1085 <em class="replaceable"><code>l</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gcd.html" target="_top"><code class="function">GCD</code></a> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)
1086 = (+ (* <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>1</sub></code></em>) ... (* <em class="replaceable"><code>k<sub>n</sub></code></em> <em class="replaceable"><code>x<sub>n</sub></code></em>))
1087 </pre><p><a id="mod-expt"></a><strong>Function <a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a>. </strong><code class="code">(<a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em> <em class="replaceable"><code>m</code></em>)</code>
1088 is equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_modcm_rem.html" target="_top"><code class="function">MOD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em>) <em class="replaceable"><code>m</code></em>)</code>
1089 except it is more efficient for very large arguments.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-decode"></a>12.2.1.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">DECODE-FLOAT</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-RADIX</code></a> always returns <span class="returnvalue">2</span>.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>digits</code></em>)</code> coerces
1090 <em class="replaceable"><code>number</code></em> (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>) to a floating point number with at least
1091 <em class="replaceable"><code>digits</code></em> mantissa digits. The following always evaluates to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>:
1092 </p><pre class="programlisting">
1093 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&gt;=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>digits</code></em>)) <em class="replaceable"><code>digits</code></em>)
1094 </pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bool-ops"></a>12.2.1.3. Boolean Operations
1095 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html">[convar_boole-_cm_boole-xor]</a></h4></div></div></div><div class="table"><a id="bool-op-table"></a><p class="title"><strong>Table 12.1. Boolean operations</strong></p><div class="table-contents"><table class="table" summary="Boolean operations" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">constant</th><th align="left">value</th></tr></thead><tbody><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-CLR</code></a></td><td align="left">0</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-SET</code></a></td><td align="left">15</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-1</code></a></td><td align="left">10</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-2</code></a></td><td align="left">12</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-C1</code></a></td><td align="left">5</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-C2</code></a></td><td align="left">3</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-AND</code></a></td><td align="left">8</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-IOR</code></a></td><td align="left">14</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-XOR</code></a></td><td align="left">6</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-EQV</code></a></td><td align="left">9</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-NAND</code></a></td><td align="left">7</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-NOR</code></a></td><td align="left">1</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ANDC1</code></a></td><td align="left">4</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ANDC2</code></a></td><td align="left">2</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ORC1</code></a></td><td align="left">13</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ORC2</code></a></td><td align="left">11</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="byte-type"></a>12.2.1.4. Byte Operations on Integers
1096 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-1-3-2.html">[sec_12-1-1-3-2]</a></h4></div></div></div><p>Byte specifiers are objects of built-in type <a class="link" href="#byte-type" title="12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2"><span class="type">BYTE</span></a>,
1097 not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-notes"></a>12.2.1.5. Floating Point Arithmetics</h4></div></div></div><p><a id="expt"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> <em class="replaceable"><code>base</code></em> <em class="replaceable"><code>exponent</code></em>)</code>
1098 is not very precise if <em class="replaceable"><code>exponent</code></em> has a large
1099 absolute value.</p><p><a id="log"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_log.html" target="_top"><code class="function">LOG</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_log.html" target="_top"><code class="function">LOG</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>base</code></em>)</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if
1100 <code class="literal"><em class="replaceable"><code>base</code></em> = 1</code>.</p><p><a id="pi"></a><strong>Constant <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>. </strong>The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> with the precision given
1101 by <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code>. When this precision is changed, the value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is
1102 automatically recomputed. Therefore <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is <span class="strong"><strong>not</strong></span> a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>.
1103 </p><p><a id="ucpt"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a>. </strong>When the argument is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#recognizable_subtype">recognizable subtype</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>,
1104 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, otherwise it
1105 returns its argument (even though a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> number in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can
1106 always have <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_realpartcm_imagpart.html" target="_top"><code class="function">REALPART</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_realpartcm_imagpart.html" target="_top"><code class="function">IMAGPART</code></a> of any type) because it allows
1107 the most precise type inference.</p><p><a id="default-float-format"></a><strong>Variable <a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a>. </strong>When rational numbers are to be converted to floats (due to
1108 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> or a transcendental function), the result
1109 type is given by the variable <a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a>.
1110 See also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a>.</p><p><a id="no-underflow"></a><strong>Macro <a class="link" href="#no-underflow" title="Macro EXT:WITHOUT-FLOATING-POINT-UNDERFLOW"><code class="function">EXT:WITHOUT-FLOATING-POINT-UNDERFLOW</code></a>. </strong>The macro <code class="code">(<a class="link" href="#no-underflow" title="Macro EXT:WITHOUT-FLOATING-POINT-UNDERFLOW"><code class="function">EXT:WITHOUT-FLOATING-POINT-UNDERFLOW</code></a> {<em class="replaceable"><code>form</code></em>}*)</code> executes the
1111 <em class="replaceable"><code>form</code></em>s, with errors of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a> inhibited.
1112 Floating point operations will silently return zero instead of
1113 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ing an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a>.
1114 </p><p><a id="float-invalid-op"></a><strong>Condition <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_id-operation.html" target="_top"><code class="classname">FLOATING-POINT-INVALID-OPERATION</code></a>. </strong>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> is never <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p><a id="float-inexact"></a><strong>Condition <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_oint-inexact.html" target="_top"><code class="classname">FLOATING-POINT-INEXACT</code></a>. </strong>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> is never <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="num-const"></a>12.2.2. Implementation-Dependent Numeric Constants
1115 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-2.html">[sec_12-1-2]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="fixnum-lim"></a>12.2.2.1. Fixnum Limits</h4></div></div></div><div class="table"><a id="fixnum-lim-table"></a><p class="title"><strong>Table 12.2. Fixnum limits</strong></p><div class="table-contents"><table class="table" summary="Fixnum limits" border="1"><colgroup><col align="center" class="vars" /><col align="center" class="b32" /><col align="center" class="b64" /></colgroup><thead><tr><th align="center">CPU type</th><th align="center">32-bit CPU</th><th align="center">64-bit CPU</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>48</sup>-1 = 281474976710655</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a></td><td align="center">-2<sup>24</sup> = -16777216</td><td align="center">-2<sup>48</sup> = -281474976710656</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bignum-lim"></a>12.2.2.2. Bignum Limits</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>s are limited in size. Their maximum size is
1116 <code class="literal">32*(2<sup>16</sup>-2)=2097088</code> bits.
1117 The largest representable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a> is therefore
1118 <code class="literal">2<sup>2097088</sup>-1</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-lim"></a>12.2.2.3. Float Limits</h4></div></div></div><p>Together with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>, the other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> constants
1119 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_short-_tive-epsilon.html" target="_top"><code class="constant">LONG-FLOAT-EPSILON</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_short-_tive-epsilon.html" target="_top"><code class="constant">LONG-FLOAT-NEGATIVE-EPSILON</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-NEGATIVE-LONG-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a></td></tr></table><p>
1120 are recomputed whenever <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>ed.
1121 They are <span class="strong"><strong>not</strong></span> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="long-float-wider-than-bignum"></a>Warning</h3><p>Since the exponent of a
1122 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> is a <a class="link" href="#floating-types-table">signed 32-bits
1123 integer</a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a> is about
1124 <code class="literal">2<sup>2<sup>31</sup></sup></code>,
1125 which is <span class="emphasis"><em>much</em></span> larger that the largest
1126 representable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>, which is <a class="link" href="#bignum-lim" title="12.2.2.2. Bignum Limits">less than</a>
1127 <code class="literal">2<sup>2<sup>21</sup></sup></code>.
1128 This, obviously, means that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">ROUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">TRUNCATE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">FLOOR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">CEILING</code></a>
1129 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> on large <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s.
1130 Less obviously, this means that <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> "<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>"
1131 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a>)</code> also fails.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="float-subst"></a>12.2.3. Rule of Float Substitutability
1132 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-3-3.html">[sec_12-1-3-3]</a></h3></div></div></div><p>When a mathematical function may return an exact (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>) or
1133 inexact (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>) result, it always returns the exact result.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="float-comp"></a>12.2.4. Floating-point Computations
1134 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4.html">[sec_12-1-4]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></div><p>There are four floating point types: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>,
1135 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>:
1136 </p><div class="informaltable"><a id="floating-types-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center">type</th><th align="center">sign</th><th align="center">mantissa</th><th align="center">exponent</th><th align="center">comment</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">16+1 bits</td><td align="center">8 bits</td><td align="center">immediate</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">23+1 bits</td><td align="center">8 bits</td><td align="center"><a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">52+1 bits</td><td align="center">11 bits</td><td align="center"><a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">&gt;=64 bits</td><td align="center">32 bits</td><td align="center">variable
1137 length</td></tr></tbody></table></div><p>The single and double float formats are those of the <a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a>
1138 <span class="quote">“<span class="quote">Standard for Binary Floating-Point Arithmetic</span>”</span>,
1139 except that <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not support features like
1140 <code class="literal">±0</code>, <code class="literal">±inf</code>,
1141 <code class="literal">NaN</code>, gradual underflow, etc.
1142 <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> does not make use of these features, so, to reduce portability
1143 problems, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> by design returns the same floating point results on
1144 all platforms (<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has a floating-point emulation built in for
1145 platforms that do not support <a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a>). Note that
1146 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When you got a <code class="literal">NaN</code>
1147 in your program, your program is broken, so you will spend time
1148 determining where the <code class="literal">NaN</code> came from.
1149 It is better to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in this case.</li><li class="listitem">When you got unnormalized floats in your program,
1150 your results will have a greatly reduced accuracy anyway.
1151 Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has the means to cope with this - <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s of
1152 <a class="link" href="#lfd" title="Arbitrary Precision Floats">variable precision</a> - it does not
1153 need unnormalized floats.</li></ul></div><p>
1154 This is why <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> does not contain the
1155 <code class="constant">:IEEE-FLOATING-POINT</code> keyword.</p><p><a id="lfd"></a><strong>Arbitrary Precision Floats. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s have variable mantissa length, which is a
1156 multiple of 16 (or 32, depending on the word size of the processor).
1157 The default length used when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> is given by the
1158 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code>. It can be set by <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>) <em class="replaceable"><code>n</code></em>)</code>,
1159 where <em class="replaceable"><code>n</code></em> is a positive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>. E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)
1160 3322)</code> sets the default precision of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s to about
1161 1000 decimal digits.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="flocont"></a>12.2.4.1. Rule of Float Precision Contagion
1162 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-4.html">[sec_12-1-4-4]</a></h4></div></div></div><p>The floating point contagion is controlled by the variable
1163 <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a>. When it is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, contagion is done as per the
1164 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> →
1165 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Rationale:</span></dt><dd>See it pragmatically: save what you can and let
1166 others worry about the rest.</dd><dt><span class="term">Brief:</span></dt><dd><a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> knows the number's <span class="emphasis"><em>precision</em></span>,
1167 not <span class="emphasis"><em>accuracy</em></span>, so preserving the precision can be
1168 accomplished reliably, while anything relating to the accuracy is
1169 just a speculation - only the user (programmer) knows what it is in
1170 each case.</dd><dt><span class="term">Detailed:</span></dt><dd>A computer float is an approximation of a real number.
1171 One can think of it as a random variable with the mean equal to
1172 itself and standard deviation equal to half the last significant digit.
1173 E.g., <code class="literal">1.5</code> is actually <code class="literal">1.5±0.05</code>.
1174 Consider adding <code class="literal">1.5</code> and <code class="literal">1.75</code>.
1175 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requires that <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1.5 1.75)</code>
1176 return <span class="returnvalue">3.25</span>, while traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
1177 would return <span class="returnvalue">3.3</span>.
1178 The implied random variables are: <code class="literal">3.25±0.005</code>
1179 and <code class="literal">3.3±0.05</code>.
1180 Note that the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> way <span class="strong"><strong>does</strong></span>
1181 lie about the mean: the mean <span class="strong"><strong>is</strong></span> <code class="literal">3.25</code> and
1182 nothing else, while the standard way
1183 <span class="strong"><strong>could</strong></span> be lying about the deviation
1184 (accuracy): if the implied accuracy of <code class="literal">1.5</code> (i.e., 0.05)
1185 is its actual accuracy, then the accuracy of the result cannot be
1186 smaller that that. Therefore, since <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> has no way of knowing the
1187 actual accuracy, [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] (and all the other standard engineering
1188 programming languages, like <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, <a class="dict" href="http://foldoc.org/Fortran"><span class="command"><strong>Fortran</strong></span></a>
1189 etc) decided that keeping the accuracy correct is the business of the
1190 programmer, while the language should preserve what it can - the precision.
1191 </dd><dt><span class="term">Experience:</span></dt><dd>Rounding errors accumulate, and if a computation
1192 is conducted with insufficient precision, an outright incorrect
1193 result can be returned.
1194 (E.g., <code class="code">E(x<sup>2</sup>) -
1195 E(x)<sup>2</sup></code> can be negative!)
1196 The user should not mix floats of different precision (that's what
1197 <a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a> is for), but one should not be penalized for this too
1198 harshly.</dd></dl></div><p>When <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> method is used,
1199 namely the result of an arithmetic operation whose arguments are of
1200 different float types is rounded to the float format of the shortest
1201 (least precise) of the arguments: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> →
1202 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>
1203 → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> (in contrast to
1204 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-4.html">[sec_12-1-4-4]</a>!)</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Rationale:</span></dt><dd>See it mathematically. Add intervals:
1205 <code class="code">{1.0 ± 1e-8} + {1.0 ± 1e-16} = {2.0 ±
1206 1e-8}</code>. So, if we add <code class="literal">1.0s0</code> and
1207 <code class="literal">1.0d0</code>, we should get <code class="literal">2.0s0</code>.
1208 </dd><dt><span class="term">Brief:</span></dt><dd>Do not suggest high accuracy of a result by giving
1209 it a precision that is greater than its accuracy.
1210 </dd><dt><span class="term">Example:</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_-.html" target="_top"><code class="function">-</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1.7 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>)</code>
1211 should not return <span class="returnvalue">1.700000726342836417234L0</span>,
1212 it should return <span class="returnvalue">1.7f0</span> (or
1213 <span class="returnvalue">1.700001f0</span> if there were rounding errors).
1214 </dd><dt><span class="term">Experience:</span></dt><dd>If in a computation using thousands of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s,
1215 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> (like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>) happens to be used, the long precision
1216 should not propagate throughout all the intermediate values.
1217 Otherwise, the long result would look precise, but its accuracy is
1218 only that of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>; furthermore much computation time
1219 would be lost by calculating with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s when only
1220 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s would be needed.</dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="warn-fpc"></a>Variable <a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a></h5></div></div></div><p>If the variable <a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is emitted for
1221 every coercion involving different floating-point types.
1222 As explained above, float precision contagion is not a good idea.
1223 You can avoid the contagion by doing all your computations with the
1224 same floating-point type (and using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a> to convert all constants,
1225 e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>, to your preferred type).</p><p>This variable helps you eliminate all occurrences of float
1226 precision contagion: set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a
1227 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> on float precision contagion; set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> to have
1228 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> on float precision contagion, so that you
1229 can look at the stack <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="floratcont"></a>12.2.4.2. Rule of Float and Rational Contagion
1230 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-1.html">[sec_12-1-4-1]</a></h4></div></div></div><p>The contagion between floating point and rational numbers is controlled
1231 by the variable <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a>. When it is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, contagion is done as per
1232 the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>.</p><p>When <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> method is used,
1233 namely if the result is mathematically an exact rational number, this
1234 rational number is returned (in contrast to
1235 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-1.html">[sec_12-1-4-1]</a>!)</p><p><a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> has an effect only in those few cases when the mathematical
1236 result is exact although one of the arguments is a floating-point number,
1237 such as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_st.html" target="_top"><code class="function">*</code></a> 0 1.618)</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sl.html" target="_top"><code class="function">/</code></a> 0 1.618)</code>,
1238 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_asincm_acoscm_atan.html" target="_top"><code class="function">ATAN</code></a> 0 1.0)</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> 2.0 0)</code>,
1239 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> 2.718)</code>.</p><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="warn-fprc"></a>Variable <a class="link" href="#warn-fprc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*</code></a></h5></div></div></div><p>If the variable <a class="link" href="#warn-fprc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is emitted for
1240 every avoidable coercion from a rational number to a floating-point number.
1241 You can avoid such coercions by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a> to convert the particular
1242 rational numbers to your preferred floating-point type.</p><p>This variable helps you eliminate all occurrences of avoidable
1243 coercions to a floating-point number when a rational number result
1244 would be possible: set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
1245 in such situations; set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an
1246 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in such situations, so that you can look at the stack
1247 <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="phasecont"></a>Variable <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a></h5></div></div></div><p>A similar variable, <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a>, controls the return
1248 value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> when the argument is an exact nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>.
1249 Namely, if <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it returns a floating-point zero;
1250 if <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it returns an exact zero. Example:
1251 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> 2/3)</code></p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="complex-comp"></a>12.2.5. Complex Computations
1252 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-5.html">[sec_12-1-5]</a></h3></div></div></div><p>Complex numbers can have a real part and an imaginary part of
1253 different types. For example, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> -9.0)</code> evaluates to
1254 the number <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0 3.0)</code></span>,
1255 which has a real part of exactly <code class="literal">0</code>,
1256 not only <span class="data"><code class="literal">0.0</code></span>
1257 (which would mean <span class="quote">“<span class="quote">approximately 0</span>”</span>).</p><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> for this is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
1258 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>)</code></span>, and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
1259 <code class="varname">type-of-real-part</code>
1260 <code class="varname">type-of-imaginary-part</code>)</code></span> in general.</p><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
1261 <em class="replaceable"><code>type</code></em>)</code></span> is equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
1262 <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>type</code></em>)</code></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="complex-rational"></a>12.2.6. Rule of Canonical Representation
1263 for Complex Rationals <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-5-3.html">[sec_12-1-5-3]</a></h3></div></div></div><p>Complex numbers can have a real part and an imaginary part of
1264 different types. If the imaginary part is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> to <code class="literal">0</code>,
1265 the number is automatically converted to a real number.</p><p>This has the advantage that
1266 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((x (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> -9.0))) (* x x))</code> - instead of
1267 evaluating to <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(-9.0 0.0)</code></span>,
1268 with <em class="replaceable"><code>x</code></em> = <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0.0 3.0)</code></span> -
1269 evaluates to <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(-9.0 0)</code></span> =
1270 <span class="data"><code class="literal">-9.0</code></span>,
1271 with <em class="replaceable"><code>x</code></em> = <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0 3.0)</code></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="random-state"></a>12.2.7. Random-State Operations
1272 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-7.html">[sec_12-1-7]</a></h3></div></div></div><p>To ease reproducibility, the variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> is
1273 initialized to the same value on each invocation, so that
1274 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
1275 will always print the same number.</p><p>If you want a new random state on each invocation, you can arrange
1276 for that by using <a href="impnotes.html#init-func" class="olink">init function</a>: </p><pre class="screen">
1277 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "foo" :init-function (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-random-state.html" target="_top"><code class="function">MAKE-RANDOM-STATE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))))'
1278 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> foo.mem <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
1279 or by placing <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a>
1280 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-random-state.html" target="_top"><code class="function">MAKE-RANDOM-STATE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> into your <a href="clisp.html#opt-norc" class="olink">RC file</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="characters"></a>Chapter 13. Characters
1281 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-13.html">[chap-13]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dd><dl><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></dd><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></dd><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dd><dl><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></dd><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-intro"></a>13.1. Introduction to Characters
1282 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1.html">[sec_13-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-code"></a>13.1.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a> takes values from <code class="literal">0</code> (inclusive) to
1283 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> (exclusive), i.e., the implementation
1284 supports exactly <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> characters.</p><div class="table"><a id="char-code-limit-table"></a><p class="title"><strong>Table 13.1. Number of characters</strong></p><div class="table-contents"><table class="table" summary="Number of characters" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">binaries built</th><th align="center"><span class="strong"><strong>without</strong></span> <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> support</th><th align="center"><span class="strong"><strong>with</strong></span> <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> support</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a></td><td align="center">2<sup>8</sup> = 256</td><td align="center">17 * 2<sup>16</sup> = 1114112</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="base-char"></a>13.1.2. Type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a></h3></div></div></div><p>The types <code class="classname">EXT:STRING-CHAR</code> and
1285 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a> are equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
1286 <code class="classname">EXT:STRING-CHAR</code> used to be available as
1287 <code class="classname">STRING-CHAR</code> prior to removal from [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] by
1288 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss026.html" target="_top">CHARACTER-PROPOSAL:2</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-width"></a>13.1.3. Function <a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a> <em class="replaceable"><code>char</code></em>)</code> returns the number of screen
1289 columns occupied by <em class="replaceable"><code>char</code></em>. The value is </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">0</span></dt><dd>for non-spacing
1290 characters (such as control characters and many combining
1291 characters);</dd><dt><span class="term">2</span></dt><dd>for double-width East
1292 Asian characters;</dd><dt><span class="term">1</span></dt><dd>for all other
1293 characters.</dd></dl></div><p>
1294 See also function <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a>.
1295 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-sets"></a>13.2. Character sets</h2></div></div></div><p>The characters are ordered according to a superset of the
1296 <a class="link" href="#charset-ASCII">ASCII character set</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd>More precisely, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top">Unicode</a> <a class="ulink" href="https://www.unicode.org/unicode/reports/tr28/" target="_top">3.2</a>
1297 character set (ISO 10646, also known as UCS-4).
1298 </dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p>More precisely, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the ISO Latin-1 (ISO
1299 8859-1) character set:
1300 </p><div class="informaltable"><a id="latin-1-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center">#x0</th><th align="center">#x1</th><th align="center">#x2</th><th align="center">#x3</th><th align="center">#x4</th><th align="center">#x5</th><th align="center">#x6</th><th align="center">#x7</th><th align="center">#x8</th><th align="center">#x9</th><th align="center">#xA</th><th align="center">#xB</th><th align="center">#xC</th><th align="center">#xD</th><th align="center">#xE</th><th align="center">#xF</th></tr></thead><tbody><tr><td align="center">#x00</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td></tr><tr><td align="center">#x10</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td></tr><tr><td align="center">#x20</td><td align="center"> </td><td align="center">!</td><td align="center">"</td><td align="center">#</td><td align="center">$</td><td align="center">%</td><td align="center">&amp;</td><td align="center">'</td><td align="center">(</td><td align="center">)</td><td align="center">*</td><td align="center">+</td><td align="center">,</td><td align="center">-</td><td align="center">.</td><td align="center">/</td></tr><tr><td align="center">#x30</td><td align="center">0</td><td align="center">1</td><td align="center">2</td><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td align="center">9</td><td align="center">:</td><td align="center">;</td><td align="center">&lt;</td><td align="center">=</td><td align="center">&gt;</td><td align="center">?</td></tr><tr><td align="center">#x40</td><td align="center">@</td><td align="center">A</td><td align="center">B</td><td align="center">C</td><td align="center">D</td><td align="center">E</td><td align="center">F</td><td align="center">G</td><td align="center">H</td><td align="center">I</td><td align="center">J</td><td align="center">K</td><td align="center">L</td><td align="center">M</td><td align="center">N</td><td align="center">O</td></tr><tr><td align="center">#x50</td><td align="center">P</td><td align="center">Q</td><td align="center">R</td><td align="center">S</td><td align="center">T</td><td align="center">U</td><td align="center">V</td><td align="center">W</td><td align="center">X</td><td align="center">Y</td><td align="center">Z</td><td align="center">[</td><td align="center">\</td><td align="center">]</td><td align="center">^</td><td align="center">_</td></tr><tr><td align="center">#x60</td><td align="center">`</td><td align="center">a</td><td align="center">b</td><td align="center">c</td><td align="center">d</td><td align="center">e</td><td align="center">f</td><td align="center">g</td><td align="center">h</td><td align="center">i</td><td align="center">j</td><td align="center">k</td><td align="center">l</td><td align="center">m</td><td align="center">n</td><td align="center">o</td></tr><tr><td align="center">#x70</td><td align="center">p</td><td align="center">q</td><td align="center">r</td><td align="center">s</td><td align="center">t</td><td align="center">u</td><td align="center">v</td><td align="center">w</td><td align="center">x</td><td align="center">y</td><td align="center">z</td><td align="center">{</td><td align="center">|</td><td align="center">}</td><td align="center">~</td><td align="center"> </td></tr><tr><td align="center">#x80</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">
1301 </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">#x90</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">
1302 </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">#xA0</td><td align="center"> </td><td align="center">¡</td><td align="center">¢</td><td align="center">£</td><td align="center">¤</td><td align="center">¥</td><td align="center">¦</td><td align="center">§</td><td align="center">¨</td><td align="center">©</td><td align="center">ª</td><td align="center">«</td><td align="center">¬</td><td align="center">­</td><td align="center">®</td><td align="center">¯</td></tr><tr><td align="center">#xB0</td><td align="center">°</td><td align="center">±</td><td align="center">²</td><td align="center">³</td><td align="center">´</td><td align="center">µ</td><td align="center">¶</td><td align="center">·</td><td align="center">¸</td><td align="center">¹</td><td align="center">º</td><td align="center">»</td><td align="center">¼</td><td align="center">½</td><td align="center">¾</td><td align="center">¿</td></tr><tr><td align="center">#xC0</td><td align="center">À</td><td align="center">Á</td><td align="center">Â</td><td align="center">Ã</td><td align="center">Ä</td><td align="center">Å</td><td align="center">Æ</td><td align="center">Ç</td><td align="center">È</td><td align="center">É</td><td align="center">Ê</td><td align="center">Ë</td><td align="center">Ì</td><td align="center">Í</td><td align="center">Î</td><td align="center">Ï</td></tr><tr><td align="center">#xD0</td><td align="center">Ð</td><td align="center">Ñ</td><td align="center">Ò</td><td align="center">Ó</td><td align="center">Ô</td><td align="center">Õ</td><td align="center">Ö</td><td align="center">×</td><td align="center">Ø</td><td align="center">Ù</td><td align="center">Ú</td><td align="center">Û</td><td align="center">Ü</td><td align="center">Ý</td><td align="center">Þ</td><td align="center">ß</td></tr><tr><td align="center">#xE0</td><td align="center">à</td><td align="center">á</td><td align="center">â</td><td align="center">ã</td><td align="center">ä</td><td align="center">å</td><td align="center">æ</td><td align="center">ç</td><td align="center">è</td><td align="center">é</td><td align="center">ê</td><td align="center">ë</td><td align="center">ì</td><td align="center">í</td><td align="center">î</td><td align="center">ï</td></tr><tr><td align="center">#xF0</td><td align="center">ð</td><td align="center">ñ</td><td align="center">ò</td><td align="center">ó</td><td align="center">ô</td><td align="center">õ</td><td align="center">ö</td><td align="center">÷</td><td align="center">ø</td><td align="center">ù</td><td align="center">ú</td><td align="center">û</td><td align="center">ü</td><td align="center">ý</td><td align="center">þ</td><td align="center">ÿ</td></tr></tbody></table></div><p>
1303 Here ** are control characters, not graphic
1304 characters. (The characters left blank here cannot be represented in
1305 this character set).
1306 </p></dd></dl></div><div class="table"><a id="standard-char-table"></a><p class="title"><strong>Table 13.2. Standard characters</strong></p><div class="table-contents"><table class="table" summary="Standard characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Space</span></td><td align="center"><span class="keycode">#x20</span></td></tr><tr><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keycode">#x0A</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="semi-standard-char-table"></a><p class="title"><strong>Table 13.3. Semi-standard characters</strong></p><div class="table-contents"><table class="table" summary="Semi-standard characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Backspace</span></td><td align="center"><span class="keycode">#x08</span></td></tr><tr><td align="center"><span class="keysym">#\Tab</span></td><td align="center"><span class="keycode">#x09</span></td></tr><tr><td align="center"><span class="keysym">#\Linefeed</span></td><td align="center"><span class="keycode">#x0A</span></td></tr><tr><td align="center"><span class="keysym">#\Page</span></td><td align="center"><span class="keycode">#x0C</span></td></tr><tr><td align="center"><span class="keysym">#\Return</span></td><td align="center"><span class="keycode">#x0D</span></td></tr></tbody></table></div></div><br class="table-break" /><p><span class="keysym">#\Newline</span> is the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>.</p><div class="table"><a id="extra-named-chars-table"></a><p class="title"><strong>Table 13.4. Additional Named Characters</strong></p><div class="table-contents"><table class="table" summary="Additional Named Characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Null</span></td><td align="center"><span class="keycode">#x00</span></td></tr><tr><td align="center"><span class="keysym">#\Bell</span></td><td align="center"><span class="keycode">#x07</span></td></tr><tr><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keycode">#x1B</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="ctrl-char-table"></a><p class="title"><strong>Table 13.5. Additional syntax for characters with code from
1307 <span class="keycode">#x00</span> to <span class="keycode">#x1F</span>:</strong></p><div class="table-contents"><table class="table" summary="Additional syntax for characters with code from&#10; #x00 to #x1F:" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\^@</span></td><td align="center"><span class="keycode">#x00</span></td></tr><tr><td align="center"><span class="keysym">#\^A</span> … <span class="keysym">#\^Z</span></td><td align="center"><span class="keycode">#x01</span> …
1308 <span class="keycode">#x1A</span></td></tr><tr><td align="center"><span class="keysym">#\^[</span></td><td align="center"><span class="keycode">#x1B</span></td></tr><tr><td align="center"><span class="keysym">#\^\</span></td><td align="center"><span class="keycode">#x1C</span></td></tr><tr><td align="center"><span class="keysym">#\^]</span></td><td align="center"><span class="keycode">#x1D</span></td></tr><tr><td align="center"><span class="keysym">#\^^</span></td><td align="center"><span class="keycode">#x1E</span></td></tr><tr><td align="center"><span class="keysym">#\^_</span></td><td align="center"><span class="keycode">#x1F</span></td></tr></tbody></table></div></div><br class="table-break" /><p>See also <a class="xref" href="#sharpsign-backslash" title="2.6.1. Sharpsign Backslash sec_2-4-8-1">Section 2.6.1, “Sharpsign Backslash sec_2-4-8-1”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-script"></a>13.3. Character Scripts
1309 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-2-1.html">[sec_13-1-2-1]</a></h2></div></div></div><p>The only defined character script is the type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
1310 itself.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-attrib"></a>13.4. Character Attributes
1311 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-3.html">[sec_13-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></div><p>Characters have no implementation-defined or <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> font and bit
1312 attributes. All characters are simple characters.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="input-char"></a>13.4.1. Input Characters</h3></div></div></div><p>For backward compatibility, there is a class <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>
1313 representing either a character with font and bits, or a keystroke.
1314 The following functions work with objects of types <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
1315 and <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
1316 Note that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> are equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> on objects of type
1317 <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">EXT:CHAR-FONT-LIMIT</code> = 16</span></dt><dd>The system uses only font 0.
1318 </dd><dt><span class="term"><code class="constant">EXT:CHAR-BITS-LIMIT</code> = 16</span></dt><dd><p>Character bits:
1319 </p><div class="informaltable"><a id="bit-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">key</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><code class="constant">:CONTROL</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-CONTROL-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:META</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-META-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:SUPER</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-SUPER-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:HYPER</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-HYPER-BIT</code></a></td></tr></tbody></table></div></dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-FONT</code>
1320 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns the font of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
1321 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-BITS</code>
1322 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns the bits of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
1323 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-CHAR</code>
1324 <em class="replaceable"><code>char</code></em> [<em class="replaceable"><code>bits</code></em>
1325 [<em class="replaceable"><code>font</code></em>]])</code></span></dt><dd>returns a new <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if such a
1326 character cannot be created.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-BIT</code>
1327 <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the named bit is set in <em class="replaceable"><code>object</code></em>,
1328 else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:SET-CHAR-BIT</code>
1329 <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>new-value</code></em>)</code></span></dt><dd>returns a new <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> with the named bit set or
1330 unset, depending on the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> <em class="replaceable"><code>new-value</code></em>.
1331 </dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> is <span class="strong"><strong>not</strong></span> a subtype of
1332 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd>The system itself uses this <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> type only to
1333 mention special keys and <span class="keycap"><strong>Control</strong></span>/<span class="keycap"><strong>Alternate</strong></span>/<span class="keycap"><strong>Shift</strong></span> key status on return from
1334 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a>)</code>.</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="graph-char"></a>13.5. Graphic Characters
1335 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-1.html">[sec_13-1-4-1]</a></h2></div></div></div><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_g.html#graphic">graphic</a> characters are those <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
1336 defined by the <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard, excluding the ranges
1337 <span class="keycode">U0000</span> … <span class="keycode">U001F</span> and
1338 <span class="keycode">U007F</span> … <span class="keycode">U009F</span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alpha-char"></a>13.6. Alphabetic Characters
1339 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-2.html">[sec_13-1-4-2]</a></h2></div></div></div><p>The alphabetic characters are those <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
1340 defined as letters by the <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard, e.g., the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters
1341 </p><div class="literallayout"><p><code class="literal">             ABCDEFGHIJKLMNOPQRSTUVWXYZ<br />
1342              abcdefghijklmnopqrstuvwxyz</code></p></div><p>
1343 and the international alphabetic characters from the character set:
1344 </p><div class="literallayout"><p><code class="literal">             ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜßáíóúñѪºãõØøÀÃÕ</code></p></div><p>
1345 etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-case"></a>13.7. Characters With Case
1346 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-3.html">[sec_13-1-4-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-invertcase"></a>13.7.1. Function <a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a> <em class="replaceable"><code>char</code></em>)</code> returns the corresponding
1347 character in the other case for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_charcm_schar.html" target="_top"><code class="function">CHAR</code></a>, i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-upca_har-downcase.html" target="_top"><code class="function">CHAR-UPCASE</code></a> for a
1348 lowercase character and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-upca_har-downcase.html" target="_top"><code class="function">CHAR-DOWNCASE</code></a> for an uppercase character; for
1349 a character that does not have a case attribute, the argument is returned.
1350 See also <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a> and <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-ext"></a>13.7.2. Case of Implementation-Defined Characters
1351 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-3-4.html">[sec_13-1-4-3-4]</a></h3></div></div></div><p>The characters with case are those <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters <em class="replaceable"><code>c</code></em>, for
1352 which the upper case mapping <em class="replaceable"><code>uc</code></em> and the lower case mapping <em class="replaceable"><code>lc</code></em>
1353 have the following properties:
1354 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><em class="replaceable"><code>uc</code></em> and <em class="replaceable"><code>lc</code></em> are different</li><li class="listitem"><em class="replaceable"><code>c</code></em> is one of <em class="replaceable"><code>uc</code></em> and <em class="replaceable"><code>lc</code></em></li><li class="listitem">the upper case mapping of <em class="replaceable"><code>uc</code></em> and of <em class="replaceable"><code>lc</code></em>
1355 is <em class="replaceable"><code>uc</code></em></li><li class="listitem">the lower case mapping of <em class="replaceable"><code>uc</code></em> and of <em class="replaceable"><code>lc</code></em>
1356 is <em class="replaceable"><code>lc</code></em></li></ul></div><p>The titlecase property of <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters has no equivalent in
1357 <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-char"></a>13.8. Numeric Characters
1358 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-4.html">[sec_13-1-4-4]</a></h2></div></div></div><p>The numeric characters are those <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
1359 defined as digits by the <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-ord"></a>13.9. Ordering of Characters
1360 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-6.html">[sec_13-1-6]</a></h2></div></div></div><p>The characters are ordered according to their <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> code.</p><p>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-EQUAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-EQUAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-LESSP</code></a>,
1361 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-GREATERP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-GREATERP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-LESSP</code></a> ignore bits and
1362 font attributes of their arguments.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-names"></a>13.10. Character Names
1363 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-7.html">[sec_13-1-7]</a></h2></div></div></div><p>Character names of non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters are the names defined by
1364 <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>, with spaces replaced by underscores, and converted to upper case.
1365 There are two exceptions, though:
1366 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="keysym">#\U0001F514</span></span></dt><dd> has the name <code class="literal">UNICODE_BELL</code>,
1367 because the name <code class="literal">BELL</code> is already taken by the
1368 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> control character with code 7 (the audible bell character).
1369 </dd><dt><span class="term"><span class="keysym">#\U0001F5CF</span></span></dt><dd>has the name <code class="literal">UNICODE_PAGE</code>,
1370 because the name <code class="literal">PAGE</code> is already taken by the
1371 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> control character with code 12 (the form feed or page
1372 separator character).</dd></dl></div><p>
1373 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clhs-newline"></a>13.11. Treatment of Newline during Input and Output
1374 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-8.html">[sec_13-1-8]</a></h2></div></div></div><p>Newlines are written according to the stream's <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>, see the
1375 function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> and the description of <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s,
1376 in particular, <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>s.
1377 The default behavior is as follows:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>When writing to a file, <span class="keysym">#\Newline</span> is converted to
1378 <span class="keycode">CR</span>/<span class="keycode">LF</span>. (This is the usual convention on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>.)
1379 For example, <span class="keysym">#\Return</span>+<span class="keysym">#\Newline</span> is written as <span class="keycode">CR</span>/<span class="keycode">CR</span>/<span class="keycode">LF</span>.
1380 </dd></dl></div><p>When reading from a file, <span class="keycode">CR</span>/<span class="keycode">LF</span> is converted to <span class="keysym">#\Newline</span>
1381 (the usual convention on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>), and <span class="keycode">CR</span> not followed by <span class="keycode">LF</span> is
1382 converted to <span class="keysym">#\Newline</span> as well (the usual conversion on MacOS, also used
1383 by some programs on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>).
1384 If you do not want this, i.e., if you really want to distinguish
1385 <span class="keycode">LF</span>, <span class="keycode">CR</span> and <span class="keycode">CR</span>/<span class="keycode">LF</span>, you have to resort to
1386 binary input (function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>).</p><p><strong>Justification. </strong><a class="ulink" href="http://www.unicode.org/reports/tr13/tr13-9.html" target="_top">Unicode
1387 Newline Guidelines</a> say: <span class="quote">“<span class="quote">Even if you know which
1388 characters represents NLF on your particular platform, on input and in
1389 interpretation, treat CR, LF, CRLF, and NEL the same. Only on output do
1390 you need to distinguish between them.</span>”</span></p><p><strong>Rationale. </strong>In <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, <span class="keysym">#\Newline</span> is identical to <span class="keysym">#\Linefeed</span>
1391 (which is specifically permitted by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] in
1392 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-7.html">[sec_13-1-7]</a> <span class="quote">“<span class="quote">Character Names</span>”</span>).
1393 Consider a file containing exactly this string:
1394 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatenate.html" target="_top"><code class="function">CONCATENATE</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/any_string.html" target="_top"><code class="literal">STRING</code></a> "foo" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Linefeed</span>)
1395 "bar" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Return</span>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Linefeed</span>))</code>
1396 Suppose we open it with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> "foo" <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>)</code>.
1397 What should <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> return?
1398 Right now, it returns <span class="returnvalue">"foo"</span>
1399 (the second <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> returns <span class="returnvalue">"bar"</span>
1400 and reaches <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>).
1401 If our i/o were <span class="quote">“<span class="quote">faithful</span>”</span>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> would have
1402 returned the string <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatenate.html" target="_top"><code class="function">CONCATENATE</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/any_string.html" target="_top"><code class="literal">STRING</code></a> "foo" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a>
1403 <span class="keysym">#\Linefeed</span>) "bar")</code>, i.e., a string with an embedded <span class="keysym">#\Newline</span>
1404 between <span class="returnvalue">"foo"</span>
1405 and <span class="returnvalue">"bar"</span> (because a single <span class="keysym">#\Linefeed</span> is not a
1406 <span class="keysym">#\Newline</span> in the specified <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>, it will not make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> return,
1407 but it <span class="strong"><strong>is</strong></span> a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <span class="keysym">#\Newline</span>!) Even though the specification for
1408 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> does not explicitly forbids newlines inside the returned
1409 string, such behavior would be quite surprising, to say the least.
1410 Moreover, this line (with an embedded <span class="keysym">#\Newline</span>) would be written as two
1411 lines (when writing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> of <code class="constant">:DOS</code>), because
1412 the embedded <span class="keysym">#\Newline</span> would be written as <span class="keycode">CR</span>+<span class="keycode">LF</span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-int"></a>13.12. Character Encodings
1413 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-9.html">[sec_13-1-9]</a></h2></div></div></div><p>The integer returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-int.html" target="_top"><code class="function">CHAR-INT</code></a> is the same as the character's
1414 code (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="script-ext"></a>13.13. Documentation of Implementation-Defined Scripts
1415 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-10.html">[sec_13-1-10]</a></h2></div></div></div><p>See <a class="xref" href="#encoding" title="31.5. Encodings">Section 31.5, “Encodings”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-platform-dep"></a>13.14. Platform-Dependent Characters</h2></div></div></div><p>The characters that are not <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_g.html#graphic">graphic</a> chars and the space character
1416 have names:</p><div class="table"><a id="dos-win32-chars-table"></a><p class="title"><strong>Table 13.6. Additional characters (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>)</strong></p><div class="table-contents"><table class="table" summary="Additional characters (Win32 platform only.)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">code</th><th align="center">char</th></tr></thead><tbody><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x00)</code></td><td align="center"><span class="keysym">#\Null</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x07)</code></td><td align="center"><span class="keysym">#\Bell</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x08)</code></td><td align="center"><span class="keysym">#\Backspace</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x09)</code></td><td align="center"><span class="keysym">#\Tab</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0A)</code></td><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keysym">#\Linefeed</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0B)</code></td><td align="center"><span class="keysym">#\Code11</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0C)</code></td><td align="center"><span class="keysym">#\Page</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0D)</code></td><td align="center"><span class="keysym">#\Return</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1A)</code></td><td align="center"><span class="keysym">#\Code26</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1B)</code></td><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keysym">#\Esc</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x20)</code></td><td align="center"><span class="keysym">#\Space</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x7F)</code></td><td align="center"><span class="keysym">#\Rubout</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="unix-chars-table"></a><p class="title"><strong>Table 13.7. Additional characters (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span>)</strong></p><div class="table-contents"><table class="table" summary="Additional characters (UNIX platform only.)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">code</th><th align="center">char</th></tr></thead><tbody><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x00)</code></td><td align="center"><span class="keysym">#\Null</span></td><td align="center"><span class="keysym">#\Nul</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x01)</code></td><td align="center"><span class="keysym">#\Soh</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x02)</code></td><td align="center"><span class="keysym">#\Stx</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x03)</code></td><td align="center"><span class="keysym">#\Etx</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x04)</code></td><td align="center"><span class="keysym">#\Eot</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x05)</code></td><td align="center"><span class="keysym">#\Enq</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x06)</code></td><td align="center"><span class="keysym">#\Ack</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x07)</code></td><td align="center"><span class="keysym">#\Bell</span></td><td align="center"><span class="keysym">#\Bel</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x08)</code></td><td align="center"><span class="keysym">#\Backspace</span></td><td align="center"><span class="keysym">#\Bs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x09)</code></td><td align="center"><span class="keysym">#\Tab</span></td><td align="center"><span class="keysym">#\Ht</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0A)</code></td><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keysym">#\Nl</span></td><td align="center"><span class="keysym">#\Linefeed</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0B)</code></td><td align="center"><span class="keysym">#\Vt</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0C)</code></td><td align="center"><span class="keysym">#\Page</span></td><td align="center"><span class="keysym">#\Np</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0D)</code></td><td align="center"><span class="keysym">#\Return</span></td><td align="center"><span class="keysym">#\Cr</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0E)</code></td><td align="center"><span class="keysym">#\So</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0F)</code></td><td align="center"><span class="keysym">#\Si</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x10)</code></td><td align="center"><span class="keysym">#\Dle</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x11)</code></td><td align="center"><span class="keysym">#\Dc1</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x12)</code></td><td align="center"><span class="keysym">#\Dc2</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x13)</code></td><td align="center"><span class="keysym">#\Dc3</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x14)</code></td><td align="center"><span class="keysym">#\Dc4</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x15)</code></td><td align="center"><span class="keysym">#\Nak</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x16)</code></td><td align="center"><span class="keysym">#\Syn</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x17)</code></td><td align="center"><span class="keysym">#\Etb</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x18)</code></td><td align="center"><span class="keysym">#\Can</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x19)</code></td><td align="center"><span class="keysym">#\Em</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1A)</code></td><td align="center"><span class="keysym">#\Sub</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1B)</code></td><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keysym">#\Esc</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1C)</code></td><td align="center"><span class="keysym">#\Fs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1D)</code></td><td align="center"><span class="keysym">#\Gs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1E)</code></td><td align="center"><span class="keysym">#\Rs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1F)</code></td><td align="center"><span class="keysym">#\Us</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x20)</code></td><td align="center"><span class="keysym">#\Space</span></td><td align="center"><span class="keysym">#\Sp</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x7F)</code></td><td align="center"><span class="keysym">#\Rubout</span></td><td align="center"><span class="keysym">#\Delete</span></td><td align="center"><span class="keysym">#\Del</span></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-bits"></a>13.15. Obsolete Constants</h2></div></div></div><div class="table"><a id="char-bits-table"></a><p class="title"><strong>Table 13.8. Character bit constants (obsolete)</strong></p><div class="table-contents"><table class="table" summary="Character bit constants (obsolete)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">constant</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-CONTROL-BIT</code></a></td><td align="center">1</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-META-BIT</code></a></td><td align="center">2</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-SUPER-BIT</code></a></td><td align="center">4</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-HYPER-BIT</code></a></td><td align="center">8</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="conses"></a>Chapter 14. Conses <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-14.html">[chap-14]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cons-list"></a>14.1. Conses as Lists
1417 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_14-1-2.html">[sec_14-1-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="map-func"></a>14.1.1. Mapping Functions</h3></div></div></div><p><a id="mapcap"></a><strong>Function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a>. </strong>The function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAN</code></a>, except that it
1418 concatenates the resulting lists with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a>:
1419 </p><pre class="programlisting">(<a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>) ≡
1420 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAR</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>))</pre><p>
1421 (Actually a bit more efficient that this would have been.)</p><p><a id="maplap"></a><strong>Function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a>. </strong>The function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCON</code></a>, except that it
1422 concatenates the resulting lists with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a>:
1423 </p><pre class="programlisting">(<a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>) ≡
1424 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPLIST</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>))</pre><p>
1425 (Actually a bit more efficient that this would have been.)</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="arrays"></a>Chapter 15. Arrays <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-15.html">[chap-15]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></div><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> can return specialized arrays for the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a>s
1426 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 2)</code></span>,
1427 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 4)</code></span>,
1428 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 16)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span>, and, of course, the required
1429 specializations <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_nil.html" target="_top"><code class="classname">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a> for displaced arrays. </strong>An array to which another array is displaced should not be shrunk
1430 (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a>) in such a way that the other array points into
1431 void space. This cannot be checked at the time <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a> is
1432 called!</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="array-elts"></a>15.1. Array Elements
1433 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_15-1-1.html">[sec_15-1-1]</a></h2></div></div></div><div class="table"><a id="array-limit-table"></a><p class="title"><strong>Table 15.1. Array limits</strong></p><div class="table-contents"><table class="table" summary="Array limits" border="1"><colgroup><col align="center" class="vars" /><col align="center" class="b32" /><col align="center" class="b64" /></colgroup><thead><tr><th align="center">CPU type</th><th align="center">32-bit CPU</th><th align="center">64-bit CPU</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-rank-limit.html" target="_top"><code class="constant">ARRAY-RANK-LIMIT</code></a></td><td colspan="2" align="center">2<sup>12</sup> = 4096</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-_ension-limit.html" target="_top"><code class="constant">ARRAY-DIMENSION-LIMIT</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>32</sup>-1 = 4294967295</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-_l-size-limit.html" target="_top"><code class="constant">ARRAY-TOTAL-SIZE-LIMIT</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>32</sup>-1 = 4294967295</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="strings"></a>Chapter 16. Strings <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-16.html">[chap-16]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="string-misc"></a>16.1. Miscellaneous</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-comp"></a>16.1.1. String Comparison</h3></div></div></div><p>String comparison (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING&lt;</code></a> and friends) is based on the
1434 function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR&lt;=</code></a> (see <a class="xref" href="#char-ord" title="13.9. Ordering of Characters sec_13-1-6">Section 13.9, “Ordering of Characters sec_13-1-6”</a>).
1435 Therefore diphthongs do <span class="strong"><strong>not</strong></span> obey the usual national rules. Example:
1436 <code class="literal">o &lt; oe &lt; z &lt; ö</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-width"></a>16.1.2. Function <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>start</code></em>
1437 <em class="replaceable"><code>end</code></em>)</code> returns the number of screen columns occupied by
1438 <em class="replaceable"><code>string</code></em>. This is computed as the sum of all <a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>s of all
1439 of the <em class="replaceable"><code>string</code></em>'s characters:</p><pre class="programlisting">
1440 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reduce.html" target="_top"><code class="function">REDUCE</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> <em class="replaceable"><code>string</code></em> <code class="constant">:KEY</code> #'<a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>)
1441 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-invertcase"></a>16.1.3. Functions <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a>
1442 and <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>)</code>
1443 and <code class="code">(<a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>)</code>
1444 are similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string-up_g-capitalize.html" target="_top"><code class="function">STRING-UPCASE</code></a> et al: they use <a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a> to
1445 invert the case of each characters in the argument string region.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="sequences"></a>Chapter 17. Sequences
1446 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-17.html">[chap-17]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></dd><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></dd><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> &amp; <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> &amp; <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> &amp; <code class="function">STABLE-SORT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="seq-func-ext"></a>17.1. Additional Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="trim-if"></a>17.1.1. Function <code class="function">EXT:TRIM-IF</code></h3></div></div></div><p>Function <code class="code">(<code class="function">EXT:TRIM-IF</code> <em class="replaceable"><code>predicate</code></em>
1447 <em class="replaceable"><code>sequence</code></em>)</code> returns the portion of <em class="replaceable"><code>sequence</code></em> without the
1448 leading and trailing elements which match <em class="replaceable"><code>predicate</code></em>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="seq-macro-ext"></a>17.2. Additional Macros</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doseq"></a>17.2.1. Macro <a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a></h3></div></div></div><p>For iteration through a sequence, a macro <a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a>,
1449 similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a>, may be used instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_map.html" target="_top"><code class="function">MAP</code></a>:</p><pre class="programlisting">
1450 (<a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>sequence-form</code></em> [<em class="replaceable"><code>result-form</code></em>])
1451 {<em class="replaceable"><code>declaration</code></em>}*
1452 {<em class="replaceable"><code>tag</code></em>|<em class="replaceable"><code>form</code></em>}*)
1453 </pre><p><a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a> forms are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#iteration_form">iteration form</a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="nreverse-nreconc"></a>17.3. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a></h2></div></div></div><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a>. </strong>The result of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> is always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the argument.
1454 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> swaps pairs of elements.
1455 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> swaps the first and the last
1456 element and reverses the list chaining between them.</p><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a>. </strong>The result of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the first argument unless it is
1457 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case the result is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the second argument.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rem-del"></a>17.4. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE-IF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE-IF-NOT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_remove-du_e-duplicates.html" target="_top"><code class="function">REMOVE-DUPLICATES</code></a> return
1458 their argument unchanged, if no element has to be removed.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE-IF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE-IF-NOT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_remove-du_e-duplicates.html" target="_top"><code class="function">DELETE-DUPLICATES</code></a>
1459 destructively modify their argument: If the argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>,
1460 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> parts are modified. If the argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> with
1461 fill pointer, the fill pointer is lowered and the remaining elements are
1462 compacted below the new fill pointer.</p><p><a id="count-ansi"></a><strong>Variable <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a>. </strong>Contrary to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss283.html" target="_top">RANGE-OF-COUNT-KEYWORD:NIL-OR-INTEGER</a>,
1463 negative <code class="constant">:COUNT</code> keyword arguments are not allowed unless you set
1464 <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value, in which case <span class="quote">“<span class="quote">using a
1465 negative integer value is functionally equivalent to using a value of
1466 zero</span>”</span>, as per the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sorting"></a>17.5. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> accept two additional keyword arguments
1467 <code class="constant">:START</code> and <code class="constant">:END</code>:</p><pre class="programlisting">
1468 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>predicate</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:KEY</code> <code class="constant">:START</code> <code class="constant">:END</code>)
1469 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>predicate</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:KEY</code> <code class="constant">:START</code> <code class="constant">:END</code>)
1470 </pre><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> are identical.
1471 They implement the mergesort algorithm.
1472 Worst case complexity: <code class="varname">O(n*log(n))</code> comparisons,
1473 where <em class="replaceable"><code>n</code></em> is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> of the subsequence bounded
1474 by the <code class="constant">:START</code> and <code class="constant">:END</code> arguments.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="hash"></a>Chapter 18. Hash Tables <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-18.html">[chap-18]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></dd><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="hash-mod-key"></a>18.1. Modifying Hash Table Keys
1475 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_18-1-2.html">[sec_18-1-2]</a></h2></div></div></div><p>If you <span class="quote">“<span class="quote">visibly modify</span>”</span> a key, consequences are
1476 <span class="emphasis"><em>unpredictable</em></span>:</p><pre class="programlisting">
1477 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<em class="replaceable"><code>hash-table</code></em> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> :test '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>)))
1478 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> <em class="replaceable"><code>hash-table</code></em> <em class="replaceable"><code>hash-table</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
1479 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> <em class="replaceable"><code>hash-table</code></em> <em class="replaceable"><code>hash-table</code></em>))
1480 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
1481 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code></pre><p>
1482 because <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a>)</code> modifies <em class="replaceable"><code>hash-table</code></em>, the very next
1483 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> does <span class="strong"><strong>not</strong></span> find it in itself.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="make-hash"></a>18.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> accepts two additional keyword arguments
1484 <code class="constant">:INITIAL-CONTENTS</code> and <code class="constant">:WEAK</code>:</p><pre class="programlisting">
1485 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :TEST :INITIAL-CONTENTS :SIZE
1486 :REHASH-SIZE :REHASH-THRESHOLD
1487 :WARN-IF-NEEDS-REHASH-AFTER-GC :WEAK)
1488 </pre><p>The <code class="constant">:TEST</code> argument can be, other than one of the symbols <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>,
1489 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>, one of the symbols <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and
1490 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>. Both of these tests use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> as the comparison
1491 function; they differ in their performance characteristics.
1492 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a></span></dt><dd>This uses the fastest possible hash function.
1493 Its drawback is that its hash codes become invalid at every <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
1494 (except if all keys are <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s),
1495 thus requiring a reorganization of the hash table at the first
1496 access after each <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion. Especially when generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is used,
1497 which leads to frequent small <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions, large hash table with this test
1498 can lead to scalability problems.</dd><dt><span class="term"><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a></span></dt><dd>This uses a slower hash function that has the
1499 property that its hash codes for instances of the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>,
1500 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> (subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>) and
1501 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a> (subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>) are
1502 stable across GCs.
1503 This test can thus avoid the scalability problems if all keys,
1504 other than <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s, are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or
1505 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a> instances.</dd></dl></div><p>
1506 One can recommend to use <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> for short-lived hash tables.
1507 For tables with a longer lifespan which can be big or accessed
1508 frequently, it is recommended to use <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>, and to modify the
1509 objects that are used as its keys to become instances of
1510 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a>.
1511 </p><p>When the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or the function <code class="literal">#'eq</code> is
1512 used as a <code class="constant">:TEST</code> argument, the value of the variable
1513 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQ-HASHFUNCTION*</code>
1514 <a id="eq-hashfunction" class="indexterm"></a></em></strong> is used instead.
1515 This value must be one of <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a>, <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.</p><p>Similarly, the <code class="constant">:TEST</code> argument can also be one
1516 of the symbols <code class="constant">EXT:FASTHASH-EQL</code>,
1517 <code class="constant">EXT:STABLEHASH-EQL</code>,
1518 <code class="constant">EXT:FASTHASH-EQUAL</code>,
1519 <code class="constant">EXT:STABLEHASH-EQUAL</code>.
1520 The same remarks apply as for <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.
1521 When the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or the function <code class="literal">#'eql</code> is used
1522 as a <code class="constant">:TEST</code> argument, the value of the variable
1523 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQL-HASHFUNCTION*</code>
1524 <a id="eql-hashfunction" class="indexterm"></a></em></strong> is used
1525 instead; this value must be one of <code class="constant">EXT:FASTHASH-EQL</code>,
1526 <code class="constant">EXT:STABLEHASH-EQL</code>.
1527 Similarly, when the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> or the function <code class="literal">#'equal</code>
1528 is used as a <code class="constant">:TEST</code> argument, the value of the variable
1529 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQUAL-HASHFUNCTION*</code>
1530 <a id="equal-hashfunction" class="indexterm"></a></em></strong> is used
1531 instead; this value must be one of <code class="constant">EXT:FASTHASH-EQUAL</code>,
1532 <code class="constant">EXT:STABLEHASH-EQUAL</code>.</p><p>The <code class="constant">:WARN-IF-NEEDS-REHASH-AFTER-GC</code> argument,
1533 if true, causes a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed when an object is stored
1534 into the table which will force table reorganizations at the first
1535 access of the table after each <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
1536 This keyword argument can be used to check whether <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>
1537 should be preferred over <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> for a particular table.
1538 Use <code class="function">HASH-TABLE-WARN-IF-NEEDS-REHASH-AFTER-GC</code>
1539 to check and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> this parameter after the table has been created.</p><p>The <code class="constant">:INITIAL-CONTENTS</code> argument is an
1540 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> that is used to initialize the new hash table.</p><p>The <code class="constant">:REHASH-THRESHOLD</code> argument is ignored.</p><p>The <code class="constant">:WEAK</code> argument can take the following values:
1541 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (default)</td></tr><tr><td><code class="constant">:KEY</code></td></tr><tr><td><code class="constant">:VALUE</code></td></tr><tr><td><code class="constant">:KEY-AND-VALUE</code></td></tr><tr><td><code class="constant">:KEY-OR-VALUE</code></td></tr></table><p>
1542 and specifies whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is <span class="emphasis"><em>weak</em></span>:
1543 if the key, value, either or both are not accessible for the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
1544 purposes, i.e., if they are only accessible via weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
1545 and <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s, it is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed and removed from the weak
1546 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>.</p><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able predicate <code class="function">EXT:HASH-TABLE-WEAK-P</code>
1547 checks whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is weak.</p><p>Note that the only test that makes sense for weak hash tables are
1548 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> and its variants <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.</p><p>Just like all other <a class="link" href="#weak" title="31.7. Weak Objects">weak objects</a>, weak
1549 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s cannot be printed readably.</p><p>See also <a class="xref" href="#weak-ht" title="31.7.9. Weak Hash Tables">Section 31.7.9, “Weak Hash Tables”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="hashtable-gc-rehash"></a>18.2.1. Interaction between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s and <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion</h3></div></div></div><p>When a hash table contains keys to be compared by identity - such
1550 as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s with the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>;
1551 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es in tables which test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>;
1552 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s in tables which test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>;
1553 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> instances in tables which
1554 test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>;
1555 - the hash code will in general depend on the object's address in
1556 memory. Therefore it will in general be invalidated after a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion,
1557 and the hash table's internal structure must be recomputed at the next
1558 table access.</p><p>While <code class="constant">:WARN-IF-NEEDS-REHASH-AFTER-GC</code> can help
1559 checking the efficiency of a particular <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, the variable
1560 <strong class="first"><em class="firstterm"><a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a>
1561 <a id="hashtable-gc-rehash-warn" class="indexterm"></a></em></strong>
1562 achieves the same effect for all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s in the system at once:
1563 when <a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a> is true and a
1564 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> needs to be rehashed after a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, a warning is
1565 issued that shows the inefficient <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>.</p><p>What can be done to avoid the inefficiencies detected by these warnings?
1566 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">In many cases you can solve the problem
1567 by using the <code class="function">STABLEHASH</code> variant of the hash
1568 test.</li><li class="listitem">In other cases, namely <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> or
1569 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> instances, you can solve the problem by making
1570 the key object classes inherit from <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or
1571 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a>, respectively.</li><li class="listitem">In the remaining cases, you should store a hash key
1572 inside the object, of which you can guarantee uniqueness through
1573 your application (for example the ID of an object in a database, or
1574 the serial number of an object), and use this key as hash key
1575 instead of the original object.</li></ol></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defhash"></a>18.3. Macro <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></h2></div></div></div><p>You can define a new hash table test using the macro
1576 <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>: <code class="code">(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> test-name <em class="replaceable"><code>test-function</code></em> <em class="replaceable"><code>hash-function</code></em>)</code>, after
1577 which <em class="replaceable"><code>name</code></em> can be passed as the <code class="constant">:TEST</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a>.
1578 E.g.: </p><pre class="programlisting">(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> string <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a>)
1579 ⇒ <code class="computeroutput">STRING</code>
1580 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> :test 'string)
1581 ⇒ <code class="computeroutput">#S(HASH-TABLE :TEST (#&lt;SYSTEM-FUNCTION STRING=&gt; . #&lt;SYSTEM-FUNCTION SXHASH&gt;))</code></pre><p>
1582 (which is not too useful because it is equivalent to an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>
1583 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> but less efficient).</p><p>The fundamental requirement is that the <em class="replaceable"><code>test-function</code></em> and <em class="replaceable"><code>hash-function</code></em> are
1584 consistent: </p><pre class="programlisting">
1585 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>test-function</code></em> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>) ⇒
1586 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>hash-function</code></em> <em class="replaceable"><code>x</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>hash-function</code></em> <em class="replaceable"><code>y</code></em>))</pre><p>
1587 This means that the following definition: </p><pre class="programlisting">
1588 (<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> number <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">broken!</span></em></pre><p>
1589 is <span class="strong"><strong>not</strong></span> correct because </p><pre class="programlisting">
1590 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> 1 1d0)
1591 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">same object!</span></em>
1592 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> 1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> 1d0))
1593 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">different buckets!</span></em></pre><p>
1594 The correct way is, e.g.: </p><pre class="programlisting">
1595 (<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> number <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> x '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>))))</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Note that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>ing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> does <span class="strong"><strong>not</strong></span> cons up
1596 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> objects while <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>ing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> does.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ht-test"></a>18.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> returns either one of
1597 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a></td><td><code class="constant">EXT:FASTHASH-EQUAL</code></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a></td><td><code class="constant">EXT:STABLEHASH-EQUAL</code></td></tr><tr><td><code class="constant">EXT:FASTHASH-EQL</code></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a></td></tr><tr><td><code class="constant">EXT:STABLEHASH-EQL</code></td><td> </td></tr></table><p>
1598 (but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> nor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> anymore), or, for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
1599 created with a user-defined <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> (see macro <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>),
1600 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> cell <span class="returnvalue">(<em class="replaceable"><code>test-function</code></em> . <em class="replaceable"><code>hash-function</code></em>)</span>.
1601 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dohash"></a>18.5. Macro <a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a></h2></div></div></div><p>For iteration through a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, a macro <a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a>,
1602 similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a>, can be used instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maphash.html" target="_top"><code class="function">MAPHASH</code></a>:</p><pre class="programlisting">
1603 (<a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a> (<em class="replaceable"><code>key-var</code></em> <em class="replaceable"><code>value-var</code></em> <em class="replaceable"><code>hash-table-form</code></em> [<em class="replaceable"><code>resultform</code></em>])
1604 {<em class="replaceable"><code>declaration</code></em>}*
1605 {<em class="replaceable"><code>tag</code></em>|<em class="replaceable"><code>form</code></em>}*)
1606 </pre><p><a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a> forms are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#iteration_form">iteration form</a>s.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="filenames"></a>Chapter 19. Filenames
1607 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-19.html">[chap-19]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></dd><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></dd></dl></div><p>For most operations, pathnames denoting files and pathnames
1608 denoting directories cannot be used interchangeably.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>For example, <code class="filename">#P"foo/bar"</code> denotes
1609 the file <code class="filename">#P"bar"</code> in the directory <code class="filename">#P"foo"</code>,
1610 while <code class="filename">#P"foo/bar/"</code> denotes the subdirectory
1611 <code class="filename">#P"bar"</code> of the directory <code class="filename">#P"foo"</code>.
1612 </dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>For example, <code class="filename">#P"foo\\bar"</code>
1613 denotes the file <code class="filename">#P"bar"</code> in the directory <code class="filename">#P"foo"</code>,
1614 while <code class="filename">#P"foo\\bar\\"</code> denotes the subdirectory
1615 <code class="filename">#P"bar"</code> of the directory <code class="filename">#P"foo"</code>.
1616 </dd><dt><a id="device-prefix"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> platforms only.</span></span></span></dt><dd>User variable <strong class="first"><em class="firstterm"><a class="link" href="#device-prefix"><code class="varname">CUSTOM:*DEVICE-PREFIX*</code></a></em></strong>
1617 controls translation between <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> pathnames
1618 (e.g., <code class="filename">#P"/cygdrive/c/gnu/clisp/"</code>) and native
1619 <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> pathnames (e.g., <code class="filename">#P"C:\\gnu\\clisp\\"</code>)
1620 When it is set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, no translations occur and the <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> port
1621 will not understand the native paths and the native <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> port will
1622 not understand the <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> paths.
1623 When its value is a string, it is used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> to
1624 translate into the appropriate platform-specific representation,
1625 so that on <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> "c:/gnu/clisp/")</code>
1626 returns <code class="filename">#P"/cygdrive/c/gnu/clisp/"</code>,
1627 while on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> "/cygdrive/c/gnu/clisp/")</code>
1628 returns <code class="filename">#P"C:/gnu/clisp/"</code>.
1629 The initial value is <code class="literal">"cygdrive"</code>, you should edit
1630 <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> to change it.</dd></dl></div><p>This is especially important for the
1631 <a class="link" href="#dir" title="20.3.3. Function EXT:DIR">directory-handling functions</a>.</p><div class="table"><a id="min-filename-syntax-table"></a><p class="title"><strong>Table 19.1. The minimum filename syntax that may be used portably</strong></p><div class="table-contents"><table class="table" summary="The minimum filename syntax that may be used portably" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">pathname</th><th align="left">meaning</th></tr></thead><tbody><tr><td align="left"><code class="filename">"xxx"</code></td><td align="left">for a file with name <em class="replaceable"><code>xxx</code></em></td></tr><tr><td align="left"><code class="filename">"xxx.yy"</code></td><td align="left">for a file with name <em class="replaceable"><code>xxx</code></em> and type
1632 <em class="replaceable"><code>yy</code></em></td></tr><tr><td align="left"><code class="filename">".yy"</code></td><td align="left">for a pathname with type <em class="replaceable"><code>yy</code></em> and no
1633 name or with name <em class="replaceable"><code>.yy</code></em> and no type,
1634 depending on the value of <a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><p>Hereby <em class="replaceable"><code>xxx</code></em> denotes 1 to 8 characters,
1635 and <em class="replaceable"><code>yy</code></em> denotes 1 to 3 characters, each of
1636 which being either an alphanumeric character or the underscore
1637 <span class="keysym">#\_</span>. Other properties of pathname syntax vary between
1638 operating systems.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="path-components"></a>19.1. Pathname Components
1639 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-2-1.html">[sec_19-2-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></div><p>When a pathname is to be fully specified (no wildcards), that
1640 means that no <code class="constant">:WILD</code>, <code class="constant">:WILD-INFERIORS</code> is allowed, no wildcard
1641 characters are allowed in the strings, and <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> may not
1642 be allowed either.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="path-dir-canon"></a>19.1.1. Directory canonicalization</h3></div></div></div><p>As permitted by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> specification, the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>
1643 directory component is canonicalized when the pathname is constructed:
1644 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="filename">""</code> and
1645 <code class="filename">"."</code> are removed</li><li class="listitem"><code class="filename">".."</code>,
1646 <code class="filename">"*"</code>, and <code class="filename">"**"</code> are converted
1647 to <code class="constant">:UP</code>, <code class="constant">:WILD</code> and <code class="constant">:WILD-INFERIORS</code>,
1648 respectively</li><li class="listitem">patterns <code class="filename">foo/../</code> are
1649 collapsed</li></ol></div><p>
1650 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="path-platform-specific"></a>19.1.2. Platform-specific issues</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><div class="variablelist"><p class="title"><strong>Pathname components</strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>host</code></em></span></dt><dd>always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><em class="replaceable"><code>device</code></em></span></dt><dd>always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><code class="code"><em class="replaceable"><code>directory</code></em> = (<em class="replaceable"><code>startpoint</code></em>
1651 . <em class="replaceable"><code>subdirs</code></em>)</code></span></dt><dd><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">element</th><th align="center">values</th><th align="center">meaning</th></tr></thead><tbody><tr><td align="center"><em class="replaceable"><code>startpoint</code></em></td><td align="center"><code class="constant">:RELATIVE</code> | <code class="constant">:ABSOLUTE</code></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdirs</code></em></td><td align="center"><span class="data"><code class="literal">()</code></span> | <span class="data"><code class="literal">(<em class="replaceable"><code>subdir</code></em>
1652 . <em class="replaceable"><code>subdirs</code></em>)</code></span></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><code class="constant">:WILD-INFERIORS</code></td><td align="center"><code class="filename">**</code> or
1653 <code class="filename">...</code>, all subdirectories</td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>,
1654 may contain wildcard characters <code class="filename">"?"</code> and
1655 <code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)</td><td align="center"> </td></tr></tbody></table></div></dd><dt><span class="term"><em class="replaceable"><code>name</code></em><br /></span><span class="term"><em class="replaceable"><code>type</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, may contain wildcard characters <code class="filename">"?"</code> and
1656 <code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)
1657 </dd><dt><span class="term"><em class="replaceable"><code>version</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="constant">:NEWEST</code>
1658 (after merging the defaults)</dd></dl></div><p>A <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> filename is <a class="link" href="#name-type-split" title="Name/type namestring split">split into name and type</a>.</p><div class="informaltable"><a id="unix-filename-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">External notation:</td><td align="center">
1659 <code class="filename">"server:sub1.typ/sub2.typ/name.typ"</code></td></tr><tr><td align="center">using defaults:</td><td align="center">
1660 <code class="filename"> "sub1.typ/sub2.typ/name.typ"</code></td></tr><tr><td align="center">or</td><td align="center">
1661 <code class="filename"> "name.typ"</code></td></tr><tr><td align="center">or</td><td align="center">
1662 <code class="filename"> "sub1.typ/**/sub3.typ/x*.lisp"</code></td></tr><tr><td align="center">or similar.</td><td align="center"> </td></tr></tbody></table></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><div class="variablelist"><p class="title"><strong>Pathname components</strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>host</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, wildcard characters may
1663 occur but do not act as wildcards</dd><dt><span class="term"><em class="replaceable"><code>device</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="filename">A</code>|...|<code class="filename">Z</code>
1664 </dd><dt><span class="term"><code class="code"><em class="replaceable"><code>directory</code></em> = (<em class="replaceable"><code>startpoint</code></em>
1665 . <em class="replaceable"><code>subdirs</code></em>)</code></span></dt><dd><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">element</th><th align="center">values</th><th align="center">meaning</th></tr></thead><tbody><tr><td align="center"><em class="replaceable"><code>startpoint</code></em></td><td align="center"><code class="constant">:RELATIVE</code> | <code class="constant">:ABSOLUTE</code></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdirs</code></em></td><td align="center"><span class="data"><code class="literal">()</code></span> | <span class="data"><code class="literal">(<em class="replaceable"><code>subdir</code></em>
1666 . <em class="replaceable"><code>subdirs</code></em>)</code></span></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><code class="constant">:WILD-INFERIORS</code></td><td align="center"><code class="filename">**</code> or
1667 <code class="filename">...</code>, all subdirectories</td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>,
1668 may contain wildcard characters <code class="filename">"?"</code> and
1669 <code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)</td><td align="center"> </td></tr></tbody></table></div></dd><dt><span class="term"><em class="replaceable"><code>name</code></em><br /></span><span class="term"><em class="replaceable"><code>type</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, may contain wildcard characters <code class="filename">"?"</code> and
1670 <code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)
1671 </dd><dt><span class="term"><em class="replaceable"><code>version</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="constant">:NEWEST</code>
1672 (after merging the defaults)</dd></dl></div><p>If <em class="replaceable"><code>host</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <em class="replaceable"><code>device</code></em> must be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>A <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> filename is <a class="link" href="#name-type-split" title="Name/type namestring split">split into name and type</a>.</p><div class="informaltable"><a id="win32-filename-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">External notation:</td><td align="center"><code class="filename">"A:\sub1.typ\sub2.typ\name.typ"</code></td></tr><tr><td align="center">using defaults:</td><td align="center"><code class="filename"> "\sub1.typ\sub2.typ\name.typ"</code></td></tr><tr><td align="center">or</td><td align="center"><code class="filename"> "name.typ"</code></td></tr><tr><td align="center">or</td><td align="center"><code class="filename">"*:\sub1.typ\**\sub3.typ\x*.lisp"</code></td></tr><tr><td align="center">or similar.</td><td align="center"> </td></tr></tbody></table></div><p>Instead of <code class="filename">"\"</code> one may use <code class="filename">"/"</code>, as usual for DOS
1673 calls.</p><p>If <em class="replaceable"><code>host</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the <em class="replaceable"><code>directory</code></em>'s <em class="replaceable"><code>startpoint</code></em>
1674 is not <code class="constant">:ABSOLUTE</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>
1675 <em class="replaceable"><code>pathname</code></em>))</code> will not be the same as <em class="replaceable"><code>pathname</code></em>.</p></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd>The wildcard characters: <code class="filename">"*"</code> matches any
1676 sequence of characters, <code class="filename">"?"</code> matches any one character.
1677 </dd></dl></div><p><a id="name-type-split"></a><strong>Name/type namestring split. </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p>A filename is split into name and type according to the
1678 following rule: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">if there is no <code class="filename">"."</code> in the filename, then the
1679 <em class="replaceable"><code>name</code></em> is everything, <em class="replaceable"><code>type</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;</li><li class="listitem">if there is a <code class="filename">"."</code>, then <em class="replaceable"><code>name</code></em> is the part
1680 before and <em class="replaceable"><code>type</code></em> the part after the last dot.</li><li class="listitem"><p>if the only <code class="filename">"."</code> is the first character, then
1681 the behavior depends on the value of the user variable
1682 <strong class="first"><em class="firstterm"><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></em></strong>
1683 which can be either
1684 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:TYPE</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>name</code></em>, everything after the <code class="filename">"."</code>
1685 is the <em class="replaceable"><code>type</code></em>; or</dd><dt><span class="term"><code class="constant">:NAME</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>type</code></em>, everything is the
1686 <em class="replaceable"><code>name</code></em></dd></dl></div><p>
1687 </p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Due to this name/type splitting rule, there are pathnames
1688 that cannot result from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a>.
1689 To get a pathname whose type contains a dot or whose name contains a
1690 dot and whose type is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> must be used. Example:
1691 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> <code class="constant">:NAME</code> "foo.bar")</code>.</p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unspecific"></a>19.2. :UNSPECIFIC as a Component Value
1692 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-2-2-2-3.html">[sec_19-2-2-2-3]</a></h2></div></div></div><p>The symbol <code class="constant">:UNSPECIFIC</code> is not permitted as a
1693 pathname component for any slot of any pathname.
1694 It is also illegal to pass it as an argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a>,
1695 although it <span class="strong"><strong>is</strong></span> a legal argument (treated as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
1696 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_user-homedir-pathname.html" target="_top"><code class="function">USER-HOMEDIR-PATHNAME</code></a>.</p><p>The only use for <code class="constant">:UNSPECIFIC</code> is that it is
1697 returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-_name-version.html" target="_top"><code class="function">PATHNAME-DEVICE</code></a> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>s, as required by
1698 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-3-2-1.html">[sec_19-3-2-1]</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="path-external-notation"></a>19.3. External notation</h2></div></div></div><p>External notation of pathnames (cf. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> and
1699 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>), of course without spaces, [,],{,}:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><div class="informaltable"><a id="unix-path-external-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">[ <code class="filename">"/"</code> ]</td><td align="center"><code class="filename">"/"</code> denotes absolute pathnames</td></tr><tr><td align="center">{ <em class="replaceable"><code>name</code></em> <code class="filename">"/"</code> }</td><td align="center">each <em class="replaceable"><code>name</code></em> is a subdirectory</td></tr><tr><td align="center">[ <em class="replaceable"><code>name</code></em> [<code class="filename">"."</code> <em class="replaceable"><code>type</code></em>] ]</td><td align="center">filename with type (extension)</td></tr></tbody></table></div><p>Name and type may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s of any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
1700 (consisting of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printing">printing</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, except <code class="filename">"/"</code>).</p></dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><div class="informaltable"><a id="win32-path-external-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">[ [<em class="replaceable"><code>drivespec</code></em>] : ]</td><td align="center">a letter <code class="filename">"*"</code>|<code class="filename">a</code>|...|<code class="filename">z</code>|<code class="filename">A</code>|...|<code class="filename">Z</code></td></tr><tr><td align="center">{ <em class="replaceable"><code>name</code></em> [. <em class="replaceable"><code>type</code></em>] \ }</td><td align="center">each <em class="replaceable"><code>name</code></em> is a subdirectory, <code class="filename">"\"</code> may be
1701 replaced by <code class="filename">"/"</code></td></tr><tr><td align="center">[ <em class="replaceable"><code>name</code></em> [. <em class="replaceable"><code>type</code></em>] ]</td><td align="center">filename with type (extension)</td></tr></tbody></table></div><p>Name and type may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s of any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
1702 (consisting of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printing">printing</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, except <code class="filename">"/"</code>,
1703 <code class="filename">"\"</code>, <code class="filename">":"</code>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="log-path"></a>19.4. Logical Pathnames
1704 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-3.html">[sec_19-3]</a></h2></div></div></div><p>No notes.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="filename-misc"></a>19.5. Miscellaneous</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></div><p><a id="path-des"></a><strong>Pathname Designators. </strong>When <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> is also treated as a
1705 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#pathname_designator">pathname designator</a>,
1706 namely its <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> is converted to the
1707 operating system's preferred pathname case.</p><p><a id="path-match"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a> does not interpret missing components as
1708 wild.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="translate-pathname"></a>19.5.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> accepts three additional keyword arguments:
1709 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> <em class="replaceable"><code>source</code></em>
1710 <em class="replaceable"><code>from-wildname</code></em>
1711 <em class="replaceable"><code>to-wildname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:ALL</code>
1712 <code class="constant">:MERGE</code> <code class="constant">:ABSOLUTE</code>)</code></p><p>If <code class="constant">:ALL</code> is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a list of all resulting
1713 pathnames, corresponding to all matches of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>
1714 <em class="replaceable"><code>source</code></em> <em class="replaceable"><code>from-wildname</code></em>)</code>, is
1715 returned.</p><p>If <code class="constant">:MERGE</code> is specified and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, unspecified pieces of
1716 <em class="replaceable"><code>to-pathname</code></em> are not replaced by
1717 corresponding pieces of <em class="replaceable"><code>source</code></em>.</p><p>If <code class="constant">:ABSOLUTE</code> is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the returned
1718 pathnames are converted to absolute by merging in the current process'
1719 directory, therefore rendering pathnames suitable for the OS and
1720 external programs. So, to pass a pathname to an external program, you
1721 do <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>
1722 #P"" #P"" <code class="constant">:ABSOLUTE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> or <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>
1723 (<a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>))</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="translate-logpath"></a>19.5.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a> accepts an additional keyword
1724 argument <code class="constant">:ABSOLUTE</code>, similar to <a class="xref" href="#translate-pathname" title="19.5.1. Function TRANSLATE-PATHNAME">Section 19.5.1, “Function <code class="function">TRANSLATE-PATHNAME</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="parsename"></a>19.5.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
1725 <em class="replaceable"><code>host</code></em> <em class="replaceable"><code>defaults</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>
1726 <em class="replaceable"><code>junk-allowed</code></em>)</code>
1727 returns a logical pathname only if <em class="replaceable"><code>host</code></em> is a
1728 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_l.html#logical_host">logical host</a>
1729 or <em class="replaceable"><code>host</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>defaults</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>.
1730 To construct a logical pathname from a string, the function
1731 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a> can be used.</p><p>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] behavior of recognizing logical pathnames when
1732 the <em class="replaceable"><code>string</code></em> begins with some alphanumeric characters followed by a
1733 colon (<span class="keysym">#\:</span>) can be very confusing
1734 (cf. <code class="filename">"c:/autoexec.bat"</code>,
1735 <code class="filename">"home:.clisprc"</code> and
1736 <code class="filename">"prep:/pub/gnu"</code>)
1737 and therefore is disabled by default.
1738 To enable the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] behavior, you should set <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
1739 Note that this also disables treating <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s as <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pathmerge"></a>19.5.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> <em class="replaceable"><code>pathname</code></em>
1740 [<em class="replaceable"><code>default-pathname</code></em>])</code> returns a
1741 logical pathname only if
1742 <em class="replaceable"><code>default-pathname</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>.
1743 To construct a logical pathname from a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, the function
1744 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a> can be used.</p><p>When both <em class="replaceable"><code>pathname</code></em> and <em class="replaceable"><code>default-pathname</code></em>
1745 are relative pathnames, the behavior depends on <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a>: when it is
1746 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> retains its traditional behavior:
1747 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code>
1748 evaluates to <code class="filename">#P"x/"</code></p><p><strong>Rationale. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> is used to specify default components for
1749 pathnames, so there is some analogy between
1750 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b)</code> and
1751 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b)</code>. Obviously, putting in the
1752 same default a second time should do the same as putting it in once:
1753 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b b)</code> is the same as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b)</code>, so
1754 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b) b)</code>
1755 should be the same as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b)</code>.
1756 </p><p>(This question actually does matter because in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> there is no
1757 distinction between <span class="quote">“<span class="quote">pathnames with defaults merged-in</span>”</span> and
1758 <span class="quote">“<span class="quote">pathnames with defaults not yet applied</span>”</span>.)</p><p>Now, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")
1759 #P"y/")</code> and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code> are
1760 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> (when <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), but not in
1761 implementations that strictly follow the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
1762 In fact, the above <span class="emphasis"><em>twice-default = once-default</em></span>
1763 rule holds for all pathnames in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p>Conversely, when <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the normal [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
1764 behavior is exhibited: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code>
1765 evaluates to <code class="filename">#P"y/x/"</code>.</p><p><strong>Rationale. </strong><span class="quote">“<span class="quote">merge</span>”</span> is <span class="emphasis"><em>merge</em></span> and
1766 not <span class="emphasis"><em>or</em></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="load-lpt"></a>19.5.5. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></h3></div></div></div><p>When the <em class="replaceable"><code>host</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>
1767 is not a defined logical host yet, we proceed as follows:
1768 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">If both <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s
1769 <code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em>_FROM</code> and
1770 <code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em>_TO</code> exist, then their values
1771 define the map of the <em class="replaceable"><code>host</code></em>.</li><li class="listitem">If the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
1772 <code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em></code> exists, its value is read from,
1773 and the result is passed to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
1774 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>)</code>.</li><li class="listitem">Variable <a href="impnotes.html#load-lpt" class="olink"><code class="varname">CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE*</code></a> is consulted.
1775 Its value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of files and/or directories,
1776 which are searched for in the <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>, just like for <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>.
1777 When the element is a file, it is repeatedly <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> from,
1778 <a class="ulink" href="http://www.franz.com/support/documentation/6.0/doc/pathnames.htm#load-logical-pathname-translations-2" target="_top">Allegro CL-style</a>,
1779 odd objects being host names and even object being their
1780 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>.
1781 When the element is a directory, a file, named <code class="filename"><em class="replaceable"><code>host</code></em></code>
1782 or <code class="filename"><em class="replaceable"><code>host</code></em>.host</code>, in that directory, is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a>
1783 from once, <a class="ulink" href="http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#logical-pathnames" target="_top">CMUCL-style</a>,
1784 the object read being the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a> of the
1785 <em class="replaceable"><code>host</code></em>.</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="absolute-pathname"></a>19.5.6. Function <a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>)</code> converts the <em class="replaceable"><code>pathname</code></em>
1786 to a physical pathname, then - if its directory component is not
1787 absolute - converts it to an absolute pathname, by merging in the
1788 current process' directory. This is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, except that it
1789 does not verify that a file named by the <em class="replaceable"><code>pathname</code></em> exists, not even that
1790 its directory exists. It does no filesystem accesses, except to
1791 determine the current directory. This function is useful when you want
1792 to save a pathname over time, or pass a pathname to an external
1793 program.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="files"></a>Chapter 20. Files <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-20.html">[chap-20]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></dd><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-is-not-file"></a>20.1. Directory is <span class="strong"><strong>not</strong></span> a file</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has traditionally taken the view that a directory is a
1794 separate object and <span class="strong"><strong>not</strong></span> a special kind of file, so whenever the
1795 standard says that a function operates on <span class="emphasis"><em>files</em></span>
1796 without specifically mentioning that it also works on
1797 <span class="emphasis"><em>directories</em></span>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when passed a
1798 directory.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> provides separate directory functions, such as
1799 <a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a>, <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> et al.</p><p>You can use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> or <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> to figure out whether a
1800 given namestring refers to a file or a directory.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-path"></a>20.1.1. Function <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<code class="constant">:ERROR</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code>
1801 figures out whether the argument refers to an existing directory or an
1802 existing regular file, and returns 4 values
1803 if the filesystem object exists: </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a></li><li class="listitem"><a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-write-date.html" target="_top"><code class="function">FILE-WRITE-DATE</code></a></li><li class="listitem"><a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a></li></ol></div><p> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if it does not exist.
1804 E.g., if you have a file <em class="replaceable"><code>file</code></em>, a directory <em class="replaceable"><code>directory</code></em>,
1805 a symbolic link <code class="filename">link-file</code> pointing to <em class="replaceable"><code>file</code></em>
1806 and a symbolic link <code class="filename">link-dir</code> pointing to <em class="replaceable"><code>directory</code></em>,
1807 then</p><pre class="programlisting">
1808 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"filename")
1809 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1810 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1811 ⇒ <code class="computeroutput">3427467015</code>
1812 ⇒ <code class="computeroutput">3171976</code>
1813 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"filename/")
1814 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1815 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1816 ⇒ <code class="computeroutput">3427467015</code>
1817 ⇒ <code class="computeroutput">3171976</code>
1818 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"directory")
1819 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1820 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1821 ⇒ <code class="computeroutput">3426940352</code>
1822 ⇒ <code class="computeroutput">1024</code>
1823 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"directory/")
1824 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1825 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1826 ⇒ <code class="computeroutput">3426940352</code>
1827 ⇒ <code class="computeroutput">1024</code>
1828 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-file")
1829 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1830 ⇒ <code class="computeroutput">#P"/.../link-file"</code>
1831 ⇒ <code class="computeroutput">3427467015</code>
1832 ⇒ <code class="computeroutput">3171976</code>
1833 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-file/")
1834 ⇒ <code class="computeroutput">#P"/.../filename"</code>
1835 ⇒ <code class="computeroutput">#P"/.../link-file"</code>
1836 ⇒ <code class="computeroutput">3427467015</code>
1837 ⇒ <code class="computeroutput">3171976</code>
1838 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-dir")
1839 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1840 ⇒ <code class="computeroutput">#P"/.../link-dir/"</code>
1841 ⇒ <code class="computeroutput">3426940352</code>
1842 ⇒ <code class="computeroutput">1024</code>
1843 (<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-dir/")
1844 ⇒ <code class="computeroutput">#P"/.../directory/"</code>
1845 ⇒ <code class="computeroutput">#P"/.../link-dir/"</code>
1846 ⇒ <code class="computeroutput">3426940352</code>
1847 ⇒ <code class="computeroutput">1024</code>
1848 </pre><p>This function may also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if, e.g., its argument resides
1849 under a tree for which you do not have sufficient access privileges;
1850 unless <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned instead.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="file-func"></a>20.2. File functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-file"></a>20.2.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a> cannot be used to check whether a directory exists.
1851 Use functions <a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a>, <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> for this.
1852 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="file-author"></a>20.2.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-author.html" target="_top"><code class="function">FILE-AUTHOR</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-author.html" target="_top"><code class="function">FILE-AUTHOR</code></a> always returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, because the operating systems
1853 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is ported to do not store a file's author in the file system.
1854 Some operating systems, such as <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, have the notion of a file's
1855 <span class="emphasis"><em>owner</em></span>, and some other <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations return
1856 the user name of the file owner. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not do this, because
1857 <span class="emphasis"><em>owner</em></span> and <span class="emphasis"><em>author</em></span> are not the
1858 same; in particular, authorship is preserved by copying, while
1859 ownership is not.</p><p>Use <a class="link" href="#file-owner"><code class="function">OS:FILE-OWNER</code></a>
1860 to find the owner of the file. See also
1861 <a class="link" href="#file-properties"><code class="function">OS:FILE-PROPERTIES</code></a>
1862 (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="del-file"></a>20.2.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-file.html" target="_top"><code class="function">DELETE-FILE</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-file.html" target="_top"><code class="function">DELETE-FILE</code></a> <em class="replaceable"><code>pathname</code></em>)</code> deletes the pathname
1863 <em class="replaceable"><code>pathname</code></em>, not its <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, and returns the absolute pathname it
1864 actually removed or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>pathname</code></em> did not exist.
1865 When <em class="replaceable"><code>pathname</code></em> points to a file which is currently open in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>,
1866 an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
1867 To remove a directory, use <a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a> instead.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rename-file"></a>20.2.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rename-file.html" target="_top"><code class="function">RENAME-FILE</code></a></h3></div></div></div><p>This functions accepts and extra keyword argument <code class="constant">:IF-EXISTS</code>.
1868 When it is <code class="constant">:ERROR</code> (the default), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the destination
1869 pathname names an existing file, otherwise (e.g., if it is <code class="constant">:OVERWRITE</code>)
1870 the destination file atomically overwritten.</p><p>When <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, only the standard two arguments are accepted,
1871 and and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed when the destination pathname names an existing file.</p><p>This function cannot operate on directories,
1872 use <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> to rename a directory.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-func"></a>20.3. Directory functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-dir"></a>20.3.1. Function <a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a> <em class="replaceable"><code>pathname</code></em>)</code> tests whether <em class="replaceable"><code>pathname</code></em> exists
1873 and is a directory.
1874 It will, unlike <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
1875 if the parent directory of <em class="replaceable"><code>pathname</code></em> does not exist.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="directory"></a>20.3.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
1876 :FULL :CIRCLE <code class="constant">:IF-DOES-NOT-EXIST</code>)</code> can run in two modes:
1877 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>pathname</code></em> contains no name or type component, a
1878 list of all matching directories is produced.
1879 E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "/etc/*/")</code> lists
1880 all subdirectories in the directory
1881 <code class="filename">#P"/etc/"</code>.</li><li class="listitem">Otherwise a list of all matching files is returned.
1882 E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "/etc/*")</code> lists all
1883 regular files in the directory <code class="filename">#P"/etc/"</code>.
1884 </li></ul></div><p>
1885
1886 If you want <span class="strong"><strong>all</strong></span> the files <span class="strong"><strong>and</strong></span> subdirectories in the current directory,
1887 you should use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "*/") (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "*"))</code>.
1888 If you want all the files and subdirectories in all the subdirectories
1889 under the current directory (similar to the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html"><span class="command"><strong>ls
1890 <code class="option">-R</code></strong></span></a> <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> command), use
1891 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "**/") (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "**/*"))</code>.</p><div class="variablelist"><p class="title"><strong>Keyword arguments accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:FULL</code></span></dt><dd>If this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, additional
1892 information is returned: for each matching file you get a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of
1893 at least four elements <span class="returnvalue">(<em class="replaceable"><code>file-pathname</code></em>
1894 <em class="replaceable"><code>file-truename</code></em>
1895 <em class="replaceable"><code>file-write-date-as-decoded-time</code></em>
1896 <em class="replaceable"><code>file-length</code></em>)</span>.
1897 </dd><dt><span class="term"><code class="constant">:CIRCLE</code></span></dt><dd>If this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> avoids
1898 endless loops that may result from symbolic links.
1899 </dd><dt><span class="term"><code class="constant">:IF-DOES-NOT-EXIST</code></span></dt><dd><p>This argument controls the treatment of links
1900 pointing to non-existent files and can take the following values:
1901 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:DISCARD</code> (default)</span></dt><dd>discard the bad directory entries
1902 </dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd>an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed on bad directory entries
1903 (this corresponds to the default behavior of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> in <a class="ulink" href="https://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>)
1904 </dd><dt><span class="term"><code class="constant">:KEEP</code></span></dt><dd>keep bad directory entries in the returned list
1905 (this roughly corresponds to the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>
1906 ... <code class="constant">:TRUNAMEP</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> call in <a class="ulink" href="https://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>)
1907 </dd><dt><span class="term"><code class="constant">:IGNORE</code></span></dt><dd>Similar to <code class="constant">:DISCARD</code>, but also do
1908 <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when a directory is unaccessible (contrary
1909 to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification).</dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dir"></a>20.3.3. Function <code class="function">EXT:DIR</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:DIR</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
1910 <em class="replaceable"><code>pathname</code></em>)</code> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>, but displays the pathnames
1911 instead of returning them. <code class="code">(EXT:DIR)</code>
1912 shows the contents of the current directory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cd"></a>20.3.4. Function <a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> <em class="replaceable"><code>pathname</code></em>)</code> sets the current working directory,
1913 <code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a>)</code> returns it.
1914 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> [<em class="replaceable"><code>pathname</code></em>])</code>
1915 manages the current directory.</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> [<em class="replaceable"><code>pathname</code></em>])</code>
1916 manages the current device and the current directory.
1917 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="default-dir"></a>20.3.5. Function <a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a>)</code> is equivalent to <code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a>)</code>.
1918 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a>) <em class="replaceable"><code>pathname</code></em>)</code> is equivalent to
1919 <code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> <em class="replaceable"><code>pathname</code></em>)</code>, except for the return value.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-dir"></a>20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:MAKE-DIRECTORY</code> <em class="replaceable"><code>directory</code></em>)</code>
1920 creates a new subdirectory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="delete-dir"></a>20.3.7. Function <a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a> <em class="replaceable"><code>directory</code></em>)</code>
1921 removes an (empty) subdirectory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rename-dir"></a>20.3.8. Function <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> <em class="replaceable"><code>old-directory</code></em>
1922 <em class="replaceable"><code>new-directory</code></em>)</code> renames a
1923 subdirectory to a new name.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="streams"></a>Chapter 21. Streams <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-21.html">[chap-21]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></dd><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dd><dl><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> &amp; <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> &amp; <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></dd><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dd><dl><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></dd><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
1924 and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
1925 </a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="streams-interactive"></a>21.1. Interactive Streams
1926 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_21-1-1-1-3.html">[sec_21-1-1-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></div><p>Interactive streams are those whose next input might depend on a
1927 prompt one might output.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="stream-stdio-init"></a>21.1.1. Initialization of Standard Streams</h3></div></div></div><p>When run interactively, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> creates a single <span class="quote">“<span class="quote">terminal</span>”</span>
1928 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and binds <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> to it.
1929 All other standard streams (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>
1930 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*TRACE-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*QUERY-IO*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*DEBUG-IO*</code></a>)
1931 are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>s pointing to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
1932 This has the benefit of avoiding unwanted blank lines from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>,
1933 see <a class="xref" href="#newline-convention" title="21.6. Newline Convention">Section 21.6, “Newline Convention”</a>.</p><p>However, there may be situations, especially in <a href="clisp.html#batch-mode" class="olink">batch mode</a>,
1934 when one wants to use a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>-style i/o where <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>
1935 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> point to different OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> so that they can be
1936 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07">redirected</a>
1937 to files in the command line and examined separately.
1938 Often <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can detect such situations (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a> not being
1939 the terminal) and handle them just as expected.
1940 However, there may be cases when one needs to do something like:
1941 </p><pre class="programlisting">
1942 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:INPUT</code>)
1943 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:OUTPUT</code> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
1944 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:ERROR</code> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
1945 </pre><p> in the <a href="clisp.html#opt-exec-file" class="olink">script</a> or <a href="impnotes.html#init-func" class="olink">init function</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="terminal"></a>21.2. Terminal interaction</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>21.1. <a href="#readline-extend-ex">Dialog with user using completion</a></dt></dl></div><p>See also <a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="readline"></a>21.2.1. Command line editing with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> linked against the
1946 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.</span></span></h4></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>21.1. <a href="#readline-extend-ex">Dialog with user using completion</a></dt></dl></div><p>Input through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> uses the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.
1947 Arrow keys can be used to move within the input history.
1948 The <span class="keycode">TAB</span> key completes the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> name or
1949 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> that is being typed.
1950 See <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/rluserman.html" target="_top">readline user
1951 manual</a> for general details and
1952 <a href="clisp.html#completion" class="olink"><span class="keycode">TAB</span> key</a> for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific
1953 extensions.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library is <span class="strong"><strong>not</strong></span> used (even when
1954 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is linked against it) if the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a> do not both
1955 refer to the same terminal.
1956 This is determined by the function <code class="function">stdio_same_tty_p</code>
1957 in file <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/stream.d"><code class="filename">src/stream.d</code></a>.
1958 In some exotic cases, e.g., when running under <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> in
1959 an <span class="command"><strong>rxvt</strong></span> window under <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, this may be
1960 determined incorrectly.</p></div><p>See also <a class="xref" href="#readline-mod" title="33.5. Advanced Readline and History Functionality">Section 33.5, “Advanced Readline and History Functionality”</a>.</p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="readline-extend"></a>Extending completion</h4></div></div></div><p><strong>Variable
1961 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*COMPLETION*</code></em></strong>. </strong>The value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of 3 arguments: <em class="replaceable"><code>string</code></em>,
1962 <em class="replaceable"><code>start</code></em> and <em class="replaceable"><code>end</code></em>, which bound the text to be completed.
1963 The return value should be the list, whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">FIRST</code></a> is the immediate
1964 replacement for the already typed text and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_rest.html" target="_top"><code class="function">REST</code></a> is all the possible
1965 completions. If no completions are available, return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p><strong>Function <code class="function">EXT:MAKE-COMPLETION</code>. </strong>Given a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all valid inputs, return a valid value for
1966 <code class="varname">CUSTOM:*COMPLETION*</code>.</p><p><strong>Function <code class="function">EXT:LONGEST-COMMON-PREFIX</code>. </strong>Given a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s, return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> which is
1967 their longest common prefix. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> elements are compared using
1968 the <code class="constant">:TEST</code> argument. Useful when writing your own
1969 <code class="varname">CUSTOM:*COMPLETION*</code> functions.</p><div class="example"><a id="readline-extend-ex"></a><p class="title"><strong>Example 21.1. Dialog with user using
1970 completion</strong></p><div class="example-contents"><pre class="programlisting">
1971 (defun read-user-line (prompt completions)
1972 (princ prompt *query-io*)
1973 (force-output *query-io*)
1974 (let ((custom:*completion* (ext:make-completion completions)))
1975 (read-line *query-io*)))
1976 (read-user-line "??? " '("a" "z123" "z135" "b" "abcd"))
1977 ⇒ <code class="computeroutput">??? </code><strong class="userinput"><code>ab TAB</code></strong>
1978 ⇒ <code class="computeroutput">??? abcd</code>
1979 (read-user-line "??? " '("a" "z123" "z135" "b" "abcd"))
1980 ⇒ <code class="computeroutput">??? </code><strong class="userinput"><code>TAB TAB</code></strong>
1981 ⇒ <code class="computeroutput">a abcd b z123 z135</code>
1982 ⇒ <code class="computeroutput">??? </code><strong class="userinput"><code>z TAB</code></strong>
1983 ⇒ <code class="computeroutput">??? z1</code><strong class="userinput"><code>TAB TAB</code></strong>
1984 ⇒ <code class="computeroutput">z123 z135</code>
1985 </pre><p>To force the user to select one of the pre-specified inputs you
1986 need to do something like this:</p><pre class="programlisting">
1987 (defun read-user-line (prompt)
1988 (princ prompt *query-io*)
1989 (force-output *query-io*)
1990 (read-line *query-io*))
1991 (defun read-user-option (prompt options)
1992 (loop
1993 :with custom:*completion* = (ext:make-completion options)
1994 :for option = (read-user-line prompt)
1995 :when (find option options :text #'string=)
1996 :return options
1997 :do (format *query-io* "Invalid option ~S, please try again~%" option)))
1998 </pre></div></div><br class="example-break" /></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="readline-config"></a>Linking against <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a></h4></div></div></div><p>For <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to use <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> it has to be detected by
1999 the <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> process.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>If you run it as
2000 </p><pre class="screen"><strong><code class="prompt">$</code></strong> ./configure --with-readline</pre><p>
2001 it will fail if it cannot find a valid modern <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>
2002 installation.</p></li><li class="listitem">If you use the option
2003 <code class="option">--without-readline</code>, it will not even try to
2004 find <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>.</li><li class="listitem">The default behavior
2005 (<code class="option">--with-readline=default</code>) is to use <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> if
2006 it is found and link <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> without it otherwise.
2007 </li></ul></div><p>
2008 You can find out whether <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> has been detected by running
2009 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html"><span class="command"><strong>grep</strong></span></a> HAVE_READLINE config.h</pre><p>
2010 in your build directory.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-kbd"></a>21.2.2. Macro <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> is not the only stream that
2011 communicates directly with the user: During execution of the body of a
2012 <code class="code">(<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> . <em class="replaceable"><code>body</code></em>)</code> form,
2013 <strong class="first"><em class="firstterm"><a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a></em></strong> is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that reads the
2014 keystrokes from the keyboard.
2015 It returns every keystroke in detail as an <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> with the
2016 following slots (see <a class="xref" href="#input-char" title="13.4.1. Input Characters">Section 13.4.1, “Input Characters”</a> for accessing them):
2017 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>char</code></em></span></dt><dd><p class="simpara">the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> for standard keys
2018 (accessed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a>)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>For non-standard keys <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, use <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a>:
2019 </p><pre class="programlisting">
2020 (<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
2021 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for <em class="replaceable"><code>char</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a>)
2022 :for <em class="replaceable"><code>key</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a> <em class="replaceable"><code>char</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a> <em class="replaceable"><code>char</code></em>))
2023 :do (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> <em class="replaceable"><code>char</code></em> <em class="replaceable"><code>key</code></em>))
2024 :when (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> <em class="replaceable"><code>key</code></em> #\Space) :return (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> <em class="replaceable"><code>char</code></em> <em class="replaceable"><code>key</code></em>)))
2025 </pre></div></dd><dt><span class="term"><em class="replaceable"><code>key</code></em></span></dt><dd><p>the key name, for non-standard keys
2026 (accessed with <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a>):
2027 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><div class="informaltable"><a id="unix-kbd-keys"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">key</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><span class="keycode">F1</span>..<span class="keycode">F12</span></td><td align="center"><code class="constant">:F1</code>..<code class="constant">:F12</code>
2028 </td></tr><tr><td align="center"><span class="keycode">Insert</span></td><td align="center"><code class="constant">:INSERT</code></td></tr><tr><td align="center"><span class="keycode">Delete</span></td><td align="center"><code class="constant">:DELETE</code></td></tr><tr><td align="center"><span class="keycode">Home</span></td><td align="center"><code class="constant">:HOME</code></td></tr><tr><td align="center"><span class="keycode">End</span></td><td align="center"><code class="constant">:END</code></td></tr><tr><td align="center"><span class="keycode">Center</span></td><td align="center"><code class="constant">:CENTER</code></td></tr><tr><td align="center"><span class="keycode">PgUp</span></td><td align="center"><code class="constant">:PGUP</code></td></tr><tr><td align="center"><span class="keycode">PgDn</span></td><td align="center"><code class="constant">:PGDN</code></td></tr><tr><td align="center">Arrow keys</td><td align="center"><code class="constant">:LEFT</code> <code class="constant">:RIGHT</code>
2029 <code class="constant">:UP</code> <code class="constant">:DOWN</code></td></tr></tbody></table></div></dd></dl></div></dd><dt><span class="term"><em class="replaceable"><code>bits</code></em></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:HYPER</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if a non-standard key.
2030 These keys are:
2031
2032 <span class="emphasis"><em>[<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>]:</em></span>
2033 Function keys, cursor keypads, numeric keypad.
2034
2035 </dd><dt><span class="term"><code class="constant">:SUPER</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if pressed together with <span class="keycap"><strong>Shift</strong></span>
2036 key(s) and if the keystroke would have been different without
2037 <span class="keycap"><strong>Shift</strong></span>.</dd><dt><span class="term"><code class="constant">:CONTROL</code></span></dt><dd>if pressed together with the <span class="keycap"><strong>Control</strong></span> key.
2038 </dd><dt><span class="term"><code class="constant">:META</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if pressed together with the
2039 <span class="keycap"><strong>Alternate</strong></span> key.</dd></dl></div></dd><dt><span class="term"><em class="replaceable"><code>font</code></em></span></dt><dd>Always <code class="literal">0</code>.</dd></dl></div><p>
2040 This keyboard input is not echoed on the screen. During execution of a
2041 <code class="code">(<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> . <em class="replaceable"><code>body</code></em>)</code> form, no input from
2042 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> or any synonymous stream should be requested.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> is <span class="strong"><strong>not</strong></span> a subtype of
2043 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> on <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> is illegal.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bin-io"></a>21.3. Binary Input and Output</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> &amp; <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> &amp; <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-input"></a>21.3.1. Binary input, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>,
2044 <a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> &amp; <a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> <em class="replaceable"><code>stream</code></em>
2045 <em class="replaceable"><code>element-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a> <em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code>
2046 reads a multi-byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> from <em class="replaceable"><code>stream</code></em>, which should be a
2047 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.
2048 <em class="replaceable"><code>element-type</code></em> should be <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>,
2049 where <em class="replaceable"><code>n</code></em> is a multiple of 8.</p><p><code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>)</code> is like
2050 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> <em class="replaceable"><code>stream</code></em>)</code> if <em class="replaceable"><code>stream</code></em>'s
2051 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> were set to <em class="replaceable"><code>element-type</code></em>,
2052 except that <em class="replaceable"><code>stream</code></em>'s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> will increase by
2053 <sup><em class="replaceable"><code>n</code></em></sup>/<sub>8</sub>
2054 instead of 1.</p><p>Together with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>, this
2055 function permits mixed character/binary input from a stream.</p><p>The function <code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>
2056 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a> <em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code> reads a
2057 floating-point number in <a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a> binary representation from
2058 <em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
2059 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
2060 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>.</p><p><a id="endianness"></a><strong>Endianness. </strong><strong class="first"><em class="firstterm"><a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>
2061 <a id="endianness-i" class="indexterm"></a></em></strong>
2062 can be <code class="constant">:LITTLE</code> or <code class="constant">:BIG</code>.
2063 The default is <code class="constant">:LITTLE</code>, which corresponds
2064 to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> behavior in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-output"></a>21.3.2. Binary output, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a>,
2065 <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> &amp; <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>
2066 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>)</code> writes a multi-byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> to
2067 <em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
2068 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
2069 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, where <em class="replaceable"><code>n</code></em> is a multiple of 8.</p><p><code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>)</code> is
2070 like <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em>)</code> if <em class="replaceable"><code>stream</code></em>'s
2071 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> were set to <em class="replaceable"><code>element-type</code></em>, except that <em class="replaceable"><code>stream</code></em>'s
2072 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> will increase by
2073 <sup><em class="replaceable"><code>n</code></em></sup>/<sub>8</sub>
2074 instead of 1.</p><p>Together with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>, this
2075 function permits mixed character/binary output to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.</p><p>The function <code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER &amp; EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a> <em class="replaceable"><code>float</code></em>
2076 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>)</code> writes a
2077 floating-point number in <a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a> binary representation to
2078 <em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>
2079 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
2080 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bulk-io"></a>21.4. Bulk Input and Output</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="read-seq"></a>21.4.1. Bulk Input</h3></div></div></div><p>In addition to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a>, the following two functions are provided:
2081 </p><div class="variablelist"><dl class="variablelist"><dt><a id="rd-by-seq"></a><span class="term"><a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>
2082 performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em>
2083 <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code> :NO-HANG :INTERACTIVE)</code>
2084 fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by <code class="constant">:START</code> and <code class="constant">:END</code>
2085 with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s consecutively read from <em class="replaceable"><code>stream</code></em>. It returns the
2086 index of the first element of <em class="replaceable"><code>sequence</code></em> that was not updated (=
2087 <em class="replaceable"><code>end</code></em> or &lt; <em class="replaceable"><code>end</code></em> if the <em class="replaceable"><code>stream</code></em> reached its end).
2088 When <em class="replaceable"><code>no-hang</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it does not block: it treats input
2089 unavailability as <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>. When <em class="replaceable"><code>no-hang</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>interactive</code></em> is
2090 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it can block for reading the first byte but does not block
2091 for any further bytes.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
2092 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
2093 with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.
2094 </p></dd><dt><a id="rd-ch-seq"></a><span class="term"><a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>
2095 performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
2096 <code class="constant">:START</code> <code class="constant">:END</code>)</code> fills the subsequence of <em class="replaceable"><code>sequence</code></em>
2097 specified by <code class="constant">:START</code> and <code class="constant">:END</code> with characters consecutively read
2098 from <em class="replaceable"><code>stream</code></em>. It returns the index of the first element of
2099 <em class="replaceable"><code>sequence</code></em> that was not updated (= <em class="replaceable"><code>end</code></em> or &lt; <em class="replaceable"><code>end</code></em> if the
2100 <em class="replaceable"><code>stream</code></em> reached its end).</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
2101 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
2102 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>.
2103 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="write-seq"></a>21.4.2. Bulk Output</h3></div></div></div><p>In addition to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>, the following two functions are provided:
2104 </p><div class="variablelist"><dl class="variablelist"><dt><a id="wr-by-seq"></a><span class="term"><a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a>
2105 performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em>
2106 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code> :NO-HANG :INTERACTIVE)</code> outputs
2107 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s of the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
2108 <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.
2109 When <em class="replaceable"><code>no-hang</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, does not block.
2110 When <em class="replaceable"><code>no-hang</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>interactive</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it can
2111 block for writing the first byte but does not block for any further
2112 bytes. Returns two values: <em class="replaceable"><code>sequence</code></em> and the index of the first
2113 byte that was not output.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
2114 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
2115 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.</p></dd><dt><a id="wr-ch-seq"></a><span class="term"><a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>
2116 performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
2117 <code class="constant">:START</code> <code class="constant">:END</code>)</code> outputs the characters of the subsequence of
2118 <em class="replaceable"><code>sequence</code></em> specified by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.
2119 Returns the <em class="replaceable"><code>sequence</code></em> argument.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
2120 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
2121 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bulk-io-rationale"></a>21.4.3. Rationale</h3></div></div></div><p>The rationale for <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> and
2122 <a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> is that some <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s support both character and binary
2123 i/o, and when you read into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> that can hold both (e.g.,
2124 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>) you cannot determine which kind of
2125 input to use. In such situation <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>
2126 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, while <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> and
2127 <a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> work just fine.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="non-block-io"></a>21.5. Non-Blocking Input and Output</h2></div></div></div><p>In addition to the standard functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> and
2128 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> provides the following functionality
2129 facilitating non-blocking input and output, both binary and
2130 character.</p><div class="variablelist"><dl class="variablelist"><dt><a id="rcwhp"></a><span class="term"><code class="code">(<a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> queries the stream's input status.
2131 It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_peek-char.html" target="_top"><code class="function">PEEK-CHAR</code></a> with a
2132 <em class="replaceable"><code>peek-type</code></em> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> will return immediately.
2133 Otherwise it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>. (In the latter case the standard
2134 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> function would return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)</p><p class="simpara">Note the difference with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>
2135 <em class="replaceable"><code>stream</code></em>))</code>: When the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> returns
2136 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, whereas <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">Note also that <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> is not a good way to test for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>:
2137 If <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, this does not mean that the <em class="replaceable"><code>stream</code></em> will
2138 deliver more characters. It only means that it is not known at this
2139 moment whether the <em class="replaceable"><code>stream</code></em> is already at <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>, or will deliver
2140 more characters.</p></dd><dt><a id="rbla"></a><span class="term"><code class="code">(<a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
2141 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
2142 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> would return immediately with an
2143 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> result.
2144 Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is already known to be reached.
2145 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>'s value is not available immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
2146 instead of waiting.</dd><dt><a id="rbwhp"></a><span class="term"><code class="code">(<a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
2147 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
2148 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> will return immediately.
2149 Otherwise it returns true.</dd><dt><a id="rbnh"></a><span class="term"><code class="code">(<a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
2150 <em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
2151 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
2152 Returns an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or does <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> handling, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>,
2153 if that would return immediately.
2154 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>'s value is not available immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
2155 instead of waiting.</dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="listen-byte"></a><code class="function">LISTEN</code> on binary streams</h3><p>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> mentions <span class="quote">“<span class="quote">character
2156 availability</span>”</span> as the criterion that determines the return value.
2157 Since a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> is <span class="emphasis"><em>never</em></span> available on a
2158 binary <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (i.e., a stream with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> being a
2159 subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for such streams.
2160 (You can use <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> to check binary streams).
2161 Any other behavior would be hard to make consistent: consider a bivalent
2162 stream, i.e., a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that can be operated upon by both
2163 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>.
2164 What should <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> return on such a stream if what is actually available
2165 on the stream at the moment is only a part of a multi-byte character?
2166 Right now one can use first <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> to check if anything at all is
2167 available and then use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> to make sure that a full <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
2168 is actually there.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="newline-convention"></a>21.6. Newline Convention</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-question"></a>21.6.1. Should programs output a newline before
2169 or after each line of output?</h3></div></div></div><p>The answer is complicated. There is an antagonism between
2170 the <span class="quote">“<span class="quote">old Lisp way</span>”</span> of outputting a newline before the
2171 line's contents (exemplified by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>) and
2172 the <span class="quote">“<span class="quote">Unix way</span>”</span> of outputting a newline after the line's
2173 contents. Which one is <span class="quote">“<span class="quote">right</span>”</span>?</p><p>A newline convention is, by definition, a consistent way to use
2174 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">TERPRI</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> functions or - in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> notation -
2175 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-2.html"><code class="literal">~%</code></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-3.html"><code class="literal">~&amp;</code></a> directives in such a way that the
2176 resulting output is properly subdivided into lines.</p><p>Three newline conventions are conceivable:</p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem">Print a newline before the line, and nothing after it.
2177 As a format string: <span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.</span>”</span></span>
2178 </li><li class="listitem">Print a newline if needed before the line,
2179 and a newline always after it. As a format string:
2180 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.~%</span>”</span></span>
2181 </li><li class="listitem">Print nothing before the line, and a newline always
2182 after it. As a format string:
2183 <span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~%</span>”</span></span>
2184 </li></ol></div><p>The most important criterion is interoperability. Two newline
2185 conventions are interoperable if, when parts of a program use one of the
2186 convention and other parts of the program use the other conventions,
2187 lines are still properly separated. It is easily seen that <span class="strong"><strong>A</strong></span> and
2188 <span class="strong"><strong>B</strong></span> are interoperable, <span class="strong"><strong>B</strong></span> and <span class="strong"><strong>C</strong></span> are interoperable as well,
2189 but <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> are not interoperable: When an output with
2190 convention <span class="strong"><strong>A</strong></span> is followed by output in convention <span class="strong"><strong>C</strong></span>, two lines
2191 are appended without a line separator. This should not happen.</p><p>Therefore, in what follows, we consider five kinds of programs:
2192 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: using convention <span class="strong"><strong>A</strong></span> exclusively,
2193 </li><li class="listitem"><span class="strong"><strong>AB</strong></span>: mixing conventions <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>B</strong></span>,
2194 </li><li class="listitem"><span class="strong"><strong>B</strong></span>: using convention <span class="strong"><strong>B</strong></span> exclusively,
2195 </li><li class="listitem"><span class="strong"><strong>BC</strong></span>: mixing conventions <span class="strong"><strong>B</strong></span> and <span class="strong"><strong>C</strong></span>,
2196 </li><li class="listitem"><span class="strong"><strong>C</strong></span>: using convention <span class="strong"><strong>C</strong></span> exclusively.
2197 </li></ul></div><p>Which of these five kinds of programs operation is satisfactory?
2198 Let us consider different criteria:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Do extra blank lines occur during normal operation?
2199 </li><li class="listitem">What happens if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> prints a newline when
2200 it is not needed, i.e. when it cannot tell for sure whether the
2201 current column is 0? (This situation happens, for example, when
2202 logging to a file: After the user has entered a line interactively,
2203 the column on screen is 0, but since the input has not been echoed in
2204 the log file, the column in the log file is usually not 0, and
2205 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> <span class="strong"><strong>must</strong></span> output a newline. Then a blank
2206 line is visible on the screen.)</li><li class="listitem">What happens if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> omits a newline when it
2207 would be needed?
2208 (This is more rare, but can happen, for example, when standard output
2209 and standard error are different streams but are joined outside the
2210 Lisp implementation, at the OS level.
2211 Such as in <span class="command"><strong>lisp | cat</strong></span>.)</li><li class="listitem"><p>Is it possible to reliably output a blank line
2212 before or after a paragraph of text? I.e. what happens with
2213 </p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
2214 <span class="format"><span class="quote">“<span class="quote">~%~%First line.~%Second line.</span>”</span></span>
2215 </li><li class="listitem">
2216 <span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.~%</span>”</span></span>
2217 </li></ol></div></li><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
2218 <span class="format"><span class="quote">“<span class="quote">~&amp;~%First line.~%Second line.~%</span>”</span></span>
2219 </li><li class="listitem">
2220 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.~%~%</span>”</span></span>
2221 </li></ol></div></li><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
2222 <span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.~%</span>”</span></span>
2223 </li><li class="listitem">
2224 <span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~%~%</span>”</span></span>
2225 </li></ol></div></li></ol></div></li><li class="listitem">Is it possible to optimize away blank lines?
2226 I.e. is it possible to avoid a blank line even though another piece
2227 of code uses one of A1 ... C2, without risking that adjacent lines be
2228 unseparated?</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-trad-analysis"></a>21.6.2. Analysis</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: An extra blank line each time one
2229 switches from convention <span class="strong"><strong>B</strong></span> to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Blank lines can occur when
2230 convention <span class="strong"><strong>B</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: Blank lines can occur.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: Blank lines can occur when
2231 convention <span class="strong"><strong>B</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Lines can be unseparated when one
2232 switches from convention <span class="strong"><strong>A</strong></span> to <span class="strong"><strong>B</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: The blank line is omitted when using
2233 A2 before switching to <span class="strong"><strong>B</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: Yes, using
2234 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2235 eats a previous blank line.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Not really: Using
2236 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2237 may eat a previous blank line or a following blank line, but you
2238 cannot know in advance which one.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: Yes, using
2239 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2240 eats a following blank line.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: Impossible.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: Impossible.
2241 To optimize blank lines in case <span class="strong"><strong>C</strong></span> would require the opposite of
2242 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>, namely a conditional newline that is annullated if the
2243 <span class="emphasis"><em>next</em></span> output on the stream will be a
2244 newline. (<a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>, see below.)</li></ul></div></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-conclusion"></a>21.6.3. Conclusion</h3></div></div></div><p>Each approach has its advantages and disadvantages.</p><p>When used globally (i.e. no interoperability requirements),
2245 <span class="strong"><strong>A</strong></span>, <span class="strong"><strong>B</strong></span>, <span class="strong"><strong>C</strong></span> can be compared as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> are equally perfect if eating
2246 blank lines is not a requirement.</li><li class="listitem">If eating blank lines is desirable, <span class="strong"><strong>A</strong></span> is perfect.
2247 </li><li class="listitem"><span class="strong"><strong>B</strong></span> is not so good, because it is suboptimal in case 2.
2248 </li></ul></div><p>For <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built-ins, however, the interoperability requirement
2249 with both <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> is a major requirement. Therefore we have
2250 to choose <span class="strong"><strong>B</strong></span>, and accept the drawbacks:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>AB</strong></span>: An extra blank line each time one
2251 switches from convention <span class="strong"><strong>B</strong></span> to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: When logging to a file, blank lines can
2252 occur.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: When joining two output streams into
2253 one, lines can be unseparated.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Blank lines after a paragraph can be
2254 eaten by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Optimizing blank lines is not really
2255 possible.</li></ul></div><p>
2256 And to minimize the drawbacks, we recommend the user programs to use
2257 approach <span class="strong"><strong>B</strong></span> or <span class="strong"><strong>C</strong></span>, but not <span class="strong"><strong>A</strong></span>.</p><p>Another drawback of <span class="strong"><strong>B</strong></span> is, however, that in interactive sessions
2258 the cursor is nearly always positioned at the beginning of a line,
2259 pointing the user's focus to the wrong point and taking away a screen
2260 line.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-solution"></a>21.6.4. Solution</h3></div></div></div><p>To solve this, we introduce the concept of an <strong class="first"><em class="firstterm">elastic
2261 newline</em></strong>, output by the function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.
2262 This is the converse of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>: It waits for the next character
2263 and outputs a newline when the next character is not a newline; then
2264 the next character is processed normally.
2265 As a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> directive, we write it <a class="link" href="#format-dot"><code class="literal">~.</code></a>.
2266 <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> followed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> leads to exactly one newline
2267 always.</p><p>Elastic newline leads to a slightly different newline convention:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>B'</strong></span>:
2268 Print a newline if needed before the line, and a newline if needed after it.
2269 As a format string:
2270 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.~.</span>”</span></span>
2271 </li></ul></div><p>The five programs being considered are now:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: using convention <span class="strong"><strong>A</strong></span> exclusively,
2272 </li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: mixing conventions <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>B'</strong></span>,
2273 </li><li class="listitem"><span class="strong"><strong>B'</strong></span>: using convention <span class="strong"><strong>B'</strong></span> exclusively,
2274 </li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: mixing conventions <span class="strong"><strong>B'</strong></span> and <span class="strong"><strong>C</strong></span>,
2275 </li><li class="listitem"><span class="strong"><strong>C</strong></span>: using convention <span class="strong"><strong>C</strong></span> exclusively,
2276 </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-elnl-analysis"></a>21.6.5. Elastic Newline Analysis</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Blank lines can occur when
2277 convention <span class="strong"><strong>B'</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Blank lines can occur.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: Blank lines can occur when
2278 convention <span class="strong"><strong>B'</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Lines can be unseparated when one
2279 switches from convention <span class="strong"><strong>A</strong></span> to <span class="strong"><strong>B'</strong></span>.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Lines can be unseparated when one
2280 switches from one stream to another without performing a
2281 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>. This is a general problem with buffered streams;
2282 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> contains a workaround that is limited to
2283 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: The blank line is omitted when
2284 using A2 before switching to <span class="strong"><strong>B'</strong></span> or when using B2 before switching
2285 to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: Yes, using
2286 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2287 eats a previous blank line.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Not really: Using
2288 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2289 may eat a previous blank line or a following blank line, but you
2290 cannot know in advance which one.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Yes, using
2291 <span class="format"><span class="quote">“<span class="quote">~&amp;First line.~%Second line.</span>”</span></span>
2292 eats a following blank line.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: Impossible.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: Yes, using
2293 <span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~.</span>”</span></span>
2294 eats a following blank line.</li></ul></div></li></ol></div><p>Now criterium 1 is satisfied perfectly. We therefore choose
2295 <span class="strong"><strong>B'</strong></span>, not <span class="strong"><strong>B</strong></span>, for use inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, and programs can use
2296 either <span class="strong"><strong>A</strong></span> or <span class="strong"><strong>C</strong></span> without problems during normal operation.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-extfmt"></a>21.7. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
2297 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> <em class="replaceable"><code>stream</code></em> [<em class="replaceable"><code>direction</code></em>]) <em class="replaceable"><code>encoding</code></em>)</code>,
2298 <em class="replaceable"><code>direction</code></em> can be <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
2299 If no <em class="replaceable"><code>direction</code></em> is given, the operation is nonrecursive.</p><p>This will <span class="strong"><strong>not</strong></span> work on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> et al, use <a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>
2300 instead.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-eltype"></a>21.8. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able. The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> of
2301 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s created by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>, <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-INPUT-STREAM</code></a>
2302 <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-OUTPUT-STREAM</code></a>, <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>, <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a>, <a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>
2303 can be modified, if the old and the new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>s are either
2304 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">both equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or
2305 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>; or</li><li class="listitem">both equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, with the
2306 same <em class="replaceable"><code>n</code></em>.</li></ul></div><p>Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
2307 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>s, see
2308 <a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="stream-eltype-stdio"></a>Warning</h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> expects to be able to
2309 do <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> i/o on standard streams like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>,
2310 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>,
2311 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*QUERY-IO*</code></a> et al, thus it is a <span class="strong"><strong>very</strong></span> bad idea
2312 to change their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> even when you can. Use
2313 <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> instead, see <a class="xref" href="#bin-stdio" title="21.8.1. Binary input from *STANDARD-INPUT*">Section 21.8.1, “Binary input from <code class="varname">*STANDARD-INPUT*</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-stdio"></a>21.8.1. Binary input from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a></h3></div></div></div><p>Note that you cannot change <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> for some
2314 built-in streams, such as <a class="link" href="#terminal" title="21.2. Terminal interaction">terminal streams</a>,
2315 which is normally the value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
2316 Since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> normally is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a> pointing
2317 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>, you cannot use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> on it.</p><p>Since <a class="ulink" href="https://en.wikipedia.org/wiki/Common_Gateway_Interface" target="_top">CGI</a>
2318 (Common Gateway Interface) provides the form data for
2319 <span class="command"><strong>METHOD="POST"</strong></span> on the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>,
2320 and the server will <span class="strong"><strong>not</strong></span> send you an <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> on the end of the data,
2321 you will need to use
2322 <code class="code">(<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> <code class="envar">"CONTENT_LENGTH"</code>)</code>
2323 to determine how much data you should read from <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>.
2324 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will detect that <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a> is not a terminal and create a regular
2325 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> which can be passed to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
2326 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>.
2327 To test this functionality interactively,
2328 you will need to open the standard input in the binary mode:
2329 </p><pre class="programlisting">
2330 (let ((buf (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-integer.html" target="_top"><code class="function">PARSE-INTEGER</code></a> (<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> "CONTENT_LENGTH"))
2331 :element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
2332 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (in (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:INPUT</code> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>))
2333 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a> buf in))
2334 buf)
2335 </pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="make-stream"></a>21.9. Function <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a></h2></div></div></div><p>Function <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> creates a Lisp stream out of an OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>:
2336 <code class="code">(<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <em class="replaceable"><code>object</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:DIRECTION</code>
2337 <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></p><p><em class="replaceable"><code>object</code></em> designates an OS handle (a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>),
2338 and should be one of the following: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">number</span></dt><dd>denotes the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> of this value
2339 </dd><dt><span class="term"><code class="constant">:INPUT</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
2340 process standard input, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>
2341 (0 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><code class="constant">:OUTPUT</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
2342 process standard output, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>
2343 (1 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
2344 process error output, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a>
2345 (2 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a></span></dt><dd>denotes the handle of this stream, which should be
2346 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> or a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a></dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="make-stream-warn-buffering"></a>Beware of buffering!</h3><p>When there are several Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s backed by the same OS
2347 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>, the behavior may be highly confusing when some of the
2348 Lisp streams are <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>. Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a> for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s,
2349 and <a class="link" href="#bulk-io" title="21.4. Bulk Input and Output">bulk input</a> for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p></div><p>The handle is duplicated (with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a>),
2350 so it is safe to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> returned by <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="file-pos"></a>21.10. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> works on any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>When a <span class="keysym">#\Newline</span> is output to (respectively input from)
2351 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, its file position is increased by 2 since <span class="keysym">#\Newline</span> is
2352 encoded as <span class="keycode">CR</span>/<span class="keycode">LF</span> in the file.
2353 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="elastic-newline"></a>21.11. Function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a></h2></div></div></div><p>The function <code class="code">(<a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> [<em class="replaceable"><code>stream</code></em>])</code> is like
2354 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> but the other way around: It outputs a conditional newline
2355 on <em class="replaceable"><code>stream</code></em>, which is canceled if the <span class="emphasis"><em>next</em></span>
2356 output on <em class="replaceable"><code>stream</code></em> happens to be a newline. More precisely, it
2357 causes a newline to be output right before the next character is
2358 written on <em class="replaceable"><code>stream</code></em>, if this character is not a newline.
2359 The newline is also output if the next operation on the stream is
2360 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</p><p>The functionality of <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> is also available through
2361 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> directive <a class="link" href="#format-dot"><code class="literal">~.</code></a>.</p><p>A technique for avoiding unnecessary blank lines in output is to
2362 begin each chunk of output with a call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> and to terminate it
2363 with a call to <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.</p><p>See also <a class="xref" href="#newline-convention" title="21.6. Newline Convention">Section 21.6, “Newline Convention”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="open"></a>21.12. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> accepts an additional keyword <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>.</p><div class="variablelist"><p class="title"><strong>The acceptable values for the arguments to the
2364 <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> functions</strong></p><dl class="variablelist"><dt><a id="eltype"></a><span class="term"><a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a></span></dt><dd><p class="simpara">types equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or
2365 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>; if the stream is to be
2366 un<a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>, <em class="replaceable"><code>n</code></em> must be a multiple of 8.</p><p class="simpara">If <em class="replaceable"><code>n</code></em> is not a multiple of 8, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will use the
2367 specified number of bits for i/o, and write the file length
2368 (as a number of <em class="replaceable"><code>n</code></em>-bit bytes) in the preamble.</p><p class="simpara">This is done to ensure the input/output consistency:
2369 suppose you open a file with <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 3)</code></span> and write 7 bytes
2370 (i.e., 21 bit) there.
2371 The underlying OS can do input/output only in whole 8-bit bytes.
2372 Thus the OS will report the size of the file as 3 (8-bit) bytes.
2373 Without the preamble <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will have no way to know how many
2374 3-bit bytes to read from this file - 6, 7 or 8.</p><p class="simpara">See also <a class="xref" href="#stream-eltype" title="21.8. Function STREAM-ELEMENT-TYPE">Section 21.8, “Function <code class="function">STREAM-ELEMENT-TYPE</code>”</a>.</p></dd><dt><a id="extfmt"></a><span class="term"><a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a></span></dt><dd><p class="simpara"><a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s, (constant) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s in the
2375 <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a> package, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s (denoting <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>-based encodings),
2376 the symbol <code class="constant">:DEFAULT</code>, and the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> keywords
2377 <code class="constant">:UNIX</code>, <code class="constant">:MAC</code>, <code class="constant">:DOS</code>. The default encoding is <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>.
2378 This argument determines how the lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> data is
2379 converted to/from the 8-bit bytes that the underlying OS uses.</p><p class="simpara">See also <a class="xref" href="#stream-extfmt" title="21.7. Function STREAM-EXTERNAL-FORMAT">Section 21.7, “Function <code class="function">STREAM-EXTERNAL-FORMAT</code>”</a>.</p></dd><dt><a id="buffered"></a><span class="term"><a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a></span></dt><dd><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, or <code class="constant">:DEFAULT</code>.
2380 Have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> manage an internal buffer for input or output (in
2381 addition to the buffering that might be used by the underlying OS).
2382 Buffering is a known general technique to significantly speed up i/o.
2383 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">for functions that create <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s and
2384 <a class="link" href="#pipe" title="32.7.2. Pipes">pipes</a>, <code class="constant">:DEFAULT</code> is equivalent to
2385 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> on the input side and to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on the output side; if you are
2386 transmitting a lot of data then using buffering
2387 will significantly speed up your i/o;</li><li class="listitem">for functions that <a class="link" href="#open" title="21.12. Function OPEN">open</a>
2388 files, <code class="constant">:DEFAULT</code> means that buffered file streams will be returned
2389 for regular files and (on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>) block-devices, and unbuffered file
2390 streams for special files.</li></ul></div><p>
2391 Note that some files, notably those on the <code class="filename">/proc</code>
2392 filesystem (on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems), are actually, despite their innocuous
2393 appearance, special files, so you might need to supply an explicit
2394 <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> argument for them. Actually, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> detects that
2395 the file is a <code class="filename">/proc</code> file, so that one is covered,
2396 but there are probably more strange beasts out there!
2397 </p></dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="reopen"></a>Variable <a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></h3></div></div></div><p>When an already opened file is opened again, and <span class="strong"><strong>not</strong></span> both the
2398 existing and the new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s are read-only (i.e., <code class="constant">:DIRECTION</code> is
2399 <code class="constant">:INPUT</code> or <code class="constant">:INPUT-IMMUTABLE</code>), the streams can
2400 mess up each other and produce unexpected results.
2401 The user variable <strong class="first"><em class="firstterm"><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></em></strong> controls how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
2402 handles the situation and can take 4 values: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>
2403 do nothing: do not even check that there are other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s
2404 pointing to the same file</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a
2405 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> and proceed</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>
2406 the <span class="emphasis"><em>other</em></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s and proceed
2407 (this could be dangerous and is not generally recommended)
2408 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> (default)</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>
2409 a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clear-input"></a>21.13. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a></h2></div></div></div><p>Calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> removes the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> state,
2410 thus making it available for further input.</p><p>This allows reading from a file as it is being appended to,
2411 as if with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/tail.html"><span class="command"><strong>tail -f</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="close"></a>21.14. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, see
2412 <a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p><p>When the <code class="constant">:ABORT</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> will not
2413 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> even when the underlying OS call fails.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-outpu_tream-string.html" target="_top"><code class="function">GET-OUTPUT-STREAM-STRING</code></a> returns the same value after
2414 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> as it would before it.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> on an already closed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> does nothing and returns
2415 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p><p>If you do not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> your <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> explicitly, it will be
2416 closed at <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion time automatically
2417 (with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>stream</code></em> <code class="constant">:ABORT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>).
2418 This is <span class="strong"><strong>not</strong></span> recommended though because <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is not deterministic.
2419 Please use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="open-stream-p"></a>21.15. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, see
2420 <a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="broadcast-stream"></a>21.16. Class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_interactive-stream-p.html" target="_top"><code class="function">INTERACTIVE-STREAM-P</code></a> return false for
2421 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-buffer"></a>21.17. Functions
2422 <strong class="first"><em class="firstterm"><code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
2423 <a id="stream-buffer-i" class="indexterm"></a></em></strong> and
2424 <strong class="first"><em class="firstterm"><code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
2425 <a id="stream-buffer-o" class="indexterm"></a></em></strong>
2426 </h2></div></div></div><p><strong><code class="code">(EXT:MAKE-BUFFERED-OUTPUT-STREAM
2427 <em class="replaceable"><code>function</code></em>)</code>. </strong>Returns a buffered <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.
2428 <em class="replaceable"><code>function</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> expecting one argument, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>.
2429 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a> collects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, until a
2430 newline character is written or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a> is called.
2431 Then <em class="replaceable"><code>function</code></em> is called with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a> as argument,
2432 that contains the characters collected so far.
2433 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">CLEAR-OUTPUT</code></a> discards the characters collected so far.</p><p><strong><code class="code">(EXT:MAKE-BUFFERED-INPUT-STREAM <em class="replaceable"><code>function</code></em>
2434 <em class="replaceable"><code>mode</code></em>)</code>. </strong>Returns a buffered <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.
2435 <em class="replaceable"><code>function</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of 0 arguments that returns
2436 either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>) or up to three values
2437 <em class="replaceable"><code>string</code></em>, <em class="replaceable"><code>start</code></em>, <em class="replaceable"><code>end</code></em>.
2438 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s of the current <em class="replaceable"><code>string</code></em> one
2439 after another, as delimited by <em class="replaceable"><code>start</code></em> and <em class="replaceable"><code>end</code></em>, which default to
2440 <code class="literal">0</code> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, respectively.
2441 When the <em class="replaceable"><code>string</code></em> is consumed, <em class="replaceable"><code>function</code></em> is called again.
2442 The <em class="replaceable"><code>string</code></em> returned by <em class="replaceable"><code>function</code></em> should not be changed by the user.
2443 <em class="replaceable"><code>function</code></em> should copy the <em class="replaceable"><code>string</code></em> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-seq.html" target="_top"><code class="function">COPY-SEQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_subseq.html" target="_top"><code class="function">SUBSEQ</code></a> before
2444 returning if the original <em class="replaceable"><code>string</code></em> is to be modified.
2445 <em class="replaceable"><code>mode</code></em> determines the behavior of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>
2446 when the current <em class="replaceable"><code>string</code></em> buffer is empty:
2447 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>the stream acts like a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>,
2448 i.e. <em class="replaceable"><code>function</code></em> is called</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></span></dt><dd>the stream acts like an interactive stream without
2449 <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>, i.e. one can assume that further characters will always
2450 arrive, without calling <em class="replaceable"><code>function</code></em></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></span></dt><dd>this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> tells, upon call, if further
2451 non-empty <em class="replaceable"><code>string</code></em>s are to be expected.</dd></dl></div><p>
2452 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a> discards the rest of the current <em class="replaceable"><code>string</code></em>,
2453 so <em class="replaceable"><code>function</code></em> will be called upon the next <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> operation.
2454 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-handles"></a>21.18. Function
2455 <code class="function">EXT:STREAM-HANDLES</code></h2></div></div></div><p>The function <code class="code">(EXT:STREAM-HANDLES <em class="replaceable"><code>stream</code></em>)</code> returns
2456 two values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">The OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> side of the
2457 <em class="replaceable"><code>stream</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>stream</code></em> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a>-only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
2458 or if there is no <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with it.</li><li class="listitem">The OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> side of the
2459 <em class="replaceable"><code>stream</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>stream</code></em> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a>-only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
2460 or if there is no <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with it.</li></ol></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>It is dangerous to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s returned by
2461 this function. This may lead to <code class="constant">EBADF</code>
2462 OS <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s and, eventually, segmentation faults. Always use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>
2463 on the original Lisp <em class="replaceable"><code>stream</code></em>s instead.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="printer"></a>Chapter 22. Printer <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-22.html">[chap-22]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dd><dl><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></dd><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dd><dl><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></dd><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> &amp; <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="multi-rep"></a>22.1. Multiple Possible Textual Representations
2464 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-1-1.html">[sec_22-1-1-1]</a></h2></div></div></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-closure"></a>Variable <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> controls whether compiled and
2465 interpreted functions (closures) are output in detailed form.
2466 If <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a readable syntax is used for closures:
2467 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">interpreted closures</span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> ...)</dd><dt><span class="term">compiled closures</span></dt><dd><span class="data"><code class="literal">#Y(...)</code></span> (this is what you
2468 would see if you open a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <code class="filename">#P".fas"</code> in a text editor)</dd></dl></div><p>This feature is turned off by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a> because
2469 it is easy to get wrong (see below) and non-portable.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Closures often refer to value cells or other entities from the
2470 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. The correct operation of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> may depend on the access
2471 to the same value cells as some other, related <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s.
2472 If you want to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> back <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s so that their semantics
2473 is preserved, you have to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> <span class="strong"><strong>all</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s that share
2474 some structure in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> <span class="emphasis"><em>together</em></span>, and you have to
2475 either bind <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>:
2476 </p><pre class="programlisting">
2477 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> my-pop my-push)
2478 `(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((storage ()))
2479 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pop.html" target="_top"><code class="function">POP</code></a> storage))
2480 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_push.html" target="_top"><code class="function">PUSH</code></a> x storage)))))
2481 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((pair (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a>
2482 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>
2483 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
2484 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> my-pop my-push)))))))
2485 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> my-pop-1 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> pair)
2486 my-push-1 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> pair)))
2487 </pre><p>
2488 Note that <code class="function">my-pop</code> and <code class="function">my-push</code>
2489 share environment between themselves but <span class="strong"><strong>not</strong></span> with
2490 <code class="function">my-pop-1</code> and <code class="function">my-push-1</code> which
2491 can be easily seen if you do </p><pre class="programlisting">
2492 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
2493 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> my-pop my-push my-pop-1 my-push-1)))
2494 </pre><p> but which is not at all obvious from the usual
2495 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html"><span class="data"><code class="literal">#&lt;</code></span></a> output.</p></div><p><a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-rpars"></a>Variable <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> controls
2496 the output of the right (closing) parentheses.
2497 If <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, closing parentheses which do not fit onto
2498 the same line as the the corresponding opening parenthesis are output
2499 just below their corresponding opening parenthesis, in the same column.
2500 </p><p><a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-indent"></a>Variable <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a> controls the indentation of
2501 lists that span more than one line.
2502 It specifies by how many characters items within the list will be
2503 indented relative to the beginning of the list.</p><p><a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a> is initially set to <code class="literal">1</code>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="ppr-first-newline"></a>Variable <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> controls
2504 pretty-printing of multi-line objects.
2505 When <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
2506 and the current line already has some characters on it,
2507 and the next object will be printed on several lines,
2508 and it does not start with a <span class="keysym">#\Newline</span>,
2509 then a <span class="keysym">#\Newline</span> is printed before the object.
2510 E.g., when you type <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "return value: ~S~%" <em class="replaceable"><code>v</code></em>)</code>
2511 you want want to see a terse one-line output when <em class="replaceable"><code>v</code></em> is something
2512 short (like <code class="literal">0</code> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>), but you probably want to see
2513 something nice, like </p><pre class="screen">
2514 return value:
2515 (long list which does not fit
2516 on one line)</pre><p>
2517 instead of </p><pre class="screen">
2518 return value: (long list which does not fit
2519 on one line)</pre><p> when it does not.</p><p><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> has no effect if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="write-float-decimal"></a>22.2. Printing Floats
2520 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-1-3.html">[sec_22-1-3-1-3]</a></h2></div></div></div><p>In the absence of <a class="link" href="#write-float-decimal" title="22.2. Printing Floats sec_22-1-3-1-3"><code class="function">SYS::WRITE-FLOAT-DECIMAL</code></a>, floating point numbers
2521 are output in radix 2. This function is defined in <a class="link" href="#floatprint-lisp"><code class="filename">floatprint.lisp</code></a>
2522 and is not available if you run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> without a <a href="impnotes.html#image" class="olink">memory image</a> (which
2523 you should never do anyway!)</p><p>If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a>
2524 has no influence on the way <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>s are printed.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spacecharprint"></a>22.3. Printing Characters
2525 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-2.html">[sec_22-1-3-2]</a></h2></div></div></div><p>Characters are printed as specified in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] using
2526 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-1.html"><span class="data"><code class="literal">#\</code></span></a>, with one exception: when <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printer_escaping">printer escaping</a> is in effect,
2527 the space character is printed as
2528 <span class="quote">“<span class="quote"><code class="computeroutput">#\Space</code></span>”</span> when the
2529 variable <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
2530 When <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it is printed as
2531 <span class="quote">“<span class="quote"><code class="computeroutput">#\ </code></span>”</span>; this is how
2532 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specifies it.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sym-pack-prefix"></a>22.4. Package Prefixes for Symbols
2533 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-3-1.html">[sec_22-1-3-3-1]</a></h2></div></div></div><p><a id="pr-sym-pack-prefix"></a><strong>Variable <a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a>. </strong>When <a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the package
2534 prefix is not the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_package-name.html" target="_top"><code class="function">PACKAGE-NAME</code></a> but the shortest (nick)name as
2535 returned by <a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a>. This variable is ignored when
2536 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-vector"></a>22.5. Printing Other Vectors
2537 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-7.html">[sec_22-1-3-7]</a></h2></div></div></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, other vectors are written as
2538 follows: if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>, the syntax
2539 <code class="computeroutput">#(<em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)</code> is used.
2540 Otherwise, the syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em>
2541 <em class="replaceable"><code>dimensions</code></em> <em class="replaceable"><code>contents</code></em>)</code> is used.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-array"></a>22.6. Printing Other Arrays
2542 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-8.html">[sec_22-1-3-8]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, other arrays are written as
2543 follows: if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>, the syntax
2544 <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-12.html"><span class="data"><code class="literal">#<em class="replaceable"><code>rank</code></em>A</code></span></a> <em class="replaceable"><code>contents</code></em></code> is used.
2545 Otherwise, the syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>
2546 <em class="replaceable"><code>contents</code></em>)</code> is used.</p><p>As explicitly permitted by this section, specialized <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a> and
2547 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s are printed with the innermost lists generated
2548 by the printing algorithm being instead printed using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a> and
2549 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> syntax, respectively.</p><p><a id="pr-empty-arr-ansi"></a><strong>Variable <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a>. </strong>Empty <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s, i.e., arrays with no elements and zero
2550 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-total-size.html" target="_top"><code class="function">ARRAY-TOTAL-SIZE</code></a> (because one of its dimensions is zero) are printed
2551 with the readable syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>
2552 <em class="replaceable"><code>contents</code></em>)</code>, unless the variable <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> is
2553 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case the arrays are printed using the
2554 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]-prescribed syntax <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-12.html"><span class="data"><code class="literal">#<em class="replaceable"><code>rank</code></em>A</code></span></a> <em class="replaceable"><code>contents</code></em></code>
2555 which often loses the dimension information.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pathprint"></a>22.6.1. Printing Pathnames
2556 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-11.html">[sec_22-1-3-11]</a></h3></div></div></div><p>Pathnames are printed as follows: If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
2557 only the namestring is printed; otherwise it is printed with the
2558 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> syntax, as per the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss276.html" target="_top">PRINT-READABLY-BEHAVIOR:CLARIFY</a>.
2559 But, if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, we are in trouble as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> is
2560 ambiguous (which is verboten when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true), while
2561 being mandated by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
2562 Therefore, in this case, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s behavior is determined by the value
2563 of <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a>: when it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, we print pathnames like this:
2564 <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-18.html"><span class="data"><code class="literal">#-</code></span></a>CLISP <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a>"..."
2565 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-17.html"><span class="data"><code class="literal">#+</code></span></a>CLISP <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> ...)</code>.
2566 Otherwise, when the variable <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the
2567 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> notation is used as per <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-5-1-4-1.html">[sec_1-5-1-4-1]</a>
2568 <span class="quote">“<span class="quote">Resolution of Apparent Conflicts in Exceptional Situations</span>”</span>.
2569 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a> notation for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>s is used
2570 extensively in the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] (see examples for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname.html" target="_top"><code class="function">PATHNAME</code></a>,
2571 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathnamep.html" target="_top"><code class="function">PATHNAMEP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> et al), but was decided against, see
2572 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss260.html" target="_top">PATHNAME-PRINT-READ:SHARPSIGN-P</a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>When both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> and <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> are
2573 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the namestring will be parsed to a dissimilar object
2574 (with the current value of <a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a>), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
2575 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_print-not-readable.html" target="_top"><code class="classname">PRINT-NOT-READABLE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clpp"></a>22.7. The Lisp Pretty Printer
2576 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-2.html">[sec_22-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></div><p>The Lisp Pretty Printer implementation is <span class="strong"><strong>not</strong></span> perfect yet.
2577 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pprint-logical-block.html" target="_top"><code class="function">PPRINT-LOGICAL-BLOCK</code></a> does not respect <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-linesst.html" target="_top"><code class="varname">*PRINT-LINES*</code></a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pp-dispatch"></a>22.7.1. Pretty Print Dispatch Table
2578 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-2-1-4.html">[sec_22-2-1-4]</a></h3></div></div></div><p>A <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#pprint_dispatch_table">pprint dispatch table</a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>
2579 of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-p_t-dispatchst.html" target="_top"><code class="varname">*PRINT-PPRINT-DISPATCH*</code></a> and an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> which maps
2580 types into priorities and print functions.
2581 Their use is strongly discouraged because of the performance issues:
2582 when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-p_t-dispatchst.html" target="_top"><code class="varname">*PRINT-PPRINT-DISPATCH*</code></a> is non-trivial and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a>
2583 is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, printing of every object requires a lookup in the table,
2584 which entails many calls to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> (which cannot be made fast
2585 enough).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-formatted"></a>22.8. Formatted Output
2586 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3.html">[sec_22-3]</a></h2></div><div><h3 class="subtitle">Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a></h3></div></div></div><p>The additional <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction
2587 <strong class="first"><em class="firstterm"><code class="literal">~!</code><a id="format-bang" class="indexterm"></a></em></strong>
2588 is similar to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-5-4.html"><code class="literal">~/</code></a>, but avoids putting a function name into a
2589 string, thus it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> in the current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>, so, even if the
2590 function is not interned in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, you might not need
2591 to specify the package explicitly.
2592 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <em class="replaceable"><code>stream</code></em> "~arguments!" <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>)</code> is
2593 equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>object</code></em>
2594 <em class="replaceable"><code>colon-modifier-p</code></em>
2595 <em class="replaceable"><code>atsign-modifier-p</code></em> <em class="replaceable"><code>arguments</code></em>)</code>.</p><p>The additional <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction
2596 <strong class="first"><em class="firstterm"><code class="literal">~.</code><a id="format-dot" class="indexterm"></a></em></strong>
2597 is a kind of opposite to <code class="code">~&amp;</code>: It outputs a conditional
2598 newline, by calling the function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.
2599 <code class="code">~<em class="replaceable"><code>n</code></em>.</code> outputs <em class="replaceable"><code>n-1</code></em> newlines
2600 followed by an <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>. <code class="code">~0.</code> does nothing.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~:R</code></a> can output only
2601 integers in the range <code class="code">|<em class="replaceable"><code>n</code></em>| &lt;
2602 <em class="replaceable"><code>10<sup>66</sup></code></em></code>.
2603 The output is in English, according to the American conventions, and
2604 these conventions are identical to the British conventions only in the
2605 range <code class="code">|<em class="replaceable"><code>n</code></em>| &lt;
2606 <em class="replaceable"><code>10<sup>9</sup></code></em></code>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-1.html"><code class="literal">~:@C</code></a> does not output the character itself, only the
2607 instruction how to type the character.</p><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, the value of
2608 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a> does not matter if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a>
2609 is true.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-6-1.html"><code class="literal">~T</code></a> can determine the current column of any
2610 built-in stream.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="write"></a>22.9. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">WRITE-TO-STRING</code></a></h2></div></div></div><p>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">WRITE-TO-STRING</code></a> have an additional
2611 keyword argument <code class="constant">:CLOSURE</code> which is used to bind
2612 <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-unreadable-object"></a>22.10. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a></h2></div></div></div><p><a id="pr-unreadable-ansi"></a><strong>Variable <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a>. </strong>The macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a>, when invoked without body forms,
2613 suppresses the trailing space if only the type is to be printed, and
2614 suppresses the leading space if only the identity is to be printed. This
2615 behaviour can be turned off set setting the variable <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a>
2616 to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value: in this case, a trailing or leading space are output,
2617 as prescribed by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-misc"></a>22.11. Miscellaneous Issues</h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a> controls the output not only of symbols, but also
2618 of characters and some <span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#&lt;</a>unreadable&gt;</code></span> objects.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> but set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>
2619 in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. This makes screen output prettier.
2620 </dd></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="reader"></a>Chapter 23. Reader <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-23.html">[chap-23]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rt-case"></a>23.1. Effect of Readtable Case on the Lisp Reader
2621 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_23-1-2.html">[sec_23-1-2]</a></h2></div></div></div><p>When the value of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a>
2622 <em class="replaceable"><code>readtable</code></em>)</code> is
2623 <code class="constant">:INVERT</code>, it applies to the package name and the
2624 symbol name of a symbol separately (not to the entire token at once).
2625 An alternative to the use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a> is the use of the
2626 <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> option of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="recursive-p"></a>23.2. The <em class="replaceable"><code>recursive-p</code></em> argument
2627 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_23-1-3-2.html">[sec_23-1-3-2]</a></h2></div></div></div><p>When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>recursive-p</code></em> argument is passed to a top-level <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a>
2628 call, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="system"></a>Chapter 24. System Construction
2629 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-24.html">[chap-24]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></dd><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></div><p>The compiler can be called not only by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>,
2630 <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>, but also by the declaration
2631 <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compilefile"></a>24.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> compiles a file to a platform-independent
2632 <a href="impnotes.html#bytecode" class="olink">bytecode</a>:
2633 </p><pre class="programlisting">
2634 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:OUTPUT-FILE</code> :LISTING <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>
2635 ((<code class="constant">:WARNINGS</code> <a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>) <a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>)
2636 ((<code class="constant">:VERBOSE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a>)
2637 ((<code class="constant">:PRINT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a>))
2638 </pre><div class="variablelist"><a id="compile-file-arguments"></a><p class="title"><strong>Options for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>filename</code></em></span></dt><dd>the file to be compiled, should be a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>.
2639 </dd><dt><span class="term"><code class="constant">:OUTPUT-FILE</code></span></dt><dd>should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> or an
2640 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</dd><dt><span class="term"><code class="constant">:LISTING</code></span></dt><dd>should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> or an
2641 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a></span></dt><dd>the <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> of the <em class="replaceable"><code>filename</code></em>.
2642 </dd><dt><span class="term"><code class="constant">:WARNINGS</code></span></dt><dd>specifies whether warnings should also appear on the
2643 screen.</dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>specifies whether error messages should also appear
2644 on the screen.</dd><dt><span class="term"><code class="constant">:PRINT</code></span></dt><dd>specifies whether an indication which forms are
2645 being compiled should appear on the screen.
2646 </dd></dl></div><p>The variables <strong class="first"><em class="firstterm"><a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>
2647 <a id="compile-warn" class="indexterm"></a></em></strong>
2648 (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a> (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
2649 affected by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a> (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
2650 affected by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code>) provide defaults for the <code class="constant">:WARNINGS</code>, <code class="constant">:VERBOSE</code>,
2651 <code class="constant">:PRINT</code> keyword arguments, respectively, and are bound by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a>
2652 to the values of the arguments, i.e., these arguments are recursive.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-file-output"></a>24.1.1. Output files</h3></div></div></div><p>For each input file (default file type: <code class="filename">#P".lisp"</code>)
2653 the following files are generated:
2654 </p><div class="informaltable"><a id="compile-file-new-files-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col align="left" /></colgroup><thead><tr><th align="center">File</th><th align="center">When</th><th align="center">Default file type</th><th align="left">Contents</th></tr></thead><tbody><tr><td align="center">output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".fas"</code></td><td align="left">can be loaded using the <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> function</td></tr><tr><td align="center">auxiliary output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a></td><td align="left">used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> when compiling a <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> form referring
2655 to the input file</td></tr><tr><td align="center">listing file</td><td align="center">only if <code class="constant">:LISTING</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".lis"</code></td><td align="left">disassembly of the output file</td></tr><tr><td align="center"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".c"</code></td><td align="left"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>; this file is created only if the source contains
2656 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms</td></tr></tbody></table></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="c-file-overwrite"></a>Warning</h3><p>If you have two files in the same
2657 directory - <code class="filename">#P"foo.lisp"</code> and <code class="filename">#P"foo.c"</code>, and you
2658 compile the first file with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, the second file will be
2659 <span class="emphasis"><em>clobbered</em></span> if you have any <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms in
2660 the first one!</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-file-return"></a>24.1.2. Return values</h3></div></div></div><p>As per [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> returns 3 values:
2661 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">output-truename</span></dt><dd>the truename of the output <code class="filename">#P".fas"</code>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
2662 if the file could not be created, in which case the compilation is
2663 considered to have failed</dd><dt><span class="term">warnings-p</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no conditions of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
2664 were detected during compilation, and the number of such conditions otherwise
2665 </dd><dt><span class="term">failure-p</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no conditions of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
2666 (other than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a>) were detected during compilation,
2667 and the number of such conditions otherwise
2668 </dd></dl></div><p>
2669 Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> tends to be relatively garrulous with warnings
2670 (see, e.g., <a class="xref" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4">Section 12.2.4.1, “Rule of Float Precision Contagion sec_12-1-4-4”</a>), the non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> tertiary return value
2671 (called <em class="replaceable"><code>failure-p</code></em> by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>])
2672 does <span class="strong"><strong>not</strong></span> indicate a failure of compilation.
2673 The correct way to check whether <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> has failed is the
2674 <span class="emphasis"><em>primary</em></span> return value.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compile-file-path"></a>24.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a></h2></div></div></div><p>The default for the <code class="constant">:OUTPUT-FILE</code> argument is
2675 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, which means <code class="filename">#P".fas"</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="require"></a>24.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> receives as the optional argument either
2676 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>s: files to be <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>ed
2677 if the required module is not already present.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="require-return"></a>24.3.1. Return value</h3></div></div></div><p>When the module is already present, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned;
2678 otherwise returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a> which was loaded to satisfy the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a>ment
2679 (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> thereof iff the second argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="require-search"></a>24.3.2. Additional <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> locations</h3></div></div></div><p>In addition to (and <span class="strong"><strong>before</strong></span>) <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> tries to
2680 find the file to <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> in the following locations:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></p><p class="simpara">The system-wide external modules directory
2681 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> "dynmod/" <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>)</code>.</p></li><li class="listitem"><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></p><p class="simpara">The user external modules directory <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a>
2682 "dynmod/" <a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a>)</code>
2683 (when <a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).</p></li><li class="listitem">When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> was called while <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>ing, the
2684 directory with the file being loaded (i.e., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a>
2685 :name <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> :type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> :defaults <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-TRUENAME*</code></a>)</code>).
2686 </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="module-providers"></a>24.3.3. User variable <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></h3></div></div></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> is called without the second (pathname) argument,
2687 the elements of the <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> are called one by one
2688 on the first (module name) argument until one of them returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
2689 If all of them return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> is called as described
2690 <a class="link" href="#require-search" title="24.3.2. Additional LOAD locations">above</a>.</p><p>Initially the lisp is empty; <code class="code">(require "<span class="module"><a class="filename" href="#asdf" title="33.1. A System Definition Facility"><code class="filename">asdf</code></a></span>")</code>
2691 modifies it (<span class="plat-dep">Platform Dependent: <span class="plat-dep">if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was configured with the
2692 option <code class="option">--with-module=asdf</code></span></span>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="lib-files"></a>24.3.4. Interaction with <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a></h3></div></div></div><p>At compile time, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> <code class="filename">#P"foo"</code>)</code>
2693 forms are treated specially: <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> is searched for
2694 <code class="filename">#P"foo.lisp"</code> <span class="strong"><strong>and</strong></span> <code class="filename">#P"foo.lib"</code>.
2695 If the latest such file is a <code class="filename">#P".lisp"</code>, it is compiled;
2696 otherwise the <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a> is loaded.
2697 If neither is found, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> <code class="filename">#P"foo"</code>)</code> is called.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="module-user-file-name-conflict"></a>Warning</h3><p>It is a <span class="strong"><strong>very</strong></span> bad
2698 idea to name your files the same way as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> modules
2699 (whether <a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">system-supplied</a>
2700 or <a href="clisp-link.html#opt-install" class="olink">user-installed</a>)
2701 because then <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> will use different files at compile
2702 and execution times.</p></div><p>The <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a> is a <span class="quote">“<span class="quote">header</span>”</span> file which contains the
2703 constant, variable, inline and macro definitions necessary for
2704 compilation of the files that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> this file, but not the function
2705 definitions and calls that are not necessary for that.
2706 Thus it is <span class="strong"><strong>not</strong></span> necessary to either enclose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> forms in
2707 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> or to load the required files in the makefiles: if you have
2708 two files, <code class="filename">#P"foo.lisp"</code> and <code class="filename">#P"bar.lisp"</code>, and the
2709 latter requires the former, you can write in your <code class="filename">Makefile</code>:
2710 </p><pre class="programlisting">
2711 all: foo.fas bar.fas
2712
2713 foo.fas: foo.lisp
2714 clisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> foo
2715
2716 bar.fas: bar.lisp foo.fas
2717 clisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> bar
2718 </pre><p>
2719 instead of the more cumbersome (and slower, since <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a>s are
2720 usually smaller and load faster that <code class="filename">#P".fas"</code>s):
2721 </p><pre class="programlisting">
2722 bar.fas: bar.lisp foo.fas
2723 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> foo <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> bar
2724 </pre><p>
2725 Thus, you do not need to <code class="code">(<a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> <code class="filename">#P"foo"</code>)</code> in order
2726 to <code class="code">(<a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> <code class="filename">#P"bar.lisp"</code>)</code>.
2727 If memory is tight, and if <code class="filename">#P"foo.lisp"</code> contains only a few inline
2728 functions, macros, constants or variables, this is a space and time
2729 saver. If <code class="filename">#P"foo.lisp"</code> does a lot of initializations or side effects
2730 when being loaded, this is important as well.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="loadfile"></a>24.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> accepts four additional keyword arguments <code class="constant">:ECHO</code>,
2731 <code class="constant">:COMPILING</code>, <code class="constant">:EXTRA-FILE-TYPES</code>, and <code class="constant">:OBSOLETE-ACTION</code>.</p><pre class="programlisting">
2732 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> ((<code class="constant">:VERBOSE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>)
2733 ((<code class="constant">:PRINT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>)
2734 ((<code class="constant">:ECHO</code> <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>) <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>) <code class="constant">:IF-DOES-NOT-EXIST</code>
2735 ((<code class="constant">:COMPILING</code> <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>) <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>) <code class="constant">:EXTRA-FILE-TYPES</code>
2736 ((<code class="constant">:OBSOLETE-ACTION</code> <a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>) <a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>)
2737 (ignore-pathname-defaults nil))
2738 </pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>causes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> to emit a short message that a file is
2739 being loaded. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>, which is initially
2740 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.
2741 </dd><dt><span class="term"><code class="constant">:PRINT</code></span></dt><dd>causes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> to print the value of each form. The
2742 default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>, which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be
2743 changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.</dd><dt><span class="term"><code class="constant">:ECHO</code></span></dt><dd>causes the input from the file to be echoed to
2744 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> (normally to the screen). Should there be an
2745 error in the file, you can see at one glance where it is.
2746 The default is <strong class="first"><em class="firstterm"><a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>
2747 <a id="load-echo" class="indexterm"></a></em></strong>,
2748 which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.
2749 </dd><dt><span class="term"><code class="constant">:COMPILING</code></span></dt><dd>causes each form read to be compiled on the fly.
2750 The compiled code is executed at once and - in contrast to
2751 <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> - not written to a file.
2752 The default is <strong class="first"><em class="firstterm"><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>
2753 <a id="load-comp" class="indexterm"></a></em></strong>,
2754 which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> option.
2755 </dd><dt><span class="term"><code class="constant">:EXTRA-FILE-TYPES</code></span></dt><dd><p class="simpara">Specifies the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of additional file types
2756 considered for loading, in addition to <strong class="first"><em class="firstterm"><a class="link" href="#source-types"><code class="varname">CUSTOM:*SOURCE-FILE-TYPES*</code></a>
2757 <a id="source-types" class="indexterm"></a></em></strong>
2758 (which is initially <span class="data"><code class="literal">("lisp" "lsp" "cl")</code></span>)
2759 and <strong class="first"><em class="firstterm"><a class="link" href="#compiled-types"><code class="varname">CUSTOM:*COMPILED-FILE-TYPES*</code></a>
2760 <a id="compiled-types" class="indexterm"></a></em></strong>
2761 (which is initially <span class="data"><code class="literal">("fas")</code></span>).
2762 </p><p class="simpara">When <em class="replaceable"><code>filename</code></em> does not specify a unique file
2763 (e.g., <em class="replaceable"><code>filename</code></em> is <code class="filename">#P"foo"</code> and both <code class="filename">#P"foo.lisp"</code>
2764 and <code class="filename">#P"foo.fas"</code> are found in the
2765 <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>), then the <span class="emphasis"><em>newest</em></span> file is loaded.
2766 </p></dd><dt><span class="term"><code class="constant">:OBSOLETE-ACTION</code></span></dt><dd><p>Specifies the action to take when loading a
2767 <code class="filename">#P".fas"</code> with a different <a href="impnotes.html#bytecode" class="olink">bytecode</a> version from the one
2768 supported by this <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version. The possible actions are
2769 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:DELETE</code></span></dt><dd>delete the <code class="filename">#P".fas"</code> and proceed as with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
2770 </dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
2771 </dd><dt><span class="term"><code class="constant">:COMPILE</code></span></dt><dd>recompile the source file (if found in <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>)
2772 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> the result</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (default)</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a> and <a class="link" href="#load-paths" title="Variable CUSTOM:*LOAD-PATHS*">look
2773 for another matching file</a>
2774 </dd></dl></div><p>
2775 If no file can be loaded and <code class="constant">:IF-DOES-NOT-EXIST</code> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
2776 The default is <strong class="first"><em class="firstterm"><a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>
2777 <a id="load-obs" class="indexterm"></a></em></strong>,
2778 which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></dd><dt><span class="term"><code class="constant">:IGNORE-PATHNAME-DEFAULTS</code></span></dt><dd>Do not merge <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdefault_e-defaultsst.html" target="_top"><code class="varname">*DEFAULT-PATHNAME-DEFAULTS*</code></a> to the
2779 argument using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (as required by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]) and rely
2780 on <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> instead.</dd></dl></div><p>The variables <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>,
2781 <a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>, <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>, and <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a> are bound by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> when it
2782 receives a corresponding keyword argument (<code class="constant">:VERBOSE</code>, <code class="constant">:PRINT</code>,
2783 <code class="constant">:OBSOLETE-ACTION</code>, <code class="constant">:COMPILING</code>, and <code class="constant">:ECHO</code>), i.e., these arguments
2784 are recursive, just like the arguments <code class="constant">:WARNINGS</code>, <code class="constant">:VERBOSE</code>, and
2785 <code class="constant">:PRINT</code> for <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>.</p><p>When evaluation of a read form <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, three <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s are
2786 available:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">SKIP</code></span></dt><dd>Skip this form and read the next one.
2787 </dd><dt><span class="term"><code class="literal">RETRY</code></span></dt><dd>Try to evaluate this form again.
2788 </dd><dt><span class="term"><code class="literal">STOP</code></span></dt><dd>Stop loading the file.
2789 </dd></dl></div><p>On success, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a> of the file which it loaded,
2790 or the <em class="replaceable"><code>filename</code></em> argument if it is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> but not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.
2791 </p><p><a id="load-paths"></a><strong>Variable <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>. </strong>The variable <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> contains a list of directories where the
2792 files are looked for - in addition to the specified or current
2793 directory - by <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>, <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a>, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> and
2794 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="features"></a>24.5. Variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a></h2></div></div></div><p>The variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a> initially contains the following symbols
2795 </p><div class="variablelist"><a id="features-table"></a><p class="title"><strong>Default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:CLISP</code></span></dt><dd>the name of this implementation
2796 </dd><dt><span class="term"><code class="constant">:ANSI-CL</code></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#purports_to_conform">purports to
2797 conform</a> to [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</dd><dt><span class="term"><code class="constant">:COMMON-LISP</code></span></dt><dd>required by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</dd><dt><span class="term"><code class="constant">:INTERPRETER</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> is implemented</dd><dt><span class="term"><code class="constant">:COMPILER</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> are implemented
2798 </dd><dt><span class="term"><code class="constant">:SOCKETS</code></span></dt><dd>see <a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a>
2799 </dd><dt><span class="term"><code class="constant">:MT</code></span></dt><dd>see <a class="xref" href="#mt" title="32.5. Multiple Threads of Execution">Section 32.5, “Multiple Threads of Execution”</a>
2800 </dd><dt><span class="term"><code class="constant">:GENERIC-STREAMS</code></span></dt><dd>see <a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a>
2801 </dd><dt><span class="term"><code class="constant">:LOGICAL-PATHNAMES</code></span></dt><dd><a class="link" href="#log-path" title="19.4. Logical Pathnames sec_19-3">Logical Pathnames</a>
2802 are implemented</dd><dt><span class="term"><code class="constant">:FFI</code></span></dt><dd>if a foreign function interface
2803 (see <a class="xref" href="#dffi" title="32.3. The Foreign Function Call Facility">Section 32.3, “The Foreign Function Call Facility”</a>) is supported
2804 (<span class="plat-dep">Platform Dependent: <span class="plat-dep">Many <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
2805 platforms only</span></span>)</dd><dt><span class="term"><code class="constant">:GETTEXT</code></span></dt><dd>if internationalization (see <a class="xref" href="#i18n" title="31.4. Internationalization of CLISP">Section 31.4, “Internationalization of <span class="command"><strong>CLISP</strong></span>”</a>)
2806 using the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a> package is supported
2807 (<span class="plat-dep">Platform Dependent: <span class="plat-dep">most <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platforms
2808 only</span></span>)</dd><dt><span class="term"><code class="constant">:UNICODE</code></span></dt><dd>if <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> (ISO 10646) characters are supported
2809 (see <a class="xref" href="#encoding" title="31.5. Encodings">Section 31.5, “Encodings”</a>)</dd><dt><span class="term"><code class="constant">:LOOP</code></span></dt><dd><span class="quote">“<span class="quote">extended</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> form is implemented
2810 </dd><dt><span class="term"><code class="constant">:CLOS</code></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is implemented</dd><dt><span class="term"><code class="constant">:MOP</code></span></dt><dd><a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is implemented</dd><dt><span class="term"><code class="constant">:WORD-SIZE=64</code></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built for a 64-bit CPU. This could
2811 be useful on platforms with 64-bit CPUs which have a 32-bit mode
2812 emulation (e.g., <span class="platform">i386</span> is
2813 emulated on <span class="platform">x86_64</span>
2814 and <span class="platform">ia64</span>) so that the user can
2815 decide which ABI library to load dynamically using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
2816 </dd><dt><span class="term"><code class="constant">:WIN32</code></span></dt><dd>if <em class="replaceable"><code>hardware</code></em> = PC (clone) and <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
2817 (Windows 95/98/Me/NT/2000/XP)</dd><dt><span class="term"><code class="constant">:PC386</code></span></dt><dd>if <em class="replaceable"><code>hardware</code></em> = PC (clone). It can be used as an
2818 indicator for the mainstream hardware characteristics (such as the
2819 existence of a graphics card with a non-graphics text mode,
2820 or the presence of a keyboard with arrows and
2821 <span class="keysym">Insert</span>/<span class="keysym">Delete</span> keys,
2822 or an ISA/VLB/PCI bus) or software characteristics (such as the
2823 <span class="keycap"><strong>Control</strong></span>+<span class="keycap"><strong>Alternate</strong></span>+<span class="keysym">Delete</span> keyboard
2824 combination).</dd><dt><span class="term"><code class="constant">:UNIX</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> (in this case the <em class="replaceable"><code>hardware</code></em> is irrelevant!)
2825 </dd><dt><span class="term"><code class="constant">:BEOS</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="https://en.wikipedia.org/wiki/BeOS" target="_top"><span class="platform">BeOS</span></a> (in that case <code class="constant">:UNIX</code> is also present)
2826 </dd><dt><span class="term"><code class="constant">:HAIKU</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="https://www.haiku-os.org/" target="_top"><span class="platform">Haiku</span></a> (in that case <code class="constant">:UNIX</code> is also present)
2827 </dd><dt><span class="term"><code class="constant">:CYGWIN</code></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is using the <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> compatibility
2828 layer on top of <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> (in that case <code class="constant">:UNIX</code> is also present)
2829 </dd><dt><span class="term"><code class="constant">:MACOS</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a> (in that case <code class="constant">:UNIX</code> is also present)
2830 </dd></dl></div><p>Each <a href="impnotes.html#modules" class="olink">module</a> should add the appropriate keyword, e.g.,
2831 <a class="link" href="#syscalls" title="33.2. System Calls"><code class="constant">:SYSCALLS</code></a>,
2832 <a class="link" href="#dir-key" title="33.8. Directory Access"><code class="constant">:DIRKEY</code></a>,
2833 <a class="link" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="constant">:REGEXP</code></a>,
2834 <a class="link" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="constant">:PCRE</code></a>, etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="featurep"></a>24.6. Function <code class="function">EXT:FEATUREP</code>
2835 <a class="ulink" href="http://clrfi.alu.org/clrfi/clrfi-1-featurep" target="_top">[CLRFI-1]</a></h2></div></div></div><p><code class="code">(EXT:FEATUREP <em class="replaceable"><code>form</code></em>)</code> provides run-time access to
2836 the read-time conditionals <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-17.html"><span class="data"><code class="literal">#+</code></span></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-18.html"><span class="data"><code class="literal">#-</code></span></a>.
2837 <em class="replaceable"><code>form</code></em> is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_24-1-2-1.html">feature exression</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compiled-file-p"></a>24.7. Function <a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a>
2838 <a class="ulink" href="http://clrfi.alu.org/clrfi/clrfi-2-compiled-file-p" target="_top">[CLRFI-2]</a></h2></div></div></div><p><code class="code">(<a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a> <em class="replaceable"><code>filename</code></em>)</code> returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
2839 when the file <em class="replaceable"><code>filename</code></em> exists, is readable, and appears to be a
2840 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-compiled <code class="filename">#P".fas"</code> file compatible with the currently used
2841 <a href="impnotes.html#bytecode" class="olink">bytecode</a> format.</p><p>System definition facilities (such as <a class="ulink" href="https://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> or <a class="ulink" href="https://www.cliki.net/mk-defsystem" target="_top"><code class="function">defsystem</code></a>) can
2842 use it to determine whether the file needs to be recompiled.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="environment"></a>Chapter 25. Environment
2843 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-25.html">[chap-25]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></dd><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> &amp; <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
2844 </a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></dd><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="repl"></a>25.1. Top Level Loop
2845 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">[sec_25-1-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></div><p>The debugger may be invoked through the functions
2846 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-debugger.html" target="_top"><code class="function">INVOKE-DEBUGGER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a>.
2847 The stepper is invoked through the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>.
2848 Debugger and stepper execute subordinate <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
2849 (called <strong class="first"><em class="firstterm">break loops</em></strong>)
2850 which are similar to the main <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> except for the
2851 <a class="link" href="#prompt" title="31.9. The Prompt">prompt</a> and the set of available commands.
2852 Commands must be typed literally, in any case,
2853 without surrounding quotes or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-4-7.html">whitespace</a>.
2854 Each command has a keyword abbreviation,
2855 indicated in the second column.</p><div class="table"><a id="debugger-main-deb-step"></a><p class="title"><strong>Table 25.1. Commands common to the main loop, the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the main loop, the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a></td><td align="center"><span class="command"><strong>:h</strong></span></td><td align="center">print a list of available commands</td></tr><tr><td align="center"><span class="command"><strong>LocalSymbols</strong></span></td><td align="center"><span class="command"><strong>:ls</strong></span></td><td align="center">print the list of
2856 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a>ed in a given <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-deb-step"></a><p class="title"><strong>Table 25.2. Commands common to the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Abort</strong></span></td><td align="center"><span class="command"><strong>:a</strong></span></td><td align="center">abort to the next most recent <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr><tr><td align="center"><span class="command"><strong>Unwind</strong></span></td><td align="center"><span class="command"><strong>:uw</strong></span></td><td align="center">abort to the next most recent <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr><tr><td align="center"><span class="command"><strong>Quit</strong></span></td><td align="center"><span class="command"><strong>:q</strong></span></td><td align="center">quit to the top <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr></tbody></table></div></div><br class="table-break" /><p>The stack is organized into frames and other stack elements.
2857 Usually every invocation of an interpreted function and every
2858 evaluation of an interpreted form corresponds to one stack frame.
2859 Special forms such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a>
2860 produce special kinds of stack frames.</p><p><a id="cur-frame"></a>In a break loop there is a
2861 <strong class="first"><em class="firstterm"><a class="link" href="#cur-frame">current stack frame</a></em></strong>, which is initially the most recent
2862 stack frame but can be moved using the debugger
2863 commands <span class="command"><strong>Up</strong></span> and <span class="command"><strong>Down</strong></span>.</p><p>Evaluation of forms in a break loop occurs in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> of the
2864 <a class="link" href="#cur-frame">current stack frame</a> and <span class="emphasis"><em>at the same time</em></span> in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-2.html">dynamic environment</a>
2865 of the debugger's caller. This means that to inspect or modify a
2866 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-1.html">lexical variable</a> all you have to do is to move the <a class="link" href="#cur-frame">current stack frame</a> to be just
2867 below the frame that corresponds to the form or the function call that
2868 binds that variable.</p><p><a id="stack-mode"></a><strong>Stack Printing Mode. </strong>There is a current <strong class="first"><em class="firstterm">stack mode</em></strong> which defines
2869 in how much detail the stack is shown by the stack-related debugger
2870 commands (<a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> et al):</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">All the stack elements are considered.
2871 This mode works fine for debugging compiled functions.</li><li class="listitem">All the frames are considered.</li><li class="listitem">Only lexical frames (frames that correspond to special
2872 forms that modify the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>) are considered.</li><li class="listitem">Only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frames are considered.
2873 Every evaluation of a form in the interpreter corresponds to an
2874 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> frame. This is the default.</li><li class="listitem">Only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frames are considered.
2875 Every invocation of an interpreted function corresponds to one
2876 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frame.</li></ol></div><div class="table"><a id="debugger-deb-step-1"></a><p class="title"><strong>Table 25.3. Commands common to the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Error</strong></span></td><td align="center"><span class="command"><strong>:e</strong></span></td><td align="center">print the last error object.</td></tr><tr><td align="center"><span class="command"><strong>Inspect</strong></span></td><td align="center"><span class="command"><strong>:i</strong></span></td><td align="center"><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a> the last error object.</td></tr><tr><td align="center"><span class="command"><strong>Where</strong></span></td><td align="center"><span class="command"><strong>:w</strong></span></td><td align="center">show the <a class="link" href="#cur-frame">current stack frame</a>.</td></tr><tr><td align="center"><span class="command"><strong>Up</strong></span></td><td align="center"><span class="command"><strong>:u</strong></span></td><td align="center">go up one frame, i.e., to the caller if in mode-5</td></tr><tr><td align="center"><span class="command"><strong>Down</strong></span></td><td align="center"><span class="command"><strong>:d</strong></span></td><td align="center">do down one frame, i.e., to the callee if in mode-5</td></tr><tr><td align="center"><span class="command"><strong>Top</strong></span></td><td align="center"><span class="command"><strong>:t</strong></span></td><td align="center">go to top frame, i.e., to the top-level form if in mode-4
2877 </td></tr><tr><td align="center"><span class="command"><strong>Bottom</strong></span></td><td align="center"><span class="command"><strong>:b</strong></span></td><td align="center">go to bottom (most recent) frame, i.e., most probably to the
2878 form or function that caused the debugger to be entered.</td></tr><tr><td align="center"><span class="command"><strong>Mode</strong></span> <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></td><td align="center"><span class="command"><strong>:m</strong></span> <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></td><td align="center">set the current stack printing mode</td></tr><tr><td align="center"><a id="frame-limit"></a><span class="command"><strong>Frame-limit</strong></span> <em class="replaceable"><code>l</code></em></td><td align="center"><span class="command"><strong>:fl</strong></span></td><td align="center">set the <a class="link" href="#frame-limit"><em class="replaceable"><code>frame-limit</code></em></a>: this many frames will be printed
2879 by <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> at most.</td></tr><tr><td align="center"><a id="backtrace"></a><a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> [<a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a> [<em class="replaceable"><code>l</code></em>]]</td><td align="center"><span class="command"><strong>:bt</strong></span> [<a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a> [<em class="replaceable"><code>l</code></em>]]</td><td align="center">list the stack in the given <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a>, bottom frame first,
2880 top frame last; at most <em class="replaceable"><code>l</code></em> frames are printed;
2881 calls <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><p>If the <a class="link" href="#cur-frame">current stack frame</a> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frame, the
2882 following commands are available as well:</p><div class="table"><a id="debugger-eval-apply"></a><p class="title"><strong>Table 25.4. Commands specific to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a></strong></p><div class="table-contents"><table class="table" summary="Commands specific to EVAL/APPLY" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Break+</strong></span></td><td align="center"><span class="command"><strong>:br+</strong></span></td><td align="center">set a breakpoint in the current frame. When the corresponding
2883 form or function will be left, the debugger will be entered again, with
2884 the variable <a class="link" href="#trace-val"><code class="varname">EXT:*TRACE-VALUES*</code></a> containing a list of its values.</td></tr><tr><td align="center"><span class="command"><strong>Break-</strong></span></td><td align="center"><span class="command"><strong>:br-</strong></span></td><td align="center">remove a breakpoint from the current frame.</td></tr><tr><td align="center"><span class="command"><strong>Redo</strong></span></td><td align="center"><span class="command"><strong>:rd</strong></span></td><td align="center">re-evaluate the corresponding form or function call. This
2885 command can be used to restart parts of a computation without
2886 aborting it entirely.</td></tr><tr><td align="center"><span class="command"><strong>Return</strong></span> <em class="replaceable"><code>value</code></em></td><td align="center"><span class="command"><strong>:rt</strong></span> <em class="replaceable"><code>value</code></em></td><td align="center">leave the current frame, returning the given value.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-deb"></a><p class="title"><strong>Table 25.5. Commands specific to the debugger</strong></p><div class="table-contents"><table class="table" summary="Commands specific to the debugger" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Continue</strong></span></td><td align="center"><span class="command"><strong>:c</strong></span></td><td align="center">continue evaluation of the program.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-step"></a><p class="title"><strong>Table 25.6. Commands specific to the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands specific to the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Step</strong></span></td><td align="center"><span class="command"><strong>:s</strong></span></td><td align="center">step into a form: evaluate this form in single step mode
2887 </td></tr><tr><td align="center"><span class="command"><strong>Next</strong></span></td><td align="center"><span class="command"><strong>:n</strong></span></td><td align="center">step over a form: evaluate this form at once
2888 </td></tr><tr><td align="center"><span class="command"><strong>Over</strong></span></td><td align="center"><span class="command"><strong>:o</strong></span></td><td align="center">step over this level: evaluate at once up to the next return
2889 </td></tr><tr><td align="center"><span class="command"><strong>Continue</strong></span></td><td align="center"><span class="command"><strong>:c</strong></span></td><td align="center">switch off single step mode, continue evaluation
2890 </td></tr></tbody></table></div></div><br class="table-break" /><p>The stepper is usually used like this: If some form returns a
2891 strange value or results in an error, call <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>
2892 <em class="replaceable"><code>form</code></em>)</code> and navigate using the
2893 commands <span class="command"><strong>Step</strong></span> and <span class="command"><strong>Next</strong></span> until you
2894 reach the form you regard as responsible. If you are too fast (execute
2895 <span class="command"><strong>Next</strong></span> once and get the error), there is no way back;
2896 you have to restart the entire stepper session. If you are too slow
2897 (stepped into a function or a form which certainly is OK), a couple of
2898 <span class="command"><strong>Next</strong></span> commands or one <span class="command"><strong>Over</strong></span> command
2899 will help.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="user-commands"></a>25.1.1. User-defined Commands</h3></div></div></div><p>You can set <strong class="first"><em class="firstterm"><a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a></em></strong> to a list of
2900 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s, each returning a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
2901 of <strong class="first"><em class="firstterm">bindings</em></strong>, i.e., either a
2902 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></span></dt><dd>the help string printed by <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> in addition to the
2903 standard <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> help</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> <span class="data"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
2904 . <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>)</code></span></span></dt><dd>the actual binding: when the user types the string,
2905 the function is called on the remainder of the string, i.e., the part
2906 of the string after the command.</dd></dl></div><p> E.g.,
2907 </p><pre class="programlisting">
2908 (setq <a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a>
2909 (list (lambda () (list (format nil "~2%User-defined commands:")))
2910 (lambda ()
2911 (flet ((panic (argline)
2912 (format t "don't panic~@[ because of ~A~], ~D~%"
2913 (and (plusp (length argline)) argline)
2914 (random 42))))
2915 (list (format nil "~%panic :p hit the panic button!")
2916 (cons "panic" #'panic)
2917 (cons ":p" #'panic))))
2918 (lambda ()
2919 (let ((curses #("ouch" "yuk" "bletch")))
2920 (flet ((swear (argline)
2921 (format t "~A: ~A!~%" argline
2922 (aref curses (random (length curses))))))
2923 (list (format nil "~%swear :e curse")
2924 (cons "swear" #'swear)
2925 (cons ":e" #'swear)))))))
2926 </pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="debugger"></a>25.2. Debugging Utilities
2927 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-2.html">[sec_25-1-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> &amp; <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="disassemble"></a>25.2.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> can disassemble to machine code,
2928 provided that <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> is present. In that case the argument may be a
2929 <code class="classname">EXT:SYSTEM-FUNCTION</code>, a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>, a
2930 special operator handler, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> denoting one of these, an
2931 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (address), or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
2932 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="uncompile"></a>25.2.2. Function <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a></h3></div></div></div><p>The function <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a> does the converse of
2933 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>: <code class="code">(<a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a> <em class="replaceable"><code>function</code></em>)</code> reverts a compiled
2934 <em class="replaceable"><code>function</code></em> (name), that has been entered or loaded in the same session
2935 and then compiled, back to its interpreted form.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="show-stack"></a>25.2.3. Function <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a></h3></div></div></div><p>The function <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a> is called by the <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> command.</p><p>It prints to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> and accepts 3 optional
2936 arguments:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></li><li class="listitem"><a class="link" href="#frame-limit"><em class="replaceable"><code>frame-limit</code></em></a></li><li class="listitem"><em class="replaceable"><code>start-frame</code></em></li></ol></div><p>It can used to find out what all the threads are up to:
2937 </p><pre class="programlisting">
2938 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :with out = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> :for <em class="replaceable"><code>thread</code></em> :in (<a class="link" href="#list-threads"><code class="function">MT:LIST-THREADS</code></a>) :do
2939 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> out "===~A===~;" <em class="replaceable"><code>thread</code></em>)
2940 (<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> :function
2941 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> out)) (<a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a> 1 3)))))
2942 </pre><p>
2943 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="documentation"></a>25.2.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></h3></div></div></div><p>No on-line documentation is available for the system functions
2944 (yet), but see <a class="xref" href="#describe" title="25.2.5. Function DESCRIBE">Section 25.2.5, “Function <code class="function">DESCRIBE</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="describe"></a>25.2.5. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a></h3></div></div></div><p>When <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, and <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> returns a valid URL,
2945 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> on a standard <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> symbol will point your web browser to the
2946 appropriate [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] page.</p><p>Also, when <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, and <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> returns a
2947 valid URL, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> on symbols and packages documented in these
2948 implementation notes will point your web browser to the appropriate
2949 page.</p><p>To do this, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> will retrieve the appropriate tables from
2950 <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> and <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> on the first relevant invocation.
2951 These operations are logged to <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>.</p><p><a id="clhs-root"></a><strong>Function <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a>. </strong>Function <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> is defined in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. By default it
2952 looks at <code class="code">(<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> "CLHSROOT")</code> and <a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a>,
2953 but you may redefine it in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> or <a href="clisp.html#opt-norc" class="olink">RC file</a>.
2954 The return value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> terminated with a <code class="filename">"/"</code>,
2955 e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/" target="_top">http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/</a> or <code class="filename">/usr/doc/HyperSpec/</code>.
2956 If the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the feature is completely disabled.
2957 <a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a> is initialized in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> based on
2958 the <code class="option">--hyperspec</code> passed to the top-level <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>
2959 script when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built.</p><p><a id="impnotes-root"></a><strong>Function <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a>. </strong>Function <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> is defined in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. By default it
2960 looks at <code class="code">(<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> "IMPNOTES")</code> and <a class="link" href="#impnotes-root" title="Function CUSTOM:IMPNOTES-ROOT"><code class="varname">CUSTOM:*IMPNOTES-ROOT-DEFAULT*</code></a>,
2961 but you may redefine it in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> or <a href="clisp.html#opt-norc" class="olink">RC file</a>.
2962 The return value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> terminated with a <code class="filename">"/"</code>,
2963 e.g., <a class="ulink" href="http://clisp.org/impnotes/" target="_top">http://clisp.org/impnotes/</a>, or the path to
2964 the monolithic page, e.g., <a class="ulink" href="http://clisp.org/impnotes.html" target="_top">http://clisp.org/impnotes.html</a>
2965 or <code class="filename">/usr/doc/clisp/impnotes.html</code>.
2966 If the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the feature is completely disabled.
2967 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="trace"></a>25.2.6. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a></h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt></dl></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> <em class="replaceable"><code>function-name</code></em> ...)</code> makes the
2968 functions <em class="replaceable"><code>function-name</code></em>, ... traced. Each <em class="replaceable"><code>function-name</code></em> should be either
2969 a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <code class="code">(<em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
2970 <code class="constant">:SUPPRESS-IF</code> <code class="constant">:MAX-DEPTH</code>
2971 <code class="constant">:STEP-IF</code> <code class="constant">:BINDINGS</code>
2972 <code class="constant">:PRE</code> <code class="constant">:POST</code>
2973 <code class="constant">:PRE-BREAK-IF</code> <code class="constant">:POST-BREAK-IF</code>
2974 <code class="constant">:PRE-PRINT</code> <code class="constant">:POST-PRINT</code>
2975 <code class="constant">:PRINT</code>)</code>, where</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:SUPPRESS-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>no trace output as long as <em class="replaceable"><code>form</code></em> is true
2976 </dd><dt><span class="term"><code class="constant">:MAX-DEPTH</code> <em class="replaceable"><code>form</code></em></span></dt><dd>no trace output as long as <code class="code">(&gt;
2977 *trace-level* <em class="replaceable"><code>form</code></em>)</code>. This is useful for tracing functions that
2978 are use by the tracer itself, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>, or otherwise when
2979 tracing would lead to an infinite recursion.
2980 </dd><dt><span class="term"><code class="constant">:STEP-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>invokes the stepper as soon as <em class="replaceable"><code>form</code></em> is true
2981 </dd><dt><span class="term"><code class="constant">:BINDINGS</code>
2982 ((<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>form</code></em>)...)</span></dt><dd>binds <em class="replaceable"><code>variable</code></em>s to the result of evaluation of
2983 <em class="replaceable"><code>form</code></em>s around evaluation of all of the following forms
2984 </dd><dt><span class="term"><code class="constant">:PRE</code> <em class="replaceable"><code>form</code></em></span></dt><dd>evaluates <em class="replaceable"><code>form</code></em> before calling the function
2985 </dd><dt><span class="term"><code class="constant">:POST</code> <em class="replaceable"><code>form</code></em></span></dt><dd>evaluates <em class="replaceable"><code>form</code></em> after return from the function
2986 </dd><dt><span class="term"><code class="constant">:PRE-BREAK-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>goes into the break loop before calling the
2987 function if <em class="replaceable"><code>form</code></em> is true</dd><dt><span class="term"><code class="constant">:POST-BREAK-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>goes into the break loop after return from the
2988 function if <em class="replaceable"><code>form</code></em> is true</dd><dt><span class="term"><code class="constant">:PRE-PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> before calling the
2989 function</dd><dt><span class="term"><code class="constant">:POST-PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> after return from the
2990 function</dd><dt><span class="term"><code class="constant">:PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> both before calling
2991 and after return from the function</dd></dl></div><p>In all these forms you can access the following variables:
2992 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="varname">EXT:*TRACE-FUNCTION*</code></span></dt><dd>the traced function itself
2993 </dd><dt><span class="term"><code class="varname">EXT:*TRACE-ARGS*</code></span></dt><dd>the arguments to the function
2994 </dd><dt><span class="term"><code class="varname">EXT:*TRACE-FORM*</code></span></dt><dd>the function/macro call as form
2995 </dd><dt><a id="trace-val"></a><span class="term"><a class="link" href="#trace-val"><code class="varname">EXT:*TRACE-VALUES*</code></a></span></dt><dd>after return from the function: the list of return
2996 values from the function call</dd></dl></div><p>
2997 and you can leave the function call with specified values by using
2998 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">UNTRACE</code></a> are also applicable to functions
2999 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>)</code> and to macros, but not to
3000 locally defined functions and macros.</p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-out"></a>Trace output</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> prints this line before evaluating the form:
3001 <code class="computeroutput"><em class="replaceable"><code>trace level</code></em>. Trace: <em class="replaceable"><code>form</code></em></code>
3002 and after evaluating the form it prints:
3003 <code class="computeroutput"><em class="replaceable"><code>trace level</code></em>. Trace: <em class="replaceable"><code>function-name</code></em> ==&gt; <em class="replaceable"><code>result</code></em></code>
3004 where <span class="quote">“<span class="quote">trace level</span>”</span> is the total nesting level.
3005 </p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-indent"></a>Variable <a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a></h4></div></div></div><p>If you want the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> level to be indicated by the indentation
3006 in addition to the printed numbers, set <a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a> to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
3007 Initially it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> since many nested traced calls will easily
3008 exhaust the available line length.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-eg"></a>Examples</h4></div></div></div><div class="example"><a id="trace-call-id"></a><p class="title"><strong>Example 25.1. Identifying Individual Calls in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a></strong></p><div class="example-contents"><p>Suppose the trace level above is not enough for you to identify
3009 individual calls. You can give each call a unique id and print it:
3010 </p><pre class="programlisting">
3011 (defun f0 (x)
3012 (cond ((zerop x) 1)
3013 ((zerop (random 2)) (* x (f0 (1- x))))
3014 (t (* x (f1 (1- x))))))
3015 ⇒ <code class="computeroutput">F0</code>
3016 (defun f1 (x)
3017 (cond ((zerop x) 1)
3018 ((zerop (random 2)) (* x (f0 (1- x))))
3019 (t (* x (f1 (1- x))))))
3020 ⇒ <code class="computeroutput">F1</code>
3021 (defvar *f0-call-count* 0)
3022 ⇒ <code class="computeroutput">*F0-CALL-COUNT*</code>
3023 (defvar *id0*)
3024 ⇒ <code class="computeroutput">*ID0*</code>
3025 (defvar *cc0*)
3026 ⇒ <code class="computeroutput">*CC0*</code>
3027 (defvar *f1-call-count* 0)
3028 ⇒ <code class="computeroutput">*F1-CALL-COUNT*</code>
3029 (defvar *id1*)
3030 ⇒ <code class="computeroutput">*ID1*</code>
3031 (defvar *cc1*)
3032 ⇒ <code class="computeroutput">*CC1*</code>
3033 (trace (f0 :bindings ((*cc0* (incf *f0-call-count*))
3034 (*id0* (gensym "F0-")))
3035 :pre-print (list 'enter *id0* *cc0*)
3036 :post-print (list 'exit *id0* *cc0*))
3037 (f1 :bindings ((*cc1* (incf *f1-call-count*))
3038 (*id1* (gensym "F1-")))
3039 :pre-print (list 'enter *id1* *cc1*)
3040 :post-print (list 'exit *id1* *cc1*)))
3041 ;; Tracing function F0.
3042 ;; Tracing function F1.
3043 ⇒ <code class="computeroutput">(F0 F1)</code>
3044 (f0 10)
3045 1. Trace: (F0 '10)
3046 (ENTER #:F0-2926 1)
3047 2. Trace: (F1 '9)
3048 (ENTER #:F1-2927 1)
3049 3. Trace: (F0 '8)
3050 (ENTER #:F0-2928 2)
3051 4. Trace: (F1 '7)
3052 (ENTER #:F1-2929 2)
3053 5. Trace: (F1 '6)
3054 (ENTER #:F1-2930 3)
3055 6. Trace: (F1 '5)
3056 (ENTER #:F1-2931 4)
3057 7. Trace: (F1 '4)
3058 (ENTER #:F1-2932 5)
3059 8. Trace: (F0 '3)
3060 (ENTER #:F0-2933 3)
3061 9. Trace: (F1 '2)
3062 (ENTER #:F1-2934 6)
3063 10. Trace: (F0 '1)
3064 (ENTER #:F0-2935 4)
3065 11. Trace: (F1 '0)
3066 (ENTER #:F1-2936 7)
3067 (EXIT #:F1-2936 7)
3068 11. Trace: F1 ==&gt; 1
3069 (EXIT #:F0-2935 4)
3070 10. Trace: F0 ==&gt; 1
3071 (EXIT #:F1-2934 6)
3072 9. Trace: F1 ==&gt; 2
3073 (EXIT #:F0-2933 3)
3074 8. Trace: F0 ==&gt; 6
3075 (EXIT #:F1-2932 5)
3076 7. Trace: F1 ==&gt; 24
3077 (EXIT #:F1-2931 4)
3078 6. Trace: F1 ==&gt; 120
3079 (EXIT #:F1-2930 3)
3080 5. Trace: F1 ==&gt; 720
3081 (EXIT #:F1-2929 2)
3082 4. Trace: F1 ==&gt; 5040
3083 (EXIT #:F0-2928 2)
3084 3. Trace: F0 ==&gt; 40320
3085 (EXIT #:F1-2927 1)
3086 2. Trace: F1 ==&gt; 362880
3087 (EXIT #:F0-2926 1)
3088 1. Trace: F0 ==&gt; 3628800
3089 ⇒ <code class="computeroutput">3628800</code>
3090 *f0-call-count*
3091 ⇒ <code class="computeroutput">4</code>
3092 *f1-call-count*
3093 ⇒ <code class="computeroutput">7</code></pre></div></div><br class="example-break" /></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="inspect"></a>25.2.7. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a></h3></div></div></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> accepts a keyword argument
3094 <code class="constant">:FRONTEND</code>, which specifies the way <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will
3095 interact with the user, and defaults
3096 to <code class="varname">CUSTOM:*INSPECT-FRONTEND*</code>.
3097 </p><div class="variablelist"><p class="title"><strong>Available <code class="constant">:FRONTEND</code>s for
3098 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:TTY</code></span></dt><dd>The interaction is conducted via the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>
3099 stream. Please use the <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> command to get the list of all
3100 available commands.</dd><dt><span class="term"><code class="constant">:HTTP</code></span></dt><dd><p class="simpara">A window in your Web browser (specified by the
3101 <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a> keyword argument) is opened and it is controlled by
3102 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> via a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, using the <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol.
3103 You should be able to use all the standard browser features.</p><p class="simpara">Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is not multitasking at this time, you will not
3104 be able to do anything else during an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> session. Please click on
3105 the <strong class="userinput"><code>quit</code></strong> link to terminate the session.</p><p class="simpara">Please be aware though, that once you terminate an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a>
3106 session, all links in all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> windows in your browser will become
3107 obsolete and using them in a new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> session will result in
3108 unpredictable behavior.</p></dd></dl></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> also accepts a keyword argument <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a>,
3109 which specifies the browser used by the <code class="constant">:HTTP</code>
3110 front-end and defaults to <code class="varname">CUSTOM:*INSPECT-BROWSER*</code>.</p><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> binds some
3111 <a class="link" href="#clpp" title="22.7. The Lisp Pretty Printer sec_22-2">pretty-printer</a> variables:
3112 </p><div class="informaltable"><a id="inspect-vars"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">Variable</th><th align="left">Bound to</th></tr></thead><tbody><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LENGTH*</code></td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LEVEL*</code></td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-linesst.html" target="_top"><code class="varname">*PRINT-LINES*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LINES*</code></td></tr></tbody></table></div><p>User variable
3113 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*INSPECT-LENGTH*</code>
3114 <a id="inspect-length" class="indexterm"></a></em></strong>
3115 specifies the number of sequence elements or slots printed in detail
3116 when a sequence or a structure or a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> object is inspected.
3117 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="time"></a>25.2.8. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a></h3></div></div></div><p>The timing data printed by the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a> includes:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">the real time (<span class="quote">“<span class="quote">wall</span>”</span> time,
3118 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-real-time.html" target="_top"><code class="function">GET-INTERNAL-REAL-TIME</code></a>),</li><li class="listitem">the run time (processor time for this process,
3119 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-run-time.html" target="_top"><code class="function">GET-INTERNAL-RUN-TIME</code></a>),</li><li class="listitem">the number of bytes allocated, and</li><li class="listitem">the number of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions performed, if any.
3120 </li></ul></div><p>The macro <strong class="first"><em class="firstterm"><a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a>
3121 <a id="times" class="indexterm"></a></em></strong> (mnemonic:
3122 <span class="quote">“<span class="quote"><span class="emphasis"><em>TIME</em></span> and <span class="emphasis"><em>S</em></span>pace</span>”</span>)
3123 is like the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a>: <code class="code">(<a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a> <em class="replaceable"><code>form</code></em>)</code> evaluates the
3124 <em class="replaceable"><code>form</code></em>, and, as a side effect, outputs detailed information about the
3125 memory allocations caused by this evaluation. It also prints
3126 everything printed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ed"></a>25.2.9. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a></h3></div></div></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a> calls the external editor specified by the value of
3127 <code class="code">(<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> "EDITOR")</code> or, failing that, the value of the variable
3128 <strong class="first"><em class="firstterm"><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a><a id="editor" class="indexterm"></a></em></strong>
3129 (set in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>).
3130 If the argument is a function name which was defined in the current
3131 session (not loaded from a file), the program text to be edited is a
3132 pretty-printed version (without comments) of the text which was used to
3133 define the function.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="apropos"></a>25.2.10. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> &amp; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a></h3></div></div></div><p>The search performed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a> is
3134 case-insensitive.</p><p><strong>Variable <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a>. </strong>You can make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> print more information about the symbols it
3135 found by setting <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a> to a list containing some of
3136 <code class="constant">:FUNCTION</code>, <code class="constant">:VARIABLE</code>, <code class="constant">:TYPE</code>, and <code class="constant">:CLASS</code>
3137 or just set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to get all of the values.</p><p><strong>Variable <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>. </strong>You can make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a> be more flexible in
3138 their search by setting <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of one
3139 argument, a pattern (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>), returning a new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of one
3140 argument, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> name (also a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>),
3141 which returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when the symbol name matches the pattern
3142 for the purposes of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a>.
3143 When <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_search.html" target="_top"><code class="function">SEARCH</code></a> is used.
3144 Some <a href="impnotes.html#modules" class="olink">module</a>s come with functions which can be used for
3145 <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>, e.g., <a class="link" href="#re-matcher"><code class="function">REGEXP:REGEXP-MATCHER</code></a>,
3146 <a class="link" href="#fnmatch-matcher" title="(POSIX:FNMATCH-MATCHER pattern)"><code class="function">POSIX:FNMATCH-MATCHER</code></a>,
3147 <a class="link" href="#pcre-matcher"><code class="function">PCRE:PCRE-MATCHER</code></a>.
3148 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dribble"></a>25.2.11. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></div><p>If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> is called with an argument, and dribbling is already
3149 enabled, a warning is printed, and the new dribbling request is
3150 ignored.</p><p>Dribbling is implemented via a kind (but <span class="strong"><strong>not</strong></span> a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#recognizable_subtype">recognizable subtype</a>)
3151 of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>, named <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>.
3152 If you have a <em class="replaceable"><code>source</code></em> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>x</code></em> and you want all transactions
3153 (input and output) on <em class="replaceable"><code>x</code></em> to be copied to the <em class="replaceable"><code>target</code></em> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>y</code></em>,
3154 you can do <a id="dribble-example"></a></p><pre class="programlisting">
3155 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> *loggable* <em class="replaceable"><code>x</code></em>)
3156 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <em class="replaceable"><code>x</code></em> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-synonym-stream.html" target="_top"><code class="function">MAKE-SYNONYM-STREAM</code></a> '*loggable*))
3157 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> toggle-logging (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> s)
3158 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (source target) (dribble-toggle *loggable* s)
3159 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_streamp.html" target="_top"><code class="function">STREAMP</code></a> source) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> *loggable* source))
3160 target))
3161 (toggle-logging <em class="replaceable"><code>y</code></em>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">start logging</span></em>
3162 ...
3163 (toggle-logging)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">finish logging</span></em>
3164 ...
3165 (toggle-logging <em class="replaceable"><code>y</code></em>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">restart logging</span></em>
3166 ...
3167 (toggle-logging)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">finish logging</span></em>
3168 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>y</code></em>)
3169 </pre><div class="variablelist"><dl class="variablelist"><dt><a id="drist"></a><span class="term"><code class="code">
3170 (<code class="function">EXT:DRIBBLE-STREAM</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns two values:
3171 the <em class="replaceable"><code>source</code></em> and the <em class="replaceable"><code>target</code></em> streams. Otherwise returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
3172 </dd><dt><a id="drist-p"></a><span class="term"><code class="code">
3173 (<code class="function">EXT:DRIBBLE-STREAM-P</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, otherwise
3174 returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><a id="drist-so"></a><span class="term"><code class="code">
3175 (<code class="function">EXT:DRIBBLE-STREAM-SOURCE</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns its
3176 <em class="replaceable"><code>source</code></em> stream, otherwise signals a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>.
3177 </dd><dt><a id="drist-ta"></a><span class="term"><code class="code">
3178 (<code class="function">EXT:DRIBBLE-STREAM-TARGET</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns its
3179 <em class="replaceable"><code>target</code></em> stream, otherwise signals a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>.
3180 </dd><dt><a id="mk-drist"></a><span class="term"><code class="code">
3181 (<code class="function">EXT:MAKE-DRIBBLE-STREAM</code>
3182 <em class="replaceable"><code>source</code></em> <em class="replaceable"><code>target</code></em>)</code></span></dt><dd>Create a new <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>.
3183 </dd><dt><a id="dri-toggle"></a><span class="term"><code class="code">
3184 (<code class="function">EXT:DRIBBLE-TOGGLE</code> <em class="replaceable"><code>stream</code></em>
3185 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> and <em class="replaceable"><code>pathname</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
3186 writes a dribble termination note to the <em class="replaceable"><code>stream</code></em>'s <em class="replaceable"><code>target</code></em>
3187 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and returns <em class="replaceable"><code>stream</code></em>'s <em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>target</code></em>
3188 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s;
3189 when <em class="replaceable"><code>stream</code></em> is not a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> and <em class="replaceable"><code>pathname</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
3190 creates a new <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, dribbling from <em class="replaceable"><code>stream</code></em> to <em class="replaceable"><code>pathname</code></em>,
3191 writes a dribble initialization note to <em class="replaceable"><code>pathname</code></em>,
3192 and return the <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> (the second value is the <em class="replaceable"><code>target</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>);
3193 otherwise <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a> that no appropriate action may be taken.
3194 <em class="replaceable"><code>pathname</code></em> may be an open <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>.
3195 See <a class="link" href="#dribble-example">above</a> for the sample usage.
3196 See also <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/dribble.lisp"><code class="filename">src/dribble.lisp</code></a> in
3197 the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source tree.
3198 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dribble-script"></a>25.2.11.1. Scripting and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> works by operating on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>,
3199 thus is does <span class="strong"><strong>not</strong></span> work when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> acts as a script interpreter
3200 (see <a class="xref" href="#quickstart-unix" title="32.6.2. Scripting with CLISP">Section 32.6.2, “Scripting with <span class="command"><strong>CLISP</strong></span>”</a>).</p><p>Traditionally, <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>,
3201 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>
3202 pointing to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>, and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is no exception.
3203 Thus changing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> to a dribble stream affects all
3204 standard i/o.</p><p>On the other hand, when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> acts as a script interpreter, it
3205 adheres to the <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html">&lt;<code class="filename">stdio.h</code>&gt;</a> <a class="link" href="#script-exec" title="Script execution">conventions</a>,
3206 thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, and
3207 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> are normal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s,
3208 and thus are <span class="strong"><strong>not</strong></span> affected by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> - and
3209 thus <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> ... <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code> - <span class="strong"><strong>is</strong></span> still affected).
3210 The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] explicitly permits this behavior by stating
3211 </p><div class="blockquote"><blockquote class="blockquote"><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> is intended primarily for interactive
3212 debugging; its effect cannot be relied upon when used in a program.
3213 </p></blockquote></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="environment-enq"></a>25.3. Environment Inquiry
3214 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-3.html">[sec_25-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
3215 </a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="room"></a>25.3.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a></h3></div></div></div><p>The function <strong class="first"><em class="firstterm"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>
3216 <a id="room-func" class="indexterm"></a></em></strong>
3217 returns five values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">space occupied by Lisp objects (in
3218 bytes)</li><li class="listitem">space available for allocating Lisp objects until
3219 the next <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered (in bytes)</li><li class="listitem">space permanently allocated (in
3220 bytes)</li><li class="listitem">the number of times <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion was done in this
3221 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session</li><li class="listitem">the cumulative space freed by all the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions in
3222 this <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session (in bytes)</li><li class="listitem">the total time (in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_intern_s-per-second.html" target="_top"><code class="constant">INTERNAL-TIME-UNITS-PER-SECOND</code></a>)
3223 spent collecting garbage</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-sect"></a>25.3.2. Function <strong class="first"><em class="firstterm"><code class="function">EXT:GC</code>
3224 <a id="gc-func" class="indexterm"></a></em></strong></h3></div></div></div><p>This function starts a global <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion and returns the same values
3225 as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>.</p><p>When the optional parameter is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> also invalidates
3226 just-in-time compiled objects.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="machine"></a>25.3.3. Machine</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">SHORT-SITE-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">LONG-SITE-NAME</code></a>
3227 should be defined in a site-specific <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> file.
3228 The default implementations try to read the value of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
3229 <code class="envar">ORGANIZATION</code>, and, failing that,
3230 call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html"><code class="function">uname</code></a>.
3231 </dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">SHORT-SITE-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">LONG-SITE-NAME</code></a>
3232 should be defined in a site-specific <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> file.
3233 The default implementations try to read the registry.
3234 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="version"></a>25.3.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a> returns
3235 the numeric version (like <code class="literal">3.14</code>), and
3236 the release date (like <code class="literal">"1999-07-21"</code>).
3237 When running on the same machine on which <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built, it appends
3238 the binary build and <a href="impnotes.html#image" class="olink">memory image</a> dump date in <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a>
3239 (like <code class="literal">3141592654</code>).
3240 When running on a different machine, it appends the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_machine-instance.html" target="_top"><code class="function">MACHINE-INSTANCE</code></a>
3241 of the machine on which it was built.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="argv"></a>25.3.5. Function <a class="link" href="#argv" title="25.3.5. Function EXT:ARGV"><code class="function">EXT:ARGV</code></a></h3></div></div></div><p>This function will return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> of
3242 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> command line arguments passed to the runtime, including
3243 those already processed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
3244 Use <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> instead of this function to get the arguments for your program.
3245 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clock"></a>25.4. Time <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4.html">[sec_25-1-4]</a></h2></div></div></div><div class="variablelist"><a id="default-tz"></a><p class="title"><strong>Default Time Zone</strong></p><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">No platform supports this currently</span></span></span></dt><dd>The variable <strong class="first"><em class="firstterm"><a class="link" href="#default-tz" title="Default Time Zone"><code class="varname">CUSTOM:*DEFAULT-TIME-ZONE*</code></a></em></strong>
3246 contains the default time zone used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_encode-universal-time.html" target="_top"><code class="function">ENCODE-UNIVERSAL-TIME</code></a> and
3247 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-universal-time.html" target="_top"><code class="function">DECODE-UNIVERSAL-TIME</code></a>. It is initially set to -1
3248 (which means 1 hour east of Greenwich, i.e., Mid European Time).
3249 </dd></dl></div><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#time_zone">time zone</a> in a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-1.html">decoded time</a> does not necessarily have be an
3250 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, but (as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> number)
3251 it should be a multiple of <span class="data"><code class="literal">1/3600</code></span>.</p><div class="table"><a id="internal-time-units-table"></a><p class="title"><strong>Table 25.7. Time granularity</strong></p><div class="table-contents"><table class="table" summary="Time granularity" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">platform</th><th align="center"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></th><th align="center"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_intern_s-per-second.html" target="_top"><code class="constant">INTERNAL-TIME-UNITS-PER-SECOND</code></a></td><td align="center">1,000,000</td><td align="center">10,000,000</td></tr></tbody></table></div></div><br class="table-break" /><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-run-time.html" target="_top"><code class="function">GET-INTERNAL-RUN-TIME</code></a> returns the amount of run time
3252 consumed by the current <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> process since its startup.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="glossary"></a>Chapter 26. Glossary
3253 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-26.html">[chap-26]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="appendix"></a>Chapter 27. Appendix
3254 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-a.html">[chap-a]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="issues"></a>Chapter 28. X3J13 Issue Index
3255 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/Issues-Categorized.html" target="_top">[CLHS-ic]</a></h2></div></div></div><p>This is the list of [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issues and their current status in
3256 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, i.e., whether <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports code that makes use of the
3257 functionality specified by the vote.</p><div class="variablelist"><a id="issues-list"></a><p class="title"><strong>X3J13 Issues</strong></p><dl class="variablelist"><dt><a id="iss001"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss001.html" target="_top">&amp;ENVIRONMENT-BINDING-ORDER:FIRST</a></span></dt><dd>yes</dd><dt><a id="iss002"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss002.html" target="_top">ACCESS-ERROR-NAME</a></span></dt><dd>yes</dd><dt><a id="iss003"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss003.html" target="_top">ADJUST-ARRAY-DISPLACEMENT</a></span></dt><dd>yes</dd><dt><a id="iss004"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss004.html" target="_top">ADJUST-ARRAY-FILL-POINTER</a></span></dt><dd>yes</dd><dt><a id="iss005"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss005.html" target="_top">ADJUST-ARRAY-NOT-ADJUSTABLE:IMPLICIT-COPY</a></span></dt><dd>yes</dd><dt><a id="iss006"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss006.html" target="_top">ALLOCATE-INSTANCE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss007"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss007.html" target="_top">ALLOW-LOCAL-INLINE:INLINE-NOTINLINE</a></span></dt><dd>yes</dd><dt><a id="iss008"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss008.html" target="_top">ALLOW-OTHER-KEYS-NIL:PERMIT</a></span></dt><dd>yes</dd><dt><a id="iss009"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss009.html" target="_top">AREF-1D</a></span></dt><dd>yes</dd><dt><a id="iss010"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss010.html" target="_top">ARGUMENT-MISMATCH-ERROR-AGAIN:CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss011"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss011.html" target="_top">ARGUMENT-MISMATCH-ERROR-MOON:FIX</a></span></dt><dd>yes</dd><dt><a id="iss012"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss012.html" target="_top">ARGUMENT-MISMATCH-ERROR:MORE-CLARIFICATIONS</a></span></dt><dd>yes, except for argument list checking in
3258 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> in compiled code (items 11,12)
3259 </dd><dt><a id="iss013"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss013.html" target="_top">ARGUMENTS-UNDERSPECIFIED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss014"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss014.html" target="_top">ARRAY-DIMENSION-LIMIT-IMPLICATIONS:ALL-FIXNUM</a></span></dt><dd>yes</dd><dt><a id="iss015"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss015.html" target="_top">ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING</a></span></dt><dd>yes</dd><dt><a id="iss016"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss016.html" target="_top">ASSERT-ERROR-TYPE:ERROR</a></span></dt><dd>yes</dd><dt><a id="iss017"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss017.html" target="_top">ASSOC-RASSOC-IF-KEY</a></span></dt><dd>yes</dd><dt><a id="iss018"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss018.html" target="_top">ASSOC-RASSOC-IF-KEY:YES</a></span></dt><dd>yes</dd><dt><a id="iss019"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss019.html" target="_top">BOA-AUX-INITIALIZATION:ERROR-ON-READ</a></span></dt><dd>yes</dd><dt><a id="iss020"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss020.html" target="_top">BREAK-ON-WARNINGS-OBSOLETE:REMOVE</a></span></dt><dd>yes</dd><dt><a id="iss021"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss021.html" target="_top">BROADCAST-STREAM-RETURN-VALUES:CLARIFY-MINIMALLY</a></span></dt><dd>yes</dd><dt><a id="iss022"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss022.html" target="_top">BUTLAST-NEGATIVE:SHOULD-SIGNAL</a></span></dt><dd>yes</dd><dt><a id="iss023"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss023.html" target="_top">CHANGE-CLASS-INITARGS:PERMIT</a></span></dt><dd>yes</dd><dt><a id="iss024"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss024.html" target="_top">CHAR-NAME-CASE:X3J13-MAR-91</a></span></dt><dd>yes</dd><dt><a id="iss025"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss025.html" target="_top">CHARACTER-LOOSE-ENDS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss026"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss026.html" target="_top">CHARACTER-PROPOSAL:2</a></span></dt><dd>yes</dd><dt><a id="iss027"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss027.html" target="_top">CHARACTER-PROPOSAL:2-1-1</a></span></dt><dd>yes</dd><dt><a id="iss028"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss028.html" target="_top">CHARACTER-PROPOSAL:2-1-2</a></span></dt><dd>yes</dd><dt><a id="iss029"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss029.html" target="_top">CHARACTER-PROPOSAL:2-2-1</a></span></dt><dd>yes</dd><dt><a id="iss030"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss030.html" target="_top">CHARACTER-PROPOSAL:2-3-1</a></span></dt><dd>yes</dd><dt><a id="iss031"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss031.html" target="_top">CHARACTER-PROPOSAL:2-3-2</a></span></dt><dd>yes</dd><dt><a id="iss032"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss032.html" target="_top">CHARACTER-PROPOSAL:2-3-3</a></span></dt><dd>yes</dd><dt><a id="iss033"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss033.html" target="_top">CHARACTER-PROPOSAL:2-3-4</a></span></dt><dd>yes</dd><dt><a id="iss034"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss034.html" target="_top">CHARACTER-PROPOSAL:2-3-5</a></span></dt><dd>yes</dd><dt><a id="iss035"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss035.html" target="_top">CHARACTER-PROPOSAL:2-3-6</a></span></dt><dd>yes</dd><dt><a id="iss036"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss036.html" target="_top">CHARACTER-PROPOSAL:2-4-1</a></span></dt><dd>yes</dd><dt><a id="iss037"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss037.html" target="_top">CHARACTER-PROPOSAL:2-4-2</a></span></dt><dd>yes</dd><dt><a id="iss038"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss038.html" target="_top">CHARACTER-PROPOSAL:2-4-3</a></span></dt><dd>yes</dd><dt><a id="iss039"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss039.html" target="_top">CHARACTER-PROPOSAL:2-5-2</a></span></dt><dd>yes</dd><dt><a id="iss040"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss040.html" target="_top">CHARACTER-PROPOSAL:2-5-6</a></span></dt><dd>yes</dd><dt><a id="iss041"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss041.html" target="_top">CHARACTER-PROPOSAL:2-5-7</a></span></dt><dd>yes</dd><dt><a id="iss042"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss042.html" target="_top">CHARACTER-PROPOSAL:2-6-1</a></span></dt><dd>yes</dd><dt><a id="iss043"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss043.html" target="_top">CHARACTER-PROPOSAL:2-6-2</a></span></dt><dd>yes</dd><dt><a id="iss044"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss044.html" target="_top">CHARACTER-PROPOSAL:2-6-3</a></span></dt><dd>yes</dd><dt><a id="iss045"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss045.html" target="_top">CHARACTER-PROPOSAL:2-6-5</a></span></dt><dd>yes</dd><dt><a id="iss046"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss046.html" target="_top">CHARACTER-VS-CHAR:LESS-INCONSISTENT-SHORT</a></span></dt><dd>yes</dd><dt><a id="iss047"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss047.html" target="_top">CLASS-OBJECT-SPECIALIZER:AFFIRM</a></span></dt><dd>yes</dd><dt><a id="iss048"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss048.html" target="_top">CLOS-CONDITIONS-AGAIN:ALLOW-SUBSET</a></span></dt><dd>yes</dd><dt><a id="iss049"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss049.html" target="_top">CLOS-CONDITIONS:INTEGRATE</a></span></dt><dd>yes</dd><dt><a id="iss050"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss050.html" target="_top">CLOS-ERROR-CHECKING-ORDER:NO-APPLICABLE-METHOD-FIRST</a></span></dt><dd>yes</dd><dt><a id="iss051"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss051.html" target="_top">CLOS-MACRO-COMPILATION:MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss052"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss052.html" target="_top">CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss053"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss053.html" target="_top">CLOSED-STREAM-OPERATIONS:ALLOW-INQUIRY</a></span></dt><dd>yes</dd><dt><a id="iss054"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss054.html" target="_top">COERCING-SETF-NAME-TO-FUNCTION:ALL-FUNCTION-NAMES</a></span></dt><dd>yes</dd><dt><a id="iss055"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss055.html" target="_top">COLON-NUMBER</a></span></dt><dd>yes</dd><dt><a id="iss056"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss056.html" target="_top">COMMON-FEATURES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss057"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss057.html" target="_top">COMMON-TYPE:REMOVE</a></span></dt><dd>yes</dd><dt><a id="iss058"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss058.html" target="_top">COMPILE-ARGUMENT-PROBLEMS-AGAIN:FIX</a></span></dt><dd>yes</dd><dt><a id="iss059"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss059.html" target="_top">COMPILE-FILE-HANDLING-OF-TOP-LEVEL-FORMS:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss060"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss060.html" target="_top">COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE</a></span></dt><dd>yes</dd><dt><a id="iss061"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss061.html" target="_top">COMPILE-FILE-PACKAGE</a></span></dt><dd>yes</dd><dt><a id="iss062"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss062.html" target="_top">COMPILE-FILE-PATHNAME-ARGUMENTS:MAKE-CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss063"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss063.html" target="_top">COMPILE-FILE-SYMBOL-HANDLING:NEW-REQUIRE-CONSISTENCY</a></span></dt><dd>yes</dd><dt><a id="iss064"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss064.html" target="_top">COMPILED-FUNCTION-REQUIREMENTS:TIGHTEN</a></span></dt><dd>yes</dd><dt><a id="iss065"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss065.html" target="_top">COMPILER-DIAGNOSTICS:USE-HANDLER</a></span></dt><dd>yes</dd><dt><a id="iss066"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss066.html" target="_top">COMPILER-LET-CONFUSION:ELIMINATE</a></span></dt><dd>yes</dd><dt><a id="iss067"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss067.html" target="_top">COMPILER-VERBOSITY:LIKE-LOAD</a></span></dt><dd>yes</dd><dt><a id="iss068"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss068.html" target="_top">COMPILER-WARNING-STREAM</a></span></dt><dd>yes</dd><dt><a id="iss069"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss069.html" target="_top">COMPLEX-ATAN-BRANCH-CUT:TWEAK</a></span></dt><dd>yes</dd><dt><a id="iss070"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss070.html" target="_top">COMPLEX-ATANH-BOGUS-FORMULA:TWEAK-MORE</a></span></dt><dd>yes</dd><dt><a id="iss071"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss071.html" target="_top">COMPLEX-RATIONAL-RESULT:EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss072"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss072.html" target="_top">COMPUTE-APPLICABLE-METHODS:GENERIC</a></span></dt><dd>yes</dd><dt><a id="iss073"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss073.html" target="_top">CONCATENATE-SEQUENCE:SIGNAL-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss074"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss074.html" target="_top">CONDITION-ACCESSORS-SETFABLE:NO</a></span></dt><dd>yes</dd><dt><a id="iss075"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss075.html" target="_top">CONDITION-RESTARTS:BUGGY</a></span></dt><dd>yes</dd><dt><a id="iss076"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss076.html" target="_top">CONDITION-RESTARTS:PERMIT-ASSOCIATION</a></span></dt><dd>yes</dd><dt><a id="iss077"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss077.html" target="_top">CONDITION-SLOTS:HIDDEN</a></span></dt><dd>yes</dd><dt><a id="iss078"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss078.html" target="_top">CONS-TYPE-SPECIFIER:ADD</a></span></dt><dd>yes</dd><dt><a id="iss079"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss079.html" target="_top">CONSTANT-CIRCULAR-COMPILATION:YES</a></span></dt><dd>yes</dd><dt><a id="iss080"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss080.html" target="_top">CONSTANT-COLLAPSING:GENERALIZE</a></span></dt><dd>yes</dd><dt><a id="iss081"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss081.html" target="_top">CONSTANT-COMPILABLE-TYPES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss082"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss082.html" target="_top">CONSTANT-FUNCTION-COMPILATION:NO</a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can dump compiled functions defined in the
3260 global <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. Interpreted functions can <span class="strong"><strong>not</strong></span> be dumped;
3261 this should not be a problem, because an
3262 <span class="emphasis"><em>interpreted</em></span> function in a
3263 <span class="emphasis"><em>compiled</em></span> file usually indicate a programmer
3264 error (often an extra <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_quote.html" target="_top"><code class="function">QUOTE</code></a>).</dd><dt><a id="iss083"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss083.html" target="_top">CONSTANT-MODIFICATION:DISALLOW</a></span></dt><dd>yes</dd><dt><a id="iss084"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss084.html" target="_top">CONSTANTP-DEFINITION:INTENTIONAL</a></span></dt><dd>yes</dd><dt><a id="iss085"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss085.html" target="_top">CONSTANTP-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss086"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss086.html" target="_top">CONTAGION-ON-NUMERICAL-COMPARISONS:TRANSITIVE</a></span></dt><dd>yes</dd><dt><a id="iss087"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss087.html" target="_top">COPY-SYMBOL-COPY-PLIST:COPY-LIST</a></span></dt><dd>yes</dd><dt><a id="iss088"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss088.html" target="_top">COPY-SYMBOL-PRINT-NAME:EQUAL</a></span></dt><dd>yes</dd><dt><a id="iss089"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss089.html" target="_top">DATA-IO:ADD-SUPPORT</a></span></dt><dd>yes</dd><dt><a id="iss090"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss090.html" target="_top">DATA-TYPES-HIERARCHY-UNDERSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss091"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss091.html" target="_top">DEBUGGER-HOOK-VS-BREAK:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss092"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss092.html" target="_top">DECLARATION-SCOPE:NO-HOISTING</a></span></dt><dd>yes</dd><dt><a id="iss093"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss093.html" target="_top">DECLARE-ARRAY-TYPE-ELEMENT-REFERENCES:RESTRICTIVE</a></span></dt><dd>yes</dd><dt><a id="iss094"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss094.html" target="_top">DECLARE-FUNCTION-AMBIGUITY:DELETE-FTYPE-ABBREVIATION</a></span></dt><dd>yes</dd><dt><a id="iss095"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss095.html" target="_top">DECLARE-MACROS:FLUSH</a></span></dt><dd>yes</dd><dt><a id="iss096"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss096.html" target="_top">DECLARE-TYPE-FREE:LEXICAL</a></span></dt><dd>yes</dd><dt><a id="iss097"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss097.html" target="_top">DECLS-AND-DOC</a></span></dt><dd>there is no writeup, but all affected
3265 operators are fully implemented as specified
3266 </dd><dt><a id="iss098"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss098.html" target="_top">DECODE-UNIVERSAL-TIME-DAYLIGHT:LIKE-ENCODE</a></span></dt><dd>yes</dd><dt><a id="iss099"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss099.html" target="_top">DEFCONSTANT-SPECIAL:NO</a></span></dt><dd>yes</dd><dt><a id="iss100"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss100.html" target="_top">DEFGENERIC-DECLARE:ALLOW-MULTIPLE</a></span></dt><dd>yes</dd><dt><a id="iss101"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss101.html" target="_top">DEFINE-COMPILER-MACRO:X3J13-NOV89</a></span></dt><dd>yes</dd><dt><a id="iss102"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss102.html" target="_top">DEFINE-CONDITION-SYNTAX:INCOMPATIBLY-MORE-LIKE-DEFCLASS+EMPHASIZE-READ-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss103"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss103.html" target="_top">DEFINE-METHOD-COMBINATION-BEHAVIOR:CLARIFY</a></span></dt><dd>no</dd><dt><a id="iss104"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss104.html" target="_top">DEFINING-MACROS-NON-TOP-LEVEL:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss105"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss105.html" target="_top">DEFMACRO-BLOCK-SCOPE:EXCLUDES-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss106"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss106.html" target="_top">DEFMACRO-LAMBDA-LIST:TIGHTEN-DESCRIPTION</a></span></dt><dd>yes</dd><dt><a id="iss107"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss107.html" target="_top">DEFMETHOD-DECLARATION-SCOPE:CORRESPONDS-TO-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss108"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss108.html" target="_top">DEFPACKAGE:ADDITION</a></span></dt><dd>yes</dd><dt><a id="iss109"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss109.html" target="_top">DEFSTRUCT-CONSTRUCTOR-KEY-MIXTURE:ALLOW-KEY</a></span></dt><dd>yes</dd><dt><a id="iss110"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss110.html" target="_top">DEFSTRUCT-CONSTRUCTOR-OPTIONS:EXPLICIT</a></span></dt><dd>yes</dd><dt><a id="iss111"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss111.html" target="_top">DEFSTRUCT-CONSTRUCTOR-SLOT-VARIABLES:NOT-BOUND</a></span></dt><dd>yes</dd><dt><a id="iss112"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss112.html" target="_top">DEFSTRUCT-COPIER-ARGUMENT-TYPE:RESTRICT</a></span></dt><dd>yes</dd><dt><a id="iss113"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss113.html" target="_top">DEFSTRUCT-COPIER:ARGUMENT-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss114"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss114.html" target="_top">DEFSTRUCT-DEFAULT-VALUE-EVALUATION:IFF-NEEDED</a></span></dt><dd>yes</dd><dt><a id="iss115"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss115.html" target="_top">DEFSTRUCT-INCLUDE-DEFTYPE:EXPLICITLY-UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss116"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss116.html" target="_top">DEFSTRUCT-PRINT-FUNCTION-AGAIN:X3J13-MAR-93</a></span></dt><dd>yes</dd><dt><a id="iss117"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss117.html" target="_top">DEFSTRUCT-PRINT-FUNCTION-INHERITANCE:YES</a></span></dt><dd>yes</dd><dt><a id="iss118"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss118.html" target="_top">DEFSTRUCT-REDEFINITION:ERROR</a></span></dt><dd>yes</dd><dt><a id="iss119"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss119.html" target="_top">DEFSTRUCT-SLOTS-CONSTRAINTS-NAME:DUPLICATES-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss120"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss120.html" target="_top">DEFSTRUCT-SLOTS-CONSTRAINTS-NUMBER</a></span></dt><dd>yes</dd><dt><a id="iss121"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss121.html" target="_top">DEFTYPE-DESTRUCTURING:YES</a></span></dt><dd>yes</dd><dt><a id="iss122"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss122.html" target="_top">DEFTYPE-KEY:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss123"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss123.html" target="_top">DEFVAR-DOCUMENTATION:UNEVALUATED</a></span></dt><dd>yes</dd><dt><a id="iss124"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss124.html" target="_top">DEFVAR-INIT-TIME:NOT-DELAYED</a></span></dt><dd>yes</dd><dt><a id="iss125"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss125.html" target="_top">DEFVAR-INITIALIZATION:CONSERVATIVE</a></span></dt><dd>yes</dd><dt><a id="iss126"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss126.html" target="_top">DEPRECATION-POSITION:LIMITED</a></span></dt><dd>yes</dd><dt><a id="iss127"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss127.html" target="_top">DESCRIBE-INTERACTIVE:NO</a></span></dt><dd>yes</dd><dt><a id="iss128"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss128.html" target="_top">DESCRIBE-UNDERSPECIFIED:DESCRIBE-OBJECT</a></span></dt><dd>yes</dd><dt><a id="iss129"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss129.html" target="_top">DESTRUCTIVE-OPERATIONS:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss130"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss130.html" target="_top">DESTRUCTURING-BIND:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss131"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss131.html" target="_top">DISASSEMBLE-SIDE-EFFECT:DO-NOT-INSTALL</a></span></dt><dd>yes</dd><dt><a id="iss132"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss132.html" target="_top">DISPLACED-ARRAY-PREDICATE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss133"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss133.html" target="_top">DO-SYMBOLS-BLOCK-SCOPE:ENTIRE-FORM</a></span></dt><dd>yes</dd><dt><a id="iss134"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss134.html" target="_top">DO-SYMBOLS-DUPLICATES</a></span></dt><dd>yes</dd><dt><a id="iss135"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss135.html" target="_top">DOCUMENTATION-FUNCTION-BUGS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss136"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss136.html" target="_top">DOCUMENTATION-FUNCTION-TANGLED:REQUIRE-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss137"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss137.html" target="_top">DOTIMES-IGNORE:X3J13-MAR91</a></span></dt><dd>yes</dd><dt><a id="iss138"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss138.html" target="_top">DOTTED-LIST-ARGUMENTS:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss139"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss139.html" target="_top">DOTTED-MACRO-FORMS:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss140"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss140.html" target="_top">DRIBBLE-TECHNIQUE</a></span></dt><dd>yes</dd><dt><a id="iss141"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss141.html" target="_top">DYNAMIC-EXTENT-FUNCTION:EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss142"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss142.html" target="_top">DYNAMIC-EXTENT:NEW-DECLARATION</a></span></dt><dd>yes</dd><dt><a id="iss143"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss143.html" target="_top">EQUAL-STRUCTURE:MAYBE-STATUS-QUO</a></span></dt><dd>yes</dd><dt><a id="iss144"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss144.html" target="_top">ERROR-TERMINOLOGY-WARNING:MIGHT</a></span></dt><dd>yes</dd><dt><a id="iss145"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss145.html" target="_top">EVAL-OTHER:SELF-EVALUATE</a></span></dt><dd>yes</dd><dt><a id="iss146"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss146.html" target="_top">EVAL-TOP-LEVEL:LOAD-LIKE-COMPILE-FILE</a></span></dt><dd>yes</dd><dt><a id="iss147"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss147.html" target="_top">EVAL-WHEN-NON-TOP-LEVEL:GENERALIZE-EVAL-NEW-KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss148"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss148.html" target="_top">EVAL-WHEN-OBSOLETE-KEYWORDS:X3J13-MAR-1993</a></span></dt><dd>no</dd><dt><a id="iss149"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss149.html" target="_top">EVALHOOK-STEP-CONFUSION:FIX</a></span></dt><dd>yes</dd><dt><a id="iss150"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss150.html" target="_top">EVALHOOK-STEP-CONFUSION:X3J13-NOV-89</a></span></dt><dd>yes</dd><dt><a id="iss151"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss151.html" target="_top">EXIT-EXTENT-AND-CONDITION-SYSTEM:LIKE-DYNAMIC-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss152"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss152.html" target="_top">EXIT-EXTENT:MINIMAL</a></span></dt><dd>yes, actually implement MEDIUM
3267 </dd><dt><a id="iss153"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss153.html" target="_top">EXPT-RATIO:P.211</a></span></dt><dd>yes</dd><dt><a id="iss154"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss154.html" target="_top">EXTENSIONS-POSITION:DOCUMENTATION</a></span></dt><dd>yes</dd><dt><a id="iss155"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss155.html" target="_top">EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM</a></span></dt><dd>yes</dd><dt><a id="iss156"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss156.html" target="_top">EXTRA-RETURN-VALUES:NO</a></span></dt><dd>yes</dd><dt><a id="iss157"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss157.html" target="_top">FILE-OPEN-ERROR:SIGNAL-FILE-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss158"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss158.html" target="_top">FIXNUM-NON-PORTABLE:TIGHTEN-DEFINITION</a></span></dt><dd>yes</dd><dt><a id="iss159"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss159.html" target="_top">FLET-DECLARATIONS</a></span></dt><dd>yes</dd><dt><a id="iss160"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss160.html" target="_top">FLET-DECLARATIONS:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss161"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss161.html" target="_top">FLET-IMPLICIT-BLOCK:YES</a></span></dt><dd>yes</dd><dt><a id="iss162"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss162.html" target="_top">FLOAT-UNDERFLOW:ADD-VARIABLES</a></span></dt><dd>yes</dd><dt><a id="iss163"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss163.html" target="_top">FLOATING-POINT-CONDITION-NAMES:X3J13-NOV-89</a></span></dt><dd>yes</dd><dt><a id="iss164"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss164.html" target="_top">FORMAT-ATSIGN-COLON</a></span></dt><dd>yes</dd><dt><a id="iss165"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss165.html" target="_top">FORMAT-COLON-UPARROW-SCOPE</a></span></dt><dd>yes</dd><dt><a id="iss166"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss166.html" target="_top">FORMAT-COMMA-INTERVAL</a></span></dt><dd>yes</dd><dt><a id="iss167"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss167.html" target="_top">FORMAT-E-EXPONENT-SIGN:FORCE-SIGN</a></span></dt><dd>yes</dd><dt><a id="iss168"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss168.html" target="_top">FORMAT-OP-C</a></span></dt><dd>yes</dd><dt><a id="iss169"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss169.html" target="_top">FORMAT-PRETTY-PRINT:YES</a></span></dt><dd>yes, except that <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>,
3268 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> also bind <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-BASE*</code></a> to 10 and
3269 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-RADIX*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><a id="iss170"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss170.html" target="_top">FORMAT-STRING-ARGUMENTS:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss171"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss171.html" target="_top">FUNCTION-CALL-EVALUATION-ORDER:MORE-UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss172"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss172.html" target="_top">FUNCTION-COMPOSITION:JAN89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss173"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss173.html" target="_top">FUNCTION-DEFINITION:JAN89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss174"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss174.html" target="_top">FUNCTION-NAME:LARGE</a></span></dt><dd>yes</dd><dt><a id="iss175"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss175.html" target="_top">FUNCTION-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss176"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss176.html" target="_top">FUNCTION-TYPE-ARGUMENT-TYPE-SEMANTICS:RESTRICTIVE</a></span></dt><dd>yes</dd><dt><a id="iss177"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss177.html" target="_top">FUNCTION-TYPE-KEY-NAME:SPECIFY-KEYWORD</a></span></dt><dd>yes</dd><dt><a id="iss178"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss178.html" target="_top">FUNCTION-TYPE-REST-LIST-ELEMENT:USE-ACTUAL-ARGUMENT-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss179"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss179.html" target="_top">FUNCTION-TYPE:X3J13-MARCH-88</a></span></dt><dd>yes</dd><dt><a id="iss180"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss180.html" target="_top">GENERALIZE-PRETTY-PRINTER:UNIFY</a></span></dt><dd>no</dd><dt><a id="iss181"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top">GENERIC-FLET-POORLY-DESIGNED:DELETE</a></span></dt><dd>yes</dd><dt><a id="iss182"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss182.html" target="_top">GENSYM-NAME-STICKINESS:LIKE-TEFLON</a></span></dt><dd>yes</dd><dt><a id="iss183"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss183.html" target="_top">GENTEMP-BAD-IDEA:DEPRECATE</a></span></dt><dd>yes</dd><dt><a id="iss184"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss184.html" target="_top">GET-MACRO-CHARACTER-READTABLE:NIL-STANDARD</a></span></dt><dd>yes</dd><dt><a id="iss185"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss185.html" target="_top">GET-SETF-METHOD-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss186"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss186.html" target="_top">HASH-TABLE-ACCESS:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss187"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss187.html" target="_top">HASH-TABLE-KEY-MODIFICATION:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss188"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss188.html" target="_top">HASH-TABLE-PACKAGE-GENERATORS:ADD-WITH-WRAPPER</a></span></dt><dd>yes</dd><dt><a id="iss189"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss189.html" target="_top">HASH-TABLE-REHASH-SIZE-INTEGER</a></span></dt><dd>yes</dd><dt><a id="iss190"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss190.html" target="_top">HASH-TABLE-SIZE:INTENDED-ENTRIES</a></span></dt><dd>yes</dd><dt><a id="iss191"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss191.html" target="_top">HASH-TABLE-TESTS:ADD-EQUALP</a></span></dt><dd>yes</dd><dt><a id="iss192"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss192.html" target="_top">IEEE-ATAN-BRANCH-CUT:SPLIT</a></span></dt><dd>yes</dd><dt><a id="iss193"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss193.html" target="_top">IGNORE-USE-TERMINOLOGY:VALUE-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss194"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss194.html" target="_top">IMPORT-SETF-SYMBOL-PACKAGE</a></span></dt><dd>yes</dd><dt><a id="iss195"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss195.html" target="_top">IN-PACKAGE-FUNCTIONALITY:MAR89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss196"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss196.html" target="_top">IN-SYNTAX:MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss197"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss197.html" target="_top">INITIALIZATION-FUNCTION-KEYWORD-CHECKING</a></span></dt><dd>yes</dd><dt><a id="iss198"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss198.html" target="_top">ISO-COMPATIBILITY:ADD-SUBSTRATE</a></span></dt><dd>yes</dd><dt><a id="iss199"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss199.html" target="_top">JUN90-TRIVIAL-ISSUES:11</a></span></dt><dd>yes</dd><dt><a id="iss200"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss200.html" target="_top">JUN90-TRIVIAL-ISSUES:14</a></span></dt><dd>yes</dd><dt><a id="iss201"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss201.html" target="_top">JUN90-TRIVIAL-ISSUES:24</a></span></dt><dd>yes</dd><dt><a id="iss202"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss202.html" target="_top">JUN90-TRIVIAL-ISSUES:25</a></span></dt><dd>yes</dd><dt><a id="iss203"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss203.html" target="_top">JUN90-TRIVIAL-ISSUES:27</a></span></dt><dd>yes for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a>, no for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> (spec not clear)
3270 </dd><dt><a id="iss204"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss204.html" target="_top">JUN90-TRIVIAL-ISSUES:3</a></span></dt><dd>yes</dd><dt><a id="iss205"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss205.html" target="_top">JUN90-TRIVIAL-ISSUES:4</a></span></dt><dd>yes</dd><dt><a id="iss206"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss206.html" target="_top">JUN90-TRIVIAL-ISSUES:5</a></span></dt><dd>yes</dd><dt><a id="iss207"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss207.html" target="_top">JUN90-TRIVIAL-ISSUES:9</a></span></dt><dd>yes</dd><dt><a id="iss208"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss208.html" target="_top">KEYWORD-ARGUMENT-NAME-PACKAGE:ANY</a></span></dt><dd>yes</dd><dt><a id="iss209"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss209.html" target="_top">LAST-N</a></span></dt><dd>yes</dd><dt><a id="iss210"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss210.html" target="_top">LCM-NO-ARGUMENTS:1</a></span></dt><dd>yes</dd><dt><a id="iss211"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss211.html" target="_top">LEXICAL-CONSTRUCT-GLOBAL-DEFINITION:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss212"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss212.html" target="_top">LISP-PACKAGE-NAME:COMMON-LISP</a></span></dt><dd>yes</dd><dt><a id="iss213"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss213.html" target="_top">LISP-SYMBOL-REDEFINITION-AGAIN:MORE-FIXES</a></span></dt><dd>yes</dd><dt><a id="iss214"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss214.html" target="_top">LISP-SYMBOL-REDEFINITION:MAR89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss215"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss215.html" target="_top">LOAD-OBJECTS:MAKE-LOAD-FORM</a></span></dt><dd>yes</dd><dt><a id="iss216"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss216.html" target="_top">LOAD-TIME-EVAL:R**2-NEW-SPECIAL-FORM</a></span></dt><dd>obsolete</dd><dt><a id="iss217"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss217.html" target="_top">LOAD-TIME-EVAL:R**3-NEW-SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss218"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss218.html" target="_top">LOAD-TRUENAME:NEW-PATHNAME-VARIABLES</a></span></dt><dd>yes</dd><dt><a id="iss219"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss219.html" target="_top">LOCALLY-TOP-LEVEL:SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss220"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss220.html" target="_top">LOOP-AND-DISCREPANCY:NO-REITERATION</a></span></dt><dd>yes</dd><dt><a id="iss221"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss221.html" target="_top">LOOP-FOR-AS-ON-TYPO:FIX-TYPO</a></span></dt><dd>yes</dd><dt><a id="iss222"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss222.html" target="_top">LOOP-INITFORM-ENVIRONMENT:PARTIAL-INTERLEAVING-VAGUE</a></span></dt><dd>no</dd><dt><a id="iss223"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss223.html" target="_top">LOOP-MISCELLANEOUS-REPAIRS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss224"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss224.html" target="_top">LOOP-NAMED-BLOCK-NIL:OVERRIDE</a></span></dt><dd>yes</dd><dt><a id="iss225"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss225.html" target="_top">LOOP-PRESENT-SYMBOLS-TYPO:FLUSH-WRONG-WORDS</a></span></dt><dd>yes</dd><dt><a id="iss226"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss226.html" target="_top">LOOP-SYNTAX-OVERHAUL:REPAIR</a></span></dt><dd>yes</dd><dt><a id="iss227"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss227.html" target="_top">MACRO-AS-FUNCTION:DISALLOW</a></span></dt><dd>yes</dd><dt><a id="iss228"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss228.html" target="_top">MACRO-DECLARATIONS:MAKE-EXPLICIT</a></span></dt><dd>yes</dd><dt><a id="iss229"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss229.html" target="_top">MACRO-ENVIRONMENT-EXTENT:DYNAMIC</a></span></dt><dd>yes</dd><dt><a id="iss230"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss230.html" target="_top">MACRO-FUNCTION-ENVIRONMENT</a></span></dt><dd>obsolete</dd><dt><a id="iss231"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss231.html" target="_top">MACRO-FUNCTION-ENVIRONMENT:YES</a></span></dt><dd>yes</dd><dt><a id="iss232"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss232.html" target="_top">MACRO-SUBFORMS-TOP-LEVEL-P:ADD-CONSTRAINTS</a></span></dt><dd>no</dd><dt><a id="iss233"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss233.html" target="_top">MACROEXPAND-HOOK-DEFAULT:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss234"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss234.html" target="_top">MACROEXPAND-HOOK-INITIAL-VALUE:IMPLEMENTATION-DEPENDENT</a></span></dt><dd>yes</dd><dt><a id="iss235"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss235.html" target="_top">MACROEXPAND-RETURN-VALUE:TRUE</a></span></dt><dd>yes</dd><dt><a id="iss236"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss236.html" target="_top">MAKE-LOAD-FORM-CONFUSION:REWRITE</a></span></dt><dd>yes</dd><dt><a id="iss237"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss237.html" target="_top">MAKE-LOAD-FORM-SAVING-SLOTS:NO-INITFORMS</a></span></dt><dd>yes</dd><dt><a id="iss238"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss238.html" target="_top">MAKE-PACKAGE-USE-DEFAULT:IMPLEMENTATION-DEPENDENT</a></span></dt><dd>yes</dd><dt><a id="iss239"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss239.html" target="_top">MAP-INTO:ADD-FUNCTION</a></span></dt><dd>yes</dd><dt><a id="iss240"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss240.html" target="_top">MAPPING-DESTRUCTIVE-INTERACTION:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss241"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss241.html" target="_top">METACLASS-OF-SYSTEM-CLASS:UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss242"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss242.html" target="_top">METHOD-COMBINATION-ARGUMENTS:CLARIFY</a></span></dt><dd>no</dd><dt><a id="iss243"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss243.html" target="_top">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</a></span></dt><dd>no</dd><dt><a id="iss244"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss244.html" target="_top">MUFFLE-WARNING-CONDITION-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss245"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss245.html" target="_top">MULTIPLE-VALUE-SETQ-ORDER:LIKE-SETF-OF-VALUES</a></span></dt><dd>yes</dd><dt><a id="iss246"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss246.html" target="_top">MULTIPLE-VALUES-LIMIT-ON-VARIABLES:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss247"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss247.html" target="_top">NINTERSECTION-DESTRUCTION</a></span></dt><dd>yes</dd><dt><a id="iss248"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss248.html" target="_top">NINTERSECTION-DESTRUCTION:REVERT</a></span></dt><dd>yes</dd><dt><a id="iss249"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss249.html" target="_top">NOT-AND-NULL-RETURN-VALUE:X3J13-MAR-93</a></span></dt><dd>yes</dd><dt><a id="iss250"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss250.html" target="_top">NTH-VALUE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss251"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss251.html" target="_top">OPTIMIZE-DEBUG-INFO:NEW-QUALITY</a></span></dt><dd>yes</dd><dt><a id="iss252"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss252.html" target="_top">PACKAGE-CLUTTER:REDUCE</a></span></dt><dd>yes</dd><dt><a id="iss253"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss253.html" target="_top">PACKAGE-DELETION:NEW-FUNCTION</a></span></dt><dd>yes</dd><dt><a id="iss254"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss254.html" target="_top">PACKAGE-FUNCTION-CONSISTENCY:MORE-PERMISSIVE</a></span></dt><dd>yes</dd><dt><a id="iss255"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss255.html" target="_top">PARSE-ERROR-STREAM:SPLIT-TYPES</a></span></dt><dd>yes</dd><dt><a id="iss256"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss256.html" target="_top">PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss257"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss257.html" target="_top">PATHNAME-COMPONENT-VALUE:SPECIFY</a></span></dt><dd>no</dd><dt><a id="iss258"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss258.html" target="_top">PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES</a></span></dt><dd>yes when <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
3271 </dd><dt><a id="iss259"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss259.html" target="_top">PATHNAME-LOGICAL:ADD</a></span></dt><dd>yes</dd><dt><a id="iss260"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss260.html" target="_top">PATHNAME-PRINT-READ:SHARPSIGN-P</a></span></dt><dd>yes</dd><dt><a id="iss261"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss261.html" target="_top">PATHNAME-STREAM</a></span></dt><dd>yes</dd><dt><a id="iss262"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss262.html" target="_top">PATHNAME-STREAM:FILES-OR-SYNONYM</a></span></dt><dd>yes</dd><dt><a id="iss263"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss263.html" target="_top">PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION</a></span></dt><dd>yes</dd><dt><a id="iss264"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss264.html" target="_top">PATHNAME-SYMBOL</a></span></dt><dd>yes when <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
3272 </dd><dt><a id="iss265"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss265.html" target="_top">PATHNAME-SYNTAX-ERROR-TIME:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss266"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss266.html" target="_top">PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN</a></span></dt><dd>yes</dd><dt><a id="iss267"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss267.html" target="_top">PATHNAME-WILD:NEW-FUNCTIONS</a></span></dt><dd>yes</dd><dt><a id="iss268"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss268.html" target="_top">PEEK-CHAR-READ-CHAR-ECHO:FIRST-READ-CHAR</a></span></dt><dd>yes</dd><dt><a id="iss269"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss269.html" target="_top">PLIST-DUPLICATES:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss270"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss270.html" target="_top">PRETTY-PRINT-INTERFACE</a></span></dt><dd>yes</dd><dt><a id="iss271"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss271.html" target="_top">PRINC-READABLY:X3J13-DEC-91</a></span></dt><dd>yes</dd><dt><a id="iss272"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss272.html" target="_top">PRINT-CASE-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss273"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss273.html" target="_top">PRINT-CASE-PRINT-ESCAPE-INTERACTION:VERTICAL-BAR-RULE-NO-UPCASE</a></span></dt><dd>yes</dd><dt><a id="iss274"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss274.html" target="_top">PRINT-CIRCLE-SHARED:RESPECT-PRINT-CIRCLE</a></span></dt><dd>yes</dd><dt><a id="iss275"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss275.html" target="_top">PRINT-CIRCLE-STRUCTURE:USER-FUNCTIONS-WORK</a></span></dt><dd>yes</dd><dt><a id="iss276"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss276.html" target="_top">PRINT-READABLY-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss277"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss277.html" target="_top">PRINTER-WHITESPACE:JUST-ONE-SPACE</a></span></dt><dd>yes</dd><dt><a id="iss278"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss278.html" target="_top">PROCLAIM-ETC-IN-COMPILE-FILE:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss279"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss279.html" target="_top">PUSH-EVALUATION-ORDER:FIRST-ITEM</a></span></dt><dd>yes</dd><dt><a id="iss280"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss280.html" target="_top">PUSH-EVALUATION-ORDER:ITEM-FIRST</a></span></dt><dd>yes</dd><dt><a id="iss281"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss281.html" target="_top">PUSHNEW-STORE-REQUIRED:UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss282"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss282.html" target="_top">QUOTE-SEMANTICS:NO-COPYING</a></span></dt><dd>yes</dd><dt><a id="iss283"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss283.html" target="_top">RANGE-OF-COUNT-KEYWORD:NIL-OR-INTEGER</a></span></dt><dd>yes, when <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;
3273 otherwise negative <code class="constant">:COUNT</code> values are not allowed.
3274 </dd><dt><a id="iss284"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss284.html" target="_top">RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL</a></span></dt><dd>yes</dd><dt><a id="iss285"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss285.html" target="_top">READ-AND-WRITE-BYTES:NEW-FUNCTIONS</a></span></dt><dd>yes</dd><dt><a id="iss286"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss286.html" target="_top">READ-CASE-SENSITIVITY:READTABLE-KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss287"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss287.html" target="_top">READ-MODIFY-WRITE-EVALUATION-ORDER:DELAYED-ACCESS-STORES</a></span></dt><dd>no</dd><dt><a id="iss288"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss288.html" target="_top">READ-SUPPRESS-CONFUSING:GENERALIZE</a></span></dt><dd>yes, except that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-delimited-list.html" target="_top"><code class="function">READ-DELIMITED-LIST</code></a> still
3275 constructs a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a></dd><dt><a id="iss289"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss289.html" target="_top">READER-ERROR:NEW-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss290"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss290.html" target="_top">REAL-NUMBER-TYPE:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss291"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss291.html" target="_top">RECURSIVE-DEFTYPE:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss292"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss292.html" target="_top">REDUCE-ARGUMENT-EXTRACTION</a></span></dt><dd>yes</dd><dt><a id="iss293"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss293.html" target="_top">REMF-DESTRUCTION-UNSPECIFIED:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss294"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss294.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91</a></span></dt><dd>yes</dd><dt><a id="iss295"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss295.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss296"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss296.html" target="_top">REQUIRE-PATHNAME-DEFAULTS:ELIMINATE</a></span></dt><dd>superseded by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss294.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91</a></dd><dt><a id="iss297"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss297.html" target="_top">REST-LIST-ALLOCATION:MAY-SHARE</a></span></dt><dd>yes</dd><dt><a id="iss298"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss298.html" target="_top">RESULT-LISTS-SHARED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss299"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss299.html" target="_top">RETURN-VALUES-UNSPECIFIED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss300"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss300.html" target="_top">ROOM-DEFAULT-ARGUMENT:NEW-VALUE</a></span></dt><dd>yes</dd><dt><a id="iss301"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss301.html" target="_top">SELF-MODIFYING-CODE:FORBID</a></span></dt><dd>yes</dd><dt><a id="iss302"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss302.html" target="_top">SEQUENCE-TYPE-LENGTH:MUST-MATCH</a></span></dt><dd>yes</dd><dt><a id="iss303"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss303.html" target="_top">SETF-APPLY-EXPANSION:IGNORE-EXPANDER</a></span></dt><dd>yes</dd><dt><a id="iss304"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss304.html" target="_top">SETF-FIND-CLASS:ALLOW-NIL</a></span></dt><dd>yes</dd><dt><a id="iss305"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss305.html" target="_top">SETF-FUNCTIONS-AGAIN:MINIMAL-CHANGES</a></span></dt><dd>yes</dd><dt><a id="iss306"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss306.html" target="_top">SETF-GET-DEFAULT:EVALUATED-BUT-IGNORED</a></span></dt><dd>yes</dd><dt><a id="iss307"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss307.html" target="_top">SETF-MACRO-EXPANSION:LAST</a></span></dt><dd>yes</dd><dt><a id="iss308"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss308.html" target="_top">SETF-METHOD-VS-SETF-METHOD:RENAME-OLD-TERMS</a></span></dt><dd>yes</dd><dt><a id="iss309"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss309.html" target="_top">SETF-MULTIPLE-STORE-VARIABLES:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss310"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss310.html" target="_top">SETF-OF-APPLY:ONLY-AREF-AND-FRIENDS</a></span></dt><dd>yes</dd><dt><a id="iss311"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss311.html" target="_top">SETF-OF-VALUES:ADD</a></span></dt><dd>yes</dd><dt><a id="iss312"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss312.html" target="_top">SETF-SUB-METHODS:DELAYED-ACCESS-STORES</a></span></dt><dd>yes</dd><dt><a id="iss313"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss313.html" target="_top">SHADOW-ALREADY-PRESENT</a></span></dt><dd>yes</dd><dt><a id="iss314"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss314.html" target="_top">SHADOW-ALREADY-PRESENT:WORKS</a></span></dt><dd>yes</dd><dt><a id="iss315"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss315.html" target="_top">SHARP-COMMA-CONFUSION:REMOVE</a></span></dt><dd>no</dd><dt><a id="iss316"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss316.html" target="_top">SHARP-O-FOOBAR:CONSEQUENCES-UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss317"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss317.html" target="_top">SHARP-STAR-DELIMITER:NORMAL-DELIMITER</a></span></dt><dd>yes</dd><dt><a id="iss318"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss318.html" target="_top">SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD</a></span></dt><dd>yes</dd><dt><a id="iss319"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss319.html" target="_top">SLOT-MISSING-VALUES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss320"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss320.html" target="_top">SLOT-VALUE-METACLASSES:LESS-MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss321"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss321.html" target="_top">SPECIAL-FORM-P-MISNOMER:RENAME</a></span></dt><dd>yes</dd><dt><a id="iss322"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss322.html" target="_top">SPECIAL-TYPE-SHADOWING:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss323"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss323.html" target="_top">STANDARD-INPUT-INITIAL-BINDING:DEFINED-CONTRACTS</a></span></dt><dd>yes</dd><dt><a id="iss324"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss324.html" target="_top">STANDARD-REPERTOIRE-GRATUITOUS:RENAME</a></span></dt><dd>yes</dd><dt><a id="iss325"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss325.html" target="_top">STEP-ENVIRONMENT:CURRENT</a></span></dt><dd>yes</dd><dt><a id="iss326"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss326.html" target="_top">STEP-MINIMAL:PERMIT-PROGN</a></span></dt><dd>yes</dd><dt><a id="iss327"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss327.html" target="_top">STREAM-ACCESS:ADD-TYPES-ACCESSORS</a></span></dt><dd>yes</dd><dt><a id="iss328"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss328.html" target="_top">STREAM-CAPABILITIES:INTERACTIVE-STREAM-P</a></span></dt><dd>yes</dd><dt><a id="iss329"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss329.html" target="_top">STRING-COERCION:MAKE-CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss330"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss330.html" target="_top">STRING-OUTPUT-STREAM-BASHING:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss331"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss331.html" target="_top">STRUCTURE-READ-PRINT-SYNTAX:KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss332"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss332.html" target="_top">SUBSEQ-OUT-OF-BOUNDS</a></span></dt><dd>yes</dd><dt><a id="iss333"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss333.html" target="_top">SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss334"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss334.html" target="_top">SUBSETTING-POSITION:NONE</a></span></dt><dd>yes</dd><dt><a id="iss335"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss335.html" target="_top">SUBTYPEP-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss336"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss336.html" target="_top">SUBTYPEP-TOO-VAGUE:CLARIFY-MORE</a></span></dt><dd>yes</dd><dt><a id="iss337"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss337.html" target="_top">SXHASH-DEFINITION:SIMILAR-FOR-SXHASH</a></span></dt><dd>yes</dd><dt><a id="iss338"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss338.html" target="_top">SYMBOL-MACROLET-DECLARE:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss339"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss339.html" target="_top">SYMBOL-MACROLET-SEMANTICS:SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss340"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss340.html" target="_top">SYMBOL-MACROLET-TYPE-DECLARATION:NO</a></span></dt><dd>yes</dd><dt><a id="iss341"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss341.html" target="_top">SYMBOL-MACROS-AND-PROCLAIMED-SPECIALS:SIGNALS-AN-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss342"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss342.html" target="_top">SYMBOL-PRINT-ESCAPE-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss343"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss343.html" target="_top">SYNTACTIC-ENVIRONMENT-ACCESS:RETRACTED-MAR91</a></span></dt><dd>yes</dd><dt><a id="iss344"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss344.html" target="_top">TAGBODY-TAG-EXPANSION:NO</a></span></dt><dd>yes</dd><dt><a id="iss345"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss345.html" target="_top">TAILP-NIL:T</a></span></dt><dd>yes</dd><dt><a id="iss346"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss346.html" target="_top">TEST-NOT-IF-NOT:FLUSH-ALL</a></span></dt><dd>yes, but no warning</dd><dt><a id="iss347"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss347.html" target="_top">THE-AMBIGUITY:FOR-DECLARATION</a></span></dt><dd>yes</dd><dt><a id="iss348"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss348.html" target="_top">THE-VALUES:RETURN-NUMBER-RECEIVED</a></span></dt><dd>yes</dd><dt><a id="iss349"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss349.html" target="_top">TIME-ZONE-NON-INTEGER:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss350"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss350.html" target="_top">TYPE-DECLARATION-ABBREVIATION:ALLOW-ALL</a></span></dt><dd>no</dd><dt><a id="iss351"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss351.html" target="_top">TYPE-OF-AND-PREDEFINED-CLASSES:TYPE-OF-HANDLES-FLOATS</a></span></dt><dd>yes</dd><dt><a id="iss352"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss352.html" target="_top">TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss353"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss353.html" target="_top">TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS</a></span></dt><dd>yes</dd><dt><a id="iss354"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss354.html" target="_top">TYPE-SPECIFIER-ABBREVIATION:X3J13-JUN90-GUESS</a></span></dt><dd>yes</dd><dt><a id="iss355"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss355.html" target="_top">UNDEFINED-VARIABLES-AND-FUNCTIONS:COMPROMISE</a></span></dt><dd>yes</dd><dt><a id="iss356"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss356.html" target="_top">UNINITIALIZED-ELEMENTS:CONSEQUENCES-UNDEFINED</a></span></dt><dd>yes, could add error checking
3276 </dd><dt><a id="iss357"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss357.html" target="_top">UNREAD-CHAR-AFTER-PEEK-CHAR:DONT-ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss358"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss358.html" target="_top">UNSOLICITED-MESSAGES:NOT-TO-SYSTEM-USER-STREAMS</a></span></dt><dd>yes</dd><dt><a id="iss359"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss359.html" target="_top">VARIABLE-LIST-ASYMMETRY:SYMMETRIZE</a></span></dt><dd>yes</dd><dt><a id="iss360"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss360.html" target="_top">WITH-ADDED-METHODS:DELETE</a></span></dt><dd>yes</dd><dt><a id="iss361"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss361.html" target="_top">WITH-COMPILATION-UNIT:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss362"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss362.html" target="_top">WITH-OPEN-FILE-DOES-NOT-EXIST:STREAM-IS-NIL</a></span></dt><dd>yes</dd><dt><a id="iss363"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss363.html" target="_top">WITH-OPEN-FILE-SETQ:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss364"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss364.html" target="_top">WITH-OPEN-FILE-STREAM-EXTENT:DYNAMIC-EXTENT</a></span></dt><dd>yes</dd><dt><a id="iss365"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss365.html" target="_top">WITH-OUTPUT-TO-STRING-APPEND-STYLE:VECTOR-PUSH-EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss366"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss366.html" target="_top">WITH-STANDARD-IO-SYNTAX-READTABLE:X3J13-MAR-91</a></span></dt><dd>yes</dd></dl></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="ext-standard"></a>Part II. Common Portable Extensions</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#mop-chap">29. Meta-Object Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#gray">30. Gray streams</a></span></dt><dd><dl><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="mop-chap"></a>Chapter 29. Meta-Object Protocol</h2></div><div><h3 class="subtitle"><em>Adapted from chapters 5 and 6 of [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]</em></h3></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></dd></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-intro"></a>29.1. Introduction</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification ([<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] Chanpter 7) describes the
3277 standard Programmer Interface for the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> Object System (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>). This
3278 document extends that specification by defining a metaobject protocol
3279 for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> - that is, a description of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> itself as an extensible
3280 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> program. In this description, the fundamental elements of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
3281 programs (classes, slot definitions, generic functions, methods,
3282 specializers and method combinations) are represented by first-class
3283 objects. The behavior of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is provided by these objects, or, more
3284 precisely, by methods specialized to the classes of these objects.
3285 </p><p>Because these objects represent pieces of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> programs, and
3286 because their behavior provides the behavior of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> language
3287 itself, they are considered meta-level objects or metaobjects. The
3288 protocol followed by the metaobjects to provide the behavior of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
3289 is called the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> <span class="quote">“<span class="quote">Metaobject Protocol</span>”</span> (MOP).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-intro-notation"></a>29.1.1. Notation</h3></div></div></div><p>The description of functions follows the same form as used in the
3290 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification. The description of generic functions is similar
3291 to that in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification, but some minor changes have been
3292 made in the way methods are presented.</p><p>The following is an example of the format for the syntax
3293 description of a generic function:
3294 </p><pre class="programlisting">
3295 (<code class="function">gf1</code> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>v</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>k</code></em>)
3296 </pre><p>This description indicates that <code class="function">gf1</code> is a
3297 generic function with two required parameters, <em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em>, an
3298 optional parameter <em class="replaceable"><code>v</code></em> and a keyword parameter <em class="replaceable"><code>k</code></em>.</p><p>The description of a generic function includes a description of
3299 its behavior. This provides the general behavior, or protocol of the
3300 generic function. All methods defined on the generic function, both
3301 portable and specified, must have behavior consistent with this
3302 description.</p><p>Every generic function described here is an instance of the class
3303 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> and uses the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6-2.html" target="_top"><code class="function">STANDARD</code></a> method
3304 combination.</p><p>The description of a generic function also includes descriptions
3305 of the specified methods for that generic function. In the description
3306 of these methods, a <strong class="first"><em class="firstterm">method signature</em></strong> is used to
3307 describe the parameters and parameter specializers of each method. The
3308 following is an example of the format for a method signature:
3309 </p><pre class="programlisting">
3310 <span class="method"><code class="literal">(<code class="function">gf1</code> (<em class="replaceable"><code>x</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) <em class="replaceable"><code>y</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>v</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>k</code></em>)</code></span>
3311 </pre><p>This signature indicates that this primary method on the generic
3312 function <code class="function">gf1</code> has two required parameters, named
3313 <em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em>. In addition, there is an optional parameter <em class="replaceable"><code>v</code></em> and
3314 a keyword parameter <em class="replaceable"><code>k</code></em>. This signature also indicates that the
3315 method's parameter specializers are the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.
3316 </p><p>The description of each method includes a description of the
3317 behavior particular to that method.</p><p>An abbreviated syntax is used when referring to a method defined
3318 elsewhere in the document. This abbreviated syntax includes the name of
3319 the generic function, the qualifiers, and the parameter specializers. A
3320 reference to the method with the signature shown above is written as:
3321 <span class="method"><code class="literal"><code class="function">gf1</code> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span>.
3322 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-package"></a>29.1.2. Package</h3></div></div></div><p>The package exporting the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> symbols is unspecified.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The symbols specified by the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> are
3323 exported from the package <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from the package
3324 <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>.</p></div><p>The package exporting the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> symbols is different in other
3325 implementations: In <a class="ulink" href="http://www.sbcl.org/" target="_top"><span class="command"><strong>SBCL</strong></span></a> it is the package
3326 <strong class="package"><span class="quote">“<span class="quote">SB-MOP</span>”</span></strong>;
3327 in <a class="ulink" href="https://www.cliki.net/CCL" target="_top"><span class="command"><strong>Clozure CL</strong></span></a> it is the package
3328 <strong class="package"><span class="quote">“<span class="quote">OPENMCL-MOP</span>”</span></strong>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-overview"></a>29.2. Overview</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-metaobjects"></a>29.2.1. Metaobjects</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></div><p>For each kind of program element there is a corresponding
3329 <strong class="first"><em class="firstterm">basic metaobject class
3330 <a id="mop-ba-mo-cl" class="indexterm"></a></em></strong>.
3331 These are the classes: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>, <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>,
3332 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a>.
3333 A <strong class="first"><em class="firstterm">metaobject class<a id="mo-cl" class="indexterm"></a></em></strong>
3334 is a subclass of exactly one of these classes.
3335 The results are undefined if an attempt is made to define a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>
3336 that is a subclass of more than one basic metaobject class.
3337 A <strong class="first"><em class="firstterm">metaobject<a id="mop-mo" class="indexterm"></a></em></strong> is an instance of a metaobject class.</p><p>Each metaobject represents one program element. Associated with
3338 each metaobject is the information required to serve its role. This
3339 includes information that might be provided directly in a user interface
3340 macro such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>. It also includes information
3341 computed indirectly from other metaobjects such as that computed from
3342 class inheritance or the full set of methods associated with a generic
3343 function.</p><p>Much of the information associated with a metaobject is in the
3344 form of connections to other metaobjects. This interconnection means
3345 that the role of a metaobject is always based on that of other
3346 metaobjects. As an introduction to this interconnected structure, this
3347 section presents a partial enumeration of the kinds of information
3348 associated with each kind of metaobject. More detailed information is
3349 presented later.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-classes"></a>29.2.1.1. Classes</h4></div></div></div><p>A <strong class="first"><em class="firstterm">class metaobject
3350 <a id="mop-class-mo" class="indexterm"></a></em></strong>
3351 determines the structure and the default behavior of its instances.
3352 The following information is associated with <a class="link" href="#mop-class-mo">class metaobject</a>s:
3353
3354 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name, if there is one, is available as an object.
3355 </li><li class="listitem">The direct subclasses, direct superclasses and class
3356 precedence list are available as lists of <a class="link" href="#mop-class-mo">class metaobject</a>s.</li><li class="listitem">The slots defined directly in the class are available
3357 as a list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The slots which are accessible in instances of
3358 the class are available as a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</li><li class="listitem">The methods which use the class as a specializer, and
3359 the generic functions associated with those methods are available as
3360 lists of method and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s respectively.</li><li class="listitem">The documentation is available as a
3361 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-classes" title="29.3. Classes">Section 29.3, “Classes”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-slot-defs"></a>29.2.1.2. Slot Definitions</h4></div></div></div><p>A <strong class="first"><em class="firstterm">slot definition metaobject
3362 <a id="mop-slot-def-mo" class="indexterm"></a></em></strong>
3363 contains information about the definition of a slot.
3364 There are two kinds of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="first"><em class="firstterm">direct<a id="mop-dsd-mo" class="indexterm"></a></em></strong> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a></span></dt><dd>Used to represent the direct definition of a slot in
3365 a class. This corresponds roughly to the slot specifiers found in
3366 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms.</dd><dt><span class="term"><strong class="first"><em class="firstterm">effective<a id="mop-esd-mo" class="indexterm"></a></em></strong> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a></span></dt><dd>Used to represent information, including inherited
3367 information, about a slot which is accessible in instances of a
3368 particular class.</dd></dl></div><p>Associated with each <a class="link" href="#mop-class-mo">class metaobject</a> is a list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s representing the
3369 slots defined directly in the class.
3370 Also associated with each <a class="link" href="#mop-class-mo">class metaobject</a> is a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s representing the
3371 set of slots accessible in instances of that class.</p><p>The following information is associated with both direct and
3372 effective slot definitions metaobjects:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name, allocation, and type are available as forms
3373 that could appear in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</li><li class="listitem">The initialization form, if there is one, is
3374 available as a form that could appear in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form. The
3375 initialization form together with its <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> is available
3376 as a function of no arguments which, when called, returns the result
3377 of evaluating the initialization form in its <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. This
3378 is called the <strong class="first"><em class="firstterm">initfunction</em></strong> of the slot.
3379 </li><li class="listitem">The slot filling initialization arguments are
3380 available as a list of symbols.</li><li class="listitem">The documentation is available as a
3381 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>Certain other information is only associated with <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
3382 This information applies only to the direct definition of the slot in
3383 the class (it is not inherited).
3384 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The function names of those generic
3385 functions for which there are automatically generated reader and
3386 writer methods. This information is available as lists of function
3387 names. Any accessors specified in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form are broken down
3388 into their equivalent readers and writers in the direct slot
3389 definition.</li></ul></div><p>Information, including inherited information, which applies to the
3390 definition of a slot in a particular class in which it is accessible is
3391 associated only with <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
3392 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">For certain slots, the location of the
3393 slot in instances of the class is available.
3394 </li></ul></div><p>See also <a class="xref" href="#mop-sd" title="29.4. Slot Definitions">Section 29.4, “Slot Definitions”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-gen-funs"></a>29.2.1.3. Generic Functions</h4></div></div></div><p>A <strong class="first"><em class="firstterm">generic function metaobject
3395 <a id="mop-gen-fun-mo" class="indexterm"></a></em></strong>
3396 contains information about a generic function over and above the
3397 information associated with each of the generic function's methods.
3398 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name is available as a function name.
3399 </li><li class="listitem">The methods associated with the generic function are
3400 available as a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</li><li class="listitem">The default class for this generic function's <a class="link" href="#mop-method-mo">method metaobject</a>s
3401 is available as a <a class="link" href="#mop-class-mo">class metaobject</a>.</li><li class="listitem">The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
3402 </li><li class="listitem">The method combination is available as a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.
3403 </li><li class="listitem">The argument precedence order is available as a
3404 permutation of those symbols from the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> which name the
3405 required arguments of the generic function.</li><li class="listitem"><p class="simpara">The <span class="quote">“<span class="quote">declarations</span>”</span> are available as a
3406 list of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>There is a slight misnomer in the naming of functions and
3407 options in this document: Where the term <span class="quote">“<span class="quote">declaration</span>”</span> is
3408 used, actually a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a> is meant.
3409 </p></div></li><li class="listitem">The documentation is available as a
3410 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-gf" title="29.5. Generic Functions">Section 29.5, “Generic Functions”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-methods"></a>29.2.1.4. Methods</h4></div></div></div><p>A <strong class="first"><em class="firstterm">method metaobject
3411 <a id="mop-method-mo" class="indexterm"></a></em></strong>
3412 contains information about a specific <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.
3413 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The qualifiers are available as a
3414 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of of non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> atoms.</li><li class="listitem">The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
3415 </li><li class="listitem">The specializers are available as a list of
3416 specializer metaobjects.</li><li class="listitem">The function is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>. This
3417 function can be applied to arguments and a list of next methods using
3418 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>.</li><li class="listitem">When the method is associated with a generic
3419 function, that <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is available. A method can be associated with
3420 at most one generic function at a time.</li><li class="listitem">The documentation is available as a
3421 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-meth" title="29.6. Methods">Section 29.6, “Methods”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-spec"></a>29.2.1.5. Specializers</h4></div></div></div><p>A <strong class="first"><em class="firstterm">specializer metaobject
3422 <a id="spec-mo" class="indexterm"></a></em></strong>
3423 represents the specializers of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.
3424 <a class="link" href="#mop-class-mo">class metaobject</a>s are themselves specializer metaobjects. A special
3425 kind of specializer metaobject is used for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p>See also <a class="xref" href="#mop-specializers" title="29.8. Specializers">Section 29.8, “Specializers”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-meth-combs"></a>29.2.1.6. Method Combinations</h4></div></div></div><p>A <strong class="first"><em class="firstterm">method combination metaobject
3426 <a id="mop-meth-comp-mo" class="indexterm"></a></em></strong>
3427 represents the information about the method combination being used by a
3428 generic function.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This document does not specify the structure of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>s.
3429 </p></div><p>See also <a class="xref" href="#mop-meth-comb" title="29.9. Method Combinations">Section 29.9, “Method Combinations”</a></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-mo-cl-inheritance"></a>29.2.2. Inheritance Structure of Metaobject Classes</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></dd></dl></div><div class="figure"><a id="mop-mo-cl-inheritance-fig"></a><p class="title"><strong>Figure 29.1. Inheritance structure of metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-all.png" width="100%" alt="Inheritance structure of metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /><p>The inheritance structure of the specified metaobject classes is
3430 shown in <a class="xref" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes">Table 29.1, “Direct Superclass Relationships Among The Specified Metaobject Classes”</a>. The class of every class
3431 shown is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> except for the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>,
3432 which are instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>, and the classes
3433 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>, which are
3434 instances of the class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>.
3435 </p><div class="table"><a id="mop-inherit-struct"></a><p class="title"><strong>Table 29.1. Direct Superclass Relationships
3436 Among The Specified Metaobject Classes</strong></p><div class="table-contents"><table class="table" summary="Direct Superclass Relationships&#10; Among The Specified Metaobject Classes" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Metaobject Class</th><th align="center">Abstract</th><th align="center">Subclassable</th><th align="center">Direct Superclasses</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EFFECTIVE-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EFFECTIVE-SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr></tbody></table></div></div><p><br class="table-break" />
3437 </p><p>Each class with a <span class="quote">“<span class="quote">yes</span>”</span> in the <span class="quote">“<span class="quote">Abstract</span>”</span>
3438 column is an <span class="emphasis"><em>abstract class</em></span> and is not intended to
3439 be instantiated. The results are undefined if an attempt is made to
3440 make an instance of one of these classes with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p>Each class with a <span class="quote">“<span class="quote">yes</span>”</span> in
3441 the <span class="quote">“<span class="quote">Subclassable</span>”</span> column can be used as direct superclass
3442 for portable programs. It is not meaningful to subclass a class that
3443 has a <span class="quote">“<span class="quote">no</span>”</span> in this column.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> is also subclassable: It
3444 is possible to create subclasses of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> that do not inherit
3445 from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span> and some other implementations</h3><p>The class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>'s class
3446 precedence list contains <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>, not
3447 after <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.
3448 This is the most transparent way to realize the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement
3449 (see the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2-2.html">4.2.2
3450 <span class="quote">“<span class="quote">Type Relationships</span>”</span></a>)
3451 that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>'s class precedence list contains
3452 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.</p></div><p>The classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>,
3453 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>,
3454 <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> are called
3455 <strong class="first"><em class="firstterm">standard metaobject
3456 <a id="std-mo" class="indexterm"></a></em></strong> classes.
3457 For each kind of metaobject, this is the class the user interface
3458 macros presented in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> use by default. These are also the
3459 classes on which user specializations are normally based.</p><p>The classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>, <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> and
3460 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> are special-purpose <a class="link" href="#mop-class-mo">class metaobject</a> classes.
3461 Built-in classes are instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>.
3462 The class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> provides a special kind of
3463 instances described in <a class="xref" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances">Section 29.10.2, “Funcallable Instances”</a>.
3464 When the definition of a class references another class which has not
3465 yet been defined, an instance of <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is used as
3466 a stand-in until the class is actually defined.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="forward-referenced-class-clisp"></a>Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></h3><p>The class <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is implemented in a way
3467 that fixes several flaws in the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] specification.</p><p>It is not a subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>, just a
3468 subclass of <a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>, because forward references to classes are
3469 not classes and cannot be used as specializers of methods. An [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]
3470 compatibility mode is provided, however, if you set the variable
3471 <strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*FORWARD-REFERENCED-CLASS-MISDESIGN*</code>
3472 <a id="frc-bad" class="indexterm"></a></em></strong> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
3473 In this mode, <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is formally a subclass of
3474 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>, but the behaviour of
3475 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances is the same.</p><p>The [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] says that the first argument of <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> can
3476 be a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.
3477 But from the description of <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>, it is clear that it can
3478 only be a class returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>, and [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>
3479 cannot return a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p>The [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] says that <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> creates a
3480 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> for not-yet-defined class symbols among the
3481 direct-superclasses list. But this leads to many
3482 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> with the same name (since they cannot be
3483 stored and retrieved through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>), and since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>
3484 preserves the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>-ness, after the class is defined, we have many
3485 class objects with the same name.</p><p>In the direct-superclasses list of non-finalized classes,
3486 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances can occur, denoting classes that
3487 have not yet been defined. When or after such a class gets defined,
3488 the <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instance is replaced with the real
3489 class. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses simple object replacement, not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>, in
3490 this process.</p></div><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> is the <span class="emphasis"><em>default direct
3491 superclass</em></span> of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. When an instance
3492 of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> is created, and no direct superclasses are
3493 explicitly specified, it defaults to the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>. In
3494 this way, any behavior associated with the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>
3495 will be inherited, directly or indirectly, by all instances of the class
3496 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. A subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> may have a different
3497 class as its default direct superclass, but that class must be a
3498 subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.</p><p>The same is true for <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> and
3499 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>.</p><p>The class <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> captures only the most basic behavior of
3500 method specializers, and is not itself intended to be instantiated. The
3501 class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> is a direct subclass of <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> reflecting the
3502 property that classes by themselves can be used as method specializers.
3503 The class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a> is used for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-ov-impl-and-user-spec"></a>29.2.2.1. Implementation and User Specialization</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></div><p>The purpose of the Metaobject Protocol is to provide users with a
3504 powerful mechanism for extending and customizing the basic behavior of
3505 the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>. As an object-oriented description of the basic <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
3506 behavior, the Metaobject Protocol makes it possible to create these
3507 extensions by defining specialized subclasses of existing metaobject
3508 classes.</p><p>The Metaobject Protocol provides this capability without
3509 interfering with the implementor's ability to develop high-performance
3510 implementations. This balance between user extensibility and
3511 implementor freedom is mediated by placing explicit restrictions on
3512 each. Some of these restrictions are general---they apply to the entire
3513 class graph and the applicability of all methods. These are presented
3514 in this section.</p><p>The following additional terminology is used to present these
3515 restrictions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Metaobjects are divided into three categories. Those
3516 defined in this document are called <strong class="first"><em class="firstterm">specified
3517 <a id="mo-specified" class="indexterm"></a></em></strong>;
3518 those defined by an implementation but not mentioned in this document
3519 are called <strong class="first"><em class="firstterm">implementation-specific
3520 <a id="mo-impl" class="indexterm"></a></em></strong>;
3521 and those defined by a portable program are called <strong class="first"><em class="firstterm">portable
3522 <a id="mo-portable" class="indexterm"></a></em></strong>.
3523 </li><li class="listitem">A class <em class="replaceable"><code>i</code></em> is <strong class="first"><em class="firstterm">interposed
3524 <a id="class-interposed" class="indexterm"></a>
3525 </em></strong> between two other classes <em class="replaceable"><code>k<sub>1</sub></code></em> and <em class="replaceable"><code>k<sub>2</sub></code></em> if and only
3526 if there is some path, following direct superclasses, from the class
3527 <em class="replaceable"><code>k<sub>1</sub></code></em> to the class <em class="replaceable"><code>k<sub>2</sub></code></em> which includes <em class="replaceable"><code>i</code></em>.</li><li class="listitem">A method is <strong class="first"><em class="firstterm">specialized
3528 <a id="method-specialized" class="indexterm"></a></em></strong>
3529 to a class if and only if that class is in the list of specializers
3530 associated with the method; and the method is in the list of methods
3531 associated with some generic function.</li><li class="listitem">In a given implementation, a specified method is said
3532 to have been <strong class="first"><em class="firstterm">promoted
3533 <a id="method-promoted" class="indexterm"></a></em></strong>
3534 if and only if the specializers of the method, <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>, are
3535 defined in this specification as the classes <em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em>, but in
3536 the implementation, one or more of the specializers
3537 <em class="replaceable"><code>x<sub>l</sub></code></em>, is a superclass of the class
3538 given in the specification <em class="replaceable"><code>k<sub>l</sub></code></em>.
3539 </li><li class="listitem"><p>For a given generic function and set of arguments, a
3540 method <em class="replaceable"><code>k<sub>2</sub></code></em> <strong class="first"><em class="firstterm">extends
3541 <a id="method-extends" class="indexterm"></a></em></strong>
3542 a method <em class="replaceable"><code>k<sub>1</sub></code></em> if and only if:
3543 </p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> and
3544 <em class="replaceable"><code>k<sub>2</sub></code></em> are both associated with the given generic function
3545 </li><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> and <em class="replaceable"><code>k<sub>2</sub></code></em> are both applicable to the given
3546 arguments,</li><li class="listitem">the specializers and qualifiers of the methods are
3547 such that when the generic function is called, <em class="replaceable"><code>k<sub>2</sub></code></em> is executed
3548 before <em class="replaceable"><code>k<sub>1</sub></code></em>,</li><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> will be executed if and only if
3549 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is invoked from within the body of <em class="replaceable"><code>k<sub>2</sub></code></em> and
3550 </li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is invoked from within the body
3551 of <em class="replaceable"><code>k<sub>2</sub></code></em>, thereby causing <em class="replaceable"><code>k<sub>1</sub></code></em> to be executed.
3552 </li></ol></div></li><li class="listitem"><p>For a given generic function and set of arguments, a
3553 method <em class="replaceable"><code>k<sub>2</sub></code></em> <strong class="first"><em class="firstterm">overrides
3554 <a id="method-overrides" class="indexterm"></a></em></strong>
3555 a method <em class="replaceable"><code>k<sub>1</sub></code></em> if and only if conditions <span class="emphasis"><em>i</em></span>
3556 through <span class="emphasis"><em>iv</em></span> above hold and,
3557 instead of <span class="emphasis"><em>v</em></span>,
3558 </p><div class="orderedlist"><ol class="orderedlist" start="6" type="i"><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is not invoked from within the
3559 body of <em class="replaceable"><code>k<sub>2</sub></code></em>, thereby preventing <em class="replaceable"><code>k<sub>1</sub></code></em> from being executed.
3560 </li></ol></div></li></ul></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-portable-restrictions"></a>29.2.2.1.1. Restrictions on Portable Programs</h5></div></div></div><p>Portable programs are allowed to define subclasses of specified
3561 classes, and are permitted to define methods on specified generic
3562 functions, with the following restrictions: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not redefine any specified
3563 classes, generic functions, methods or method combinations. Any method
3564 defined by a portable program on a specified generic function must have
3565 at least one specializer that is neither a specified class nor an
3566 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer whose associated value is an instance of a specified
3567 class.</li><li class="listitem">Portable programs may define methods that extend
3568 specified methods unless the description of the specified method
3569 explicitly prohibits this. Unless there is a specific statement to the
3570 contrary, these extending methods must return whatever value was
3571 returned by the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>.</li><li class="listitem"><p class="simpara">Portable programs may define methods that override
3572 specified methods only when the description of the specified method
3573 explicitly allows this. Typically, when a method is allowed to be
3574 overridden, a small number of related methods will need to be overridden
3575 as well.</p><p class="simpara">An example of this is the specified methods on the generic
3576 functions <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>, <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> and <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>.
3577 Overriding a specified method on one of these generic functions requires
3578 that the corresponding method on the other two generic functions be
3579 overridden as well.</p></li><li class="listitem"><p class="simpara">Portable methods on specified generic functions
3580 specialized to portable metaobject classes must be defined before any
3581 instances of those classes (or any subclasses) are created, either
3582 directly or indirectly by a call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. Methods can be
3583 defined after instances are created by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a> however.
3584 Portable metaobject classes cannot be redefined.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The purpose of this last restriction is to permit
3585 implementations to provide performance optimizations by analyzing, at
3586 the time the first instance of a metaobject class is initialized, what
3587 portable methods will be applicable to it. This can make it possible to
3588 optimize calls to those specified generic functions which would have no
3589 applicable portable methods.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mop-mo-redef-clisp-warn"></a>Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>When a metaobject class is redefined,
3590 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> that the redefinition has no effect.
3591 To avoid this warning, place all metaobject class definitions in a
3592 separate file, compile it in a <span class="emphasis"><em>separate</em></span> session
3593 (because <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is evaluated at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> too;
3594 see <a class="xref" href="#mop-ov-ui-others" title="29.2.3.2. Compile-file Processing of Specific User Interface Macros">Section 29.2.3.2, “Compile-file Processing of Specific User Interface Macros”</a>),
3595 and then <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> it only <span class="emphasis"><em>once</em></span> per session.
3596 </p></div></li></ul></div><p>
3597 </p><p>The results are undefined if any of
3598 these restrictions are violated.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The specification technology used in this document needs
3599 further development. The concepts of object-oriented protocols and
3600 subclass specialization are intuitively familiar to programmers of
3601 object-oriented systems; the protocols presented here fit quite
3602 naturally into this framework. Nonetheless, in preparing this document,
3603 we have found it difficult to give specification-quality descriptions of
3604 the protocols in a way that makes it clear what extensions users can and
3605 cannot write. Object-oriented protocol specification is inherently
3606 about specifying leeway, and this seems difficult using current
3607 technology.</p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-impl-restrictions"></a>29.2.2.1.2. Restrictions on Implementations</h5></div></div></div><p>Implementations are allowed latitude to modify the structure of
3608 specified classes and methods. This includes: the interposition of
3609 implementation-specific classes; the promotion of specified methods; and
3610 the consolidation of two or more specified methods into a single method
3611 specialized to interposed classes.</p><p>Any such modifications are permitted only so long as for any
3612 portable class <em class="replaceable"><code>k</code></em> that is a subclass of one or more specified classes
3613 <em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em>, the following conditions are met:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">In the actual class precedence list of <em class="replaceable"><code>k</code></em>, the
3614 classes <em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em> must appear in the same order as they would
3615 have if no implementation-specific modifications had been made.
3616 </li><li class="listitem">The method applicability of any specified generic
3617 function must be the same in terms of behavior as it would have been
3618 had no implementation-specific changes been made. This includes
3619 specified generic functions that have had portable methods added. In
3620 this context, the expression <span class="quote">“<span class="quote">the same in terms of
3621 behavior</span>”</span> means that methods with the same behavior as those
3622 specified are applicable, and in the same order.</li><li class="listitem">No portable class <em class="replaceable"><code>k</code></em> may inherit, by virtue of
3623 being a direct or indirect subclass of a specified class, any slot for
3624 which the name is a symbol accessible in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package or
3625 exported by any package defined in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li><li class="listitem">Implementations are free to define
3626 implementation-specific before- and after-methods on specified generic
3627 functions. Implementations are also free to define
3628 implementation-specific around-methods with extending behavior.
3629 </li></ul></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-ui-macro"></a>29.2.3. Processing of the User Interface Macros</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></div><p>A list in which the first element is one of the symbols
3630 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a>,
3631 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top"><code class="function">CLOS:GENERIC-FUNCTION</code></a>, <a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a> or <a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a>, and which has proper
3632 syntax for that macro is called a <strong class="first"><em class="firstterm">user interface macro
3633 form</em></strong>. This document provides an extended specification of
3634 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macros.</p><p>The user interface macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
3635 can be used not only to define metaobjects that are instances of the
3636 corresponding standard metaobject class, but also to define metaobjects
3637 that are instances of appropriate portable metaobject classes. To make
3638 it possible for portable metaobject classes to properly process the
3639 information appearing in the macro form, this document provides a
3640 limited specification of the processing of these macro forms.</p><p>User interface macro forms can be <span class="emphasis"><em>evaluated</em></span>
3641 or <span class="emphasis"><em>compiled</em></span> and later <span class="emphasis"><em>executed</em></span>.
3642 The effect of evaluating or executing a user interface macro form is
3643 specified in terms of calls to specified functions and generic functions
3644 which provide the actual behavior of the macro. The arguments received
3645 by these functions and generic functions are derived in a specified way
3646 from the macro form.</p><p>Converting a user interface macro form into the arguments to the
3647 appropriate functions and generic functions has two major aspects: the
3648 conversion of the macro argument syntax into a form more suitable for
3649 later processing, and the processing of macro arguments which are forms
3650 to be evaluated (including method bodies).</p><p>In the syntax of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, the <em class="replaceable"><code>initform</code></em>
3651 and <em class="replaceable"><code>default-initarg-initial-value-form</code></em>
3652 arguments are forms which will be evaluated one or more times after the
3653 macro form is evaluated or executed. Special processing must be done on
3654 these arguments to ensure that the lexical scope of the forms is
3655 captured properly. This is done by building a function of zero
3656 arguments which, when called, returns the result of evaluating the form
3657 in the proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><p>In the syntax of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro
3658 the <em class="replaceable"><code>forms</code></em> argument is a list of forms that
3659 comprise the body of the method definition. This list of forms must be
3660 processed specially to capture the lexical scope of the macro form. In
3661 addition, the lexical functions available only in the body of methods
3662 must be introduced. To allow this and any other special processing
3663 (such as slot access optimization), a specializable protocol is used for
3664 processing the body of methods.
3665 This is discussed in <a class="xref" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">Section 29.6.3.1.1, “Processing Method Bodies”</a>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-compile-ui-macro"></a>29.2.3.1. Compile-file Processing of the User Interface Macros</h4></div></div></div><p>It is a common practice for <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> compilers, while processing a file
3666 or set of files, to maintain information about the definitions that have
3667 been compiled so far. Among other things, this makes it possible to
3668 ensure that a global macro definition (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> form) which appears in
3669 a file will affect uses of the macro later in that file.
3670 This information about the state of the compilation is called the
3671 <strong class="first"><em class="firstterm"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environment</em></strong>.</p><p>When compiling files containing <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> definitions, it is useful
3672 to maintain certain additional information in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environment.
3673 This can make it possible to issue various kinds of warnings (e.g.,
3674 <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> congruence) and to do various performance optimizations that
3675 would not otherwise be possible.</p><p>At this time, there is such significant variance in the way
3676 existing <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations handle <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environments that it
3677 would be premature to specify this mechanism. Consequently, this
3678 document specifies only the behavior of evaluating or executing user
3679 interface macro forms. What functions and generic functions are called
3680 during <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> processing of a user interface macro form is not
3681 specified. Implementations are free to define and document their own
3682 behavior. Users may need to check implementation-specific behavior
3683 before attempting to compile certain portable programs.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-ov-ui-others"></a>29.2.3.2. Compile-file Processing of Specific User Interface Macros</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> evaluates <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms also at
3684 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a>.</p></div></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-meth-init-defmethod" title="29.6.3.1. Macro DEFMETHOD">Section 29.6.3.1, “Macro <code class="function">DEFMETHOD</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does <span class="strong"><strong>not</strong></span> evaluate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
3685 forms at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> except as necessary for signature checking.
3686 </p></div></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-gf-init-defgeneric" title="29.5.3.1. Macro DEFGENERIC">Section 29.5.3.1, “Macro <code class="function">DEFGENERIC</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does <span class="strong"><strong>not</strong></span> evaluate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>
3687 forms at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> except as necessary for signature checking.
3688 </p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-ov-mo-init"></a>29.2.4. Metaobject Initialization Protocol</h3></div></div></div><p>Like other objects, metaobjects can be created by calling
3689 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The initialization arguments passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
3690 are used to initialize the metaobject in the usual way. The set of
3691 legal initialization arguments, and their interpretation, depends on the
3692 kind of metaobject being created. Implementations and portable programs
3693 are free to extend the set of legal initialization arguments. Detailed
3694 information about the initialization of each kind of metaobject are
3695 provided in the appropriate sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-cl-reinit-mo" title="29.3.5.2. Reinitialization of class metaobjects">Section 29.3.5.2, “Reinitialization of class metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-cl-finalization" title="29.3.4. Class Finalization Protocol">Section 29.3.4, “Class Finalization Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances">Section 29.10.2, “Funcallable Instances”</a></li><li class="listitem"><a class="xref" href="#mop-gf-invocation" title="29.5.3.2. Generic Function Invocation Protocol">Section 29.5.3.2, “Generic Function Invocation Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a></li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-classes"></a>29.3. Classes</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-defclass"></a>29.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a></h3></div></div></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form results in a call
3696 to the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function. The arguments received by <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
3697 are derived from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form in a defined way. The exact
3698 macro-expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form is not defined, only the
3699 relationship between the arguments to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro and the
3700 arguments received by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function. Examples of typical
3701 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms and sample expansions are shown in the following two
3702 examples:
3703 </p><div class="informalexample"><a id="mop-cl-defclass-ex-1"></a><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form with
3704 standard slot and class options and an expansion of it that would
3705 result in the proper call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><pre class="programlisting">
3706 (defclass plane (moving-object graphics-object)
3707 ((altitude :initform 0 :accessor plane-altitude)
3708 (speed))
3709 (:default-initargs :engine *jet*))
3710
3711 (ensure-class 'plane
3712 ':direct-superclasses '(moving-object graphics-object)
3713 ':direct-slots (list (list ':name 'altitude
3714 ':initform '0
3715 ':initfunction #'(lambda () 0)
3716 ':readers '(plane-altitude)
3717 ':writers '((setf plane-altitude)))
3718 (list ':name 'speed))
3719 ':direct-default-initargs (list (list ':engine
3720 '*jet*
3721 #'(lambda () *jet*))))
3722 </pre></div><p>
3723 </p><div class="informalexample"><a id="mop-cl-defclass-ex-2"></a><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form
3724 with non-standard class and slot options, and an expansion of it which
3725 results in the proper call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>. Note that the order of
3726 the slot options has not affected the order of the properties in the
3727 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>, but has affected the order of the elements
3728 in the lists which are the values of those properties.</p><pre class="programlisting">
3729 (defclass sst (plane)
3730 ((mach mag-step 2
3731 locator sst-mach
3732 locator mach-location
3733 :reader mach-speed
3734 :reader mach))
3735 (:metaclass faster-class)
3736 (another-option foo bar))
3737
3738 (ensure-class 'sst
3739 ':direct-superclasses '(plane)
3740 ':direct-slots (list (list ':name 'mach
3741 ':readers '(mach-speed mach)
3742 'mag-step '2
3743 'locator '(sst-mach mach-location)))
3744 ':metaclass 'faster-class
3745 'another-option '(foo bar))
3746 </pre></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>name</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>
3747 becomes the value of the first argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>. This is
3748 the only positional argument accepted by <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>; all other
3749 arguments are keyword arguments.</li><li class="listitem">The <code class="constant">:DIRECT-SUPERCLASSES</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>
3750 becomes the value of the <code class="constant">:DIRECT-SUPERCLASSES</code> keyword argument to
3751 <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</li><li class="listitem"><p class="simpara">The <code class="constant">:DIRECT-SLOTS</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> becomes
3752 the value of the <code class="constant">:DIRECT-SLOTS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
3753 Special processing of this value is done to regularize the form of
3754 each slot specification and to properly capture the lexical scope of
3755 the initialization forms. This is done by converting each slot
3756 specification to a property list called a
3757 <strong class="first"><em class="firstterm">canonicalized slot specification</em></strong>.
3758 The resulting list of <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s is the value
3759 of the <code class="constant">:DIRECT-SLOTS</code> keyword argument.</p><p><a id="mop-canonicalized-slot-spec"></a>Canonicalized slot
3760 specifications are later used as the keyword arguments to a generic
3761 function which will, in turn, pass them to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> for use as
3762 a set of initialization arguments. Each <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> is
3763 formed from the corresponding slot specification as follows:
3764 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">The name of the slot is the value of the <code class="constant">:NAME</code>
3765 property. This property appears in every
3766 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</li><li class="listitem">When the <code class="constant">:INITFORM</code> slot option is present in
3767 the slot specification, then both the <code class="constant">:INITFORM</code> and
3768 <code class="constant">:INITFUNCTION</code> properties are present in the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
3769 The value of the <code class="constant">:INITFORM</code> property is the
3770 initialization form. The value of the <code class="constant">:INITFUNCTION</code> property is
3771 a function of zero arguments which, when called, returns the result
3772 of evaluating the initialization form in its proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.
3773 </li><li class="listitem">If the <code class="constant">:INITFORM</code> slot option is not present in
3774 the slot specification, then either the <code class="constant">:INITFUNCTION</code> property
3775 will not appear, or its value will be false. In such cases, the
3776 value of the <code class="constant">:INITFORM</code> property, or whether it appears, is
3777 unspecified.</li><li class="listitem">The value of the <code class="constant">:INITARGS</code> property is a list
3778 of the values of each <code class="constant">:INITARG</code> slot option. If there are no
3779 <code class="constant">:INITARG</code> slot options, then either the <code class="constant">:INITARGS</code> property
3780 will not appear or its value will be the empty list.
3781 </li><li class="listitem">The value of the <code class="constant">:READERS</code> property is a list of
3782 the values of each <code class="constant">:READER</code> and <code class="constant">:ACCESSOR</code> slot option. If
3783 there are no <code class="constant">:READER</code> or <code class="constant">:ACCESSOR</code> slot options, then either
3784 the <code class="constant">:READERS</code> property will not appear or its value will be the
3785 empty list.</li><li class="listitem">The value of the <code class="constant">:WRITERS</code> property is a list of
3786 the values specified by each <code class="constant">:WRITER</code> and <code class="constant">:ACCESSOR</code> slot
3787 option. The value specified by a <code class="constant">:WRITER</code> slot option is just
3788 the value of the slot option. The value specified by an
3789 <code class="constant">:ACCESSOR</code> slot option is a two element list: the first element
3790 is the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>, the second element is the value of the slot
3791 option. If there are no <code class="constant">:WRITER</code> or <code class="constant">:ACCESSOR</code> slot options,
3792 then either the <code class="constant">:WRITERS</code> property will not appear or its value
3793 will be the empty list.</li><li class="listitem">The value of the <code class="constant">:DOCUMENTATION</code> property is the
3794 value of the <code class="constant">:DOCUMENTATION</code> slot option. If there is no
3795 <code class="constant">:DOCUMENTATION</code> slot option, then either the <code class="constant">:DOCUMENTATION</code>
3796 property will not appear or its value will be false.
3797 </li><li class="listitem">All other slot options appear as the values of
3798 properties with the same name as the slot option. Note that this
3799 includes not only the remaining standard slot options
3800 (<code class="constant">:ALLOCATION</code> and <code class="constant">:TYPE</code>), but also any other options and
3801 values appearing in the slot specification. If one of these slot
3802 options appears more than once, the value of the property will be a
3803 list of the specified values.</li><li class="listitem">An implementation is free to add additional
3804 properties to the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> provided these
3805 are not symbols accessible in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, or exported by
3806 any package defined in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li></ul></div></li><li class="listitem"><p class="simpara">The <code class="constant">:DEFAULT-INITARGS</code> class
3807 option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
3808 the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
3809 Special processing of this value is done to properly capture the
3810 lexical scope of the default value forms. This is done by converting
3811 each default initarg in the class option into a
3812 <strong class="first"><em class="firstterm">canonicalized default initialization argument</em></strong>.
3813 The resulting list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s is the value of
3814 the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
3815 </p><p class="simpara"><a id="mop-canonicalized-default-initarg"></a>A canonicalized default
3816 initarg is a list of three elements. The first element is the name;
3817 the second is the actual form itself; and the third is a function of
3818 zero arguments which, when called, returns the result of evaluating
3819 the default value form in its proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:DEFAULT-INITARGS</code>
3820 class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
3821 <code class="constant">:DIRECT-DEFAULT-INITARGS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
3822 fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
3823 the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">The <code class="constant">:METACLASS</code> class
3824 option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
3825 the <code class="constant">:METACLASS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:METACLASS</code>
3826 class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
3827 <code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
3828 fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
3829 the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">The <code class="constant">:DOCUMENTATION</code> class
3830 option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
3831 the <code class="constant">:DOCUMENTATION</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:DOCUMENTATION</code>
3832 class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
3833 <code class="constant">:DIRECT-DEFAULT-INITARGS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
3834 fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
3835 the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">Any other class options become the value of keyword
3836 arguments with the same name. The value of the keyword argument is
3837 the tail of the class option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if any class
3838 option appears more than once in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The default initargs of the
3839 <code class="constant">:METACLASS</code> are added at the end of the list
3840 of arguments to pass to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
3841 fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
3842 the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li></ul></div><p>In the call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>, every element of its arguments
3843 appears in the same left-to-right order as the corresponding element of
3844 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, except that the order of the properties of
3845 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s is unspecified. The values of
3846 properties in <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s do follow this ordering
3847 requirement. Other ordering relationships in the keyword arguments to
3848 <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> are unspecified.</p><p>The result of the call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> is returned as the result
3849 of evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-Inheritance"></a>29.3.2. Inheritance Structure of <a class="link" href="#mop-class-mo">class metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-cl-Inheritance-fig"></a><p class="title"><strong>Figure 29.2. Inheritance structure of <a class="link" href="#mop-class-mo">class metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-class.png" width="100%" alt="Inheritance structure of class metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-readers"></a>29.3.3. Introspection: Readers for <a class="link" href="#mop-class-mo">class metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></div><p>In this and the following sections, the <span class="quote">“<span class="quote">reader</span>”</span>
3850 generic functions which simply return information associated with a
3851 particular kind of metaobject are presented together. General
3852 information is presented first, followed by a description of the purpose
3853 of each, and ending with the specified methods for these generic
3854 functions.</p><p>The reader generic functions which simply return information
3855 associated with <a class="link" href="#mop-class-mo">class metaobject</a>s are presented together in this section.</p><p>Each of the reader generic functions for <a class="link" href="#mop-class-mo">class metaobject</a>s has the same
3856 syntax, accepting one required argument called <em class="replaceable"><code>class</code></em>, which must be
3857 a <a class="link" href="#mop-class-mo">class metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if
3858 the <a class="link" href="#mop-class-mo">class metaobject</a> has not been initialized.</p><p>These
3859 generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
3860 will not be mutated by the implementation. The results are undefined if a
3861 portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-name"></a>29.3.3.1. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns the name of <em class="replaceable"><code>class</code></em>. This value can be any Lisp object,
3862 but is usually a symbol, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the class has no name. This is the
3863 defaulted value of the <code class="constant">:NAME</code> initialization argument that was
3864 associated with the class during initialization or reinitialization.
3865 (Also see <a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a>.)
3866 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-superclasses"></a>29.3.3.2. Generic Function <a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the direct superclasses of <em class="replaceable"><code>class</code></em>. The
3867 elements of this list are <a class="link" href="#mop-class-mo">class metaobject</a>s. The empty list is returned if
3868 <em class="replaceable"><code>class</code></em> has no direct superclasses. This is the defaulted value of
3869 the <code class="constant">:DIRECT-SUPERCLASSES</code> initialization argument that was associated
3870 with the class during initialization or reinitialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>For a class that has not yet been finalized,
3871 the returned list may contain <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances as
3872 placeholder for classes that were not yet defined when finalization of
3873 the class was last attempted.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-slots"></a>29.3.3.3. Generic Function <a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a set of the direct slots of <em class="replaceable"><code>class</code></em>. The elements of
3874 this set are <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. If the class has no direct slots, the empty set
3875 is returned. This is the defaulted value of the <code class="constant">:DIRECT-SLOTS</code>
3876 initialization argument that was associated with the class during
3877 initialization and reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-default-initargs"></a>29.3.3.4. Generic Function <a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the direct default initialization arguments for
3878 <em class="replaceable"><code>class</code></em>. Each element of this list is a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.
3879 The empty list is returned if <em class="replaceable"><code>class</code></em> has no
3880 direct default initialization arguments. This is the defaulted value of
3881 the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> initialization argument that was
3882 associated with the class during initialization or reinitialization.
3883 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="cpl"></a>29.3.3.5. Generic Function <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns the class precedence list of <em class="replaceable"><code>class</code></em>.
3884 The elements of this list are <a class="link" href="#mop-class-mo">class metaobject</a>s.</p><p>During class finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
3885 <a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a> to compute the class precedence list of the class. That
3886 value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and is returned by <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
3887 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-subclasses"></a>29.3.3.6. Generic Function <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a set of the direct subclasses of <em class="replaceable"><code>class</code></em>. The elements
3888 of this set are <a class="link" href="#mop-class-mo">class metaobject</a>s that all mention this class among their direct
3889 superclasses. The empty set is returned if <em class="replaceable"><code>class</code></em> has no direct
3890 subclasses. This value is maintained by the generic functions
3891 <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> and <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The set of direct subclasses of a class is
3892 internally managed as a <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>. Therefore the existence of
3893 the <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a> function does not prevent otherwise
3894 unreferenced classes from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-slots"></a>29.3.3.7. Generic Function <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a possibly empty set of the slots accessible in instances
3895 of <em class="replaceable"><code>class</code></em>. The elements of this set are <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><p>During class finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
3896 <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> to compute the slots of the class. That value is
3897 associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and is returned by <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
3898 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-default-initargs"></a>29.3.3.8. Generic Function <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the default initialization arguments for <em class="replaceable"><code>class</code></em>.
3899 Each element of this list is a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.
3900 The empty list is returned if <em class="replaceable"><code>class</code></em> has no
3901 default initialization arguments.</p><p>During finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
3902 <a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a> to compute the default initialization
3903 arguments for the class. That value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and
3904 is returned by <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been
3905 finalized.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-finalized-p"></a>29.3.3.9. Generic Function <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns true if <em class="replaceable"><code>class</code></em> has been finalized. Returns false
3906 otherwise. Also returns false if the <em class="replaceable"><code>class</code></em> has not been initialized.
3907 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-prototype"></a>29.3.3.10. Generic Function <a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a prototype instance of <em class="replaceable"><code>class</code></em>. Whether the instance
3908 is initialized is not specified. The results are undefined if a
3909 portable program modifies the binding of any slot of a prototype instance.
3910 </p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
3911 </p><div class="informalexample"><a id="class-prototype-ex"></a><p>This allows non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3]
3912 access to slots with allocation <code class="constant">:CLASS</code>:</p><pre class="programlisting">
3913 (defclass counter ()
3914 ((count :allocation :class :initform 0 :reader how-many)))
3915 (defmethod initialize-instance :after ((obj counter) &amp;rest args)
3916 (incf (slot-value obj 'count)))
3917 (defclass counted-object (counter) ((name :initarg :name)))
3918 </pre><p>
3919 Now one can find out how many <code class="classname">COUNTED-OBJECT</code>s
3920 have been created by using
3921 <code class="code">(HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'COUNTER)))</code>:
3922 </p><pre class="programlisting">
3923 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> 'counted-object :name 'foo)
3924 ⇒ <code class="computeroutput">#&lt;COUNTED-OBJECT #x203028C9&gt;</code>
3925 (HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'counter)))
3926 ⇒ <code class="computeroutput">1</code>
3927 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> 'counted-object :name 'bar)
3928 ⇒ <code class="computeroutput">#&lt;COUNTED-OBJECT #x20306CB1&gt;</code>
3929 (HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'counter)))
3930 ⇒ <code class="computeroutput">2</code>
3931 </pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-readers-methods"></a>29.3.3.11. Methods</h4></div></div></div><p>The specified methods for the <a class="link" href="#mop-class-mo">class metaobject</a> reader generic
3932 functions are presented below.</p><p>Each entry in the table indicates a method on one of the reader
3933 generic functions, specialized to a specified class.
3934 The number in each entry is a reference to the full description of the method.
3935 The full descriptions appear after the table.
3936 </p><div class="informaltable"><a id="mop-cl-readers-methods-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Generic Function</th><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a></th><th align="center"><a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a></th><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-8">8</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></td><td align="center"><a class="xref" href="#CRM-9">9</a></td><td align="center"><a class="xref" href="#CRM-9">9</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-6">6</a></td><td align="center"><a class="xref" href="#CRM-5">5</a></td></tr><tr><td align="center"><a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td></tr></tbody></table></div><div class="orderedlist"><p class="title"><strong>Class Reader Methods</strong></p><ol class="orderedlist" type="1"><li class="listitem"><a id="CRM-1"></a>This method returns the value which was
3937 associated with the <a class="link" href="#mop-class-mo">class metaobject</a> during initialization or
3938 reinitialization.</li><li class="listitem"><a id="CRM-2"></a>This method returns the value associated
3939 with the <a class="link" href="#mop-class-mo">class metaobject</a> by <span class="method"><code class="literal"><a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
3940 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span> or
3941 <span class="method"><code class="literal"><a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
3942 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span></li><li class="listitem"><a id="CRM-3"></a>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</li><li class="listitem"><a id="CRM-4"></a>This method returns the empty list.
3943 </li><li class="listitem"><a id="CRM-5"></a>This method returns true.</li><li class="listitem"><a id="CRM-6"></a>This method returns false.</li><li class="listitem"><a id="CRM-7"></a>This method returns a value derived from
3944 the information in <a class="xref" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes">Table 29.1, “Direct Superclass Relationships Among The Specified Metaobject Classes”</a>, except that
3945 implementation-specific modifications are permitted as described in
3946 <a class="xref" href="#mop-ov-impl-and-user-spec" title="29.2.2.1. Implementation and User Specialization">Section 29.2.2.1, “Implementation and User Specialization”</a>.</li><li class="listitem"><a id="CRM-8"></a>This method returns the name of the
3947 built-in class.</li><li class="listitem"><a id="CRM-9"></a>This method returns a value which is
3948 maintained by <span class="method"><code class="literal"><a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>
3949 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span> and <span class="method"><code class="literal"><a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
3950 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span>.
3951 This method can be overridden only if those methods are overridden as
3952 well.</li><li class="listitem"><a id="CRM-10"></a>No behavior is specified for this
3953 method beyond that which is specified for the generic function.</li></ol></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-finalization"></a>29.3.4. Class Finalization Protocol</h3></div></div></div><p>Class <strong class="first"><em class="firstterm">finalization
3954 <a id="class-finalization" class="indexterm"></a>
3955 </em></strong> is the process of computing the information a class
3956 inherits from its superclasses and preparing to actually allocate
3957 instances of the class.
3958 The class finalization process includes computing the class's class
3959 precedence list, the full set of slots accessible in instances of the
3960 class and the full set of default initialization arguments for the class.
3961 These values are associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be accessed by
3962 calling the appropriate reader.
3963 In addition, the class finalization process makes decisions about how
3964 instances of the class will be implemented.</p><p>To support forward-referenced superclasses, and to account for the
3965 fact that not all classes are actually instantiated, class finalization
3966 is not done as part of the initialization of the <a class="link" href="#mop-class-mo">class metaobject</a>. Instead,
3967 finalization is done as a separate protocol, invoked by calling the
3968 generic function <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>. The exact point at which
3969 <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called depends on the class of the <a class="link" href="#mop-class-mo">class metaobject</a>; for
3970 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> it is called sometime after all the classes
3971 superclasses are defined, but no later than when the first instance of
3972 the class is allocated (by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>).</p><p>The first step of class finalization is computing the class
3973 precedence list. Doing this first allows subsequent steps to access the
3974 class precedence list. This step is performed by calling the generic
3975 function <a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a>. The value returned from this call is associated
3976 with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be accessed by calling the <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a> generic
3977 function.</p><p>The second step is computing the full set of slots that will be
3978 accessible in instances of the class. This step is performed by calling
3979 the generic function <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>. The result of this call is a list
3980 of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. This value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can
3981 be accessed by calling the <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a> generic function.</p><p>The behavior of <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is itself layered, consisting of
3982 calls to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a>.</p><p>The final step of class finalization is computing the full set of
3983 initialization arguments for the class. This is done by calling the
3984 generic function <a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>. The value returned by this
3985 generic function is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be
3986 accessed by calling <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p>If the class was previously finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> may
3987 call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_mak_ces-obsolete.html" target="_top"><code class="function">MAKE-INSTANCES-OBSOLETE</code></a>. The circumstances under which this
3988 happens are described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
3989 <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>.</p><p>Forward-referenced classes, which provide a temporary definition
3990 for a class which has been referenced but not yet defined, can never be
3991 finalized. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called on a
3992 forward-referenced class.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-init"></a>29.3.5. Class Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-init-mo"></a>29.3.5.1. Initialization of <a class="link" href="#mop-class-mo">class metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></div><p>A <a class="link" href="#mop-class-mo">class metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.
3993 The initialization arguments establish the definition of the class.
3994 A <a class="link" href="#mop-class-mo">class metaobject</a> can be redefined by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
3995 Some classes of <a class="link" href="#mop-class-mo">class metaobject</a> do not support redefinition;
3996 in these cases, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-class-mo">class metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
3997 and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Reinitialization of a
3998 <a class="link" href="#mop-class-mo">class metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
3999 Portable programs must <span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
4000 initialize a <a class="link" href="#mop-class-mo">class metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
4001 initialize or reinitialize a <a class="link" href="#mop-class-mo">class metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
4002 <a class="link" href="#mop-class-mo">class metaobject</a> or to turn a non-class object into a
4003 <a class="link" href="#mop-class-mo">class metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined,
4004 no behavior is specified for the result of calls to
4005 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-class-mo">class metaobject</a>s.
4006 Since the class of <a class="link" href="#mop-class-mo">class metaobject</a>s may not be changed,
4007 no behavior is specified for the result of calls to
4008 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-class-mo">class metaobject</a>s.</p><p>During initialization or reinitialization, each initialization
4009 argument is checked for errors and then associated with the <a class="link" href="#mop-class-mo">class metaobject</a>.
4010 The value can then be accessed by calling the appropriate accessor as
4011 shown in <a class="xref" href="#class-mo-initargs" title="Table 29.2. Initialization arguments and accessors for class metaobjects">Table 29.2, “Initialization arguments and accessors for class metaobjects”</a>.</p><p>This section begins with a description of the error checking and
4012 processing of each initialization argument. This is followed by a table
4013 showing the generic functions that can be used to access the stored
4014 initialization arguments. Initialization behavior specific to the
4015 different specified <a class="link" href="#mop-class-mo">class metaobject</a> classes comes next. The section ends with a
4016 set of restrictions on portable methods affecting <a class="link" href="#mop-class-mo">class metaobject</a> initialization
4017 and reinitialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
4018 <em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
4019 supplied, initialization or reinitialization is performed as if
4020 <em class="replaceable"><code>value</code></em> had been supplied. For some initialization arguments this
4021 could be done by the use of default initialization arguments, but
4022 whether it is done this way is not specified. Implementations are free
4023 to define default initialization arguments for specified <a class="link" href="#mop-class-mo">class metaobject</a> classes.
4024 Portable programs are free to define default initialization arguments
4025 for portable subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>.</p><p>Unless there is a specific note to the
4026 contrary, then during reinitialization, if an initialization argument
4027 is not supplied, the previously stored value is left unchanged.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:DIRECT-DEFAULT-INITARGS</code> argument is a list
4028 of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if any
4029 element of the list is not a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.</p><p class="simpara">If the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, this argument
4030 defaults to the empty list.</p></li><li class="listitem"><p class="simpara"> The <code class="constant">:DIRECT-SLOTS</code> argument is a list of
4031 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if any
4032 element of the list is not a <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</p><p>After error checking, this value is converted to a
4033 list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s before it is associated with the <a class="link" href="#mop-class-mo">class metaobject</a>. Conversion
4034 of each <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is a two-step process.
4035 First, the generic function <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> is called with the <a class="link" href="#mop-class-mo">class metaobject</a> and
4036 the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to determine the class of the new
4037 <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>; this permits both the <a class="link" href="#mop-class-mo">class metaobject</a> and the
4038 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to control the resulting <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> class.
4039 Second, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> is applied to the direct <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> class and the
4040 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
4041 This conversion could be implemented as shown in the
4042 following code:</p><pre class="programlisting">
4043 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> convert-to-direct-slot-definition (class canonicalized-slot)
4044 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
4045 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a>
4046 class canonicalized-slot)
4047 canonicalized-slot))
4048 </pre><p class="simpara">If the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, this argument defaults to
4049 the empty list.</p><p class="simpara">Once the <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s have been created, the specified reader and
4050 writer methods are created. The generic functions
4051 <a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a> and <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a> are called to
4052 determine the classes of the <a class="link" href="#mop-method-mo">method metaobject</a>s created.</p></li><li class="listitem"><p class="simpara"> The <code class="constant">:DIRECT-SUPERCLASSES</code> argument is a list of
4053 <a class="link" href="#mop-class-mo">class metaobject</a>s. Classes which do not support multiple inheritance
4054 signal an error if the list contains more than one element.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if
4055 <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> applied to <em class="replaceable"><code>class</code></em> and any element of this
4056 list returns false.</p><p class="simpara">When the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, and this argument is
4057 either not supplied or is the empty list, this argument defaults as
4058 follows: if the class is an instance of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> or one of
4059 its subclasses the default value is a list of the class
4060 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>; if the class is an instance of
4061 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> or one of its subclasses the default
4062 value is a list of the class
4063 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the class is an instance of
4064 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> or one of its subclasses the default value is a
4065 list of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a></p></div><p class="simpara">After any defaulting of the value, the generic function
4066 <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> is called once for each element of the list.
4067 </p><p class="simpara">When the <a class="link" href="#mop-class-mo">class metaobject</a> is being reinitialized and this
4068 argument is supplied, the generic function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
4069 is called once for each <a class="link" href="#mop-class-mo">class metaobject</a> in the previously stored value but not
4070 in the new value; the generic function <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> is
4071 called once for each <a class="link" href="#mop-class-mo">class metaobject</a> in the new value but not in the
4072 previously stored value.</p></li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
4073 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
4074 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li><li class="listitem"><p class="simpara">The <code class="constant">:NAME</code> argument is an object.</p><p class="simpara">If the class is being initialized, this argument defaults to
4075 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></li></ul></div><p>After the processing and defaulting of initialization arguments
4076 described above, the value of each initialization argument is associated
4077 with the <a class="link" href="#mop-class-mo">class metaobject</a>. These values can then be accessed by calling
4078 the corresponding generic function. The correspondences are as follows:
4079 </p><div class="table"><a id="class-mo-initargs"></a><p class="title"><strong>Table 29.2. Initialization arguments and
4080 accessors for <a class="link" href="#mop-class-mo">class metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and&#10; accessors for class metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:DIRECT-DEFAULT-INITARGS</code></td><td align="center"><a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></td></tr><tr><td align="center"><code class="constant">:DIRECT-SLOTS</code></td><td align="center"><a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></td></tr><tr><td align="center"><code class="constant">:DIRECT-SUPERCLASSES</code></td><td align="center"><a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><p>Instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> support multiple
4081 inheritance and reinitialization. Instances of the class
4082 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> support multiple inheritance and
4083 reinitialization. For <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>es, all of the
4084 initialization arguments default to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>Instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> do
4085 not support multiple inheritance and reinitialization.
4086 </p></div><p>Since built-in classes cannot be created or reinitialized by the
4087 user, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>
4088 are called to initialize or reinitialize a derived instance of the class
4089 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="class-mo-init-methods"></a>29.3.5.1.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization and
4090 reinitialization behavior described above. Instead, the information
4091 needed to allow portable programs to specialize this behavior is
4092 presented as a set of restrictions on the methods a portable program can
4093 define. The model is that portable initialization methods have access
4094 to the <a class="link" href="#mop-class-mo">class metaobject</a> when either all or none of the specified initialization
4095 has taken effect.</p><p>These restrictions govern the methods that a portable program can
4096 define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
4097 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.
4098 These restrictions apply only to methods on these generic functions for
4099 which the first specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>.
4100 Other portable methods on these generic functions are not affected by
4101 these restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
4102 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>:
4103 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
4104 </li><li class="listitem">Portable programs may define around-methods, but
4105 these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
4106 are run, none of the initialization behavior described above has been
4107 completed.</li><li class="listitem">Portable after-methods must assume that when they
4108 are run, all of the initialization behavior described above has been
4109 completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
4110 these restrictions are violated.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-cl-init-anon"></a>29.3.5.1.2. Initialization of Anonymous Classes</h5></div></div></div><p><a class="link" href="#mop-class-mo">class metaobject</a>s created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are usually <strong class="first"><em class="firstterm">anonymous
4111 <a id="class-anonymous" class="indexterm"></a>
4112 </em></strong>; that is, they have no <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a>.
4113 An anonymous <a class="link" href="#mop-class-mo">class metaobject</a> can be given a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> using
4114 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>)</code> and
4115 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>)</code>.</p><p>When a <a class="link" href="#mop-class-mo">class metaobject</a> is created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, it is initialized
4116 in the usual way. The initialization arguments passed to
4117 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are use to establish the definition of the class. Each
4118 initialization argument is checked for errors and associated with the
4119 <a class="link" href="#mop-class-mo">class metaobject</a>. The initialization arguments correspond roughly to the
4120 arguments accepted by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, and more closely to the
4121 arguments accepted by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function.</p><p>Some <a class="link" href="#mop-class-mo">class metaobject</a> classes allow their instances to be
4122 redefined. When permissible, this is done by calling
4123 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>. This is discussed in the
4124 <a class="link" href="#mop-cl-reinit-mo" title="29.3.5.2. Reinitialization of class metaobjects">next section</a>.</p><p>An example of creating an anonymous class directly using
4125 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> follows:</p><pre class="programlisting">
4126 (flet ((zero () 0)
4127 (propellor () *propellor*))
4128 (make-instance 'standard-class
4129 :name '(my-class foo)
4130 :direct-superclasses (list (find-class 'plane)
4131 another-anonymous-class)
4132 :direct-slots `((:name x
4133 :initform 0
4134 :initfunction ,#'zero
4135 :initargs (:x)
4136 :readers (position-x)
4137 :writers ((setf position-x)))
4138 (:name y
4139 :initform 0
4140 :initfunction ,#'zero
4141 :initargs (:y)
4142 :readers (position-y)
4143 :writers ((setf position-y))))
4144 :direct-default-initargs `((:engine *propellor* ,#'propellor))))
4145 </pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-reinit-mo"></a>29.3.5.2. Reinitialization of <a class="link" href="#mop-class-mo">class metaobject</a>s</h4></div></div></div><p>Some <a class="link" href="#mop-class-mo">class metaobject</a> classes allow their instances to be reinitialized.
4146 This is done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>. The initialization
4147 arguments have the same interpretation as in class initialization.</p><p>If the <a class="link" href="#mop-class-mo">class metaobject</a> was finalized before the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>,
4148 <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> will be called again once all the initialization
4149 arguments have been processed and associated with the <a class="link" href="#mop-class-mo">class metaobject</a>.
4150 In addition, once finalization is complete, any dependents of the
4151 <a class="link" href="#mop-class-mo">class metaobject</a> will be updated by calling <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-customize"></a>29.3.6. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-class-name"></a>29.3.6.1. Generic Function <a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a> <em class="replaceable"><code>new-name</code></em>
4152 <em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>new-name</code></em></span></dt><dd>any Lisp object.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-name</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function changes the name of <em class="replaceable"><code>class</code></em> to <em class="replaceable"><code>new-name</code></em>.
4153 This value is usually a symbol, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the class has no name.</p><p class="simpara">This function works by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> with
4154 <em class="replaceable"><code>class</code></em> as its first argument, the symbol <code class="constant">:NAME</code> as its second
4155 argument and <em class="replaceable"><code>new-name</code></em> as its third argument.
4156 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-class"></a>29.3.6.2. Generic Function <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
4157 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>.</dd><dt><span class="term">keyword arguments</span></dt><dd>Some of the keyword arguments accepted by this
4158 function are actually processed by <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>,
4159 others are processed during initialization of the <a class="link" href="#mop-class-mo">class metaobject</a>
4160 (as described in <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>).
4161 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to define or redefine a
4162 class with the specified name, and can be called by the user or the
4163 implementation. It is the functional equivalent of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, and
4164 is called by the expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro.</p><p class="simpara">The behavior of this function is actually implemented by the
4165 generic function <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>. When <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> is called,
4166 it immediately calls <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> and returns that result as its
4167 own.</p><p>The first argument to <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> is computed as
4168 follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>name</code></em> names a class (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> returns a
4169 class when called with <em class="replaceable"><code>name</code></em>) use that class.</li><li class="listitem">Otherwise use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>
4170 The second argument is <em class="replaceable"><code>name</code></em>. The remaining arguments are the
4171 complete set of keyword arguments received by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
4172 function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-class-UC"></a>29.3.6.3. Generic Function <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
4173 <code class="constant">:DIRECT-DEFAULT-INITARGS</code> <code class="constant">:DIRECT-SLOTS</code> <code class="constant">:DIRECT-SUPERCLASSES</code>
4174 <code class="constant">:NAME</code> <code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)
4175 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a class name.</dd><dt><span class="term"><code class="constant">:METACLASS</code></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> class or a <a class="link" href="#mop-class-mo">class metaobject</a> class name. If this
4176 argument is not supplied, it defaults to the class named
4177 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. If a class name is supplied, it is interpreted
4178 as the class with that name. If a class name is supplied, but
4179 there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</dd><dt><span class="term"><code class="constant">:DIRECT-SUPERCLASSES</code></span></dt><dd>a list of which each element is a <a class="link" href="#mop-class-mo">class metaobject</a> or a
4180 class name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not a
4181 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>.</dd><dt><span class="term">additional keyword arguments</span></dt><dd>See <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>
4182 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to define or modify
4183 the definition of a named class. It is called by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
4184 function. It can also be called directly.</p><p>The first step performed by this generic function is to
4185 compute the set of initialization arguments which will be used to
4186 create or reinitialize the named class. The initialization arguments
4187 are computed from the full set of keyword arguments received by this
4188 generic function as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:METACLASS</code> argument is not included in the
4189 initialization arguments.</li><li class="listitem"><p>If the <code class="constant">:DIRECT-SUPERCLASSES</code> argument was received
4190 by this generic function, it is converted into a list of <a class="link" href="#mop-class-mo">class metaobject</a>s.
4191 This conversion does not affect the structure of the supplied
4192 <code class="constant">:DIRECT-SUPERCLASSES</code> argument. For each element in the
4193 <code class="constant">:DIRECT-SUPERCLASSES</code> argument:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">If the element is a <a class="link" href="#mop-class-mo">class metaobject</a>, that
4194 <a class="link" href="#mop-class-mo">class metaobject</a> is used.</li><li class="listitem">If the element names a class, that <a class="link" href="#mop-class-mo">class metaobject</a> is
4195 used.</li><li class="listitem"><p class="simpara">Otherwise an instance of the class
4196 <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is created and used.
4197 The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> of the newly created forward referenced
4198 <a class="link" href="#mop-class-mo">class metaobject</a> is set to the element.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>A new <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>
4199 instance is only created when one for the given class name
4200 does not yet exist; otherwise the existing one is reused.
4201 See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></div></li></ul></div></li><li class="listitem">All other keyword arguments are included directly
4202 in the initialization arguments.</li></ul></div><p class="simpara">If the <em class="replaceable"><code>class</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a new <a class="link" href="#mop-class-mo">class metaobject</a> is created
4203 by calling the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> generic function with the value of the
4204 <code class="constant">:METACLASS</code> argument as its first argument, and the previously
4205 computed initialization arguments. The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> of the
4206 newly created <a class="link" href="#mop-class-mo">class metaobject</a> is set to <em class="replaceable"><code>name</code></em>. The newly created <a class="link" href="#mop-class-mo">class metaobject</a> is
4207 returned.</p><p class="simpara">If the <em class="replaceable"><code>class</code></em> argument is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>,
4208 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called to change its class to the value specified
4209 by the <code class="constant">:METACLASS</code> argument. The <a class="link" href="#mop-class-mo">class metaobject</a> is then reinitialized with
4210 the previously initialization arguments. (This is a documented
4211 violation of the general constraint that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> may not be
4212 used with <a class="link" href="#mop-class-mo">class metaobject</a>s.)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>
4213 The <em class="replaceable"><code>class</code></em> argument cannot be a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>. See
4214 <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></div><p class="simpara">If the class of the <em class="replaceable"><code>class</code></em> argument is not the same as the
4215 class specified by the <code class="constant">:METACLASS</code> argument, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Otherwise, the <a class="link" href="#mop-class-mo">class metaobject</a> <em class="replaceable"><code>class</code></em> is redefined by calling the
4216 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> generic function with <em class="replaceable"><code>class</code></em> and the
4217 initialization arguments. The <em class="replaceable"><code>class</code></em> argument is then
4218 returned.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
4219 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:METACLASS</code>
4220 <code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
4221 function in the case where the <em class="replaceable"><code>class</code></em> argument is a class.</p><p class="simpara">This method can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
4222 (<em class="replaceable"><code>class</code></em> <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:METACLASS</code>
4223 <code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
4224 function in the case where the <em class="replaceable"><code>class</code></em> argument is a forward
4225 referenced class.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>This method does not exist.
4226 See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.
4227 Use the method specialized on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a> instead.</p></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
4228 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:METACLASS</code>
4229 <code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd>This method implements the behavior of the generic
4230 function in the case where the <em class="replaceable"><code>class</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
4231 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="finalize-inheritance"></a>29.3.6.4. Generic Function <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
4232 <em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
4233 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to finalize a <a class="link" href="#mop-class-mo">class metaobject</a>.
4234 This is described in <a class="xref" href="#mop-cl-finalization" title="29.3.4. Class Finalization Protocol">Section 29.3.4, “Class Finalization Protocol”</a>
4235 </p><p class="simpara">After <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> returns, the <a class="link" href="#mop-class-mo">class metaobject</a> is
4236 finalized and the result of calling <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> on the <a class="link" href="#mop-class-mo">class metaobject</a>
4237 will be true.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
4238 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
4239 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd>No behavior is specified for these
4240 methods beyond that which is specified for their respective generic
4241 functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
4242 (<em class="replaceable"><code>class</code></em> <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>))</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
4243 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-make-instance"></a>29.3.6.5. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
4244 <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a class name.
4245 </dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of alternating initialization argument
4246 names and values.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A newly allocated and initialized instance of <em class="replaceable"><code>class</code></em>.
4247 </dd><dt><span class="term">Purpose</span></dt><dd>The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> creates and
4248 returns a new instance of the given class. Its behavior and use is
4249 described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
4250 </dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
4251 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>This method simply invokes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
4252 recursively on the arguments <span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>
4253 <em class="replaceable"><code>class</code></em>)</code></span> and <em class="replaceable"><code>initargs</code></em>.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> (<em class="replaceable"><code>class</code></em>
4254 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> (<em class="replaceable"><code>class</code></em>
4255 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>These methods implement the behavior of
4256 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
4257 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-1.html">7.1
4258 <span class="quote">“<span class="quote">Object Creation and Initialization</span>”</span></a>.
4259 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="alloc-instance"></a>29.3.6.6. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a> <em class="replaceable"><code>class</code></em>
4260 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>alternating initialization argument names and
4261 values.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A newly allocated instance of <em class="replaceable"><code>class</code></em>
4262 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to create a new,
4263 uninitialized instance of a class. The interpretation of the concept
4264 of an <strong class="first"><em class="firstterm">uninitialized</em></strong> instance depends on the
4265 <a class="link" href="#mop-class-mo">class metaobject</a> class.</p><p class="simpara">Before allocating the new instance, <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> is
4266 called to see if <em class="replaceable"><code>class</code></em> has been finalized. If it has not been
4267 finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called before the new instance
4268 is allocated.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
4269 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em></code></span></span></dt><dd>This method allocates storage in the instance for
4270 each slot with allocation <code class="constant">:INSTANCE</code>. These slots are unbound.
4271 Slots with any other allocation are ignored by this method (no
4272 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
4273 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)
4274 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">This method allocates storage in the instance for
4275 each slot with allocation <code class="constant">:INSTANCE</code>. These slots are unbound.
4276 Slots with any other allocation are ignored by this method (no
4277 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">The funcallable instance function of the instance is
4278 undefined - the results are undefined if the instance is applied to
4279 arguments before <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a> has been used
4280 to set the funcallable instance function.
4281 </p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
4282 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
4283 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="validate-superclass"></a>29.3.6.7. Generic Function <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> <em class="replaceable"><code>class</code></em>
4284 <em class="replaceable"><code>superclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine whether
4285 the class <em class="replaceable"><code>superclass</code></em> is suitable for use as a superclass of
4286 <em class="replaceable"><code>class</code></em>.</p><p class="simpara">This generic function can be be called by the implementation
4287 or user code. It is called during <a class="link" href="#mop-class-mo">class metaobject</a> initialization and
4288 reinitialization, before the direct superclasses are stored. If this
4289 generic function returns false, the initialization or
4290 reinitialization will signal an error.
4291 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a>
4292 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p>This method returns true in three situations:
4293 </p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">If the <em class="replaceable"><code>superclass</code></em> argument is the class named <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>,
4294 </li><li class="listitem">if the class of the <em class="replaceable"><code>class</code></em> argument is the same
4295 as the class of the <em class="replaceable"><code>superclass</code></em> argument, or
4296 </li><li class="listitem">if the class of one of the arguments is
4297 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> and the class of the other is
4298 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>.</li></ol></div><p>In all other cases, this method returns false.</p><p class="simpara">This method can be overridden.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>This method also returns true in a fourth situation:
4299 </p><div class="orderedlist"><ol class="orderedlist" start="4" type="i"><li class="listitem">If the class of the <em class="replaceable"><code>class</code></em> argument is a subclass
4300 of the class of the <em class="replaceable"><code>superclass</code></em> argument.
4301 </li></ol></div></div></dd></dl></div><p><strong>Remarks. </strong>Defining a method on <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> requires detailed
4302 knowledge of of the internal protocol followed by each of the two
4303 <a class="link" href="#mop-class-mo">class metaobject</a> classes. A method on <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> which returns true
4304 for two different <a class="link" href="#mop-class-mo">class metaobject</a> classes declares that they are
4305 compatible.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-dsd-initargs"></a>29.3.6.8. Generic Function <a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
4306 <em class="replaceable"><code>slot-spec</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>slot-spec</code></em></span></dt><dd>a
4307 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of initialization arguments for a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
4308 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the initialization
4309 arguments for the direct slot definition for a slot in a class.
4310 It is called during initialization of a class. The resulting
4311 initialization arguments are passed to <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> and then to
4312 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p class="simpara">This generic function uses the supplied <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
4313 The value of <code class="constant">:NAME</code> in the returned initargs is the same as the value
4314 of <code class="constant">:NAME</code> in the supplied <em class="replaceable"><code>slot-spec</code></em> argument.
4315 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a>
4316 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>slot-spec</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a> (<em class="replaceable"><code>class</code></em>
4317 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>slot-spec</code></em>)</code></span></span></dt><dd><p class="simpara">This method returns <em class="replaceable"><code>slot-spec</code></em> unmodified.</p><p class="simpara">This method can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dsd-class"></a>29.3.6.9. Generic Function <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
4318 <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a set of initialization arguments and values.
4319 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A subclass of the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.
4320 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">When a class is initialized, each of the
4321 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s must be converted to a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
4322 This generic function is called to determine
4323 the class of that <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument is simply the
4324 <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> for the slot.
4325 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a>
4326 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> (<em class="replaceable"><code>class</code></em>
4327 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>.
4328 </p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-cpl"></a>29.3.6.10. Generic Function <a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a>
4329 <em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of <a class="link" href="#mop-class-mo">class metaobject</a>s.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic-function is called to determine the
4330 class precedence list of a class.</p><p class="simpara">The result is a list which contains each of <em class="replaceable"><code>class</code></em> and its
4331 superclasses once and only once. The first element of the list is
4332 <em class="replaceable"><code>class</code></em> and the last element is the class named <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.</p><p class="simpara">All methods on this generic function must compute the class
4333 precedence list as a function of the ordered direct superclasses of
4334 the superclasses of <em class="replaceable"><code>class</code></em>. The results are undefined if the
4335 rules used to compute the class precedence list depend on any other
4336 factors.</p><p class="simpara">When a class is finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls this
4337 generic function and associates the returned value with the <a class="link" href="#mop-class-mo">class metaobject</a>.
4338 The value can then be accessed by calling <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a>.</p><p class="simpara">The list returned by this function
4339 will not be mutated by the implementation. The results are undefined
4340 if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a> (<em class="replaceable"><code>class</code></em>
4341 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">This method computes the class precedence list
4342 according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
4343 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-5.html">4.3.5 <span class="quote">“<span class="quote">Determining the
4344 Class Precedence List</span>”</span></a>.</p><p class="simpara">This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> or any of its superclasses
4345 is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p class="simpara">This method can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-slots"></a>29.3.6.11. Generic Function <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)
4346 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A set of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function computes a set of effective
4347 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s for the class <em class="replaceable"><code>class</code></em>. The result is a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s:
4348 one for each slot that will be accessible in instances of <em class="replaceable"><code>class</code></em>.
4349 </p><p class="simpara">This generic function proceeds in 3 steps:</p><p class="simpara">The first step collects the full set of direct slot
4350 definitions from the superclasses of <em class="replaceable"><code>class</code></em>.</p><p class="simpara">The direct slot definitions are then collected into
4351 individual lists, one list for each slot name associated with any of
4352 the direct slot definitions. The slot names are compared with
4353 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>. Each such list is then sorted into class precedence list
4354 order. Direct slot definitions coming from classes earlier in the
4355 class precedence list of <em class="replaceable"><code>class</code></em> appear before those coming from
4356 classes later in the class precedence list. For each slot name, the
4357 generic function <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> is called to compute an effective slot
4358 definition. The result of <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is a list of these
4359 effective slot definitions, in unspecified order.</p><p class="simpara">In the final step, the location for each effective slot
4360 definition is set. This is done by specified around-methods;
4361 portable methods cannot take over this behavior.
4362 For more information on the slot definition locations,
4363 see <a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a>.</p><p class="simpara">The list returned by this function
4364 will not be mutated by the implementation. The results are undefined
4365 if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
4366 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
4367 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)}</code></span></span></dt><dd><p class="simpara">These methods implement the specified behavior of
4368 the generic function.</p><p class="simpara">These methods can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
4369 <code class="constant">:AROUND</code> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
4370 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd>These methods implement the specified behavior of
4371 computing and storing slot locations.
4372 These methods cannot be overridden.
4373 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-esd"></a>29.3.6.12. Generic Function <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)
4374 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a slot name.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definitions</code></em></span></dt><dd>an ordered list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The most specific
4375 <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> appears first in the list.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>An <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the effective slot
4376 definition for a slot in a class. It is called by <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
4377 once for each slot accessible in instances of <em class="replaceable"><code>class</code></em>.</p><p class="simpara">This generic function uses the supplied list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s to
4378 compute the inheritance of slot properties for a single slot. The
4379 returned effective slot definition represents the result of computing
4380 the inheritance. The name of the new effective slot definition is
4381 the same as the name of the direct slot definitions supplied.</p><p class="simpara">The class of the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is determined by calling
4382 <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>. The effective slot definition is then created by
4383 calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The initialization arguments passed in this
4384 call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are used to initialize the new <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
4385 See <a class="xref" href="#mop-sd" title="29.4. Slot Definitions">Section 29.4, “Slot Definitions”</a> for details.
4386 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> (<em class="replaceable"><code>class</code></em>
4387 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> (<em class="replaceable"><code>class</code></em>
4388 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span></span></dt><dd><p class="simpara">This method implements the
4389 inheritance and defaulting of slot options following the rules
4390 described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-5-3.html" target="_top">7.5.3 <span class="quote">“<span class="quote">Inheritance of Slots and Options</span>”</span></a>.</p><p class="simpara">This method can be extended, but the value returned by the
4391 extending method must be the value returned by this method.
4392 </p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The initialization arguments that are passed
4393 to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are computed through a call to
4394 <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>. It is the <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> method that
4395 implements the inheritance rules.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-esd-initargs"></a>29.3.6.13. Generic Function <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)
4396 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definitions</code></em></span></dt><dd>an ordered list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The most specific
4397 <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> appears first in the list.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of initialization arguments for an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
4398 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the initialization
4399 arguments for the effective slot definition for a slot in a class.
4400 It is called by <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a>. The resulting initialization arguments
4401 are passed to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and then to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p class="simpara">This generic function uses the supplied list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s to
4402 compute the inheritance of slot properties for a single slot. The
4403 returned effective slot definition initargs represent the result of
4404 computing the inheritance. The value of <code class="constant">:NAME</code> in the returned
4405 initargs is the same as the name of the direct slot definitions
4406 supplied.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>
4407 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> (<em class="replaceable"><code>class</code></em>
4408 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span></span></dt><dd><p class="simpara">This method implements the
4409 inheritance and defaulting of slot options following the rules
4410 described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-5-3.html" target="_top">7.5.3 <span class="quote">“<span class="quote">Inheritance of Slots and Options</span>”</span></a>.</p><p class="simpara">This method can be extended.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="esd-class"></a>29.3.6.14. Generic Function <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
4411 <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>set of initialization arguments and values.
4412 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A subclass of the class <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>.
4413 </dd><dt><span class="term">Purpose</span></dt><dd>This generic function is called by <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> to
4414 determine the class of the resulting <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. The <em class="replaceable"><code>initargs</code></em>
4415 argument is the set of initialization arguments and values that will
4416 be passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> when the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is created.
4417 </dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>
4418 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> (<em class="replaceable"><code>class</code></em>
4419 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>.
4420 </p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-default-initargs"></a>29.3.6.15. Generic Function <a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
4421 <em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s.
4422 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic-function is called to determine the
4423 default initialization arguments for a class.</p><p class="simpara">The result is a list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s,
4424 with no duplication among initialization argument names.</p><p>All methods on this generic function must compute the default
4425 initialization arguments as a function of only:
4426 </p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">the class precedence list of <em class="replaceable"><code>class</code></em>,
4427 and</li><li class="listitem">the direct default initialization arguments of each
4428 class in that list.</li></ol></div><p>The results are undefined if the rules used to compute
4429 the default initialization arguments depend on any other factors.</p><p class="simpara">When a class is finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls this
4430 generic function and associates the returned value with the <a class="link" href="#mop-class-mo">class metaobject</a>.
4431 The value can then be accessed by calling
4432 <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p class="simpara">The list returned by this function
4433 will not be mutated by the implementation. The results are undefined
4434 if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
4435 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
4436 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">These methods compute the default initialization
4437 arguments according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
4438 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-1-3.html">7.1.3 <span class="quote">“<span class="quote">Defaulting
4439 of Initialization Arguments</span>”</span></a>.</p><p class="simpara">These methods signal an error if <em class="replaceable"><code>class</code></em> or any of its
4440 superclasses is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-dep"></a>29.3.7. Updating Dependencies</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-direct-subclass"></a>29.3.7.1. Generic Function <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> <em class="replaceable"><code>superclass</code></em>
4441 <em class="replaceable"><code>subclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>subclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
4442 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
4443 backpointers from a class to its direct subclasses. This generic
4444 function adds <em class="replaceable"><code>subclass</code></em> to the set of direct subclasses of
4445 <em class="replaceable"><code>superclass</code></em>.</p><p class="simpara">When a class is initialized, this generic function is called
4446 once for each direct superclass of the class.</p><p class="simpara">When a class is reinitialized, this generic function is
4447 called once for each added direct superclass of the class. The
4448 generic function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a> is called once for each
4449 deleted direct superclass of the class.
4450 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>
4451 (<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>subclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
4452 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
4453 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
4454 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
4455 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div><p>
4456 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-direct-subclass"></a>29.3.7.2. Generic Function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a> <em class="replaceable"><code>superclass</code></em>
4457 <em class="replaceable"><code>subclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>subclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
4458 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
4459 backpointers from a class to its direct subclasses. It removes
4460 <em class="replaceable"><code>subclass</code></em> from the set of direct subclasses of <em class="replaceable"><code>superclass</code></em>. No
4461 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <em class="replaceable"><code>subclass</code></em> is not in this set.</p><p class="simpara">Whenever a class is reinitialized, this generic function is
4462 called once with each deleted direct superclass of the class.
4463 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
4464 (<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>subclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
4465 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
4466 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>
4467 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
4468 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-sd"></a>29.4. Slot Definitions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-inheritance"></a>29.4.1. Inheritance Structure of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-sd-inheritance-fig"></a><p class="title"><strong>Figure 29.3. Inheritance structure of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-slotdef.png" width="100%" alt="Inheritance structure of slot definition metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-readers"></a>29.4.2. Introspection: Readers for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></dd></dl></div><p>The reader generic functions which simply return information
4469 associated with <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s are presented together here
4470 in the format described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of the reader generic functions for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s has the same
4471 syntax, accepting one required argument called <em class="replaceable"><code>slot</code></em>, which must be a
4472 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>
4473 has not been initialized.</p><p>These
4474 generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
4475 will not be mutated by the implementation. The results are undefined if a
4476 portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-sd-readers-GFs"></a>29.4.2.1. Generic Functions</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-name"></a>29.4.2.1.1. Generic Function <a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the name of <em class="replaceable"><code>slot</code></em>. This value is a symbol that can be
4477 used as a variable name. This is the value of the <code class="constant">:NAME</code>
4478 initialization argument that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during
4479 initialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The slot name does not need to be usable as a
4480 variable name. Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are perfectly valid.
4481 </p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-allocation"></a>29.4.2.1.2. Generic Function <a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the allocation of <em class="replaceable"><code>slot</code></em>. This is a symbol. This is
4482 the defaulted value of the <code class="constant">:ALLOCATION</code> initialization argument that
4483 was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initform"></a>29.4.2.1.3. Generic Function <a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the initialization form of <em class="replaceable"><code>slot</code></em>. This can be any
4484 form. This is the defaulted value of the <code class="constant">:INITFORM</code> initialization
4485 argument that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.
4486 When <em class="replaceable"><code>slot</code></em> has no initialization form, the value returned is
4487 unspecified (however, <a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a> is guaranteed to return
4488 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initfunction"></a>29.4.2.1.4. Generic Function <a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the initialization function of <em class="replaceable"><code>slot</code></em>. This value is
4489 either a function of no arguments, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, indicating that the slot
4490 has no initialization function. This is the defaulted value of the
4491 <code class="constant">:INITFUNCTION</code> initialization argument that was associated with the
4492 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-type"></a>29.4.2.1.5. Generic Function <a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the type of <em class="replaceable"><code>slot</code></em>. This is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> name.
4493 This is the defaulted value of the <code class="constant">:TYPE</code> initialization argument that
4494 was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initargs"></a>29.4.2.1.6. Generic Function <a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the set of initialization argument keywords for <em class="replaceable"><code>slot</code></em>.
4495 This is the defaulted value of the <code class="constant">:INITARGS</code> initialization argument
4496 that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-methods"></a>29.4.2.2. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a>
4497 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a>
4498 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a>
4499 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a>
4500 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a>
4501 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a>
4502 (<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
4503 methods beyond that which is specified for their respective generic
4504 functions.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-dsd"></a>29.4.2.3. Readers for <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></div><p>The following additional reader generic functions are defined for
4505 <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-readers"></a>29.4.2.3.1. Generic Function <a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a> <em class="replaceable"><code>direct-slot-definition</code></em>)</code></h6></div></div></div><p>Returns a (possibly empty) set of readers of the <em class="replaceable"><code>direct-slot-definition</code></em>. This
4506 value is a list of function names. This is the defaulted value of the
4507 <code class="constant">:READERS</code> initialization argument that was associated with the direct
4508 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-writers"></a>29.4.2.3.2. Generic Function <a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a> <em class="replaceable"><code>direct-slot-definition</code></em>)</code></h6></div></div></div><p>Returns a (possibly empty) set of writers of the <em class="replaceable"><code>direct-slot-definition</code></em>. This
4509 value is a list of function names. This is the defaulted value of the
4510 <code class="constant">:WRITERS</code> initialization argument that was associated with the direct
4511 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.
4512 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a>
4513 (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a>
4514 (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
4515 methods beyond that which is specified for their respective generic
4516 functions.</dd></dl></div><p>
4517 </p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-esd"></a>29.4.2.4. Readers for <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></div><p>The following reader generic function is defined for effective
4518 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-location"></a>29.4.2.4.1. Generic Function <a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a> <em class="replaceable"><code>effective-slot-definition</code></em>)</code></h6></div></div></div><p>Returns the location of <em class="replaceable"><code>effective-slot-definition</code></em>. The meaning and interpretation
4519 of this value is described in <a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a>
4520 (<em class="replaceable"><code>effective-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>This method returns the value stored by
4521 <span class="method"><code class="literal"><a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
4522 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span> and
4523 <span class="method"><code class="literal"><a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
4524 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>.
4525 </dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-init"></a>29.4.3. Initialization of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The
4526 initialization arguments establish the definition of the slot
4527 definition. A <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> cannot be redefined; calling
4528 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
4529 and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>.
4530 Portable programs must <span class="strong"><strong>not</strong></span>...</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
4531 initialize a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
4532 initialize a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
4533 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> or to turn a non-slot-definition object into a
4534 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined, no behavior is
4535 specified for the result of calls to
4536 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. Since the class of a
4537 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> cannot be changed, no behavior is specified for the result of
4538 calls to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><p>During initialization, each initialization argument is checked for
4539 errors and then associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. The value can then be
4540 accessed by calling the appropriate accessor as shown in
4541 <a class="xref" href="#slotd-mo-initargs" title="Table 29.3. Initialization arguments and accessors for slot definition metaobjects">Table 29.3, “Initialization arguments and accessors for slot definition metaobjects”</a>.</p><p>This section begins with a description of the error checking and
4542 processing of each initialization argument. This is followed by a table
4543 showing the generic functions that can be used to access the stored
4544 initialization arguments.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
4545 <em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
4546 supplied, initialization is performed as if <em class="replaceable"><code>value</code></em> had been supplied.
4547 For some initialization arguments this could be done by the use of
4548 default initialization arguments, but whether it is done this way is not
4549 specified. Implementations are free to define default initialization
4550 arguments for specified <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> classes. Portable programs are free to
4551 define default initialization arguments for portable subclasses of the
4552 class <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:NAME</code> argument is a slot name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
4553 if this argument is not a symbol which can be used as a variable
4554 name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not supplied.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:NAME</code> argument does not need to be
4555 usable as a variable name. Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are
4556 perfectly valid.</p></div></li><li class="listitem">The <code class="constant">:INITFORM</code> argument is a form. The
4557 <code class="constant">:INITFORM</code> argument defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the
4558 <code class="constant">:INITFORM</code> argument is supplied, but the <code class="constant">:INITFUNCTION</code> argument
4559 is not supplied.</li><li class="listitem">The <code class="constant">:INITFUNCTION</code> argument is a function of zero
4560 arguments which, when called, evaluates the <code class="constant">:INITFORM</code> in the
4561 appropriate <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. The <code class="constant">:INITFUNCTION</code> argument
4562 defaults to false. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <code class="constant">:INITFUNCTION</code> argument is
4563 supplied, but the <code class="constant">:INITFORM</code> argument is not supplied.</li><li class="listitem">The <code class="constant">:TYPE</code> argument is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> name. An
4564 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed otherwise. The <code class="constant">:TYPE</code> argument defaults to the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
4565 </li><li class="listitem">The <code class="constant">:ALLOCATION</code> argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>. An
4566 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed otherwise. The <code class="constant">:ALLOCATION</code> argument defaults to the
4567 symbol <code class="constant">:INSTANCE</code>.</li><li class="listitem">The <code class="constant">:INITARGS</code> argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s.
4568 An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if any
4569 element of this list is not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>. The <code class="constant">:INITARGS</code> argument
4570 defaults to the empty list.</li><li class="listitem">The <code class="constant">:READERS</code> and <code class="constant">:WRITERS</code> arguments are
4571 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s of function names. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if they are not
4572 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>s, or if any element is not a valid function name.
4573 They default to the empty list. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if either of these
4574 arguments is supplied and the metaobject is not a <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.
4575 </li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
4576 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
4577 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li></ul></div><p>After the processing and defaulting of initialization arguments
4578 described above, the value of each initialization argument is associated
4579 with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. These values can then be accessed by calling the
4580 corresponding generic function. The correspondences are as follows:
4581
4582 </p><div class="table"><a id="slotd-mo-initargs"></a><p class="title"><strong>Table 29.3. Initialization arguments and
4583 accessors for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and&#10; accessors for slot definition metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></td></tr><tr><td align="center"><code class="constant">:INITFORM</code></td><td align="center"><a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></td></tr><tr><td align="center"><code class="constant">:INITFUNCTION</code></td><td align="center"><a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></td></tr><tr><td align="center"><code class="constant">:TYPE</code></td><td align="center"><a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></td></tr><tr><td align="center"><code class="constant">:ALLOCATION</code></td><td align="center"><a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></td></tr><tr><td align="center"><code class="constant">:INITARGS</code></td><td align="center"><a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></td></tr><tr><td align="center"><code class="constant">:READERS</code></td><td align="center"><a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></td></tr><tr><td align="center"><code class="constant">:WRITERS</code></td><td align="center"><a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotdef-mo-methods"></a>29.4.3.1. Methods</h4></div></div></div><p>It is not specified which methods provide the initialization and
4584 reinitialization behavior described above. Instead, the information
4585 needed to allow portable programs to specialize this behavior is
4586 presented as a set of restrictions on the methods a portable program can
4587 define. The model is that portable initialization methods have access
4588 to the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> when either all or none of the specified initialization
4589 has taken effect.</p><p>These restrictions govern the methods that a portable program can
4590 define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
4591 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
4592 apply only to methods on these generic functions for which the first
4593 specializer is a subclass of the class <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>. Other portable
4594 methods on these generic functions are not affected by these
4595 restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
4596 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>:
4597 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
4598 </li><li class="listitem">Portable programs may define around-methods, but
4599 these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
4600 are run, none of the initialization behavior described above has been
4601 completed.</li><li class="listitem">Portable after-methods must assume that when they
4602 are run, all of the initialization behavior described above has been
4603 completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
4604 these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-gf"></a>29.5. Generic Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-inheritance"></a>29.5.1. Inheritance Structure of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-gf-inheritance-fig"></a><p class="title"><strong>Figure 29.4. Inheritance structure of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-genfun.png" width="100%" alt="Inheritance structure of generic function metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-readers"></a>29.5.2. Introspection: Readers for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></div><p>The reader generic functions which simply return information
4605 associated with <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s are presented together here in the format
4606 described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of the reader generic functions for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s has the same
4607 syntax, accepting one required argument called <em class="replaceable"><code>generic-function</code></em>, which must be a
4608 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the
4609 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> has not been initialized.</p><p>These
4610 generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
4611 will not be mutated by the implementation. The results are undefined if a
4612 portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-name"></a>29.5.2.1. Generic Function <a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the name of the generic function, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the generic
4613 function has no name. This is the defaulted value of the <code class="constant">:NAME</code>
4614 initialization argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during
4615 initialization or reinitialization.
4616 (See also <a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a>.)</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-methods"></a>29.5.2.2. Generic Function <a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the set of methods currently connected to the generic
4617 function. This is a set of <a class="link" href="#mop-method-mo">method metaobject</a>s. This value is maintained by the
4618 generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-lambda-list"></a>29.5.2.3. Generic Function <a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function. This is the
4619 defaulted value of the <code class="constant">:LAMBDA-LIST</code> initialization argument that was
4620 associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.
4621 An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> has yet to be supplied.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-argument-precedence-order"></a>29.5.2.4. Generic Function <a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the argument precedence order of the generic function.
4622 This value is a list of symbols, a permutation of the required
4623 parameters in the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function. This is the
4624 defaulted value of the <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> initialization
4625 argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or
4626 reinitialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> has not yet been
4627 supplied.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-declarations"></a>29.5.2.5. Generic Function <a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns a possibly empty list of the <span class="quote">“<span class="quote">declarations</span>”</span>
4628 of the generic function. The elements of this list are
4629 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s. This list is the defaulted value of the
4630 <code class="constant">:DECLARATIONS</code> initialization argument that was associated with the
4631 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-method-class"></a>29.5.2.6. Generic Function <a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the default method class of the generic function. This
4632 class must be a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>. This is the defaulted
4633 value of the <code class="constant">:METHOD-CLASS</code> initialization argument that was
4634 associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.
4635 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-method-combination"></a>29.5.2.7. Generic Function <a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the method combination of the generic function. This is a
4636 <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>. This is the defaulted value of the <code class="constant">:METHOD-COMBINATION</code>
4637 initialization argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during
4638 initialization or reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-name-methods"></a>29.5.2.8. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> reader generic
4639 functions</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a>
4640 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a>
4641 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a>
4642 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a>
4643 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a>
4644 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a>
4645 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
4646 methods beyond that which is specified for their respective generic
4647 functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a>
4648 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
4649 method beyond that which is specified for the generic function.</p><p class="simpara">The value returned by this method is maintained by
4650 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
4651 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span> and
4652 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
4653 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-init"></a>29.5.3. Initialization of Generic Functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-init-defgeneric"></a>29.5.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></h4></div></div></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form results in a
4654 call to the <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> function. The arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>
4655 are derived from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form in a defined way. As with
4656 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, the exact macro-expansion of the
4657 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form is not defined, only the relationship between the
4658 arguments to the macro and the arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>function-name</code></em>
4659 argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> becomes the first argument to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
4660 This is the only positional argument accepted by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>; all other
4661 arguments are keyword arguments.</li><li class="listitem">The <em class="replaceable"><code>lambda-list</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> becomes the value
4662 of the <code class="constant">:LAMBDA-LIST</code> keyword argument to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</li><li class="listitem"><p class="simpara">For each of the options <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code>,
4663 <code class="constant">:DOCUMENTATION</code>, <code class="constant">:GENERIC-FUNCTION-CLASS</code> and <code class="constant">:METHOD-CLASS</code>, the value of the
4664 option becomes the value of the keyword argument with the same name.
4665 If the option does not appear in the macro form, the keyword argument
4666 does not appear in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the option does not appear in the macro form,
4667 the keyword argument appears in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, with a
4668 default value: the <em class="replaceable"><code>lambda-list</code></em> for <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for
4669 <code class="constant">:DOCUMENTATION</code>, the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> for <code class="constant">:GENERIC-FUNCTION-CLASS</code>,
4670 the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a> for <code class="constant">:METHOD-CLASS</code>.
4671 This is needed to make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.
4672 </p></div></li><li class="listitem"><p class="simpara">For the option <code class="constant">:DECLARE</code>, the list
4673 of <span class="quote">“<span class="quote">declarations</span>”</span> becomes the value of the <code class="constant">:DECLARATIONS</code>
4674 keyword argument. If the <code class="constant">:DECLARE</code> option does not
4675 appear in the macro form, the <code class="constant">:DECLARATIONS</code> keyword argument does not
4676 appear in the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the <code class="constant">:DECLARE</code> option does not appear in
4677 the macro form, the <code class="constant">:DECLARATIONS</code> keyword argument appears in the
4678 resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, with a default value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. This is
4679 needed to make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.
4680 </p></div></li><li class="listitem"><p class="simpara">The handling of the <code class="constant">:METHOD-COMBINATION</code> option is
4681 not specified.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the <code class="constant">:METHOD-COMBINATION</code> option does not
4682 appear in the macro form, the <code class="constant">:METHOD-COMBINATION</code> keyword argument
4683 still appears in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, but in a position
4684 where it can be overridden by user-defined initargs and default initargs.
4685 </p></div></li><li class="listitem"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:DECLARE</code> keyword is
4686 recognized as equivalent to the <code class="constant">:DECLARATIONS</code> keyword, for
4687 compatibility with <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]. If both <code class="constant">:DECLARE</code> and
4688 <code class="constant">:DECLARATIONS</code> keyword arguments are specified, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p>Any other generic function options become the value of
4689 keyword arguments with the same name. The value of the keyword
4690 argument is the tail of the generic function option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if
4691 any generic function option appears more than once in the
4692 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p><p>The default initargs of the
4693 <em class="replaceable"><code>generic-function-class</code></em> are added at the
4694 end of the list of arguments to pass to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>. This is needed to
4695 make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div></li><li class="listitem"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a id="mop-defgeneric-user-options"></a><strong>User-defined options. </strong>Any other options become the value of keyword arguments with
4696 the same name. The value of the keyword argument is the tail of the
4697 option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if any option appears more than once in the
4698 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div></li></ul></div><p>The result of the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> is returned as the result of
4699 evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-invocation"></a>29.5.3.2. Generic Function Invocation Protocol</h4></div></div></div><p>Associated with each generic function is its discriminating
4700 function. Each time the generic function is called, the discriminating
4701 function is called to provide the behavior of the generic function. The
4702 discriminating function receives the full set of arguments received by
4703 the generic function. It must lookup and execute the appropriate
4704 methods, and return the appropriate values.</p><p>The discriminating function is computed by the highest layer of
4705 the generic function invocation protocol, <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>.
4706 Whenever a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is initialized, reinitialized, or a method is added or
4707 removed, the discriminating function is recomputed.
4708 The new discriminating function is then stored with
4709 <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>.</p><p>Discriminating functions call <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
4710 and <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> to compute the methods
4711 applicable to the generic functions arguments.
4712 Applicable methods are combined by <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> to
4713 produce an <strong class="first"><em class="firstterm">effective method
4714 <a id="effective-method" class="indexterm"></a></em></strong>.
4715 Provisions are made to allow memoization of the method applicability and
4716 effective methods computations. (See the description of
4717 <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for details.)</p><p>The body of method definitions are processed by <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.
4718 The result of this generic function is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>
4719 which is processed by either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> to produce a
4720 <strong class="first"><em class="firstterm">method function<a id="me-func" class="indexterm"></a></em></strong>.
4721 The arguments received by the method function are controlled by the
4722 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> forms appearing in the effective methods.
4723 By default, method functions accept two arguments: a list of arguments
4724 to the generic function, and a list of next methods.
4725 The list of next methods corresponds to the next methods argument to
4726 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>.
4727 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> appears with additional arguments, these will be passed
4728 to the method functions as well; in these cases, <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>
4729 must have created the method lambdas to expect additional arguments.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>See <a class="xref" href="#no-make-method-lambda" title="The generic function CLOS:MAKE-METHOD-LAMBDA is not implemented">The generic function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code> is not implemented</a>.</p><p>See <a class="xref" href="#method-functions-args" title="Method function arguments">Method function arguments</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-init-mo"></a>29.5.3.3. Initialization of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The
4730 initialization arguments establish the definition of the generic
4731 function. A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be redefined by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
4732 Some classes of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> do not support redefinition; in these cases,
4733 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
4734 and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Reinitialization of a
4735 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
4736 Portable programs must <span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
4737 initialize a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
4738 initialize or reinitialize a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
4739 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or to turn a non-generic-function object into a
4740 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined,
4741 no behavior is specified for the result of calls to
4742 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.
4743 Since the class of a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> may not be changed,
4744 no behavior is specified for the results of calls to
4745 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.</p><p>During initialization or reinitialization, each initialization
4746 argument is checked for errors and then associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.
4747 The value can then be accessed by calling the appropriate accessor as
4748 shown in <a class="xref" href="#gf-mo-initargs" title="Table 29.4. Initialization arguments and accessors for generic function metaobjects">Table 29.4, “Initialization arguments and accessors for generic function metaobjects”</a>.</p><p>This section begins with a description of the error checking and
4749 processing of each initialization argument. This is followed by a table
4750 showing the generic functions that can be used to access the stored
4751 initialization arguments. The section ends with a set of restrictions on
4752 portable methods affecting <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> initialization and reinitialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
4753 <em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
4754 supplied, initialization or reinitialization is performed as if
4755 <em class="replaceable"><code>value</code></em> had been supplied. For some initialization arguments this
4756 could be done by the use of default initialization arguments, but
4757 whether it is done this way is not specified. Implementations are free
4758 to define default initialization arguments for specified <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> classes.
4759 Portable programs are free to define default initialization arguments
4760 for portable subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>.</p><p>Unless there is a specific note to the
4761 contrary, then during reinitialization, if an initialization argument
4762 is not supplied, the previously stored value is left unchanged.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> argument is a list
4763 of symbols.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument appears but the <code class="constant">:LAMBDA-LIST</code>
4764 argument does not appear. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a
4765 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if this value is not a permutation of the
4766 symbols from the required arguments part of the <code class="constant">:LAMBDA-LIST</code>
4767 initialization argument.</p><p class="simpara">When the generic function is being initialized or
4768 reinitialized, and this argument is not supplied, but the
4769 <code class="constant">:LAMBDA-LIST</code> argument is supplied, this value defaults to the
4770 symbols from the required arguments part of the <code class="constant">:LAMBDA-LIST</code>
4771 argument, in the order they appear in that argument. If neither
4772 argument is supplied, neither are initialized (see the description of
4773 <code class="constant">:LAMBDA-LIST</code>.)</p></li><li class="listitem"><p class="simpara">The <code class="constant">:DECLARATIONS</code> argument is a list of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s.
4774 </p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or
4775 if each of its elements is not a legal <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>.</p><p class="simpara">When the generic function is being initialized, and this
4776 argument is not supplied, it defaults to the empty list.
4777 </p></li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
4778 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
4779 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li><li class="listitem"><p class="simpara">The <code class="constant">:LAMBDA-LIST</code> argument is a <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a proper generic function
4780 <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p><p class="simpara">When the generic function is being initialized, and this
4781 argument is not supplied, the generic function's <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is not
4782 initialized. The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> will be initialized later, either when
4783 the first method is added to the generic function, or a later
4784 reinitialization of the generic function.</p></li><li class="listitem">The <code class="constant">:METHOD-COMBINATION</code> argument is a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.
4785 </li><li class="listitem"><p class="simpara">The <code class="constant">:METHOD-CLASS</code> argument is a <a class="link" href="#mop-class-mo">class metaobject</a>.
4786 </p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a subclass of the
4787 class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.</p><p class="simpara">When the generic function is being initialized, and this
4788 argument is not supplied, it defaults to the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>.
4789 </p></li><li class="listitem"><p class="simpara"> The <code class="constant">:NAME</code> argument is an object.</p><p class="simpara">If the generic function is being initialized, this argument
4790 defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
4791 </p></li></ul></div><p>After the processing and defaulting of initialization arguments
4792 described above, the value of each initialization argument is associated
4793 with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>. These values can then be accessed by calling the
4794 corresponding generic function. The correspondences are as follows:
4795 </p><div class="table"><a id="gf-mo-initargs"></a><p class="title"><strong>Table 29.4. Initialization arguments and accessors
4796 for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and accessors&#10; for generic function metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code></td><td align="center"><a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></td></tr><tr><td align="center"><code class="constant">:DECLARATIONS</code></td><td align="center"><a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr><tr><td align="center"><code class="constant">:LAMBDA-LIST</code></td><td align="center"><a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></td></tr><tr><td align="center"><code class="constant">:METHOD-COMBINATION</code></td><td align="center"><a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></td></tr><tr><td align="center"><code class="constant">:METHOD-CLASS</code></td><td align="center"><a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></td></tr><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="gf-mo-init-methods"></a>29.5.3.3.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization and
4797 reinitialization behavior described above. Instead, the information
4798 needed to allow portable programs to specialize this behavior is
4799 presented as a set of restrictions on the methods a portable program can
4800 define. The model is that portable initialization methods have access
4801 to the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> when either all or none of the specified initialization
4802 has taken effect.</p><p>These restrictions govern the methods that a portable program can
4803 define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
4804 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
4805 apply only to methods on these generic functions for which the first
4806 specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>. Other
4807 portable methods on these generic functions are not affected by these
4808 restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
4809 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>:
4810 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
4811 </li><li class="listitem">Portable programs may define around-methods, but
4812 these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
4813 are run, none of the initialization behavior described above has been
4814 completed.</li><li class="listitem">Portable after-methods must assume that when they
4815 are run, all of the initialization behavior described above has been
4816 completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
4817 these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-customize"></a>29.5.4. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-gf-name"></a>29.5.4.1. Generic Function <a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a> <em class="replaceable"><code>new-name</code></em> <em class="replaceable"><code>generic-function</code></em>)
4818 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>new-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
4819 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-name</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function changes the name of <em class="replaceable"><code>generic-function</code></em> to <em class="replaceable"><code>new-name</code></em>.
4820 This value is usually a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, if the generic function
4821 is to have no name.</p><p class="simpara">This function works by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> with
4822 <em class="replaceable"><code>generic-function</code></em> as its first argument, the symbol <code class="constant">:NAME</code> as its second argument
4823 and <em class="replaceable"><code>new-name</code></em> as its third argument.
4824 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-gf"></a>29.5.4.2. Generic Function <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
4825 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>function-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a></dd><dt><span class="term">keyword arguments</span></dt><dd>Some of the keyword arguments accepted by this
4826 function are actually processed by <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>, others are
4827 processed during initialization of the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>
4828 (as described in <a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a>).
4829 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to define a globally named
4830 generic function or to specify or modify options and declarations
4831 that pertain to a globally named generic function as a whole. It can
4832 be called by the user or the implementation.</p><p class="simpara">It is the functional equivalent of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, and is
4833 called by the expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macros.
4834 </p><p class="simpara">The behavior of this function is actually
4835 implemented by the generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>. When <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>
4836 is called, it immediately calls <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> and returns that
4837 result as its own.</p><p>The first argument to <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> is computed as follows:
4838 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>function-name</code></em> names a non-generic
4839 function, a macro, or a special form, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
4840 </li><li class="listitem">If <em class="replaceable"><code>function-name</code></em> names a generic function, that
4841 <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is used.</li><li class="listitem">Otherwise, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is used.
4842 </li></ul></div><p class="simpara">The second argument is <em class="replaceable"><code>function-name</code></em>. The remaining arguments
4843 are the complete set of keyword arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
4844 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-gf-UC"></a>29.5.4.3. Generic Function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
4845 <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> <code class="constant">:DECLARATIONS</code> <code class="constant">:DOCUMENTATION</code>
4846 <code class="constant">:GENERIC-FUNCTION-CLASS</code> <code class="constant">:LAMBDA-LIST</code> <code class="constant">:METHOD-CLASS</code> <code class="constant">:METHOD-COMBINATION</code>
4847 <code class="constant">:NAME</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><em class="replaceable"><code>function-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a></dd><dt><span class="term"><code class="constant">:GENERIC-FUNCTION-CLASS</code></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a class name.
4848 If it is not supplied, it defaults to the class named
4849 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>. If a class name is supplied, it is
4850 interpreted as the class with that name. If a class name is
4851 supplied, but there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
4852 </dd><dt><span class="term">additional keyword arguments</span></dt><dd><p class="simpara">see <a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:DECLARE</code> keyword is recognized as
4853 equivalent to the <code class="constant">:DECLARATIONS</code> keyword, for compatibility
4854 with <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p></div></dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">The generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> is called to
4855 define or modify the definition of a globally named generic function.
4856 It is called by the <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> function. It can also be called
4857 directly.</p><p>The first step performed by this generic function is to compute
4858 the set of initialization arguments which will be used to create or
4859 reinitialize the globally named generic function. These
4860 initialization arguments are computed from the full set of keyword
4861 arguments received by this generic function as follows:
4862 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:GENERIC-FUNCTION-CLASS</code>
4863 argument is not included in the initialization arguments.
4864 </li><li class="listitem">If the <code class="constant">:METHOD-CLASS</code> argument was received by
4865 this generic function, it is converted into a <a class="link" href="#mop-class-mo">class metaobject</a>.
4866 This is done by looking up the class name with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>. If
4867 there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</li><li class="listitem">All other keyword arguments are included directly
4868 in the initialization arguments.</li></ul></div><p class="simpara">If the <em class="replaceable"><code>generic-function</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an instance of the class
4869 specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument is created by
4870 calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> with the previously computed initialization
4871 arguments. The function name <em class="replaceable"><code>function-name</code></em> is set to name the generic
4872 function. The newly created <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is returned.
4873 </p><p class="simpara">If the class of the <em class="replaceable"><code>generic-function</code></em> argument is not the same
4874 as the class specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The description of <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
4875 specifies that in this case, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called if the class of the
4876 <em class="replaceable"><code>generic-function</code></em> argument and the class specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument are
4877 compatible. Given the description of <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, this also applies to the
4878 <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> function. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation calls <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>
4879 always, and leaves it to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> function to signal an error if
4880 needed.</p></div><p class="simpara">Otherwise the generic function <em class="replaceable"><code>generic-function</code></em> is redefined by calling
4881 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> generic function with <em class="replaceable"><code>generic-function</code></em> and the
4882 initialization arguments. The <em class="replaceable"><code>generic-function</code></em> argument is then returned.
4883 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>
4884 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
4885 <code class="constant">:GENERIC-FUNCTION-CLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
4886 function in the case where <em class="replaceable"><code>function-name</code></em> names an existing generic
4887 function.</p><p class="simpara">This method can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>
4888 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>) <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:GENERIC-FUNCTION-CLASS</code>
4889 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd>This method implements the behavior of the generic
4890 function in the case where <em class="replaceable"><code>function-name</code></em> names no function, generic
4891 function, macro or special form.
4892 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-add-method"></a>29.5.4.4. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method</code></em>)
4893 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>generic-function</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function associates an unattached
4894 method with a generic function.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the method is not
4895 congruent with the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the method is already associated with some
4896 other generic function.</p><p class="simpara">If the given method agrees with an existing method of the
4897 generic function on parameter specializers and qualifiers, the
4898 existing method is removed by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> before the
4899 new method is added. See the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
4900 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-3.html">7.6.3 <span class="quote">“<span class="quote">Agreement on
4901 Parameter Specializers and Qualifiers</span>”</span></a>
4902 for a definition of agreement in this context.</p><p>Associating the method with the generic function then
4903 proceeds in four steps:</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">add <em class="replaceable"><code>method</code></em> to the set returned by
4904 <a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> and arrange for <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> to return <em class="replaceable"><code>generic-function</code></em>;
4905 </li><li class="listitem">call <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> for each of the method's
4906 specializers;</li><li class="listitem">call <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> and
4907 install its result with <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>; and
4908 </li><li class="listitem">update the dependents of the generic function.
4909 </li></ol></div><p class="simpara">The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> can be called by the user
4910 or the implementation.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>
4911 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
4912 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
4913 method beyond that which is specified for the generic function.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>
4914 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
4915 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd>This method is specified by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
4916 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-remove-method"></a>29.5.4.5. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method</code></em>)
4917 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>generic-function</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function breaks the association between
4918 a generic function and one of its methods.</p><p class="simpara">No <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the method is not among the methods of the
4919 generic function.</p><p>Breaking the association between the method and the generic
4920 function proceeds in four steps:</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">remove <em class="replaceable"><code>method</code></em> from the set returned by
4921 <a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> and arrange for <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> to return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;
4922 </li><li class="listitem">call <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> for each of the
4923 method's specializers;</li><li class="listitem">call <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> and
4924 install its result with <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>;
4925 and</li><li class="listitem">update the dependents of the generic function.
4926 </li></ol></div><p class="simpara">The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> can be called by the
4927 user or the implementation.
4928 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>
4929 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
4930 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
4931 method beyond that which is specified for the generic function.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>
4932 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
4933 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd>This method is specified by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
4934 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-applicable-methods"></a>29.5.4.6. Generic Function <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
4935 <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>arguments</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>arguments</code></em></span></dt><dd>a list of objects.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
4936 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the method
4937 applicability of a generic function given a list of required
4938 arguments. The returned list of <a class="link" href="#mop-method-mo">method metaobject</a>s is sorted by
4939 precedence order with the most specific method appearing first. If
4940 no methods are applicable to the supplied arguments the empty list is
4941 returned.</p><p class="simpara">When a generic function is invoked, the
4942 discriminating function must determine the ordered list of methods
4943 applicable to the arguments. Depending on the generic function and
4944 the arguments, this is done in one of three ways: using a memoized
4945 value; calling <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>; or calling
4946 <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
4947 (Refer to the description of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for
4948 the details of this process.)</p><p class="simpara">The <em class="replaceable"><code>arguments</code></em> argument is permitted to contain more elements
4949 than the generic function accepts required arguments; in these cases
4950 the extra arguments will be ignored. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <em class="replaceable"><code>arguments</code></em>
4951 contains fewer elements than the generic function accepts required
4952 arguments.</p><p class="simpara">The list returned by this function
4953 will not be mutated by the implementation. The results are undefined
4954 if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
4955 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>arguments</code></em>)</code></span></span></dt><dd><p class="simpara">This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if any method of the generic
4956 function has a specializer which is neither a <a class="link" href="#mop-class-mo">class metaobject</a> nor an
4957 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject.</p><p class="simpara">Otherwise, this method computes the sorted list of applicable
4958 methods according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
4959 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6.html">7.6.6 <span class="quote">“<span class="quote">Method Selection
4960 and Combination</span>”</span></a></p><p class="simpara">This method can be overridden. Because of the consistency
4961 requirements between this generic function and
4962 <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>, doing so may require also overriding
4963 <span class="method"><code class="literal"><a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
4964 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span>.
4965 </p></dd></dl></div><p><a id="mop-cam-remarks"></a><strong>Remarks. </strong>See also the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_com_able-methods.html" target="_top"><code class="function">COMPUTE-APPLICABLE-METHODS</code></a>.
4966 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-applicable-methods-UC"></a>29.5.4.7. Generic Function <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
4967 <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>classes</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>classes</code></em></span></dt><dd>a list of <a class="link" href="#mop-class-mo">class metaobject</a>s.
4968 </dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
4969 </li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to attempt to
4970 determine the method applicability of a generic function given only
4971 the classes of the required arguments.</p><p class="simpara">If it is possible to completely determine the ordered list of
4972 applicable methods based only on the supplied classes, this generic
4973 function returns that list as its <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and true as its second
4974 value. The returned list of <a class="link" href="#mop-method-mo">method metaobject</a>s is sorted by
4975 precedence order, the most specific method coming first. If no
4976 methods are applicable to arguments with the specified classes, the
4977 empty list and true are returned.</p><p class="simpara">If it is not possible to completely determine the ordered
4978 list of applicable methods based only on the supplied classes, this
4979 generic function returns an unspecified <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and false as its
4980 second value.</p><p class="simpara">When a generic function is invoked, the
4981 discriminating function must determine the ordered list of methods
4982 applicable to the arguments. Depending on the generic function and
4983 the arguments, this is done in one of three ways: using a memoized
4984 value; calling <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>; or calling
4985 <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
4986 (Refer to the description of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for
4987 the details of this process.)</p><p class="simpara">The following consistency relationship between
4988 <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> and <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a> must
4989 be maintained: for any given generic function and set of arguments,
4990 if <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second value of true,
4991 the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> must be equal to the value that would be returned by
4992 a corresponding call to <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>. The results
4993 are undefined if a portable method on either of these generic
4994 functions causes this consistency to be violated.</p><p class="simpara">The list returned by this function
4995 will not be mutated by the implementation. The results are undefined
4996 if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
4997 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>classes</code></em>)</code></span></span></dt><dd><p class="simpara">If any method of the generic function has a
4998 specializer which is neither a <a class="link" href="#mop-class-mo">class metaobject</a> nor an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>
4999 specializer metaobject, this method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p class="simpara">In cases where the generic function has no methods with
5000 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers, or has no methods with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers
5001 that could be applicable to arguments of the supplied classes, this
5002 method returns the ordered list of applicable methods as its first
5003 value and true as its second value.</p><p class="simpara">Otherwise this method returns an unspecified <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and
5004 false as its second value.</p><p class="simpara">This method can be overridden. Because of the consistency
5005 requirements between this generic function and
5006 <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>, doing so may require also overriding
5007 <span class="method"><code class="literal"><a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
5008 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>) </code></span>.
5009 </p></dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-cam-UC-remarks"></a>Remarks</h5></div></div></div><p>This generic function exists to allow user extensions which alter
5010 method lookup rules, but which base the new rules only on the classes of
5011 the required arguments, to take advantage of the class-based method
5012 lookup memoization found in many implementations. (There is of course
5013 no requirement for an implementation to provide this optimization.)</p><p>Such an extension can be implemented by two methods, one on this
5014 generic function and one on <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>. Whenever
5015 the user extension is in effect, the first method will return a second
5016 value of true. This should allow the implementation to absorb these
5017 cases into its own memoization scheme.</p><p>To get appropriate performance, other kinds of extensions may
5018 require methods on <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> which implement
5019 their own memoization scheme.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-effective-method"></a>29.5.4.8. Generic Function <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method-combination</code></em>
5020 <em class="replaceable"><code>methods</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method-combination</code></em></span></dt><dd>a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>methods</code></em></span></dt><dd>a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">An effective method</li><li class="listitem">A list of effective method options
5021 </li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
5022 effective method from a sorted list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</p><p class="simpara">An effective method is a form that describes how the
5023 applicable methods are to be combined. Inside of effective method
5024 forms are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> forms which indicate that a particular
5025 method is to be called. The arguments to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> form
5026 indicate exactly how the method function of the method should be
5027 called. (See <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more details about method
5028 functions.)</p><p class="simpara">An effective method option has the same interpretation and
5029 syntax as either the <code class="constant">:ARGUMENTS</code> or the <code class="constant">:GENERIC-FUNCTION</code> option in the long form
5030 of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a>.</p><p class="simpara">More information about the form and interpretation of
5031 effective methods and effective method options can be found under
5032 the description of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a> macro in the
5033 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification.</p><p class="simpara">This generic function can be called by the user or the
5034 implementation. It is called by discriminating functions whenever a
5035 sorted list of applicable methods must be converted to an effective
5036 method.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
5037 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>method-combination</code></em> <em class="replaceable"><code>methods</code></em>)</code></span></span></dt><dd><p class="simpara">This method computes the effective method according
5038 to the rules of the method combination type implemented by <em class="replaceable"><code>method-combination</code></em>.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second return value may contain only one
5039 <code class="constant">:ARGUMENTS</code> option and only one <code class="constant">:GENERIC-FUNCTION</code> option. When overriding a
5040 <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> method, before adding an <code class="constant">:ARGUMENTS</code> or
5041 <code class="constant">:GENERIC-FUNCTION</code> option, you therefore need to check whether it this option is
5042 already present.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-effective-method-as-function"></a>29.5.4.9. Function <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>
5043 <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>methods</code></em> <em class="replaceable"><code>arguments</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>methods</code></em></span></dt><dd>a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</dd><dt><span class="term"><em class="replaceable"><code>arguments</code></em></span></dt><dd>a list of arguments.
5044 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The effective method as a function, accepting any
5045 set of arguments for which all of the given methods are applicable.
5046 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to determine the effective method
5047 from a sorted list of <a class="link" href="#mop-method-mo">method metaobject</a>s, and convert it to a function.
5048 The <em class="replaceable"><code>arguments</code></em> are a set of arguments to which the methods are applicable,
5049 and are used solely for error message purposes.</p><p class="simpara">This function calls <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> using the <em class="replaceable"><code>generic-function</code></em>'s
5050 method combination, wraps local macro definitions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> and
5051 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">MAKE-METHOD</code></a> around it, handles the <code class="constant">:ARGUMENTS</code> and <code class="constant">:GENERIC-FUNCTION</code> options,
5052 and compiles the resulting form to a function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="make-method-lambda"></a>29.5.4.10. Generic Function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> <em class="replaceable"><code>generic-function</code></em>
5053 <em class="replaceable"><code>method</code></em> <em class="replaceable"><code>lambda-expression</code></em> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)
5054 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a (possibly uninitialized) <a class="link" href="#mop-method-mo">method metaobject</a>.
5055 </dd><dt><span class="term"><em class="replaceable"><code>lambda-expression</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>.</dd><dt><span class="term"><em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em></span></dt><dd>the same as the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;ENVIRONMENT</code></a> argument to
5056 macro expansion functions.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a></li><li class="listitem">A list of initialization arguments and values
5057 </li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to produce a
5058 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> which can itself be used to produce a method function
5059 for a method and generic function with the specified classes.
5060 The generic function and method the method function will be used with
5061 are not required to be the given ones.
5062 Moreover, the <a class="link" href="#mop-method-mo">method metaobject</a> may be uninitialized.</p><p class="simpara">Either the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>, the special form <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> or
5063 the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> must be used to convert the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> a
5064 method function. The method function itself can be applied to
5065 arguments with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>.</p><p class="simpara">When a method is actually called by an effective method, its
5066 first argument will be a list of the arguments to the generic
5067 function. Its remaining arguments will be all but the first argument
5068 passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>. By default, all method functions must
5069 accept two arguments: the list of arguments to the generic function
5070 and the list of next methods.</p><p class="simpara">For a given generic function and method class, the applicable
5071 methods on <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> and <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> must
5072 be consistent in the following way: each use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>
5073 returned by the method on <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> must have the
5074 same number of arguments, and the method lambda returned by the
5075 method on <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> must accept a corresponding number of
5076 arguments.</p><p class="simpara">Note that the system-supplied implementation of
5077 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is not required to handle extra arguments to the
5078 method function. Users who define additional arguments to the method
5079 function must either redefine or forego <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>. (See the
5080 example below.)</p><p class="simpara">When the <a class="link" href="#mop-method-mo">method metaobject</a> is created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, the method
5081 function must be the value of the <code class="constant">:FUNCTION</code> initialization
5082 argument. The additional initialization arguments, returned as the
5083 second value of this generic function, must also be passed in this
5084 call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>
5085 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
5086 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>) <em class="replaceable"><code>lambda-expression</code></em> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code></span></span></dt><dd><p class="simpara">This method returns a method lambda which accepts two
5087 arguments, the list of arguments to the generic function, and the list
5088 of next methods. What initialization arguments may be returned in the
5089 second value are unspecified.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="informalexample"><a id="make-method-lambda-ex"></a><p>This example shows how to define a kind of method which, from
5090 within the body of the method, has access to the actual <a class="link" href="#mop-method-mo">method metaobject</a> for the
5091 method. This simplified code overrides whatever method combination is
5092 specified for the generic function, implementing a simple method
5093 combination supporting only primary methods, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> and
5094 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a>. (In addition, its a simplified version of
5095 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> which does no error checking.)</p><p>Notice that the extra lexical function bindings get wrapped around
5096 the body before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is called. In this way, the user's
5097 definition of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a> are sure to
5098 override the system's definitions.</p><pre class="programlisting">
5099 (defclass my-generic-function (standard-generic-function)
5100 ()
5101 (:default-initargs :method-class (find-class 'my-method)))
5102
5103 (defclass my-method (standard-method) ())
5104
5105 (defmethod make-method-lambda ((gf my-generic-function)
5106 (method my-method)
5107 lambda-expression
5108 environment)
5109 (declare (ignore environment))
5110 `(lambda (args next-methods this-method)
5111 (,(call-next-method gf method
5112 `(lambda ,(cadr lambda-expression)
5113 (flet ((this-method () this-method)
5114 (call-next-method (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> cnm-args)
5115 (funcall (method-function (car next-methods))
5116 (or cnm-args args)
5117 (cdr next-methods)
5118 (car next-methods)))
5119 (next-method-p ()
5120 (not (null next-methods))))
5121 ,@(cddr lambda-expression)))
5122 environment)
5123 args next-methods)))
5124
5125 (defmethod compute-effective-method ((gf my-generic-function)
5126 method-combination
5127 methods)
5128 `(call-method ,(car methods) ,(cdr methods) ,(car methods)))
5129 </pre></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a id="no-make-method-lambda"></a><strong>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> is not implemented. </strong>Its specification is misdesigned: it mixes <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> and
5130 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#execution_time">execution time</a> behaviour. The essential problem is: where could the
5131 generic-function argument come from?
5132 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form occurs in a source file, is
5133 <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> then called at compile time or at load time?
5134 If it was called at compile time, there's no possible value for
5135 the first argument, since the class of the generic function to
5136 which the method will belong is not known until load time. If it
5137 was called at load time, it would mean that the method's source
5138 code could only be compiled at load time, not earlier - which
5139 defeats the purpose of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></li><li class="listitem">When a method is removed from a generic function
5140 using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> and then added through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> to a
5141 different generic function, possibly belonging to a different
5142 generic function class, would <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> then be called
5143 again or not? If no, then <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>'s first argument is
5144 useless. If yes, then the source code of every method would have
5145 to be present at runtime, and its lexical environment as well.
5146 </li></ul></div><p><a id="method-functions-args"></a><strong>Method function arguments. </strong></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> always expect
5147 exactly two arguments: the method and a list of next methods.
5148 </li><li class="listitem">Method functions always
5149 expect exactly two arguments: the list of arguments passed to the
5150 generic function, and the list of next methods.
5151 </li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-discriminating-function"></a>29.5.4.11. Generic Function <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>
5152 <em class="replaceable"><code>generic-function</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A function.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
5153 discriminating function for a generic function. When a generic
5154 function is called, the <strong class="first"><em class="firstterm">installed</em></strong>
5155 discriminating function is called with the full set of arguments
5156 received by the generic function, and must implement the behavior of
5157 calling the generic function: determining the ordered set of
5158 applicable methods, determining the effective method, and running the
5159 effective method.</p><p class="simpara">To determine the ordered set of applicable methods, the
5160 discriminating function first calls <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>.
5161 If <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second value of false,
5162 the discriminating function then calls <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
5163 </p><p>When <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second
5164 value of true, the discriminating function is permitted to memoize
5165 the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> as follows. The discriminating function may
5166 reuse the list of applicable methods without calling
5167 <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> again provided that:
5168 </p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">the generic function is being called again with
5169 required arguments which are instances of the same classes,
5170 </li><li class="listitem">the generic function has not been reinitialized,
5171 </li><li class="listitem">no method has been added to or removed from the
5172 generic function,</li><li class="listitem">for all the specializers of all the generic
5173 function's methods which are classes, their class precedence lists
5174 have not changed, and</li><li class="listitem">for any such memoized value, the class precedence
5175 list of the class of each of the required arguments has not changed.
5176 </li></ol></div><p>
5177 Determination of the effective method is done by calling
5178 <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>. When the effective method is run, each
5179 method's function is called, and receives as arguments:
5180 </p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">a list of the arguments to the generic function,
5181 </li><li class="listitem">whatever other arguments are specified in the
5182 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> form indicating that the method should be called.
5183 </li></ol></div><p>
5184 (See <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more information about how method
5185 functions are called.)</p><p class="simpara">The generic function <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> is
5186 called, and its result installed, by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>,
5187 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
5188 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>
5189 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5190 method beyond that which is specified for the generic function.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>Overriding methods can make use of the function
5191 <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>. It is more convenient to call
5192 <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a> than <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
5193 because the in the latter case one needs a lot of <span class="quote">“<span class="quote">glue
5194 code</span>”</span> for implementing the local macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> and
5195 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">MAKE-METHOD</code></a>, and this glue code is implementation dependent because
5196 it needs</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">to retrieve the declarations
5197 list stored in the method-combination object and</li><li class="listitem">to handle implementation dependent options that
5198 are returned as second value from <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>.
5199 </li></ol></div></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-meth"></a>29.6. Methods</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-inheritance"></a>29.6.1. Inheritance Structure of <a class="link" href="#mop-method-mo">method metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-meth-inheritance-fig"></a><p class="title"><strong>Figure 29.5. Inheritance structure of <a class="link" href="#mop-method-mo">method metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-method.png" width="100%" alt="Inheritance structure of method metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-mo-readers"></a>29.6.2. Introspection: Readers for <a class="link" href="#mop-method-mo">method metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></div><p>The reader generic functions which simply return information
5200 associated with <a class="link" href="#mop-method-mo">method metaobject</a>s are presented together here in the
5201 format described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of these reader generic functions have the same syntax,
5202 accepting one required argument called <em class="replaceable"><code>method</code></em>, which must be a
5203 <a class="link" href="#mop-method-mo">method metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
5204 if the <a class="link" href="#mop-method-mo">method metaobject</a> has not been initialized.</p><p>These
5205 generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
5206 will not be mutated by the implementation. The results are undefined if a
5207 portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-specializers"></a>29.6.2.1. Generic Function <a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns a list of the specializers of <em class="replaceable"><code>method</code></em>. This value is a
5208 list of specializer metaobjects. This is the value of the
5209 <code class="constant">:SPECIALIZERS</code> initialization argument that was associated with the
5210 method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-qualifiers"></a>29.6.2.2. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns a (possibly empty) list of the qualifiers of <em class="replaceable"><code>method</code></em>.
5211 This value is a list of non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> atoms. This is the defaulted value of
5212 the <code class="constant">:QUALIFIERS</code> initialization argument that was associated with the
5213 method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-lambda-list"></a>29.6.2.3. Generic Function <a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the (unspecialized) <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of <em class="replaceable"><code>method</code></em>. This value
5214 is a <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>. This is the value of the <code class="constant">:LAMBDA-LIST</code>
5215 initialization argument that was associated with the method during
5216 initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-gf"></a>29.6.2.4. Generic Function <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the generic function that <em class="replaceable"><code>method</code></em> is currently
5217 connected to, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if it is not currently connected to any generic
5218 function. This value is either a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
5219 When a method is first created it is not connected to any generic
5220 function. This connection is maintained by the generic functions
5221 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-function"></a>29.6.2.5. Generic Function <a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the method function of <em class="replaceable"><code>method</code></em>. This is the
5222 value of the <code class="constant">:FUNCTION</code> initialization argument that was associated
5223 with the method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-mo-readers-methods"></a>29.6.2.6. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-method-mo">method metaobject</a> readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a>
5224 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a>
5225 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a>
5226 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a>
5227 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for these
5228 methods beyond that which is specified for their respective generic
5229 functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a>
5230 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5231 method beyond that which is specified for the generic function.</p><p class="simpara">The value returned by this method is maintained by
5232 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
5233 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span> and
5234 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
5235 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-init"></a>29.6.3. Initialization of Methods</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-init-defmethod"></a>29.6.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a></h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form requires first
5236 that the body of the method be converted to a method function.
5237 This process is described
5238 <a class="link" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">below</a>.
5239 The result of this process is a method function and a set of additional
5240 initialization arguments to be used when creating the new method.
5241 Given these two values, the evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
5242 form proceeds in three steps.</p><p>The first step ensures the existence of a generic function with
5243 the specified name. This is done by calling the function <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
5244 The first argument in this call is the generic function name specified
5245 in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</p><p>The second step is the creation of the new <a class="link" href="#mop-method-mo">method metaobject</a> by calling
5246 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The class of the new <a class="link" href="#mop-method-mo">method metaobject</a> is determined by calling
5247 <a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> on the result of the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> from the
5248 first step.</p><p>The initialization arguments received by the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
5249 are as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The value of the <code class="constant">:QUALIFIERS</code> initialization
5250 argument is a list of the qualifiers which appeared in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
5251 form. No special processing is done on these values. The order of the
5252 elements of this list is the same as in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
5253 </li><li class="listitem">The value of the <code class="constant">:LAMBDA-LIST</code> initialization
5254 argument is the unspecialized <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
5255 </li><li class="listitem">The value of the <code class="constant">:SPECIALIZERS</code> initialization
5256 argument is a list of the specializers for the method. For specializers
5257 which are classes, the specializer is the <a class="link" href="#mop-class-mo">class metaobject</a> itself. In
5258 the case of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers, it will be an <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>
5259 metaobject obtained by calling <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> on the result of
5260 evaluating the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer form in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> of the
5261 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</li><li class="listitem">The value of the <code class="constant">:FUNCTION</code> initialization
5262 argument is the method function.</li><li class="listitem"><p class="simpara">The value of the <code class="constant">:DECLARATIONS</code> initialization
5263 argument is a list of the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
5264 If there are no declarations in the macro form, this initialization argument
5265 either does not appear, or appears with a value of the empty list.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>No <code class="constant">:DECLARATIONS</code> initialization argument is
5266 provided, because method initialization does not support a <code class="constant">:DECLARATIONS</code>
5267 argument, and because the method function is already completely provided
5268 through the <code class="constant">:FUNCTION</code> initialization argument.</p></div></li><li class="listitem">The value of the <code class="constant">:DOCUMENTATION</code> initialization
5269 argument is the documentation string from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form. If
5270 there is no documentation string in the macro form this initialization
5271 argument either does not appear, or appears with a value of false.
5272 </li><li class="listitem">Any other initialization argument produced in
5273 conjunction with the method function are also included.</li><li class="listitem">The implementation is free to include additional
5274 initialization arguments provided these are not symbols accessible in
5275 the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, or exported by any package defined in the
5276 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li></ul></div><p>In the third step, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> is called to add the newly created
5277 method to the set of methods associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</p><p>The result of the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> is returned as the result
5278 of evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</p><p>An example showing a typical <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form and a sample
5279 expansion is shown in the following example:
5280 </p><div class="informalexample"><a id="defmethod-ex-1"></a><p>An example <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form and one possible correct
5281 expansion. In the expansion, <em class="replaceable"><code>method-lambda</code></em>
5282 is the result of calling <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> as described in
5283 <a class="xref" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">Section 29.6.3.1.1, “Processing Method Bodies”</a>.
5284 The initargs appearing after <code class="constant">:FUNCTION</code> are assumed to be additional
5285 initargs returned from the call to <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.</p><pre class="programlisting">
5286 (defmethod move :before ((p position) (l (eql 0))
5287 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (visiblyp t)
5288 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> color)
5289 (set-to-origin p)
5290 (when visiblyp (show-move p 0 color)))
5291
5292 (let ((#:g001 (ensure-generic-function 'move)))
5293 (add-method #:g001
5294 (make-instance (generic-function-method-class #:g001)
5295 :qualifiers '(:before)
5296 :specializers (list (find-class 'position)
5297 (intern-eql-specializer 0))
5298 :lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (visiblyp t)
5299 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> color)
5300 :function (function <em class="replaceable"><code>method-lambda</code></em>)
5301 'additional-initarg-1 't
5302 'additional-initarg-2 '39)))
5303 </pre></div><p>The processing of the method body for this method is shown
5304 <a class="link" href="#defmethod-ex-2">below</a>.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-defmethod-body"></a>29.6.3.1.1. Processing Method Bodies</h5></div></div></div><p>Before a method can be created, the list of forms comprising the
5305 method body must be converted to a method function. This conversion is
5306 a two step process.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The body of methods can also appear in the
5307 <code class="constant">:METHOD</code> option of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> forms. Initial methods are
5308 not considered by any of the protocols specified in this document.
5309 </p></div><div class="informalexample"><a id="defmethod-ex-2"></a><p>During macro-expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro shown in
5310 the <a class="link" href="#defmethod-ex-1">previous example</a> code
5311 similar to this would be run to produce the method lambda and
5312 additional initargs. In this example, <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> is the macroexpansion
5313 environment of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro form.</p><pre class="programlisting">
5314 (let ((gf (ensure-generic-function 'move)))
5315 (make-method-lambda
5316 gf
5317 (class-prototype (generic-function-method-class gf))
5318 '(lambda (p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (visiblyp t) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> color)
5319 (set-to-origin p)
5320 (when visiblyp (show-move p 0 color)))
5321 <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>))
5322 </pre></div><p>The first step occurs during macro-expansion of the macro form.
5323 In this step, the method <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>, declarations and body are
5324 converted to a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> called a <strong class="first"><em class="firstterm">method lambda
5325 <a id="method-lambda" class="indexterm"></a></em></strong>.
5326 This conversion is based on information associated with the generic
5327 function definition in effect at the time the macro form is expanded.</p><p>The generic function definition is obtained by calling <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> with
5328 a first argument of the generic function name specified in the macro form.
5329 The <code class="constant">:LAMBDA-LIST</code> keyword argument is not passed in this call.</p><p>Given the generic function, production of the method lambda
5330 proceeds by calling <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.
5331 The first argument in this call is the generic function obtained as
5332 described above.
5333 The second argument is the result of calling <a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> on the
5334 result of calling <a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> on the generic function.
5335 The third argument is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> formed from the method <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>,
5336 declarations and body.
5337 The fourth argument is the macro-expansion environment of the macro
5338 form; this is the value of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;ENVIRONMENT</code></a> argument to the
5339 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro.</p><p>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> returns two values.
5340 The first is the method lambda itself.
5341 The second is a list of initialization arguments and values. These are
5342 included in the initialization arguments when the method is created.</p><p>In the second step, the method lambda is converted to a function
5343 which properly captures the lexical scope of the macro form. This is
5344 done by having the method lambda appear in the macro-expansion as the
5345 argument of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> special form. During the subsequent
5346 evaluation of the macro-expansion, the result of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> special
5347 form is the method function.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>See <a class="xref" href="#no-make-method-lambda" title="The generic function CLOS:MAKE-METHOD-LAMBDA is not implemented">The generic function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code> is not implemented</a>.
5348 </p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-defmethod-mo"></a>29.6.3.1.2. Initialization of Generic Function and <a class="link" href="#mop-method-mo">method metaobject</a>s</h5></div></div></div><p>An example of creating a generic function and a <a class="link" href="#mop-method-mo">method metaobject</a>, and then
5349 adding the method to the generic function is shown below. This example
5350 is comparable to the method definition shown
5351 <a class="link" href="#defmethod-ex-1">above</a>:
5352 </p><pre class="programlisting">
5353 (let* ((gf (make-instance 'standard-generic-function
5354 :lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> visiblyp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>)))
5355 (method-class (generic-function-method-class gf)))
5356 (multiple-value-bind (lambda initargs)
5357 (make-method-lambda
5358 gf
5359 (class-prototype method-class)
5360 '(lambda (p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (visiblyp t) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> color)
5361 (set-to-origin p)
5362 (when visiblyp (show-move p 0 color)))
5363 nil)
5364 (add-method gf
5365 (apply #'make-instance method-class
5366 :function (compile nil lambda)
5367 :specializers (list (find-class 'position)
5368 (intern-eql-specializer 0))
5369 :qualifiers ()
5370 :lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (visiblyp t)
5371 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> color)
5372 initargs))))
5373 </pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-efficiency"></a>29.6.3.1.3. Efficiency</h5></div><div><h6 class="subtitle">Implementation dependent: only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> and some other
5374 implementations</h6></div></div></div><p>Methods created through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> have a faster calling
5375 convention than methods created through a portable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
5376 invocation.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-init-mo"></a>29.6.3.2. Initialization of <a class="link" href="#mop-method-mo">method metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-method-mo">method metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.
5377 The initialization arguments establish the definition of the method.
5378 A <a class="link" href="#mop-method-mo">method metaobject</a> cannot be redefined;
5379 calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-method-mo">method metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
5380 and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Portable programs must
5381 <span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
5382 initialize a <a class="link" href="#mop-method-mo">method metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
5383 initialize a <a class="link" href="#mop-method-mo">method metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
5384 <a class="link" href="#mop-method-mo">method metaobject</a> or to turn a non-method object into a <a class="link" href="#mop-method-mo">method metaobject</a>.
5385 </li></ul></div><p>Since metaobject classes may not be redefined,
5386 no behavior is specified for the result of calls to
5387 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-method-mo">method metaobject</a>s.
5388 Since the class of a <a class="link" href="#mop-method-mo">method metaobject</a> cannot be changed,
5389 no behavior is specified for the result of calls to
5390 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-method-mo">method metaobject</a>s.</p><p>During initialization, each initialization argument is checked
5391 for errors and then associated with the <a class="link" href="#mop-method-mo">method metaobject</a>. The value
5392 can then be accessed by calling the appropriate accessor as shown in
5393 <a class="xref" href="#mop-meth-initargs" title="Table 29.5. Initialization arguments and accessors for method metaobjects">Table 29.5, “Initialization arguments and accessors for method metaobjects”</a>.</p><p>This section begins with a description of the error checking and
5394 processing of each initialization argument. This is followed by a table
5395 showing the generic functions that can be used to access the stored
5396 initialization arguments. The section ends with a set of restrictions
5397 on portable methods affecting <a class="link" href="#mop-method-mo">method metaobject</a> initialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
5398 <em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
5399 supplied, initialization is performed as if <em class="replaceable"><code>value</code></em> had been supplied.
5400 For some initialization arguments this could be done by the use of
5401 default initialization arguments, but whether it is done this way is not
5402 specified. Implementations are free to define default initialization
5403 arguments for specified <a class="link" href="#mop-method-mo">method metaobject</a> classes. Portable programs
5404 are free to define default initialization arguments for portable
5405 subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:QUALIFIERS</code> argument is a list of method
5406 qualifiers. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if
5407 any element of the list is not a non-null atom. This argument
5408 defaults to the empty list.</li><li class="listitem">The <code class="constant">:LAMBDA-LIST</code> argument is the unspecialized
5409 <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a
5410 proper <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>. If this value is not supplied, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
5411 </li><li class="listitem">The <code class="constant">:SPECIALIZERS</code> argument is a list of the
5412 specializer metaobjects for the method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value
5413 is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if the length of the list differs from the
5414 number of required arguments in the <code class="constant">:LAMBDA-LIST</code> argument, or if
5415 any element of the list is not a specializer metaobject. If this
5416 value is not supplied, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</li><li class="listitem"> The <code class="constant">:FUNCTION</code> argument is a method function. It
5417 must be compatible with the methods on <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
5418 defined for this class of method and generic function with which it
5419 will be used. That is, it must accept the same number of arguments
5420 as all uses of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> that will call it supply. (See
5421 <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> and <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more information.)
5422 An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not supplied.</li><li class="listitem"> When the method being initialized is an instance of
5423 a subclass of <a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>, the <code class="constant">:SLOT-DEFINITION</code>
5424 initialization argument must be provided. Its value is the direct
5425 <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> which defines this accessor method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the value
5426 is not an instance of a subclass of <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.</li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is a string or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
5427 An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a string or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. This argument
5428 defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>After the processing and defaulting of initialization arguments
5429 described above, the value of each initialization argument is associated
5430 with the <a class="link" href="#mop-method-mo">method metaobject</a>. These values can then be accessed by calling the
5431 corresponding generic function. The correspondences are as follows:
5432
5433 </p><div class="table"><a id="mop-meth-initargs"></a><p class="title"><strong>Table 29.5. Initialization arguments and
5434 accessors for <a class="link" href="#mop-method-mo">method metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and&#10; accessors for method metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:QUALIFIERS</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a></td></tr><tr><td align="center"><code class="constant">:LAMBDA-LIST</code></td><td align="center"><a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></td></tr><tr><td align="center"><code class="constant">:SPECIALIZERS</code></td><td align="center"><a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a></td></tr><tr><td align="center"><code class="constant">:FUNCTION</code></td><td align="center"><a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a></td></tr><tr><td align="center"><code class="constant">:SLOT-DEFINITION</code></td><td align="center"><a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-mo-method"></a>29.6.3.2.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization
5435 behavior described above. Instead, the information needed to allow
5436 portable programs to specialize this behavior is presented in as a set
5437 of restrictions on the methods a portable program can define. The model
5438 is that portable initialization methods have access to the <a class="link" href="#mop-method-mo">method metaobject</a> when
5439 either all or none of the specified initialization has taken
5440 effect.</p><p>These restrictions govern the methods that a portable program can
5441 define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
5442 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
5443 apply only to methods on these generic functions for which the first
5444 specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>. Other portable
5445 methods on these generic functions are not affected by these
5446 restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
5447 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>:
5448 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
5449 </li><li class="listitem">Portable programs may define around-methods, but
5450 these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
5451 are run, none of the initialization behavior described above has been
5452 completed.</li><li class="listitem">Portable after-methods must assume that when they
5453 are run, all of the initialization behavior described above has been
5454 completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
5455 these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-customize"></a>29.6.4. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="extract-lambda-list"></a>29.6.4.1. Function <a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> <em class="replaceable"><code>specialized-lambda-list</code></em>)
5456 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specialized-lambda-list</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> as accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>.
5457 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>An unspecialized <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.
5458 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function takes a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> and
5459 returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> with the specializers removed. This is a
5460 non-destructive operation. Whether the result shares any structure
5461 with the argument is unspecified.</p><p class="simpara">If the <em class="replaceable"><code>specialized-lambda-list</code></em> argument does not have legal syntax,
5462 an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. This syntax checking does not check the syntax of the
5463 actual specializer names, only the syntax of the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> and
5464 where the specializers appear.
5465 </p></dd></dl></div><div class="informalexample"><a id="extract-lambda-list-ex"></a><pre class="programlisting">
5466 (<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '((p position)))
5467 ⇒ <code class="computeroutput">(P)</code>
5468 (<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '((p position) x y))
5469 ⇒ <code class="computeroutput">(P X Y)</code>
5470 (<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '(a (b (eql x)) c <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> i))
5471 ⇒ <code class="computeroutput">(A B C <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> I)</code>
5472 </pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="extract-specializer-names"></a>29.6.4.2. Function <a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a>
5473 <em class="replaceable"><code>specialized-lambda-list</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specialized-lambda-list</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> as accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>.
5474 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of specializer names.
5475 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function takes a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> and
5476 returns its specializer names. This is a non-destructive operation.
5477 Whether the result shares structure with the argument is unspecified.
5478 </p><p class="simpara">The list returned by this function
5479 will not be mutated by the implementation. The results are undefined
5480 if a portable program mutates the list returned by this function.</p><p class="simpara">The result of this function will be a list with a
5481 number of elements equal to the number of required arguments in
5482 <em class="replaceable"><code>specialized-lambda-list</code></em>. Specializers are defaulted to the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.
5483 </p><p class="simpara">If the <em class="replaceable"><code>specialized-lambda-list</code></em> argument does not have legal
5484 syntax, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. This syntax checking does not check the syntax
5485 of the actual specializer names, only the syntax of the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>
5486 and where the specializers appear.
5487 </p></dd></dl></div><div class="informalexample"><a id="extract-specializer-names-ex"></a><pre class="programlisting">
5488 (<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '((p position)))
5489 ⇒ <code class="computeroutput">(POSITION)</code>
5490 (<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '((p position) x y))
5491 ⇒ <code class="computeroutput">(POSITION T T)</code>
5492 (<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '(a (b (eql x)) c <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> i))
5493 ⇒ <code class="computeroutput">(T (EQL X) T)</code>
5494 </pre></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-accessors"></a>29.7. Accessor Methods</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-acc-readers"></a>29.7.1. Introspection</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="accessor-method-slotdef"></a>29.7.1.1. Generic Function <a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>This accessor can only be called on accessor methods. It returns
5495 the <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> that defined this method. This is the value of the
5496 <code class="constant">:SLOT-DEFINITION</code> initialization argument associated with the method during
5497 initialization.</p><div class="variablelist"><p class="title"><strong>The specified methods for the accessor <a class="link" href="#mop-method-mo">method metaobject</a>
5498 readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a>
5499 (<em class="replaceable"><code>method</code></em> <a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
5500 method beyond that which is specified for the generic function.</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-acc-customize"></a>29.7.2. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="reader-method-class"></a>29.7.2.1. Generic Function <a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>direct-slot-definition</code></em>
5501 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definition</code></em></span></dt><dd>a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>alternating initialization argument names and values.
5502 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
5503 class of reader methods created during class initialization and
5504 reinitialization. The result must be a subclass of
5505 <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument must be the same as will be passed
5506 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> to create the reader method. The <em class="replaceable"><code>initargs</code></em>
5507 must include <code class="constant">:SLOT-DEFINITION</code> with <em class="replaceable"><code>slot-definition</code></em> as its value.
5508 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a>
5509 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
5510 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a>
5511 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
5512 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class
5513 <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="writer-method-class"></a>29.7.2.2. Generic Function <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a> <em class="replaceable"><code>class</code></em>
5514 <em class="replaceable"><code>direct-slot</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)
5515 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot</code></em></span></dt><dd>a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of initialization arguments and values.
5516 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
5517 class of writer methods created during class initialization and
5518 reinitialization. The result must be a subclass of
5519 <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument must be the same as will be passed
5520 to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> to create the reader method. The <em class="replaceable"><code>initargs</code></em>
5521 must include <code class="constant">:SLOT-DEFINITION</code> with <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> as its value.
5522 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a>
5523 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)
5524 (<em class="replaceable"><code>direct-slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
5525 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a>
5526 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)
5527 (<em class="replaceable"><code>direct-slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
5528 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class
5529 <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-specializers"></a>29.8. Specializers</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-specializers-inheritance"></a>29.8.1. Inheritance Structure of Specializer Metaobject Classes</h3></div></div></div><div class="figure"><a id="mop-specializers-inheritance-fig"></a><p class="title"><strong>Figure 29.6. Inheritance structure of specializer metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-specializer.png" width="100%" alt="Inheritance structure of specializer metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-readers"></a>29.8.2. Introspection</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="eql-specializer-object"></a>29.8.2.1. Function <a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a>
5530 <em class="replaceable"><code>eql-specializer</code></em>)
5531 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>eql-specializer</code></em></span></dt><dd>an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject.
5532 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function returns the object associated with
5533 <em class="replaceable"><code>eql-specializer</code></em> during initialization.
5534 The value is guaranteed to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> to the value originally passed
5535 to <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a>, but it is not necessarily <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to that
5536 value.</p><p class="simpara">This function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if
5537 <em class="replaceable"><code>eql-specializer</code></em> is not an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>
5538 specializer.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-init"></a>29.8.3. Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="intern-eql-specializer"></a>29.8.3.1. Function <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a>
5539 <em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>any Lisp object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject for <em class="replaceable"><code>object</code></em>.
5540 </dd><dt><span class="term">Purpose</span></dt><dd>This function returns the unique <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer
5541 metaobject for <em class="replaceable"><code>object</code></em>, creating one if necessary. Two calls to
5542 <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> arguments will return the same
5543 (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>) value.</dd></dl></div><p><strong>Remarks. </strong>The result of calling <a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a> on the result of a
5544 call to <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> is only guaranteed to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> to the
5545 original <em class="replaceable"><code>object</code></em> argument, not necessarily <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-dep"></a>29.8.4. Updating Dependencies</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="specializer-direct-methods"></a>29.8.4.1. Generic Function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5546 <em class="replaceable"><code>specializer</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
5547 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
5548 </dd><dt><span class="term">Purpose</span></dt><dd>This generic function returns the possibly empty set
5549 of those methods, connected to generic functions, which have
5550 <em class="replaceable"><code>specializer</code></em> as a specializer. The elements of this set are
5551 <a class="link" href="#mop-method-mo">method metaobject</a>s. This value is maintained by the generic
5552 functions <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> and <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.
5553 </dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5554 (<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5555 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5556 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5557 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
5558 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
5559 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5560 (<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>))</code></span></span></dt><dd>No behavior is specified for this
5561 method beyond that which is specified for the generic function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="specializer-direct-gfs"></a>29.8.4.2. Generic Function <a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
5562 <em class="replaceable"><code>specializer</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
5563 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.
5564 </dd><dt><span class="term">Purpose</span></dt><dd>This generic function returns the possibly empty set
5565 of those generic functions which have a method with <em class="replaceable"><code>specializer</code></em>
5566 as a specializer. The elements of this set are <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s. This value
5567 is maintained by the generic functions <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> and
5568 <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
5569 (<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5570 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5571 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5572 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
5573 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5574 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
5575 (<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>))</code></span></span></dt><dd>No behavior is specified for this
5576 method beyond that which is specified for the generic function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-direct-method"></a>29.8.4.3. Generic Function <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5577 <em class="replaceable"><code>specializer</code></em> <em class="replaceable"><code>method</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
5578 </dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5579 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
5580 backpointers from a specializer to the set of methods specialized to
5581 it. If <em class="replaceable"><code>method</code></em> is already in the set, it is not added again (no
5582 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">This set can be accessed as a list by calling the generic
5583 function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>. Methods are removed from the
5584 set by <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.</p><p class="simpara">The generic function <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> is called by
5585 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> whenever a method is added to a generic function. It is
5586 called once for each of the specializers of the method. Note that in
5587 cases where a specializer appears more than once in the specializers
5588 of a method, this generic function will be called more than once with
5589 the same specializer as argument.</p><p class="simpara">The results are undefined if the <em class="replaceable"><code>specializer</code></em> argument
5590 is not one of the specializers of the <em class="replaceable"><code>method</code></em> argument.
5591 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5592 (<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
5593 function for class specializers.</p><p class="simpara">No behavior is specified for this
5594 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5595 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
5596 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal">
5597 <a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5598 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div><p>
5599 </p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5600 (<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>)
5601 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
5602 function for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p class="simpara">No behavior is specified for this
5603 method beyond that which is specified for the generic function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-direct-method"></a>29.8.4.4. Generic Function <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> <em class="replaceable"><code>specializer</code></em>
5604 <em class="replaceable"><code>method</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
5605 </dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5606 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
5607 backpointers from a specializer to the set of methods specialized to
5608 it. If <em class="replaceable"><code>method</code></em> is in the set it is removed. If it is not, no
5609 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">This set can be accessed as a list by calling the generic
5610 function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>. Methods are added to the set
5611 by <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>.</p><p class="simpara">The generic function <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> is called by
5612 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> whenever a method is removed from a generic function.
5613 It is called once for each of the specializers of the method. Note
5614 that in cases where a specializer appears more than once in the
5615 specializers of a method, this generic function will be called more
5616 than once with the same specializer as argument.</p><p class="simpara">The results are undefined if the <em class="replaceable"><code>specializer</code></em> argument is
5617 not one of the specializers of the <em class="replaceable"><code>method</code></em> argument.
5618 </p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
5619 (<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
5620 function for class specializers.</p><p class="simpara">No behavior is specified for this
5621 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5622 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
5623 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
5624 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
5625 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
5626 (<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>)
5627 (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
5628 function for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p class="simpara">No behavior is specified for this
5629 method beyond that which is specified for the generic function.</p></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-meth-comb"></a>29.9. Method Combinations</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-comb-inheritance"></a>29.9.1. Inheritance Structure of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-meth-comb-inheritance-fig"></a><p class="title"><strong>Figure 29.7. Inheritance structure of method combination metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-methcomb.png" width="100%" alt="Inheritance structure of method combination metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-comb-customize"></a>29.9.2. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="find-method-combination"></a>29.9.2.1. Generic Function <a class="link" href="#find-method-combination" title="29.9.2.1. Generic Function CLOS:FIND-METHOD-COMBINATION"><code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#find-method-combination" title="29.9.2.1. Generic Function CLOS:FIND-METHOD-COMBINATION"><code class="function">CLOS:FIND-METHOD-COMBINATION</code></a> <em class="replaceable"><code>generic-function</code></em>
5630 <em class="replaceable"><code>method-combination-type-name</code></em>
5631 <em class="replaceable"><code>method-combination-options</code></em>)
5632 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method-combination-type-name</code></em></span></dt><dd>a symbol which names a type of method combination.
5633 </dd><dt><span class="term"><em class="replaceable"><code>method-combination-options</code></em></span></dt><dd>a list of arguments to the method combination type.
5634 </dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd>This generic function is called to determine the
5635 method combination object used by a generic function.
5636 </dd></dl></div><p><strong>Remarks. </strong>Further details of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>s are not specified.
5637 </p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-slot-access"></a>29.10. Slot Access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-instance-struct"></a>29.10.1. Instance Structure Protocol</h3></div></div></div><p>The instance structure protocol is responsible for implementing
5638 the behavior of the slot access functions like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> and
5639 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code>.</p><p>For each <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> slot access function other than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-exists-p.html" target="_top"><code class="function">SLOT-EXISTS-P</code></a>,
5640 there is a corresponding generic function which actually provides the
5641 behavior of the function. When called, the slot access function finds
5642 the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>, calls the corresponding generic function and
5643 returns its result. The arguments passed on to the generic function
5644 include one additional value, the class of the <em class="replaceable"><code>object</code></em> argument,
5645 which always immediately precedes the <em class="replaceable"><code>object</code></em> argument.</p><div class="table"><a id="mop-sa-instance-struct-table"></a><p class="title"><strong>Table 29.6. The correspondence between slot access function and
5646 underlying slot access generic function</strong></p><div class="table-contents"><table class="table" summary="The correspondence between slot access function and&#10; underlying slot access generic function" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Slot Access Function</th><th align="center">Corresponding
5647 Slot Access Generic Function</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr></tbody></table></div></div><br class="table-break" /><p>At the lowest level, the instance structure protocol provides only
5648 limited mechanisms for portable programs to control the implementation
5649 of instances and to directly access the storage associated with
5650 instances without going through the indirection of slot access. This is
5651 done to allow portable programs to perform certain commonly requested
5652 slot access optimizations.</p><p>In particular, portable programs can control the implementation
5653 of, and obtain direct access to, slots with allocation <code class="constant">:INSTANCE</code> and
5654 type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>. These are called <strong class="first"><em class="firstterm">directly accessible slots
5655 <a id="slot-directly-accessible" class="indexterm"></a></em></strong>.</p><p>The relevant specified around-method on <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> determines
5656 the implementation of instances by deciding how each slot in the
5657 instance will be stored. For each directly accessible slot, this method
5658 allocates a <strong class="first"><em class="firstterm">location
5659 <a id="slot-location" class="indexterm"></a>
5660 </em></strong> and associates it with the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
5661 The location can be accessed by calling the <a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a>
5662 generic function. Locations are non-negative integers. For a given
5663 class, the locations increase consecutively, in the order that the
5664 directly accessible slots appear in the list of effective slots. (Note
5665 that here, the next paragraph, and the specification of this
5666 around-method are the only places where the value returned by
5667 <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is described as a list rather than a set.)</p><p>Given the location of a directly accessible slot, the value of
5668 that slot in an instance can be accessed with the appropriate accessor.
5669 For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, this accessor is the function
5670 <a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a>. For <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>, this
5671 accessor is the function <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a>.
5672 In each case, the arguments to the accessor are the instance and the
5673 slot location, in that order. See the definition of each accessor for
5674 additional restrictions on the use of these function.</p><p>Portable programs are permitted to affect and rely on the
5675 allocation of locations only in the following limited way: By first
5676 defining a portable primary method on <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> which orders the
5677 returned value in a predictable way, and then relying on the defined
5678 behavior of the specified around-method to assign locations to all
5679 directly accessible slots. Portable programs may compile-in calls to
5680 low-level accessors which take advantage of the resulting predictable
5681 allocation of slot locations.</p><div class="informalexample"><a id="mop-sa-instance-struct-ex"></a><p>This example shows the use of this mechanism to implement a new
5682 <a class="link" href="#mop-class-mo">class metaobject</a> class, <code class="classname">ordered-class</code> and class
5683 option <code class="constant">:SLOT-ORDER</code>. This option provides control
5684 over the allocation of slot locations. In this simple example
5685 implementation, the <code class="constant">:SLOT-ORDER</code> option is not
5686 inherited by subclasses; it controls only instances of the class
5687 itself.
5688 </p><pre class="programlisting">
5689 (defclass ordered-class (standard-class)
5690 ((slot-order :initform ()
5691 :initarg :slot-order
5692 :reader class-slot-order)))
5693
5694 (defmethod compute-slots ((class ordered-class))
5695 (let ((order (class-slot-order class)))
5696 (sort (copy-list (call-next-method))
5697 #'(lambda (a b)
5698 (&lt; (position (slot-definition-name a) order)
5699 (position (slot-definition-name a) order))))))
5700 </pre><p>
5701
5702 Following is the source code the user of this extension would write.
5703 Note that because the code above does not implement inheritance of
5704 the <code class="constant">:SLOT-ORDER</code> option, the function
5705 <code class="function">distance</code> must not be called on instances of
5706 subclasses of <code class="classname">point</code>; it can only be called on
5707 instances of <code class="classname">point</code> itself.
5708
5709 </p><pre class="programlisting">
5710 (defclass point ()
5711 ((x :initform 0)
5712 (y :initform 0))
5713 (:metaclass ordered-class)
5714 (:slot-order x y))
5715
5716 (defun distance (point)
5717 (sqrt (/ (+ (expt (standard-instance-access point 0) 2)
5718 (expt (standard-instance-access point 1) 2))
5719 2.0)))
5720 </pre><p>
5721
5722 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>You cannot assume that the slot-location
5723 values start at 0. In class <code class="classname">point</code>, for
5724 example, <em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em> will be at slot locations 1 and 2, not 0 and
5725 1.</p></div><p>
5726
5727 In more realistic uses of this mechanism, the calls to the low-level
5728 instance structure accessors would not actually appear textually in the
5729 source program, but rather would be generated by a meta-level analysis
5730 program run during the process of compiling the source program.
5731 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-funcallable"></a>29.10.2. Funcallable Instances</h3></div></div></div><p>Instances of classes which are themselves instances of
5732 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> or one of its subclasses are called
5733 <strong class="first"><em class="firstterm">funcallable instances</em></strong>.
5734 Funcallable instances can only be created by
5735 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
5736 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>.</p><p>Like standard instances, funcallable instances have slots with the
5737 normal behavior. They differ from standard instances in that they can
5738 be used as functions as well; that is, they can be passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>
5739 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a>, and they can be stored as the definition of a function
5740 name. Associated with each funcallable instance is the function which
5741 it runs when it is called. This function can be changed with
5742 <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>.</p><div class="informalexample"><a id="mop-sa-funcallable-ex"></a><p>The following simple example shows the use of funcallable
5743 instances to create a simple, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>-like facility. (Funcallable
5744 instances are useful when a program needs to construct and maintain a
5745 set of functions and information about those functions. They make it
5746 possible to maintain both as the same object rather than two separate
5747 objects linked, for example, by hash tables.)
5748
5749 </p><pre class="programlisting">
5750 (defclass constructor ()
5751 ((name :initarg :name :accessor constructor-name)
5752 (fields :initarg :fields :accessor constructor-fields))
5753 (:metaclass funcallable-standard-class))
5754 ⇒ <code class="computeroutput">#&gt;FUNCALLABLE-STANDARD-CLASS CONSTRUCTOR&gt;</code>
5755 (defmethod initialize-instance :after ((c constructor) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>)
5756 (with-slots (name fields) c
5757 (set-funcallable-instance-function
5758 c
5759 #'(lambda ()
5760 (let ((new (make-array (1+ (length fields)))))
5761 (setf (aref new 0) name)
5762 new)))))
5763 ⇒ <code class="computeroutput">#&lt;STANDARD-METHOD :AFTER (#&lt;FUNCALLABLE-STANDARD-CLASS CONSTRUCTOR&gt;)&gt;</code>
5764 (setq c1 (make-instance 'constructor :name 'position :fields '(x y)))
5765 ⇒ <code class="computeroutput">#&lt;CONSTRUCTOR #&lt;UNBOUND&gt;&gt;</code>
5766 (setq p1 (funcall c1))
5767 ⇒ <code class="computeroutput">#(POSITION NIL NIL)</code>
5768 </pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-customize"></a>29.10.3. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="standard-instance-access"></a>29.10.3.1. Function <a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a>
5769 <em class="replaceable"><code>instance</code></em> <em class="replaceable"><code>location</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>instance</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>location</code></em></span></dt><dd>a slot location</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to provide direct access to
5770 a slot in an instance. By usurping the normal slot lookup protocol,
5771 this function is intended to provide highly optimized access to the
5772 slots associated with an instance.</p><p>The following restrictions apply to the use of this function:
5773 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument must be a
5774 standard instance (it must have been returned by
5775 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span>).
5776 </li><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument cannot be an
5777 non-updated obsolete instance.</li><li class="listitem">The <em class="replaceable"><code>location</code></em> argument must be a location of
5778 one of the directly accessible slots of the instance's class.
5779 </li><li class="listitem">The slot must be bound.
5780 </li></ul></div><p class="simpara">The results are undefined if any of
5781 these restrictions are violated.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second and third restrictions do not
5782 apply in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation supports non-updated
5783 obsolete instances and also supports slots with allocation <code class="constant">:CLASS</code>.
5784 </p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="funcallable-standard-instance-access"></a>29.10.3.2. Function <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a>
5785 <em class="replaceable"><code>instance</code></em> <em class="replaceable"><code>location</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>instance</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>location</code></em></span></dt><dd>a slot location</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to provide direct access to
5786 a slot in an instance. By usurping the normal slot lookup protocol,
5787 this function is intended to provide highly optimized access to the
5788 slots associated with an instance.</p><p>The following restrictions apply to the use of this function:
5789 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument must be a
5790 funcallable instance (it must have been returned by
5791 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
5792 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>).</li><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument cannot be an
5793 non-updated obsolete instance.</li><li class="listitem">The <em class="replaceable"><code>location</code></em> argument must be a location of
5794 one of the directly accessible slots of the instance's class.
5795 </li><li class="listitem">The slot must be bound.
5796 </li></ul></div><p class="simpara">The results are undefined if any of
5797 these restrictions are violated.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second and third restrictions do not
5798 apply in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation supports non-updated
5799 obsolete instances and also supports slots with allocation <code class="constant">:CLASS</code>.
5800 </p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="set-fif"></a>29.10.3.3. Function <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>
5801 <em class="replaceable"><code>funcallable-instance</code></em> <em class="replaceable"><code>function</code></em>)
5802 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>funcallable-instance</code></em></span></dt><dd>a funcallable instance (it must have been returned by
5803 <span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
5804 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>).
5805 </dd><dt><span class="term"><em class="replaceable"><code>function</code></em></span></dt><dd>A function.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5806 </dd><dt><span class="term">Purpose</span></dt><dd>This function is called to set or to change the
5807 function of a funcallable instance. After
5808 <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a> is called, any subsequent calls
5809 to <em class="replaceable"><code>funcallable-instance</code></em> will run the new
5810 function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-value-UC"></a>29.10.3.4. Generic Function <a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em>
5811 <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
5812 <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
5813 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> with the class
5814 of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its
5815 third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> returns the value
5816 contained in the given slot of the given object. If the slot is
5817 unbound, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-unbound.html" target="_top"><code class="function">SLOT-UNBOUND</code></a> is called.</p><p class="simpara">The results are undefined if
5818 the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
5819 if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
5820 slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
5821 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5822 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
5823 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5824 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
5825 the full behavior of this generic function for slots with allocation
5826 <code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
5827 other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
5828 but may require overriding other methods in the standard implementation
5829 of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
5830 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
5831 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-slot-value-UC"></a>29.10.3.5. Generic Function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>class</code></em>
5832 <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>new-value</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
5833 <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-value</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">The generic function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> implements
5834 the behavior of the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> function. It is called by
5835 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> with the class of <em class="replaceable"><code>object</code></em> as its second argument
5836 and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its fourth argument.</p><p class="simpara">The generic function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> sets the value
5837 contained in the given slot of the given object to the given new
5838 value; any previous value is lost.</p><p class="simpara">The results are undefined if
5839 the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
5840 if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
5841 slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
5842 <em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5843 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
5844 <em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5845 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
5846 the full behavior of this generic function for slots with allocation
5847 <code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
5848 other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
5849 but may require overriding other methods in the standard implementation
5850 of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
5851 <em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
5852 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-boundp-UC"></a>29.10.3.6. Generic Function <a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em>
5853 <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
5854 <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
5855 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> with the class
5856 of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its
5857 third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> tests whether a
5858 specific slot in an instance is bound.</p><p class="simpara">The results are undefined if
5859 the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
5860 if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
5861 slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
5862 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5863 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
5864 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5865 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
5866 the full behavior of this generic function for slots with allocation
5867 <code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
5868 other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
5869 but may require overriding other methods in the standard implementation
5870 of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
5871 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</dd></dl></div><p><strong>Remarks. </strong>In cases where the <a class="link" href="#mop-class-mo">class metaobject</a> class does not distinguish
5872 unbound slots, true should be returned.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-makunbound-UC"></a>29.10.3.7. Generic Function <a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em>
5873 <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
5874 <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
5875 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> with
5876 the class of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent
5877 <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> restores a slot in
5878 an object to its unbound state. The interpretation
5879 of <span class="quote">“<span class="quote">restoring a slot to its unbound state</span>”</span> depends on
5880 the <a class="link" href="#mop-class-mo">class metaobject</a> class.</p><p class="simpara">The results are undefined if
5881 the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
5882 if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
5883 slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
5884 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5885 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
5886 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
5887 (<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
5888 the full behavior of this generic function for slots with allocation
5889 <code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
5890 other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
5891 but may require overriding other methods in the standard implementation
5892 of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
5893 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
5894 </dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-dep-maint"></a>29.11. Dependent Maintenance</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></dd></dl></div><p>It is convenient for portable metaobjects to be able to memoize
5895 information about other metaobjects, portable or otherwise. Because
5896 class and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s can be reinitialized, and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s can be modified by
5897 adding and removing methods, a means must be provided to update this
5898 memoized information.</p><p>The dependent maintenance protocol supports this by providing a
5899 way to register an object which should be notified whenever a class or
5900 generic function is modified. An object which has been registered this
5901 way is called a <strong class="first"><em class="firstterm">dependent</em></strong> of the class or <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.
5902 The dependents of class and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s are maintained with <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
5903 and <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>. The dependents of a class or <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be
5904 accessed with <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>. Dependents are notified about a
5905 modification by calling <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>. (See the specification of
5906 <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> for detailed description of the circumstances under
5907 which it is called.)</p><p>To prevent conflicts between two portable programs, or between
5908 portable programs and the implementation, portable code must not
5909 register metaobjects themselves as dependents. Instead, portable
5910 programs which need to record a metaobject as a dependent, should
5911 encapsulate that metaobject in some other kind of object, and record
5912 that object as the dependent. The results are undefined if this
5913 restriction is violated.</p><div class="informalexample"><a id="mop-dep-maint-ex"></a><p>This example shows a general facility for encapsulating
5914 metaobjects before recording them as dependents. The facility defines a
5915 basic kind of encapsulating object: an updater. Specializations of the
5916 basic class can be defined with appropriate special updating behavior.
5917 In this way, information about the updating required is associated with
5918 each updater rather than with the metaobject being updated.</p><p>Updaters are used to encapsulate any metaobject which requires
5919 updating when a given class or generic function is modified. The
5920 function <code class="function">record-updater</code> is called to both create an
5921 updater and add it to the dependents of the class or generic function.
5922 Methods on the generic function <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>, specialized to the
5923 specific class of updater do the appropriate update work.</p><pre class="programlisting">
5924 (defclass updater ()
5925 ((dependent :initarg :dependent :reader dependent)))
5926
5927 (defun record-updater (class dependee dependent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> initargs)
5928 (let ((updater (apply #'make-instance class :dependent dependent
5929 initargs)))
5930 (add-dependent dependee updater)
5931 updater))
5932 </pre><p>A <code class="function">flush-cache-updater</code> simply flushes the
5933 cache of the dependent when it is updated.</p><pre class="programlisting">
5934 (defclass flush-cache-updater (updater) ())
5935
5936 (defmethod update-dependent (dependee (updater flush-cache-updater) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> args)
5937 (declare (ignore args))
5938 (flush-cache (dependent updater)))
5939 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-dep-maint-protocol"></a>29.11.1. Protocol</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="update-dependent"></a>29.11.1.1. Generic Function <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
5940 <em class="replaceable"><code>dependent</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>initargs</code></em>)
5941 </code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> - the metaobject being
5942 reinitialized or otherwise modified.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object - the dependent being updated.
5943 </dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of the initialization arguments for
5944 the metaobject redefinition.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5945 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to update a
5946 dependent of <em class="replaceable"><code>metaobject</code></em>.</p><p class="simpara">When a class or a generic function is reinitialized each of
5947 its dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument to
5948 <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> is the set of initialization arguments received by
5949 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</p><p class="simpara">When a method is added to a generic function, each of the
5950 generic function's dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument
5951 is a list of two elements: the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>, and the method
5952 that was added.</p><p class="simpara">When a method is removed from a generic function, each of the
5953 generic function's dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument
5954 is a list of two elements: the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>, and the method
5955 that was removed.</p><p>In each case, <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> is used to call
5956 <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> on each of the dependents. So, for example, the
5957 update of a generic function's dependents when a method is added
5958 could be performed by the following code:</p><pre class="programlisting">
5959 (<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> <em class="replaceable"><code>generic-function</code></em>
5960 #'(lambda (dep)
5961 (<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> <em class="replaceable"><code>generic-function</code></em>
5962 dep 'add-method new-method)))
5963 </pre></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
5964 use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-dependent"></a>29.11.1.2. Generic Function <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
5965 <em class="replaceable"><code>dependent</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5966 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function adds <em class="replaceable"><code>dependent</code></em> to the
5967 dependents of <em class="replaceable"><code>metaobject</code></em>. If <em class="replaceable"><code>dependent</code></em> is already in the set
5968 of dependents it is not added again (no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">The generic function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> can be called to access
5969 the set of dependents of a class or generic function. The generic
5970 function <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> can be called to remove an object from
5971 the set of dependents of a class or generic function. The effect of
5972 calling <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> while a call to
5973 <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> on the same class or generic function is in progress
5974 is unspecified.</p><p class="simpara">The situations in which <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> is called are not
5975 specified.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
5976 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5977 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5978 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
5979 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
5980 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
5981 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5982 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5983 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
5984 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
5985 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
5986 (<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
5987 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
5988 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
5989 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
5990 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
5991 use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-dependent"></a>29.11.1.3. Generic Function <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
5992 <em class="replaceable"><code>dependent</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
5993 </dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function removes <em class="replaceable"><code>dependent</code></em> from the
5994 dependents of <em class="replaceable"><code>metaobject</code></em>. If <em class="replaceable"><code>dependent</code></em> is not one of the
5995 dependents of <em class="replaceable"><code>metaobject</code></em>, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">The generic function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> can be called to access
5996 the set of dependents of a class or generic function. The generic
5997 function <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> can be called to add an object from the set
5998 of dependents of a class or generic function. The effect of calling
5999 <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> while a call to
6000 <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> on the same class or generic function is in progress
6001 is unspecified.</p><p class="simpara">The situations in which <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> is called are not
6002 specified.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6003 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6004 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6005 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6006 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6007 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6008 (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6009 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6010 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6011 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6012 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6013 (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6014 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6015 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6016 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6017 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
6018 use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="map-dependents"></a>29.11.1.4. Generic Function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> <em class="replaceable"><code>metaobject</code></em>
6019 <em class="replaceable"><code>function</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>function</code></em></span></dt><dd>a function which accepts one argument.
6020 </dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
6021 </dd><dt><span class="term">Purpose</span></dt><dd>This generic function applies <em class="replaceable"><code>function</code></em> to each of
6022 the dependents of <em class="replaceable"><code>metaobject</code></em>. The order in which the dependents
6023 are processed is not specified, but <em class="replaceable"><code>function</code></em> is applied to each
6024 dependent once and only once. If, during the mapping,
6025 <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> is called to alter the
6026 dependents of <em class="replaceable"><code>metaobject</code></em>, it is not specified whether the newly
6027 added or removed dependent will have <em class="replaceable"><code>function</code></em> applied to it.
6028 </dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6029 (<em class="replaceable"><code>metaobject</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6030 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6031 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6032 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6033 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6034 (<em class="replaceable"><code>metaobject</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6035 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6036 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6037 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6038 (<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
6039 (<em class="replaceable"><code>metaobject</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
6040 method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
6041 following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
6042 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
6043 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
6044 use of this facility.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-clisp"></a>29.12. Deviations from [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></dd></dl></div><p>This section lists the differences between the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] and the
6045 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation thereof.</p><div class="itemizedlist"><a id="mop-not-in-clisp"></a><p class="title"><strong>Not implemented in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> is not implemented.
6046 See <a class="xref" href="#mop-gf-invocation" title="29.5.3.2. Generic Function Invocation Protocol">Section 29.5.3.2, “Generic Function Invocation Protocol”</a>.</p></li></ul></div><div class="itemizedlist"><a id="mop-clisp-different"></a><p class="title"><strong>Features implemented differently in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The class precedence list of <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>
6047 is different. See <a class="xref" href="#mop-mo-cl-inheritance" title="29.2.2. Inheritance Structure of Metaobject Classes">Section 29.2.2, “Inheritance Structure of Metaobject Classes”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro passes default values to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
6048 See <a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macro passes default values to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
6049 See <a class="xref" href="#mop-gf-init-defgeneric" title="29.5.3.1. Macro DEFGENERIC">Section 29.5.3.1, “Macro <code class="function">DEFGENERIC</code>”</a>.</p></li><li class="listitem"><p>The class <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is implemented differently.
6050 See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></li><li class="listitem"><p>The function <a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
6051 if the generic function has no <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p></li><li class="listitem"><p>It is not possible to create a class with metaclass
6052 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> when specifying a superclass with metaclass
6053 <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>, even though <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a>
6054 returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for this situation.
6055
6056 </p></li></ul></div><div class="itemizedlist"><a id="mop-clisp-ext"></a><p class="title"><strong>Extensions specific to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is applicable to classes of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a>.
6057 The default superclass for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> instances is
6058 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>.
6059 Structure classes do not support multiple inheritance and reinitialization.
6060 See <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>.
6061 See also <a class="xref" href="#defstruct-mop" title="8.2. The structure Meta-Object Protocol">Section 8.2, “The structure Meta-Object Protocol”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macro supports user-defined options.
6062 See <a class="xref" href="#mop-defgeneric-user-options" title="User-defined options">User-defined options</a>.</p></li><li class="listitem"><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> is subclassable.
6063 See <a class="xref" href="#mop-mo-cl-inheritance" title="29.2.2. Inheritance Structure of Metaobject Classes">Section 29.2.2, “Inheritance Structure of Metaobject Classes”</a>.</p></li><li class="listitem"><p>Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are allowed.
6064 See <a class="xref" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME">Section 29.4.2.1.1, “Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code>”</a>.</p></li><li class="listitem"><p>The <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> method is more permissive by
6065 default and does not need to be overridden in
6066 some <span class="quote">“<span class="quote">obvious</span>”</span> cases.
6067 See <a class="xref" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS">Section 29.3.6.7, “Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code>”</a>.</p></li><li class="listitem"><p>New generic function <a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a>. It can sometimes
6068 be used when overriding <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> is cumbersome.</p></li><li class="listitem"><p>New generic function <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>. It can sometimes
6069 be used when overriding <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> is cumbersome.</p></li><li class="listitem"><p>New function <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>. It
6070 can be used in overriding methods of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>.
6071 </p></li><li class="listitem"><p>The generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> accepts a
6072 <code class="constant">:DECLARE</code> keyword.</p></li><li class="listitem"><p>The functions <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a> and
6073 <a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a> support non-updated obsolete instances and
6074 also support slots with allocation <code class="constant">:CLASS</code>.</p></li><li class="listitem"><p>The existence of the function <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
6075 does not prevent otherwise unreferenced classes from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
6076 </p></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-clisp-warn"></a>29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></div><p>When <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> encounters suspicious or suboptimal <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> code,
6077 it issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> of type <code class="classname">CLOS:CLOS-WARNING</code>
6078 or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> of type <code class="classname">CLOS:CLOS-STYLE-WARNING</code>.
6079 To suppress the undesired warnings (<span class="strong"><strong>not</strong></span> recommended!) use
6080 <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">MUFFLE-WARNING</code></a> on the appropriate
6081 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> type;.
6082 To find where the warnings come from (recommended), set
6083 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a> to the appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> type.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-clisp-gf-already-called-warning"></a>29.12.1.1. Warning
6084 <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></h4></div></div></div><p>This is a hint that the order in which program files are loaded
6085 (order of definitions, order of macro expansions, or similar) may be wrong.
6086 Example:<a id="mop-clisp-gf-already-called-warning-code"></a></p><pre class="programlisting">
6087 (defclass ware () ((title :initarg :title :accessor title)))
6088 (defclass book (ware) ())
6089 (defclass compact-disk (ware) ())
6090 (defclass dvd (ware) ())
6091 (defgeneric add-to-inventory (object))
6092 (defmethod add-to-inventory ((object ware)) nil)
6093 (add-to-inventory (make-instance 'book :title "CLtL1"))
6094 (defvar *book-counter* 0)
6095 (defmethod add-to-inventory ((object book)) (incf *book-counter*))
6096 (add-to-inventory (make-instance 'book :title "CLtL2"))
6097 *book-counter*
6098 ⇒ <code class="computeroutput">1</code>
6099 </pre><p>
6100 Since <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> and <a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a> were already added to the inventory, the
6101 programmer might have expected that <code class="varname">*book-counter*</code>
6102 is 2.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">No warning for standard generic functions</h3><p>A few functions, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>, are listed in the
6103 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] and the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] as <span class="quote">“<span class="quote">standard generic functions</span>”</span>,
6104 to which users may add methods.
6105 This warning is <span class="strong"><strong>not</strong></span> issued for such functions.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
6106 behavior officially sanctioned by the standard and useful in some situations.
6107 We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
6108 behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-already-called-warning-motivation"></a>Motivation</h5></div></div></div><p>A generic function is defined by a contract.
6109 Whoever adds a method to a generic function, however, also
6110 expects the contract to be fulfilled.
6111 (In the example above, the contract is that
6112 <code class="varname">*book-counter*</code> equals the number of invocations
6113 of <code class="function">add-to-inventory</code> on
6114 <code class="classname">book</code> instances.)
6115 If the generic function has already been called before the
6116 method was added, the method's contract is definitely broken.
6117 Maybe the programmer has foreseen this case (in this example:
6118 he could initialize <code class="varname">*book-counter*</code> to the number of
6119 instances of <code class="classname">book</code> that exist at this moment,
6120 rather than to <code class="literal">0</code>), or maybe not. This is what the warning is about.
6121 </p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-dynamically-modifiable"></a>Disabling
6122 the warning for a specific generic function</h5></div></div></div><p>If your generic function constitutes a public interface which is
6123 used by adding methods (similar to aforementioned <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>), you
6124 can declare it as such:</p><pre class="programlisting">
6125 (defgeneric my-public-gf (a b c)
6126 (declare (clos:dynamically-modifiable))
6127 ...)</pre><p>
6128 </p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-clisp-gf-replacing-method-warning"></a>29.12.1.2. Warning
6129 <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></h4></div></div></div><p>This is a hint that different parts of the program, possibly
6130 developed by independent people, are colliding.
6131 Example: in addition to the code
6132 <a class="link" href="#mop-clisp-gf-already-called-warning-code">above</a>:
6133 </p><pre class="programlisting">
6134 (defvar *book-sales-statistics* (make-hash-table :test 'equal))
6135 (defmethod add-to-inventory ((object book))
6136 (setf (gethash (title object) sale-stats) (cons 0 0)))
6137 (add-to-inventory (make-instance 'book :title "AMOP"))
6138 *book-counter*
6139 ⇒ <code class="computeroutput">1</code>
6140 *book-sales-statistics*
6141 ⇒ <code class="computeroutput">#S(HASH-TABLE :TEST FASTHASH-EQUAL ("AMOP" . (0 . 0)))</code>
6142 </pre><p>
6143 The programmer who programmed the first
6144 <span class="method"><code class="literal"><code class="function">add-to-inventory</code>@<code class="classname">book</code></code></span>
6145 method expects that <code class="varname">*book-counter*</code> will be incremented.
6146 The programmer who programmed the second
6147 <span class="method"><code class="literal"><code class="function">add-to-inventory</code>@<code class="classname">book</code></code></span>
6148 method expects that <code class="varname">*book-sales-statistics*</code> gets
6149 augmented. If the implementation gives no warning, one of the two
6150 programmers will waste time debugging.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
6151 behavior officially sanctioned by the standard and useful in some situations.
6152 We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
6153 behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-replacing-method-warning-motivation"></a>Motivation</h5></div></div></div><p>This warning can be warranted for the same reason as
6154 <a class="link" href="#mop-clisp-gf-already-called-warning-motivation" title="Motivation">above</a>:
6155 if the old method and the new method have a different contract,
6156 something is fishy and possibly wrong.
6157 Additionally, the programmers may not even have intended to replace the
6158 method. They may have intended cumulative effects of the two methods.
6159 </p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-obsolescence-warning"></a>29.12.1.3. Warning
6160 <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></h4></div></div></div><p>This is a hint that different parts of the program define the same
6161 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> incompatibly, and some objects, created to the old
6162 specification, have been obsoleted by the new one.
6163 Example: in addition to the code
6164 <a class="link" href="#mop-clisp-gf-already-called-warning-code">above</a>:
6165 </p><pre class="programlisting">
6166 (defclass ware ()
6167 ((title :initarg :title :accessor title)
6168 (year :initarg :year :accessor year)))
6169 </pre><p>
6170 Evaluating the above will obsolete all objects of type
6171 <code class="classname">ware</code>s, <code class="classname">book</code>s etc
6172 created so far, i.e., their components will become inaccessible.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
6173 behavior officially sanctioned by the standard and useful in some situations.
6174 We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
6175 behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="class-obsolescence-warning-motivation"></a>Motivation</h5></div></div></div><p>In addition to the
6176 <a class="link" href="#mop-clisp-gf-already-called-warning-motivation" title="Motivation">above</a>,
6177 this warning tells the programmers that they are losing some objects
6178 they have already created.</p></div></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="gray"></a>Chapter 30. Gray streams</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-overview"></a>30.1. Overview</h2></div></div></div><p>This interface permits the definition of new classes of streams,
6179 and programming their behavior by defining methods for the elementary
6180 stream operations.
6181 It is based on the proposal <a class="ulink" href="http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html" target="_top">STREAM-DEFINITION-BY-USER:GENERIC-FUNCTIONS</a> of David N. Gray to X3J13
6182 and is supported by most <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations currently in use.</p><p>All symbols defined by this interface, starting with the prefix
6183 <code class="literal">FUNDAMENTAL-</code> or <code class="literal">STREAM-</code>,
6184 are exported from the package <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>
6185 and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-classes"></a>30.2. Defined classes</h2></div></div></div><div class="variablelist"><p class="title"><strong>Defined classes</strong></p><dl class="variablelist"><dt><a id="fu-st"></a><span class="term"><a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams.
6186 It is a subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.
6187 Its metaclass is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>.</dd><dt><a id="fu-st-in"></a><span class="term"><a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
6188 It is a subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. The built-in function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
6189 returns true on instances of this class. This means that when you
6190 define a new stream class capable of doing input, you have to make it
6191 a subclass of <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><a id="fu-st-out"></a><span class="term"><a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
6192 It is a subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. The built-in function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">OUTPUT-STREAM-P</code></a>
6193 returns true on instances of this class. This means that when you
6194 define a new stream class capable of doing output, you have to make
6195 it a subclass of <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd><dt><a id="fu-st-char"></a><span class="term"><a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams
6196 whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>. It is a subclass of
6197 <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. It defines a method on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> that returns
6198 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</dd><dt><a id="fu-st-bin"></a><span class="term"><a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams
6199 whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is a subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>. It is a
6200 subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. When you define a subclass of <a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a>,
6201 you have to provide a method on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>.
6202 </dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-INPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
6203 <a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> and <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-OUTPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
6204 <a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> and <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-BINARY-INPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
6205 <a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a> and <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-BINARY-OUTPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
6206 <a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a> and <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-general"></a>30.3. General generic functions</h2></div></div></div><div class="variablelist"><p class="title"><strong>General generic functions defined on streams</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns the stream's element type, normally a
6207 subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p class="simpara">The method for <a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
6208 </p></dd><dt><span class="term"><code class="code">((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)
6209 <em class="replaceable"><code>new-element-type</code></em> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Changes the stream's element type.</p><p class="simpara">The default method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="xref" href="#stream-eltype" title="21.8. Function STREAM-ELEMENT-TYPE">Section 21.8, “Function <code class="function">STREAM-ELEMENT-TYPE</code>”</a>).</p></dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
6210 <code class="constant">:ABORT</code>)</code></span></dt><dd><p class="simpara">Closes the stream and flushes any associated buffers.
6211 </p><p class="simpara">When you define a primary method on this
6212 function, do not forget to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>.
6213 </p></dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns true before the stream has been closed, and
6214 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> after the stream has been closed.</p><p class="simpara">You do not need to add methods to this function.</p></dd><dt><a id="st-position"></a><span class="term"><code class="code">(<a class="link" href="#st-position"><code class="function">GRAY:STREAM-POSITION</code></a>
6215 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>position</code></em>)</code></span></dt><dd><p class="simpara">Just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a>, but <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
6216 <em class="replaceable"><code>position</code></em> means inquire.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rd-seq"></a><span class="term"><code class="code">(GRAY:STREAM-READ-SEQUENCE
6217 <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd><p class="simpara">Used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a>. <span class="emphasis"><em>Deprecated</em></span>.
6218 Define <a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a> and call <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>/<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> instead.
6219 </p><p class="simpara">The default method calls <a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a>.
6220 </p></dd><dt><a id="st-wr-seq"></a><span class="term"><code class="code">(GRAY:STREAM-WRITE-SEQUENCE
6221 <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd><p class="simpara">Used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>. <span class="emphasis"><em>Deprecated</em></span>.
6222 Define <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a> and call <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>/<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> instead.
6223 </p><p class="simpara">The default method calls <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a>.
6224 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-char-in"></a>30.4. Generic functions for character input</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for character input</strong></p><dl class="variablelist"><dt><a id="st-rc"></a><span class="term"><code class="code">(<a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
6225 returns and consumes it. Otherwise returns and consumes the next
6226 character from the stream. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.
6227 </p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-uc"></a><span class="term"><code class="code">(<a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd><p class="simpara">Pushes <em class="replaceable"><code>char</code></em>, which must be the last character
6228 read from the <em class="replaceable"><code>stream</code></em>, back onto the front of the <em class="replaceable"><code>stream</code></em>.
6229 </p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rcnh"></a><span class="term"><code class="code">(<a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns a character or <code class="constant">:EOF</code>, like <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>, if
6230 that would return immediately. If <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>'s value is not available
6231 immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">
6232 The default method simply calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this is sufficient for streams
6233 whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method never blocks.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-PEEK-CHAR <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
6234 returns it. Otherwise returns the next character from the stream,
6235 avoiding any side effects <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> would do. Returns <code class="constant">:EOF</code> if the
6236 <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.</p><p class="simpara">The default method calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
6237 sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no
6238 side-effects.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-LISTEN <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
6239 returns it. Otherwise returns the next character from the stream, if
6240 already available. If no character is available immediately, or if
6241 <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">The default method calls <a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
6242 sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no
6243 side-effects.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-READ-CHAR-WILL-HANG-P
6244 <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> will return immediately.
6245 Otherwise it returns true.</p><p class="simpara">The default method calls <a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
6246 sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no side-effects.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a>).</p></dd><dt><a id="st-rd-cs"></a><span class="term"><code class="code">(<a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a>
6247 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
6248 <code class="constant">:START</code> and <code class="constant">:END</code> with characters consecutively read from <em class="replaceable"><code>stream</code></em>.
6249 Returns the index of the first element of <em class="replaceable"><code>sequence</code></em> that was not
6250 updated (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <em class="replaceable"><code>end</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&lt;</code></a> <em class="replaceable"><code>end</code></em> if the stream reached its end).
6251 </p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, i.e. a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
6252 <em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to <code class="literal">0</code>.
6253 <em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
6254 which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
6255 </p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this
6256 is always sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
6257 <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>).</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-READ-LINE <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Reads a line of characters, and return two values:
6258 the line (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, without the terminating <span class="keysym">#\Newline</span> character),
6259 and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> value which is true if the line was terminated by
6260 <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> instead of <span class="keysym">#\Newline</span>.</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this
6261 is always sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-CLEAR-INPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Clears all pending interactive input from the
6262 <em class="replaceable"><code>stream</code></em>, and returns true if some pending input was removed.</p><p class="simpara">The default method does nothing and returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>; this is
6263 sufficient for non-interactive streams.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-char-out"></a>30.5. Generic functions for character output</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for character output</strong></p><dl class="variablelist"><dt><a id="st-wc"></a><span class="term"><code class="code">(<a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd><p class="simpara">Writes <em class="replaceable"><code>char</code></em>.
6264 </p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-lc"></a><span class="term"><code class="code">(<a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns the column number where the next character
6265 would be written (<code class="literal">0</code> stands for the first column),
6266 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if that is not meaningful for this stream.
6267 </p><p class="simpara">You must define a method for this function.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-START-LINE-P <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns true if the next character would be
6268 written at the start of a new line.</p><p class="simpara">The default method calls <a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> and compares its result with
6269 0; this is sufficient for streams whose <a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> never returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
6270 </p></dd><dt><a id="st-wr-cs"></a><span class="term"><code class="code">(<a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a>
6271 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>sequence</code></em> specified
6272 by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.</p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, i.e. a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
6273 <em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
6274 <em class="replaceable"><code>end</code></em> is a nonnegative integer or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
6275 which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
6276 </p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a>; this
6277 is always sufficient if speed does not matter.
6278 </p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension
6279 (see <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>).</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-WRITE-STRING
6280 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>string</code></em> specified by
6281 <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>. Returns <em class="replaceable"><code>string</code></em>.</p><p class="simpara"><em class="replaceable"><code>string</code></em> is a string. <em class="replaceable"><code>start</code></em> is a nonnegative integer
6282 and default to 0. <em class="replaceable"><code>end</code></em> is a nonnegative integer or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and
6283 defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>string</code></em>)</code>.
6284 </p><p class="simpara">The default method calls <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a>;
6285 this is always sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-TERPRI <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Outputs a <span class="keysym">#\Newline</span> character.</p><p class="simpara">The default method calls <a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a>; this is always
6286 sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FRESH-LINE <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Possibly outputs a <span class="keysym">#\Newline</span> character, so as to ensure
6287 that the next character would be written at the start of a new line.
6288 Returns true if it did output a <span class="keysym">#\Newline</span> character.</p><p class="simpara">The default method calls
6289 <code class="function">GRAY:STREAM-START-LINE-P</code> and then
6290 <code class="function">GRAY:STREAM-TERPRI</code> if necessary; this is always
6291 sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FINISH-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Ensures that any buffered output has reached its
6292 destination, and then returns.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FORCE-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Brings any buffered output on its way towards its
6293 destination, and returns without waiting until it has reached its
6294 destination.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-CLEAR-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Attempts to discard any buffered output which has
6295 not yet reached its destination.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-ADVANCE-TO-COLUMN
6296 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>column</code></em>)</code></span></dt><dd><p class="simpara">Ensures that the next character will be written at
6297 least at <em class="replaceable"><code>column</code></em>.</p><p class="simpara">The default method outputs an appropriate amount of space
6298 characters; this is sufficient for non-proportional output.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-byte-in"></a>30.6. Generic functions for binary input</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for binary input</strong></p><dl class="variablelist"><dt><a id="st-rb"></a><span class="term"><code class="code">(<a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns and consumes the next integer from the
6299 stream. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rbla"></a><span class="term"><code class="code">(<a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
6300 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
6301 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> would return immediately with an
6302 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> result. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is already
6303 known to be reached. If <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>'s value is not available
6304 immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">You must define a method for this function.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
6305 <a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a>).</p></dd><dt><a id="st-rbwhp"></a><span class="term"><code class="code">(<a class="link" href="#rbwhp"><code class="function">GRAY:STREAM-READ-BYTE-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
6306 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
6307 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> will return immediately.
6308 Otherwise it returns true.</p><p class="simpara">The default method calls <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a>; this is always sufficient.
6309 </p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a>).
6310 </p></dd><dt><a id="st-rbnh"></a><span class="term"><code class="code">(<a class="link" href="#rbnh"><code class="function">GRAY:STREAM-READ-BYTE-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
6311 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
6312 Returns an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <code class="constant">:EOF</code>, like <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>, if that would
6313 return immediately. If <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>'s value is not available immediately,
6314 returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">The default method calls <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> if <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a> returns true;
6315 this is always sufficient.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a>).
6316 </p></dd><dt><a id="st-rd-bs"></a><span class="term"><code class="code">(<a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a>
6317 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
6318 [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em> [<em class="replaceable"><code>no-hang</code></em> [<em class="replaceable"><code>interactive</code></em>]]]])</code></span></dt><dd><p class="simpara">Fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
6319 <code class="constant">:START</code> and <code class="constant">:END</code> with integers consecutively read from <em class="replaceable"><code>stream</code></em>.
6320 Returns the index of the first element of <em class="replaceable"><code>sequence</code></em> that was not
6321 updated (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <em class="replaceable"><code>end</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&lt;</code></a> <em class="replaceable"><code>end</code></em> if the stream reached its end).
6322 </p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.
6323 <em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
6324 <em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
6325 which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
6326 If <em class="replaceable"><code>no-hang</code></em> is true, the function should avoid blocking and instead fill
6327 only as many elements as are immediately available. If <em class="replaceable"><code>no-hang</code></em> is false
6328 and <em class="replaceable"><code>interactive</code></em> is true, the function can block for reading the first
6329 byte but should avoid blocking for any further bytes.</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>; this
6330 is always sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
6331 <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-byte-out"></a>30.7. Generic functions for binary output</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for binary output</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(GRAY:STREAM-WRITE-BYTE
6332 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>integer</code></em>)</code></span></dt><dd><p class="simpara">Writes <em class="replaceable"><code>integer</code></em>.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-wr-bs"></a><span class="term"><code class="code">(<a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a>
6333 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
6334 [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em> [<em class="replaceable"><code>no-hang</code></em> [<em class="replaceable"><code>interactive</code></em>]]]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>sequence</code></em> specified
6335 by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em></p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.
6336 <em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
6337 <em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
6338 which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
6339 If <em class="replaceable"><code>no-hang</code></em> is true, the function should avoid blocking and instead output
6340 only as many elements as it can immediately proceed. If <em class="replaceable"><code>no-hang</code></em> is false
6341 and <em class="replaceable"><code>interactive</code></em> is true, the function can block for writing the first
6342 byte but should avoid blocking for any further bytes.</p><p class="simpara">The default method repeatedly calls
6343 <code class="function">GRAY:STREAM-WRITE-BYTE</code>; this is always
6344 sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
6345 <a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fill-stream"></a>30.8. Class <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a></h2></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>30.1. <a href="#ex-fill-stream">Example of <code class="classname">EXT:FILL-STREAM</code> usage</a></dt></dl></div><p>As an example of the use of <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
6346 offers an additional class, <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a>. An instance of this class
6347 is a <span class="quote">“<span class="quote">formatting</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, which makes the final
6348 output to the underlying stream look neat: indented and filled.
6349 An instance of <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> is created like this:
6350 </p><pre class="programlisting">
6351 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> '<a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> :stream <em class="replaceable"><code>stream</code></em>
6352 [:text-indent symbol-or-number]
6353 [:sexp-indent symbol-or-number-or-function])
6354 </pre><p>where</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>stream</code></em></span></dt><dd>is the target <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> where the output actually
6355 goes.</dd><dt><span class="term"><em class="replaceable"><code>symbol-or-number</code></em></span></dt><dd>is the variable whose value is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> text
6356 indentation or the indentation itself (defaults to 0).
6357 </dd><dt><span class="term"><em class="replaceable"><code>symbol-or-number-or-function</code></em></span></dt><dd><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> writes an S-expression to a
6358 <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> using <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>, and the expression's printed
6359 representation does not fit on the current line, it is printed on
6360 separate lines, ignoring the prescribed text indentation and
6361 preserving spacing. When this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the
6362 S-expression <span class="strong"><strong>is</strong></span> indented by:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></span></dt><dd>the text indentation above;
6363 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> is the indentation;
6364 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></span></dt><dd>the indentation itself;
6365 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></span></dt><dd>called with one argument, the text indentation,
6366 and the value is used as S-expression indentation;
6367 thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_identity.html" target="_top"><code class="function">IDENTITY</code></a> is equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> above.
6368 </dd></dl></div><p>
6369 Defaults to <a href="impnotes.html#fill-stream" class="olink"><code class="varname">CUSTOM:*FILL-INDENT-SEXP*</code></a>, whose initial value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a>.
6370 </p></dd></dl></div><p></p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Note that, due to buffering, one must call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>
6371 when done with the <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> (and before changing the indent variable).
6372 The former is done automatically by the macro
6373 <code class="code">(with-fill-stream (fill target-stream ...) ...)</code>.</p></div><div class="example"><a id="ex-fill-stream"></a><p class="title"><strong>Example 30.1. Example of <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> usage</strong></p><div class="example-contents"><pre class="programlisting">
6374 (defvar *my-indent-level*)
6375 (with-output-to-string (out)
6376 (let ((*print-right-margin* 20)
6377 (*print-pretty* t)
6378 (*my-indent-level* 2))
6379 (with-fill-stream (fill out :text-indent '*my-indent-level*)
6380 (format fill "~%this is some long sentence which will be broken at spaces")
6381 (force-output fill)
6382 (let ((*my-indent-level* 5))
6383 (format fill "~%and properly indented to the level specified by the ~S argument which can be a ~S or an ~S - cool!"
6384 :TEXT-INDENT 'symbol 'integer)
6385 (force-output fill))
6386 (format fill "~%Don't forget to call ~S on it, and/or use ~S Pretty formatting of the S-expressions printed with ~~S is preserved: ~S"
6387 'force-output 'with-fill-stream '(defun foo (x y z) (if x (+ y z) (* y z)))))))
6388 ⇒ <code class="computeroutput">"
6389 this is some long
6390 sentence which
6391 will be broken at
6392 spaces
6393 and properly
6394 indented to
6395 the level
6396 specified by
6397 the
6398 :TEXT-INDENT
6399 argument which
6400 can be a
6401 SYMBOL or an
6402 INTEGER -
6403 cool!
6404 Don't forget to
6405 call FORCE-OUTPUT
6406 on it, and/or use
6407 WITH-FILL-STREAM
6408 Pretty formatting
6409 of the
6410 S-expressions
6411 printed with ~S
6412 is preserved:
6413 (DEFUN FOO
6414 (X Y Z)
6415 (IF X (+ Y Z)
6416 (* Y Z)))
6417 "</code></pre></div></div><br class="example-break" /></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="ext-clisp"></a>Part III. Extensions Specific to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#ext-p-indep">31. Platform Independent Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dd><dl><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></dd><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dd><dl><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt><dt><span class="section"><a href="#images-in-distros">31.2.2. Distributing images in package repositories</a></span></dt></dl></dd><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></dd><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></dd><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></dd><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> &amp; <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-platform">32. Platform Specific Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt></dl></dd><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt></dl></dd><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dd><dl><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></dd><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></dd><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dd><dl><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></dd><dt><span class="section"><a href="#os-env">32.8. Operating System Environment</a></span></dt><dd><dl><dt><span class="section"><a href="#os">32.8.1. Operating System Identification</a></span></dt><dt><span class="section"><a href="#getenv">32.8.2. Environment Variables</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#ext-modules">33. Extensions Implemented as Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dd><dl><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dd><dl><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></dd><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></dd><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></dd></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-p-indep"></a>Chapter 31. Platform Independent Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dd><dl><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></dd><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></dd><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dd><dl><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt><dt><span class="section"><a href="#images-in-distros">31.2.2. Distributing images in package repositories</a></span></dt></dl></dd><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></dd><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></dd><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></dd><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></dd><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> &amp; <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="custom-init-fini"></a>31.1. Customizing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Process
6418 Initialization and Termination</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></dd><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cradle-grave"></a>31.1.1. Cradle to Grave</h3></div><div><h4 class="subtitle">What is done when</h4></div></div></div><div class="procedure"><ol class="procedure" type="1"><li class="step"><p class="title"><strong>Initialization</strong></p><ol type="a" class="substeps"><li class="step"><p>Parse command line arguments until the first
6419 positional argument (see <a href="impnotes.html#image-script" class="olink"><code class="constant">:SCRIPT</code></a>).</p></li><li class="step"><p>Load the <a href="impnotes.html#image" class="olink">memory image</a>.</p></li><li class="step"><p>Install internal signal handlers.</p></li><li class="step"><p>Initialize time variables.</p></li><li class="step"><p>Initialize <a class="link" href="#enc-dflt" title="31.5.6. Default encodings">locale-dependent
6420 encodings</a>.</p></li><li class="step"><p>Initialize stream variables.</p></li><li class="step"><p>Initialize pathname variables.</p></li><li class="step"><p>Initialize <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p></li><li class="step"><p><a class="link" href="#modinit" title="32.2.2. Module initialization">Initialize
6421 modules</a>.</p></li><li class="step"><p>Run all functions in <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a>.</p></li><li class="step"><p>Say <span class="quote">“<span class="quote">hi</span>”</span>, unless suppressed by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.
6422 </p></li><li class="step"><p>Load <a href="clisp.html#opt-norc" class="olink">RC file</a>, unless suppressed by
6423 <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code>.</p></li></ol></li><li class="step"><p class="title"><strong>The actual work</strong></p><p>Handle command line options: file
6424 <a href="clisp.html#opt-init" class="olink">loading</a> and/or
6425 <a href="clisp.html#opt-compile" class="olink">compilation</a>,
6426 <a href="clisp.html#opt-exec-expr" class="olink">form evaluation</a>,
6427 <a href="clisp.html#opt-exec-file" class="olink">script</a> execution, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.</p></li><li class="step"><p class="title"><strong>Finalization (executed even on abnormal exit due
6428 to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html"><code class="function">kill</code></a>)</strong></p><ol type="a" class="substeps"><li class="step"><p>Unwind the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, executing cleanup forms in
6429 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>.</p></li><li class="step"><p>Run all functions in <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>.</p></li><li class="step"><p>Call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> on the standard streams.</p></li><li class="step"><p>Say <span class="quote">“<span class="quote">bye</span>”</span> unless suppressed by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.
6430 </p></li><li class="step"><p>Wait for a keypress if requested by
6431 <code class="option"><a href="clisp.html#opt-wait" class="olink">-w</a></code>.
6432 </p></li><li class="step"><p>Close all open <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s.</p></li><li class="step"><p><a class="link" href="#modfini" title="32.2.3. Module finalization">Finalize
6433 modules</a>.</p></li><li class="step"><p>Close all open DLLs.</p></li></ol></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="init-hooks"></a>31.1.2. Customizing Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></div><p><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> is run like this:</p><pre class="programlisting">
6434 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_ignore-errors.html" target="_top"><code class="function">IGNORE-ERRORS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPC</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a>))
6435 </pre><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="init-hooks-function"></a>31.1.2.1. The difference between
6436 <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> and <a href="impnotes.html#init-func" class="olink">init function</a></h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> are
6437 <span class="emphasis"><em>always</em></span> run regardless of the command line
6438 options before even the banner is printed.</li><li class="listitem">The <a href="impnotes.html#init-func" class="olink">init function</a> is run <span class="emphasis"><em>only</em></span>
6439 if the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> is ever entered and just before the
6440 first <a class="link" href="#prompt" title="31.9. The Prompt">prompt</a> is printed.
6441 </li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fini-hooks"></a>31.1.3. Customizing Termination</h3></div></div></div><p><a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a> is run like this:</p><pre class="programlisting">
6442 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPC</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>)
6443 </pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="image"></a>31.2. Saving an Image</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt><dt><span class="section"><a href="#images-in-distros">31.2.2. Distributing images in package repositories</a></span></dt></dl></div><p>The function <code class="code">(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
6444 (<em class="replaceable"><code>filename</code></em> "lispinit.mem") <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :KEEP-GLOBAL-HANDLERS :QUIET
6445 :INIT-FUNCTION :LOCKED-PACKAGES :START-PACKAGE :EXECUTABLE :NORC
6446 :SCRIPT :DOCUMENTATION :VERBOSE)</code>
6447 saves the running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s memory to the file <em class="replaceable"><code>filename</code></em>;
6448 extension <code class="filename">#P".mem"</code> is recommended (when <em class="replaceable"><code>filename</code></em> does not have an
6449 extension, <code class="filename">#P".mem"</code> extension is automatically added unless the file
6450 being created is an executable).
6451 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:QUIET</code></span></dt><dd><p class="simpara">If this argument is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the startup banner
6452 and the good-bye message will be suppressed, as if by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.</p><p class="simpara">This is <span class="strong"><strong>not</strong></span> recommended for interactive application delivery,
6453 please <span class="emphasis"><em>append</em></span> your banner to ours (using
6454 <a href="impnotes.html#init-func" class="olink">init function</a>) instead of <span class="emphasis"><em>replacing</em></span> it.
6455 </p></dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>Print a message after writing the file.
6456 This argument defaults to <a href="impnotes.html#image" class="olink"><code class="varname">CUSTOM:*SAVEINITMEM-VERBOSE*</code></a>; initial value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
6457 </dd><dt><span class="term"><code class="constant">:NORC</code></span></dt><dd>If this argument is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the <a href="clisp.html#opt-norc" class="olink">RC file</a>
6458 loading will be suppressed, as if by <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code>.
6459 </dd><dt><a id="init-func"></a><span class="term"><code class="constant">:INIT-FUNCTION</code></span></dt><dd><p class="simpara">This argument specifies a function that will be
6460 executed at startup of the saved image, before entering the standard <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
6461 (but after all other initialization, see <a class="xref" href="#cradle-grave" title="31.1.1. Cradle to Grave">Section 31.1.1, “Cradle to Grave”</a>);
6462 thus, if you want to avoid the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>, you have to call <a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a> at the
6463 end of the init function yourself
6464 (this does not prevent <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a> from being run).</p><p class="simpara">See <a href="clisp.html#opt-exec-file" class="olink">the
6465 manual</a> for passing command line arguments to this function.
6466 </p><p class="simpara">See also <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> and <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>.</p></dd><dt><a id="image-script"></a><span class="term"><a href="impnotes.html#image-script" class="olink"><code class="constant">:SCRIPT</code></a></span></dt><dd><p>This options determines the handling of positional
6467 arguments when the image is invoked.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, then the first positional argument
6468 is the script name and the rest is placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>, as described
6469 in <a class="xref" href="#quickstart-unix" title="32.6.2. Scripting with CLISP">Section 32.6.2, “Scripting with <span class="command"><strong>CLISP</strong></span>”</a>.</li><li class="listitem">It it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then all positional arguments
6470 are placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> to be handled by the <a href="impnotes.html#init-func" class="olink">init function</a>.
6471 </li></ul></div><p>
6472 This option defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when <a href="impnotes.html#init-func" class="olink">init function</a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and to
6473 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when <a href="impnotes.html#init-func" class="olink">init function</a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
6474 </p></dd><dt><a id="image-doc"></a><span class="term"><code class="constant">:DOCUMENTATION</code></span></dt><dd><p class="simpara">The description of what this image does, printed
6475 by the <code class="option"><a href="clisp.html#opt-help-image" class="olink">-help-image</a></code> olption.</p><p class="simpara">Defaults to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a> <a href="impnotes.html#init-func" class="olink">init function</a>
6476 '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a>)</code></p></dd><dt><span class="term"><code class="constant">:LOCKED-PACKAGES</code></span></dt><dd>This argument specifies the packages to lock before
6477 saving the image; this is convenient for application delivery, when
6478 you do not want your users to mess up your product.
6479 This argument defaults to <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>.
6480 </dd><dt><span class="term"><code class="constant">:START-PACKAGE</code></span></dt><dd>This argument specifies the starting value of
6481 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> in the image being saved, and defaults to the current
6482 value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>.</dd><dt><span class="term"><code class="constant">:KEEP-GLOBAL-HANDLERS</code></span></dt><dd><p>When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the currently established global
6483 handlers (either with <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> or with <code class="option"><a href="clisp.html#opt-on-error" class="olink">-on-error</a></code>)
6484 are inherited by the image. Defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, so that
6485 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> myfile <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>)'</pre><p>
6486 will produce an image without any global handlers inherited
6487 from the batch mode of the above command.</p></dd><dt><a id="image-exec"></a><span class="term"><code class="constant">:EXECUTABLE</code></span></dt><dd><p class="simpara">When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the saved file will be a
6488 standalone executable.
6489 In this case, the <code class="filename">#P".mem"</code> extension is not added.
6490 On <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> the extension <code class="filename">#P".exe"</code>
6491 is added instead.</p><p>Additionally, if this argument is <code class="literal">0</code>, the standard
6492 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> command line options will <span class="strong"><strong>not</strong></span> be processed by the
6493 executable but will be placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> instead.
6494 This is convenient for application delivery, so that your
6495 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-based application can accept, e.g., <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code>.
6496 To override this feature of the image, you have to prefix the
6497 options with <code class="literal">"--clisp"</code>, e.g.,
6498 use <code class="option">--clisp-x</code> instead of <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code>.
6499 This, given such a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-based application, you can get to an
6500 ordinary <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> by doing </p><pre class="screen">
6501 <strong><code class="prompt">$</code></strong> application --clisp-x '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "myclisp" :executable t :init-function nil)'
6502 <strong><code class="prompt">$</code></strong> ./myclisp
6503 [1]&gt; (<a class="link" href="#factorial" title="Function EXT:!">!</a> 20)
6504 2432902008176640000</pre><p>
6505 These instructions are also printed by
6506 <code class="option">--clisp--help</code>.</p><p class="simpara">Of course, this feature opens a <span class="emphasis"><em>security hole</em></span>
6507 if the application is running <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html"><code class="function">setuid</code></a> root,
6508 therefore <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> resets the effective group and user IDs to the real
6509 ones if it sees a <code class="literal">"--clisp-*"</code> option.
6510 </p></dd></dl></div><p>
6511 You can use this memory image with the <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> option.
6512 On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems, you may compress it with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gzip.org/" target="_top"><span class="command"><strong>gzip</strong></span></a> to save disk
6513 space.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="image-portability"></a>31.2.1. Image Portability</h3></div></div></div><p>Memory images are <span class="strong"><strong>not</strong></span> portable across different platforms
6514 (in contrast with platform-independent <code class="filename">#P".fas"</code> files).
6515 They are <span class="strong"><strong>not</strong></span> even portable across <a href="impnotes.html#linkset" class="olink">linking set</a>s: image saved using
6516 the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> cannot be used with the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="clisp.html#runtime" class="olink">runtime</a>:</p><pre class="screen">
6517 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>)'
6518 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> base <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> lispinit.mem
6519 base/lisp.run: initialization file `lispinit.mem' was not created by this version of CLISP runtime</pre><p>
6520 See also <a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/18854510/" target="_top">https://sourceforge.net/p/clisp/mailman/message/18854510/</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="images-in-distros"></a>31.2.2. Distributing images in package repositories</h3></div></div></div><p>When <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> and packages that rely on <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> are distributed through
6521 package repositories, such as operating system distributions, the way the
6522 memory images work imposes certain ways to handle them in the packaging
6523 system.</p><p>Assume you have a package <code class="constant">foo</code> that relies on
6524 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. There are three ways to package it:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>It can be packaged to not use a memory image. Instead the program
6525 <code class="constant">foo</code> is an invocation of <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> that will load a
6526 set of <code class="filename">*.fas</code> files at startup. You can simplify
6527 this loading by concatenating the <code class="filename">*.fas</code> files
6528 together; then only a single <code class="filename">*.fas</code> file needs to be
6529 loaded. The drawback of this approach is the startup time.</p></li><li class="listitem"><p>It can be packaged to use a memory image that is constructed in a
6530 subdirectory of <code class="filename">/var/lib</code>, when
6531 <code class="constant">foo</code> gets installed, through a post-install action of
6532 package <code class="constant">foo</code>. Also the package
6533 <code class="constant">clisp</code> will have a post-install action that removes
6534 and rebuilds these memory images when a new version of
6535 <code class="constant">clisp</code> is installed.</p></li><li class="listitem"><p>It can be packaged to use a memory image that is part of the binary
6536 package of <code class="constant">foo</code> and installed in a subdirectory of
6537 <code class="filename">/usr/lib</code>. In order to catch the case where
6538 <code class="constant">clisp</code> is upgraded and <code class="constant">foo</code> is not
6539 upgraded, you attach an alias
6540 <code class="constant">clisp-<em class="replaceable"><code>memory-image-interface-hash</code></em></code>
6541 to the <code class="constant">clisp</code> package, and you make the
6542 <code class="constant">foo</code> package depend on this alias. When the
6543 <code class="constant">clisp</code> package is upgraded (or even when it is only
6544 rebuilt with a different parameterization), the
6545 <em class="replaceable"><code>memory-image-interface-hash</code></em> changes, and the
6546 packaging system will notice a dependency conflict. A good packaging
6547 system will then propose one of two actions to the user:
6548 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><p>either upgrade package <code class="constant">foo</code> as well, to a
6549 build that depends on the new
6550 <code class="constant">clisp-<em class="replaceable"><code>memory-image-interface-hash</code></em></code>
6551 alias (assuming such a build exists),</p></li><li class="listitem"><p>or refuse the upgrade of <code class="constant">clisp</code>.</p></li></ul></div><p>
6552 To allow you to implement such a system, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> provides the following
6553 command-line options:
6554 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code"><span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> [-K <em class="replaceable"><code>linking-set</code></em>] -memfile-hash</code></span></dt><dd>Prints the hash code of the mem file binary interface.</dd><dt><span class="term"><code class="code"><span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> [-K <em class="replaceable"><code>linking-set</code></em>] -memfile-hash-of <em class="replaceable"><code>mem-file</code></em></code></span></dt><dd>Prints the hash code of the mem file binary interface
6555 that was used to create this <em class="replaceable"><code>mem-file</code></em>.
6556 </dd><dt><span class="term"><code class="code"><span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> [-K <em class="replaceable"><code>linking-set</code></em>] -memfile-compatible <em class="replaceable"><code>mem-file</code></em></code></span></dt><dd>Returns 0 or 1, depending whether this
6557 <em class="replaceable"><code>mem-file</code></em> is compatible with the
6558 <em class="replaceable"><code>linking-set</code></em> or not.</dd></dl></div><p>
6559 When the hash code of the mem file binary interface of a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
6560 executable is the same as the one of a <em class="replaceable"><code>mem-file</code></em>,
6561 it is guaranteed that the executable can load this
6562 <em class="replaceable"><code>mem-file</code></em>.
6563 </p></li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quit"></a>31.3. Quitting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><p>The functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr><tr><td><code class="code">(EXT:QUIT <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr><tr><td><code class="code">(EXT:BYE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr></table><p>
6564 - all synonymous - terminate <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. If <em class="replaceable"><code>status</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
6565 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> aborts with the supplied numeric error <em class="replaceable"><code>status</code></em>, i.e.,
6566 the OS environment is informed that the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session did not
6567 succeed.</p><p><a class="link" href="#fin-delim">Final delimiter</a>s also terminate
6568 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="i18n"></a>31.4. Internationalization of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></div><div class="variablelist"><p class="title"><strong>Glossary</strong></p><dl class="variablelist"><dt><span class="term">Internationalization (<span class="quote">“<span class="quote">i18n</span>”</span>)</span></dt><dd>preparing a program so that it can use multiple
6569 national languages and national cultural conventions without requiring
6570 further source code changes.</dd><dt><span class="term">Localization (<span class="quote">“<span class="quote">l10n</span>”</span>)</span></dt><dd>providing the data - mostly textual translations -
6571 necessary for an internationalized program to work in a particular
6572 language and with particular cultural conventions.
6573 </dd></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is internationalized, and is localized for the languages
6574 English, German, French, Spanish, Dutch, Russian, and Danish.
6575 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> also supports internationalized Lisp programs, through
6576 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a>, see <a class="xref" href="#i18n-mod" title="33.3. Internationalization of User Programs">Section 33.3, “Internationalization of User Programs”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="language"></a>31.4.1. The Language</h3></div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The facilities described in this section will
6577 work only for the languages for which <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> itself is already
6578 localized.</p></div><p>The language <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses to communicate with the user can be one of
6579 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">ENGLISH</code></td></tr><tr><td><code class="constant">DEUTSCH</code> (i.e., German)</td></tr><tr><td><code class="constant">FRANÇAIS</code> (i.e., French)</td></tr><tr><td><code class="constant">ESPAÑOL</code> (i.e., Spanish)</td></tr><tr><td><code class="constant">NEDERLANDS</code> (i.e., Dutch)</td></tr><tr><td><code class="constant">РУССКИЙ</code>
6580 (i.e. Russian)</td></tr><tr><td><code class="constant">DANSK</code> (i.e., Danish)</td></tr></table><p>This is controlled by the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
6581 <strong class="first"><em class="firstterm"><a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a><a id="curr-lang" class="indexterm"></a></em></strong>,
6582 which can be set at run time as well as using the <code class="option"><a href="clisp.html#opt-lang" class="olink">-L</a></code> command line option.
6583 If you wish to change the
6584 <a href="clisp.html#opt-locale" class="olink">locale directory</a>
6585 at run time too, you can do that by setting <a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>
6586 cell, whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is the language (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, one of the above),
6587 and whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> is the new locale directory.</p><p>More languages can be defined through the macro
6588 <strong class="first"><em class="firstterm"><a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a><a id="deflang" class="indexterm"></a></em></strong>:
6589 <code class="code">(<a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code>.
6590 For such an additional language to take effect, you must install the
6591 corresponding message catalog, or translate the messages yourself,
6592 using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a> and <a class="ulink" href="https://www.gnu.org/software/emacs/" target="_top">Emacs</a> <a class="" href="http://www.google.com/search?q=po-mode">po-mode</a>.</p><p>This works only for strings. For arbitrary language-dependent
6593 Lisp objects, you define one through the macro
6594 <strong class="first"><em class="firstterm"><a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a><a id="def-i-l" class="indexterm"></a></em></strong>:
6595 <code class="code">(<a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a> <em class="replaceable"><code>symbol</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
6596 (<em class="replaceable"><code>default-language</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> and add
6597 language-dependent values through the macro
6598 <strong class="first"><em class="firstterm"><a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a><a id="defloc" class="indexterm"></a></em></strong>:
6599 <code class="code">(<a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>language</code></em>
6600 <em class="replaceable"><code>value-form</code></em>)</code>
6601 (One such form for each language. Languages without an assigned
6602 value will be treated like the default-language.)
6603 You can then access the localized value by calling
6604 <strong class="first"><em class="firstterm"><a class="link" href="#localized"><code class="function">I18N:LOCALIZED</code></a><a id="localized" class="indexterm"></a></em></strong>:
6605 <code class="code">(<a class="link" href="#localized"><code class="function">I18N:LOCALIZED</code></a> <em class="replaceable"><code>symbol</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>language</code></em>)</code></p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="encoding"></a>31.5. Encodings</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></dd><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="encodings-intro"></a>31.5.1. Introduction</h3></div></div></div><p>An <span class="quote">“<span class="quote">encoding</span>”</span> describes the correspondence
6606 between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and raw bytes during input/output via
6607 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p><p>An <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> is an object composed of the following facets:
6608 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#charset" title="31.5.2. Character Sets">character set</a></span></dt><dd>This denotes both the set of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s that
6609 can be represented and passed through the I/O channel, and the way
6610 these characters translate into raw bytes, i.e., the map between
6611 sequences of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> in the form of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s
6612 and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> as well as character and byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
6613 In this context, for example, <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> and <a class="link" href="#charset-UCS-4"><code class="constant">CHARSET:UCS-4</code></a>
6614 are considered different, although they can represent the same set
6615 of characters.</dd><dt><span class="term"><a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode</span></dt><dd>This denotes the way newline characters are
6616 represented.</dd></dl></div><p><a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s are also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html" target="_top"><code class="literal">TYPE</code></a>s. As such, they represent the set of
6617 characters encodable in the character set. In this context, the way
6618 characters are translated into raw bytes is ignored, and the line
6619 terminator mode is ignored as well. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> can be used
6620 on encodings:</p><pre class="programlisting">
6621 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a>)
6622 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
6623 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
6624 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>)
6625 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
6626 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
6627 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> CHARSET:ASCII CHARSET:ISO-8859-1)
6628 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
6629 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
6630 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> CHARSET:ISO-8859-1 CHARSET:ASCII)
6631 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
6632 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
6633 </pre><p><a id="enc1-1"></a><strong><span class="quote">“<span class="quote">1:1</span>”</span> encodings. </strong>Encodings which define a bijection between character and byte
6634 sequences are called <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>s. <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a> is an example of such an
6635 encoding: any byte sequence corresponds to some character sequence and
6636 vice versa. <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>, however, is <span class="strong"><strong>not</strong></span> a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>: there are no
6637 characters for bytes in the range [128;255]. <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> is <span class="strong"><strong>not</strong></span> a
6638 <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a> either: some byte sequences do not correspond to any character
6639 sequence.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="charset"></a>31.5.2. Character Sets</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd>Only one character set is understood: the platform's
6640 native (8-bit) character set. See <a class="xref" href="#characters" title="Chapter 13. Characters chap-13">Chapter 13, <em>Characters chap-13</em></a>.
6641 </dd><dt><a id="charset-symbols"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p>The following character sets are supported, as values
6642 of the corresponding (constant) symbol in the <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a> package:
6643 </p><div class="orderedlist"><a id="charset-symbol-list"></a><p class="title"><strong>Symbols in package <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a></strong></p><ol class="orderedlist" type="1"><li class="listitem"><a id="charset-UCS-2"></a><code class="constant">UCS-2</code>
6644 ≡ <code class="constant">UNICODE-16</code>
6645 ≡ <code class="constant">UNICODE-16-BIG-ENDIAN</code>,
6646 the 16-bit basic multilingual plane of the <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
6647 Every character is represented as two bytes.</li><li class="listitem"><a id="charset-UNICODE-16-LITTLE-ENDIAN"></a><code class="constant">UNICODE-16-LITTLE-ENDIAN</code>
6648 </li><li class="listitem"><a id="charset-UCS-4"></a><code class="constant">UCS-4</code>
6649 ≡ <code class="constant">UNICODE-32</code>
6650 ≡ <code class="constant">UNICODE-32-BIG-ENDIAN</code>,
6651 the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. Every character is represented as
6652 four bytes. This encoding is used by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internally.</li><li class="listitem"><a id="charset-UNICODE-32-LITTLE-ENDIAN"></a><code class="constant">UNICODE-32-LITTLE-ENDIAN</code></li><li class="listitem"><a id="charset-UTF-8"></a><code class="constant">UTF-8</code>,
6653 the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
6654 Every character is represented as one to four bytes.
6655 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves and need one byte per character.
6656 Most Latin/Greek/Cyrillic/Hebrew characters need two bytes per
6657 character. Most other characters need three bytes per character,
6658 and the rarely used remaining characters need four bytes per
6659 character. This is therefore, in general, the most space-efficient
6660 encoding of all of Unicode.</li><li class="listitem"><a id="charset-UTF-16"></a><code class="constant">UTF-16</code>,
6661 the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. Every character in the 16-bit
6662 basic multilingual plane is represented as two bytes, and the
6663 rarely used remaining characters need four bytes per character.
6664 This character set is only available on
6665 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-UTF-7"></a><code class="constant">UTF-7</code>,
6666 the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. This is a stateful 7-bit encoding.
6667 Not all <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves.
6668 This character set is only available on
6669 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-JAVA"></a><code class="constant">JAVA</code>,
6670 the 21-bit <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
6671 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves and need one byte per character.
6672 All other characters of the basic multilingual plane are represented
6673 by <code class="literal">\u<em class="replaceable"><code>nnnn</code></em></code> sequences
6674 (<em class="replaceable"><code>nnnn</code></em> a hexadecimal number)
6675 and need 6 bytes per character. The remaining characters are represented
6676 by <code class="literal">\u<em class="replaceable"><code>xxxx</code></em>\u<em class="replaceable"><code>yyyy</code></em></code>
6677 and need 12 bytes per character. While this encoding is very comfortable
6678 for editing Unicode files using only <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>-aware tools and editors, it
6679 cannot faithfully represent all <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> text. Only text which
6680 does not contain <code class="literal">\u</code> (backslash followed by
6681 lowercase Latin u) can be faithfully represented by this encoding.
6682 </li><li class="listitem"><a id="charset-ASCII"></a><code class="constant">ASCII</code>,
6683 the well-known US-centric 7-bit character set (American Standard
6684 Code for Information Interchange - <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>).</li><li class="listitem"><a id="charset-ISO-8859-1"></a><p class="simpara"><code class="constant">ISO-8859-1</code>,
6685 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Afrikaans, Albanian, Basque, Breton, Catalan,
6686 Cornish, Danish, Dutch, English, Færoese, Finnish, French,
6687 Frisian, Galician, German, Greenlandic, Icelandic, Irish, Italian,
6688 Latin, Luxemburgish, Norwegian, Portuguese, Ræto-Romanic,
6689 Scottish, Spanish, and Swedish languages.</p><p>This encoding has the nice property that</p><pre class="programlisting">
6690 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for i :from 0 :to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> :for c = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> i)
6691 :always (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> c CHARSET:ISO-8859-1))
6692 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a> (<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> c) CHARSET:ISO-8859-1)
6693 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_vector.html" target="_top"><code class="function">VECTOR</code></a> i))))
6694 ⇒ <code class="computeroutput">T</code></pre><p>
6695 i.e., it is compatible with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a>
6696 in its own domain.</p></li><li class="listitem"><a id="charset-ISO-8859-2"></a><code class="constant">ISO-8859-2</code>,
6697 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Croatian, Czech, German, Hungarian, Polish,
6698 Slovak, Slovenian, and Sorbian languages. </li><li class="listitem"><a id="charset-ISO-8859-3"></a><code class="constant">ISO-8859-3</code>,
6699 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Esperanto and Maltese languages.</li><li class="listitem"><a id="charset-ISO-8859-4"></a><code class="constant">ISO-8859-4</code>,
6700 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Latvian, Lithuanian and Sami (Lappish)
6701 languages.</li><li class="listitem"><a id="charset-ISO-8859-5"></a><code class="constant">ISO-8859-5</code>,
6702 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Bulgarian, Byelorussian, Macedonian, Russian,
6703 Serbian, and Ukrainian languages.</li><li class="listitem"><a id="charset-ISO-8859-6"></a><code class="constant">ISO-8859-6</code>,
6704 suitable for the Arabic language.</li><li class="listitem"><a id="charset-ISO-8859-7"></a><code class="constant">ISO-8859-7</code>,
6705 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Greek language.</li><li class="listitem"><a id="charset-ISO-8859-8"></a><code class="constant">ISO-8859-8</code>,
6706 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Hebrew language (without punctuation).</li><li class="listitem"><a id="charset-ISO-8859-9"></a><code class="constant">ISO-8859-9</code>,
6707 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Turkish language.</li><li class="listitem"><a id="charset-ISO-8859-10"></a><code class="constant">ISO-8859-10</code>,
6708 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Icelandic, Inuit (Greenlandic), Latvian,
6709 Lithuanian, and Sami (Lappish) languages.</li><li class="listitem"><a id="charset-ISO-8859-13"></a><code class="constant">ISO-8859-13</code>,
6710 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Latvian, Lithuanian, Polish and Sami
6711 (Lappish) languages.</li><li class="listitem"><a id="charset-ISO-8859-14"></a><code class="constant">ISO-8859-14</code>,
6712 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Irish Gælic, Manx Gælic, Scottish
6713 Gælic, and Welsh languages.</li><li class="listitem"><a id="charset-ISO-8859-15"></a><code class="constant">ISO-8859-15</code>,
6714 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the ISO-8859-1 languages, with improvements for
6715 French, Finnish and the Euro.</li><li class="listitem"><a id="charset-ISO-8859-16"></a><code class="constant">ISO-8859-16</code>
6716 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Rumanian language.</li><li class="listitem"><a id="charset-KOI8-R"></a><code class="constant">KOI8-R</code>,
6717 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Russian language (very popular, especially on the
6718 internet).</li><li class="listitem"><a id="charset-KOI8-U"></a><code class="constant">KOI8-U</code>,
6719 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Ukrainian language (very popular, especially on the
6720 internet).</li><li class="listitem"><a id="charset-KOI8-RU"></a><code class="constant">KOI8-RU</code>,
6721 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Russian language. This character set is only available on
6722 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><code class="constant">JIS_X0201</code>,
6723 a character set for the Japanese language.</li><li class="listitem"><a id="charset-MAC-ARABIC"></a><code class="constant">MAC-ARABIC</code>,
6724 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CENTRAL-EUROPE"></a><code class="constant">MAC-CENTRAL-EUROPE</code>,
6725 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CROATIAN"></a><code class="constant">MAC-CROATIAN</code>,
6726 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CYRILLIC"></a><code class="constant">MAC-CYRILLIC</code>,
6727 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-DINGBAT"></a><code class="constant">MAC-DINGBAT</code>,
6728 a platform specific character set.</li><li class="listitem"><a id="charset-MAC-GREEK"></a><code class="constant">MAC-GREEK</code>,
6729 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-HEBREW"></a><code class="constant">MAC-HEBREW</code>,
6730 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ICELAND"></a><code class="constant">MAC-ICELAND</code>,
6731 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ROMAN"></a><code class="constant">MAC-ROMAN</code>
6732 ≡ <code class="constant">MACINTOSH</code>,
6733 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ROMANIA"></a><code class="constant">MAC-ROMANIA</code>,
6734 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-SYMBOL"></a><code class="constant">MAC-SYMBOL</code>,
6735 a platform specific character set.</li><li class="listitem"><a id="charset-MAC-THAI"></a><code class="constant">MAC-THAI</code>,
6736 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-TURKISH"></a><code class="constant">MAC-TURKISH</code>,
6737 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-UKRAINE"></a><code class="constant">MAC-UKRAINE</code>,
6738 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP437"></a><code class="constant">CP437</code>, a DOS oldie,
6739 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP437-IBM"></a><code class="constant">CP437-IBM</code>,
6740 an IBM variant of <code class="constant">CP437</code>.</li><li class="listitem"><a id="charset-CP737"></a><code class="constant">CP737</code>, a DOS oldie,
6741 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-CP775"></a><code class="constant">CP775</code>, a DOS oldie,
6742 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for some Baltic languages.</li><li class="listitem"><a id="charset-CP850"></a><code class="constant">CP850</code>, a DOS oldie,
6743 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP852"></a><code class="constant">CP852</code>, a DOS oldie,
6744 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP852-IBM"></a><code class="constant">CP852-IBM</code>,
6745 an IBM variant of <code class="constant">CP852</code>.</li><li class="listitem"><a id="charset-CP855"></a><code class="constant">CP855</code>, a DOS oldie,
6746 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-CP857"></a><code class="constant">CP857</code>, a DOS oldie,
6747 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Turkish language.</li><li class="listitem"><a id="charset-CP860"></a><code class="constant">CP860</code>, a DOS oldie,
6748 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Portuguese language.</li><li class="listitem"><a id="charset-CP860-IBM"></a><code class="constant">CP860-IBM</code>,
6749 an IBM variant of <code class="constant">CP860</code>.</li><li class="listitem"><a id="charset-CP861"></a><code class="constant">CP861</code>, a DOS oldie,
6750 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Icelandic language.</li><li class="listitem"><a id="charset-CP861-IBM"></a><code class="constant">CP861-IBM</code>,
6751 an IBM variant of <code class="constant">CP861</code>.</li><li class="listitem"><a id="charset-CP862"></a><code class="constant">CP862</code>, a DOS oldie,
6752 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Hebrew language.</li><li class="listitem"><a id="charset-CP862-IBM"></a><code class="constant">CP862-IBM</code>,
6753 an IBM variant of <code class="constant">CP862</code>.</li><li class="listitem"><a id="charset-CP863"></a><code class="constant">CP863</code>, a DOS oldie,
6754 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP863-IBM"></a><code class="constant">CP863-IBM</code>,
6755 an IBM variant of <code class="constant">CP863</code>.</li><li class="listitem"><a id="charset-CP864"></a><code class="constant">CP864</code>, a DOS oldie,
6756 meant to be suitable for the Arabic language.</li><li class="listitem"><a id="charset-CP864-IBM"></a><code class="constant">CP864-IBM</code>,
6757 an IBM variant of <code class="constant">CP864</code>.
6758 </li><li class="listitem"><a id="charset-CP865"></a><code class="constant">CP865</code>, a DOS oldie,
6759 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for some Nordic languages.</li><li class="listitem"><a id="charset-CP865-IBM"></a><code class="constant">CP865-IBM</code>,
6760 an IBM variant of <code class="constant">CP865</code>.
6761 </li><li class="listitem"><a id="charset-CP866"></a><code class="constant">CP866</code>, a DOS oldie,
6762 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-CP869"></a><code class="constant">CP869</code>, a DOS oldie,
6763 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-CP869-IBM"></a><code class="constant">CP869-IBM</code>,
6764 an IBM variant of <code class="constant">CP869</code>.
6765 </li><li class="listitem"><a id="charset-CP874"></a><code class="constant">CP874</code>, a DOS oldie,
6766 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Thai language.</li><li class="listitem"><a id="charset-CP874-IBM"></a><code class="constant">CP874-IBM</code>,
6767 an IBM variant of <code class="constant">CP874</code>.
6768 </li><li class="listitem"><a id="charset-WINDOWS-1250"></a><code class="constant">WINDOWS-1250</code>
6769 ≡ <code class="constant">CP1250</code>,
6770 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, heavily incompatible with ISO-8859-2.
6771 </li><li class="listitem"><a id="charset-WINDOWS-1251"></a><code class="constant">WINDOWS-1251</code>
6772 ≡ <code class="constant">CP1251</code>,
6773 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, heavily incompatible with ISO-8859-5,
6774 meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-WINDOWS-1252"></a><code class="constant">WINDOWS-1252</code>
6775 ≡ <code class="constant">CP1252</code>,
6776 a platform specific extension of the ISO-8859-1 character set.
6777 </li><li class="listitem"><a id="charset-WINDOWS-1253"></a><code class="constant">WINDOWS-1253</code>
6778 ≡ <code class="constant">CP1253</code>,
6779 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, gratuitously incompatible with ISO-8859-7,
6780 meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-WINDOWS-1254"></a><code class="constant">WINDOWS-1254</code>
6781 ≡ <code class="constant">CP1254</code>,
6782 a platform specific extension of the ISO-8859-9 character set.
6783 </li><li class="listitem"><a id="charset-WINDOWS-1255"></a><code class="constant">WINDOWS-1255</code>
6784 ≡ <code class="constant">CP1255</code>,
6785 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, gratuitously incompatible with ISO-8859-8,
6786 suitable for the Hebrew language.
6787 This character set is only available on
6788 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-WINDOWS-1256"></a><code class="constant">WINDOWS-1256</code>
6789 ≡ <code class="constant">CP1256</code>,
6790 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Arabic language.</li><li class="listitem"><a id="charset-WINDOWS-1257"></a><code class="constant">WINDOWS-1257</code>
6791 ≡ <code class="constant">CP1257</code>,
6792 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-WINDOWS-1258"></a><code class="constant">WINDOWS-1258</code>
6793 ≡ <code class="constant">CP1258</code>, a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the
6794 Vietnamese language. This character set is only available on
6795 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-HP-ROMAN8"></a><code class="constant">HP-ROMAN8</code>,
6796 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-NEXTSTEP"></a><code class="constant">NEXTSTEP</code>,
6797 a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-EUC-JP"></a><code class="constant">EUC-JP</code>,
6798 a multibyte character set for the Japanese language.
6799 This character set is only available on
6800 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-SHIFT-JIS"></a><code class="constant">SHIFT-JIS</code>,
6801 a multibyte character set for the Japanese language.
6802 This character set is only available on
6803 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP932"></a><code class="constant">CP932</code>,
6804 a Microsoft variant of <code class="constant">SHIFT-JIS</code>.
6805 This character set is only available on
6806 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP"></a><code class="constant">ISO-2022-JP</code>,
6807 a stateful 7-bit multibyte character set for the Japanese language.
6808 This character set is only available on
6809 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP-2"></a><code class="constant">ISO-2022-JP-2</code>,
6810 a stateful 7-bit multibyte character set for the Japanese language.
6811 This character set is only available on platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> 2.3
6812 or newer or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP-1"></a><code class="constant">ISO-2022-JP-1</code>,
6813 a stateful 7-bit multibyte character set for the Japanese language.
6814 This character set is only available on
6815 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-CN"></a><code class="constant">EUC-CN</code>,
6816 a multibyte character set for simplified Chinese.
6817 This character set is only available on
6818 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-HZ"></a><code class="constant">HZ</code>,
6819 a stateful 7-bit multibyte character set for simplified Chinese.
6820 This character set is only available on
6821 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GBK"></a><code class="constant">GBK</code>,
6822 a multibyte character set for Chinese,
6823 This character set is only available on
6824 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP936"></a><code class="constant">CP936</code>,
6825 a Microsoft variant of <code class="constant">GBK</code>.
6826 This character set is only available on
6827 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GB18030"></a><code class="constant">GB18030</code>,
6828 a multibyte character set for Chinese,
6829 This character set is only available on
6830 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-TW"></a><code class="constant">EUC-TW</code>,
6831 a multibyte character set for traditional Chinese.
6832 This character set is only available on
6833 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-BIG5"></a><code class="constant">BIG5</code>,
6834 a multibyte character set for traditional Chinese.
6835 This character set is only available on
6836 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP950"></a><code class="constant">CP950</code>,
6837 a Microsoft variant of <code class="constant">BIG5</code>.
6838 This character set is only available on
6839 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-BIG5-HKSCS"></a><code class="constant">BIG5-HKSCS</code>,
6840 a multibyte character set for traditional Chinese.
6841 This character set is only available on
6842 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-CN"></a><code class="constant">ISO-2022-CN</code>,
6843 a stateful 7-bit multibyte character set for Chinese.
6844 This character set is only available on
6845 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-CN-EXT"></a><code class="constant">ISO-2022-CN-EXT</code>,
6846 a stateful 7-bit multibyte character set for Chinese.
6847 This character set is only available on
6848 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-KR"></a><code class="constant">EUC-KR</code>,
6849 a multibyte character set for Korean.
6850 This character set is only available on
6851 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP949"></a><code class="constant">CP949</code>,
6852 a Microsoft variant of <code class="constant">EUC-KR</code>.
6853 This character set is only available on
6854 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-KR"></a><code class="constant">ISO-2022-KR</code>,
6855 a stateful 7-bit multibyte character set for Korean.
6856 This character set is only available on
6857 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-JOHAB"></a><code class="constant">JOHAB</code>,
6858 a multibyte character set for Korean used mostly on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>.
6859 This character set is only available on
6860 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ARMSCII-8"></a><code class="constant">ARMSCII-8</code>,
6861 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Armenian. This character set is only available on
6862 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GEORGIAN-ACADEMY"></a><code class="constant">GEORGIAN-ACADEMY</code>,
6863 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Georgian. This character set is only available on
6864 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GEORGIAN-PS"></a><code class="constant">GEORGIAN-PS</code>,
6865 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Georgian. This character set is only available on
6866 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-TIS-620"></a><code class="constant">TIS-620</code>,
6867 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Thai. This character set is only available on
6868 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-MULELAO-1"></a><code class="constant">MULELAO-1</code>,
6869 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Laotian. This character set is only available on
6870 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP1133"></a><code class="constant">CP1133</code>,
6871 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Laotian. This character set is only available on
6872 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-VISCII"></a><code class="constant">VISCII</code>,
6873 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Vietnamese. This character set is only available on
6874 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-TCVN"></a><code class="constant">TCVN</code>,
6875 an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Vietnamese. This character set is only available on
6876 platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><p><a id="base64"></a><code class="constant">BASE64</code>, encodes
6877 arbitrary byte sequences with 64 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters </p><div class="literallayout"><p><br />
6878    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/<br />
6879   </p></div><p> as specifined by <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a>; 3 bytes are encoded with 4
6880 characters, line breaks are inserted after every 76 characters.</p><p class="simpara">While this is not a traditional character set (i.e., it does
6881 not map a set of characters in a natural language into bytes), it
6882 does define a map between arbitrary byte sequences and certain
6883 character sequences, so it falls naturally into the <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> class.
6884 </p></li></ol></div><p>
6885
6886
6887 </p><div class="variablelist"><dl class="variablelist"><dt><a id="iconv"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only on <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> systems
6888 with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> 2.2 or better and other systems (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
6889 on which the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library has been installed</span></span></span></dt><dd><p class="simpara">The character sets provided by the library function
6890 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> can also be used as encodings. To create such an encoding,
6891 call <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> with the character set name (a string) as the
6892 <code class="constant">:CHARSET</code> argument.</p><p class="simpara">When an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> is available both as a <a class="link" href="#charset-symbols">built-in</a> and
6893 through <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>, the <a class="link" href="#charset-symbols">built-in</a> is used, because it is more
6894 efficient and available across all platforms.</p><p class="simpara">These encodings are not assigned to global variables, since
6895 there is no portable way to get the list of all character sets
6896 supported by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>.</p><p class="simpara">On standard-compliant <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems (e.g., <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> systems, such
6897 as <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="https://www.gnu.org/software/hurd/" target="_top"><span class="platform">Hurd</span></a>) and on systems with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a> you
6898 get this list by calling the <span class="emphasis"><em>program</em></span>:
6899 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/iconv.html"><span class="command"><strong>iconv -l</strong></span></a>.</p><p class="simpara">The reason we use only <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> 2.2 or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a> is
6900 that the other <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> implementations are broken in various ways and
6901 we do not want to deal with random <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> crashes caused by those bugs.
6902 If your system supplies an <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> implementation which passes the
6903 <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libiconv/" target="_top">libiconv</a>'s test suite, please report that
6904 to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> and a
6905 future <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version will use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> on your system.</p></dd></dl></div><p>
6906
6907 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="newline"></a>31.5.3. Line Terminators</h3></div></div></div><p>The line terminator mode can be one of the following three keywords:
6908 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:UNIX</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
6909 <span class="keycode">LF</span> character (<span class="keycode">U000A</span>).
6910 </dd><dt><span class="term"><code class="constant">:MAC</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
6911 <span class="keycode">CR</span> character (<span class="keycode">U000D</span>).
6912 </dd><dt><span class="term"><code class="constant">:DOS</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
6913 <span class="keycode">CR</span> followed by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> <span class="keycode">LF</span>.
6914 </dd></dl></div><p>Windows programs typically use the <code class="constant">:DOS</code> line terminator,
6915 sometimes they also accept <code class="constant">:UNIX</code> line terminators or produce
6916 <code class="constant">:MAC</code> line terminators.</p><p>The <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol also requires <code class="constant">:DOS</code> line terminators.</p><p>The line terminator mode is relevant only for output (writing to a
6917 <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>). During input, all three kinds of line terminators
6918 are recognized. See also <a class="xref" href="#clhs-newline" title="13.11. Treatment of Newline during Input and Output sec_13-1-8">Section 13.11, “Treatment of Newline during Input and Output sec_13-1-8”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-encoding"></a>31.5.4. Function <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :CHARSET
6919 :LINE-TERMINATOR :INPUT-ERROR-ACTION :OUTPUT-ERROR-ACTION)</code>
6920 returns an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>. The <code class="constant">:CHARSET</code> argument may be
6921 an encoding, a string, or <code class="constant">:DEFAULT</code>.
6922 The possible values for the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> argument are the
6923 keywords <code class="constant">:UNIX</code>, <code class="constant">:MAC</code>, <code class="constant">:DOS</code>.</p><p>The <code class="constant">:INPUT-ERROR-ACTION</code> argument specifies
6924 what happens when an invalid byte sequence is encountered while
6925 converting bytes to characters. Its value can be <code class="constant">:ERROR</code>, <code class="constant">:IGNORE</code>
6926 or a character to be used instead. The <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character
6927 <span class="keysym">#\uFFFD</span> is typically used to indicate an error in the
6928 input sequence.</p><p>The <code class="constant">:OUTPUT-ERROR-ACTION</code> argument specifies
6929 what happens when an invalid character is encountered while converting
6930 characters to bytes. Its value can be <code class="constant">:ERROR</code>, <code class="constant">:IGNORE</code>, a byte to
6931 be used instead, or a character to be used instead. The <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>
6932 character <span class="keysym">#\uFFFD</span> can be used here only if it is
6933 encodable in the character set.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="enc-charset"></a>31.5.5. Function <a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></h4></div></div></div><p>The function <code class="code">(<a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a> <em class="replaceable"><code>encoding</code></em>)</code> returns the
6934 charset of the <em class="replaceable"><code>encoding</code></em>, as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> (<a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a> <em class="replaceable"><code>encoding</code></em>))</code> is
6935 not necessarily a valid <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a> name.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="enc-dflt"></a>31.5.6. Default encodings</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></div><p>Besides every <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> containing an encoding,
6936 the following <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> places contain global <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s:</p><p><a id="def-file-enc"></a><strong><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>. </strong>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a> is the encoding used for
6937 new <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, when no <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> argument was specified.
6938 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p class="simpara">The following are <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> places.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>
6939 <a id="path-enc" class="indexterm"></a></em></strong></span></dt><dd><p>is the encoding used for converting filenames in the
6940 file system (represented with byte sequences by the OS) to lisp
6941 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> components (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s).
6942 If this encoding is incompatible with some file names on your system,
6943 file system access (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>) may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s,
6944 thus extreme caution is recommended if this is <span class="strong"><strong>not</strong></span> a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>.
6945 Sometimes it may not be obvious that the encoding is involved at all.
6946 E.g., on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>: </p><pre class="programlisting">
6947 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> #\ARMENIAN_SMALL_LETTER_RA))
6948 *** - PARSE-NAMESTRING: syntax error in filename "ռ" at position 0
6949 </pre><p>when <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> because then
6950 <span class="data"><code class="literal">#\ARMENIAN_SMALL_LETTER_RA</code></span> corresponds
6951 to the 4 bytes <span class="data"><code class="literal">#(255 254 124 5)</code></span>
6952 and the byte <span class="data"><code class="literal">124</code></span> is <span class="strong"><strong>not</strong></span> a valid
6953 byte for a <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> file name because it
6954 means <span class="data"><code class="literal">|</code></span> in <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>.</p><p class="simpara">The set of valid pathname <span class="emphasis"><em>bytes</em></span> is
6955 determined by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a> test
6956 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/m4/filecharset.m4"><code class="filename">src/m4/filecharset.m4</code></a>
6957 at configure time. While rather stable for the first 127 bytes,
6958 on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> it varies wildly for the bytes 128-256, depending on the
6959 OS version and the file system.</p><p class="simpara">The <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode of <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is ignored.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a> platform only</span></span>:
6960 <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a> pathnames are actually <a class="ulink" href="https://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, so
6961 <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is a constant with value <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>.</p></dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>
6962 <a id="term-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding used for communication with the
6963 terminal, in particular by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
6964 </dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a>
6965 <a id="misc-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding used for access to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s,
6966 command line options, and the like. Its <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode is ignored.
6967 </dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a>
6968 <a id="foreign-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding for strings passed through the
6969 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> (some platforms only). If it is a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>,
6970 i.e. an encoding in which every character is represented by one byte,
6971 it is also used for passing characters through the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
6972 </dd></dl></div></dd></dl></div><p>The default encoding objects are initialized according to <code class="option"><a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a></code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Reminder</h3><p>You have to use <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF</code></a>/<a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF*</code></a>
6973 for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> will <span class="strong"><strong>not</strong></span> work!</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="line-term-default"></a>31.5.6.1. Default <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a></h4></div></div></div><p>The <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> facet of the above <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s is determined by
6974 the following logic: since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> understands all possible
6975 <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>s on <span class="emphasis"><em>input</em></span> (see
6976 <a class="xref" href="#clhs-newline" title="13.11. Treatment of Newline during Input and Output sec_13-1-8">Section 13.11, “Treatment of Newline during Input and Output sec_13-1-8”</a>), all that matters is what <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>
6977 do most <span class="emphasis"><em>other</em></span> programs expect?</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>If a non-0 <code class="literal">O_BINARY</code> <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>
6978 constant is defined, we assume that the OS distinguishes between text
6979 and binary files, and, since the encodings are relevant only for text
6980 files, we thus use <code class="constant">:DOS</code>; otherwise the default is <code class="constant">:UNIX</code>.
6981 </dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>Since most <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> programs expect CRLF, the default
6982 <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> is <code class="constant">:DOS</code>.</dd></dl></div><p>This boils down to the following code
6983 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/encoding.d"><code class="filename">src/encoding.d</code></a>:
6984 </p><pre class="programlisting">
6985 #if defined(WIN32) || (defined(UNIX) &amp;&amp; (O_BINARY != 0))
6986 </pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="cygwin-line-term-default"></a>Default line terminator on <span class="platform">Cygwin</span></h3><p><span class="emphasis"><em>Both</em></span> of the above tests
6987 pass on <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, so the default <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> is <code class="constant">:DOS</code>.
6988 If you so desire, you can change it in your <a href="clisp.html#opt-norc" class="olink">RC file</a>.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-byte"></a>31.5.7. Converting between strings and byte vectors</h3></div></div></div><p>Encodings can also be used to convert directly between strings and
6989 their corresponding byte vector representation according to that encoding.
6990 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-FROM-BYTES</code></a>
6991 <em class="replaceable"><code>vector</code></em> <em class="replaceable"><code>encoding</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd>converts the subsequence of <em class="replaceable"><code>vector</code></em> (a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)
6992 from <em class="replaceable"><code>start</code></em> to <em class="replaceable"><code>end</code></em> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, according to the given
6993 <em class="replaceable"><code>encoding</code></em>, and returns the resulting string.
6994 </dd><dt><span class="term"><code class="code">(<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a>
6995 <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>encoding</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd>converts the subsequence of <em class="replaceable"><code>string</code></em> from
6996 <em class="replaceable"><code>start</code></em> to <em class="replaceable"><code>end</code></em> to a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>, according to the given
6997 <em class="replaceable"><code>encoding</code></em>, and returns the resulting byte vector.
6998 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gstream"></a>31.6. Generic streams</h2></div></div></div><p>This interface is <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific and now obsolete. Please use
6999 the <a class="link" href="#gray" title="Chapter 30. Gray streams">Gray streams</a> interface instead.</p><p>Generic streams are user programmable streams.
7000 The programmer interface:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">gstream:make-generic-stream</code>
7001 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>returns a generic stream.
7002 </dd><dt><span class="term"><code class="code">(<code class="function">gstream:generic-stream-controller</code>
7003 <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>returns a private object to which generic stream
7004 methods dispatch. The typical usage is to retrieve the object
7005 originally provided by the user in
7006 <code class="function">gstream:make-generic-stream</code>.
7007 </dd><dt><span class="term"><code class="code">(<code class="function">gstream:generic-stream-p</code>
7008 <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>determines whether a stream is a generic stream,
7009 returning <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if it is, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> otherwise.
7010 </dd></dl></div><p>In order to specify the behavior of a generic stream, the user
7011 must define <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> methods on the following <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> generic
7012 functions. The function <code class="function">gstream:generic-stream-<em class="replaceable"><code>x</code></em></code>
7013 corresponds to the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> function <code class="function"><em class="replaceable"><code>x</code></em></code>.
7014 They all take a controller and some number of arguments.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(gstream:generic-stream-read-char
7015 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd> Returns and consumes the next character, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at
7016 end of file. Takes one argument, the controller object.
7017 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-peek-char
7018 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd> Returns the next character, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at end of file. A
7019 second value indicates whether the side effects associated with
7020 consuming the character were executed: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> means that a full
7021 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> was done, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> means that no side effects were done.
7022 Takes one argument, the controller object.
7023 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-read-byte
7024 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>Returns and consumes the next integer, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at end
7025 of file. Takes one argument, the controller object.
7026 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-read-char-will-hang-p
7027 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>This generic function is used to query the stream's
7028 input status. It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
7029 <code class="function">gstream:generic-stream-read-char</code> and
7030 <code class="function">gstream:generic-stream-peek-char</code> will certainly
7031 return immediately. Otherwise it returns true.
7032 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-char
7033 <em class="replaceable"><code>controller</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd>The first argument is the controller object.
7034 The second argument is the character to be written.
7035 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-byte
7036 <em class="replaceable"><code>controller</code></em>
7037 <em class="replaceable"><code>by</code></em>)</code></span></dt><dd>The first argument is the controller object.
7038 The second argument is the integer to be written.
7039 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-string
7040 <em class="replaceable"><code>controller</code></em>
7041 <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>length</code></em>)</code></span></dt><dd>Writes the subsequence of <em class="replaceable"><code>string</code></em> starting from
7042 <em class="replaceable"><code>start</code></em> of length <em class="replaceable"><code>length</code></em>.
7043 The first argument is the controller object.
7044 </dd><dt><span class="term"><code class="code">(gstream:generic-stream-clear-input
7045 <em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-clear-output
7046 <em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-finish-output
7047 <em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-force-output
7048 <em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-close
7049 <em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>Take one argument, the controller object.
7050 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="weak"></a>31.7. Weak Objects</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></div><p>Recall two terms: An object is called <span class="quote">“<span class="quote">"alive"</span>”</span> as
7051 long as it can be retrieved by the user or program, through any kind of
7052 references, starting from global and local variables. (Objects that
7053 consume no heap storage, also known as <span class="quote">“<span class="quote">"immediate
7054 objects"</span>”</span>, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s, and
7055 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s, are alive indefinitely.) An object is said to be
7056 <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed when its storage is reclaimed, at some moment after it becomes
7057 <span class="quote">“<span class="quote">"dead"</span>”</span>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-pointer"></a>31.7.1. Weak Pointers</h3></div></div></div><p>A <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a> is an object holding a reference to a given object,
7058 without keeping the latter from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p><div class="variablelist"><p class="title"><strong>Weak Pointer API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-POINTER</code>
7059 <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>returns a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a> referring to
7060 <em class="replaceable"><code>value</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-POINTER-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7061 <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-POINTER-VALUE</code>
7062 <em class="replaceable"><code>weak-pointer</code></em>)</code></span></dt><dd>returns two values: The original value and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
7063 if the value has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
7064 It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able: you can change the value that the weak pointer
7065 points to.</dd></dl></div><p>Weak pointers are useful for notification-based communication
7066 protocols between software modules, e.g. when a change to an object
7067 <em class="replaceable"><code>x</code></em> requires a notification to an object <em class="replaceable"><code>y</code></em>, as long as <em class="replaceable"><code>y</code></em> is
7068 alive.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-list"></a>31.7.2. Weak Lists</h3></div></div></div><p>A <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> is an ordered collection of references to objects
7069 that does <span class="strong"><strong>not</strong></span> keep the objects from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. It is
7070 semantically equivalent to a list of <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s, however with a
7071 more efficient in-memory representation than a plain list of
7072 <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s would be.</p><div class="variablelist"><p class="title"><strong>Weak List API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-LIST</code> <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> pointing to each of the
7073 elements in the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-LIST-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7074 <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-LIST-LIST</code>
7075 <em class="replaceable"><code>weak-list</code></em>)</code></span></dt><dd>returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of those objects from the
7076 <em class="replaceable"><code>weak-list</code></em> that are still
7077 alive.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-LIST-LIST</code>
7078 <em class="replaceable"><code>weak-list</code></em>) <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>replaces the list of objects stored by the
7079 <em class="replaceable"><code>weak-list</code></em>.</dd></dl></div><p>Weak lists are useful for notification based communication
7080 protocols between software modules, e.g. when a change to an object
7081 <em class="replaceable"><code>x</code></em> requires a notification to objects <em class="replaceable"><code>k<sub>1</sub></code></em>, <em class="replaceable"><code>k<sub>2</sub></code></em>, ..., as long
7082 as such a particular <em class="replaceable"><code>k<sub>n</sub></code></em> is alive.</p><p>A <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> with a single element is semantically equivalent to a
7083 single <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-and-relation"></a>31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">and</span>”</span> relation is an ordered collection of
7084 references to objects, that does <span class="strong"><strong>not</strong></span> keep the objects from being
7085 <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and which allows access to all the objects as long as all of
7086 them are still alive. As soon as one of them is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, the entire
7087 collection of objects becomes empty.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">And</span>”</span> Relation API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-AND-RELATION</code>
7088 <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> between the objects in
7089 the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-RELATION-P</code>
7090 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7091 <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-RELATION-LIST</code>
7092 <em class="replaceable"><code>weak-and-relation</code></em>)</code></span></dt><dd>returns the list of objects stored in the
7093 <em class="replaceable"><code>weak-and-relation</code></em>. The returned list must not
7094 be destructively modified.</dd></dl></div><p><a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>s are useful to model relations between objects
7095 that become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> with a single element is semantically
7096 equivalent to a <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-or-relation"></a>31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">or</span>”</span> relation is an ordered collection of
7097 references to objects, that keeps all objects from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed as long
7098 as one of them is still alive. In other words, each of them keeps all
7099 others among them from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. When all of them are unreferenced,
7100 the collection of objects becomes empty.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">Or</span>”</span> Relation API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-OR-RELATION</code>
7101 <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> between the objects in
7102 the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-RELATION-P</code>
7103 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7104 <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-RELATION-LIST</code>
7105 <em class="replaceable"><code>weak-or-relation</code></em>)</code></span></dt><dd>returns the list of objects stored in the
7106 <em class="replaceable"><code>weak-or-relation</code></em>. The returned list must not
7107 be destructively modified.</dd></dl></div><p><a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>s are useful to model relations between objects
7108 that do not become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> with a single element is semantically
7109 equivalent to a <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-mapping"></a>31.7.5. Weak Associations</h3></div></div></div><p>A weak association is a mapping from an object called <em class="replaceable"><code>key</code></em> to
7110 an object called <em class="replaceable"><code>value</code></em>, that exists as long as the key is alive. In
7111 other words, as long as the key is alive, it keeps the value from being
7112 <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p><div class="variablelist"><p class="title"><strong>Weak Association API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-MAPPING</code>
7113 <em class="replaceable"><code>key</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>.
7114 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-P</code>
7115 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the object is of type
7116 <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-PAIR</code>
7117 <em class="replaceable"><code>weak-mapping</code></em>)</code></span></dt><dd>returns three values: the original key, the original
7118 value, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if the key has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
7119 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-VALUE</code>
7120 <em class="replaceable"><code>weak-mapping</code></em>)</code></span></dt><dd>returns the value, if the key has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
7121 else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-MAPPING-VALUE</code>
7122 <em class="replaceable"><code>weak-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
7123 <em class="replaceable"><code>weak-mapping</code></em>. It has no effect when the
7124 key has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p>Weak associations are useful to supplement objects with additional
7125 information that is stored outside of the object.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-and-mapping"></a>31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">and</span>”</span> mapping is a mapping from a tuple of
7126 objects called <em class="replaceable"><code>keys</code></em> to an object called <em class="replaceable"><code>value</code></em>, that does
7127 <span class="strong"><strong>not</strong></span> keep the keys from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed and that exists as long as all
7128 keys are alive. As soon as one of the keys is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, the entire
7129 mapping goes away.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">And</span>”</span> Mapping API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-AND-MAPPING</code>
7130 <em class="replaceable"><code>keys</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a> between the <em class="replaceable"><code>keys</code></em>
7131 objects in the given list and the given <em class="replaceable"><code>value</code></em>.
7132 The <em class="replaceable"><code>keys</code></em> list must be non-empty.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-P</code>
7133 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7134 <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-PAIR</code>
7135 <em class="replaceable"><code>weak-and-mapping</code></em>)</code></span></dt><dd>returns three values: the list of keys, the value,
7136 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if none of the keys have been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
7137 The returned keys list must not be destructively modified.
7138 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-VALUE</code>
7139 <em class="replaceable"><code>weak-and-mapping</code></em>)</code></span></dt><dd>returns the value, if none of the keys have been
7140 <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
7141 (<code class="function">EXT:WEAK-AND-MAPPING-VALUE</code>
7142 <em class="replaceable"><code>weak-and-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
7143 <em class="replaceable"><code>weak-and-mapping</code></em>. It has no effect when
7144 some key has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p><a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>s are useful to model properties of sets of
7145 objects that become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a> with a single key is semantically equivalent
7146 to a weak association.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-or-mapping"></a>31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">or</span>”</span> mapping is a mapping from a tuple of
7147 objects called <em class="replaceable"><code>keys</code></em> to an object called <em class="replaceable"><code>value</code></em>, that keeps all
7148 keys and the value from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed as long as one of the keys is
7149 still alive. In other words, each of the keys keeps all others among
7150 them and the value from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. When all of them are
7151 unreferenced, the entire mapping goes away.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">Or</span>”</span> Mapping API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-OR-MAPPING</code>
7152 <em class="replaceable"><code>keys</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd> creates a <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a> between the
7153 <em class="replaceable"><code>keys</code></em> objects in the given list and the given
7154 <em class="replaceable"><code>value</code></em>. The <em class="replaceable"><code>keys</code></em> list must be
7155 non-empty.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-P</code>
7156 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7157 <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-PAIR</code>
7158 <em class="replaceable"><code>weak-or-mapping</code></em>)</code></span></dt><dd>returns three values: the list of keys, the value,
7159 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if the keys have not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
7160 The returned keys list must not be destructively modified.
7161 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-VALUE</code>
7162 <em class="replaceable"><code>weak-or-mapping</code></em>)</code></span></dt><dd>returns the value, if the keys have not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
7163 else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-OR-MAPPING-VALUE</code>
7164 <em class="replaceable"><code>weak-or-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
7165 <em class="replaceable"><code>weak-or-mapping</code></em>. It has no effect when the
7166 keys have already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p><a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>s are useful to model properties of sets of
7167 objects that do not become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a> with a single key is semantically equivalent
7168 to a weak association.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-alist"></a>31.7.8. Weak Association Lists</h3></div></div></div><p>A weak association list is an ordered collection of pairs, each
7169 pair being built from an object called <em class="replaceable"><code>key</code></em> and an object called
7170 <em class="replaceable"><code>value</code></em>. The lifetime of each pair depends on the type of the weak
7171 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>:
7172 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
7173 As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em> from
7174 being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>value</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
7175 As long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the <em class="replaceable"><code>key</code></em> from
7176 being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>
7177 are alive.
7178 </dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> or the <em class="replaceable"><code>value</code></em>
7179 are alive. As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em>
7180 from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and as long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the
7181 <em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p>
7182 In other words, each pair is:
7183 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>key</code></em> to the <em class="replaceable"><code>value</code></em>,
7184 </dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>value</code></em> to the <em class="replaceable"><code>key</code></em>,
7185 </dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>,
7186 </dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>.
7187 </dd></dl></div><div class="variablelist"><p class="title"><strong>Weak Association List API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-ALIST</code>
7188 :type :initial-contents)</code></span></dt><dd>creates a <a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>. The <em class="replaceable"><code>type</code></em> argument
7189 must be one of the four aforementioned types; the default is <code class="constant">:KEY</code>.
7190 The <em class="replaceable"><code>initial-contents</code></em> argument must be an
7191 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
7192 <a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-TYPE</code>
7193 <em class="replaceable"><code>weak-alist</code></em>)</code></span></dt><dd>returns the type of the
7194 <em class="replaceable"><code>weak-alist</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
7195 <em class="replaceable"><code>weak-alist</code></em>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> that corresponds to the current
7196 contents of the <em class="replaceable"><code>weak-alist</code></em>.
7197 </dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
7198 <em class="replaceable"><code>weak-alist</code></em>)
7199 <em class="replaceable"><code>contents</code></em>)</code></span></dt><dd>replaces the contents of a
7200 <em class="replaceable"><code>weak-alist</code></em>. The
7201 <em class="replaceable"><code>contents</code></em> argument must be an
7202 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-ASSOC</code> <em class="replaceable"><code>item</code></em>
7203 <em class="replaceable"><code>weak-alist</code></em>
7204 [:test] [:test-not] [:key])</code></span></dt><dd>is equivalent to
7205 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_assoccm_a_assoc-if-not.html" target="_top"><code class="function">ASSOC</code></a> <em class="replaceable"><code>item</code></em> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
7206 <em class="replaceable"><code>weak-alist</code></em>)
7207 [:test] [:test-not] [:key])</code>.
7208 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-RASSOC</code> <em class="replaceable"><code>item</code></em>
7209 <em class="replaceable"><code>weak-alist</code></em>
7210 [:test] [:test-not] [:key])</code></span></dt><dd>is equivalent to
7211 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rassoccm__assoc-if-not.html" target="_top"><code class="function">RASSOC</code></a> <em class="replaceable"><code>item</code></em> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
7212 <em class="replaceable"><code>weak-alist</code></em>)
7213 [:test] [:test-not] [:key])</code>.
7214 </dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-VALUE</code> <em class="replaceable"><code>item</code></em>
7215 <em class="replaceable"><code>weak-alist</code></em> [:test] [:test-not])</code></span></dt><dd>is equivalent to
7216 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> (<code class="function">EXT:WEAK-LIST-ASSOC</code>
7217 <em class="replaceable"><code>item</code></em> <em class="replaceable"><code>weak-alist</code></em>
7218 [:test] [:test-not]))</code>.
7219 </dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-ALIST-VALUE</code>
7220 <em class="replaceable"><code>item</code></em> <em class="replaceable"><code>weak-alist</code></em> [:test] [:test-not])
7221 <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored for <em class="replaceable"><code>item</code></em> in
7222 a <em class="replaceable"><code>weak-alist</code></em>. When a pair with the given
7223 <em class="replaceable"><code>item</code></em> as key does not exist or has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, a new pair
7224 is added to the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd></dl></div><p>Weak associations lists are useful to supplement objects with
7225 additional information that is stored outside of the object, when the
7226 number of such objects is known to be small.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-ht"></a>31.7.9. Weak Hash Tables</h3></div></div></div><p>A weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is an unordered collection of pairs, each
7227 pair being built from an object called <em class="replaceable"><code>key</code></em> and an object called
7228 <em class="replaceable"><code>value</code></em>. There can be only one pair with a given <em class="replaceable"><code>key</code></em> in a weak
7229 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>. The lifetime of each pair depends on the type of the
7230 weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>
7231 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
7232 As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em> from
7233 being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>value</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
7234 As long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the <em class="replaceable"><code>key</code></em> from
7235 being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> and the
7236 <em class="replaceable"><code>value</code></em> are alive.</dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> or the
7237 <em class="replaceable"><code>value</code></em> are alive. As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents
7238 the <em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and as long as the <em class="replaceable"><code>value</code></em> is
7239 alive, it prevents the <em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
7240 </dd></dl></div><p>
7241 In other words, each pair is:
7242 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>key</code></em> to the <em class="replaceable"><code>value</code></em>,
7243 </dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>value</code></em> to the <em class="replaceable"><code>key</code></em>,
7244 </dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>,
7245 </dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>.
7246 </dd></dl></div><p>See also <a class="xref" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE">Section 18.2, “Function <code class="function">MAKE-HASH-TABLE</code>”</a>.</p><p>Weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s are useful to supplement objects with
7247 additional information that is stored outside of the object. This data
7248 structure scales up without performance degradation when the number of
7249 pairs is big.</p><p>Weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s are also useful to implement canonicalization
7250 tables.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="final"></a>31.8. Finalization</h2></div></div></div><p>Calling <code class="code">(<a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>function</code></em>)</code>
7251 has the effect that when the specified object is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
7252 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>)</code> will be executed.</p><p>Calling <code class="code">(<a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>guardian</code></em>)</code>
7253 has a similar effect, but only as long as the <em class="replaceable"><code>guardian</code></em> has not been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed:
7254 when <em class="replaceable"><code>object</code></em> is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>
7255 <em class="replaceable"><code>guardian</code></em>)</code> will be executed.
7256 If the <em class="replaceable"><code>guardian</code></em> is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed before <em class="replaceable"><code>object</code></em> is, nothing happens.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The time when <span class="quote">“<span class="quote">the <em class="replaceable"><code>object</code></em> is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed</span>”</span> is not
7257 defined deterministically. (Actually, it might possibly never occur.)
7258 It denotes a moment at which no references to <em class="replaceable"><code>object</code></em> exist from other
7259 Lisp objects. When the <em class="replaceable"><code>function</code></em> is called, <em class="replaceable"><code>object</code></em> (and, possibly,
7260 <em class="replaceable"><code>guardian</code></em>) enter the <span class="quote">“<span class="quote">arena of live Lisp objects</span>”</span> again.
7261 </p></div><p>No finalization request will be executed more than once.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="prompt"></a>31.9. The Prompt</h2></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> prompt consists of 3 mandatory parts: <span class="quote">“<span class="quote">start</span>”</span>,
7262 <span class="quote">“<span class="quote">body</span>”</span>, and <span class="quote">“<span class="quote">finish</span>”</span>; and 2 optional parts:
7263 <span class="quote">“<span class="quote">break</span>”</span>, which appears only in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> (after <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>
7264 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a>), and <span class="quote">“<span class="quote">step</span>”</span>, which appears only in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>er.
7265 Each part is controlled by a custom variable, which can be either a
7266 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of no arguments returning a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
7267 (if it is something else - or if the return value was not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
7268 - it is printed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>). In the order of invocation:</p><div class="variablelist"><dl class="variablelist"><dt><a id="prompt-start"></a><span class="term"><a class="link" href="#prompt-start"><code class="varname">CUSTOM:*PROMPT-START*</code></a></span></dt><dd>Defaults to an empty string.
7269 </dd><dt><a id="prompt-step"></a><span class="term"><a class="link" href="#prompt-step"><code class="varname">CUSTOM:*PROMPT-STEP*</code></a></span></dt><dd>Used only during <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>ping.
7270 Defaults to <span class="quote">“<span class="quote"><code class="prompt">Step n </code></span>”</span>,
7271 where <em class="replaceable"><code>n</code></em> is the stepping level as returned by <a class="link" href="#step-level"><code class="function">EXT:STEP-LEVEL</code></a>.
7272 </dd><dt><a id="prompt-break"></a><span class="term"><a class="link" href="#prompt-break"><code class="varname">CUSTOM:*PROMPT-BREAK*</code></a></span></dt><dd>Used only inside break loop (during debugging).
7273 Defaults to <span class="quote">“<span class="quote"><code class="prompt">Break n </code></span>”</span>,
7274 where <em class="replaceable"><code>n</code></em> is the break level as returned by <a class="link" href="#break-level"><code class="function">EXT:BREAK-LEVEL</code></a>.
7275 </dd><dt><a id="prompt-body"></a><span class="term"><a class="link" href="#prompt-body"><code class="varname">CUSTOM:*PROMPT-BODY*</code></a></span></dt><dd>Defaults to <span class="quote">“<span class="quote"><code class="prompt">package[n]</code></span>”</span>
7276 where <em class="replaceable"><code>package</code></em> is the shortest (nick)name (as returned by
7277 <a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a>) of the current package <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>
7278 if it is <span class="strong"><strong>not</strong></span> the same as it was in the beginning
7279 (determined by <a class="link" href="#prompt-new-package"><code class="function">EXT:PROMPT-NEW-PACKAGE</code></a>)
7280 or if it does not contain symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
7281 (it is assumed that in the latter case you would want to keep in
7282 mind that your current package is something weird);
7283 and <em class="replaceable"><code>n</code></em> is the index of the current prompt, kept in <a class="link" href="#command-index"><code class="varname">EXT:*COMMAND-INDEX*</code></a>.
7284 </dd><dt><a id="prompt-finish"></a><span class="term"><a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a></span></dt><dd>Defaults to <span class="quote">“<span class="quote"><code class="prompt">&gt; </code></span>”</span>.
7285 </dd></dl></div><p>To facilitate your own custom prompt creation, the following
7286 functions and variables are available:</p><div class="variablelist"><dl class="variablelist"><dt><a id="break-level"></a><span class="term"><a class="link" href="#break-level"><code class="function">EXT:BREAK-LEVEL</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> level.
7287 </dd><dt><a id="step-level"></a><span class="term"><a class="link" href="#step-level"><code class="function">EXT:STEP-LEVEL</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a> level.
7288 </dd><dt><a id="prompt-new-package"></a><span class="term"><a class="link" href="#prompt-new-package"><code class="function">EXT:PROMPT-NEW-PACKAGE</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
7289 if the current package is the same as it was initially.
7290 </dd><dt><a id="package-shortest-name"></a><span class="term"><a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> takes one argument, a
7291 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>, and returns its shortest name or nickname.
7292 </dd><dt><a id="command-index"></a><span class="term"><a class="link" href="#command-index"><code class="varname">EXT:*COMMAND-INDEX*</code></a></span></dt><dd>contains the current prompt number;
7293 it is your responsibility to increment it
7294 (this variable is bound to 0 before saving the <a href="impnotes.html#image" class="olink">memory image</a>).
7295 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ansi"></a>31.10. Maximum ANSI CL compliance</h2></div></div></div><p>Some [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] features are turned off by default for convenience and
7296 backward compatibility.
7297 They can be switched on, all at once, by setting the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
7298 <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, or they can be switched on individually.
7299 Setting <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> implies the following:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Setting <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ol></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> switch or set
7300 the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> and then save <a href="impnotes.html#image" class="olink">memory image</a>,
7301 then all subsequent invocations of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with this image
7302 will be as if with <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code>
7303 (regardless whether you actually supply the <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> switch).
7304 You can always set the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, or invoke
7305 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the <code class="option"><a href="clisp.html#opt-traditional" class="olink">-traditional</a></code> switch, reversing the above
7306 settings, i.e.,</p></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Setting <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macros3"></a>31.11. Additional Fancy Macros and Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> &amp; <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with some extension macros, mostly defined in the
7307 file <a class="link" href="#macros3-lisp"><code class="filename">macros3.lisp</code></a> and loaded from the file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a> during <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>:</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ethe"></a>31.11.1. Macro <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a> <em class="replaceable"><code>value-type</code></em> <em class="replaceable"><code>form</code></em>)</code>
7308 enforces a type check in both interpreted and compiled code.
7309 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="letf"></a>31.11.2. Macros <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF</code></a> &amp; <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF*</code></a></h3></div></div></div><p>These macros are similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>, respectively,
7310 except that they can bind <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s, even <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s with <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.
7311 Example:
7312 </p><pre class="programlisting">(letf (((values a b) form)) ...)
7313 </pre><p>
7314 is equivalent to
7315 </p><pre class="programlisting">(multiple-value-bind (a b) form ...)
7316 </pre><p>
7317 while
7318 </p><pre class="programlisting">(letf (((first l) 7)) ...)
7319 </pre><p>
7320 is approximately equivalent to
7321 </p><pre class="programlisting">
7322 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> ((#:g1 l) (#:g2 (first #:g1)))
7323 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (first #:g1) 7) ...)
7324 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (first #:g1) #:g2)))
7325 </pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="memoized"></a>31.11.3. Macro <code class="function">EXT:MEMOIZED</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:MEMOIZED</code> <em class="replaceable"><code>form</code></em>)</code>
7326 memoizes the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> of <em class="replaceable"><code>form</code></em> from its first evaluation.
7327 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-collect"></a>31.11.4. Macro <a class="link" href="#with-collect" title="31.11.4. Macro EXT:WITH-COLLECT"><code class="function">EXT:WITH-COLLECT</code></a></h3></div></div></div><p>Similar to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>'s
7328 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-3.html"><code class="literal">COLLECT</code></a>
7329 construct, except that it is looks more "Lispy" and can appear
7330 arbitrarily deep. It defines local macros (with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a>) which
7331 collect objects given to it into lists, which are then returned as
7332 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>. E.g., </p><pre class="programlisting">
7333 (ext:with-collect (c0 c1)
7334 (dotimes (i 10) (if (oddp i) (c0 i) (c1 i))))
7335 ⇒ <code class="computeroutput">(1 3 5 7 9)</code> ;
7336 ⇒ <code class="computeroutput">(0 2 4 6 8)</code>
7337 </pre><p> returns two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-time-value"></a>31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></h3></div></div></div><p>Sometimes one may want to call an expensive function at
7338 compilation time and write the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> into the <code class="filename">#P".fas"</code> file,
7339 thus speeding up loading the <code class="filename">#P".fas"</code> file.
7340 E.g., let your file <code class="filename">primes.lisp</code> be
7341 </p><pre class="programlisting">
7342 (defun primes-list (limit)
7343 "Return the list of all primes smaller than LIMIT."
7344 ...)
7345 (defvar *all-primes* (compile-time-value (primes-list <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>)))
7346 </pre><p>
7347 Then </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> "primes.lisp")</code></span></dt><dd>will <span class="strong"><strong>not</strong></span> call <code class="function">primes-list</code>
7348 and <code class="varname">*all-primes*</code> will be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
7349 </dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> "primes.lisp")</code></span></dt><dd>will call <code class="function">primes-list</code> (and
7350 will probably take a long time) and will write the resulting list
7351 into <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a> "primes.lisp")</code>
7352 </dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a>
7353 "primes.lisp"))</code></span></dt><dd>will <span class="strong"><strong>not</strong></span> call <code class="function">primes-list</code>
7354 but <code class="varname">*all-primes*</code> will be the list computed during
7355 compilation.</dd></dl></div><p>An alternative is to save a <a href="impnotes.html#image" class="olink">memory image</a>, which is faster than <code class="filename">#P".fas"</code>
7356 file but <a class="link" href="#image-portability" title="31.2.1. Image Portability">less portable</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-gensyms"></a>31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></h3></div></div></div><p>Similar to its namesake from
7357 <a class="ulink" href="http://www.paulgraham.com/" target="_top">Paul Graham</a>'s book
7358 <a class="ulink" href="http://www.paulgraham.com/onlisp.html" target="_top"><span class="quote">“<span class="quote">On
7359 Lisp</span>”</span></a>, this macro is useful for writing other macros:
7360 </p><pre class="programlisting">
7361 (with-gensyms ("FOO-" bar baz zot) ...)
7362 </pre><p>
7363 expands to
7364 </p><pre class="programlisting">
7365 (let ((bar (gensym "FOO-BAR-"))
7366 (baz (gensym "FOO-BAZ-"))
7367 (zot (gensym "FOO-ZOT-")))
7368 ...)
7369 </pre><p>
7370 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="remove-plist"></a>31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></h3></div></div></div><p>Similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_remf.html" target="_top"><code class="function">REMF</code></a>, this function removes some
7371 properties from a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>. It is non-destructive and thus can be
7372 used on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> arguments to remove some keyword parameters, e.g.,
7373 </p><pre class="programlisting">
7374 (defmacro with-foo ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> foo1 foo2) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)
7375 `(... ,foo1 ... ,foo2 ... ,@body))
7376 (defmacro with-foo-bar ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> opts <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> bar1 bar2
7377 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)
7378 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)
7379 `(with-foo (,@(remove-plist opts :bar1 :bar2)
7380 ... ,bar1 ... ,bar2 ... ,@body)))
7381 (defun foo-bar ()
7382 (with-foo-bar (:bar1 1 :foo2 2) ...))
7383 </pre><p>
7384 here <code class="function">WITH-FOO</code> does not receive the
7385 <code class="literal">:BAR1 1</code> argument from <code class="function">FOO-BAR</code>.
7386 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="html-http-output"></a>31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and
7387 <code class="function">EXT:WITH-HTTP-OUTPUT</code></h3></div></div></div><p>Defined in <a class="link" href="#inspect-lisp"><code class="filename">inspect.lisp</code></a>, these macros are useful
7388 for the rudimentary <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server defined there.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="open-http"></a>31.11.9. Function <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> and
7389 macro <code class="function">EXT:WITH-HTTP-INPUT</code></h3></div></div></div><p>Defined in
7390 <a class="link" href="#clhs-lisp"><code class="filename">clhs.lisp</code></a>,
7391 they allow downloading data over the Internet using the <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol.
7392 <code class="code">(<a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> url <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:IF-DOES-NOT-EXIST</code> :LOG)</code> opens
7393 a <a class="link" href="#socket" title="32.4. Socket Streams">socket</a> connection to the <em class="replaceable"><code>url</code></em> host,
7394 sends the <span class="command"><strong>GET</strong></span> request,
7395 and returns two values: the <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> and content length.
7396 <code class="code">(EXT:WITH-HTTP-INPUT (<em class="replaceable"><code>variable</code></em> url) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code> binds <em class="replaceable"><code>variable</code></em>
7397 to the <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> returned by <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> and executes the <em class="replaceable"><code>body</code></em>.
7398 <code class="code">(EXT:WITH-HTTP-INPUT ((<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>contents</code></em>) url) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code>
7399 additionally binds <em class="replaceable"><code>contents</code></em> to the content length.</p><p><a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> will check <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> on startup and parse the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
7400 <code class="envar">HTTP_PROXY</code> if <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>The <code class="constant">:LOG</code> argument binds <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="http-log-stream"></a>31.11.10. Variable <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></h3></div></div></div><p>Function <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> logs its actions to <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>
7401 which is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="browse-url"></a>31.11.11. Function <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a> url <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a> <code class="constant">:OUT</code>)</code>
7402 calls a browser on the URL. <em class="replaceable"><code>browser</code></em>
7403 (defaults to <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a>) should be a valid keyword in the <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">CUSTOM:*BROWSERS*</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.
7404 <code class="constant">:OUT</code> specifies the stream where the progress messages are printed
7405 (defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>).
7406 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="http-proxy"></a>31.11.12. Variable <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a></h3></div></div></div><p>If you are behind a proxy server, you will need to set <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> to
7407 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <span class="data"><code class="literal">(name:password host port)</code></span>.
7408 By default, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">http_proxy</code> is used, the
7409 expected format is <span class="data"><code class="literal">"name:password@host:port"</code></span>.
7410 If no <span class="data"><code class="literal">#\@</code></span> is present,
7411 <em class="replaceable"><code>name</code></em> and <em class="replaceable"><code>password</code></em> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
7412 If no <span class="data"><code class="literal">#\:</code></span> is present,
7413 <em class="replaceable"><code>password</code></em> (or <em class="replaceable"><code>port</code></em>) is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>Use function <code class="code">(EXT:HTTP-PROXY <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
7414 (<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> "http_proxy")))</code> to reset
7415 <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="canonicalize"></a>31.11.13. Function <a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a></h3></div></div></div><p>If you want to canonicalize a <em class="replaceable"><code>value</code></em> before further processing it, you
7416 can pass it to <a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a> together with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s:
7417 <code class="code">(<a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a> <em class="replaceable"><code>value</code></em> <em class="replaceable"><code>functions</code></em>
7418 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (test '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>) (max-iter 1024))</code> will call <em class="replaceable"><code>function</code></em>s on
7419 <em class="replaceable"><code>value</code></em> until it stabilizes under <em class="replaceable"><code>test</code></em>
7420 (which should be a valid <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a>) and return the stabilized
7421 value and the number of iterations the stabilization required.</p><p>E.g., <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> uses it together with
7422 <strong class="first"><em class="firstterm"><code class="varname">XLIB:*CANONICALIZE-ENCODING*</code></em></strong>
7423 to fix the broken encoding names returned by the <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a> (e.g., convert
7424 <code class="literal">"iso8859-1"</code> to <code class="literal">"ISO-8859-1"</code>)
7425 before passing them over to <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a>. If you encounter an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>
7426 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>, you can augment this variable to avoid it.
7427 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="customize"></a>31.12. Customizing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> behavior</h2></div></div></div><p>The user-customizable variables and functions are located in the
7428 package <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a> and thus can be listed using
7429 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> "" "CUSTOM")</code>:
7430 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a></td><td><code class="varname">CUSTOM:*APPLYHOOK*</code></td></tr><tr><td><a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a></td><td><a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*BREAK-ON-WARNINGS*</code></td><td><a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a></td></tr><tr><td><a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">CUSTOM:*BROWSERS*</code></a></td><td><a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a></td></tr><tr><td><a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a></td><td><a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a></td></tr><tr><td><a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a></td><td><a class="link" href="#compiled-types"><code class="varname">CUSTOM:*COMPILED-FILE-TYPES*</code></a></td></tr><tr><td><a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a></td><td><a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a></td><td><a class="link" href="#default-tz" title="Default Time Zone"><code class="varname">CUSTOM:*DEFAULT-TIME-ZONE*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*DEFTYPE-DEPTH-LIMIT*</code></td><td><a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a></td></tr><tr><td><a class="link" href="#device-prefix"><code class="varname">CUSTOM:*DEVICE-PREFIX*</code></a></td><td><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQ-HASHFUNCTION*</code></a></td><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQL-HASHFUNCTION*</code></a></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQUAL-HASHFUNCTION*</code></a></td><td><code class="varname">CUSTOM:*ERROR-HANDLER*</code></td></tr><tr><td><code class="varname">CUSTOM:*EVALHOOK*</code></td><td><a href="impnotes.html#fill-stream" class="olink"><code class="varname">CUSTOM:*FILL-INDENT-SEXP*</code></a></td></tr><tr><td><a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a></td><td><a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a></td></tr><tr><td><a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a></td><td><a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></td><td><a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a></td></tr><tr><td><a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a></td><td><a class="link" href="#impnotes-root" title="Function CUSTOM:IMPNOTES-ROOT"><code class="varname">CUSTOM:*IMPNOTES-ROOT-DEFAULT*</code></a></td></tr><tr><td><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-BROWSER*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-FRONTEND*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-LENGTH*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LENGTH*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LEVEL*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LINES*</code></a></td><td><a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a></td></tr><tr><td><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a></td><td><a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a></td></tr><tr><td><a href="impnotes.html#load-lpt" class="olink"><code class="varname">CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE*</code></a></td><td><a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a></td></tr><tr><td><a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a></td><td><a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a></td></tr><tr><td><a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a></td><td><a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></td><td><code class="varname">CUSTOM:*PACKAGE-TASKS-TREAT-SPECIALLY*</code></td></tr><tr><td><a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a></td><td><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></td></tr><tr><td><a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a></td><td><a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a></td></tr><tr><td><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a></td><td><a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a></td></tr><tr><td><a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a></td><td><a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a></td></tr><tr><td><a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a></td><td><a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*PRINT-PRETTY-FILL*</code></td><td><a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a></td></tr><tr><td><a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a></td><td><a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a></td></tr><tr><td><a class="link" href="#prompt-body"><code class="varname">CUSTOM:*PROMPT-BODY*</code></a></td><td><a class="link" href="#prompt-break"><code class="varname">CUSTOM:*PROMPT-BREAK*</code></a></td></tr><tr><td><a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a></td><td><a class="link" href="#prompt-start"><code class="varname">CUSTOM:*PROMPT-START*</code></a></td></tr><tr><td><a class="link" href="#prompt-step"><code class="varname">CUSTOM:*PROMPT-STEP*</code></a></td><td><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></td></tr><tr><td><a href="impnotes.html#err-pr-bt" class="olink"><code class="varname">CUSTOM:*REPORT-ERROR-PRINT-BACKTRACE*</code></a></td><td><a href="impnotes.html#image" class="olink"><code class="varname">CUSTOM:*SAVEINITMEM-VERBOSE*</code></a></td></tr><tr><td><a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a></td><td><a class="link" href="#source-types"><code class="varname">CUSTOM:*SOURCE-FILE-TYPES*</code></a></td></tr><tr><td><a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a></td><td><a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></td></tr><tr><td><a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a></td><td><a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a></td><td><a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a></td></tr><tr><td><a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a></td><td><code class="varname">CUSTOM:*USER-MAIL-ADDRESS*</code></td></tr><tr><td><a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a></td><td><a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*WITH-HTML-OUTPUT-DOCTYPE*</code></td><td> </td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some of these variables are
7431 platform-specific.</p></div><p>You should set these variables (and do whatever other
7432 customization you see fit) in the file <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> in the build
7433 directory before building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
7434 Alternatively, after building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, or if you are using a binary
7435 distribution of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, you can modify <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>, compile and load
7436 it, and then save the <a href="impnotes.html#image" class="olink">memory image</a>.
7437 Finally, you can create an <a href="clisp.html#opt-norc" class="olink">RC file</a> which is loaded whenever <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7438 is started.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="code-walk"></a>31.13. Code Walker</h2></div></div></div><p>You can use function <a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> to expand all the macros,
7439 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s, etc, in a single form:
7440 </p><pre class="programlisting">
7441 (<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(macrolet ((bar (x) `(print ,x)))
7442 (macrolet ((baz (x) `(bar ,x)))
7443 (symbol-macrolet ((z 3))
7444 (baz z)))))
7445 ⇒ <code class="computeroutput">(locally (print 3))</code> <strong> ; </strong><em class="lineannotation"><span class="lineannotation">the expansion</span></em>
7446 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> <strong> ; </strong><em class="lineannotation"><span class="lineannotation">indicator: some expansion has actually been done</span></em>
7447 </pre><p>This is sometimes called a <span class="quote">“<span class="quote">code walker</span>”</span>,
7448 except that a code walker would probably leave the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a> and
7449 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a> forms intact and just do the expansion.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Function <a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> is the exported part of the
7450 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> interpreter (AKA <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>), so it expands forms by assuming the
7451 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> situation <code class="constant">:EXECUTE</code> and is therefore
7452 unsuitable for forms that may later be passed to the compiler:
7453 </p><pre class="programlisting">
7454 (<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (:COMPILE-TOPLEVEL) (foo)))
7455 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
7456 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
7457 (<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (:LOAD-TOPLEVEL) (foo)))
7458 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
7459 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
7460 </pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-platform"></a>Chapter 32. Platform Specific Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dd><dl><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></dd><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt><dd><dl><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></dd><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dd><dl><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></dd><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></dd><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></dd><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dd><dl><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></dd><dt><span class="section"><a href="#os-env">32.8. Operating System Environment</a></span></dt><dd><dl><dt><span class="section"><a href="#os">32.8.1. Operating System Identification</a></span></dt><dt><span class="section"><a href="#getenv">32.8.2. Environment Variables</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="screen"></a>32.1. Random Screen Access</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">SCREEN:MAKE-WINDOW</code>)</code></span></dt><dd>returns a <span class="type">WINDOW-STREAM</span>.
7461 As long as this stream is open, the terminal is in cbreak/noecho mode.
7462 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> should not be used for input or output during this
7463 time. (Use <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> and <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> instead.)
7464 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WITH-WINDOW</code> .
7465 <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>binds
7466 <strong class="first"><em class="firstterm"><a class="link" href="#screen" title="32.1. Random Screen Access"><code class="varname">SCREEN:*WINDOW*</code></a><a id="scr-win" class="indexterm"></a></em></strong>
7467 to a <span class="type">WINDOW-STREAM</span> and executes <em class="replaceable"><code>body</code></em>.
7468 The stream is guaranteed to be closed when the body is left.
7469 During its execution, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> should not be used, as above.
7470 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-SIZE</code>
7471 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>returns the window's size, as two values:
7472 height (= y<sub>max</sub>+1) and width (= x<sub>max</sub>+1).
7473 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-POSITION</code>
7474 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>returns the position of the cursor in the window,
7475 as two values: line (≥0, ≤y<sub>max</sub>, 0 means top), column
7476 (≥0, ≤x<sub>max</sub>, 0 means left margin).
7477 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:SET-WINDOW-CURSOR-POSITION</code>
7478 <em class="replaceable"><code>window-stream</code></em> <em class="replaceable"><code>line</code></em> <em class="replaceable"><code>column</code></em>)</code></span></dt><dd>sets the position of the cursor in the window.
7479 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW</code>
7480 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents and puts the cursor
7481 in the upper left corner.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW-TO-EOT</code>
7482 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents from the cursor
7483 position to the end of window.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW-TO-EOL</code>
7484 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents from the cursor
7485 position to the end of line.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:DELETE-WINDOW-LINE</code>
7486 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>removes the cursor's line, moves the lines below
7487 it up by one line and clears the window's last line.
7488 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:INSERT-WINDOW-LINE</code>
7489 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>inserts a line at the cursor's line, moving the
7490 lines below it down by one line.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:HIGHLIGHT-ON</code>
7491 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>switches highlighted output on.
7492 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:HIGHLIGHT-OFF</code>
7493 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>switches highlighted output off.
7494 </dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-ON</code>
7495 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>makes the cursor visible, a cursor block in most
7496 implementations.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-OFF</code>
7497 <em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>makes the cursor invisible, in implementations
7498 where this is possible.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="modules"></a>32.2. External Modules</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dd><dl><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></dd><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt><dd><dl><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-win32"></a>Modules on <span class="platform">Win32</span></h3><p>Everything described in the section will work verbatim on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
7499 when using <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> or <a class="ulink" href="http://www.mingw.org/" target="_top"><span class="platform">MinGW</span></a>, <span class="emphasis"><em>except</em></span> for one
7500 thing - you will need to replace the <code class="filename">run</code>
7501 extension in <code class="filename">lisp.run</code> with the <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> executable
7502 extension <code class="filename">exe</code>.</p><p>For historical reasons, all examples appear to assume <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and
7503 use the <code class="filename">run</code> file type (<span class="quote">“<span class="quote">extension</span>”</span>)
7504 for the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="clisp.html#runtime" class="olink">runtime</a>.
7505 This does <span class="strong"><strong>not</strong></span> mean that they will not work on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-overview"></a>32.2.1. Overview</h3></div></div></div><p><span class="emphasis"><em>External modules</em></span> are a mechanism to add
7506 extensions (written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, for example) to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
7507 Extending <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using an external module requires creating a <a href="impnotes.html#modset" class="olink">module set</a>
7508 and adding it to an existing <a href="impnotes.html#linkset" class="olink">linking set</a> using <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to prodice a
7509 new <a href="impnotes.html#linkset" class="olink">linking set</a> which contains the extension. </p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="modset"></a>Module Set</h4></div></div></div><p>A <strong class="first"><em class="firstterm">module<a id="module" class="indexterm"></a></em></strong> is a piece of code
7510 (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> or Lisp) which defines extra (non-core) Lisp objects, symbols
7511 and functions. Together with <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>, which describes how to add the
7512 module to an existing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, it comprises a <a href="impnotes.html#modset" class="olink">module set</a>.</p><p>More formally,
7513 <strong class="first"><em class="firstterm"><a href="impnotes.html#modset" class="olink">module set</a><a id="modseti" class="indexterm"></a></em></strong>
7514 is a directory containing:
7515 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></span></dt><dd>some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> commands, which prepare the directory
7516 for linking, and set some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s, see <a class="xref" href="#mod-vars" title="Module set variables">the section called “Module set variables”</a>
7517 </dd><dt><span class="term">all other files that define the module functionality</span></dt><dd>needed by <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></dd></dl></div><p>In <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a> the <a href="impnotes.html#modset" class="olink">module set</a> directory is referred to
7518 as <code class="varname">$modulename/</code>.</p><p>A module <strong class="first"><em class="firstterm">name<a id="module-name" class="indexterm"></a></em></strong>
7519 must consist of the characters <code class="filename">A</code>-<code class="filename">Z</code>,
7520 <code class="filename">a</code>-<code class="filename">z</code>, <code class="filename">_</code>,
7521 <code class="filename">0</code>-<code class="filename">9</code>.</p><p>The module name <span class="quote">“<span class="quote">clisp</span>”</span> is reserved.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="linkset"></a>Linking Set</h4></div></div></div><p>A <strong class="first"><em class="firstterm"><a href="impnotes.html#linkset" class="olink">linking set</a><a id="linkseti" class="indexterm"></a></em></strong>
7522 is a collection of files (<a href="clisp.html#runtime" class="olink">runtime</a>, <a href="impnotes.html#image" class="olink">memory image</a> &amp;c) which allows
7523 performing two major tasks:
7524 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>: to run a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7525 contained in some <a href="impnotes.html#linkset" class="olink">linking set</a> <em class="replaceable"><code>directory</code></em>, call</p><pre class="screen">
7526 <strong><code class="prompt">$</code></strong> <em class="replaceable"><code>directory</code></em>/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> <em class="replaceable"><code>directory</code></em>/lispinit.mem</pre><p>
7527 or </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> <em class="replaceable"><code>directory</code></em></pre><p>
7528 (recommended, since it also passes
7529 <code class="option"><a href="clisp.html#opt-libdir" class="olink">-B</a></code>
7530 to the <a href="clisp.html#runtime" class="olink">runtime</a>).</p></li><li class="listitem">Adding a <a href="impnotes.html#modset" class="olink">module set</a> to create a new <a href="impnotes.html#linkset" class="olink">linking set</a> which
7531 will contain the module functionality.</li></ol></div><p>
7532 The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build directory contains three <a href="impnotes.html#linkset" class="olink">linking set</a>s in
7533 directories <span class="command"><strong>boot</strong></span>, <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a>, and <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a>, and a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7534 installation normally contains two <a href="impnotes.html#linkset" class="olink">linking set</a>s: <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a>, and <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a></p><p>More formally, a <a href="impnotes.html#linkset" class="olink">linking set</a> is a directory containing at least
7535 these files:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">lisp.run</code></span></dt><dd>the executable <a href="clisp.html#runtime" class="olink">runtime</a></dd><dt><span class="term"><a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a></span></dt><dd>the <a href="impnotes.html#image" class="olink">memory image</a></dd><dt><span class="term"><code class="filename">modules.h</code></span></dt><dd>the list of modules contained in this <a href="impnotes.html#linkset" class="olink">linking set</a>
7536 </dd><dt><span class="term"><code class="filename">modules.o</code></span></dt><dd>the compiled list of modules contained in this <a href="impnotes.html#linkset" class="olink">linking set</a>
7537 </dd><dt><a id="makevars"></a><span class="term"><code class="filename">makevars</code></span></dt><dd><p>some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> commands, setting the variables
7538 </p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><code class="envar">CC</code></span></p></td><td>the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler
7539 </td></tr><tr><td><p><span class="term"><code class="envar">CPPFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when preprocessing
7540 or compiling</td></tr><tr><td><p><span class="term"><code class="envar">CFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when compiling or
7541 linking</td></tr><tr><td><p><span class="term"><code class="envar">LDFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when linking
7542 </td></tr><tr><td><p><span class="term"><code class="envar">LIBS</code></span></p></td><td>libraries to use when linking (either present in
7543 the <a href="impnotes.html#linkset" class="olink">linking set</a> directory, or system-wide)
7544 </td></tr><tr><td><p><span class="term"><code class="envar">X_LIBS</code></span></p></td><td>additional <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a> libraries to use
7545 </td></tr><tr><td><p><span class="term"><code class="envar">RANLIB</code></span></p></td><td>the ranlib command
7546 </td></tr><tr><td><p><span class="term"><code class="envar">FILES</code></span></p></td><td>the list of files needed when linking
7547 </td></tr></tbody></table></div></dd><dt><span class="term">all the <code class="envar">FILES</code></span></dt><dd>listed in <code class="filename">makevars</code>
7548 </dd></dl></div></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="clisp-link"></a>Manipulating <a href="impnotes.html#modset" class="olink">module set</a>s and <a href="impnotes.html#linkset" class="olink">linking set</a>s</h4></div></div></div><p>Use <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to create and install <a href="impnotes.html#modset" class="olink">module set</a>s
7549 and add them to <a href="impnotes.html#linkset" class="olink">linking set</a>s.</p><p>See also <a class="xref" href="#mod-set-example" title="32.2.6. Example">Section 32.2.6, “Example”</a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="mod-vars"></a>Module set variables</h4></div></div></div><p>The following variables should be defined in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">NEW_FILES</code></span></dt><dd>the space-separated list of object files that
7550 belong to the <a href="impnotes.html#modset" class="olink">module set</a> and will belong to every new <a href="impnotes.html#linkset" class="olink">linking set</a> linked
7551 with this <a href="impnotes.html#modset" class="olink">module set</a>.</dd><dt><span class="term"><code class="envar">NEW_LIBS</code></span></dt><dd>the space-separated list of object files, libraries or
7552 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler switches that need to be passed to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
7553 compiler when linking the <code class="filename">lisp.run</code> belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
7554 </dd><dt><span class="term"><code class="envar">NEW_MODULES</code></span></dt><dd>the space-separated list of the module names
7555 belonging to the <a href="impnotes.html#modset" class="olink">module set</a>. Normally, every <code class="filename">#P".c"</code> file in the
7556 <a href="impnotes.html#modset" class="olink">module set</a> defines a module of its own. The module name is usually
7557 derived from the file name.</dd><dt><a id="mod-load"></a><span class="term"><a class="link" href="#mod-load"><code class="envar">TO_LOAD</code></a></span></dt><dd>the space-separated list of Lisp files to load
7558 before building the <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
7559 </dd><dt><a id="mod-preload"></a><span class="term"><a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a> (optional)</span></dt><dd><p class="simpara">the space-separated list of Lisp files to load
7560 into an intermediate <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> file, before building the <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a>
7561 belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
7562 This variable is usually used to <a class="link" href="#make-pack" title="11.1.1. Function MAKE-PACKAGE">create</a>
7563 (or <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2">unlock</a>) the Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s which
7564 must be present when the new <code class="filename">#P".c"</code> files are initialized.
7565 E.g., the <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> functions must reside in already defined packages;
7566 see <a class="xref" href="#ex-call-in" title="Example 32.7. Calling Lisp from C">Example 32.7, “Calling Lisp from <span class="command"><strong>C</strong></span>”</a>. You can find a live example in
7567 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/syscalls/preload.lisp"><code class="filename">modules/syscalls/preload.lisp</code></a>
7568 and <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/syscalls/link.sh.in"><code class="filename">modules/syscalls/link.sh.in</code></a>.
7569 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you are unlocking a package, you must also
7570 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a> it from <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a> (see <a class="xref" href="#image" title="31.2. Saving an Image">Section 31.2, “Saving an Image”</a>) here
7571 and re-add it to <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a> in one of the <a class="link" href="#mod-load"><code class="envar">TO_LOAD</code></a> files.
7572 See, e.g., <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/i18n/preload.lisp"><code class="filename">modules/i18n/preload.lisp</code></a>
7573 and <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/i18n/link.sh.in"><code class="filename">modules/i18n/link.sh.in</code></a>.
7574 </p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modinit"></a>32.2.2. Module initialization</h3></div></div></div><p>Each module has two initialization functions:
7575 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">void
7576 <code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_1</code>
7577 (struct module_t* module)</span></dt><dd><p class="simpara">called only <span class="emphasis"><em>once</em></span> when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7578 discovers while loading a <a href="impnotes.html#image" class="olink">memory image</a> that there is a module present
7579 in the executable (<code class="filename">lisp.run</code>) which was not present at the time the
7580 image was saved. It can be used to create Lisp objects,
7581 e.g. functions or keywords, and is indeed used for that purpose by
7582 <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
7583 <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :init-once ...)</code>
7584 will add code to this function.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s must already exist and be unlocked,
7585 cf. <a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you are using <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> <span class="strong"><strong>and</strong></span> defining your
7586 own <span class="quote">“<span class="quote">init-once</span>”</span> function, it must call the
7587 <code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_1__modprep</code>
7588 function!</p></div></dd><dt><span class="term">void <code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_2</code>
7589 (struct module_t* module)</span></dt><dd><p class="simpara">called <span class="emphasis"><em>every time</em></span> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> starts.
7590 It can be used to bind names to foreign addresses, since the address
7591 will be different in each invocation of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, and is indeed used
7592 for that purpose by <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> (e.g., by <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>).
7593 It can also be used to set parameters of the libraries to which the
7594 module interfaces, e.g., the <span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span> module
7595 sets <code class="varname">pcre_malloc</code> and <code class="varname">pcre_free</code>.
7596 </p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
7597 <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :init-always ...)</code>
7598 will add code to this function.</p></dd></dl></div><p>
7599 <em class="replaceable"><code>name</code></em> is the <a class="link" href="#mod-overview" title="32.2.1. Overview">module name</a>.</p><p>See also <a class="xref" href="#custom-init-fini" title="31.1. Customizing CLISP Process Initialization and Termination">Section 31.1, “Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modfini"></a>32.2.3. Module finalization</h3></div></div></div><p>Each module has a finalization function
7600 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">void
7601 <code class="function">module__<em class="replaceable"><code>name</code></em>__fini_function</code>
7602 (struct module_t* module)</span></dt><dd><p class="simpara">called before exiting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
7603 <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :fini ...)</code> will
7604 add code to this function.</p></dd></dl></div><p>
7605 <em class="replaceable"><code>name</code></em> is the <a class="link" href="#mod-overview" title="32.2.1. Overview">module name</a>.</p><p>See also <a class="xref" href="#custom-init-fini" title="31.1. Customizing CLISP Process Initialization and Termination">Section 31.1, “Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modinfo"></a>32.2.4. Function <a class="link" href="#modinfo" title="32.2.4. Function EXT:MODULE-INFO"><code class="function">EXT:MODULE-INFO</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#modinfo" title="32.2.4. Function EXT:MODULE-INFO"><code class="function">EXT:MODULE-INFO</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>name</code></em>
7606 <em class="replaceable"><code>verbose</code></em>)</code> allows one to inquire
7607 about what modules are available in the currently running image.
7608 When called without arguments, it returns the list of module names,
7609 starting with <span class="quote">“<span class="quote">clisp</span>”</span>. When <em class="replaceable"><code>name</code></em> is supplied and
7610 names a module, 3 values are returned - <em class="replaceable"><code>name</code></em>,
7611 <em class="replaceable"><code>subr-count</code></em>,
7612 <em class="replaceable"><code>object-count</code></em>.
7613 When <em class="replaceable"><code>verbose</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the full list of
7614 module lisp function names written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> (<span class="type">Subr</span>s) and
7615 the full list of internal lisp objects available in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
7616 are additionally returned for the total of 5 values.</p><p>When <em class="replaceable"><code>name</code></em> is <code class="constant">:FFI</code>, returns the list of
7617 shared libraries opened using <code class="constant">:LIBRARY</code>.
7618 When <em class="replaceable"><code>verbose</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return the
7619 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of DLL names and all foreign objects associated with it.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-dynload"></a>32.2.5. Dynamic module loading</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Dynamic loading does not work on all operating systems
7620 (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> or equivalent is required).</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You will probably never need to call the function <a href="impnotes.html#mod-dynload" class="olink"><code class="function">SYS::DYNLOAD-MODULES</code></a>
7621 explicitly (this is why it is in <a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a> and not in <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>).
7622 You should install your module with
7623 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> <code class="option"><a href="clisp-link.html#opt-install" class="olink">install</a></code> <em class="replaceable"><code>name</code></em></pre><p>
7624 and load it with <code class="code">(<a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> <em class="replaceable"><code>name</code></em>).</code></p></div><p>Function <code class="code">(<a href="impnotes.html#mod-dynload" class="olink"><code class="function">SYS::DYNLOAD-MODULES</code></a> <em class="replaceable"><code>filename</code></em> ({<em class="replaceable"><code>name</code></em>}+))</code>
7625 loads a shared object file or library containing a number of named
7626 external <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> modules.
7627 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This facility <span class="strong"><strong>cannot</strong></span> be used to
7628 access arbitrary shared libraries. To do that, use the <code class="constant">:LIBRARY</code>
7629 argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> instead.</p></div><p>
7630 </p><p>External modules for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> are shared objects
7631 (dynamic libraries) that contain the
7632 <code class="literal">module__<em class="replaceable"><code>name</code></em>__subr_tab</code> variable, among others.
7633 This serves to register external functions which operate on Lisp-level
7634 structures with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p>To use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> with modules, you should add
7635 <a class="ulink" href="http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html" target="_top"><code class="option">-fPIC</code></a> to the module's compilation options.
7636 Something like
7637 </p><pre class="screen"><strong><code class="prompt">$</code></strong> cc -shared -o <em class="replaceable"><code>name</code></em>.so <em class="replaceable"><code>name</code></em>.o</pre><p>
7638 may be needed to produce the shared object file.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-set-example"></a>32.2.6. Example</h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt></dl></div><div class="example"><a id="mod-set-ex-bindings"></a><p class="title"><strong>Example 32.1. Create a <a href="impnotes.html#modset" class="olink">module set</a> with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a> bindings</strong></p><div class="example-contents"><p>To link in the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> bindings for the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> operating
7639 system, the following steps are needed. (Step 1 and step 2 need not be
7640 executed in this order.)</p><div class="procedure"><ol class="procedure" type="1"><li class="step"><p class="title"><strong>Create a new <a href="impnotes.html#modset" class="olink">module set</a></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create linux /<em class="replaceable"><code>pathname</code></em>/bindings/linux.c</pre></li><li class="step"><p class="title"><strong>Modify the newly created
7641 <code class="filename">linux/<a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></code></strong></p><ol type="a" class="substeps"><li class="step"><p class="title"><strong>add <code class="option">-lm</code> to the libraries</strong></p><p>replace </p><pre class="screen">NEW_LIBS="$file_list"</pre><p>
7642 with </p><pre class="screen">NEW_LIBS="$file_list -lm"</pre></li><li class="step"><p class="title"><strong>load <code class="filename">linux.fas</code> before saving the
7643 <a href="impnotes.html#image" class="olink">memory image</a></strong></p><p>replace </p><pre class="screen">TO_LOAD=''</pre><p> with
7644 </p><pre class="screen">TO_LOAD='/<em class="replaceable"><code>pathname</code></em>/bindings/linux.fas'</pre></li></ol></li><li class="step"><p class="title"><strong>Compile <code class="filename">linux.lisp</code>, creating
7645 <code class="filename">linux.c</code></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> /<em class="replaceable"><code>pathname</code></em>/bindings/linux.lisp</pre></li><li class="step"><p class="title"><strong>Create a new <a href="impnotes.html#linkset" class="olink">linking set</a></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+linux linux</pre></li><li class="step"><p class="title"><strong>Run and try it</strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> base+linux/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+linux/lispinit.mem <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(linux:stat "/tmp")'</pre></li></ol></div></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="module-tools"></a>32.2.7. Module tools</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></div><p>There are some tools to facilitate easy module writing.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="modprep"></a>32.2.7.1. Modprep</h4></div></div></div><p>If your module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you can pre-process your
7646 sources with <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> distribution and define lisp
7647 functions with the <code class="function">DEFUN</code> macro:
7648 </p><pre class="programlisting">
7649 DEFUN(MY-PACKAGE:MY-FUNCTION-NAME, arg1 arg2 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> FOO BAR) {
7650 if (!boundp(STACK_0)) STACK_0 = fixnum(0); /* BAR */
7651 if (!boundp(STACK_1)) STACK_1 = fixnum(1); /* FOO */
7652 pushSTACK(`MY-PACKAGE::SOME-SYMBOL`); /* create a symbol in the package */
7653 pushSTACK(`#(:THIS :IS :A :VECTOR)`); /* some vector, created once */
7654 pushSTACK(``MY-PACKAGE::MY-FUNCTION-NAME``); /* double `` means FUNCTION */
7655 VALUES1(listof(7)); /* cons up a new list and clean up the STACK */
7656 }</pre><p>
7657 Then <code class="code">(MY-PACKAGE:MY-FUNCTION-NAME 'A 12 :FOO T)</code> will
7658 return <span class="returnvalue">(A 12 T 0 MY-PACKAGE::SOME-SYMBOL #(:THIS
7659 :IS :A :VECTOR) #&lt;ADD-ON-SYSTEM-FUNCTION
7660 MY-PACKAGE:MY-FUNCTION-NAME&gt;)</span>
7661 (assuming you <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed <code class="literal">MY-FUNCTION-NAME</code> from
7662 <strong class="package"><span class="quote">“<span class="quote">MY-PACKAGE</span>”</span></strong>).</p><p>Note that the arguments are passed on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> (last argument
7663 being the top) which has to be cleaned up before exit.</p><p>Another useful macros are:
7664 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">DEFVAR</code></span></dt><dd>create a GC-visible private object
7665 </dd><dt><span class="term"><code class="function">DEFFLAGSET</code></span></dt><dd>define a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function which will remove
7666 several flag arguments from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and return the combined flag
7667 value</dd><dt><span class="term"><code class="function">DEFCHECKER</code></span></dt><dd>define a map from <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> constants to lisp symbols and
7668 functions that map between them, checking that the argument is appropriate
7669 </dd></dl></div><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/syscalls/calls.c"><code class="filename">modules/syscalls/calls.c</code></a>
7670 and other included modules for more examples and file <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> for full
7671 documentation.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you manipulate Lisp objects, you need to watch out for
7672 <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="clisp-h"></a>32.2.7.2. clisp.h</h4></div></div></div><p>If your module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you will probably want
7673 to <code class="literal">#include "clisp.h"</code> to access <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects.
7674 You will certainly need to read <a href="impnotes.html#clisp-h" class="olink"><code class="filename">"clisp.h"</code></a> and some code in
7675 <a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">included modules</a>, but here are
7676 some important hints that you will need to keep in mind:
7677 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Lisp objects have type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>.</li><li class="listitem">Variables of this type are invalidated by
7678 <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">lisp memory allocation</a>
7679 (<code class="function">allocate_*()</code> functions) - but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
7680 allocations (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> et al) - and must be saved on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> using <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>
7681 macros <code class="function">pushSTACK()</code>, <code class="function">popSTACK()</code>
7682 and <code class="function">skipSTACK()</code>.</li><li class="listitem">Access object slots using the
7683 appropriate <code class="function">TheFoo()</code> macro, e.g.,
7684 <code class="function">TheCons(my_cons)-&gt;Car</code>, but first check the
7685 type with <code class="function">consp()</code>.</li><li class="listitem">Arguments are passed on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, as illustrated
7686 in the <a class="link" href="#modprep" title="32.2.7.1. Modprep">above example</a>.</li><li class="listitem"><p class="simpara">Wrap your system calls in
7687 <code class="literal">begin_system_call()</code>/<code class="literal">end_system_call()</code>
7688 pairs. These macros, defined in <a href="impnotes.html#clisp-h" class="olink"><code class="filename">"clisp.h"</code></a>, save and restore
7689 registers used by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> which could be clobbered by a system call.
7690 </p><p class="simpara">If the system call could block (e.g., <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>)
7691 you need to use <code class="literal">begin_blocking_system_call()</code> and
7692 <code class="literal">end_blocking_system_call()</code> instead. This will
7693 allow other threads to run while yours is inside the system call.
7694 This means that <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion could happen while you are inside this system
7695 call and, thus, that all objects of type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> are
7696 invalidated by the call. See also <a class="xref" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">Section 35.5, “The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span>”</a> and
7697 <a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p></li></ul></div><p>
7698 </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="exporting"></a>32.2.7.3. Exporting</h4></div></div></div><p>If your module uses <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> to interface to a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library,
7699 you might want to make your module package <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> and use
7700 <a class="link" href="#exporting-lisp"><code class="filename">exporting.lisp</code></a> in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> distribution to make <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms
7701 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> at al export the symbols they define.
7702 See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/netica/"><code class="filename">modules/netica/</code></a>,
7703 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/matlab/"><code class="filename">modules/matlab/</code></a> and
7704 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/"><code class="filename">modules/bindings/</code></a> for examples.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-ffi-vs-c"></a>32.2.8. Trade-offs: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> vs. <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
7705 modules</h3></div></div></div><p>When deciding how to write a module: whether to use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> or
7706 to stick with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> and <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>, one has to take into account
7707 several issues: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Speed: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd><p><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> has a noticeable overhead:
7708 compare <code class="function">RAWSOCK:HTONS</code> (defined
7709 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a>)
7710 with </p><pre class="programlisting">
7711 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> htons (<code class="constant">:NAME</code> "htons") (<code class="constant">:LIBRARY</code> :default)
7712 (<code class="constant">:ARGUMENTS</code> (s ffi:short)) (<code class="constant">:RETURN-TYPE</code> ffi:short) (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
7713 </pre><p> and observe that <code class="function">RAWSOCK:HTONS</code> is
7714 almost 3 times as fast (this really does compare the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>
7715 overhead to the normal lisp function call because
7716 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html"><code class="function">htons</code></a> is computationally trivial).
7717 This difference will matter only if you call a simple function very
7718 many times, in which case it would make sense to put the loop itself
7719 into <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p></dd><dt><span class="term">Portability: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> is <span class="strong"><strong>not</strong></span> as widely
7720 ported as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, so it is possible that you will face a platform
7721 where <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> runs but <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> is not present.</li><li class="listitem">It is much easier to handle portability in
7722 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>: observe the alternative implementations
7723 of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html"><code class="function">htonl</code></a> et al in
7724 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a>.
7725 </li><li class="listitem">Certain <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> structures have different
7726 layout on different platforms, and functions may take 64-bit
7727 arguments on some platforms and 32-bit arguments on others; so the
7728 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> code has to track those differences, while <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> will
7729 mostly take care of these things for you.</li></ol></div></dd><dt><span class="term">Code size: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> wins</span></dt><dd>You need to type much fewer characters with <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>,
7730 and, if you use the <code class="constant">:LIBRARY</code> argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and
7731 <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>, you do not need to leave your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session to try
7732 out your code. This is a huge advantage for rapid prototyping.
7733 </dd><dt><span class="term">UI: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd>To produce a nice lispy UI (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> and
7734 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>word arguments etc), you will need to write wrappers to your
7735 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s, while in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> you can do that directly.
7736 The same goes for <span class="quote">“<span class="quote">polymorphism</span>”</span>: accepting different
7737 argument types (like, e.g., <a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a> does) would require a lisp
7738 wrapper for <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s.
7739 </dd><dt><span class="term">Learning curve: unclear</span></dt><dd><p class="simpara">If you are comfortable with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you might
7740 find the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> module facilities (e.g., <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>) very
7741 easy to use.</p><p class="simpara"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, on the other hand, is quite high-level,
7742 so, if you are more comfortable with high-level languages, you might
7743 find it easier to write <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms than <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
7744 </p></dd><dt><span class="term">Safety: unclear</span></dt><dd>One can get a segfault either way: if your
7745 <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> form does not describe the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function's
7746 expectations with respect to the arguments and return values
7747 (including <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>), you will probably learn that the hard way.
7748 If the module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, all the opportunities to shoot
7749 oneself in the foot (and other body parts) are wide open
7750 (although well known to most <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> users).
7751 However, with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, one has to watch
7752 for <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a> too.
7753 </dd><dt><span class="term">System requirements: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> wins</span></dt><dd><p>Some <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> distributions offer separate
7754 <span class="emphasis"><em>library</em></span> (containing shared libraries only)
7755 and <span class="emphasis"><em>development</em></span> (containing static libraries and
7756 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> headers) packages.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When <span class="emphasis"><em>developing</em></span> using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>
7757 with <code class="constant">:LIBRARY</code> (and avoiding <a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a>), the
7758 <span class="emphasis"><em>development</em></span> package is <span class="strong"><strong>not</strong></span> needed.
7759 </li><li class="listitem">When <span class="emphasis"><em>developing</em></span> with <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>,
7760 the <span class="emphasis"><em>development</em></span> package <span class="strong"><strong>is</strong></span> necessary.
7761 </li><li class="listitem">When <span class="emphasis"><em>distributing</em></span> module (built
7762 with either <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> or <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>), only the <span class="emphasis"><em>library</em></span>
7763 package is needed.</li></ul></div></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-ffi-vs-c-granularity"></a>Note</h3><p>The granularity of the
7764 choice is <span class="emphasis"><em>per function</em></span>: the same module can use
7765 both <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-ffi-vs-c-naming"></a>Note</h3><p>It is not a good idea to have
7766 both <code class="filename">foo.lisp</code> and <code class="filename">foo.c</code>
7767 files in a module, because if you ever add an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> form to the
7768 former, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> will
7769 <a class="link" href="#c-file-overwrite" title="Warning">overwrite</a> the latter.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="included-modules"></a>32.2.9. Modules included in the source distribution</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></div><p>A few modules come with the <span class="emphasis"><em>source</em></span>
7770 distribution of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> (but are not necessarily built in a
7771 particular <span class="emphasis"><em>binary</em></span> distribution).</p><p>To use modules, read <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/unix/INSTALL"><code class="filename">unix/INSTALL</code></a>
7772 and build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> in a directory <code class="filename">build-dir</code> with,
7773 e.g.,</p><pre class="screen">
7774 <strong><code class="prompt">$</code></strong> ./configure --with-module=pcre --with-module=clx/new-clx --cbc build-dir</pre><p> then run it with
7775 </p><pre class="screen"><strong><code class="prompt">$</code></strong> ./build-dir/clisp <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full</pre><p>
7776 This will create a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> with modules
7777 <span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span>, <span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span> and <span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span> (and maybe <span class="module"><a class="filename" href="#readline-mod" title="33.5. Advanced Readline and History Functionality"><code class="filename">readline</code></a></span>);
7778 and a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> with modules <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> and <span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span> in addition
7779 to the 3 (or 4) <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> modules.</p><p>Here we list the included modules by their general theme.
7780 See <a class="xref" href="#ext-modules" title="Chapter 33. Extensions Implemented as Modules">Chapter 33, <em>Extensions Implemented as Modules</em></a> for individual module documentation.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="base-modules"></a>32.2.9.1. Base Modules</h4></div></div></div><p>The default build process includes the following modules
7781 in <span class="strong"><strong>both</strong></span> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <span class="strong"><strong>and</strong></span> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>s:
7782 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span></span></dt><dd>Internationalization of User Programs.
7783 </dd><dt><span class="term"><span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span></span></dt><dd>The <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> <a class="ulink" href="regexp.html" target="_top">Regular
7784 Expressions</a> matching, compiling, executing.
7785 </dd><dt><span class="term"><span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span></span></dt><dd>Use some system calls in a platform-independent way.
7786 </dd><dt><span class="term"><span class="module"><a class="filename" href="#readline-mod" title="33.5. Advanced Readline and History Functionality"><code class="filename">readline</code></a></span> (only when <span class="strong"><strong>both</strong></span> <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and
7787 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> are available)</span></dt><dd>Some advanced readline and history features are exported
7788 using this module.</dd></dl></div><p>The composition of the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> depends on the platform
7789 and on the vendor preferences.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-db"></a>32.2.9.2. Database, Directory et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#gdbm" title="33.6. GDBM - The GNU database manager"><code class="filename">gdbm</code></a></span></span></dt><dd>Interface to <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gdbm/" target="_top">DataBase Manager</a> by
7790 <span class="author"><span class="firstname">Masayuki</span> <span class="surname">Onjo</span></span>.
7791 </dd><dt><span class="term"><span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span></span></dt><dd><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/index.html">Berkeley DB</a>
7792 interface.</dd><dt><span class="term"><span class="module"><a class="filename" href="#dir-key" title="33.8. Directory Access"><code class="filename">dirkey</code></a></span></span></dt><dd>Directory Access (LDAP, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> registry etc).
7793 </dd><dt><span class="term"><span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span></span></dt><dd>Access <a class="ulink" href="http://www.PostgreSQL.org/" target="_top">PostgreSQL</a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
7794 </dd><dt><span class="term"><span class="module"><a class="filename" href="#oracle" title="33.10. Oracle Interface"><code class="filename">oracle</code></a></span></span></dt><dd>Access <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> RDBMS from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>; by <span class="author"><span class="firstname">John</span> <span class="surname">Hinsdale</span></span>.
7795 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-kdml"></a>32.2.9.3. Mathematics, Data Mining et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span></span></dt><dd>Build
7796 <a class="ulink" href="http://www.support-vector-machines.org/" target="_top">Support
7797 Vector Machine</a> models using <a class="ulink" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/" target="_top">LibSVM</a> inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
7798 </dd><dt><span class="term"><span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span></span></dt><dd>Interface to the computer algebra system <a class="ulink" href="http://pari.math.u-bordeaux.fr/" target="_top">PARI</a>.
7799 </dd><dt><span class="term"><span class="module"><a class="filename" href="#matlab" title="33.13. Matlab Interface"><code class="filename">matlab</code></a></span></span></dt><dd>Do matrix computations via
7800 <a class="ulink" href="http://www.mathworks.com/products/matlab/" target="_top">MATLAB</a>.
7801 </dd><dt><span class="term"><span class="module"><a class="filename" href="#netica" title="33.14. Netica Interface"><code class="filename">netica</code></a></span></span></dt><dd>Work with Bayesian belief networks and influence
7802 diagrams using <a class="ulink" href="http://norsys.com/netica_c_api.htm" target="_top">Netica C API</a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-match"></a>32.2.9.4. Matching, File Processing et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span></span></dt><dd>The <a class="ulink" href="http://www.pcre.org/" target="_top">Perl Compatible Regular Expressions</a> matching, compiling, executing.
7803 </dd><dt><span class="term"><span class="module"><a class="filename" href="#zlib" title="33.16. Interface to zlib"><code class="filename">zlib</code></a></span></span></dt><dd>Compress <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s using <a class="ulink" href="http://zlib.net" target="_top">ZLIB</a>.
7804 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-net"></a>32.2.9.5. Communication, Networking</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span></span></dt><dd>Raw socket access.</dd><dt><span class="term"><span class="module"><a class="filename" href="#dbus" title="33.19. Interface to D-Bus"><code class="filename">dbus</code></a></span></span></dt><dd>Interface to <a class="ulink" href="http://www.freedesktop.org/wiki/Software/dbus" target="_top">D-Bus</a>.
7805 </dd><dt><span class="term"><span class="module"><a class="filename" href="#fastcgi" title="33.18. The FastCGI Interface"><code class="filename">fastcgi</code></a></span></span></dt><dd>Access <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>;
7806 by <span class="author"><span class="firstname">John</span> <span class="surname">Hinsdale</span></span>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-gui"></a>32.2.9.6. Graphics</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="https://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a></span></dt><dd><p>Call
7807 <a class="ulink" href="http://www.x.org/docs/X11/xlib.pdf" target="_top">Xlib</a>
7808 functions from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. Two implementations are supplied:
7809 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span>, from MIT
7810 <a class="ulink" href="https://www.x.org/archive/unsupported/lib/CLX/" target="_top">https://www.x.org/archive/unsupported/lib/CLX/</a></span></dt><dd>the standard implementation
7811 </dd><dt><span class="term"><span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>, by <span class="author"><span class="firstname">Gilbert</span> <span class="surname">Baumann</span></span></span></dt><dd><p>faster, with additional features, but not quite complete yet.
7812 Please try it first and use <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span> only
7813 if <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> does not work for you.
7814 <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> comes with several demos, please try them using
7815 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/clx/new-clx/demos/clx-demos.lisp"><code class="filename">modules/clx/new-clx/demos/clx-demos.lisp</code></a> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(clx-demos:run-all-demos)'</pre><p>
7816 and follow the intructions.</p></dd></dl></div><p>This functionality is documented in the manual
7817 <a class="ulink" href="https://common-lisp.net/project/cmucl/doc/clx/" target="_top">https://common-lisp.net/project/cmucl/doc/clx/</a>, also
7818 available in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source distribution as
7819 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/clx/clx-manual.tar.gz"><code class="filename">modules/clx/clx-manual.tar.gz</code></a>.
7820 </p></dd><dt><span class="term"><span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span></span></dt><dd>Use <a class="ulink" href="https://www.gtk.org" target="_top">GTK+</a> and <a class="ulink" href="https://glade.gnome.org/" target="_top">Glade</a> to create GUI by
7821 <span class="author"><span class="firstname">James</span> <span class="surname">Bailey</span></span>.
7822 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-bind"></a>32.2.9.7. Bindings</h4></div></div></div><p>Call the operating system functions from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
7823 The following platforms are supported:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span></span></dt><dd><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>/<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libc/" target="_top">libc</a></dd><dt><span class="term"><span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/win32/"><code class="filename">bindings/win32</code></a></span></span></dt><dd><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-toys"></a>32.2.9.8. Toys and Games</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/queens/"><code class="filename">queens</code></a></span></span></dt><dd>Compute the number of solutions to the <em class="replaceable"><code>n</code></em>-queens
7824 problem on a <em class="replaceable"><code>n</code></em>×<em class="replaceable"><code>n</code></em> chessboard (a toy
7825 example for the users to explore the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#modules" class="olink">module</a> system).
7826 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/clx/new-clx/demos/sokoban.lisp"><code class="filename">modules/clx/new-clx/demos/sokoban.lisp</code></a></span></dt><dd>a demo which comes with <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>.
7827 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-misc"></a>32.2.9.9. Miscellaneous</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#asdf" title="33.1. A System Definition Facility"><code class="filename">asdf</code></a></span></span></dt><dd>A system definition facility.
7828 </dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dffi"></a>32.3. The Foreign Function Call Facility</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Many <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms
7829 only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></dd><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-intro"></a>32.3.1. Introduction</h3></div></div></div><p>This facility, also known as <span class="quote">“<span class="quote">Foreign Language Interface</span>”</span>,
7830 allows one to call a function implemented in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> from inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7831 and to do many related things, like inspect and modify foreign memory,
7832 define a <span class="quote">“<span class="quote">callback</span>”</span> (i.e., make a lisp function available
7833 to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> world), etc.
7834 To use this facility, one writes a <strong class="first"><em class="firstterm">foreign function
7835 <a id="dffi-ff" class="indexterm"></a></em></strong> description into an
7836 ordinary Lisp file, which is then compiled and loaded as usual;
7837 or just evaluates the appropriate form in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.</p><p>There are two basic ways to do define a foreign function:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">Use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a> to get to the location of the
7838 function code in a dynamic library.
7839 To access this facility, pass the <code class="constant">:LIBRARY</code> option to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
7840 and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>.</p><p class="simpara">Unfortunately, this functionality is not available on some
7841 operating systems, and, also, it offers only a part of the foreign
7842 functionality: <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros and <code class="literal">inline</code> functions
7843 cannot be accessed this way. On the other hand, this functionality
7844 is available in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> and does not require a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler.
7845 </p></li><li class="listitem">Use a somewhat less direct way: when you do not use
7846 the <code class="constant">:LIBRARY</code> argument, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> produces a <code class="filename">#P".c"</code> file
7847 (in addition to a <code class="filename">#P".fas"</code> and a <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a>).
7848 Then you compile (with a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler) and link it into <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
7849 (statically, linking it into <code class="filename">lisp.a</code>, or
7850 dynamically, loading it into a running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a>).
7851 This way you can use any functionality your foreign library exports,
7852 whether using ordinary functions, <code class="literal">inline</code> functions,
7853 or <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros (see <a class="xref" href="#dffi-ex-macro" title="Example 32.6. Accessing cpp macros">Example 32.6, “Accessing <span class="command"><strong>cpp</strong></span> macros”</a>).
7854 </li></ol></div><p>
7855 </p><p>All symbols relating to the foreign function interface are
7856 exported from the package <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
7857 To use them, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>)</code>.</p><p>Special <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms may appear anywhere in the Lisp file.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-overview"></a>32.3.2. Overview</h3></div></div></div><p>These are the special <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms. We have taken a pragmatic
7858 approach: the only foreign languages we support for now are <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
7859 and <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Unless specifically noted otherwise, type specification
7860 parameters are <span class="strong"><strong>not</strong></span> evaluated, so that they can be compiled by
7861 <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> into the internal format at macroexpansion time.
7862 </p></div><div class="variablelist"><p class="title"><strong>High-level <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms; <em class="replaceable"><code>name</code></em> is any Lisp
7863 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>; <em class="replaceable"><code>c-name</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></strong></p><dl class="variablelist"><dt><a id="def-c-type"></a><span class="term"><code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd><p class="simpara">This form makes <em class="replaceable"><code>name</code></em> a shortcut for <em class="replaceable"><code>c-type</code></em>.
7864 Note that <em class="replaceable"><code>c-type</code></em> may already refer to <em class="replaceable"><code>name</code></em>.
7865 Forward declarations of types are not possible, however.</p><p class="simpara">When <em class="replaceable"><code>c-type</code></em> is omitted, the type is assumed to be an
7866 integer, and its size and signedness are determined at link time,
7867 e.g., <code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> size_t)</code>.</p></dd><dt><a id="def-c-var"></a><span class="term"><code class="code">(<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> <em class="replaceable"><code>name</code></em>
7868 {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>.
7869 <em class="replaceable"><code>name</code></em> is the Lisp name, a regular Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>.</p><div class="variablelist"><a id="def-c-var-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>specifies the name as seen from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, as a
7870 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. If not specified, it is derived from the print name of
7871 the Lisp name.</dd><dt><span class="term"><code class="code">(<code class="constant">:TYPE</code> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>specifies the variable's foreign type.
7872 </dd><dt><span class="term"><code class="code">(<code class="constant">:READ-ONLY</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>)</code></span></dt><dd>If this option is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
7873 it will be impossible to change the variable's value from within
7874 Lisp (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> or similar).</dd><dt><span class="term"><code class="code">(:ALLOC <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>)</code></span></dt><dd>This option can be either <code class="constant">:NONE</code> or
7875 <code class="constant">:MALLOC-FREE</code> and defaults to <code class="constant">:NONE</code>.
7876 If it is <code class="constant">:MALLOC-FREE</code>, any values of type <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>, <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>,
7877 <a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>, <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> within the foreign value are assumed
7878 to be pointers to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>-allocated storage, and when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>
7879 replaces an old value by a new one, the old storage is freed using
7880 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> and the new storage allocated using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>.
7881 If it is <code class="constant">:NONE</code>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> assumes that the pointers point to good
7882 storage (not <code class="constant">NULL</code>!) and overwrites the old values by the new ones.
7883 This is dangerous (just think of overwriting a string with a longer
7884 one or storing some data in a <code class="constant">NULL</code> pointer...) and deprecated.
7885 </dd><dt><span class="term"><code class="code">(<code class="constant">:LIBRARY</code> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Specifies the (optional) dynamic library
7886 which contains the variable, the default is set by
7887 <a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:VERSION</code> <em class="replaceable"><code>version</code></em>)</code></span></dt><dd>Specifies the (optional) symbol version in the library
7888 (therefore, if <code class="constant">:VERSION</code> is supplied, <code class="constant">:LIBRARY</code> must also be supplied)
7889 </dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">VARIABLE</code></a> documentation.
7890 </dd></dl></div></dd><dt><a id="def-c-const"></a><span class="term"><code class="code">(<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> <em class="replaceable"><code>name</code></em>
7891 {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p>This form defines a Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a> <em class="replaceable"><code>name</code></em> whose value is
7892 determined at build time using an internal <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.</p><div class="variablelist"><a id="def-c-const-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>specifies the name as seen from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, as a
7893 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. If not specified, it is derived from the print name
7894 of the Lisp name.</dd><dt><span class="term"><code class="code">(<code class="constant">:TYPE</code> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd><p>specifies the constant's foreign type, one of
7895 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><span class="type">FFI:INT</span></td></tr><tr><td><a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a></td></tr><tr><td><a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a></td></tr></table></dd><dt><span class="term"><code class="code">(<code class="constant">:GUARD</code>
7896 <em class="replaceable"><code>string</code></em>)</code></span></dt><dd><p>specifies the <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> check to wrap around <em class="replaceable"><code>c-name</code></em>,
7897 defaults to <span class="data"><code class="literal">"defined(<em class="replaceable"><code>c-name</code></em>)"</code></span>;
7898 can be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> to omit the test. When the test fails, <em class="replaceable"><code>name</code></em> is
7899 unbound.</p></dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">VARIABLE</code></a> documentation.
7900 </dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-ex-macro" title="Example 32.6. Accessing cpp macros">Example 32.6, “Accessing <span class="command"><strong>cpp</strong></span> macros”</a>.</p></dd><dt><a id="def-call-out"></a><span class="term"><code class="code">(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
7901 <em class="replaceable"><code>name</code></em> {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a named call-out function (a
7902 foreign function called from Lisp: control flow temporarily leaves Lisp).
7903 </p><div class="variablelist"><a id="def-call-out-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>Any Lisp function call to <code class="function">#'<em class="replaceable"><code>name</code></em></code>
7904 is redirected to call the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function <em class="replaceable"><code>c-name</code></em>.
7905 </dd><dt><span class="term"><code class="code">(<code class="constant">:ARGUMENTS</code>
7906 {(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)</code><br /></span><span class="term"><code class="code">(<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])</code></span></dt><dd>Argument list and return value, see
7907 <a class="xref" href="#allocation" title="32.3.8. Argument and result passing conventions">Section 32.3.8, “Argument and result passing conventions”</a> and <a class="xref" href="#param-mode" title="32.3.9. Parameter Mode">Section 32.3.9, “Parameter Mode”</a>.
7908 </dd><dt><span class="term"><code class="code">(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code></span></dt><dd>See <a class="xref" href="#c-flavor" title="32.3.4. The choice of the C flavor">Section 32.3.4, “The choice of the <span class="command"><strong>C</strong></span> flavor”</a>.
7909 </dd><dt><span class="term"><code class="code">(:BUILT-IN <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>)</code></span></dt><dd>When the function is a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> built-in, the full
7910 prototype will be output (unless suppressed by <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>).
7911 </dd><dt><span class="term"><code class="code">(<code class="constant">:LIBRARY</code> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Specifies the (optional) dynamic library
7912 which contains the function, the default is set by
7913 <a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:VERSION</code> <em class="replaceable"><code>version</code></em>)</code></span></dt><dd>Specifies the (optional) symbol version in the library
7914 (therefore, if <code class="constant">:VERSION</code> is supplied, <code class="constant">:LIBRARY</code> must also be supplied).
7915 </dd><dt><span class="term"><code class="code">(:GUARD <em class="replaceable"><code>guard</code></em>)</code></span></dt><dd><p>Specifies how to wrap the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code in the <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>
7916 conditionals for portability and defaults to <a class="link" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a>:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>Do nothing</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></span></dt><dd>Rely on <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a>
7917 feature detection as described in <a class="xref" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a>.
7918 </dd><dt><span class="term">anything else</span></dt><dd><p>Use as is, e.g., in
7919 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/bindings/glibc/linux.lisp"><code class="filename">modules/bindings/glibc/linux.lisp</code></a>:
7920 </p><pre class="programlisting">
7921 (def-call-out canonicalize_file_name (:arguments (name c-string))
7922 (:return-type c-string :malloc-free) (:guard "defined(__USE_GNU)"))
7923 </pre></dd></dl></div></dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a> documentation.
7924 </dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="def-call-in"></a><span class="term"><code class="code">(<a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>
7925 <em class="replaceable"><code>function</code></em> {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a
7926 <strong class="first"><em class="firstterm">callback<a id="def-call-in-callback" class="indexterm"></a></em></strong> -
7927 a named call-in function (i.e., a Lisp function called from the
7928 foreign language: control flow temporary enters Lisp)</p><div class="variablelist"><a id="def-call-in-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>Any <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function call to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function
7929 <em class="replaceable"><code>c-name</code></em> is redirected to call the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> function <em class="replaceable"><code>function</code></em>, which
7930 should be a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:ARGUMENTS</code>
7931 {(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)</code><br /></span><span class="term"><code class="code">(<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])</code></span></dt><dd>Argument list and return value, see
7932 <a class="xref" href="#allocation" title="32.3.8. Argument and result passing conventions">Section 32.3.8, “Argument and result passing conventions”</a> and <a class="xref" href="#param-mode" title="32.3.9. Parameter Mode">Section 32.3.9, “Parameter Mode”</a>.
7933 </dd><dt><span class="term"><code class="code">(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code></span></dt><dd>See <a class="xref" href="#c-flavor" title="32.3.4. The choice of the C flavor">Section 32.3.4, “The choice of the <span class="command"><strong>C</strong></span> flavor”</a>.
7934 </dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="dffi-open-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a>
7935 <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :REQUIRE)</code></span></dt><dd><p class="simpara">Open (load) a shared foreign library.</p><p class="simpara">Some shared libraries depend on other shared libraries
7936 and this dependency can be specified using
7937 the <code class="constant">:REQUIRE</code> argument.</p><p class="simpara">Unless the library has dependencies, this is only needed if
7938 you want to test for <span class="emphasis"><em>presence</em></span> of a library
7939 without creating a foreign object referencing its contents.
7940 When you create a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>
7941 using <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> or <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> with a <code class="constant">:LIBRARY</code> argument,
7942 the library <em class="replaceable"><code>name</code></em> is opened automatically.</p><p>E.g., <code class="filename">libgsl.so</code>
7943 requires <code class="filename">libgslcblas.so</code>:</p><pre class="programlisting">
7944 (<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgsl.so")
7945 *** - FFI:OPEN-FOREIGN-LIBRARY: Cannot open library "libgsl.so": "/usr/lib64/libgsl.so: undefined symbol: cblas_ctrmv"
7946 </pre><p> so a common way is to pre-open the dependency:
7947 </p><pre class="programlisting">
7948 (<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgslcblas.so")
7949 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gsl_cheb_alloc (<code class="constant">:LIBRARY</code> "libgsl.so") (:language :stdc)
7950 (:arguments (n ffi:int)) (:return-type ffi:c-pointer))
7951 ⇒ <code class="computeroutput">GSL_CHEB_ALLOC</code>
7952 </pre><p> Alas, this would work <span class="emphasis"><em>in the current
7953 image</em></span> only: if you save the
7954 image, <code class="function">GSL_CHEB_ALLOC</code> will <span class="strong"><strong>not</strong></span> work there
7955 because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will try to re-open <code class="filename">libgsl.so</code> and
7956 fail as above. However, using the <code class="constant">:REQUIRE</code> argument
7957 will tell <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to re-open <span class="strong"><strong>both</strong></span> libraries in the right order:</p><pre class="screen">
7958 <strong><code class="prompt">$</code></strong> clisp
7959 &gt; (<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgsl.so" :require '("libgslcblas.so"))
7960 &gt; (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gsl_cheb_alloc (:library "libgsl.so") (:language :stdc)
7961 (:arguments (n ffi:int)) (:return-type ffi:c-pointer))
7962 &gt; (<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "foo" :executable t)
7963 &gt; (<a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a>)
7964 <strong><code class="prompt">$</code></strong> ./foo
7965 &gt; (gsl_cheb_alloc 10)
7966 <code class="computeroutput">#&lt;<a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> #x0000000017AC38A0&gt;</code>
7967 </pre></dd><dt><a id="dffi-close-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-close-lib"><code class="function">FFI:CLOSE-FOREIGN-LIBRARY</code></a>
7968 <em class="replaceable"><code>name</code></em>)</code></span></dt><dd><p class="simpara">Close (unload) a shared foreign library (opened by
7969 <a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> or the <code class="constant">:LIBRARY</code> argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
7970 or <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>).</p><p class="simpara">If you want to modify your shared library, you need to close
7971 it using <a class="link" href="#dffi-close-lib"><code class="function">FFI:CLOSE-FOREIGN-LIBRARY</code></a> first. When you use a
7972 <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> which resides in the
7973 library <em class="replaceable"><code>name</code></em>, it will be re-opened automatically.
7974 </p></dd><dt><a id="dffi-default-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>
7975 <em class="replaceable"><code>library-name</code></em>)</code></span></dt><dd><p class="simpara">This macro sets the default <code class="constant">:LIBRARY</code> argument for
7976 <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>. <em class="replaceable"><code>library-name</code></em> should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
7977 (meaning use the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> file produced by <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>), a
7978 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, or, depending on the underlying <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a>
7979 or <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=dlvsym"><code class="function">dlvsym</code></a> implementation,
7980 <code class="constant">:DEFAULT</code> or <code class="constant">:NEXT</code>.</p><p class="simpara">The default is set separately in each <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>, so, if you
7981 are interfacing to a single library, you can set this variable in the
7982 beginning of your lisp file and omit the <code class="constant">:LIBRARY</code> argument
7983 throughout the file.</p></dd><dt><a id="def-c-struct"></a><span class="term"><code class="code">(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a>
7984 <em class="replaceable"><code>name</code></em> (<em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>c-type</code></em>)*)</code></span></dt><dd><p>This form defines <em class="replaceable"><code>name</code></em> to be both a
7985 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> and a foreign <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type with the given slots.
7986 If this class representation overhead is not needed one should consider
7987 writing <code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> <em class="replaceable"><code>name</code></em> (<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a>
7988 {<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> | <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>} (<em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>c-type</code></em>)*))</code> instead.
7989 <em class="replaceable"><code>name</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (structure name) or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">FIRST</code></a>
7990 element is the structure name and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_rest.html" target="_top"><code class="function">REST</code></a> is options.
7991 Two options are supported at this time:
7992 </p><div class="variablelist"><a id="def-c-struct-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a></strong></p><dl class="variablelist"><dt><a id="def-c-struct-typedef"></a><span class="term"><code class="constant">:TYPEDEF</code></span></dt><dd>means that the name of this structure is a
7993 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type defined with <code class="function">typedef</code>
7994 elsewhere.</dd><dt><a id="def-c-struct-external"></a><span class="term"><code class="constant">:EXTERNAL</code></span></dt><dd>means that this structure is defined in a
7995 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> header file that you include with, e.g.,
7996 <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> "#include &lt;filename.h&gt;~%")</code>.
7997 </dd></dl></div><p>
7998 These options determine how the struct is written to the <code class="filename">#P".c"</code>.
7999 </p></dd><dt><a id="def-c-enum"></a><span class="term"><code class="code">(<a class="link" href="#def-c-enum"><code class="function">FFI:DEF-C-ENUM</code></a>
8000 <em class="replaceable"><code>name</code></em> {<em class="replaceable"><code>symbol</code></em> | (<em class="replaceable"><code>symbol</code></em> [<em class="replaceable"><code>value</code></em>])}*)</code></span></dt><dd><p class="simpara">This form defines <em class="replaceable"><code>symbol</code></em>s
8001 as constants, similarly to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> declaration <span class="type">enum {
8002 <em class="replaceable"><code>symbol</code></em> [= <em class="replaceable"><code>value</code></em>], ... };</span></p><p class="simpara">You can use <code class="code">(<code class="function">FFI:ENUM-FROM-VALUE</code>
8003 <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>value</code></em>)</code> and
8004 <code class="code">(<code class="function">FFI:ENUM-TO-VALUE</code> <em class="replaceable"><code>name</code></em>
8005 <em class="replaceable"><code>symbol</code></em>)</code> to convert between the numeric and symbolic
8006 representations (of course, the latter function boils down to
8007 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> plus a check that the <em class="replaceable"><code>symbol</code></em> is indeed a constant
8008 defined in the <a class="link" href="#def-c-enum"><code class="function">FFI:DEF-C-ENUM</code></a> <em class="replaceable"><code>name</code></em>).</p></dd><dt><a id="c-lines"></a><span class="term"><code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> <em class="replaceable"><code>format-string</code></em>
8009 {<em class="replaceable"><code>argument</code></em>}*)</code></span></dt><dd><p class="simpara">This form outputs the string
8010 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>format-string</code></em> {<em class="replaceable"><code>argument</code></em>}*)</code>
8011 to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> output file's top level.
8012 This is usually used to include the relevant header files,
8013 see <a class="xref" href="#def-c-struct-external"><code class="constant">:EXTERNAL</code></a>
8014 and <a class="xref" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>.</p><p>When <em class="replaceable"><code>format-string</code></em> is not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>,
8015 and then the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> {<em class="replaceable"><code>argument</code></em>}*)</code>
8016 is added to the appropriate <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:INIT-ALWAYS</code><br /></span><span class="term"><code class="constant">:INIT-ONCE</code></span></dt><dd><a class="link" href="#modinit" title="32.2.2. Module initialization">initialization
8017 function</a></dd><dt><span class="term"><code class="constant">:FINI</code></span></dt><dd><a class="link" href="#modfini" title="32.2.3. Module finalization">finalization
8018 function</a></dd></dl></div></dd><dt><a id="element"></a><span class="term"><code class="code">(<a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a> <em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>index<sub>1</sub></code></em>
8019 ... <em class="replaceable"><code>index<sub>n</sub></code></em>)</code></span></dt><dd>Array element: If <em class="replaceable"><code>c-place</code></em> is of foreign type
8020 <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> (<em class="replaceable"><code>dim<sub>1</sub></code></em> ... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span>
8021 and 0 ≤ <em class="replaceable"><code>index<sub>1</sub></code></em> &lt; <em class="replaceable"><code>dim<sub>1</sub></code></em>, ..., 0 ≤ <em class="replaceable"><code>index<sub>n</sub></code></em> &lt; <em class="replaceable"><code>dim<sub>n</sub></code></em>,
8022 this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> corresponding to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>c-place</code></em>
8023 <em class="replaceable"><code>index<sub>1</sub></code></em> ... <em class="replaceable"><code>index<sub>n</sub></code></em>)</code> or
8024 <code class="varname"><em class="replaceable"><code>c-place</code></em>[<em class="replaceable"><code>index<sub>1</sub></code></em>]...[<em class="replaceable"><code>index<sub>n</sub></code></em>]</code>.
8025 It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
8026 If <em class="replaceable"><code>c-place</code></em> is of foreign type <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>
8027 <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>dim</code></em>)</code></span> and 0 ≤ <em class="replaceable"><code>index</code></em> &lt; <em class="replaceable"><code>dim</code></em>,
8028 this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> corresponding to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>c-place</code></em>
8029 <em class="replaceable"><code>index</code></em>)</code> or <code class="varname"><em class="replaceable"><code>c-place</code></em>[<em class="replaceable"><code>index</code></em>]</code>.
8030 It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
8031 </dd><dt><a id="deref"></a><span class="term"><code class="code">(<a class="link" href="#deref"><code class="function">FFI:DEREF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Dereference pointer: If
8032 <em class="replaceable"><code>c-place</code></em> is of foreign type
8033 <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
8034 <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span> or
8035 <span class="type"><code class="literal">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
8036 this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> the pointer points to.
8037 It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
8038 For <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
8039 the <em class="replaceable"><code>c-place</code></em> may not be <code class="constant">NULL</code>.
8040 </dd><dt><a id="slot"></a><span class="term"><code class="code">(<a class="link" href="#slot"><code class="function">FFI:SLOT</code></a> <em class="replaceable"><code>c-place</code></em>
8041 <em class="replaceable"><code>slot-name</code></em>)</code></span></dt><dd>Struct or union component: If <em class="replaceable"><code>c-place</code></em> is of
8042 foreign type <span class="type"><code class="literal">(<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a> <em class="replaceable"><code>class</code></em> ...
8043 (<em class="replaceable"><code>slot-name</code></em> <em class="replaceable"><code>c-type</code></em>) ...)</code></span> or of
8044 type <span class="type"><code class="literal">(<a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>
8045 ... (<em class="replaceable"><code>slot-name</code></em> <em class="replaceable"><code>c-type</code></em>) ...)</code></span>,
8046 this will be of type <em class="replaceable"><code>c-type</code></em>.</dd><dt><a id="cast"></a><span class="term"><code class="code">(<a class="link" href="#cast"><code class="function">FFI:CAST</code></a>
8047 <em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>Type change: A <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> denoting the same memory
8048 locations as the original <em class="replaceable"><code>c-place</code></em>, but of type <em class="replaceable"><code>c-type</code></em>.
8049 </dd><dt><a id="offset"></a><span class="term"><code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a>
8050 <em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>offset</code></em> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>Type change and displacement: return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> denoting
8051 a memory locations displaced from the original <em class="replaceable"><code>c-place</code></em> by an
8052 <em class="replaceable"><code>offset</code></em> counted in bytes, with type <em class="replaceable"><code>c-type</code></em>.
8053 This can be used to resize an array, e.g. of <em class="replaceable"><code>c-type</code></em>
8054 <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint16</span> <em class="replaceable"><code>n</code></em>)</code></span>
8055 via <code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a> <em class="replaceable"><code>c-place</code></em> 0 '(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint16</span>
8056 <em class="replaceable"><code>k</code></em>))</code>.
8057 </dd><dt><a id="c-var-addr"></a><span class="term"><code class="code">(<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a>
8058 <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Return the address of <em class="replaceable"><code>c-place</code></em> as a Lisp object of
8059 type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>. This is useful as an argument
8060 to foreign functions expecting a parameter of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>.
8061 </dd><dt><a id="c-var-object"></a><span class="term"><code class="code">(<a class="link" href="#c-var-object"><code class="function">FFI:C-VAR-OBJECT</code></a>
8062 <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Return the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object underlying the
8063 <em class="replaceable"><code>c-place</code></em>. This is also an acceptable argument type to a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
8064 declaration.</dd><dt><a id="typeof"></a><span class="term"><code class="code">(<a class="link" href="#typeof"><code class="function">FFI:TYPEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>returns the <em class="replaceable"><code>c-type</code></em> corresponding to the <em class="replaceable"><code>c-place</code></em>.
8065 </dd><dt><a id="sizeof"></a><span class="term"><code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd><p class="simpara">The first form returns the size and alignment of the
8066 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <em class="replaceable"><code>c-type</code></em>, measured in bytes.</p><p class="simpara">The second form returns the size and alignment of the
8067 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type of <em class="replaceable"><code>c-place</code></em>, measured in bytes.
8068 </p></dd><dt><a id="bitsizeof"></a><span class="term"><code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd><p class="simpara">The first form returns the size and alignment of the
8069 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <em class="replaceable"><code>c-type</code></em>, measured in bits.</p><p class="simpara">The second form returns the size and alignment of the
8070 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type of <em class="replaceable"><code>c-place</code></em>, measured in bits.
8071 </p></dd><dt><a id="faddr-u"></a><span class="term"><code class="code">(<a class="link" href="#faddr-u"><code class="function">FFI:FOREIGN-ADDRESS-UNSIGNED</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> <em class="replaceable"><code>number</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#faddr-u"><code class="function">FFI:FOREIGN-ADDRESS-UNSIGNED</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
8072 address embodied in the Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>,
8073 <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.</p><p class="simpara"><a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> returns a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
8074 object pointing to the given <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> address.
8075 </p></dd><dt><a id="faddr"></a><span class="term"><code class="code">(<a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> is both a type name and a
8076 selector/constructor function. It is the Lisp object type
8077 corresponding to a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> external type declaration, e.g. a
8078 call-out function with <code class="code">(<code class="constant">:RETURN-TYPE</code> <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>)</code> yields
8079 a Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>.</p><p class="simpara">The function extracts the object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
8080 living within any <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object.
8081 If the <em class="replaceable"><code>foreign-entity</code></em> already is a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, it returns it.
8082 If it is a <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> (e.g. a base foreign library address),
8083 it encapsulates it into a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> object, as suitable
8084 for use with a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> external type declaration.
8085 It does not construct addresses out of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s,
8086 <a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> must be used for that purpose.
8087 </p></dd><dt><a id="dffi-make-var"></a><span class="term"><code class="code">(<a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>foreign-entity</code></em>
8088 <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd> This constructor creates a new <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
8089 from the given <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> or <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> and the
8090 internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor (as obtained from <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a>).
8091 <em class="replaceable"><code>name</code></em>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is mostly useful for documentation and
8092 interactive debugging since it appears in the printed representation
8093 of the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object, as in
8094 <code class="computeroutput">#&lt;<a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> "foo"
8095 #x0ADD4E55&gt;</code>.
8096 In effect, this is similar to <a class="link" href="#cast"><code class="function">FFI:CAST</code></a> (or rather
8097 <code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a> ... 0 ...)</code> for places),
8098 except that it works with <a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> objects and allows
8099 caching of the internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types.</dd><dt><a id="dffi-make-func"></a><span class="term"><code class="code">(<a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>
8100 <em class="replaceable"><code>foreign-entity</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd><p class="simpara">This constructor creates a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>
8101 from the given <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> and the
8102 internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor (as obtained from
8103 <code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> '(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> ...))</code>,
8104 in which case it is important to specify the <a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> because the
8105 expressions are likely to be evaluated at run time, outside the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>).
8106 The <em class="replaceable"><code>name</code></em>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is mostly useful for documentation and
8107 interactive debugging since it appears in the printed representation
8108 of the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object, e.g.,
8109 <code class="computeroutput">#&lt;<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> "foo"
8110 #x0052B060&gt;</code>.
8111 It is inherited from the given <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object when
8112 available.</p><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="validp"></a><span class="term"><code class="code">(<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> <em class="replaceable"><code>foreign-entity</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">This predicate returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>foreign-entity</code></em>
8113 (e.g. the Lisp equivalent of a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>) refers to a pointer
8114 which is invalid (e.g., because it comes from a previous Lisp session).
8115 It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <em class="replaceable"><code>foreign-entity</code></em> can be used within the current Lisp process
8116 (thus it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for all non-foreign arguments).</p><p class="simpara">You can invalidate a foreign object using
8117 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code>.
8118 You cannot resurrect a zombie, nor can you kill a non-foreign object.
8119 </p></dd><dt><a id="fptr"></a><span class="term"><code class="code">(<a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code></span></dt><dd><a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> returns the <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
8120 associated with the Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>,
8121 <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.
8122 </dd><dt><span class="term"><code class="code">(<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> <em class="replaceable"><code>foreign-entity</code></em> {<em class="replaceable"><code>foreign-entity</code></em> |
8123 <code class="constant">:COPY</code>})</code></span></dt><dd><a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> changes the
8124 <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> associated with the Lisp object of type
8125 <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> to
8126 that of the other entity.
8127 With <code class="constant">:COPY</code>, a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> is allocated.
8128 The original <em class="replaceable"><code>foreign-entity</code></em> still points to the same object and is returned.
8129 This is particularly useful with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code>,
8130 see <a class="xref" href="#ex-dffi-validity" title="Example 32.11. Controlling validity of resources">Example 32.11, “Controlling validity of resources”</a>.</dd><dt><a id="foreign-stack"></a><span class="term"><code class="code">(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>c-type</code></em>
8131 [<em class="replaceable"><code>initarg</code></em>]) <em class="replaceable"><code>body</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>c-type</code></em>
8132 [<em class="replaceable"><code>initarg</code></em>]) <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">These forms allocate space on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> execution
8133 stack, bind respectively a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object or
8134 a local <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> to <em class="replaceable"><code>variable</code></em> and execute <em class="replaceable"><code>body</code></em>.</p><p class="simpara">When <em class="replaceable"><code>initarg</code></em> is not supplied,
8135 they allocate space only for <code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code> bytes.
8136 This space is filled with zeroes. E.g.,
8137 using a <em class="replaceable"><code>c-type</code></em> of <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> or even <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>
8138 (<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint8</span> 32))</code></span> (!) both allocate space
8139 for a single pointer, initialized to <code class="constant">NULL</code>.</p><p>When <em class="replaceable"><code>initarg</code></em> is supplied, they
8140 allocate space for an arbitrarily complex set of structures rooted in
8141 <em class="replaceable"><code>c-type</code></em>. Therefore, <a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>, <span class="data"><code class="literal">#()</code></span>
8142 and <span class="data"><code class="literal">""</code></span> are your friends for creating a
8143 pointer to the empty arrays:
8144 </p><pre class="programlisting">(with-c-var (v '(c-ptr (c-array-max uint8 32)) #())
8145 (setf (element (deref v) 0) 127) v)</pre><p>
8146 <em class="replaceable"><code>c-type</code></em> is evaluated, making creation of variable sized buffers easy:
8147 </p><pre class="programlisting">(with-c-var (fv `(c-array uint8 ,(length my-vector)) my-vector)
8148 (print fv))</pre><p>
8149 </p></dd><dt><a id="foreign-value"></a><span class="term"><code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>) ...)</code></span></dt><dd><p class="simpara">This functions converts the reference to a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
8150 data structure which the <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> describes, to Lisp. Such a
8151 reference is typically obtained from <a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a>,
8152 <a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a>, <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> or via a <code class="code">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
8153 <em class="replaceable"><code>c-type</code></em>)</code> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type description.
8154 Alternatively, macros like <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> or <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> and the
8155 concept of foreign <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> hide many uses of this function.</p><p class="simpara">The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> form performs conversion from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>,
8156 following to the <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>'s type description.
8157 </p></dd><dt><a id="foreign-stack-string"></a><span class="term"><code class="code">(<a class="link" href="#foreign-stack-string"><code class="function">FFI:WITH-FOREIGN-STRING</code></a>
8158 (<em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>char-count</code></em>
8159 <em class="replaceable"><code>byte-count</code></em> <em class="replaceable"><code>string</code></em>
8160 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>encoding</code></em> <em class="replaceable"><code>null-terminated-p</code></em>
8161 <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">This forms converts a Lisp <em class="replaceable"><code>string</code></em> according to
8162 the <em class="replaceable"><code>encoding</code></em>, allocating space on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> execution stack.
8163 <em class="replaceable"><code>encoding</code></em> can be any <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>, e.g. <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> or <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>,
8164 whereas <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> must be an <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>-compatible encoding.
8165 </p><p class="simpara"><em class="replaceable"><code>body</code></em> is then executed with the three variables <em class="replaceable"><code>foreign-address</code></em>,
8166 <em class="replaceable"><code>char-count</code></em> and
8167 <em class="replaceable"><code>byte-count</code></em> respectively bound to an
8168 untyped <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> (as known from the <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> foreign
8169 type specification) pointing to the stack location, the number of
8170 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s of the Lisp <em class="replaceable"><code>string</code></em> that were considered and the
8171 number of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> bytes that were allocated for it on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
8172 stack.</p><p class="simpara">When <em class="replaceable"><code>null-terminated-p</code></em> is true,
8173 which is the default, a variable number of zero bytes is appended,
8174 depending on the encoding, e.g. 2 for <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a>,
8175 and accounted for in <em class="replaceable"><code>byte-count</code></em>,
8176 and <em class="replaceable"><code>char-count</code></em> is incremented by one.</p><p class="simpara">The <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> object bound to <em class="replaceable"><code>foreign-address</code></em> is
8177 invalidated upon the exit from the form.</p><p>A stupid example (a quite costly interface
8178 to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mblen.html"><code class="function">mblen</code></a>):
8179 </p><pre class="programlisting">(with-foreign-string (fv elems bytes string
8180 :encoding charset:jis... :null-terminated-p nil
8181 :end 5)
8182 (declare (ignore fv elems))
8183 (format t "This string would take ~D bytes." bytes))</pre><p>
8184 </p></dd><dt><a id="c-type-parse"></a><span class="term"><code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:DEPARSE-C-TYPE</code></a> <em class="replaceable"><code>c-type-internal</code></em>)</code></span></dt><dd><p class="simpara">Convert between the external (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>) and internal
8185 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>) <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type representations (used by <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>).
8186 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Although you can memoize a <em class="replaceable"><code>c-type-internal</code></em> (see
8187 <a class="xref" href="#memoized" title="31.11.3. Macro EXT:MEMOIZED">Section 31.11.3, “Macro <code class="function">EXT:MEMOIZED</code>”</a> - but do not expect type redefinitions to
8188 work across memoization!), you cannot serialize it (write to
8189 disk) because deserialization loses object identity.</p></div></dd><dt><a id="foreign-heap"></a><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a>
8190 <em class="replaceable"><code>c-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>contents</code></em>
8191 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> <em class="replaceable"><code>foreign-entity</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :FULL)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> <em class="replaceable"><code>c-type-internal</code></em>
8192 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :INITIAL-CONTENTS <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code></span></dt><dd><p class="simpara">Macro <a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a> allocates
8193 <code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code>
8194 bytes on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> heap and zeroes them out
8195 (like <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html"><code class="function">calloc</code></a>).
8196 When <code class="constant">:COUNT</code> is supplied, <em class="replaceable"><code>c-type</code></em> is substituted with
8197 <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>count</code></em>)</code></span>,
8198 except when <em class="replaceable"><code>c-type</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, in which case
8199 <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>count</code></em>)</code></span>
8200 is used instead.
8201 When <code class="constant">:READ-ONLY</code> is supplied, the Lisp side is prevented from modifying the
8202 memory contents. This can be used as an indication that some foreign
8203 side is going to fill this memory (e.g. via <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>).</p><p class="simpara">Returns a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object of the actual <em class="replaceable"><code>c-type</code></em>,
8204 whose address part points to the newly allocated memory.</p><p class="simpara"><a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> will call <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> as many times
8205 as necessary to build a structure on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> heap of the given
8206 <em class="replaceable"><code>c-type</code></em>, initialized from the given <em class="replaceable"><code>contents</code></em>.</p><p class="simpara">E.g., <code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> '<a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> "ABCDE")</code>
8207 performs 2 allocations: one for a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> pointer to a string,
8208 another for the contents of that string. This would be useful in
8209 conjunction with a <span class="type">char**</span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type
8210 declaration. <code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a> '<a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>)</code>
8211 allocates room for a single pointer (probably 4 bytes).</p><p class="simpara"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> "ABCDEF" :count
8212 10)</code> allocates and initializes room for the type <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> 10)</code></span>,
8213 corresponding to <span class="type">char*</span> or, more specifically,
8214 <span class="type">char[10]</span> in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p><p class="simpara">Function <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> deallocates memory at the address
8215 held by the given <em class="replaceable"><code>foreign-entity</code></em>. If <code class="constant">:FULL</code> is supplied
8216 and the argument is of type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>, recursively frees
8217 the whole complex structure pointed to by this variable.</p><p class="simpara">If given a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object that corresponds to a
8218 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> callback, deallocates it. Callbacks are automatically
8219 created each time you pass a Lisp function via the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p><p class="simpara">Use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code> to disable further
8220 references to this address from Lisp. This is currently not done
8221 automatically. If the given pointer is already invalid,
8222 <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> (currently) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>. This may change to
8223 make it easier to integrate with <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p><p class="simpara">Function <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> is a lower-level interface as it
8224 requires an internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor as returned by
8225 <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a>.</p></dd><dt><a id="with-c-place"></a><span class="term"><code class="code">(<a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>foreign-entity</code></em>)
8226 <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Create a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> out of the given <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
8227 object so operations on places (e.g. <a class="link" href="#cast"><code class="function">FFI:CAST</code></a>, <a class="link" href="#deref"><code class="function">FFI:DEREF</code></a>, <a class="link" href="#slot"><code class="function">FFI:SLOT</code></a> etc.) can
8228 be used within <em class="replaceable"><code>body</code></em>. <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> appears as a composition of
8229 <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> and <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a>.</p><p>Such a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> can be used to access memory referenced by a <em class="replaceable"><code>foreign-entity</code></em>
8230 object:
8231 </p><pre class="programlisting">(setq foo (allocate-deep '(c-array uint8 3) rgb))
8232 (with-c-place (place foo) (element place 0))</pre><p>
8233 </p></dd><dt><a id="ffi-extern-output"></a><span class="term"><a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a><br /></span><span class="term"><code class="varname">FFI:*OUTPUT-C-VARIABLES*</code></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will write the <span class="type">extern</span>
8234 declarations for foreign functions (defined with <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>) and
8235 foreign variables (defined with <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>) into the output <code class="filename">#P".c"</code>
8236 (when the Lisp file is compiled with <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>)
8237 <span class="emphasis"><em>unless</em></span> these variables are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
8238 They are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> by default, so the <span class="type">extern</span>
8239 declarations are <span class="strong"><strong>not</strong></span> written; you are encouraged to use
8240 <a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> to include the appropriate <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> headers.
8241 Set these variables to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the headers are not available or
8242 not usable.</dd><dt><a id="ffi-guard"></a><span class="term"><a class="link" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a></span></dt><dd><p>When this variable is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a>,
8243 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will guard the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> statements in the output file with
8244 <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> conditionals to take advantage of <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a> feature detection.
8245 E.g., </p><pre class="programlisting">
8246 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq *foreign-guard* t))
8247 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> some-function (:name "function_name") ...)
8248 </pre><p> will produce </p><pre class="programlisting">
8249 # if defined(HAVE_FUNCTION_NAME)
8250 register_foreign_function((void*)&amp;function_name,"function_name",1024);
8251 # endif
8252 </pre><p> and will compile and link on any system.</p><p class="simpara">This is mostly useful for product delivery when you want your
8253 module to build on any system even if some features will not be
8254 available.</p><p class="simpara"><a class="link" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a> is initialized to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for backwards compatibility.
8255 </p></dd><dt><a id="fptr-info"></a><span class="term"><a class="link" href="#fptr-info"><code class="function">FFI:FOREIGN-POINTER-INFO</code></a></span></dt><dd>This is an interface
8256 to <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=dladdr"><code class="function">dladdr</code></a> and it returns the 4 fields
8257 of <span class="type">Dl_info</span> as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</dd></dl></div><div class="variablelist"><a id="dffi-low"></a><p class="title"><strong>Low-level <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms</strong></p><dl class="variablelist"><dt><a id="memory-as"></a><span class="term"><code class="code">(<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
8258 <em class="replaceable"><code>offset</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
8259 <em class="replaceable"><code>offset</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">This accessor is useful when operating with untyped
8260 foreign pointers (<a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>) as opposed to typed ones
8261 (represented by <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>). It allows to type and
8262 dereference the given pointer without the need to create an object of
8263 type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>.</p><p class="simpara">Alternatively, one could use <code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a>
8264 (<a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>foreign-entity</code></em> <em class="replaceable"><code>c-type-internal</code></em>))</code>
8265 (also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able).</p><p class="simpara">Note that <em class="replaceable"><code>c-type-internal</code></em> is the <span class="emphasis"><em>internal</em></span>
8266 representation of a foreign type, thus <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> is required
8267 with literal names or types, e.g. <code class="code">(<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em>
8268 (<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> '(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> uint8 3)))</code> or <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
8269 (<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> (<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> 'uint32)) 0)</code>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-types"></a>32.3.3. (Foreign) <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types</h3></div></div></div><p>Foreign <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types are used in the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
8270 They are <span class="strong"><strong>not</strong></span> regular <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> types or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> classes.</p><p>A <em class="replaceable"><code>c-type</code></em> is either a predefined <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type or the name of a
8271 type defined by <a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a>.</p><div class="variablelist"><p class="title"><strong>the predefined <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types (<em class="replaceable"><code>c-type</code></em>)</strong></p><dl class="variablelist"><dt><a id="simple-c-type"></a><span class="term"><em class="replaceable"><code>simple-c-type</code></em></span></dt><dd><p>the simple <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types
8272 </p><div class="informaltable"><a id="simple-c-type-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Lisp name</th><th align="center">Lisp equivalent</th><th align="center"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> equivalent</th><th align="center"><a class="ulink" href="http://www2.parc.com/istl/projects/ILU/" target="_top"><acronym class="acronym" title="Inter-Language Unification">ILU</acronym></a> equivalent</th><th align="center">Comment</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><span class="type">void</span></td><td align="center"> </td><td align="center">as a result type only</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></td><td align="center"><span class="type">int</span></td><td align="center"><span class="type">BOOLEAN</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td><td align="center"><span class="type">char</span></td><td align="center"><span class="type">SHORT CHARACTER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">char</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">signed char</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uchar</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned char</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">short</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">short</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">ushort</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned short</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">int</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">int</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned int</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">long</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">long</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">ulong</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned long</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint8</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span></td><td align="center"><span class="type">uint8</span></td><td align="center"><span class="type">BYTE</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint8</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span></td><td align="center"><span class="type">sint8</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint16</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 16)</code></span></td><td align="center"><span class="type">uint16</span></td><td align="center"><span class="type">SHORT CARDINAL</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint16</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 16)</code></span></td><td align="center"><span class="type">sint16</span></td><td align="center"><span class="type">SHORT INTEGER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint32</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span></td><td align="center"><span class="type">uint32</span></td><td align="center"><span class="type">CARDINAL</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint32</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 32)</code></span></td><td align="center"><span class="type">sint32</span></td><td align="center"><span class="type">INTEGER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint64</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 64)</code></span></td><td align="center"><span class="type">uint64</span></td><td align="center"><span class="type">LONG CARDINAL</span></td><td align="center">does not work on all platforms</td></tr><tr><td align="center"><span class="type">sint64</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 64)</code></span></td><td align="center"><span class="type">sint64</span></td><td align="center"><span class="type">LONG INTEGER</span></td><td align="center">does not work on all platforms</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center"><span class="type">float</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center"><span class="type">double</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></dd><dt><a id="c-pointer"></a><span class="term"><a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a></span></dt><dd>This type corresponds to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8273 <span class="type">void*</span>, an opaque pointer.
8274 When used as an argument, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is accepted as a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> and
8275 treated as <code class="constant">NULL</code>; when a function wants to return a <code class="constant">NULL</code>
8276 <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>, it actually returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
8277 </dd><dt><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
8278 <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8279 <span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
8280 <em class="replaceable"><code>c-type</code></em>. It differs from <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>
8281 <em class="replaceable"><code>c-type</code></em>)</code></span> (see below) in that no conversion to and from
8282 Lisp will occur (beyond the usual one of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <code class="constant">NULL</code> pointer
8283 to or from Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>). Instead, an object of type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
8284 is used to represent the foreign <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>. It is assimilable to a typed
8285 pointer.</dd><dt><a id="c-string"></a><span class="term"><a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a></span></dt><dd>This type corresponds to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8286 <span class="type">char*</span>, a zero-terminated string. Its Lisp equivalent is
8287 a string, without the trailing zero character.
8288 </dd><dt><a id="c-struct"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a> <em class="replaceable"><code>class</code></em>
8289 (<em class="replaceable"><code>ident<sub>1</sub></code></em> <em class="replaceable"><code>c-type<sub>1</sub></code></em>) ... (<em class="replaceable"><code>ident<sub>n</sub></code></em> <em class="replaceable"><code>c-type<sub>n</sub></code></em>))</code></span></span></dt><dd><p class="simpara">This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8290 <span class="type">struct { <em class="replaceable"><code>c-type<sub>1</sub></code></em> <em class="replaceable"><code>ident<sub>1</sub></code></em>; ...; <em class="replaceable"><code>c-type<sub>n</sub></code></em> <em class="replaceable"><code>ident<sub>n</sub></code></em>; }</span>.
8291 Its Lisp equivalent is: if <em class="replaceable"><code>class</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>, a
8292 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>; if <em class="replaceable"><code>class</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>;
8293 if <em class="replaceable"><code>class</code></em> is a symbol naming a structure or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> class, an
8294 instance of this class, with slots of names
8295 <em class="replaceable"><code>ident<sub>1</sub></code></em>, ..., <em class="replaceable"><code>ident<sub>n</sub></code></em>.</p><p class="simpara">
8296 <em class="replaceable"><code>class</code></em> may also be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (as above) and
8297 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> options.
8298 </p></dd><dt><a id="c-union"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>
8299 (<em class="replaceable"><code>ident<sub>1</sub></code></em> <em class="replaceable"><code>c-type<sub>1</sub></code></em>) ... (<em class="replaceable"><code>ident<sub>n</sub></code></em> <em class="replaceable"><code>c-type<sub>n</sub></code></em>))</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8300 <span class="type">union { <em class="replaceable"><code>c-type<sub>1</sub></code></em> <em class="replaceable"><code>ident<sub>1</sub></code></em>; ...; <em class="replaceable"><code>c-type<sub>n</sub></code></em> <em class="replaceable"><code>ident<sub>n</sub></code></em>; }</span>.
8301 Conversion to and from Lisp assumes that a value is to be viewed as
8302 being of <em class="replaceable"><code>c-type<sub>1</sub></code></em>.
8303 </dd><dt><a id="c-array"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a>
8304 <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>dim<sub>1</sub></code></em>)</code></span><br /></span><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> (<em class="replaceable"><code>dim<sub>1</sub></code></em>
8305 ... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8306 <span class="type"><em class="replaceable"><code>c-type</code></em> [<em class="replaceable"><code>dim<sub>1</sub></code></em>] ... [<em class="replaceable"><code>dim<sub>n</sub></code></em>]</span>.
8307 Note that when an array is passed as an argument to a function in
8308 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, it is actually passed as a pointer; you therefore have to
8309 write <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> ...))</code></span> for this
8310 argument's type.</dd><dt><a id="c-array-max"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>
8311 <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>maxdimension</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8312 <span class="type"><em class="replaceable"><code>c-type</code></em> [<em class="replaceable"><code>maxdimension</code></em>]</span>, an array containing up to
8313 <em class="replaceable"><code>maxdimension</code></em> elements.
8314 The array is zero-terminated if it contains less than <em class="replaceable"><code>maxdimension</code></em> elements.
8315 Conversion from Lisp of an array with more than <em class="replaceable"><code>maxdimension</code></em> elements
8316 silently ignores the extra elements.
8317 </dd><dt><a id="c-function"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> (<code class="constant">:ARGUMENTS</code>
8318 {(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>a-c-type</code></em>
8319 [<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)
8320 (<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>r-c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])
8321 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>))</code></span></span></dt><dd>This type designates a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function that can be
8322 called according to the given prototype
8323 <code class="code">(<em class="replaceable"><code>r-c-type</code></em> (*)
8324 (<em class="replaceable"><code>a-c-type<sub>1</sub></code></em>, ...))</code>.
8325 Conversion between <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions and Lisp functions
8326 is transparent, and <code class="constant">NULL</code>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is recognized and
8327 accepted.</dd><dt><a id="c-ptr"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8328 <span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
8329 <em class="replaceable"><code>c-type</code></em>.</dd><dt><a id="c-ptr-null"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is also equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8330 <span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
8331 <em class="replaceable"><code>c-type</code></em>, with the exception that <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <code class="constant">NULL</code> corresponds to
8332 Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><a id="c-array-ptr"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
8333 <span class="type"><em class="replaceable"><code>c-type</code></em> (*)[]</span>: a pointer to a zero-terminated array of
8334 items of the given <em class="replaceable"><code>c-type</code></em>.</dd></dl></div><p>The conversion of <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>,
8335 <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>dim<sub>1</sub></code></em>)</code></span>,
8336 <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>maxdimension</code></em>)</code></span>,
8337 <span class="type"><code class="literal">(<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>
8338 is governed by <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> and dimensions are given
8339 in <span class="emphasis"><em>bytes</em></span>.
8340 The conversion of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, and as such of
8341 <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>, or
8342 <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>, as well as
8343 that of multi-dimensional arrays <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
8344 (<em class="replaceable"><code>dim<sub>1</sub></code></em> ... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span>, are governed by <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> if
8345 the latter is a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>, or by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> encoding otherwise.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Remember that the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">char</span> is
8346 a <span class="emphasis"><em>numeric</em></span> type and does not use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
8347 <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="c-flavor"></a>32.3.4. The choice of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> flavor</h3></div></div></div><p><a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>, <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>, <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> take a <a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> argument.
8348 The <em class="replaceable"><code>language</code></em> is either <code class="constant">:C</code> (denotes K&amp;R <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) or <code class="constant">:STDC</code>
8349 (denotes <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) or <code class="constant">:STDC-STDCALL</code> (denotes <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
8350 with the <a class="" href="http://www.google.com/search?q=stdcall">stdcall</a> calling convention).
8351 It specifies whether the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function (caller or callee) has been
8352 compiled by a K&amp;R <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler or by an <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler,
8353 and possibly the calling convention.</p><p>The default language is set using the macro
8354 <strong class="first"><em class="firstterm"><a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a>
8355 <a id="dflt-ffi-lang" class="indexterm"></a></em></strong>.
8356 If this macro has not been called in the current <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>
8357 (usually a file), a warning is issued and <code class="constant">:STDC</code> is used for the rest
8358 of the unit.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-variables"></a>32.3.5. Foreign variables</h3></div></div></div><p><strong class="first"><em class="firstterm">Foreign variables<a id="dffi-fv" class="indexterm"></a></em></strong> are variables whose
8359 storage is allocated in the foreign language module.
8360 They can nevertheless be evaluated and modified through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>,
8361 just as normal variables can, except that the range of allowed values
8362 is limited according to the variable's foreign type.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="dffi-eq"></a>Equality of foreign values</h3><p>For a foreign variable <em class="replaceable"><code>x</code></em> the form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> <em class="replaceable"><code>x</code></em>
8363 <em class="replaceable"><code>x</code></em>)</code> is not necessarily true, since every time <em class="replaceable"><code>x</code></em> is
8364 evaluated its foreign value is converted to a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> Lisp value.
8365 Ergo, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>n</code></em>) <em class="replaceable"><code>y</code></em>)</code> modifies this
8366 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> Lisp value (immediately discarded), <span class="strong"><strong>not</strong></span> the foreign data.
8367 Use <a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a> et al instead, see <a class="xref" href="#dffi-places" title="32.3.6. Operations on foreign places">Section 32.3.6, “Operations on foreign places”</a>.
8368 </p></div><p>Foreign variables are defined using <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> and <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-places"></a>32.3.6. Operations on foreign places</h3></div></div></div><p>A <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>name</code></em> defined by <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>, <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a>
8369 or <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> defines a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>,
8370 i.e., a form which can also be used as argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>.
8371 (An <a class="dict" href="http://foldoc.org/lvalue"><span class="quote">“<span class="quote">lvalue</span>”</span></a> in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> terminology.)
8372 The following operations are available on foreign places:
8373 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a></td><td><a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a></td></tr><tr><td><a class="link" href="#deref"><code class="function">FFI:DEREF</code></a></td><td><a class="link" href="#c-var-object"><code class="function">FFI:C-VAR-OBJECT</code></a></td></tr><tr><td><a class="link" href="#slot"><code class="function">FFI:SLOT</code></a></td><td><a class="link" href="#typeof"><code class="function">FFI:TYPEOF</code></a></td></tr><tr><td><a class="link" href="#cast"><code class="function">FFI:CAST</code></a></td><td><a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a></td></tr><tr><td><a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a></td><td><a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-functions"></a>32.3.7. Foreign functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></div><p>Foreign functions are functions which are defined in the foreign language.
8374 There are <strong class="first"><em class="firstterm">named foreign functions<a id="dffi-ff-n" class="indexterm"></a></em></strong>
8375 (imported via <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> or created via <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>) and
8376 <strong class="first"><em class="firstterm">anonymous foreign functions<a id="dffi-ff-a" class="indexterm"></a></em></strong>; they arise through conversion of function
8377 pointers using <a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>.</p><p>A <strong class="first"><em class="firstterm">call-out function<a id="dffi-ff-call-out" class="indexterm"></a></em></strong> is a foreign function
8378 called from Lisp: control flow temporarily leaves Lisp.
8379 A <strong class="first"><em class="firstterm">call-in function<a id="dffi-ff-call-in" class="indexterm"></a></em></strong>
8380 (AKA <strong class="first"><em class="firstterm">callback<a id="def-call-in-callback-main" class="indexterm"></a></em></strong>)
8381 is a Lisp function called from the foreign language:
8382 control flow temporary enters Lisp.</p><p>The following operators define foreign functions:
8383 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a></td></tr><tr><td><a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a></td></tr><tr><td><a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a></td></tr></table><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dffi-callback-mem"></a>32.3.7.1. Callbacks and memory management</h4></div></div></div><p>Callbacks (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function calling Lisp function) create
8384 so-called <strong class="first"><em class="firstterm">trampolines<a id="dffi-trampoline" class="indexterm"></a></em></strong>.
8385 A trampoline is a piece of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code which knows how to call a
8386 particular Lisp function.
8387 (That is how all foreign language interfaces work, not just ours).
8388 The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> pointer that the foreign library receives is the pointer
8389 to this piece of code.
8390 These are <span class="strong"><strong>not</strong></span> subject to <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, as there is no protocol to
8391 tell the garbage collector when a given callback is not needed anymore
8392 (unlike with Lisp objects).</p><p>With callbacks to <span class="emphasis"><em>named</em></span> functions (i.e.,
8393 created by a <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> form where <em class="replaceable"><code>function</code></em> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>) this is
8394 mostly harmless, since <em class="replaceable"><code>function</code></em> is unlikely to be redefined.</p><p>With callbacks to <span class="emphasis"><em>anonymous</em></span> functions (i.e.,
8395 created by <a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a> or a <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> form where <em class="replaceable"><code>function</code></em>
8396 argument is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>), this might become an issue when they are
8397 produced dynamically and en masse, e.g. inside a loop, so that many
8398 trampolines are generated.</p><p>You can use <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> to free the trampoline associated with a
8399 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object, but when you pass a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> to a
8400 <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> as an argument of type <a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>, such a trampoline
8401 <span class="strong"><strong>is</strong></span> allocated, but you do <span class="strong"><strong>not</strong></span> get hold of the associated trampoline
8402 object, and thus you cannot (trivially) free it.
8403 Thus you may find it easier to create the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object
8404 first, pass it to the <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>, and then call <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a>
8405 manually.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocation"></a>32.3.8. Argument and result passing conventions</h3></div></div></div><p>When passed to and from functions, allocation of arguments and
8406 results is handled as follows:</p><p>Values of <a class="link" href="#simple-c-type"><em class="replaceable"><code>SIMPLE-C-TYPE</code></em></a>, <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> are passed on the stack,
8407 with dynamic extent. The <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is effectively ignored.</p><p>Values of type <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>, <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>, <a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>, <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a>
8408 need storage. The <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> specifies the allocation policy:
8409 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd>no storage is allocated.
8410 </dd><dt><span class="term"><code class="constant">:ALLOCA</code></span></dt><dd>allocation of storage on the stack, which has
8411 dynamic extent.</dd><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>storage will be allocated via <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and released via
8412 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a>.</dd></dl></div><p>If no <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is specified, the default <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is
8413 <code class="constant">:NONE</code> for most types, but <code class="constant">:ALLOCA</code> for <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> and <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> and
8414 <a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> and <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> and for <code class="constant">:OUT</code> arguments.
8415 The <code class="constant">:MALLOC-FREE</code> policy provides the ability to pass
8416 arbitrarily nested structures within a single conversion.</p><p><a id="dffi-allocation-out"></a><strong>Call-out function arguments: </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">For arguments passed from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp allocates the storage using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and
8417 never deallocates it. The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function is supposed to call
8418 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> when done with it.</dd><dt><span class="term"><code class="constant">:ALLOCA</code></span></dt><dd>Lisp allocates the storage on the stack, with
8419 dynamic extent. It is freed when the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function returns.
8420 </dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd><p class="simpara">Lisp assumes that the pointer already points to a
8421 valid area of the proper size and puts the result value there.</p><p class="simpara">This is dangerous and deprecated.</p></dd></dl></div></dd><dt><span class="term">For results passed from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> to Lisp:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> on it when done.
8422 </dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd>Lisp does nothing.
8423 </dd></dl></div></dd></dl></div><p><a id="dffi-allocation-in"></a><strong>Call-in function arguments: </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">For arguments passed from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> to Lisp:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> on it when done.
8424 </dd><dt><span class="term"><code class="constant">:ALLOCA</code><br /></span><span class="term"><code class="constant">:NONE</code></span></dt><dd>Lisp does nothing.
8425 </dd></dl></div></dd><dt><span class="term">For results passed from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp allocates the storage using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and
8426 never deallocates it. The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function is supposed to call
8427 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> when done with it.</dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd><p class="simpara">Lisp assumes that the pointer already points to a
8428 valid area of the proper size and puts the result value there.</p><p class="simpara">This is dangerous and deprecated.</p></dd></dl></div></dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="ffi-struct-arg"></a>Warning</h3><p>Passing <a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a>, <a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>,
8429 <a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a>, <a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> values as arguments (not via pointers) is
8430 only possible to the extent the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler supports it.
8431 Most <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compilers do it right, but some <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compilers
8432 (such as <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> on <span class="platform">hppa</span>,
8433 <span class="platform">x86_64</span> and <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
8434 have problems with this.
8435 The recommended workaround is to pass pointers; this is fully supported.
8436 See also <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
8437 (<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12562038/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12562038/</a>).</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="param-mode"></a>32.3.9. Parameter Mode</h3></div></div></div><p>A function parameter's <a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> may be</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:IN</code> (means: read-only):</span></dt><dd>The caller passes information to the callee.
8438 </dd><dt><span class="term"><code class="constant">:OUT</code> (means: write-only):</span></dt><dd>The callee passes information back to the caller on
8439 return. When viewed as a Lisp function, there is no Lisp argument
8440 corresponding to this, instead it means an additional return value.
8441 Requires <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> = <code class="constant">:ALLOCA</code>.</dd><dt><span class="term"><code class="constant">:IN-OUT</code> (means: read-write):</span></dt><dd>Information is passed from the caller to the callee
8442 and then back to the caller. When viewed as a Lisp function, the
8443 <code class="constant">:OUT</code> value is returned as an additional return value.
8444 </dd></dl></div><p>The default is <code class="constant">:IN</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-examples"></a>32.3.10. Examples</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt></dl></div><div class="example"><a id="dffi-simple"></a><p class="title"><strong>Example 32.2. Simple declarations and access</strong></p><div class="example-contents"><p>The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> declaration </p><pre class="programlisting">
8445 struct foo {
8446 int a;
8447 struct foo * b[100];
8448 };
8449 </pre><p> corresponds to </p><pre class="programlisting">
8450 (<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> foo
8451 (a int)
8452 (b (c-array (c-ptr foo) 100)))
8453 </pre><p>The element access </p><pre class="programlisting">
8454 struct foo f;
8455 f.b[7].a
8456 </pre><p> corresponds to </p><pre class="programlisting">
8457 (declare (type foo f))
8458 (foo-a (aref (foo-b f) 7)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
8459 (slot-value (aref (slot-value f 'b) 7) 'a)
8460 </pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-var"></a><p class="title"><strong>Example 32.3. External <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variable and some accesses</strong></p><div class="example-contents"><pre class="programlisting">
8461 struct bar {
8462 short x, y;
8463 char a, b;
8464 int z;
8465 struct bar * n;
8466 };
8467
8468 extern struct bar * my_struct;
8469
8470 my_struct-&gt;x++;
8471 my_struct-&gt;a = 5;
8472 my_struct = my_struct-&gt;n;
8473 </pre><p> corresponds to </p><pre class="programlisting">
8474 (<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> bar
8475 (x short)
8476 (y short)
8477 (a char)
8478 (b char) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or (b character) if it represents a character, not a number</span></em>
8479 (z int)
8480 (n (c-ptr bar)))
8481
8482 (<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> my_struct (:type (c-ptr bar)))
8483
8484 (setq my_struct (let ((s my_struct)) (incf (slot-value s 'x)) s)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
8485 (incf (slot my_struct 'x))
8486 (setq my_struct (let ((s my_struct)) (setf (slot-value s 'a) 5) s)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
8487 (setf (slot my_struct 'a) 5)
8488 (setq my_struct (slot-value my_struct 'n)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
8489 (setq my_struct (deref (slot my_struct 'n)))
8490 </pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-func1"></a><p class="title"><strong>Example 32.4. Calling an external function</strong></p><div class="example-contents"><p>On <a class="ulink" href="https://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> systems, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html">&lt;<code class="filename">stdlib.h</code>&gt;</a>
8491 contains the declarations:
8492
8493 </p><pre class="programlisting">
8494 typedef struct {
8495 int quot; /* Quotient */
8496 int rem; /* Remainder */
8497 } div_t;
8498 extern div_t div (int numer, int denom);
8499 </pre><p>
8500
8501 This translates to
8502
8503 </p><pre class="programlisting">
8504 (<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> (div_t :typedef)
8505 (quot int)
8506 (rem int))
8507 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a> :stdc)
8508 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> div (<code class="constant">:ARGUMENTS</code> (numer int) (denom int))
8509 (<code class="constant">:RETURN-TYPE</code> div_t))
8510 </pre><p>
8511 Sample call from within Lisp (after running <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span>):
8512 </p><pre class="programlisting">
8513 (div 20 3)
8514 ⇒ <code class="computeroutput">#S(DIV_T :QUOT 6 :REM 2)</code>
8515 </pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-func2"></a><p class="title"><strong>Example 32.5. Another example for calling an external function</strong></p><div class="example-contents"><p>Suppose the following is defined in a file <code class="filename">cfun.c</code>:
8516 </p><pre class="programlisting">
8517 struct cfunr { int x; char *s; };
8518 struct cfunr * cfun (int i,char *s,struct cfunr * r,int a[10]) {
8519 int j;
8520 struct cfunr * r2;
8521 printf("i = %d\n", i);
8522 printf("s = %s\n", s);
8523 printf("r-&gt;x = %d\n", r-&gt;x);
8524 printf("r-&gt;s = %s\n", r-&gt;s);
8525 for (j = 0; j &lt; 10; j++) printf("a[%d] = %d.\n", j, a[j]);
8526 r2 = (struct cfunr *) malloc (sizeof (struct cfunr));
8527 r2-&gt;x = i+5;
8528 r2-&gt;s = "A C string";
8529 return r2;
8530 }
8531 </pre><p>
8532
8533 It is possible to call this function from Lisp using the file
8534 <code class="filename">callcfun.lisp</code> (do not call it
8535 <code class="filename">cfun.lisp</code> - <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> will
8536 <a class="link" href="#c-file-overwrite" title="Warning">overwrite</a>
8537 <code class="filename">cfun.c</code>) whose contents is:
8538
8539 </p><pre class="programlisting">
8540 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "TEST-C-CALL" (:use <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))
8541 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "TEST-C-CALL")
8542 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
8543 (<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> cfunr (x int) (s c-string))
8544 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a> :stdc)
8545 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> cfun (<code class="constant">:RETURN-TYPE</code> (c-ptr cfunr))
8546 (<code class="constant">:ARGUMENTS</code> (i int)
8547 (s c-string)
8548 (r (c-ptr cfunr) :in :alloca)
8549 (a (c-ptr (c-array int 10)) :in :alloca)))
8550 (defun call-cfun ()
8551 (cfun 5 "A Lisp string" (make-cfunr :x 10 :s "Another Lisp string")
8552 '#(0 1 2 3 4 5 6 7 8 9)))
8553 </pre><p>
8554
8555 Use the <a href="impnotes.html#modules" class="olink">module</a> facility:
8556
8557 </p><pre class="screen">
8558 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create cfun callcfun.c
8559 <strong><code class="prompt">$</code></strong> cc -O -c cfun.c
8560 <strong><code class="prompt">$</code></strong> cd cfun
8561 <strong><code class="prompt">$</code></strong> ln -s ../cfun.o cfun.o
8562 Add cfun.o to NEW_LIBS and NEW_FILES in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
8563 <strong><code class="prompt">$</code></strong> cd ..
8564 <strong><code class="prompt">$</code></strong> base/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base/lispinit.mem <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> callcfun.lisp
8565 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+cfun cfun
8566 <strong><code class="prompt">$</code></strong> base+cfun/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+cfun/lispinit.mem <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> callcfun
8567 &gt; (test-c-call::call-cfun)
8568 i = 5
8569 s = A Lisp string
8570 r-&gt;x = 10
8571 r-&gt;s = Another Lisp string
8572 a[0] = 0.
8573 a[1] = 1.
8574 a[2] = 2.
8575 a[3] = 3.
8576 a[4] = 4.
8577 a[5] = 5.
8578 a[6] = 6.
8579 a[7] = 7.
8580 a[8] = 8.
8581 a[9] = 9.
8582 #S(TEST-C-CALL::CFUNR :X 10 :S "A C string")
8583 &gt;
8584 <strong><code class="prompt">$</code></strong> rm -r base+cfun</pre><p>Note that there is a memory leak here: The return value
8585 <code class="varname">r2</code> of <code class="function">cfun()</code> is
8586 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed but never <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a>d. Specifying</p><pre class="programlisting">
8587 (<code class="constant">:RETURN-TYPE</code> (c-ptr cfunr) :malloc-free)
8588 </pre><p>
8589 is not an alternative because this would also
8590 <code class="function">free(r2-&gt;x)</code> but <code class="varname">r2-&gt;x</code> is a
8591 pointer to static data.</p><p>The memory leak can be avoided using
8592 </p><pre class="programlisting">
8593 (<code class="constant">:RETURN-TYPE</code> (c-pointer cfunr))
8594 </pre><p>
8595 instead, in conjunction with
8596 </p><pre class="programlisting">
8597 (defun call-cfun ()
8598 (let ((data (cfun ...)))
8599 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> data)
8600 (<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> data :FULL nil))))
8601 </pre></div></div><br class="example-break" /><div class="example"><a id="dffi-ex-macro"></a><p class="title"><strong>Example 32.6. Accessing <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros</strong></p><div class="example-contents"><p>Suppose you are interfacing to a library <code class="filename">mylib.so</code>
8602 which defines types, macros and <code class="literal">inline</code> functions
8603 in <code class="filename">mylib.h</code>:</p><pre class="programlisting">
8604 #define FOO(x) .....
8605 #define BAR ...
8606 struct zot { ... }
8607 inline int bar (int x) { ... }
8608 </pre><p>
8609 To make them available from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, write these forms into the lisp
8610 file <code class="filename">my.lisp</code>:</p><pre class="programlisting">
8611 (<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> "#include &lt;mylib.h&gt;
8612 int my_foo (int x) { return FOO(x); }
8613 int my_bar (int x) { return bar(x); }~%")
8614 (<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> bar)
8615 (<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> zot-size (:name "sizeof(struct zot)") (:guard nil))
8616 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> my-foo (<code class="constant">:NAME</code> "my_foo") (<code class="constant">:ARGUMENTS</code> (x ffi:int)) (<code class="constant">:RETURN-TYPE</code> ffi:int))
8617 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> my-bar (<code class="constant">:NAME</code> "my_bar") (<code class="constant">:ARGUMENTS</code> (x ffi:int)) (<code class="constant">:RETURN-TYPE</code> ffi:int))
8618 </pre><p>Compiling this file will produce <code class="filename">my.c</code>
8619 and <code class="filename">my.fas</code> and you have two options:
8620 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Compile <code class="filename">my.c</code>
8621 into <code class="filename">my.o</code> with
8622 </p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -c my.c -lmylib</pre><p>
8623 and use <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to create a new <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>.
8624 </p></li><li class="listitem"><p>Add <code class="code">(<code class="constant">:LIBRARY</code> "my.dll")</code> to the <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
8625 forms, compile <code class="filename">my.c</code> into <code class="filename">my.so</code>
8626 (or <code class="filename">my.dll</code> on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>) with
8627 </p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -shared -o my.so my.c -lmylib</pre><p> and
8628 load <code class="filename">my.fas</code>.</p></li></ol></div><p>Of course, you could have created <code class="filename">my1.c</code>
8629 containing</p><pre class="programlisting">
8630 #include &lt;mylib.h&gt;
8631 int my_foo (int x) { return FOO(x); }
8632 int my_bar (int x) { return bar(x); }
8633 </pre><p>manually, but <a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> allows you to keep the
8634 definitions of <code class="function">my_foo</code> and <code class="function">my-foo</code>
8635 close together for easier maintenance.</p></div></div><br class="example-break" /><div class="example"><a id="ex-call-in"></a><p class="title"><strong>Example 32.7. Calling Lisp from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a></strong></p><div class="example-contents"><p>To sort an array of double-floats using the Lisp function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a>
8636 instead of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library function
8637 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/qsort.html"><code class="function">qsort</code></a>, one can use the
8638 following interface code <code class="filename">sort1.c</code>.
8639 The main problem is to pass a variable-sized array.
8640
8641 </p><pre class="programlisting">
8642 extern void lispsort_begin (int);
8643 void* lispsort_function;
8644 void lispsort_double (int n, double * array) {
8645 double * sorted_array;
8646 int i;
8647 lispsort_begin(n); /* store #'sort2 in lispsort_function */
8648 sorted_array = ((double * (*) (double *)) lispsort_function) (array);
8649 for (i = 0; i &lt; n; i++) array[i] = sorted_array[i];
8650 free(sorted_array);
8651 }
8652 </pre><p>
8653
8654 This is accompanied by <code class="filename">sort2.lisp</code>:
8655
8656 </p><pre class="programlisting">
8657 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FFI-TEST" (:use <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))
8658 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "FFI-TEST")
8659 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
8660 (<a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> lispsort_begin (<code class="constant">:ARGUMENTS</code> (n int))
8661 (<code class="constant">:RETURN-TYPE</code> nil)
8662 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
8663 (<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> lispsort_function (:type c-pointer))
8664 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> lispsort_begin (n)
8665 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#cast"><code class="function">FFI:CAST</code></a> lispsort_function
8666 `(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>
8667 (<code class="constant">:ARGUMENTS</code> (v (c-ptr (c-array double-float ,n))))
8668 (<code class="constant">:RETURN-TYPE</code> (c-ptr (c-array double-float ,n))
8669 :malloc-free)))
8670 #'sort2))
8671 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> sort2 (v)
8672 (declare (type vector v))
8673 (sort v #'&lt;))
8674 </pre><p>
8675
8676 To test this, use the following test file <code class="filename">sorttest.lisp</code>:
8677
8678 </p><pre class="programlisting">
8679 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
8680 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> sort10
8681 (<code class="constant">:NAME</code> "lispsort_double")
8682 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
8683 (<code class="constant">:ARGUMENTS</code> (n ffi:int)
8684 (array (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> ffi:double-float 10)) :in-out)))
8685 </pre><p>
8686
8687 Now try
8688
8689 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create sort sort2.c sorttest.c
8690 <strong><code class="prompt">$</code></strong> cc -O -c sort1.c
8691 <strong><code class="prompt">$</code></strong> cd sort
8692 <strong><code class="prompt">$</code></strong> ln -s ../sort1.o sort1.o</pre><p>
8693
8694 Add <code class="filename">sort1.o</code> to <code class="envar">NEW_LIBS</code>
8695 and <code class="envar">NEW_FILES</code> in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
8696 Create a file <code class="filename">package.lisp</code> containing the form
8697 </p><pre class="programlisting">
8698 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> "FFI-TEST" :use '(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))</pre><p>
8699 and add <code class="filename">package.lisp</code> to <a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a> in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
8700 Proceed:
8701
8702 </p><pre class="screen"><strong><code class="prompt">$</code></strong> cd ..
8703 <strong><code class="prompt">$</code></strong> base/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base/lispinit.mem <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> sort2.lisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> sorttest.lisp
8704 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+sort sort
8705 <strong><code class="prompt">$</code></strong> base+sort/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+sort/lispinit.mem <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> sort2 sorttest
8706 &gt; (sort10 10 '#(0.501d0 0.528d0 0.615d0 0.550d0 0.711d0
8707 0.523d0 0.585d0 0.670d0 0.271d0 0.063d0))
8708 #(0.063d0 0.271d0 0.501d0 0.523d0 0.528d0 0.55d0 0.585d0 0.615d0 0.67d0 0.711d0)
8709 <strong><code class="prompt">$</code></strong> rm -r base+sort</pre></div></div><br class="example-break" /><div class="example"><a id="ex-call-in-dll"></a><p class="title"><strong>Example 32.8. Calling Lisp from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> dynamically</strong></p><div class="example-contents"><p>Create a dynamic library <code class="filename">lispdll</code>
8710 (<code class="filename">#P".dll"</code> on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>,
8711 <code class="filename">#P".so"</code> on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)
8712 with the following function:</p><pre class="programlisting">
8713 typedef int (*LispFunc)(int parameter);
8714 int CallInFunc(LispFunc f) {
8715 return f(5)+11;
8716 }
8717 </pre><p>
8718 and call it from Lisp:
8719 </p><pre class="programlisting">
8720 (ffi:def-call-out callout
8721 (<code class="constant">:NAME</code> "CallInFunc")
8722 (<code class="constant">:LIBRARY</code> "lispdll.dll")
8723 (<code class="constant">:ARGUMENTS</code> (function-arg
8724 (<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> (<code class="constant">:ARGUMENTS</code> (number ffi:int))
8725 (<code class="constant">:RETURN-TYPE</code> ffi:int) (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))))
8726 (<code class="constant">:RETURN-TYPE</code> ffi:int)
8727 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
8728 (defun f (x) (* x 2))
8729 ⇒ <code class="computeroutput">F</code>
8730 (callout #'f)
8731 ⇒ <code class="computeroutput">21</code>
8732 </pre></div></div><br class="example-break" /><div class="example"><a id="dffi-gethostname"></a><p class="title"><strong>Example 32.9. Variable size arguments:
8733 calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><div class="example-contents"><p>The standard <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> function
8734 </p><div class="funcsynopsis"><a id="gethostname-synopsis"></a><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <strong class="fsfunc">gethostname</strong>(</code></td><td>char* <var class="pdparam">name</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
8735 follows a typical pattern of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="quote">“<span class="quote">out</span>”</span>-parameter
8736 convention: it expects a pointer to a buffer it is going to fill.
8737 So you must view this parameter as either <code class="constant">:OUT</code> or <code class="constant">:IN-OUT</code>.
8738 Additionally, one must tell the function the size of the buffer.
8739 Here <em class="replaceable"><code>length</code></em> is just an <code class="constant">:IN</code> parameter.
8740 Sometimes this will be an <code class="constant">:IN-OUT</code> parameter, returning the
8741 number of bytes actually filled in.</p><p>So <em class="replaceable"><code>name</code></em> is actually a pointer to an array of up to <em class="replaceable"><code>length</code></em>
8742 characters, regardless of what the poor <span class="type">char*</span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
8743 prototype says, to be used like a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">string</span>
8744 (<code class="constant">NULL</code>-termination). <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> specifies that <span class="quote">“<span class="quote">host names are
8745 limited to <code class="constant">HOST_NAME_MAX</code> bytes</span>”</span>, which is,
8746 of course, system dependent, but it appears that 256 is sufficient.</p><p>In the present example, you can use allocation <code class="constant">:ALLOCA</code>, like
8747 you would do in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>: stack-allocate a temporary:
8748 </p><pre class="programlisting">
8749 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
8750 (<code class="constant">:ARGUMENTS</code> (name (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> ffi:char 256))
8751 <code class="constant">:OUT</code> <code class="constant">:ALLOCA</code>)
8752 (length ffi:int))
8753 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
8754 (<code class="constant">:RETURN-TYPE</code> ffi:int))
8755 ⇒ <code class="computeroutput">GETHOSTNAME</code>
8756 (defun myhostname ()
8757 (multiple-value-bind (success name)<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><code class="constant">:OUT</code> and <code class="constant">:IN-OUT</code> parameters are returned as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a></span></em>
8758 (gethostname 256)
8759 (if (zerop success) name
8760 (error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror)))))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">See <a class="xref" href="#errno" title="33.2.15. Error handling">Section 33.2.15, “Error handling”</a></span></em>
8761 ⇒ <code class="computeroutput">MYHOSTNAME</code>
8762 (myhostname)
8763 ⇒ <code class="computeroutput">#(97 98 97 122 111 110 107)</code></pre><p>
8764 It is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>, not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, because the <em class="replaceable"><code>name</code></em>
8765 argument is an array of <span class="type">char</span> (an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> type, see
8766 <a class="xref" href="#dffi-types" title="32.3.3. (Foreign) C types">Section 32.3.3, “(Foreign) <span class="command"><strong>C</strong></span> types”</a>), <span class="strong"><strong>not</strong></span> <span class="type">character</span>.
8767 </p><pre class="programlisting">
8768 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
8769 (<code class="constant">:ARGUMENTS</code> (name (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character 256))
8770 <code class="constant">:OUT</code> <code class="constant">:ALLOCA</code>)
8771 (length ffi:int))
8772 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
8773 (<code class="constant">:RETURN-TYPE</code> ffi:int))
8774 ⇒ <code class="computeroutput">GETHOSTNAME</code>
8775 (myhostname)
8776 ⇒ <code class="computeroutput">"abazonk"</code></pre><p>
8777 Now we have a different problem:
8778 if <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> fails, then the buffer
8779 allocated for <em class="replaceable"><code>name</code></em> will be filled with garbage, but it will still go
8780 through the string conversion <span class="strong"><strong>before</strong></span> we can check
8781 the <em class="replaceable"><code>success</code></em> status.
8782 If <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> is <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>, this is not a problem since no real
8783 conversion is happening, but with <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
8784 A safe approach is to pass to the foreign function our own
8785 stack-allocated buffer, and only convert the buffer to a string when the
8786 foreign function succeeds: </p><pre class="programlisting">
8787 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
8788 (<code class="constant">:ARGUMENTS</code> (name <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>)
8789 (length ffi:int))
8790 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
8791 (<code class="constant">:RETURN-TYPE</code> ffi:int))
8792 ⇒ <code class="computeroutput">GETHOSTNAME</code>
8793 (defun myhostname ()
8794 (<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (name '(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character 256))
8795 (let ((success (gethostname name 256)))
8796 (if (zerop success) (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> name)
8797 (error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror))))))
8798 ⇒ <code class="computeroutput">MYHOSTNAME</code>
8799 (myhostname)
8800 ⇒ <code class="computeroutput">"abazonk"</code></pre><p>
8801 Note that the <em class="replaceable"><code>type</code></em> argument of <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> is evaluated,
8802 so we do not have to make any assumptions
8803 about <code class="constant">HOST_NAME_MAX</code>: </p><pre class="programlisting">
8804 (defun myhostname ()
8805 (let ((host-name-max (<a class="link" href="#sysinfo" title="33.2.4. System Information">os:sysconf</a> :host-name-max)))
8806 (<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (name `(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character ,host-name-max))
8807 (let ((success (gethostname name host-name-max)))
8808 (if (zerop success) (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> name)
8809 (error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror)))))))
8810 ⇒ <code class="computeroutput">MYHOSTNAME</code>
8811 (myhostname)
8812 ⇒ <code class="computeroutput">"abazonk"</code></pre><p>
8813 </p></div></div><br class="example-break" /><div class="example"><a id="dffi-dll-var"></a><p class="title"><strong>Example 32.10. Accessing variables in shared libraries</strong></p><div class="example-contents"><p>Suppose one wants to access and modify variables that reside in
8814 shared libraries:
8815 </p><pre class="programlisting">
8816 struct bar {
8817 double x, y;
8818 double out;
8819 };
8820
8821 struct bar my_struct = {10.0, 20.5, 0.0};
8822
8823 double test_dll(struct bar *ptr)
8824 {
8825 return ptr-&gt;out = ptr-&gt;out + ptr-&gt;x + ptr-&gt;y;
8826 }
8827 </pre><p>This is compiled to <code class="filename">libtest.so</code> (or
8828 <code class="filename">libtest.dll</code>, depending on your platform).</p><p>Use the following lisp code:
8829 </p><pre class="programlisting">
8830 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>)
8831
8832 (<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> bar
8833 (x double-float)
8834 (y double-float)
8835 (out double-float))
8836
8837 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> get-own-c-float
8838 (<code class="constant">:LIBRARY</code> "libtest.so")
8839 (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
8840 (<code class="constant">:NAME</code> "test_dll")
8841 (<code class="constant">:ARGUMENTS</code> (ptr c-pointer :in :alloca))
8842 (<code class="constant">:RETURN-TYPE</code> double-float))
8843
8844 (<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> my-c-var (:name "my_struct")
8845 (<code class="constant">:LIBRARY</code> "libtest.so") (:type (c-ptr bar)))
8846 </pre><p>Note that <code class="function">get-own-c-float</code> takes a
8847 <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>, not a <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> bar)</code></span> as the
8848 argument.</p><p>Now you can access call <code class="function">get-own-c-float</code> on
8849 <code class="varname">my-c-var</code>:
8850 </p><pre class="programlisting">
8851 (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var)
8852 ⇒ <code class="computeroutput">#&lt;FOREIGN-ADDRESS #x282935D8&gt;</code>
8853 (get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
8854 ⇒ <code class="computeroutput">30.5d0</code>
8855 (get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
8856 ⇒ <code class="computeroutput">61.0d0</code>
8857 (get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
8858 ⇒ <code class="computeroutput">91.5d0</code>
8859 (get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
8860 ⇒ <code class="computeroutput">122.0d0</code>
8861 </pre></div></div><br class="example-break" /><div class="example"><a id="ex-dffi-validity"></a><p class="title"><strong>Example 32.11. Controlling validity of resources</strong></p><div class="example-contents"><p><a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> is useful in conjunction with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
8862 <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code> to limit the extent of external resources.
8863 Closing twice can be avoided by checking <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>.
8864 All pointers depending on this resource can be disabled at once upon
8865 close by sharing their <a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> using <a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a>.
8866 </p><pre class="programlisting">
8867 (<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> PGconn c-pointer)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">opaque pointer</span></em>
8868 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> PQconnectdb (<code class="constant">:RETURN-TYPE</code> PGconn)
8869 (<code class="constant">:ARGUMENTS</code> (conninfo c-string)))
8870 (defun sql-connect (conninfo)
8871 (let ((conn (PQconnectdb conninfo)))
8872 (unless conn (error "NULL pointer"))
8873 ;; may wish to use <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> as well
8874 (<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> conn <code class="constant">:COPY</code>)))
8875 (defun sql-dependent-resource (conn arg1)
8876 (<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> (PQxxx conn arg1) conn))
8877 (defun sql-close (connection)
8878 (when (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> connection)
8879 (PQfinish connection)
8880 (setf (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> connection) nil)
8881 T))
8882 </pre><p>
8883 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Sharing <a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> goes both ways: invalidating
8884 the dependent resource will invalidate the primary one.</p></div><p>
8885 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>An alternative approach to resource management,
8886 more suitable to non-<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> <a href="impnotes.html#modules" class="olink">module</a>s,
8887 is implemented in the <span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span> module,
8888 see <a class="xref" href="#bdb-close" title="33.7.2. Closing handles">Section 33.7.2, “Closing handles”</a>.</p></div></div></div><br class="example-break" /><div class="example"><a id="ex-dffi-float"></a><p class="title"><strong>Example 32.12. Floating point arrays</strong></p><div class="example-contents"><p>Save this code into <code class="filename">sum.c</code>:
8889 </p><pre class="programlisting">
8890 double sum (int len, double *vec) {
8891 int i;
8892 double s=0;
8893 for (i=0; i&lt;len; i++) s+= vec[i];
8894 return s;
8895 }
8896 </pre><p>
8897 and compile it with
8898 </p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -shared -o libsum.so sum.c</pre><p>
8899 Now you can sum doubles:
8900 </p><pre class="programlisting">
8901 (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> sum (<code class="constant">:NAME</code> "sum") (<code class="constant">:LIBRARY</code> "libsum.so") (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
8902 (<code class="constant">:RETURN-TYPE</code> ffi:double-float)
8903 (<code class="constant">:ARGUMENTS</code> (len ffi:int) (vec (<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> ffi:double-float))))
8904 (sum 3 #(1d0 2d0 3d0))
8905 ⇒ <code class="computeroutput">6d0</code>
8906 </pre></div></div><br class="example-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dffi-ex-more"></a>32.3.10.1. More examples</h4></div></div></div><p>You can find more information and examples of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
8907 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> in the following <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> messages:
8908 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">variable size values</span></dt><dd><a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10143425/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10143425/</a>
8909 </dd><dt><span class="term">variable length arrays</span></dt><dd><a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10142276/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10142276/</a>
8910 <a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10142279/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10142279/</a>
8911 </dd></dl></div><p>Even more examples can be found in the file
8912 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/tests/ffi.tst"><code class="filename">tests/ffi.tst</code></a>
8913 in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source distribution.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="socket"></a>32.4. Socket Streams</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="socket-intro"></a>32.4.1. Introduction</h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt></dl></div><p><a class="ulink" href="http://www.freesoft.org/CIE/Topics/20.htm" target="_top">Sockets</a>
8914 are used for interprocess communications by processes running on the
8915 same host as well as by processes running on different hosts over a
8916 computer network.
8917 The most common kind of sockets is Internet stream sockets, and a
8918 high-level interface to them is described here.
8919 A more low level interface that closely follows the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> system
8920 calls is also available, see <a class="xref" href="#rawsock" title="33.17. Raw Socket Access">Section 33.17, “Raw Socket Access”</a>.</p><p>Two main varieties of sockets are interfaced to:
8921 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="quote">“<span class="quote">active</span>”</span> sockets</span></dt><dd>correspond to <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s which are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a>
8922 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s</dd><dt><span class="term"><span class="quote">“<span class="quote">passive</span>”</span> sockets</span></dt><dd>correspond to <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s which are a special
8923 kind of objects that are used to allow the other side to initiate
8924 interaction with lisp.</dd></dl></div><div class="example"><a id="socket-ex-server"></a><p class="title"><strong>Example 32.13. Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> server</strong></p><div class="example-contents"><p>Here is a simple lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> server that waits for a remote
8925 connection and evaluates forms read from it:
8926 </p><pre class="programlisting">
8927 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((server (<a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>)))
8928 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> t "~&amp;Waiting for a connection on ~S:~D~%"
8929 (<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a> server) (<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a> server))
8930 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>
8931 ;; infinite loop, terminate with <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
8932 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> server))
8933 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (local-host local-port) (<a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a> socket)
8934 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (remote-host remote-port) (<a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a> socket)
8935 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "~&amp;Connection: ~S:~D -- ~S:~D~%"
8936 remote-host remote-port local-host local-port)))
8937 ;; loop is terminated when the remote host closes the connection or on <a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a>
8938 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> :eof (<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> (cons socket :input))) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a>))
8939 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> socket)) socket)
8940 ;; flush everything left in socket
8941 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for c = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a> socket nil nil) :while c)
8942 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">TERPRI</code></a> socket))))
8943 ;; make sure server is closed
8944 (<a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a> server)))
8945 </pre><p>
8946 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This opens a gaping security hole!</h3><p>Functions like <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a>, <a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> will allow the
8947 remote host to execute arbitrary code with your permissions.
8948 While functions defined in lisp (like <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a>) can be removed
8949 (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fmakunbound.html" target="_top"><code class="function">FMAKUNBOUND</code></a>), the built-in functions (like <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> and <a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a>)
8950 cannot be permanently removed from the <a href="clisp.html#runtime" class="olink">runtime</a>, and an experienced
8951 hacker will be able to invoke them even if you <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fmakunbound.html" target="_top"><code class="function">FMAKUNBOUND</code></a> their names.
8952 </p><p>You should limit the socket server to local connections
8953 by passing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> <span class="data"><code class="literal">"127.0.0.1"</code></span>
8954 as the <code class="constant">:INTERFACE</code> argument to <a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>.</p></div><p>
8955 </p></div></div><br class="example-break" /><div class="example"><a id="socket-ex-client"></a><p class="title"><strong>Example 32.14. Lisp <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> client</strong></p><div class="example-contents"><p>Here are a couple of simple lisp <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> clients that fetch a web
8956 page and a binary file, and upload a file:
8957 </p><pre class="programlisting">
8958 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wget-text (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (port 80))
8959 ;; <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requires the <code class="constant">:DOS</code> <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>
8960 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
8961 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "GET ~A HTTP/1.0~2%" page)
8962 ;; dump the whole thing - header+data - into the output file
8963 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (out file :direction :output)
8964 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil) :while line
8965 :do (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-str_m_write-line.html" target="_top"><code class="function">WRITE-LINE</code></a> line out)))))
8966 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wget-binary (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (port 80))
8967 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
8968 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "GET ~A HTTP/1.0~2%" page)
8969 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :with content-length :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil)
8970 ;; header is separated from the data with a blank line
8971 :until (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_zerop.html" target="_top"><code class="function">ZEROP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> line)) :do
8972 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> line #1="Content-length: " :end1 #2=<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> #1#))
8973 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> content-length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-integer.html" target="_top"><code class="function">PARSE-INTEGER</code></a> line :start #2#))
8974 ;; this will not work if the server does not supply the content-length header
8975 :finally (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((data (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> content-length
8976 :element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
8977 ;; switch to binary i/o on socket
8978 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> socket) '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
8979 ;; read the whole file in one system call
8980 (<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> data socket)
8981 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (out file :direction :output
8982 <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
8983 ;; write the whole file in one system call
8984 (<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> data out))
8985 data))))))
8986 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wput (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (port 80))
8987 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
8988 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (in file :direction :inptut <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
8989 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> ((length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-length.html" target="_top"><code class="function">FILE-LENGTH</code></a> in))
8990 (data (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> length :element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
8991 ;; some servers may not understand the "Content-length" header
8992 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "PUT ~A HTTP/1.0~%Content-length: ~D~2%" page length)
8993 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> socket) '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
8994 (<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> data in)
8995 (<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> data socket)))
8996 ;; not necessary if the server understands the "Content-length" header
8997 (<a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> socket :output)
8998 ;; get the server response
8999 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil) :while line :collect line)))
9000 </pre></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="socket-api"></a>32.4.2. Socket API Reference</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="sose"></a><span class="term"><code class="code">(<a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>port</code></em>
9001 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:INTERFACE</code>
9002 <code class="constant">:BACKLOG</code>)</code></span></dt><dd><p class="simpara">This function creates a passive socket an binds a
9003 port to it. The server exists to watch for client connection
9004 attempts.</p><p class="simpara">The optional argument is the port to use (non-negative
9005 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>, <code class="literal">0</code> means assigned by the system).</p><p class="simpara">The <code class="constant">:BACKLOG</code> parameter defines maximum
9006 length of queue of pending connections (see
9007 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html"><code class="function">listen</code></a>) and defaults to 1.</p><p class="simpara">The <code class="constant">:INTERFACE</code> parameter specifies the
9008 interface(s) on which the socket server will listen, and is either a
9009 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, interpreted as the interface <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> address that will be
9010 bound, or a socket, from whose peer the connections will be made.</p><p class="simpara">Default is (for backward compatibility) to bind to all local
9011 interfaces, but for security reasons it is advisable to bind to
9012 the loopback interface <span class="data"><code class="literal">"127.0.0.1"</code></span> if
9013 you need only local connections.</p></dd><dt><a id="sose-close"></a><span class="term"><code class="code">(<a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a> <em class="replaceable"><code>socket-server</code></em>)</code></span></dt><dd>Closes down the server socket. <a class="link" href="#close" title="21.14. Function CLOSE">Just
9014 like streams</a>, <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s are closed at <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
9015 You should not rely on this however, because <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion times are not
9016 deterministic and the port assigned to the server socket cannot be
9017 reused until it is closed.</dd><dt><a id="sose-hopo"></a><span class="term"><code class="code">(<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a> <em class="replaceable"><code>socket-server</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a> <em class="replaceable"><code>socket-server</code></em>)</code></span></dt><dd>Returns the host mask indicating which hosts can
9018 connect to this server and the port which was bound using <a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>.
9019 </dd><dt><a id="so-wait"></a><span class="term"><code class="code">(<a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>
9020 <em class="replaceable"><code>socket-server</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#timeout-opt">[<em class="replaceable"><code>seconds</code></em> [<em class="replaceable"><code>microseconds</code></em>]]</a>)</code></span></dt><dd><a id="timeout-opt"></a>Wait for a fixed time for a
9021 connection on the <em class="replaceable"><code>socket-server</code></em> (a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>).
9022 Without a timeout argument, <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a> blocks indefinitely.
9023 When timeout is zero, poll.
9024 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when a connection is available (i.e., <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> will
9025 not block) and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.</dd><dt><a id="so-accept"></a><span class="term"><code class="code">(<a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> <em class="replaceable"><code>socket-server</code></em>
9026 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Waits for an attempt to connect to the <em class="replaceable"><code>socket-server</code></em> and
9027 creates the server-side <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> for the connection.
9028 </p><p class="simpara"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if no connection is made in that time.
9029 </p></dd><dt><a id="so-connect"></a><span class="term"><code class="code">(<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>
9030 <em class="replaceable"><code>port</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> [<em class="replaceable"><code>host</code></em>] <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9031 <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Attempts to create a client-side <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a>
9032 <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>. Blocks until the server accepts the connection, for
9033 no more than <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>. If it is 0, returns immediately.
9034 </p><p class="simpara"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if no connection could be established
9035 within the given time.
9036 </p></dd><dt><a id="so-status"></a><span class="term"><code class="code">(<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a>
9037 <em class="replaceable"><code>socket-stream-or-list</code></em>
9038 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#timeout-opt">[<em class="replaceable"><code>seconds</code></em> [<em class="replaceable"><code>microseconds</code></em>]]</a>)</code></span></dt><dd><p class="simpara">Checks whether it is possible to read from or write
9039 to a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> or whether a connection is available on a
9040 <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a> without blocking.</p><p class="simpara">This is similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>, which checks only one
9041 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and only for input, and <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>, which works only with
9042 <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s.</p><p class="simpara">We define <em class="replaceable"><code>status</code></em> for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a> or a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>
9043 to be <code class="constant">:ERROR</code> if <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a> finds an exceptional condition pending
9044 on any of the argument <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s.</p><p class="simpara">Additionally, for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>, we define
9045 <em class="replaceable"><code>status</code></em> to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if a connection is available, i.e.,
9046 is <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> will not block, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> otherwise.</p><p>Additionally, for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, we define <em class="replaceable"><code>status</code></em> in the
9047 given <em class="replaceable"><code>direction</code></em> (one of <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code>, and <code class="constant">:IO</code>) to be
9048 </p><div class="variablelist"><a id="so-status-values"></a><p class="title"><strong>Possible status values for various directions:</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><code class="constant">:INPUT</code> status:</span></p></td><td><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></p></td><td>reading will block
9049 </td></tr><tr><td><p><span class="term"><code class="constant">:INPUT</code></span></p></td><td>some input is available
9050 </td></tr><tr><td><p><span class="term"><code class="constant">:EOF</code></span></p></td><td>the stream has reached its end
9051 </td></tr></tbody></table></div></td></tr><tr><td><p><span class="term"><code class="constant">:OUTPUT</code> status:</span></p></td><td><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></p></td><td>writing will block
9052 </td></tr><tr><td><p><span class="term"><code class="constant">:OUTPUT</code></span></p></td><td>output to the stream will not block
9053 </td></tr></tbody></table></div></td></tr><tr><td><p><span class="term"><code class="constant">:IO</code> status:</span></p></td><td><div class="informaltable"><a id="so-status-i-o"></a><table class="informaltable" border="1"><colgroup><col align="center" class="out" /><col align="center" class="nil" /><col align="center" class="inp" /><col align="center" class="eof" /></colgroup><thead><tr><th rowspan="2" align="center" valign="bottom">output status</th><th colspan="3" align="center">input status</th></tr><tr><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></th><th align="center"><code class="constant">:INPUT</code></th><th align="center"><code class="constant">:EOF</code></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="constant">:INPUT</code></td><td align="center"><code class="constant">:EOF</code></td></tr><tr><td align="center"><code class="constant">:OUTPUT</code></td><td align="center"><code class="constant">:OUTPUT</code></td><td align="center"><code class="constant">:IO</code></td><td align="center"><code class="constant">:APPEND</code></td></tr></tbody></table></div></td></tr></tbody></table></div><div class="variablelist"><p class="title"><strong>Possible values of
9054 <em class="replaceable"><code>socket-stream-or-list</code></em>:</strong></p><dl class="variablelist"><dt><span class="term"><a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> or <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a></span></dt><dd>Returns the appropriate status, as defined
9055 above (<code class="constant">:IO</code> status for <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>)
9056 </dd><dt><span class="term"><code class="code">(<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> . <em class="replaceable"><code>direction</code></em>)</code></span></dt><dd>Return the status in the specified direction
9057 </dd><dt><span class="term">a non-empty list of the above</span></dt><dd>Return a list of values, one for each element of the
9058 argument list (a la <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAR</code></a>)</dd></dl></div><p class="simpara">If you want to avoid <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3] up a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> list, you can
9059 make the elements of <em class="replaceable"><code>socket-stream-or-list</code></em>
9060 to be <span class="data"><code class="literal">(<em class="replaceable"><code>socket-stream</code></em> <em class="replaceable"><code>direction</code></em> .
9061 <em class="replaceable"><code>x</code></em>)</code></span> or <span class="data"><code class="literal">(<em class="replaceable"><code>socket-server</code></em> . <em class="replaceable"><code>x</code></em>)</code></span>.
9062 Then <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> will destructively modify its argument and replace
9063 <em class="replaceable"><code>x</code></em> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> with the status and return the modified list.
9064 You can pass this modified list to <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> again.</p><p class="simpara">The optional arguments specify the timeout. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> means
9065 wait forever, <code class="literal">0</code> means poll.</p><p class="simpara">The second value returned is the number of objects with
9066 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> status, i.e., <span class="quote">“<span class="quote">actionable</span>”</span> objects.
9067 <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> returns either due to a timeout or when this number is
9068 positive, i.e., if the timeout was <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> did
9069 return, then the second value is positive (this is the reason <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
9070 is <span class="strong"><strong>not</strong></span> treated as an empty <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, but as an invalid
9071 argument).</p><p class="simpara">This is the interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a>
9072 (on some platforms, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html"><code class="function">poll</code></a>),
9073 so it will work on any <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> which is based on a
9074 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>, e.g., <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> and <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s, as well as
9075 on <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw sockets</a>.</p></dd><dt><a id="sost-hopo"></a><span class="term"><code class="code">(<a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a> <em class="replaceable"><code>socket-stream</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a> <em class="replaceable"><code>socket-stream</code></em>)</code></span></dt><dd>These two functions return information about the
9076 <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>.</dd><dt><a id="sost-peer"></a><span class="term"><code class="code">(<a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a>
9077 <em class="replaceable"><code>socket-stream</code></em> [<em class="replaceable"><code>do-not-resolve-p</code></em>])</code></span></dt><dd><p class="simpara">Given a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, this function returns the
9078 name of the host on the opposite side of the connection and its port
9079 number; the server-side can use this to see who connected.</p><p class="simpara">When the optional second argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the hostname
9080 resolution is disabled and just the <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> address is returned, without
9081 the <acronym class="acronym" title="Fully Qualified Domain Name">FQDN</acronym>.
9082 </p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
9083 <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="sost-local"></a><span class="term"><code class="code">(<a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a>
9084 <em class="replaceable"><code>socket-stream</code></em> [<em class="replaceable"><code>do-not-resolve-p</code></em>])</code></span></dt><dd><p class="simpara">The dual to <a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a> - same information,
9085 host name and port number, but for the local host.
9086 The difference from <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a> and <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a> is that this function
9087 asks the OS (and thus returns the correct trusted values) while the
9088 other two are just accessors to the internal data structure, and
9089 basically return the arguments given to the function which created
9090 the <em class="replaceable"><code>socket-stream</code></em>.</p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
9091 <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="sost-shut"></a><span class="term"><code class="code">(<a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> <em class="replaceable"><code>socket-stream</code></em>
9092 <em class="replaceable"><code>direction</code></em>)</code></span></dt><dd><p class="simpara">Some protocols provide for closing the connection
9093 in one <em class="replaceable"><code>direction</code></em> using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html"><code class="function">shutdown</code></a>.
9094 This function provides an interface to this <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system call.
9095 <em class="replaceable"><code>direction</code></em> should be <code class="constant">:INPUT</code> or <code class="constant">:OUTPUT</code>. Note that you
9096 should still call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> after you are done with your <em class="replaceable"><code>socket-stream</code></em>; this
9097 is best accomplished by using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a>.</p><p>All <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s (i.e., both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
9098 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">OUTPUT-STREAM-P</code></a> return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for them).
9099 <a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> <span class="emphasis"><em>breaks</em></span> this and turns its argument
9100 stream into an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (if <em class="replaceable"><code>direction</code></em> is <code class="constant">:OUTPUT</code>) or <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (if
9101 <em class="replaceable"><code>direction</code></em> is <code class="constant">:INPUT</code>).
9102 Thus, the following important invariant is preserved: whenever
9103 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is open
9104 (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) and</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
9105 returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</li></ul></div><p>
9106 the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> can be read from (e.g., with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>).
9107 </p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
9108 <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="so-opt"></a><span class="term"><code class="code">(<a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a> <em class="replaceable"><code>socket-server</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
9109 {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">Query and, optionally, set socket options using
9110 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html"><code class="function">getsockopt</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a>.
9111 An <em class="replaceable"><code>option</code></em> is a keyword, optionally followed by the new value.
9112 When the new value is not supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a> is not called.
9113 For each option the old (or current, if new value was not supplied)
9114 value is returned. E.g., <code class="code">(<a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a> <em class="replaceable"><code>socket-server</code></em>
9115 :SO-LINGER 1 :SO-RCVLOWAT)</code> returns 2 values: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the old
9116 value of the <code class="constant">:SO-LINGER</code> option, and 1, the
9117 current value of the <code class="constant">:SO-RCVLOWAT</code> option.
9118 </p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
9119 <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="st-handles"></a><span class="term"><code class="code">(<a class="link" href="#st-handles"><code class="function">EXT:STREAM-HANDLES</code></a>
9120 <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>Return the input and output OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s of the
9121 <em class="replaceable"><code>stream</code></em> as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>. See <a class="xref" href="#rawsock" title="33.17. Raw Socket Access">Section 33.17, “Raw Socket Access”</a>.
9122 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="timeout-k"></a>32.4.3. Argument <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a></h3></div></div></div><p>The <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> argument specifies the number of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a> to wait for
9123 an event. The value may be a</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">a non-negative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> or</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <span class="data"><code class="literal">(sec usec)</code></span>
9124 or</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> cell <span class="data"><code class="literal">(sec .
9125 usec)</code></span>.</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mt"></a>32.5. Multiple Threads of Execution</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span>
9126 configure-time flag <code class="option">--with-threads</code>.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></dd><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>This functionality is <span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>.</p><p>Use it at your own risk.</p><p>Discuss it on <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-intro"></a>32.5.1. Introduction</h3></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the OS threads to implement multiple threads of execution.
9127 Two flavors are supported: <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> and <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>. Both are preemptive.</p><p>All symbols are exported from the package <a class="link" href="#mt" title="32.5. Multiple Threads of Execution"><strong class="package"><span class="quote">“<span class="quote">THREADS</span>”</span></strong></a>, which has nicknames
9128 <strong class="package"><span class="quote">“<span class="quote">MT</span>”</span></strong> (for <span class="emphasis"><em>MultiThreading</em></span>) and
9129 <strong class="package"><span class="quote">“<span class="quote">MP</span>”</span></strong> (for <span class="emphasis"><em>MultiProcessing</em></span>).
9130 When this functionality is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
9131 contains the symbol <code class="constant">:MT</code>.</p><p>See also <a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-general"></a>32.5.2. General principles</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-parallelizability"></a>32.5.2.1. Parallelizability</h4></div></div></div><p>A program developed for a single-threaded world which shares no
9132 application objects with programs running in other threads must run
9133 fine, without problems.</p><p>Specfically:
9134 if, in a single-threaded world, execution of program A before program B
9135 produces semantically the same results as execution of program B before
9136 program A, then in a multithreaded world, it is possible to run A and B
9137 simultaneously in different threads, and the result will be the same as
9138 in the two single-threaded cases (A before B, or B before A).
9139 </p><div class="itemizedlist"><p class="title"><strong>Summary</strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If A and B have no common objects, then the
9140 implementation ensures that the principle is fulfilled.</li><li class="listitem">If A and B share some objects, the implementation
9141 allows the programs to satisfy the principle with little effort.
9142 </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-symvalue"></a>32.5.2.2. Special Variable Values</h4></div></div></div><p>Every <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a> has a global value that can be shared across all
9143 <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s.</p><p>Bindings of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>s (via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a>)
9144 are local to <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s, i.e. every <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> has a different value cell in
9145 each <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>. <a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> can be used to inspect and modify
9146 these thread local bindings.</p><p>Threads do not inherit dynamic bindings from the parent thread.</p><p>Example:</p><pre class="programlisting">
9147 (defvar *global* 1)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">create a <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a></span></em>
9148 (defun thread-1 ()
9149 <strong> ; </strong><em class="lineannotation"><span class="lineannotation">here *global* and (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> *global*) will be 1 not 2!</span></em>
9150 (setq *global* 5)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">change the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value</span></em>
9151 (let ((*global* 10))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is initialized</span></em>
9152 (setq *global* 20)<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is changed</span></em>
9153 <strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value is not accessible here (only via <a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a>)</span></em>
9154 )
9155 (setq *global* 30))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value is modified again</span></em>
9156 (let ((*global* 2))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is initialized</span></em>
9157 (<a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> #'thread-1))
9158 </pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-package"></a>32.5.2.3. Packages</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Locking discussed in this section has nothing to do with
9159 <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a>.</p></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a> objects have an internal <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> and are locked by
9160 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> before adding a symbol (if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-symbol.html" target="_top"><code class="function">FIND-SYMBOL</code></a> fails). All
9161 modifications of internal package data are guarded by this <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.</p><p>While iterating over package symbols with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-SYMBOLS</code></a>,
9162 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-EXTERNAL-SYMBOLS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-ALL-SYMBOLS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-package-iterator.html" target="_top"><code class="function">WITH-PACKAGE-ITERATOR</code></a>
9163 or the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-2-1-7.html">for-as-package
9164 subclause</a> the package being iterated over is also locked.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-clos"></a>32.5.2.4. <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a></h4></div><div><h5 class="subtitle">This information is likely to change in the near future</h5></div></div></div><p><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is <span class="strong"><strong>not</strong></span> thread-safe. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>,
9165 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> modify <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> without any locking and may
9166 interfere with each other.</p><p>It is recommended that all code is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a>ed <span class="strong"><strong>before</strong></span>
9167 any <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s are spawned.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-mutable"></a>32.5.2.5. Hash Tables, Sequences, and other
9168 mutable objects</h4></div><div><h5 class="subtitle">If you want to shoot yourself, it is <span class="emphasis"><em>your</em></span>
9169 responsibility to wear armor.</h5></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></div><p>Nothing is ever locked automatically (automatic locking will
9170 impose an unjustifiable penalty on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a>s
9171 local to threads), so the user must use locks when sharing
9172 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a>s and user-defined mutable objects between
9173 threads.</p><p>This approach is consistent with the usual <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> approach:
9174 </p><div class="blockquote"><table border="0" class="blockquote" style="width: 100%; cellspacing: 0; cellpadding: 0;" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><p>The consequences are undefined when code executed during an
9175 object-traversing operation destructively modifies the object in a
9176 way that might affect the ongoing traversal operation...
9177 </p></td><td width="10%" valign="top"> </td></tr><tr><td width="10%" valign="top"> </td><td colspan="2" align="right" valign="top">--<span class="attribution"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-6.html">[sec_3-6]</a></span></td></tr></table></div><p>
9178 </p><div class="blockquote"><table border="0" class="blockquote" style="width: 100%; cellspacing: 0; cellpadding: 0;" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><p>If an object O1 is used as a key in a hash table H and is then
9179 visibly modified with regard to the equivalence test of H, then the
9180 consequences are unspecified if O1 is used as a key in further
9181 operations on H...</p></td><td width="10%" valign="top"> </td></tr><tr><td width="10%" valign="top"> </td><td colspan="2" align="right" valign="top">--<span class="attribution"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_18-1-2.html">[sec_18-1-2]</a></span></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mt-random"></a>32.5.2.5.1. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a></h5></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> modifies a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a> <span class="strong"><strong>without</strong></span> locking, which
9182 means that you <span class="strong"><strong>cannot</strong></span> carelessly share such objects between threads.
9183 However, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> is bound per-thread (see <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> and
9184 <a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a>), i.e., each thread has its own value and
9185 thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> <span class="strong"><strong>is</strong></span> thread-safe.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-unsafe"></a>32.5.2.6. Examples of thread-unsafe code</h4></div></div></div><p>Here are some forms whose results are undefined if two threads
9186 evaluate them without locking:</p><pre class="programlisting">
9187 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">INCF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> x global-ht 0))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">see <a class="xref" href="#mt-mutable" title="32.5.2.5. Hash Tables, Sequences, and other mutable objects">Section 32.5.2.5, “Hash Tables, Sequences, and other mutable objects”</a></span></em>
9188 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> global-array ...) ...)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">ditto</span></em>
9189 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> <em class="replaceable"><code>generic-function</code></em> (...) ...)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">see <a class="xref" href="#mt-clos" title="32.5.2.4. CLOS">Section 32.5.2.4, “<span class="command"><strong>CLOS</strong></span>”</a></span></em>
9190 </pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The above code may result in a segfault!</p><p>This is the reason why the multithreading support is still
9191 <span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>. However, if you do not share global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
9192 between your threads and define all your <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> methods <span class="strong"><strong>before</strong></span>
9193 spawning threads, multithreading should work fine.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-api"></a>32.5.3. Thread API reference</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="thread"></a><span class="term"><a class="link" href="#thread"><span class="type">MT:THREAD</span></a></span></dt><dd><p class="simpara">The type of the object returned by <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</p><p class="simpara">Each <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> represent a separate computation, executed in
9194 parallel to each other.</p></dd><dt><a id="make-thread"></a><span class="term"><code class="code">(<a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> <em class="replaceable"><code>function</code></em>
9195 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:NAME</code> :INITIAL-BINDINGS :CSTACK-SIZE :VSTACK-SIZE)</code></span></dt><dd><p class="simpara">Start a new named <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> running <em class="replaceable"><code>function</code></em>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:INITIAL-BINDINGS</code></span></dt><dd><p class="simpara">an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of <span class="data"><code class="literal">(<em class="replaceable"><code>symbol</code></em>
9196 . <em class="replaceable"><code>form</code></em>)</code></span>.
9197 The <em class="replaceable"><code>form</code></em>s are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated in the context of the new thread
9198 and <em class="replaceable"><code>symbol</code></em>s are bound to the result in the thread before <em class="replaceable"><code>function</code></em> is
9199 called. The default value is <a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a>.</p><p class="simpara">The main purpose of this argument is to initialize some
9200 global data that should not be shared between threads, e.g.,
9201 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_streadtablest.html" target="_top"><code class="varname">*READTABLE*</code></a>.</p><p class="simpara">When using <code class="constant">:INITIAL-BINDINGS</code> it is
9202 best to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> the application-specific data in front of
9203 <a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a> or copy and modify it to fit the
9204 application needs.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>When the same <em class="replaceable"><code>symbol</code></em> appears in this <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> multiple
9205 times, the <span class="emphasis"><em>first</em></span> occurrence determines the value.
9206 </p></div></dd><dt><span class="term"><code class="constant">:CSTACK-SIZE</code></span></dt><dd>the size in bytes of the control (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) stack.
9207 If 0, the value is decided by the OS.</dd><dt><span class="term"><code class="constant">:VSTACK-SIZE</code></span></dt><dd>the size of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> in <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s.
9208 The default value is calculated based on the <code class="option"><a href="clisp.html#opt-memsize" class="olink">-m</a></code> option
9209 used when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was started.
9210 If 0, the value will be the same as that of the calling thread.
9211 </dd></dl></div><p class="simpara">If <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> creation fails (e.g., due to a lack of system
9212 memory), a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_control-error.html" target="_top"><code class="classname">CONTROL-ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_create.html"><code class="function">pthread_create</code></a>.</p></dd><dt><a id="threadp"></a><span class="term"><code class="code">(<a class="link" href="#threadp"><code class="function">MT:THREADP</code></a> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>.
9213 </dd><dt><a id="thread-yield"></a><span class="term"><code class="code">(<a class="link" href="#thread-yield"><code class="function">MT:THREAD-YIELD</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd><p class="simpara">Relinquish the CPU. The <em class="replaceable"><code>thread</code></em> is placed at the end
9214 of the run queue and another thread is scheduled to run.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html"><code class="function">sched_yield</code></a>.</p></dd><dt><a id="thread-interrupt"></a><span class="term"><code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em>
9215 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:FUNCTION</code> <code class="constant">:OVERRIDE</code> <code class="constant">:ARGUMENTS</code>)</code></span></dt><dd><p class="simpara">Interrupt the normal execution flow in <em class="replaceable"><code>thread</code></em> and ask
9216 it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> <em class="replaceable"><code>function</code></em> to <em class="replaceable"><code>arguments</code></em>.</p><p class="simpara">Use <code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> <code class="constant">:FUNCTION</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code>
9217 to debug <em class="replaceable"><code>thread</code></em> and <code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> <code class="constant">:FUNCTION</code>
9218 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code> to terminate <em class="replaceable"><code>thread</code></em>.</p><p class="simpara">The <code class="constant">:OVERRIDE</code> argument overrides <a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a>
9219 and should be used with extreme care.</p><p class="simpara">Threads can only be interrupted at a point where the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
9220 can run, see <a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p><p class="simpara">Currently on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> blocking I/O cannot be interrupted.
9221 The interrupt will be handled after the call returns.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Thread may be interrupted inside <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>'s
9222 cleanup forms and on non-local exit from <em class="replaceable"><code>function</code></em> -
9223 they may not execute entirely. In order to prevent this,
9224 <a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a> is provided.</p></div></dd><dt><a id="thread-name"></a><span class="term"><code class="code">(<a class="link" href="#thread-name"><code class="function">MT:THREAD-NAME</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <em class="replaceable"><code>thread</code></em>.
9225 </dd><dt><a id="thread-active-p"></a><span class="term"><code class="code">(<a class="link" href="#thread-active-p"><code class="function">MT:THREAD-ACTIVE-P</code></a>
9226 <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd><p class="simpara">Return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the thread has already terminated
9227 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> otherwise.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <em class="replaceable"><code>thread</code></em> may have
9228 already terminated anyway.</p></div></dd><dt><a id="current-thread"></a><span class="term"><code class="code">(<a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>)</code></span></dt><dd>Return the <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> object encapsulating the caller.
9229 </dd><dt><a id="list-threads"></a><span class="term"><code class="code">(<a class="link" href="#list-threads"><code class="function">MT:LIST-THREADS</code></a>)</code></span></dt><dd><p class="simpara">Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all currently running <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s.
9230 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns, the set of
9231 actually running threads may have a single intersection with the
9232 return value - the <a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>.
9233 </p></div></dd><dt><a id="mutex"></a><span class="term"><a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a></span></dt><dd><p class="simpara">The type of the object return by <a class="link" href="#make-mutex"><code class="function">MT:MAKE-MUTEX</code></a>.</p><p class="simpara">This represents a <span class="emphasis"><em>lock</em></span>, i.e., a way to
9234 prevent different threads from doing something at the same time,
9235 e.g., modifying the same object.</p></dd><dt><a id="mutexp"></a><span class="term"><code class="code">(<a class="link" href="#mutexp"><code class="function">MT:MUTEXP</code></a> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.
9236 </dd><dt><a id="make-mutex"></a><span class="term"><code class="code">(<a class="link" href="#make-mutex"><code class="function">MT:MAKE-MUTEX</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9237 <code class="constant">:NAME</code> <code class="constant">:RECURSIVE-P</code>)</code></span></dt><dd><p class="simpara">Create new <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> object - not locked by any thread.
9238 <code class="constant">:NAME</code> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> describing the mutex (this really helps
9239 debugging deadlocks). When <em class="replaceable"><code>RECURSIVE-P</code></em> is
9240 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a recursive <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> is created i.e., a thread can acquire
9241 the mutex repeatedly (and should, of course, release it for each
9242 successful acquisition).</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html"><code class="function">pthread_mutex_init</code></a>.</p></dd><dt><a id="mutex-name"></a><span class="term"><code class="code">(<a class="link" href="#mutex-name"><code class="function">MT:MUTEX-NAME</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.
9243 </dd><dt><a id="mutex-lock"></a><span class="term"><code class="code">(<a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a> <em class="replaceable"><code>mutex</code></em>
9244 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Acquire the <em class="replaceable"><code>mutex</code></em>. If <em class="replaceable"><code>mutex</code></em> is locked by
9245 another thread, the call blocks and waits up to <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.
9246 If <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> is not specified, waits forever.</p><p class="simpara">Return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> on a successful locking of <em class="replaceable"><code>mutex</code></em>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on
9247 timeout.</p><p>If the calling thread has already acquired <em class="replaceable"><code>mutex</code></em>, then
9248 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">if <em class="replaceable"><code>mutex</code></em> is recursive, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> is
9249 returned (for each recursive <a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a> there should be a
9250 separate <a class="link" href="#mutex-unlock"><code class="function">MT:MUTEX-UNLOCK</code></a>);</li><li class="listitem">If <em class="replaceable"><code>mutex</code></em> is non-recursive an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed to
9251 avoid a deadlock.</li></ul></div><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html"><code class="function">pthread_mutex_lock</code></a>.</p></dd><dt><a id="mutex-unlock"></a><span class="term"><code class="code">(<a class="link" href="#mutex-unlock"><code class="function">MT:MUTEX-UNLOCK</code></a>
9252 <em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd><p class="simpara">Release (unlock) <em class="replaceable"><code>mutex</code></em>. If the calling thread is
9253 not locking <em class="replaceable"><code>mutex</code></em>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_unlock.html"><code class="function">pthread_mutex_unlock</code></a>.</p></dd><dt><a id="mutex-owner"></a><span class="term"><code class="code">(<a class="link" href="#mutex-owner"><code class="function">MT:MUTEX-OWNER</code></a>
9254 <em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd><p class="simpara">Return the <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> that owns (locks) <em class="replaceable"><code>mutex</code></em>,
9255 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>mutex</code></em> is not locked.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns the <em class="replaceable"><code>mutex</code></em>
9256 ownership may have changed (unless the owner is the
9257 <a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>). The function is mostly useful for debugging
9258 deadlocks.</p></div></dd><dt><a id="mutex-recursive-p"></a><span class="term"><code class="code">(<a class="link" href="#mutex-recursive-p"><code class="function">MT:MUTEX-RECURSIVE-P</code></a>
9259 <em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd>Return a indicator whether <em class="replaceable"><code>mutex</code></em> is recursive.
9260 </dd><dt><a id="with-mutex-lock"></a><span class="term"><code class="code">(<a class="link" href="#with-mutex-lock"><code class="function">MT:WITH-MUTEX-LOCK</code></a> (<em class="replaceable"><code>mutex</code></em>)
9261 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Execute <em class="replaceable"><code>body</code></em> with <em class="replaceable"><code>mutex</code></em> locked.
9262 Upon exit <em class="replaceable"><code>mutex</code></em> is released. Return whatever <em class="replaceable"><code>body</code></em> returns.
9263 </dd><dt><a id="exemption"></a><span class="term"><a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a></span></dt><dd><p class="simpara">The type of the object returned by <a class="link" href="#make-exemption"><code class="function">MT:MAKE-EXEMPTION</code></a>.
9264 These correspond to the <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> condition variables,
9265 see <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html">&lt;<code class="filename">pthread.h</code>&gt;</a>.</p><p class="simpara">These objects allow broadcasting state from one <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> to
9266 the others.</p></dd><dt><a id="exemptionp"></a><span class="term"><code class="code">(<a class="link" href="#exemptionp"><code class="function">MT:EXEMPTIONP</code></a>
9267 <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a>.
9268 </dd><dt><a id="make-exemption"></a><span class="term"><code class="code">(<a class="link" href="#make-exemption"><code class="function">MT:MAKE-EXEMPTION</code></a>
9269 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:NAME</code>)</code></span></dt><dd><p class="simpara">Create a new <a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a> object.
9270 <code class="constant">:NAME</code> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> describing the exemption (this really
9271 helps debugging deadlocks).</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_init.html"><code class="function">pthread_cond_init</code></a>.</p></dd><dt><a id="exemption-name"></a><span class="term"><code class="code">(<a class="link" href="#exemption-name"><code class="function">MT:EXEMPTION-NAME</code></a>
9272 <em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <em class="replaceable"><code>exemption</code></em>.
9273 </dd><dt><a id="exemption-signal"></a><span class="term"><code class="code">(<a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>
9274 <em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd><p class="simpara">Signal <em class="replaceable"><code>exemption</code></em> object, i.e. wake up a thread blocked
9275 on waiting for <em class="replaceable"><code>exemption</code></em>.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_signal.html"><code class="function">pthread_cond_signal</code></a>.</p></dd><dt><a id="exemption-wait"></a><span class="term"><code class="code">(<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a>
9276 <em class="replaceable"><code>exemption</code></em> <em class="replaceable"><code>mutex</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <code class="constant">:TEST</code>)</code></span></dt><dd><p class="simpara">Wait for another <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> to call <a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>
9277 or <a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a> on <em class="replaceable"><code>exemption</code></em>.
9278 <em class="replaceable"><code>mutex</code></em> should be locked by the caller; otherwise an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
9279 The function releases the <em class="replaceable"><code>mutex</code></em> and waits for <em class="replaceable"><code>exemption</code></em>.
9280 On return <em class="replaceable"><code>mutex</code></em> is acquired again.</p><p class="simpara">When using exemptions there is always a boolean <em class="replaceable"><code>predicate</code></em> involving
9281 shared variables associated with each exemption wait that is true if the
9282 thread should proceed.</p><p class="simpara">The function waits up to <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.
9283 If timeout is not specified, waits forever.</p><p class="simpara">
9284 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <em class="replaceable"><code>exemption</code></em> was signaled and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.</p><p>On <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> it is possible to have
9285 <a class="ulink" href="http://en.wikipedia.org/wiki/Spurious_wakeup" target="_top">spurious
9286 wakeup</a>s, i.e., this function may return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> even though no
9287 thread called <a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a> or <a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>.
9288 Therefore, a common idiom for using this function is: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>
9289 :until (<em class="replaceable"><code>predicate</code></em>) :do (<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> <em class="replaceable"><code>exemption</code></em> <em class="replaceable"><code>mutex</code></em>))</code></p><p class="simpara">The <code class="constant">:TEST</code> argument simplifies this. When supplied,
9290 <a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> returns when either <code class="constant">:TEST</code> <em class="replaceable"><code>predicate</code></em> is satisfied
9291 (always called while <em class="replaceable"><code>mutex</code></em> is held) or when <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> elapses.
9292 The above loop is equivalent to: <code class="code">(<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> <em class="replaceable"><code>exemption</code></em>
9293 <em class="replaceable"><code>mutex</code></em> <code class="constant">:TEST</code> #'<em class="replaceable"><code>predicate</code></em>)</code>.
9294 When <code class="constant">:TEST</code> is supplied, <a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when <em class="replaceable"><code>exemption</code></em> was
9295 signaled and <code class="constant">:TEST</code> <em class="replaceable"><code>predicate</code></em> is satisfied and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.
9296 </p><p class="simpara">This is the preferred and most portable way to wait on
9297 an exemption.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_wait.html"><code class="function">pthread_cond_wait</code></a>.</p></dd><dt><a id="exemption-broadcast"></a><span class="term"><code class="code">(<a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a>
9298 <em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd><p class="simpara">Signal <em class="replaceable"><code>exemption</code></em> to all threads waiting for it.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html"><code class="function">pthread_cond_broadcast</code></a>.
9299 </p></dd><dt><a id="y-or-n-p-timeout"></a><span class="term"><code class="code">(<a class="link" href="#y-or-n-p-timeout"><code class="function">MT:Y-OR-N-P-TIMEOUT</code></a>
9300 seconds default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#y-or-n-p-timeout"><code class="function">MT:YES-OR-NO-P-TIMEOUT</code></a> seconds default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
9301 <em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd>Similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">Y-OR-N-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">YES-OR-NO-P</code></a>, but use
9302 <a class="link" href="#with-timeout"><code class="function">MT:WITH-TIMEOUT</code></a> to return <em class="replaceable"><code>DEFAULT</code></em> when no
9303 reply is given within timeout <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.</dd><dt><a id="with-timeout"></a><span class="term"><code class="code">(<a class="link" href="#with-timeout"><code class="function">MT:WITH-TIMEOUT</code></a>
9304 (seconds <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> timeout-forms) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Execute <em class="replaceable"><code>body</code></em>. If it does not finish for up to
9305 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>, it is interrupted and <em class="replaceable"><code>timeout-forms</code></em>
9306 are executed.</p><p class="simpara">Return the values of the last evaluated form in either
9307 <em class="replaceable"><code>body</code></em> or <em class="replaceable"><code>timeout-forms</code></em>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since on timeout the current thread is interrupted,
9308 special care may be needed for ensuring proper cleanup in <em class="replaceable"><code>body</code></em>.
9309 See <a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> and <a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a>.</p></div></dd><dt><a id="symbol-value-thread"></a><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
9310 (<a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>thread</code></em>) <em class="replaceable"><code>value</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Access or set the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value.
9311 When <em class="replaceable"><code>thread</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, use the <a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>; if it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, use the
9312 <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> binding.
9313 Returns two values: the <em class="replaceable"><code>symbol</code></em> binding and an indicator: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
9314 not bound in the <em class="replaceable"><code>thread</code></em>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if bound, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_makunbound.html" target="_top"><code class="function">MAKUNBOUND</code></a> if
9315 the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> binding was removed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_makunbound.html" target="_top"><code class="function">MAKUNBOUND</code></a>.
9316 </dd><dt><a id="default-special-bindings"></a><span class="term"><a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a></span></dt><dd>The default <code class="constant">:INITIAL-BINDINGS</code>
9317 argument of <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</dd><dt><a id="with-deferred-interrupts"></a><span class="term">
9318 <code class="code">(<a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Defer thread interrupts (but <span class="strong"><strong>not</strong></span> thread
9319 preemption) while <em class="replaceable"><code>body</code></em> is executed. If there is an interrupt
9320 while <em class="replaceable"><code>body</code></em> is run, it is queued and will be executed after
9321 <em class="replaceable"><code>body</code></em> finishes.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Care is needed if waiting or blocking in <em class="replaceable"><code>body</code></em>,
9322 since there is no way to interrupt it (in case of a deadlock).
9323 The macro was added to avoid partial <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>'s cleanup
9324 forms evaluation in case they are interrupted with a non-local exit.
9325 </p></div></dd><dt><a id="thread-join"></a><span class="term"><code class="code">(<a class="link" href="#thread-join"><code class="function">MT:THREAD-JOIN</code></a> <em class="replaceable"><code>thread</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9326 <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Wait for <em class="replaceable"><code>thread</code></em> to terminate and return two values:
9327 <em class="replaceable"><code>thread</code></em>'s <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether <em class="replaceable"><code>thread</code></em>
9328 finished normally or has been interrupted with <a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a>.</p><p class="simpara">This function uses <a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> (and <span class="strong"><strong>not</strong></span>
9329 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html"><code class="function">pthread_join</code></a>), so there are no resource
9330 leaks normally associated with this function.</p><p class="simpara">On timeout, return <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>.</p><p class="simpara">This function can be used repeatedly on the same thread,
9331 so this is the usual way to access the return values of a finished
9332 thread.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quickstart"></a>32.6. Quickstarting delivery with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></div><p>This section describes three ways to turn <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> programs into
9333 executable programs, which can be started as quickly as executables
9334 written in other languages.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-summary"></a>32.6.1. Summary</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can act as a script interpreter.
9335 </dd><dt><span class="term">Desktop environments such as <a class="ulink" href="https://www.kde.org/" target="_top"><span class="platform">KDE</span></a>, <a class="ulink" href="https://www.gnome.org/" target="_top"><span class="platform">Gnome</span></a>,
9336 <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a> or <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</span></dt><dd>Files created with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can be associated with
9337 the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> executable so that clicking on them would make <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
9338 execute the appropriate code.</dd><dt><span class="term"><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> kernel with
9339 <code class="option">CONFIG_BINFMT_MISC=y</code></span></dt><dd>Associate the extensions <code class="filename">#P".fas"</code>
9340 and <code class="filename">#P".lisp"</code> with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>; then you can make the
9341 files executable and run them from the command line.
9342 </dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-multifile"></a>Multi-file applications</h3><p>These three techniques apply to a single <code class="filename">#P".lisp"</code> or
9343 <code class="filename">#P".fas"</code> file. If your application is made up of several
9344 <code class="filename">#P".lisp"</code> or <code class="filename">#P".fas"</code> files, you can simply concatenate them
9345 (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html"><span class="command"><strong>cat</strong></span></a>) into one file; the
9346 techniques then apply to that concatenated file.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-lispless"></a>Lisp-less target</h3><p>These three techniques assume that the target machine has <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
9347 pre-installed and thus you can deliver just your own application, not
9348 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> itself. If you want to deliver applications without assuming
9349 anything about your target box, you have to resort to creating
9350 executable <a href="impnotes.html#image" class="olink">memory image</a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-unix"></a>32.6.2. Scripting with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></h4></div></div></div><p>On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, a text file (<code class="filename">#P".fas"</code> or <code class="filename">#P".lisp"</code>) can
9351 be made executable by adding a first line of the form
9352 </p><pre class="screen">#!<em class="replaceable"><code>interpreter</code></em> [<em class="replaceable"><code>interpreter-arguments</code></em>]</pre><p>
9353 and using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html"><span class="command"><strong>chmod</strong></span></a> to make the file
9354 executable.</p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="script-req"></a>OS Requirements</h4></div></div></div><p>There are two cases:
9355 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>On operating systems where the program
9356 <code class="filename">/usr/bin/env</code> understands the <code class="literal">-S</code>
9357 option – this is the case on <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and <a class="ulink" href="https://www.gnu.org/software/hurd/" target="_top"><span class="platform">Hurd</span></a> distributions
9358 that use the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/coreutils/" target="_top">coreutils</a>, and on <a class="ulink" href="https://www.freebsd.org/" target="_top"><span class="platform">FreeBSD</span></a> –:
9359 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Define the <em class="replaceable"><code>interpreter</code></em> as
9360 <code class="filename">/usr/bin/env</code>.</li><li class="listitem">Define the <em class="replaceable"><code>interpreter-arguments</code></em> as
9361 <code class="literal">-S clisp [<em class="replaceable"><code>clisp-arguments</code></em>]</code>.
9362 </li></ul></div><p>
9363 For example:
9364 </p><pre class="screen">#!/usr/bin/env -S clisp <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> my-image.mem <code class="option"><a href="clisp.html#opt-lang" class="olink">-L</a></code> French</pre><p>
9365 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> will then be looked up in <code class="envar">PATH</code>, and the
9366 <a class="ulink" href="https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html#g_t_002dS_002f_002d_002dsplit_002dstring-usage-in-scripts" target="_top"><code class="literal">-S</code></a>
9367 option causes
9368 <a class="ulink" href="https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html" target="_top"><span class="command"><strong>env</strong></span></a>
9369 to split the <em class="replaceable"><code>interpreter-arguments</code></em> at spaces.</p></li><li class="listitem"><p>Otherwise, a lookup in PATH is not possible; you will
9370 need to use the full pathname of <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> instead. The following
9371 conditions need to be met:
9372 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">The <em class="replaceable"><code>interpreter</code></em> must be the full pathname of <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span>.
9373 The recommended path is <code class="filename">/usr/local/bin/clisp</code>,
9374 and if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is actually installed elsewhere, making
9375 <code class="filename">/usr/local/bin/clisp</code> be a symbolic link to the
9376 real <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span>.</li><li class="listitem">The <em class="replaceable"><code>interpreter</code></em> must be a real executable, not a script.
9377 Unfortunately, in the binary distributions of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> on Solaris,
9378 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> is a shell script because a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler cannot be
9379 assumed to be installed on this platform. If you do have a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
9380 compiler installed, build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> from the source yourself;
9381 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make install</strong></span></a> will install <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> as
9382 a real executable.</li><li class="listitem"><p>On some platforms, the first line which specifies the
9383 interpreter and <em class="replaceable"><code>interpreter-arguments</code></em> is limited in length:
9384 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: square; "><li class="listitem">max. 253 characters on <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>.</li><li class="listitem">max. 513 characters on <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a>.</li><li class="listitem">max. 1025 characters on <a class="ulink" href="https://www.netbsd.org/" target="_top"><span class="platform">NetBSD</span></a>.</li><li class="listitem">max. 125 characters on <a class="ulink" href="https://www.openbsd.org/" target="_top"><span class="platform">OpenBSD</span></a>.</li><li class="listitem">max. 1022 characters on AIX.</li><li class="listitem">max. 1021 characters on Solaris.</li></ul></div><p>
9385 On <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and AIX,
9386 characters exceeding this limit are simply cut off by the system.
9387 On <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a>, <a class="ulink" href="https://www.netbsd.org/" target="_top"><span class="platform">NetBSD</span></a>, <a class="ulink" href="https://www.openbsd.org/" target="_top"><span class="platform">OpenBSD</span></a>, and Solaris,
9388 the script is not executed at all if this line is too long.
9389 There is no workaround: You have to keep the interpreter pathname
9390 and arguments short.</p></li><li class="listitem">On AIX and Solaris, only the first
9391 <em class="replaceable"><code>interpreter-arg</code></em> is passed to the <em class="replaceable"><code>interpreter</code></em>.
9392 In order to pass more than one option (for example, <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> and
9393 <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code>) to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, separate them with
9394 <a class="ulink" href="http://www.fileformat.info/info/unicode/char/00a0/" target="_top">no-break
9395 spaces</a> instead of normal spaces. (But the separator between
9396 <em class="replaceable"><code>interpreter</code></em> and <em class="replaceable"><code>interpreter-arguments</code></em> must still be a normal space!) <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
9397 will split the <em class="replaceable"><code>interpreter-arguments</code></em> both at no-break spaces and at normal spaces.
9398 </li></ul></div><p>
9399 </p></li></ul></div><p>
9400 </p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="script-arg-split"></a>How <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> handles
9401 <em class="replaceable"><code>interpreter-arguments</code></em>.</h4></div></div></div><p><a id="script-shebang"></a><strong>Shebang. </strong>The <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>
9402 <a class="ulink" href="https://en.wikipedia.org/wiki/Shebang_(Unix)" target="_top">Shebang</a>
9403 <a class="ulink" href="https://en.wikipedia.org/wiki/Interpreter_directive" target="_top">interpreter
9404 directive</a> consists of <span class="strong"><strong>one</strong></span> <em class="replaceable"><code>interpreter</code></em> path and <span class="strong"><strong>one</strong></span>
9405 <em class="replaceable"><code>interpreter-arguments</code></em> string. This means that if the script
9406 <code class="filename">"my-script.lisp"</code> starts with
9407 </p><pre class="screen">#!/usr/local/bin/clisp <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> my-image.mem <code class="option"><a href="clisp.html#opt-lang" class="olink">-L</a></code> French</pre><p>
9408 the OS will pass <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> the following <span class="strong"><strong>two</strong></span> arguments:
9409 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="literal">"-C -M my-image.mem -L
9410 French"</code></li><li class="listitem"><code class="literal">"./my-script.lisp"</code></li></ol></div><p> instead of the
9411 <span class="strong"><strong>six</strong></span> arguments:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="literal">"-C"</code></li><li class="listitem"><code class="literal">"-M"</code></li><li class="listitem"><code class="literal">"my-image.mem"</code></li><li class="listitem"><code class="literal">"-L"</code></li><li class="listitem"><code class="literal">"French"</code></li><li class="listitem"><code class="literal">"./my-script.lisp"</code></li></ol></div><p> that the similar command line would generate.</p><p><a id="script-split"></a><strong>Argument Splitting. </strong><span class="emphasis"><em>This means that <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <span class="strong"><strong>may</strong></span>
9412 need to split its first argument on spaces.</em></span> In fact, <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span>
9413 does split its first argument when it starts with a dash.</p><p><a id="script-dash"></a><strong>Scripts named with a leading dash. </strong>When executing a script named, say, <code class="filename">-leading dash.lisp</code>:
9414 </p><pre class="screen"><strong><code class="prompt">$</code></strong> "-leading dash.lisp" maybe with args</pre><p>
9415 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> receives as its first argument either an absolute path
9416 <code class="filename">"/home/you/bin/-leading dash.lisp"</code> or a relative path
9417 <code class="filename">"./-leading dash.lisp"</code> - either way it does <span class="strong"><strong>not</strong></span>
9418 start with a dash and thus will <span class="strong"><strong>not</strong></span> be split.
9419 If, however, the script is run like this:
9420 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> "-leading dash.lisp" args</pre><p>
9421 the file name argument <code class="literal">"-leading dash.lisp"</code>
9422 <span class="emphasis"><em>will be split</em></span> into <span class="strong"><strong>two</strong></span> arguments
9423 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="literal">"-leading"</code></li><li class="listitem"><code class="literal">"dash.lisp"</code></li></ol></div><p> and will fail.
9424 There are two workarounds to this problem:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Do <span class="strong"><strong>not</strong></span> use dash as the first character in the file name.
9425 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> is <span class="strong"><strong>not</strong></span> the only command that will have problems. Rename them:
9426 </p><pre class="screen"><strong><code class="prompt">$</code></strong> mv "./-leading dash.lisp" "something sensible.lisp"</pre><p>
9427 </p></li><li class="listitem"><p>Pass the relative path on the
9428 command line:</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> "./-leading dash.lisp" args</pre><p>
9429 </p></li></ol></div></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="script-exec"></a>Script execution</h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <a href="clisp.html#opt-exec-file" class="olink">script</a> should contain Lisp
9430 forms, except in the <code class="literal">#!</code> line.</li><li class="listitem">The file is loaded normally, through the function
9431 <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> (in particular, the name of the script file, which
9432 is <code class="envar">$0</code> in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>, can be found in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-TRUENAME*</code></a> and
9433 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-PATHNAME*</code></a>).</li><li class="listitem">Before it is loaded, the variable <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> is bound
9434 to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, representing the arguments given to the
9435 Lisp script (i.e., <code class="envar">$1</code> in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> becomes <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">FIRST</code></a>
9436 <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)</code> etc).</li><li class="listitem">The standard <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> i/o facilities (see <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html">&lt;<code class="filename">stdio.h</code>&gt;</a>)
9437 are used: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> is bound to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>,
9438 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a>.
9439 Note <a class="xref" href="#dribble-script" title="25.2.11.1. Scripting and DRIBBLE">Section 25.2.11.1, “Scripting and <code class="function">DRIBBLE</code>”</a>.</li><li class="listitem">The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s will be turned into <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>s
9440 (using <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>).</li><li class="listitem">Non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s and <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span> interrupts will
9441 terminate the execution of the Lisp script with an error status
9442 (using <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>).</li><li class="listitem">If you wish the script's contents to be compiled
9443 during loading, add <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> to the <em class="replaceable"><code>interpreter-arguments</code></em>.
9444 </li></ul></div></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="script-bad"></a>If nothing works</h4></div></div></div><p>Another, quite inferior, alternative is to put the following into a file:
9445 </p><pre class="programlisting">
9446 #!<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>
9447 exec <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> &lt;&lt;EOF
9448 (lisp-form)
9449 (another-lisp-form)
9450 (yet-another-lisp-form)
9451 EOF
9452 </pre><p>
9453 The problem with this approach is that the return values of each form
9454 will be printed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>.
9455 Another problem is that no user input will be available.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-desktop"></a>32.6.3. Desktop Environments</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>, <a class="ulink" href="https://www.gnome.org/" target="_top"><span class="platform">Gnome</span></a>, <a class="ulink" href="https://www.kde.org/" target="_top"><span class="platform">KDE</span></a>, <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a>
9456 desktop platforms only.</span></span></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-desktop-win32"></a>Notations</h3><p>Although we use <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>-specific notation, these techniques work
9457 on other desktop environments as well.</p></div><p>There are two different ways to make <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
9458 <span class="quote">“<span class="quote">executables</span>”</span> on desktop platforms.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Associate the <code class="filename">#P".mem"</code> extension with
9459 <span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> "%s"</strong></span>.
9460 </li><li class="listitem">Associate the <code class="filename">#P".fas"</code> extension with
9461 <span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> "%s"</strong></span>
9462 Alternatively, you may want to have a function
9463 <code class="function">main</code> in your <code class="filename">#P".fas"</code> files and associate
9464 the <code class="filename">#P".fas"</code> extension with <span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code>
9465 %s <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> (main)</strong></span>.
9466 </li></ol></div><p>Then clicking on the compiled lisp file (with <code class="filename">#P".fas"</code>
9467 extension) will load the file (thus executing all the code in the
9468 file), while the clicking on a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#image" class="olink">memory image</a> (with <code class="filename">#P".mem"</code>
9469 extension) will start <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the given <a href="impnotes.html#image" class="olink">memory image</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>On <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is distributed with a file
9470 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/install.bat"><code class="filename">src/install.bat</code></a>, which
9471 runs <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/install.lisp"><code class="filename">src/install.lisp</code></a> to create a
9472 file <code class="filename">clisp.lnk</code> on your desktop and also associates
9473 <code class="filename">#P".fas"</code>, <code class="filename">#P".lisp"</code>, and <code class="filename">#P".mem"</code> files with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-linux"></a>32.6.4. Associating extensions with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> via kernel</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> platforms only.
9474 </span></span></h4></div></div></div><p>You have to build your kernel with
9475 <code class="option">CONFIG_BINFMT_MISC=y</code> and
9476 <code class="option">CONFIG_PROC_FS=y</code>. Then you will have a
9477 <code class="filename">/proc/sys/fs/binfmt_misc/</code> directory and you will
9478 be able to do (as <code class="literal">root</code>; you might want to put
9479 these lines into <code class="filename">/etc/rc.d/rc.local</code>):
9480
9481 </p><pre class="screen"><strong><code class="prompt">#</code></strong> echo ":CLISP:E::fas::/usr/local/bin/clisp:" &gt;&gt; /proc/sys/fs/binfmt_misc/register
9482 <strong><code class="prompt">#</code></strong> echo ":CLISP:E::lisp::/usr/local/bin/clisp:" &gt;&gt; /proc/sys/fs/binfmt_misc/register</pre><p>Then you can do the following:
9483 </p><pre class="screen"><strong><code class="prompt">$</code></strong> cat &lt;&lt; EOF &gt; hello.lisp
9484 (print "hello, world!")
9485 EOF
9486 <strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> hello.lisp
9487 ;; Compiling file hello.lisp ...
9488 ;; Wrote file hello.fas
9489 0 errors, 0 warnings
9490 <strong><code class="prompt">$</code></strong> chmod +x hello.fas
9491 <strong><code class="prompt">$</code></strong> hello.fas
9492
9493 "hello, world!"</pre><p>Please read
9494 <a class="ulink" href="https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst" target="_top">
9495 <code class="filename">/usr/src/linux/Documentation/binfmt_misc.txt</code></a>
9496 for details.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="shell"></a>32.7. Shell, Pipes and Printing</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></div><p>This section describes how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can invoke external
9497 executables and communicate with the resulting processes.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="exec"></a>32.7.1. Shell</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a> <em class="replaceable"><code>program</code></em>
9498 <em class="replaceable"><code>arg<sub>1</sub></code></em>
9499 <em class="replaceable"><code>arg<sub>2</sub></code></em> ...)</code>
9500 executes an external program.
9501 Its name is <em class="replaceable"><code>program</code></em> (a full pathname).
9502 It is given the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s <em class="replaceable"><code>arg<sub>1</sub></code></em>,
9503 <em class="replaceable"><code>arg<sub>2</sub></code></em>, ... as arguments.
9504 </dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p class="simpara"><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> [<em class="replaceable"><code>command</code></em>])</code>
9505 calls the operating system's shell.</p><p class="simpara"><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a>)</code> calls the shell for interactive use.</p><p><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> <em class="replaceable"><code>command</code></em>)</code> calls the shell
9506 only for execution of the one given <em class="replaceable"><code>command</code></em>, which can be a
9507 complex expression: </p><pre class="programlisting">
9508 (<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> "for x in 1 2 3; do echo $x; done")
9509 1
9510 2
9511 3
9512 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code></pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a> is called on the value of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
9513 <code class="envar">SHELL</code> if used interactively;
9514 <span class="command"><strong><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> -c <em class="replaceable"><code>command</code></em></strong></span> if used non-interactively.
9515 </dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=CreateProcess"><code class="function">CreateProcess</code></a> is
9516 called on <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> <em class="replaceable"><code>command</code></em> (<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> <code class="envar">COMSPEC</code>))</code>
9517 </dd></dl></div></dd><dt><a id="run-prog"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p class="simpara">The functions <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> and <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> are the
9518 general interface to <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> and the above:</p><p class="simpara"><code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9519 <code class="constant">:MAY-EXEC</code> <code class="constant">:INDIRECTP</code>
9520 <code class="constant">:INPUT</code> <code class="constant">:OUTPUT</code> <code class="constant">:IF-OUTPUT-EXISTS</code> <code class="constant">:WAIT</code>)</code>
9521 runs a shell command (including shell built-in commands,
9522 like <span class="command"><strong>DIR</strong></span> on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
9523 and <span class="command"><strong>for/do/done</strong></span> on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>).</p><p class="simpara"><code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> <em class="replaceable"><code>program</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9524 <code class="constant">:MAY-EXEC</code> <code class="constant">:INDIRECTP</code>
9525 <code class="constant">:ARGUMENTS</code> <code class="constant">:INPUT</code> <code class="constant">:OUTPUT</code> <code class="constant">:IF-OUTPUT-EXISTS</code> <code class="constant">:WAIT</code>)</code>
9526 runs an external program.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>command</code></em></span></dt><dd>the shell command.</dd><dt><span class="term"><em class="replaceable"><code>program</code></em></span></dt><dd>the program. The directories listed in the
9527 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">PATH</code> will be searched for it.
9528 </dd><dt><span class="term"><code class="constant">:ARGUMENTS</code></span></dt><dd>a list of arguments (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s) that are given
9529 to the program.</dd><dt><span class="term"><code class="constant">:INPUT</code></span></dt><dd>where the program's input is to come from: either
9530 <code class="constant">:TERMINAL</code> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>, the default) or
9531 <code class="constant">:STREAM</code> (a Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> to be created) or
9532 a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> (an input file) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (no input at all).
9533 </dd><dt><span class="term"><code class="constant">:OUTPUT</code></span></dt><dd>where the program's output is to be sent to: either
9534 <code class="constant">:TERMINAL</code> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>, the default) or
9535 <code class="constant">:STREAM</code> (a Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> to be created) or
9536 a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> (an output file) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (ignore the output).
9537 </dd><dt><span class="term"><code class="constant">:IF-OUTPUT-EXISTS</code></span></dt><dd>what to do if the <code class="constant">:OUTPUT</code> file already exists.
9538 The possible values are <code class="constant">:OVERWRITE</code>, <code class="constant">:APPEND</code>, <code class="constant">:ERROR</code>,
9539 with the same meaning as for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>. The default is <code class="constant">:OVERWRITE</code>.
9540 </dd><dt><span class="term"><code class="constant">:WAIT</code></span></dt><dd>whether to wait for program termination or not
9541 (this is useful when no i/o to the process is needed);
9542 the default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, i.e., synchronous execution.
9543 </dd><dt><span class="term"><code class="constant">:MAY-EXEC</code></span></dt><dd>pass <span class="command"><strong>exec</strong></span> to the underlying
9544 shell (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> only).</dd><dt><span class="term"><code class="constant">:INDIRECTP</code></span></dt><dd>use a shell to run the command, e.g.,
9545 <code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> "dir" :indirectp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>
9546 will run the shell built-in command <span class="command"><strong>DIR</strong></span>.
9547 This argument defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> and to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a>.
9548 (<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).</dd></dl></div><p>If <code class="constant">:STREAM</code> was specified for <code class="constant">:INPUT</code> or <code class="constant">:OUTPUT</code>, a Lisp
9549 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is returned.
9550 If <code class="constant">:STREAM</code> was specified for both <code class="constant">:INPUT</code> and <code class="constant">:OUTPUT</code>, three
9551 Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s are returned, as for the function <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>.
9552 Otherwise, the return value depends on the process termination status:
9553 if it exited on a signal or a core-dump,
9554 the signal number is returned as a negative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>,
9555 else, if it ended normally with 0 exit status, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned;
9556 otherwise, the status is returned as a positive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p>This use of <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> can cause
9557 <a class="link" href="#deadlock" title="Warning">deadlocks</a>, see <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pipe"></a>32.7.2. Pipes</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-INPUT-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
9558 <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will supply the output
9559 from the execution of the given operating system command.
9560 </dd><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-OUTPUT-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
9561 <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will pass its output as
9562 input to the execution of the given operating system command.
9563 </dd><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
9564 <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd><p class="simpara">returns three values.
9565 The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will simultaneously pass its output
9566 as input to the execution of the given operating system command and
9567 supply the output from this command as input.
9568 The second and third value are the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that
9569 make up the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, respectively.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>These three streams must be closed individually, see
9570 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss052.html" target="_top">CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY</a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="deadlock"></a>Warning</h3><p>Improper use of this function
9571 can lead to <span class="emphasis"><em>deadlocks</em></span>.
9572 Use it at your own risk!</p><p>A deadlock occurs if the command and your Lisp program either
9573 both try to read from each other at the same time or both try to
9574 write to each other at the same time.</p><p>To avoid deadlocks, it is recommended that you fix a
9575 protocol between the command and your program and avoid any hidden
9576 buffering: use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>,
9577 <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> on the input side, and
9578 complete every output operation by a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a>.
9579 The same precautions must apply to the called command as well.
9580 </p></div></dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="hardcopy"></a>32.7.3. Printing</h3></div></div></div><p>The macro
9581 <strong class="first"><em class="firstterm"><a class="link" href="#hardcopy" title="32.7.3. Printing"><code class="function">EXT:WITH-OUTPUT-TO-PRINTER</code></a><a id="with-print" class="indexterm"></a></em></strong>:
9582 </p><pre class="programlisting">
9583 (<a class="link" href="#hardcopy" title="32.7.3. Printing"><code class="function">EXT:WITH-OUTPUT-TO-PRINTER</code></a> (<em class="replaceable"><code>variable</code></em> [<a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>])
9584 {<em class="replaceable"><code>declaration</code></em>}*
9585 {<em class="replaceable"><code>form</code></em>}*)
9586 </pre><p>
9587 binds the variable <em class="replaceable"><code>variable</code></em> to an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
9588 that sends its output to the printer.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="os-env"></a>32.8. Operating System Environment</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#os">32.8.1. Operating System Identification</a></span></dt><dt><span class="section"><a href="#getenv">32.8.2. Environment Variables</a></span></dt></dl></div><p>This section describes how to get information about the environment
9589 on the machine on which <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is running.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="os"></a>32.8.1. Operating System Identification</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="link" href="#os" title="32.8.1. Operating System Identification"><code class="function">EXT:OPERATING-SYSTEM-TYPE</code></a>)</code></span></dt><dd><p>Returns the operating system (kernel) name. The value
9590 is a string, similar to the result of <code class="code">uname -s</code>. Possible
9591 values include:
9592 <code class="code">Linux</code> (on GNU/Linux, on musl libc systems, and on
9593 Android systems),
9594 <code class="code">GNU/Hurd</code>,
9595 <code class="code">GNU/kFreeBSD</code>,
9596 <code class="code">Darwin</code> (on <a class="ulink" href="https://www.apple.com/macos/" target="_top"><span class="platform">Mac OS X</span></a> systems),
9597 <code class="code">FreeBSD</code> (on <a class="ulink" href="https://www.freebsd.org/" target="_top"><span class="platform">FreeBSD</span></a> systems),
9598 <code class="code">DragonFly</code>,
9599 <code class="code">NetBSD</code> (on <a class="ulink" href="https://www.netbsd.org/" target="_top"><span class="platform">NetBSD</span></a> systems),
9600 <code class="code">OpenBSD</code> (on <a class="ulink" href="https://www.openbsd.org/" target="_top"><span class="platform">OpenBSD</span></a> systems),
9601 <code class="code">CYGWIN</code>,
9602 <code class="code">Haiku</code>,
9603 <code class="code">Minix</code>,
9604 <code class="code">SunOS</code> (on Solaris systems),
9605 <code class="code">AIX</code>,
9606 <code class="code">Windows</code>.
9607 Other values are possible as well.</p></dd><dt><span class="term"><code class="code">(<a class="link" href="#os" title="32.8.1. Operating System Identification"><code class="function">EXT:OPERATING-SYSTEM-VERSION</code></a>)</code></span></dt><dd><p>Returns the operating system (kernel) version. The
9608 value is a string, similar to the result of
9609 <code class="code">uname -r</code>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="getenv"></a>32.8.2. Environment Variables</h3></div></div></div><p>Most modern operating systems support <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s that associate
9610 strings (<span class="quote">“<span class="quote">variables</span>”</span>) with other strings
9611 (<span class="quote">“<span class="quote">values</span>”</span>). These variables are somewhat similar to the
9612 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> variables in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>: their values are inherited by the
9613 processes from their parent process.</p><p>You can access your OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s using the function
9614 <code class="code">(<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>string</code></em>)</code>,
9615 where <em class="replaceable"><code>string</code></em> is the name of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>.
9616 When <em class="replaceable"><code>string</code></em> is omitted or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s and their values
9617 are returned in an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</p><p>You can change the value of existing <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s or create new ones
9618 using <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> <em class="replaceable"><code>string</code></em>) <em class="replaceable"><code>new-value</code></em>)</code>.</p><p>Use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> <em class="replaceable"><code>string</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> to remove an
9619 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <em class="replaceable"><code>string</code></em>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-modules"></a>Chapter 33. Extensions Implemented as Modules</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dd><dl><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dd><dl><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dd><dl><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></dd><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></dd><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></dd><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></dd><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="asdf"></a>33.1. A System Definition Facility</h2></div></div></div><p>This module offers a system definition facility (similar to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>).
9620 It is based on <a class="ulink" href="https://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> 3.3.6.7.</p><p>Additionally, it hooks into <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> using <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a>.
9621 This way, requiring a module causes <a class="ulink" href="https://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> to load the corresponding system.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the symbols
9622 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:ASDF3.3</code></td></tr><tr><td><code class="constant">:ASDF3.2</code></td></tr><tr><td><code class="constant">:ASDF3.1</code></td></tr><tr><td><code class="constant">:ASDF3</code></td></tr><tr><td><code class="constant">:ASDF2</code></td></tr><tr><td><code class="constant">:ASDF</code></td></tr></table><p>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="syscalls"></a>33.2. System Calls</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></div><p>The <a class="link" href="#syscalls" title="33.2. System Calls"><strong class="package"><span class="quote">“<span class="quote">POSIX</span>”</span></strong></a> module makes some system calls available from lisp.
9623 Not all of these system calls are actually <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a>, so this package has a
9624 nickname <strong class="package"><span class="quote">“<span class="quote">OS</span>”</span></strong>. If the package prefix is
9625 not specified below, the symbol resides in this package.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
9626 contains the symbol <code class="constant">:SYSCALLS</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="neworking"></a>33.2.1. Networking</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="resolve-host"></a><span class="term"><code class="code">(<a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a>
9627 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>host</code></em>)</code></span></dt><dd><p>Returns the <span class="type">HOSTENT</span> structure:
9628 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>name</code></em></span></dt><dd>host name</dd><dt><span class="term"><em class="structfield"><code>aliases</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of aliases</dd><dt><span class="term"><em class="structfield"><code>addr-list</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> addresses as dotted quads (for IPv4)
9629 or coloned octets (for IPv6)</dd><dt><span class="term"><em class="structfield"><code>addrtype</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> address type (IPv4 or IPv6)
9630 </dd></dl></div><p>
9631 When <em class="replaceable"><code>host</code></em> is omitted or <code class="constant">:DEFAULT</code>, return the data for the
9632 current host. When <em class="replaceable"><code>host</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all the
9633 host database is returned as a list (this would be the contents of the
9634 <code class="filename">/etc/hosts</code> file on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system or
9635 <code class="filename">${windir}/system32/etc/hosts</code> on a <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> system).
9636 </p><p class="simpara">This is an interface
9637 to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostent.html"><code class="function">gethostent</code></a>,
9638 <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=gethostbyname"><code class="function">gethostbyname</code></a>,
9639 and <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=gethostbyaddr"><code class="function">gethostbyaddr</code></a>.</p></dd><dt><a id="service"></a><span class="term"><code class="code">(OS:SERVICE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
9640 <em class="replaceable"><code>service-name</code></em> <em class="replaceable"><code>protocol</code></em>)</code></span></dt><dd><p class="simpara">A convenience function for looking up a port given
9641 the service name, such as <span class="quote">“<span class="quote">WWW</span>”</span> or <span class="quote">“<span class="quote">FTP</span>”</span>.
9642 It returns the <span class="type">SERVICE</span> structure
9643 (name, list of aliases, port, protocol) for the given
9644 <em class="replaceable"><code>service-name</code></em> and <em class="replaceable"><code>protocol</code></em>,
9645 or all services as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> if <em class="replaceable"><code>service-name</code></em>
9646 is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">This is an interface
9647 to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservent.html"><code class="function">getservent</code></a>,
9648 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyname.html"><code class="function">getservbyname</code></a>,
9649 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyport.html"><code class="function">getservbyport</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="file-system"></a>33.2.2. File system</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="file-stat"></a><span class="term"><code class="code">(POSIX:FILE-STAT
9650 <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>link-p</code></em>)</code></span></dt><dd><p>Return the <span class="type">FILE-STAT</span> structure.
9651 <em class="replaceable"><code>pathname</code></em> can be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a
9652 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> (on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system, meaning <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>).
9653 The first slot of the structure returned is the string or the
9654 number on which <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a>,
9655 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a>,
9656 or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html"><code class="function">lstat</code></a> was called.
9657 The other slots are numbers, members of the <span class="type">struct stat</span>:
9658 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>dev</code></em></span></dt><dd>Device ID of device containing file.
9659 </dd><dt><span class="term"><em class="structfield"><code>ino</code></em></span></dt><dd>File serial number.
9660 </dd><dt><span class="term"><em class="structfield"><code>mode</code></em></span></dt><dd>Mode of file.
9661 </dd><dt><span class="term"><em class="structfield"><code>nlink</code></em></span></dt><dd>Number of hard links to the file.
9662 </dd><dt><span class="term"><em class="structfield"><code>uid</code></em></span></dt><dd>User ID of file.
9663 </dd><dt><span class="term"><em class="structfield"><code>gid</code></em></span></dt><dd>Group ID of file.
9664 </dd><dt><span class="term"><em class="structfield"><code>rdev</code></em></span></dt><dd>Device ID (if file is character or block
9665 special).</dd><dt><span class="term"><em class="structfield"><code>size</code></em></span></dt><dd>For regular files, the file size in bytes.
9666 For symbolic links, the length in bytes of the pathname contained
9667 in the symbolic link.
9668 For a shared memory object, the length in bytes.
9669 For a typed memory object, the length in bytes.
9670 For other file types, the use of this field is unspecified.
9671 </dd><dt><span class="term"><em class="structfield"><code>atime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last access.
9672 </dd><dt><span class="term"><em class="structfield"><code>mtime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last data modification.
9673 </dd><dt><span class="term"><em class="structfield"><code>ctime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last status change
9674 (on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> - creation time).</dd><dt><span class="term"><em class="structfield"><code>blksize</code></em></span></dt><dd>A file system-specific preferred I/O block size
9675 for this object. In some file system types, this may vary from
9676 file to file.</dd><dt><span class="term"><em class="structfield"><code>blocks</code></em></span></dt><dd>Number of blocks allocated for this object.
9677 </dd></dl></div><p>
9678 All slots are read-only.</p><p class="simpara">If the system does not support a particular field (e.g.,
9679 <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> prior to 2000 does not have hard links), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (or the
9680 default, like 1 for the number of hard links for old <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>) is
9681 returned.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><span class="platform">Win32</span> platform only.</h3><p>Normally, one would expect <code class="code">(POSIX:FILE-STAT
9682 "foo")</code> and <code class="code">(POSIX:FILE-STAT (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> "foo"))</code> to
9683 return <span class="quote">“<span class="quote">similar</span>”</span> objects (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>ing a file changes its
9684 access time though). This is <span class="strong"><strong>not</strong></span> the case on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>, where
9685 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> works but <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a> does <span class="strong"><strong>not</strong></span>.
9686 Specifically, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a> requires an <span class="type">int</span> argument of an unknown
9687 nature, and it is not clear how do deduce it from the <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> file handle.
9688 Therefore, instead of always failing on open <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> arguments,
9689 this function calls
9690 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetFileInformationByHandle"><code class="function">GetFileInformationByHandle</code></a> and
9691 fills the <span class="type">FILE-STAT</span> return value based on that.
9692 </p></div></dd><dt><a id="set-file-stat"></a><span class="term"><code class="code">(POSIX:SET-FILE-STAT
9693 <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :ATIME :MTIME :MODE :UID :GID)</code></span></dt><dd>Set some file attributes using
9694 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html"><code class="function">chmod</code></a>,
9695 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html"><code class="function">chown</code></a>,
9696 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html"><code class="function">utime</code></a>.
9697 </dd><dt><a id="stat-vfs"></a><span class="term"><code class="code">(POSIX:STAT-VFS <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd><p>Return a <span class="type">STAT-VFS</span> structure.
9698 <em class="replaceable"><code>pathname</code></em> can be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a
9699 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> (on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system, meaning <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>).
9700 The first slot of the structure returned is the string
9701 or the number on which <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html"><code class="function">statvfs</code></a> or
9702 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html"><code class="function">fstatvfs</code></a> was called.
9703 The other slots are members of the <span class="type">struct statvfs</span>:
9704 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>bsize</code></em></span></dt><dd>File system block size.
9705 </dd><dt><span class="term"><em class="structfield"><code>frsize</code></em></span></dt><dd>Fundamental file system block size.
9706 </dd><dt><span class="term"><em class="structfield"><code>blocks</code></em></span></dt><dd>Total number of blocks on file system in units of
9707 <em class="structfield"><code>frsize</code></em>.</dd><dt><span class="term"><em class="structfield"><code>bfree</code></em></span></dt><dd>Total number of free blocks.
9708 </dd><dt><span class="term"><em class="structfield"><code>bavail</code></em></span></dt><dd>Number of free blocks available to
9709 non-privileged processes.</dd><dt><span class="term"><em class="structfield"><code>files</code></em></span></dt><dd>Total number of file serial numbers.
9710 </dd><dt><span class="term"><em class="structfield"><code>ffree</code></em></span></dt><dd>Total number of free file serial numbers.
9711 </dd><dt><span class="term"><em class="structfield"><code>favail</code></em></span></dt><dd>Number of file serial numbers available to
9712 non-privileged processes.</dd><dt><span class="term"><em class="structfield"><code>fsid</code></em></span></dt><dd>File system ID.</dd><dt><span class="term"><em class="structfield"><code>flag</code></em></span></dt><dd>List of platform-dependent values, such as <code class="constant">:READ-ONLY</code>.
9713 </dd><dt><span class="term"><em class="structfield"><code>namemax</code></em></span></dt><dd>Maximum filename length.
9714 </dd><dt><span class="term"><em class="structfield"><code>vol-name</code></em></span></dt><dd>Volume name (<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).
9715 </dd><dt><span class="term"><em class="structfield"><code>fs-type</code></em></span></dt><dd>File system type (<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).
9716 </dd></dl></div><p>
9717 All slots are read-only.
9718 </p></dd><dt><a id="chroot"></a><span class="term"><code class="code">(POSIX:CHROOT <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd><p class="simpara">Change the apparent disk root directory for the current
9719 running process (and its children) using
9720 <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=chroot"><code class="function">chroot</code></a>.</p><p class="simpara">Unless the process has superuser privileges, the operation will
9721 probably fail with <code class="constant">EPERM</code>.</p></dd><dt><a id="file-tree-walk"></a><span class="term"><code class="code">(POSIX:FILE-TREE-WALK <em class="replaceable"><code>pathname</code></em>
9722 <em class="replaceable"><code>function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> FD-LIMIT CHDIR DEPTH MOUNT PHYS)</code></span></dt><dd><p>For each object under <em class="replaceable"><code>pathname</code></em> calls <em class="replaceable"><code>function</code></em> with 5
9723 arguments: </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">the pathname of the object</li><li class="listitem">the <span class="type">FILE-STAT</span> instance containing
9724 information on the object (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, see below)</li><li class="listitem"><p>a keyword giving additional information.
9725 Its value is one of the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:F</code></span></dt><dd>The object is a file.
9726 </dd><dt><span class="term"><code class="constant">:D</code></span></dt><dd>The object is a directory.
9727 </dd><dt><span class="term"><code class="constant">:DP</code></span></dt><dd>The object is a directory and subdirectories have
9728 been visited. (This condition shall only occur if the
9729 <code class="constant">:DEPTH</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
9730 </dd><dt><span class="term"><code class="constant">:SL</code></span></dt><dd>The object is a symbolic link. (This condition shall
9731 only occur if the <code class="constant">PHYS</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
9732 </dd><dt><span class="term"><code class="constant">:SLN</code></span></dt><dd>The object is a symbolic link that does not name an
9733 existing file. (This condition shall only occur if the
9734 <code class="constant">PHYS</code> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
9735 </dd><dt><span class="term"><code class="constant">:DNR</code></span></dt><dd>The object is a directory that cannot be read.
9736 The fn function shall not be called for any of its descendants.
9737 </dd><dt><span class="term"><code class="constant">:NS</code></span></dt><dd> The <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> function
9738 failed on the object because of lack of appropriate permission.
9739 The <span class="type">FILE-STAT</span> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
9740 If <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> fails for any other reason,
9741 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</dd></dl></div><p>
9742 </p></li><li class="listitem">the offset of the object's filename in the pathname
9743 passed as the first argument to <em class="replaceable"><code>function</code></em>.</li><li class="listitem">the depth relative to the root of the walk,
9744 where the root level is 0.</li></ol></div><p class="simpara">As soon as <em class="replaceable"><code>function</code></em> returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, this function returns that
9745 value; if <em class="replaceable"><code>function</code></em> always returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then this function also returns
9746 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when the file tree is exhausted.</p><p class="simpara">The <code class="constant">:FD-LIMIT</code> argument defaults to 5.</p><p class="simpara">If <code class="constant">:CHDIR</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
9747 shall change the current working directory to each directory as it reports
9748 files in that directory</p><p class="simpara">If <code class="constant">:DEPTH</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
9749 shall report all files in a directory before reporting the directory
9750 itself.</p><p class="simpara">If <code class="constant">:MOUNT</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
9751 shall only report files in the same file system as <em class="replaceable"><code>pathname</code></em>.</p><p class="simpara">If <code class="constant">:PHYS</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
9752 shall perform a physical walk and shall not follow symbolic links.</p><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/nftw.html"><code class="function">nftw</code></a>.</p></dd><dt><a id="file-info"></a><span class="term"><code class="code">(OS:FILE-INFO <em class="replaceable"><code>pathname</code></em>
9753 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> all)</code></span></dt><dd><p>Return the <span class="type">FILE-INFO</span> structure.
9754 <em class="replaceable"><code>pathname</code></em> should be a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>. The 7 slots are</p><table border="0" summary="Simple list" class="simplelist"><tr><td><em class="structfield"><code>attributes</code></em></td></tr><tr><td><em class="structfield"><code>ctime</code></em></td></tr><tr><td><em class="structfield"><code>atime</code></em></td></tr><tr><td><em class="structfield"><code>wtime</code></em></td></tr><tr><td><em class="structfield"><code>size</code></em></td></tr><tr><td><em class="structfield"><code>name</code></em></td></tr><tr><td><em class="structfield"><code>name-short</code></em></td></tr></table><p>When <em class="replaceable"><code>pathname</code></em> is wild, returns just the first match,
9755 unless the second (optional) argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case a
9756 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of objects is returned, one for each match.
9757 </p></dd><dt><a id="stream-lock"></a><span class="term"><code class="code">(POSIX:STREAM-LOCK <em class="replaceable"><code>stream</code></em>
9758 <em class="replaceable"><code>lock-p</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9759 (:BLOCK <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) (:SHARED <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>) (:START 0) (:END <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>))</code></span></dt><dd><p class="simpara">Set or remove a file lock for the (portion of the)
9760 file associated with <em class="replaceable"><code>stream</code></em>,
9761 depending on <em class="replaceable"><code>lock-p</code></em>.
9762 When <em class="replaceable"><code>block</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the call is non-blocking,
9763 and when locking fails, it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
9764 When <em class="replaceable"><code>shared</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
9765 then lock can be shared between several callers.
9766 Several processes can set a <em class="replaceable"><code>shared</code></em>
9767 (i.e., <span class="emphasis"><em>read</em></span>) lock, but only one can set
9768 an <em class="replaceable"><code>exclusive</code></em> (i.e., <span class="emphasis"><em>write</em></span>,
9769 or non-<em class="replaceable"><code>shared</code></em>) lock.
9770 Uses <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html"><code class="function">fcntl</code></a>
9771 or <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=LockFileEx"><code class="function">LockFileEx</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> differ on locking 0-length files: on
9772 <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>, two processes can have exclusive locks on it!</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> locks are <span class="emphasis"><em>mandatory</em></span>:
9773 if you lock a file, others will not be able to open it!</p><p><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> locks are usually <span class="emphasis"><em>advisory</em></span>: a process
9774 is free to ignore it, but on some <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems one can mount some
9775 file system with <span class="emphasis"><em>mandatory</em></span> locks.</p></div></dd><dt><a id="with-stream-lock"></a><span class="term"><code class="code">(POSIX:WITH-STREAM-LOCK
9776 (<em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Lock the <em class="replaceable"><code>stream</code></em>, execute the <em class="replaceable"><code>body</code></em>, unlock
9777 the <em class="replaceable"><code>stream</code></em>. Pass <em class="replaceable"><code>options</code></em> to <a class="link" href="#stream-lock"><code class="function">POSIX:STREAM-LOCK</code></a>.
9778 </dd><dt><a id="fcntl"></a><span class="term"><code class="code">(<a class="link" href="#fcntl"><code class="function">POSIX:STREAM-OPTIONS</code></a>
9779 <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html"><code class="function">fcntl</code></a>,
9780 <em class="replaceable"><code>command</code></em> can be <code class="constant">:FD</code> or <code class="constant">:FL</code>.
9781 </p><p class="simpara">When <em class="replaceable"><code>value</code></em> is missing, the option is queried and
9782 the value is returned; if <em class="replaceable"><code>value</code></em> is supplied, the option is set and
9783 no values are returned.</p></dd><dt><a id="file-size"></a><span class="term"><code class="code">(<a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a> <em class="replaceable"><code>file</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a> <em class="replaceable"><code>file</code></em>) <em class="replaceable"><code>size</code></em>)</code></span></dt><dd><p class="simpara">Extend <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-length.html" target="_top"><code class="function">FILE-LENGTH</code></a> to operate on <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</p><p class="simpara">Set the <em class="replaceable"><code>size</code></em> of a <em class="replaceable"><code>file</code></em> using
9784 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html"><code class="function">ftruncate</code></a> (if <em class="replaceable"><code>file</code></em> is an open
9785 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>) or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html"><code class="function">truncate</code></a> (if
9786 <em class="replaceable"><code>file</code></em> is a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>).</p><p class="simpara">Use <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetFilePointerEx"><code class="function">SetFilePointerEx</code></a>
9787 and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetEndOfFile"><code class="function">SetEndOfFile</code></a> on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.
9788 </p></dd><dt><a id="mknod"></a><span class="term"><code class="code">(POSIX:MKNOD <em class="replaceable"><code>pathname</code></em> <em class="replaceable"><code>type</code></em>
9789 <em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Create a special file using
9790 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html"><code class="function">mknod</code></a>.
9791 Use <code class="constant">:FIFO</code> to create pipes
9792 and <code class="constant">:SOCK</code> to create sockets.
9793 </dd><dt><a id="convert-mode"></a><span class="term"><code class="code">(POSIX:CONVERT-MODE <em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Convert between numeric, (e.g., <code class="literal">0644</code>)
9794 and symbolic (e.g., <span class="data"><code class="literal">(:RUSR :WUSR :RGRP
9795 :ROTH)</code></span>) file modes.</dd><dt><a id="umask"></a><span class="term"><code class="code">(POSIX:UMASK <em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Change process mask using
9796 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html"><code class="function">umask</code></a>.
9797 </dd><dt><a id="copy-file"></a><span class="term"><code class="code">(<a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a> <em class="replaceable"><code>source</code></em> <em class="replaceable"><code>destination</code></em>
9798 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :METHOD :PRESERVE :IF-EXISTS :IF-DOES-NOT-EXIST)</code></span></dt><dd><p class="simpara">This is an interface to
9799 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html"><code class="function">symlink</code></a>
9800 (when <em class="replaceable"><code>method</code></em> is <code class="constant">:SYMLINK</code>),
9801 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html"><code class="function">link</code></a>
9802 (when it is <code class="constant">:HARDLINK</code>),
9803 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html"><code class="function">rename</code></a>
9804 (when it is <code class="constant">:RENAME</code>) system calls, as well as,
9805 you guessed it, a generic file copy utility (when <em class="replaceable"><code>method</code></em> is <code class="constant">:COPY</code>).
9806 </p><p class="simpara">When <em class="replaceable"><code>method</code></em> is <code class="constant">:HARDLINK-OR-COPY</code>
9807 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html"><code class="function">link</code></a> fails (e.g., because the
9808 <em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>destination</code></em> are on different devices), fall back to <code class="constant">:COPY</code>.
9809 </p><p class="simpara">Both <em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>destination</code></em> may be wild, in which
9810 case <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> is used.</p><p class="simpara">When <em class="replaceable"><code>preserve</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, try
9811 to duplicate the time, owner, and permission characteristics of each
9812 source file in the corresponding destination file,
9813 similar to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html"><span class="command"><strong>cp -p</strong></span></a>.</p><p class="simpara">The meaning and defaults of <code class="constant">:IF-EXISTS</code> and
9814 <code class="constant">:IF-DOES-NOT-EXIST</code> are the same as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>.</p><p class="simpara">The actual <em class="replaceable"><code>destination</code></em> file created is
9815 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> <em class="replaceable"><code>source</code></em> <em class="replaceable"><code>destination</code></em>)</code> so that
9816 <code class="code">(<a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a> "foo" "dir/")</code> creates
9817 <code class="filename">"dir/foo"</code> and
9818 <code class="code">(<a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a> "foo.csv" "bar")</code> creates
9819 <code class="filename">"bar.csv"</code>.
9820 If you want to actually copy <code class="filename">"foo.csv"</code> to
9821 <code class="filename">"bar"</code>, do
9822 <code class="code">(<a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> :name "foo.csv") "bar")</code>.
9823 </p></dd><dt><a id="dup-handle"></a><span class="term"><code class="code">(<a class="link" href="#dup-handle"><code class="function">POSIX:DUPLICATE-HANDLE</code></a>
9824 <em class="replaceable"><code>fd1</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
9825 <em class="replaceable"><code>fd2</code></em>)</code></span></dt><dd>This is an interface to the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a> system calls on
9826 <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems and to <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=DuplicateHandle"><code class="function">DuplicateHandle</code></a>
9827 system call on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</dd><dt><a id="shortcut-info"></a><span class="term"><code class="code">(OS:SHORTCUT-INFO
9828 <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd>Return information about a <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> shortcut
9829 (<code class="filename">#P".lnk"</code>) file contents in a
9830 <span class="type">SHORTCUT-INFO</span> structure.</dd><dt><a id="make-shortcut"></a><span class="term"><code class="code">(OS:MAKE-SHORTCUT <em class="replaceable"><code>pathname</code></em>
9831 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :WORKING-DIRECTORY :ARGUMENTS :SHOW-COMMAND :ICON :DESCRIPTION
9832 :HOT-KEY :PATH)</code></span></dt><dd>Create (or modify the properties of an existing one)
9833 a <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> shortcut (<code class="filename">#P".lnk"</code>) file.
9834 </dd><dt><a id="file-properties"></a><span class="term"><code class="code">(OS:FILE-PROPERTIES
9835 filename set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :INITID <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></dt><dd><p>Wrapper for the <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
9836 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=IPropertyStorage"><code class="function">IPropertyStorage</code></a> functionality.
9837 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>filename</code></em></span></dt><dd>name of a compound file (where properties are stored)
9838 or (on NTFS) name of any file (properties are stored in the filesystem).
9839 For compound files on NTFS, file storage is preferred.
9840 </dd><dt><span class="term"><em class="replaceable"><code>set</code></em></span></dt><dd>property set, either <code class="constant">:BUILT-IN</code>
9841 or <code class="constant">:USER-DEFINED</code>
9842 </dd><dt><span class="term"><code class="constant">:INITID</code>
9843 <em class="replaceable"><code>init-id</code></em></span></dt><dd>set the <em class="replaceable"><code>init-id</code></em>
9844 </dd><dt><span class="term"><em class="replaceable"><code>specifier value</code></em></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specifier</code></em></span></dt><dd><p>the property specifier: an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>,
9845 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or a
9846 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
9847 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></span></dt><dd>a property identifier
9848 </dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a></span></dt><dd><p>Predefined <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> IDs are
9849 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:APPNAME</code></td><td><code class="constant">:CREATE-DTM</code></td><td><code class="constant">:LASTPRINTED</code></td><td><code class="constant">:SUBJECT</code></td></tr><tr><td><code class="constant">:AUTHOR</code></td><td><code class="constant">:DOC-SECURITY</code></td><td><code class="constant">:LASTSAVE-DTM</code></td><td><code class="constant">:TEMPLATE</code></td></tr><tr><td><code class="constant">:CHARCOUNT</code></td><td><code class="constant">:EDITTIME</code></td><td><code class="constant">:LOCALE</code></td><td><code class="constant">:THUMBNAIL</code></td></tr><tr><td><code class="constant">:CODEPAGE</code></td><td><code class="constant">:KEYWORDS</code></td><td><code class="constant">:PAGECOUNT</code></td><td><code class="constant">:TITLE</code></td></tr><tr><td><code class="constant">:COMMENTS</code></td><td><code class="constant">:LASTAUTHOR</code></td><td><code class="constant">:REVNUMBER</code></td><td><code class="constant">:WORDCOUNT</code></td></tr></table></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></span></dt><dd>string property specifier.
9850 If no match is found, the first ID &gt;= init-id
9851 (which defaults to 2) is associated with the
9852 string and its value is replaced with new value.
9853 </dd><dt><span class="term">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>|<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>
9854 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>)</span></dt><dd>the first element is used as
9855 a specifier, the string is associated with this ID.
9856 </dd></dl></div><p>
9857 </p></dd><dt><span class="term"><em class="replaceable"><code>value</code></em></span></dt><dd><p>the new value of the property, a suitable Lisp
9858 object, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> and the value
9859 itself. If <em class="replaceable"><code>value</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, no assignment is done.
9860 <code class="constant">:EMPTY</code> and <code class="constant">:NULL</code>
9861 correspond to the <span class="type">VT_EMPTY</span>
9862 and <span class="type">VT_NULL</span> data types.
9863 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> specifies the desired type of
9864 the property being set.
9865 Supported types are</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:BOOL</code></td><td><code class="constant">:I1</code></td><td><code class="constant">:LPWSTR</code></td><td><code class="constant">:UI4</code></td></tr><tr><td><code class="constant">:BSTR</code></td><td><code class="constant">:I2</code></td><td><code class="constant">:R4</code></td><td><code class="constant">:UI8</code></td></tr><tr><td><code class="constant">:DATE</code></td><td><code class="constant">:I4</code></td><td><code class="constant">:R8</code></td><td><code class="constant">:UINT</code></td></tr><tr><td><code class="constant">:ERROR</code></td><td><code class="constant">:I8</code></td><td><code class="constant">:UI1</code></td><td> </td></tr><tr><td><code class="constant">:FILETIME</code></td><td><code class="constant">:LPSTR</code></td><td><code class="constant">:UI2</code></td><td> </td></tr></table><p>
9866 <span class="type">FILETIME</span>s are converted to/from the universal
9867 time format, while <span class="type">DATE</span>s are not.
9868 </p></dd></dl></div><p>
9869 </p></dd></dl></div><p>
9870 Returns the property contents before assignment as multiple values.
9871 </p></dd><dt><a id="file-owner"></a><span class="term"><code class="code">(OS:FILE-OWNER
9872 <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd><p class="simpara">Return the owner of the file.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="mkstemp"></a><span class="term"><code class="code">(POSIX:MKSTEMP <em class="replaceable"><code>filename</code></em>
9873 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:DIRECTION</code> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkstemp.html"><code class="function">mkstemp</code></a>;
9874 returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.</p><p class="simpara"><code class="constant">:DIRECTION</code> should allow output.</p></dd><dt><a id="mkdtemp"></a><span class="term"><code class="code">(POSIX:MKDTEMP
9875 <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdtemp.html"><code class="function">mkdtemp</code></a>;
9876 creates a new empty temporary directory and returns its namestring.
9877 </dd><dt><a id="sync"></a><span class="term"><code class="code">(POSIX:SYNC <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
9878 <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html"><code class="function">fsync</code></a>
9879 (<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=FlushFileBuffers"><code class="function">FlushFileBuffers</code></a> on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
9880 on the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with <em class="replaceable"><code>stream</code></em>,
9881 or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sync.html"><code class="function">sync</code></a>
9882 when <em class="replaceable"><code>stream</code></em> is not supplied</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="user-group"></a>33.2.3. Users and Groups</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="user-info"></a><span class="term"><code class="code">(POSIX:USER-INFO
9883 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>user</code></em>)</code></span></dt><dd><p class="simpara">Return the <span class="type">USER-INFO</span> structure (name,
9884 encoded password, UID, GID, full name, home directory, shell).
9885 <em class="replaceable"><code>user</code></em> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
9886 (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwnam.html"><code class="function">getpwnam</code></a> is used) or an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
9887 (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid.html"><code class="function">getpwuid</code></a> is used).
9888 When <em class="replaceable"><code>user</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all
9889 users (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwent.html"><code class="function">getpwent</code></a>).
9890 When <em class="replaceable"><code>user</code></em> is <code class="constant">:DEFAULT</code>, return the information about the current user
9891 (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html"><code class="function">getlogin</code></a>).</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></dd><dt><a id="group-info"></a><span class="term"><code class="code">(POSIX:GROUP-INFO
9892 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>group</code></em>)</code></span></dt><dd><p class="simpara">Return the <span class="type">GROUP-INFO</span> structure (name,
9893 GID, member <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>). <em class="replaceable"><code>group</code></em> should be a
9894 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrnam.html"><code class="function">getgrnam</code></a> is used) or an
9895 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrgid.html"><code class="function">getgrgid</code></a> is used).
9896 When <em class="replaceable"><code>group</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all
9897 groups (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrent.html"><code class="function">getgrent</code></a>).</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></dd><dt><a id="user-shells"></a><span class="term"><code class="code">(POSIX:USER-SHELLS)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getusershell"><code class="function">getusershell</code></a>.
9898 </dd><dt><a id="get-user-sid"></a><span class="term"><code class="code">(OS:GET-USER-SID
9899 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>user</code></em>)</code></span></dt><dd>Call <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=LookupAccountName"><code class="function">LookupAccountName</code></a>
9900 on <em class="replaceable"><code>user</code></em> or, if that is not supplied, call
9901 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=OpenProcessToken"><code class="function">OpenProcessToken</code></a>,
9902 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetTokenInformation"><code class="function">GetTokenInformation</code></a>, and then
9903 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=ConvertSidToStringSid"><code class="function">ConvertSidToStringSid</code></a> on
9904 <em class="structfield"><code>User.Sid</code></em>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sysinfo"></a>33.2.4. System Information</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="uname"></a><span class="term"><code class="code">(POSIX:UNAME)</code></span></dt><dd>Return a structure describing the OS, derived from
9905 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html"><code class="function">uname</code></a>.</dd><dt><a id="sysconf"></a><span class="term"><code class="code">(POSIX:SYSCONF <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code><br /></span><span class="term"><code class="code">(POSIX:CONFSTR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the specified configuration parameter or a
9906 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available parameters (when <em class="replaceable"><code>what</code></em> is missing or
9907 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html"><code class="function">sysconf</code></a>
9908 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html"><code class="function">confstr</code></a> respectively.
9909 </dd><dt><a id="pathconf"></a><span class="term"><code class="code">(POSIX:PATHCONF <em class="replaceable"><code>pathname</code></em>
9910 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the specified configuration parameter or a
9911 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available parameters (when <em class="replaceable"><code>what</code></em> is missing or
9912 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html"><code class="function">fpathconf</code></a> on
9913 open file streams and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pathconf.html"><code class="function">pathconf</code></a> on
9914 all other <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</dd><dt><a id="rlimit"></a><span class="term"><code class="code">(<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>
9915 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the current and the maximal limits as two
9916 values when <em class="replaceable"><code>what</code></em> is specified or the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available
9917 limits (as an <span class="type">RLIMIT</span> structure) when <em class="replaceable"><code>what</code></em> is
9918 missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html"><code class="function">getrlimit</code></a>.
9919 </dd><dt><a id="set-rlimit"></a><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a> <em class="replaceable"><code>what</code></em>)
9920 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> <em class="replaceable"><code>cur</code></em>
9921 <em class="replaceable"><code>max</code></em>))</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a> <em class="replaceable"><code>what</code></em>)
9922 <em class="replaceable"><code>rlimit</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>)
9923 <em class="replaceable"><code>rlimit-plist</code></em>)</code></span></dt><dd><p>Set the limits using
9924 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setrlimit.html"><code class="function">setrlimit</code></a>.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">In the first form, <em class="replaceable"><code>cur</code></em>
9925 and <em class="replaceable"><code>max</code></em> are numbers
9926 (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for <code class="constant">RLIM_INFINITY</code>).</li><li class="listitem">In the second form, <em class="replaceable"><code>rlimit</code></em>
9927 is an <span class="type">RLIMIT</span> structure.</li><li class="listitem">In the third form,
9928 <em class="replaceable"><code>rlimit-plist</code></em> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>, as returned by
9929 <code class="code">(<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>)</code>.</li></ol></div></dd><dt><a id="usage"></a><span class="term"><code class="code">(<a class="link" href="#usage"><code class="function">POSIX:USAGE</code></a>
9930 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the <span class="type">USAGE</span> structure describing the
9931 resource usage of the thread, process, or its children, using
9932 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrusage.html"><code class="function">getrusage</code></a>. WHen <em class="replaceable"><code>what</code></em> is missing
9933 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all available data as a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>.
9934 </dd><dt><a id="bogomips"></a><span class="term"><code class="code">(POSIX:BOGOMIPS)</code></span></dt><dd>Compute the
9935 <a class="ulink" href="http://en.wikipedia.org/wiki/BogoMips" target="_top">BogoMips</a>
9936 rating.</dd><dt><a id="loadavg"></a><span class="term"><code class="code">(POSIX:LOADAVG <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
9937 percentp)</code></span></dt><dd>Return 1, 5, and 15 minute system load averages,
9938 retrieved by <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getloadavg"><code class="function">getloadavg</code></a>.
9939 If the argument is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the values are returned
9940 as integer percentiles.</dd><dt><span class="term"><code class="code">(OS:SYSTEM-INFO)</code></span></dt><dd>Return <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> system information in a
9941 <span class="type">SYSTEM-INFO</span> structure.</dd><dt><span class="term"><code class="code">(OS:VERSION)</code></span></dt><dd>Return <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> version information in a
9942 <span class="type">VERSION</span> structure.</dd><dt><span class="term"><code class="code">(OS:MEMORY-STATUS)</code></span></dt><dd>Return <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> memory status information in a
9943 <span class="type">MEMORY-STATUS</span> structure.</dd><dt><a id="phys-mem"></a><span class="term"><code class="code">(OS:PHYSICAL-MEMORY)</code></span></dt><dd><p class="simpara">Return 2 values: total and available physical memory.
9944 </p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="hostid"></a><span class="term"><code class="code">(OS:HOSTID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:HOSTID) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostid.html"><code class="function">gethostid</code></a> and
9945 return a (hopefully) universally unique <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> identifier of
9946 this machine.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>On <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> this number appears to be the IPv4 32-bit
9947 address with the first 2 bytes and the last 2 bytes swapped:
9948 </p><pre class="programlisting">(<a class="link" href="#rawsock-convert-address"><code class="function">RAWSOCK:CONVERT-ADDRESS</code></a> :inet (os:hostid))
9949 ⇒ <code class="computeroutput">"7.3.192.168"</code>
9950 (first (posix:hostent-addr-list (<a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a> :default)))
9951 ⇒ <code class="computeroutput">"192.168.7.3"</code></pre><p>This, of
9952 course, means that <span class="quote">“<span class="quote">universally unique</span>”</span> it is <span class="strong"><strong>not</strong></span>.
9953 </p></div><p class="simpara">Superuser can also set host identifier
9954 using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> which calls <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=sethostid"><code class="function">sethostid</code></a>.
9955 </p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="domainname"></a><span class="term"><code class="code">(OS:DOMAINNAME)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:DOMAINNAME) <em class="replaceable"><code>domain</code></em>)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getdomainname"><code class="function">getdomainname</code></a>
9956 and <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=setdomainname"><code class="function">setdomainname</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="posix-math"></a>33.2.5. Mathematical functions</h3></div></div></div><p>We implement access to </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/erf.html"><code class="function">erf</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/erfc.html"><code class="function">erfc</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/j0.html"><code class="function">j0</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/j1.html"><code class="function">j1</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/jn.html"><code class="function">jn</code></a> <em class="replaceable"><code>integer</code></em>
9957 <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/y0.html"><code class="function">y0</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/y1.html"><code class="function">y1</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/yn.html"><code class="function">yn</code></a> <em class="replaceable"><code>integer</code></em>
9958 <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/tgamma.html"><code class="function">tgamma</code></a>
9959 <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lgamma.html"><code class="function">lgamma</code></a>
9960 <em class="replaceable"><code>real</code></em>)</code></td></tr></table><p>
9961 which compute the error functions, Bessel functions and Gamma.</p><p>These functions are required by the <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> standard and should
9962 be declared in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html">&lt;<code class="filename">math.h</code>&gt;</a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Please note that these functions do <span class="strong"><strong>not</strong></span> provide
9963 lisp-style error handling and precision, and do all the computations
9964 at the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> level.</p></div><p>Function <code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ffs.html"><code class="function">ffs</code></a> <em class="replaceable"><code>n</code></em>)</code>
9965 finds the first bit set. It is implemented in pure Lisp and supports
9966 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="encryption"></a>33.2.6. Encryption</h3></div></div></div><p>The functionss <span style="color: red">&lt;term&gt;<code class="code">POSIX:CRYPT</code>&lt;/term&gt;</span>,
9967 <span style="color: red">&lt;term&gt;<code class="code">POSIX:ENCRYPT</code>&lt;/term&gt;</span>, and
9968 <span style="color: red">&lt;term&gt;<code class="code">POSIX:SETKEY</code>&lt;/term&gt;</span> are no longer implemented, since
9969 they are no longer considered secure.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sys-log"></a>33.2.7. Syslog</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="openlog"></a><span class="term"><code class="code">(POSIX:OPENLOG ident <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
9970 :PID :CONS :NDELAY :ODELAY :NOWAIT :FACILITY)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/openlog.html"><code class="function">openlog</code></a>
9971 </dd><dt><a id="setlogmask"></a><span class="term"><code class="code">(POSIX:SETLOGMASK
9972 maskpri)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlogmask.html"><code class="function">setlogmask</code></a>.
9973 </dd><dt><a id="syslog"></a><span class="term"><code class="code">(POSIX:SYSLOG severity facility
9974 <em class="replaceable"><code>format-string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html"><code class="function">syslog</code></a> on
9975 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>format-string</code></em> <em class="replaceable"><code>arguments</code></em>)</code>.</p><p class="simpara">No <span class="data"><code class="literal">%</code></span> conversion is performed,
9976 you must do all formatting in Lisp.</p></dd><dt><a id="closelog"></a><span class="term"><code class="code">(POSIX:CLOSELOG)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/closelog.html"><code class="function">closelog</code></a>.
9977 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="processes"></a>33.2.8. Processes</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="process-id"></a><span class="term"><code class="code">(OS:PROCESS-ID)</code></span></dt><dd>Return the process ID
9978 (on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpid.html"><code class="function">getpid</code></a>,
9979 on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> calls <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetCurrentProcessId"><code class="function">GetCurrentProcessId</code></a>)
9980 </dd><dt><a id="priority"></a><span class="term"><code class="code">(OS:PRIORITY <em class="replaceable"><code>pid</code></em>
9981 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:PRIORITY <em class="replaceable"><code>pid</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)
9982 priority)</code></span></dt><dd><p>Return or set the process priority, platform-dependent
9983 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or platform-independent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, one of
9984 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:REALTIME</code></td><td><code class="constant">:NORMAL</code></td><td><code class="constant">:IDLE</code></td></tr><tr><td><code class="constant">:HIGH</code></td><td><code class="constant">:BELOW-NORMAL</code></td><td> </td></tr><tr><td><code class="constant">:ABOVE-NORMAL</code></td><td><code class="constant">:LOW</code></td><td> </td></tr></table><p>
9985 On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html"><code class="function">getpriority</code></a>
9986 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html"><code class="function">setpriority</code></a>, on
9987 <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> calls <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetPriorityClass"><code class="function">GetPriorityClass</code></a> and
9988 <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetPriorityClass"><code class="function">SetPriorityClass</code></a>.</p></dd><dt><a id="kill"></a><span class="term"><code class="code">(POSIX:KILL <em class="replaceable"><code>pid</code></em> <em class="replaceable"><code>signal</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html"><code class="function">kill</code></a>.
9989 </dd><dt><a id="getppid"></a><span class="term"><code class="code">(POSIX:GETPPID)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getppid.html"><code class="function">getppid</code></a>.
9990 </dd><dt><a id="getpgrp"></a><span class="term"><code class="code">(POSIX:GETPGRP)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html"><code class="function">getpgrp</code></a>.
9991 </dd><dt><a id="setpgrp"></a><span class="term"><code class="code">(POSIX:SETPGRP)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgrp.html"><code class="function">setpgrp</code></a>;
9992 on non-<a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> systems where it requires 2 arguments (legacy
9993 BSD-style), it is called as <code class="code">setpgrp(0,0)</code>.
9994 </dd><dt><a id="getsid"></a><span class="term"><code class="code">(POSIX:GETSID <em class="replaceable"><code>pid</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsid.html"><code class="function">getsid</code></a>.
9995 </dd><dt><a id="setsid"></a><span class="term"><code class="code">(POSIX:SETSID)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsid.html"><code class="function">setsid</code></a>.
9996 </dd><dt><a id="getpgid"></a><span class="term"><code class="code">(POSIX:PGID <em class="replaceable"><code>pid</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:PGID <em class="replaceable"><code>pid</code></em>)
9997 <em class="replaceable"><code>pgid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html"><code class="function">getpgid</code></a> and
9998 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgid.html"><code class="function">setpgid</code></a>.</dd><dt><a id="setreuid"></a><span class="term"><code class="code">(POSIX:SETREUID
9999 ruid euid)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setreuid.html"><code class="function">setreuid</code></a>.
10000 </dd><dt><a id="setregid"></a><span class="term"><code class="code">(POSIX:SETREGID
10001 rgid egid)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setregid.html"><code class="function">setregid</code></a>.
10002 </dd><dt><a id="getuid"></a><span class="term"><code class="code">(POSIX:UID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:UID) <em class="replaceable"><code>uid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getuid.html"><code class="function">getuid</code></a> and
10003 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html"><code class="function">setuid</code></a>.</dd><dt><a id="getgid"></a><span class="term"><code class="code">(POSIX:GID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:GID) <em class="replaceable"><code>gid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgid.html"><code class="function">getgid</code></a> and
10004 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setgid.html"><code class="function">setgid</code></a>.</dd><dt><a id="geteuid"></a><span class="term"><code class="code">(POSIX:EUID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:EUID) <em class="replaceable"><code>uid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/geteuid.html"><code class="function">geteuid</code></a> and
10005 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/seteuid.html"><code class="function">seteuid</code></a>.</dd><dt><a id="getegid"></a><span class="term"><code class="code">(POSIX:EGID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:EGID) <em class="replaceable"><code>gid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getegid.html"><code class="function">getegid</code></a> and
10006 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setegid.html"><code class="function">setegid</code></a>.</dd><dt><a id="getgroups"></a><span class="term"><code class="code">(POSIX:GROUPS)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:GROUPS) <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html"><code class="function">getgroups</code></a> and
10007 <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=setgroups"><code class="function">setgroups</code></a>.
10008 </dd><dt><a id="wait"></a><span class="term"><code class="code">(<a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :PID :USAGE
10009 :NOHANG :UNTRACED :STOPPED :EXITED :CONTINUED :NOWAIT)</code></span></dt><dd><p class="simpara">Wait for termination of the child process
10010 <code class="constant">:PID</code> (or any child process if not specified).</p><p class="simpara">If <code class="constant">:NOHANG</code> is specifed, return <code class="literal">0</code>
10011 as the only value immediately if no child process has terminated.</p><p class="simpara">Otherwise, the first return value is the <em class="replaceable"><code>pid</code></em> of the
10012 terminated child process.</p><p>The second and third return values depend on the way the
10013 process terminated:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">2nd value = <code class="constant">:EXITED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>exit status</code></em></span></dt><dd>if the child terminated normally, e.g., by
10014 calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html"><code class="function">exit</code></a>.
10015 </dd><dt><span class="term">2nd value = <code class="constant">:SIGNALED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>signal</code></em></span></dt><dd>if the child process was terminated by a <em class="replaceable"><code>signal</code></em>.
10016 </dd><dt><span class="term">2nd value = <code class="constant">:STOPPED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>signal</code></em></span></dt><dd>if the child process was stopped by delivery of
10017 a <em class="replaceable"><code>signal</code></em>.</dd><dt><span class="term">2nd value = <code class="constant">:CONTINUED</code><br /></span><span class="term">3rd value = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>if the child process has continued from a job
10018 control stop.</dd><dt><span class="term">2nd value = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a><br /></span><span class="term">3rd value = <em class="replaceable"><code>number</code></em></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> could not figure out what has happened.
10019 Please read your local <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html"><code class="function">waitpid</code></a>
10020 manual and send us a patch.</dd></dl></div><p class="simpara">The fourth value is only returned if <code class="constant">:USAGE</code>
10021 is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and in that case it is a structure describing resource
10022 usage by the terminated process, similar to what <a class="link" href="#usage"><code class="function">POSIX:USAGE</code></a> returns.</p><p class="simpara">To avoid race conditions, it is important to start your
10023 subprocesses <span class="strong"><strong>and</strong></span> <a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> for them inside the <em class="replaceable"><code>body</code></em> of
10024 a <a class="link" href="#with-subprocesses"><code class="function">POSIX:WITH-SUBPROCESSES</code></a> form.</p><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html"><code class="function">waitpid</code></a> and
10025 (when the <code class="constant">:USAGE</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
10026 <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=wait4"><code class="function">wait4</code></a>.</p></dd><dt><a id="with-subprocesses"></a><span class="term"><code class="code">(<a class="link" href="#with-subprocesses"><code class="function">POSIX:WITH-SUBPROCESSES</code></a>
10027 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a>)</code></span></dt><dd>Evaluate <em class="replaceable"><code>body</code></em> while receiving signals from
10028 subprocesses; your <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> and related <a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> calls should be
10029 inside it.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="accounting"></a>33.2.9. Accounting</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="endutxent"></a><span class="term"><code class="code">(POSIX:ENDUTXENT)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endutxent.html"><code class="function">endutxent</code></a>.
10030 </dd><dt><a id="getutxent"></a><span class="term"><code class="code">(POSIX:GETUTXENT
10031 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> utmpx)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxent.html"><code class="function">getutxent</code></a>,
10032 returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> of type <span class="type">POSIX:UTMPX</span>,
10033 which can be passed to subsequent calls to this function and re-used.
10034 </dd><dt><a id="getutxid"></a><span class="term"><code class="code">(POSIX:GETUTXID id)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxid.html"><code class="function">getutxid</code></a>,
10035 the argument is filled and returned.</dd><dt><a id="getutxline"></a><span class="term"><code class="code">(POSIX:GETUTXLINE line)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxline.html"><code class="function">getutxline</code></a>,
10036 the argument is filled and returned.</dd><dt><a id="pututxline"></a><span class="term"><code class="code">(POSIX:PUTUTXLINE
10037 utmpx)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pututxline.html"><code class="function">pututxline</code></a>,
10038 the argument is filled and returned.</dd><dt><a id="setutxent"></a><span class="term"><code class="code">(POSIX:SETUTXENT)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setutxent.html"><code class="function">setutxent</code></a>.
10039 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="posix-time"></a>33.2.10. Time and Data Conversion</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="strtime"></a><span class="term"><code class="code">(OS:STRING-TIME
10040 <em class="replaceable"><code>format-string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>object</code></em> timezone)</code></span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When <em class="replaceable"><code>object</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
10041 it is parsed into a universal time according to <em class="replaceable"><code>format-string</code></em> by
10042 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html"><code class="function">strptime</code></a>.</li><li class="listitem">When it is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, it is formatted according
10043 to <em class="replaceable"><code>format-string</code></em> by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code class="function">strftime</code></a>.
10044 <em class="replaceable"><code>object</code></em> defaults to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-unive_decoded-time.html" target="_top"><code class="function">GET-UNIVERSAL-TIME</code></a>)</code>.
10045 </li></ul></div></dd><dt><a id="getdate"></a><span class="term"><code class="code">(OS:GETDATE <em class="replaceable"><code>string</code></em>
10046 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> timezone)</code></span></dt><dd><p class="simpara">Parse the <em class="replaceable"><code>string</code></em> into a universal time using
10047 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getdate.html"><code class="function">getdate</code></a>.</p><p class="simpara">If the the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">DATEMSK</code> is not set when
10048 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is invoked, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> sets it to point to the file
10049 <code class="filename">modules/syscalls/datemsk</code>, installed as
10050 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> "syscalls/datemsk" <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>)</code>.
10051 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="strverscmp"></a>33.2.11. String comparision</h3></div></div></div><p>Functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(OS:VERSION&lt; <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION&lt;= <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION&gt; <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION&gt;= <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr></table><p>
10052 compare two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s as version numbers (e.g.,
10053 <span class="data"><code class="literal">"foo10"</code></span> is <span class="emphasis"><em>greater</em></span> than
10054 <span class="data"><code class="literal">"foo9"</code></span>) using
10055 <a class="gnu" href="http://www.kernel.org/doc/man-pages/online/pages/man3/strverscmp.3.html"><code class="function">strverscmp</code></a> and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>.</p><p>Function <code class="function">OS:VERSION-COMPARE</code> does the same but
10056 returns either <span class="data"><code class="literal">&lt;</code></span>,
10057 <span class="data"><code class="literal">&gt;</code></span> or <span class="data"><code class="literal">=</code></span>.
10058 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="wildcard"></a>33.2.12. Wildcard Matching</h3></div></div></div><p>Wildcards describe sets of file names; see <span class="quote">“<span class="quote"><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13">Pathname Matching</a>
10059 Notation</span>”</span> for the syntax description.</p><p><a id="fnmatch-f"></a><strong><code class="code">(POSIX:FNMATCH <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em>
10060 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :PATHNAME :PERIOD :NOESCAPE (:CASE-SENSITIVE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code>. </strong>This function returns a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value if the <em class="replaceable"><code>string</code></em> matches
10061 the <em class="replaceable"><code>pattern</code></em> by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fnmatch.html"><code class="function">fnmatch</code></a>.
10062 </p><p><a id="fnmatch-matcher"></a><strong><code class="code">(POSIX:FNMATCH-MATCHER
10063 <em class="replaceable"><code>pattern</code></em>)</code>. </strong>This function is a valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
10064 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>These two functions used to reside in a separate package
10065 <strong class="package"><span class="quote">“<span class="quote">WILDCARD</span>”</span></strong>, which has been now deprecated.
10066 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mk-xterm-io"></a>33.2.13. XTerm</h3></div></div></div><p><code class="code">(<a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> title xterm)</code>
10067 When running under the <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a>, you can create a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, which uses a new
10068 dedicated text window (created by the executable specified by
10069 the <code class="constant">:XTERM</code> argument which should be compatible
10070 with <span class="command"><strong>xterm</strong></span> and <span class="command"><strong>rxvt</strong></span>, i.e., accept
10071 options <code class="option">-n</code>, <code class="option">-T</code>, and <code class="option">-e</code>)
10072 using the function <a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a>: </p><pre class="programlisting">
10073 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>
10074 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*DEBUG-IO*</code></a>
10075 (<a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a> :title "clisp errors and debug")))
10076 </pre><p><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="stdio"></a>33.2.14. Standard file input and output</h3></div></div></div><p>We define the type <span class="type">FFI:file</span> = <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> and
10077 the following functions:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html"><code class="function">fopen</code></a> <em class="replaceable"><code>filename</code></em>
10078 <em class="replaceable"><code>mode</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html"><code class="function">fdopen</code></a> fd
10079 <em class="replaceable"><code>mode</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/freopen.html"><code class="function">freopen</code></a> <em class="replaceable"><code>filename</code></em>
10080 <em class="replaceable"><code>mode</code></em> <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html"><code class="function">fclose</code></a>
10081 <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html"><code class="function">fflush</code></a>
10082 <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/clearerr.html"><code class="function">clearerr</code></a>
10083 <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/feof.html"><code class="function">feof</code></a>
10084 <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ferror.html"><code class="function">ferror</code></a>
10085 <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fileno.html"><code class="function">fileno</code></a>
10086 <em class="replaceable"><code>file</code></em>)</code></td></tr></table><p>call their namesakes defined in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html">&lt;<code class="filename">stdio.h</code>&gt;</a>.</p><p>Functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="function">OS:FOPEN</code></td></tr><tr><td><code class="function">OS:FDOPEN</code></td></tr><tr><td><code class="function">OS:FREOPEN</code></td></tr><tr><td><code class="function">OS:FCLOSE</code></td></tr><tr><td><code class="function">OS:FFLUSH</code></td></tr><tr><td><code class="function">OS:FILENO</code></td></tr></table><p> may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><div class="variablelist"><p class="title"><strong>Return values</strong></p><dl class="variablelist"><dt><span class="term"><code class="function">OS:FOPEN</code><br /></span><span class="term"><code class="function">OS:FDOPEN</code></span></dt><dd><span class="type">FFI:file</span> = <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
10087 </dd><dt><span class="term"><code class="function">OS:FREOPEN</code><br /></span><span class="term"><code class="function">OS:FCLOSE</code><br /></span><span class="term"><code class="function">OS:FFLUSH</code><br /></span><span class="term"><code class="function">OS:CLEARERR</code></span></dt><dd>no values (they modify their <em class="replaceable"><code>file</code></em> argument in place)
10088 </dd><dt><span class="term"><code class="function">OS:FEOF</code><br /></span><span class="term"><code class="function">OS:FERROR</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></dd><dt><span class="term"><code class="function">OS:FILENO</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>)</dd></dl></div><p>We also define 3 constants </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">OS:STDIN</code></td></tr><tr><td><code class="constant">OS:STDOUT</code></td></tr><tr><td><code class="constant">OS:STDERR</code></td></tr></table><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="stdio-rationale"></a>Rationale</h4></div></div></div><p><a id="stdio-ffi"></a><strong>Iterface to foreign libraries. </strong>This functionality can be used by <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> <a href="impnotes.html#modules" class="olink">module</a>s which
10089 interface to functions which use the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">FILE*</span> pointers.
10090 E.g., <span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span> has a function <a class="pq" href="http://www.postgresql.org/search/?q=PQtrace"><code class="function">PQtrace</code></a>
10091 which expects a <span class="type">FILE*</span> argument.
10092 You can use <code class="function">OS:FOPEN</code>
10093 and <code class="function">OS:FCLOSE</code> for that.</p><p><a id="stdio-wild"></a><strong>Bypass <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> filename processing. </strong>You can also use this functionality to access files whose
10094 names are interpreted as wild by <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>. E.g.,</p><pre class="programlisting">
10095 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((file (posix:fopen "foo*" "r")))
10096 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>
10097 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (s (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> (posix:fileno file)))
10098 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
10099 (posix:fclose file)))
10100 </pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="errno"></a>33.2.15. Error handling</h3></div></div></div><p>To handle errors in foreign functions, the following four
10101 functions are provided: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(POSIX:ERRNO <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is set (useful
10102 before a system call which sets <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> as the only way to report an
10103 error).</p><p class="simpara">If <em class="replaceable"><code>error-code</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, the corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>
10104 is returned and vice versa.</p><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is not supplied, the current <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is
10105 returned as a keyword if possible, a number otherwise.</p><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, all known error codes are
10106 returned as an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</p></dd><dt><span class="term"><code class="code">(OS:LAST-ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10107 <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Just like <code class="function">POSIX:ERRNO</code>,
10108 but uses <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLastError"><code class="function">GetLastError</code></a>
10109 and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetLastError"><code class="function">SetLastError</code></a> instead
10110 of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></p></dd><dt><span class="term"><code class="code">(POSIX:STRERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10111 <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Return a string description of <em class="replaceable"><code>error-code</code></em>.
10112 When <em class="replaceable"><code>error-code</code></em> is not supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is used.</p><p class="simpara">This calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html"><code class="function">strerror</code></a>.</p></dd><dt><span class="term"><code class="code">(OS:FORMAT-MESSAGE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10113 <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Just like <code class="function">POSIX:STRERROR</code>,
10114 but uses <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=FormatMessage"><code class="function">FormatMessage</code></a>
10115 and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLastError"><code class="function">GetLastError</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="misc"></a>33.2.16. Miscellanea</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="clipboard"></a><span class="term"><code class="code">(OS:CLIPBOARD)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:CLIPBOARD) <em class="replaceable"><code>object</code></em>)</code></span></dt><dd><p class="simpara">Get
10116 (using <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetClipboardData"><code class="function">GetClipboardData</code></a>) a set
10117 (using <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetClipboardData"><code class="function">SetClipboardData</code></a>)
10118 the windows clipboard.</p><p class="simpara">Return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>; convert <em class="replaceable"><code>object</code></em> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
10119 using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRINC-TO-STRING</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> platforms only.</span></span></p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="i18n-mod"></a>33.3. Internationalization of User Programs</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dd><dl><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ggettext"></a>33.3.1. The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></div><p><a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a> is a set of functions, included in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> or the
10120 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library, which permit looking up translations of strings
10121 through message catalogs. It is also a set of tools which makes the
10122 translation maintenance easy for the translator and the program
10123 maintainer.</p><p>The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gettext/" target="_top">gettext</a> functions are available in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> in the
10124 <a class="link" href="#i18n" title="31.4. Internationalization of CLISP"><strong class="package"><span class="quote">“<span class="quote">I18N</span>”</span></strong></a> package, which is <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from the <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>
10125 package.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
10126 contains the symbol <code class="constant">:I18N</code>.</p><div class="variablelist"><dl class="variablelist"><dt><a id="gettext"></a><span class="term"><code class="code">(<a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a>
10127 <em class="replaceable"><code>MSGID</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>)</code></span></dt><dd>returns the translation of the message <em class="replaceable"><code>MSGID</code></em>,
10128 in the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, depending on the given <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>.
10129 <em class="replaceable"><code>MSGID</code></em> should be an <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> string, and is normally the English message.
10130 </dd><dt><a id="ngettext"></a><span class="term"><code class="code">(<a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a>
10131 <em class="replaceable"><code>MSGID</code></em> <em class="replaceable"><code>msgid_plural</code></em>
10132 <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>)</code></span></dt><dd>returns the plural form of the translation for of
10133 <em class="replaceable"><code>MSGID</code></em> and <em class="replaceable"><code>n</code></em> in the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, depending on the given
10134 <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>. <em class="replaceable"><code>MSGID</code></em> and <em class="replaceable"><code>msgid_plural</code></em>
10135 should be <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> strings, and are normally the English singular and
10136 English plural variant of the message, respectively.
10137 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="domain"></a>33.3.1.1. Domain</h4></div></div></div><p>The <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> is a string identifier denoting the program that
10138 is requesting the translation. The pathname of the message catalog
10139 depends on the <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>: usually it is located at
10140 <code class="filename">TEXTDOMAINDIR/l/LC_MESSAGES/domain.mo</code>, where
10141 <em class="replaceable"><code>l</code></em> is the <a class="ulink" href="http://www.loc.gov/standards/iso639-2/" target="_top">ISO
10142 639-2</a> code of the language.
10143 The notion of <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> allows several Lisp programs running in the same
10144 image to request translations independently of each other.</p><p><a id="textdomain"></a><strong>Function <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>. </strong><code class="code">(<a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> that returns the default
10145 <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, used when no <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> argument is passed to the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> and
10146 <a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a> functions. It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able.
10147 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is usually used
10148 during the startup phase of a program.
10149 Note that the default <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> is not saved in a <a href="impnotes.html#image" class="olink">memory image</a>.
10150 The use of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is
10151 recommended only for programs that are so simple that they will never
10152 need more than one <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>.</p><p><a id="textdomaindir"></a><strong>Function <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a>. </strong><code class="code">(<a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>)</code>
10153 is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> that returns the base directory, called
10154 <code class="filename">TEXTDOMAINDIR</code> above, where the message
10155 catalogs for the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> are assumed to be installed.
10156 It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able.
10157 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a>)</code> is usually used
10158 during the startup phase of a program, and should be used because only
10159 the program knows where its message catalogs are installed.
10160 Note that the <code class="filename">TEXTDOMAINDIR</code>s
10161 are not saved in a <a href="impnotes.html#image" class="olink">memory image</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="category"></a>33.3.1.2. Category</h4></div></div></div><p>The <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> argument of the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> and <a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a>
10162 functions denotes which <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> facet the result should depend on.
10163 The possible values are a platform-dependent subset of
10164 <span class="simplelist"><code class="constant">:LC_ADDRESS</code>, <code class="constant">:LC_ALL</code>, <code class="constant">:LC_COLLATE</code>, <code class="constant">:LC_CTYPE</code>, <code class="constant">:LC_IDENTIFICATION</code>, <code class="constant">:LC_MEASUREMENT</code>, <code class="constant">:LC_MESSAGES</code>, <code class="constant">:LC_MONETARY</code>, <code class="constant">:LC_NAME</code>, <code class="constant">:LC_NUMERIC</code>, <code class="constant">:LC_PAPER</code>, <code class="constant">:LC_TELEPHONE</code>, <code class="constant">:LC_TIME</code></span>
10165 The use of these values is useful for users who have a
10166 character/time/collation/money handling set differently from the usual
10167 message handling.
10168 Note that when a <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> argument is used, the message catalog
10169 location depends on the <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>: it will be expected at
10170 <code class="filename">TEXTDOMAINDIR/ll/category/domain.mo</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="i18n-example"></a>33.3.1.3. Internationalization Example</h4></div></div></div><p>A non-internationalized program simulating a restaurant dialogue
10171 might look as follows.</p><p><a id="i18n-non-i"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
10172 (setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
10173
10174 (format t "~A~%" "'Your command, please?', asked the waiter.")
10175
10176 (format t "~@?~%"
10177 (if (= n 1) "a piece of cake" "~D pieces of cake")
10178 n)
10179 </pre><p>After being internationalized, all strings are wrapped in
10180 <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> calls, and <a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a> is used for plurals.
10181 Also, <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a> is assigned a value; in our case, for simplicity,
10182 the current directory.</p><p><a id="i18n-i"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
10183 (setf (textdomain) "prog")
10184 (setf (textdomaindir "prog") "./")
10185
10186 (setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
10187
10188 (format t "~A~%"
10189 (gettext "'Your command, please?', asked the waiter."))
10190
10191 (format t "~@?~%"
10192 (ngettext "a piece of cake" "~D pieces of cake" n)
10193 n)
10194 </pre><p>For ease of reading, it is customary to define an abbreviation
10195 for the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> function. An underscore is customary.</p><p><a id="i18n-i-abbrev"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
10196 (setf (textdomaindir "prog") "./")
10197 (defun _ (msgid) (gettext msgid "prog"))
10198
10199 (setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
10200
10201 (format t "~A~%"
10202 (_"'Your command, please?', asked the waiter."))
10203
10204 (format t "~@?~%"
10205 (ngettext "a piece of cake" "~D pieces of cake" n "prog")
10206 n)
10207 </pre><p>Now the program's maintainer creates a message catalog template
10208 through the command
10209 </p><pre class="screen">
10210 <strong><code class="prompt">$</code></strong> xgettext -o prog.pot prog.lisp
10211 </pre><p>
10212 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>xgettext version 0.11 or higher is required here.</p></div><p>The message catalog template looks roughly like this.</p><p><a id="i18n-pot"></a><strong>prog.pot. </strong></p><pre class="programlisting">
10213 msgid "'Your command, please?', asked the waiter."
10214 msgstr ""
10215
10216 msgid "a piece of cake"
10217 msgid_plural "%d pieces of cake"
10218 msgstr[0] ""
10219 msgstr[1] ""
10220 </pre><p>Then a French translator creates a French message catalog</p><p><a id="i18n-fr-po"></a><strong>prog.fr.po. </strong></p><pre class="programlisting">
10221 msgid ""
10222 msgstr ""
10223 "Content-Type: text/plain; charset=ISO-8859-1\n"
10224 "Plural-Forms: nplurals=2; plural=(n &gt; 1);\n"
10225
10226 msgid "'Your command, please?', asked the waiter."
10227 msgstr "«Votre commande, s'il vous plait», dit le garçon."
10228
10229 # Les gateaux allemands sont les meilleurs du monde.
10230 msgid "a piece of cake"
10231 msgid_plural "%d pieces of cake"
10232 msgstr[0] "un morceau de gateau"
10233 msgstr[1] "%d morceaux de gateau"
10234 </pre><p>and sends it to the program's maintainer.</p><p>The program's maintainer compiles the catalog as follows:
10235 </p><pre class="screen">
10236 <strong><code class="prompt">$</code></strong> mkdir -p ./fr/LC_MESSAGES
10237 <strong><code class="prompt">$</code></strong> msgfmt -o ./fr/LC_MESSAGES/prog.mo prog.fr.po
10238 </pre><p>When a user in a french <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> then runs the program
10239 </p><pre class="screen">
10240 <strong><code class="prompt">$</code></strong> clisp prog.lisp 2
10241 </pre><p>
10242 she will get the output
10243 </p><pre class="screen">
10244 «Votre commande, s'il vous plait», dit le garçon.
10245 2 morceaux de gateau
10246 </pre><p>
10247 </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="i18n-locale"></a>33.3.2. Locale</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="set-locale"></a><span class="term"><code class="code">(<a class="link" href="#set-locale"><code class="function">I18N:SET-LOCALE</code></a>
10248 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em>)</code></span></dt><dd><p class="simpara">This is an interface to
10249 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html"><code class="function">setlocale</code></a>.</p><p class="simpara">When <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return the current one.</p><p class="simpara">When <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all categories
10250 as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</p></dd><dt><a id="locale-conv"></a><span class="term"><code class="code">(<a class="link" href="#locale-conv"><code class="function">I18N:LOCALE-CONV</code></a>)</code></span></dt><dd><p class="simpara">This is an interface to
10251 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html"><code class="function">localeconv</code></a>.</p><p class="simpara">Returns a <span class="type">I18N:LOCALE-CONV</span>
10252 structure.</p></dd><dt><a id="lang-info"></a><span class="term"><code class="code">(<a class="link" href="#lang-info"><code class="function">I18N:LANGUAGE-INFORMATION</code></a>
10253 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>item</code></em>)</code></span></dt><dd><p class="simpara">This is an interface to
10254 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.html"><code class="function">nl_langinfo</code></a> (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)
10255 and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLocaleInfo"><code class="function">GetLocaleInfo</code></a> (<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>).</p><p class="simpara">When <em class="replaceable"><code>item</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
10256 return all available information as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="regexp-mod"></a>33.4. POSIX Regular Expressions</h2></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>33.1. <a href="#ex-re-match"><code class="function">REGEXP:MATCH</code></a></dt><dt>33.2. <a href="#ex-re-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></dt><dt>33.3. <a href="#re-count-shell-users">Count unix shell users</a></dt></dl></div><p>The <a class="link" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><strong class="package"><span class="quote">“<span class="quote">REGEXP</span>”</span></strong></a> module implements the <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a>
10257 <a class="ulink" href="regexp.html" target="_top">regular expressions</a>
10258 matching by calling the standard <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> system facilities.
10259 The syntax of these <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>s is described in many places,
10260 such as your local <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html">&lt;<code class="filename">regex.h</code>&gt;</a> manual and <a class="ulink" href="https://www.gnu.org/software/emacs/" target="_top">Emacs</a> info pages.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
10261 contains the symbol <code class="constant">:REGEXP</code>.</p><div class="variablelist"><a id="regexp-api"></a><p class="title"><strong>Regular Expression API</strong></p><dl class="variablelist"><dt><a id="re-match"></a><span class="term"><code class="code">(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> <em class="replaceable"><code>pattern</code></em>
10262 <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code> <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a>
10263 <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd><p>This macro returns as first value a <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structure
10264 containing the indices of the start and end of the first match for the
10265 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <em class="replaceable"><code>pattern</code></em> in <em class="replaceable"><code>string</code></em>; or no values if there is no match.
10266 Additionally, a <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structure is returned for every matched
10267 <code class="literal">"\(...\)"</code> group in <em class="replaceable"><code>pattern</code></em>, in the
10268 order that the open parentheses appear in <em class="replaceable"><code>pattern</code></em>.
10269 If <em class="replaceable"><code>start</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the search starts at that index in <em class="replaceable"><code>string</code></em>.
10270 If <em class="replaceable"><code>end</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, only <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_subseq.html" target="_top"><code class="function">SUBSEQ</code></a> <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>start</code></em>
10271 <em class="replaceable"><code>end</code></em>)</code> is considered.
10272 </p><div class="example"><a id="ex-re-match"></a><p class="title"><strong>Example 33.1. <a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a></strong></p><div class="example-contents"><pre class="programlisting">
10273 (<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly.")
10274 ⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 4 :END 9)</code>
10275 (<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly." :start 8)
10276 ⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 27 :END 32)</code>
10277 (<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly." :start 8 :end 30)
10278 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code>
10279 (<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "\\([a-z]*\\)[0-9]*\\(bar\\)" "foo12bar")
10280 ⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 0 :END 8)</code> ;
10281 ⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 0 :END 3)</code> ;
10282 ⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 5 :END 8)</code>
10283 </pre></div></div><p><br class="example-break" />
10284 </p></dd><dt><a id="re-match-access"></a><span class="term"><code class="code">(<a class="link" href="#re-match-access"><code class="function">REGEXP:MATCH-START</code></a> <em class="replaceable"><code>match</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#re-match-access"><code class="function">REGEXP:MATCH-END</code></a> <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Return the start and end the <em class="replaceable"><code>match</code></em>; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able.
10285 </dd><dt><a id="re-match-string"></a><span class="term"><code class="code">(<a class="link" href="#re-match-string"><code class="function">REGEXP:MATCH-STRING</code></a> <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Extracts the substring of <em class="replaceable"><code>string</code></em> corresponding
10286 to the given pair of start and end indices of <em class="replaceable"><code>match</code></em>.
10287 The result is shared with <em class="replaceable"><code>string</code></em>.
10288 If you want a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-seq.html" target="_top"><code class="function">COPY-SEQ</code></a> or
10289 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>.</dd><dt><a id="re-regexp-quote"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a>
10290 <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>extended</code></em>)</code></span></dt><dd><p>This function returns a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
10291 that matches exactly <em class="replaceable"><code>string</code></em> and nothing else.
10292 This allows you to request an exact string match when calling a
10293 function that wants a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>.
10294 </p><div class="example"><a id="ex-re-quote"></a><p class="title"><strong>Example 33.2. <a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></strong></p><div class="example-contents"><pre class="programlisting">
10295 (regexp-quote "^The cat$")
10296 ⇒ <code class="computeroutput">"\\^The cat\\$"</code></pre></div></div><p><br class="example-break" />
10297 One use of <a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a> is to combine an exact string match with
10298 context described as a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>.
10299 When <em class="replaceable"><code>extended</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, also
10300 quote <span class="keysym">#\+</span> and <span class="keysym">#\?</span>.
10301 </p></dd><dt><a id="re-regexp-compile"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>
10302 <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a>)</code></span></dt><dd>Compile the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <em class="replaceable"><code>string</code></em> into an
10303 object suitable for <a class="link" href="#re-regexp-exec"><code class="function">REGEXP:REGEXP-EXEC</code></a>.</dd><dt><a id="re-regexp-exec"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-exec"><code class="function">REGEXP:REGEXP-EXEC</code></a>
10304 <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:RETURN-TYPE</code>
10305 (<code class="constant">:START</code> 0) <code class="constant">:END</code> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd><p class="simpara">Execute the <em class="replaceable"><code>pattern</code></em>, which must be a compiled
10306 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> returned by <a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>, against the appropriate
10307 portion of the <em class="replaceable"><code>string</code></em>.</p><p class="simpara">Returns <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> (one for each
10308 subexpression which successfully matched and one for the whole pattern).
10309 </p><p class="simpara">If <code class="constant">:RETURN-TYPE</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>), the
10310 <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures are returned as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> (or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>) instead.
10311 Also, if there are more than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_multip_values-limit.html" target="_top"><code class="constant">MULTIPLE-VALUES-LIMIT</code></a> <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures
10312 to return, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> is returned instead of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.
10313 If <code class="constant">:RETURN-TYPE</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>, return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> as an indicator
10314 of success or failure, but do <span class="strong"><strong>not</strong></span> allocate anything.
10315 </p></dd><dt><a id="re-regexp-split"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-split"><code class="function">REGEXP:REGEXP-SPLIT</code></a>
10316 <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code>
10317 <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd>Return a list of substrings of <em class="replaceable"><code>string</code></em> (all
10318 sharing the structure with <em class="replaceable"><code>string</code></em>) separated by <em class="replaceable"><code>pattern</code></em> (a
10319 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a return value of <a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>)
10320 </dd><dt><a id="re-with-loop-split"></a><span class="term"><code class="code">(<a class="link" href="#re-with-loop-split"><code class="function">REGEXP:WITH-LOOP-SPLIT</code></a>
10321 (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>pattern</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code>
10322 <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Read lines from <em class="replaceable"><code>stream</code></em>, split them with
10323 <a class="link" href="#re-regexp-split"><code class="function">REGEXP:REGEXP-SPLIT</code></a> on <em class="replaceable"><code>pattern</code></em>, and bind the resulting list to
10324 <em class="replaceable"><code>variable</code></em>.</dd><dt><a id="re-cflags"></a><span class="term"><a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a></span></dt><dd>These options control compilation of a pattern.
10325 See <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html">&lt;<code class="filename">regex.h</code>&gt;</a> for their meaning.</dd><dt><a id="re-eflags"></a><span class="term"><a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a></span></dt><dd>These options control execution of a pattern.
10326 See <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html">&lt;<code class="filename">regex.h</code>&gt;</a> for their meaning.</dd><dt><a id="re-matcher"></a><span class="term"><a class="link" href="#re-matcher"><code class="function">REGEXP:REGEXP-MATCHER</code></a></span></dt><dd>A valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
10327 This will work only when your <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> is <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>
10328 because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> internally and <a class="ulink" href="https://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> constrains
10329 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html">&lt;<code class="filename">regex.h</code>&gt;</a> to use the current <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em>.</dd></dl></div><div class="example"><a id="re-count-shell-users"></a><p class="title"><strong>Example 33.3. Count unix shell users</strong></p><div class="example-contents"><p>The following code computes the number of people who use a
10330 particular shell:</p><pre class="programlisting">
10331 #!/usr/bin/clisp -C
10332 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> "REGEXP")
10333 (let ((h (make-hash-table :test #'equal :size 10)) (n 0))
10334 (with-open-file (f (or (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>) "/etc/passwd"))
10335 (with-loop-split (s f (s f (or (second <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>) ":")))
10336 (incf (gethash (seventh s) h 0))))
10337 (with-hash-table-iterator (i h)
10338 (loop (multiple-value-bind (r k v) (i)
10339 (unless r (return))
10340 (format t "[~d] ~s~30t== ~5:d~%" (incf n) k v)))))
10341 </pre><p>For comparison, the same (almost - except for the nice output formatting)
10342 can be done by the following <a class="ulink" href="https://www.perl.com" target="_top"><span class="command"><strong>Perl</strong></span></a>:</p><pre class="programlisting">
10343 #!/usr/bin/perl -w
10344
10345 use diagnostics;
10346 use strict;
10347
10348 my $IN = $ARGV[0] || "/etc/passwd";
10349 open(INF,"≤ $IN") or die "$0: cannot read file [$IN]: $!\n";
10350 my %hash;
10351 while (≤INF≥) {
10352 chop;
10353 my @all = split($ARGV[1] || ":");
10354 $hash{$all[6] || ""}++;
10355 }
10356 my $ii = 0;
10357 for my $kk (keys(%hash)) {
10358 print "[",++$ii,"] \"",$kk,"\" -- ",$hash{$kk},"\n";
10359 }
10360 close(INF);
10361 </pre></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="readline-mod"></a>33.5. Advanced Readline and History Functionality</h2></div></div></div><p>The <strong class="package"><span class="quote">“<span class="quote">READLINE</span>”</span></strong> module exports most
10362 of the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> functions using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p><p>This module is present even in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default
10363 on platforms where both <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> are available.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
10364 contains the symbol <code class="constant">:READLINE</code>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/readline/test.tst"><code class="filename">modules/readline/test.tst</code></a>
10365 for sample usage.</p><div class="variablelist"><p class="title"><strong>Lisp-level Functionality</strong></p><dl class="variablelist"><dt><span class="term"><code class="varname">READLINE:*READLINE-INPUT-STREAM*</code></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (see <a class="xref" href="#stream-buffer" title="21.17. Functions EXT:MAKE-BUFFERED-INPUT-STREAM and EXT:MAKE-BUFFERED-OUTPUT-STREAM">Section 21.17, “Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
10366 and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
10367 ”</a>)
10368 that receives user input using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and the standard <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
10369 <a class="link" href="#prompt" title="31.9. The Prompt">prompt</a>.
10370 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gdbm"></a>33.6. GDBM - The GNU database manager</h2></div></div></div><p>This is an interface to the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gdbm/" target="_top">DataBase Manager</a>, which extends the standard
10371 <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html">&lt;<code class="filename">ndbm.h</code>&gt;</a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
10372 symbol <code class="constant">:GDBM</code>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/gdbm/test.tst"><code class="filename">modules/gdbm/test.tst</code></a>
10373 for sample usage.</p><div class="variablelist"><a id="gdbm-api"></a><p class="title"><strong>GDBM module API</strong></p><dl class="variablelist"><dt><a id="gdbm-version"></a><span class="term"><code class="code">(GDBM:GDBM-VERSION)</code></span></dt><dd><p>Return the version string.</p></dd><dt><a id="gdbm-open"></a><span class="term"><code class="code">(GDBM:GDBM-OPEN <em class="replaceable"><code>filename</code></em>
10374 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :BLOCKSIZE :READ-WRITE :OPTIONS
10375 :MODE :DEFAULT-KEY-TYPE :DEFAULT-VALUE-TYPE)</code></span></dt><dd><p>Open <em class="replaceable"><code>filename</code></em> database file.
10376 The return value is a <span class="type">GDBM</span> structure.
10377 <code class="constant">:READ-WRITE</code> can have one of following values:
10378 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:READER</code></td></tr><tr><td><code class="constant">:WRITER</code></td></tr><tr><td><code class="constant">:WRCREAT</code></td></tr><tr><td><code class="constant">:NEWDB</code></td></tr></table><p><code class="constant">:OPTIONS</code> is a combination of </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:FAST</code></td></tr><tr><td><code class="constant">:SYNC</code></td></tr><tr><td><code class="constant">:NOLOCK</code></td></tr><tr><td><code class="constant">:NOMMAP</code></td></tr><tr><td><code class="constant">:CLOEXEC</code></td></tr><tr><td><code class="constant">:BSEXACT</code></td></tr></table><p><code class="constant">:MODE</code> is the numeric file permission mode
10379 (cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html"><code class="function">open</code></a>), use
10380 <a class="link" href="#convert-mode"><code class="function">POSIX:CONVERT-MODE</code></a>
10381 to extract it from a list of keywords.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can store and retrieve values of the
10382 following types:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (meaning anything that can be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>d to
10383 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</td></tr><tr><td><span class="type"><code class="literal">EXT:32BIT-VECTOR</code></span> (meaning
10384 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span>)</code></span>)</td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td></tr></table><p>
10385 and <code class="constant">:DEFAULT-KEY-TYPE</code>
10386 and <code class="constant">:DEFAULT-VALUE-TYPE</code> should be one of
10387 those. If not specified (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), the <code class="constant">:TYPE</code>
10388 argument is required in the access functions below.</p><p>If <em class="replaceable"><code>filename</code></em> is actually an existing <span class="type">GDBM</span> structure,
10389 then it is re-opened (if it has been closed), and returned as is.</p><p>The return value is <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>d with
10390 <a class="link" href="#gdbm-close"><code class="function">GDBM-CLOSE</code></a>.</p></dd><dt><a id="gdbm-path"></a><span class="term"><code class="code">(GDBM:GDBM-PATH <em class="replaceable"><code>db</code></em>)</code></span></dt><dd><p>Return the original <em class="replaceable"><code>filename</code></em> passed to .</p></dd><dt><a id="gdbm-close"></a><span class="term"><code class="code">(GDBM:GDBM-CLOSE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Close the database.
10391 </dd><dt><a id="gdbm-open-p"></a><span class="term"><code class="code">(GDBM:GDBM-OPEN-P <em class="replaceable"><code>db</code></em>)</code></span></dt><dd><p class="simpara">Check whether <em class="replaceable"><code>db</code></em> has been already closed.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Only the above functions accept closed databases,
10392 the following functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when passed a closed database.
10393 </p></div></dd><dt><a id="gdbm-store"></a><span class="term"><code class="code">(GDBM:GDBM-STORE <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <em class="replaceable"><code>contents</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10394 :FLAG)</code></span></dt><dd><p><em class="replaceable"><code>db</code></em> is the <span class="type">GDBM</span> structure returned by
10395 <a class="link" href="#gdbm-open"><code class="function">GDBM:GDBM-OPEN</code></a>. <em class="replaceable"><code>key</code></em> is the key datum.
10396 <em class="replaceable"><code>contents</code></em> is the data to be associated with the key.
10397 <code class="constant">:FLAG</code> can have one of following values:
10398 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:INSERT</code></td></tr><tr><td><code class="constant">:REPLACE</code></td></tr></table><p>
10399 </p></dd><dt><a id="gdbm-fetch"></a><span class="term"><code class="code">(GDBM:GDBM-FETCH <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10400 (TYPE (GDBM:GDBM-OPT <em class="replaceable"><code>db</code></em> :DEFAULT-VALUE-TYPE)))</code></span></dt><dd>Search the database.
10401 The <code class="constant">:TYPE</code> argument specifies the return type.
10402 </dd><dt><a id="gdbm-delete"></a><span class="term"><code class="code">(GDBM:GDBM-DELETE <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em>)</code></span></dt><dd>Delete <em class="replaceable"><code>key</code></em> and its contents.
10403 </dd><dt><a id="gdbm-exists"></a><span class="term"><code class="code">(GDBM:GDBM-EXISTS <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em>)</code></span></dt><dd>Search data without retrieving it.
10404 </dd><dt><a id="gdbm-firstkey"></a><span class="term"><code class="code">(GDBM:GDBM-FIRSTKEY <em class="replaceable"><code>db</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10405 (TYPE (GDBM:GDBM-OPT <em class="replaceable"><code>db</code></em> :DEFAULT-KEY-TYPE)))</code></span></dt><dd>Return the key of the first entry, as <code class="constant">:TYPE</code>.
10406 If the database has no entries, the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
10407 </dd><dt><a id="gdbm-nextkey"></a><span class="term"><code class="code">(GDBM:GDBM-NEXTKEY <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10408 (TYPE (GDBM:GDBM-OPT <em class="replaceable"><code>db</code></em> :DEFAULT-KEY-TYPE)))</code></span></dt><dd>Return the key that follows <em class="replaceable"><code>key</code></em>, as <code class="constant">:TYPE</code>,
10409 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if there are no further entries.
10410 </dd><dt><a id="gdbm-reorganize"></a><span class="term"><code class="code">(GDBM:GDBM-REORGANIZE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Reorganize the database.
10411 </dd><dt><a id="gdbm-sync"></a><span class="term"><code class="code">(GDBM:GDBM-SYNC <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Syncronize the in-memory state of the database to
10412 the disk file.</dd><dt><a id="gdbm-opt"></a><span class="term"><code class="code">(GDBM:GDBM-OPT <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>option</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (GDBM:GDBM-OPT <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>option</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p>Set or retrieve options of an already open database.
10413 <em class="replaceable"><code>option</code></em> is one of following:
10414 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:FLAGS</code></span></dt><dd>Retrieve the <code class="constant">:READ-WRITE</code>
10415 and <code class="constant">:OPTIONS</code> passed to <a class="link" href="#gdbm-open"><code class="function">GDBM:GDBM-OPEN</code></a>
10416 (read-only).</dd><dt><span class="term"><code class="constant">:CACHESIZE</code></span></dt><dd>Retrieve and set the size of the internal
10417 bucket cache.</dd><dt><span class="term"><code class="constant">:MAXMAPSIZE</code></span></dt><dd>Retrieve and set the maximum size of a memory
10418 mapped region.</dd><dt><span class="term"><code class="constant">:BLOCKSIZE</code></span></dt><dd>Retrieve the block size in bytes (read-only).
10419 </dd><dt><span class="term"><code class="constant">:MMAP</code></span></dt><dd>Retrieve and enable or disable memory mapping mode.
10420 </dd><dt><span class="term"><code class="constant">:SYNCMODE</code></span></dt><dd>Retrieve or set file system synchronization mode.
10421 </dd><dt><span class="term"><code class="constant">:CENTFREE</code></span></dt><dd>Retrieve or set central free block pool handling.
10422 </dd><dt><span class="term"><code class="constant">:COALESCEBLKS</code></span></dt><dd>Retrieve or set free block merging.
10423 </dd><dt><span class="term"><code class="constant">:DBNAME</code></span></dt><dd>Retrieve the namestring of the database (read-only).
10424 </dd><dt><span class="term"><code class="constant">:DEFAULT-VALUE-TYPE</code><br /></span><span class="term"><code class="constant">:DEFAULT-KEY-TYPE</code></span></dt><dd>The default data conversion types, see <a class="link" href="#gdbm-open"><code class="function">GDBM:GDBM-OPEN</code></a>.
10425 </dd></dl></div></dd><dt><a id="gdbm-file-size"></a><span class="term"><code class="code">(GDBM:GDBM-FILE-SIZE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Return the underlying file size using
10426 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html"><code class="function">lseek</code></a>.</dd><dt><a id="gdbm-count"></a><span class="term"><code class="code">(GDBM:GDBM-COUNT <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Return the number of records in the database.
10427 </dd><dt><a id="gdbm-do-db"></a><span class="term"><code class="code">(GDBM:DO-DB (<em class="replaceable"><code>key</code></em> <em class="replaceable"><code>db</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>options</code></em>)
10428 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Iterate over the database keys, <em class="replaceable"><code>options</code></em> are
10429 passed to <code class="function">GDBM-FIRSTKEY</code>
10430 and <code class="function">GDBM-NEXTKEY</code>.
10431 <em class="replaceable"><code>body</code></em> is passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>, so you can use all the standard loop
10432 contructs, e.g., <code class="code">(do-db (k db) :collect (list k (gdbm-fetch
10433 k)))</code> will convert the database to an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.
10434 </dd><dt><a id="gdbm-with-open-db"></a><span class="term"><code class="code">(GDBM:WITH-OPEN-DB (<em class="replaceable"><code>db</code></em> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>options</code></em>)
10435 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Open the <em class="replaceable"><code>filename</code></em>, execute the <em class="replaceable"><code>body</code></em>, close
10436 the database.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="berkeley-db"></a>33.7. Berkeley DB access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></dd><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></div><p>This interface to <a class="ulink" href="http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html" target="_top">Berkeley DB</a>
10437 from <a class="ulink" href="http://en.wikipedia.org/wiki/Sleepycat_Software" target="_top">Sleepycat
10438 Software</a>/<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> exports most functions in the official
10439 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> API. Supported versions:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_2.html">4.2</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_3.html">4.3</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_4.html">4.4</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_5.html">4.5</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_6.html">4.6</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_7.html">4.7</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_8.html">4.8</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_5_3.html">5.3</a></td></tr></table><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
10440 symbol <code class="constant">:BERKELEY-DB</code>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/berkeley-db/test.tst"><code class="filename">modules/berkeley-db/test.tst</code></a>
10441 for sample usage.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The symbol names do evolve with new Berkeley DB releases.
10442 E.g., version 4.3 introduced <code class="constant">DB_DSYNC_LOG</code> which
10443 was renamed to <code class="constant">DB_LOG_DSYNC</code> in version 4.7.
10444 The corresponding Lisp symbol was renamed from
10445 <code class="constant">:DSYNC-LOG</code> to <code class="constant">:LOG-DSYNC</code>
10446 when support for version 4.7 was added.
10447 This means that we always use Lisp names which correspond to the
10448 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> names in the <span class="emphasis"><em>latest</em></span> Berkeley DB release,
10449 even though we keep suport for older releases.
10450 This is convenient because the online documentation to which this
10451 manual refers documents the latest Berkeley DB release.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-objects"></a>33.7.1. Berkeley-DB Objects</h3></div></div></div><p>Thie module exports the following opaque <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> types:
10452 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="type">BDB:DBE</span></span></dt><dd>environment handle</dd><dt><span class="term"><span class="type">BDB:DB</span></span></dt><dd>database handle</dd><dt><span class="term"><span class="type">BDB:DBC</span></span></dt><dd>cursor handle</dd><dt><span class="term"><span class="type">BDB:TXN</span></span></dt><dd>transaction handle</dd><dt><span class="term"><span class="type">BDB:LOGC</span></span></dt><dd>log cursor handle</dd><dt><span class="term"><span class="type">BDB:MPOOLFILE</span></span></dt><dd>memory pool file handle</dd><dt><span class="term"><span class="type">BDB:DBLOCK</span></span></dt><dd>lock handle</dd></dl></div><p>
10453 They contain the internal handle (a <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>), the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
10454 of parents, and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of dependents.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-close"></a>33.7.2. Closing handles</h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> will close (or commit, in the case of a
10455 <a class="link" href="#bdb-transaction" title="33.7.13. Transaction Subsystem">transaction</a>, or
10456 put, in the case of a <a class="link" href="#bdb-lock" title="33.7.8. Lock Subsystem">lock</a>)
10457 the Berkeley-DB handle objects. The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or will also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.
10458 Closing an object will <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> all its dependents and remove the object
10459 itself from the dependents lists of its parents (but see
10460 <a class="link" href="#bdb-lock" title="33.7.8. Lock Subsystem"><code class="function">BDB:LOCK-CLOSE</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-db-environment"></a>33.7.3. Database Environment</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:DB-VERSION <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10461 subsystems-too)</code></span></dt><dd><p>Return version information as multiple values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">descriptive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
10462 (from <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/env_version.html"><code class="function">db_version</code></a>)</li><li class="listitem">major version number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li><li class="listitem">minor version number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li><li class="listitem">patch number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li></ol></div><p>When the optional argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, returns the
10463 <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of the subsystem versions as the 5th value.
10464 </p></dd><dt><a id="dbe-create"></a><span class="term"><code class="code">(BDB:DBE-CREATE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10465 PASSWORD ENCRYPT)</code></span></dt><dd>Create an environment handle
10466 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/env_class.html"><code class="function">db_env_create</code></a>),
10467 possibly using encryption with password
10468 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_encrypt.html"><code class="function">DB_ENV-&gt;set_encrypt</code></a>).
10469 </dd><dt><span class="term"><code class="code">(BDB:DBE-CLOSE dbe)</code></span></dt><dd>Close an environment
10470 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envclose.html"><code class="function">DB_ENV-&gt;close</code></a>).
10471 You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DBE-MESSAGES dbe)</code></span></dt><dd>Return the verbose messages accumulated so far
10472 (requires Berkeley-DB 4.3 or better).</dd><dt><span class="term"><code class="code">(BDB:DBREMOVE dbe file
10473 database <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Remove a database
10474 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envdbremove.html"><code class="function">DB_ENV-&gt;dbremove</code></a>).
10475 </dd><dt><span class="term"><code class="code">(BDB:DBREMOVE dbe file
10476 database newname <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Rename a database
10477 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envdbrename.html"><code class="function">DB_ENV-&gt;dbrename</code></a>).
10478 </dd><dt><a id="dbe-open"></a><span class="term"><code class="code">(BDB:DBE-OPEN dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10479 FLAGS HOME JOIN INIT-CDB INIT-LOCK INIT-LOG INIT-MPOOL INIT-TXN
10480 RECOVER RECOVER-FATAL USE-ENVIRON USE-ENVIRON-ROOT CREATE
10481 LOCKDOWN PRIVATE SYSTEM-MEM THREAD MODE)</code></span></dt><dd>Open an environment
10482 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html"><code class="function">DB_ENV-&gt;open</code></a>).
10483 <code class="constant">:FLAGS</code> may be the value of a previous call
10484 to <code class="code">(<a class="link" href="#dbe-get-options"><code class="function">BDB:DBE-GET-OPTIONS</code></a> dbe :OPEN)</code>.
10485 </dd><dt><span class="term"><code class="code">(BDB:DBE-REMOVE dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10486 HOME FORCE USE-ENVIRON USE-ENVIRON-ROOT)</code></span></dt><dd>Destroy an environment
10487 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envremove.html"><code class="function">DB_ENV-&gt;remove</code></a>).
10488 </dd><dt><a id="with-dbe"></a><span class="term"><code class="code">(BDB:WITH-DBE (var <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10489 <em class="replaceable"><code>create</code></em> <em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code></span></dt><dd>Create an environment, execute <em class="replaceable"><code>body</code></em>, close it.
10490 <em class="replaceable"><code>create</code></em> is a list of options to be passed to <a class="link" href="#dbe-create"><code class="function">BDB:DBE-CREATE</code></a>,
10491 <em class="replaceable"><code>options</code></em> is a list of options to be passed to <a class="link" href="#dbe-set-options"><code class="function">BDB:DBE-SET-OPTIONS</code></a>.
10492 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-environment-config"></a>33.7.4. Environment Configuration</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="dbe-set-options"></a><span class="term"><code class="code">(BDB:DBE-SET-OPTIONS dbe
10493 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> MSGFILE ERRFILE ERRPFX PASSWORD ENCRYPT LOCK-TIMEOUT TXN-TIMEOUT
10494 SHM-KEY TAS-SPINS TX-TIMESTAMP TX-MAX DATA-DIR TMP-DIR
10495 INTERMEDIATE-DIR-MODE LG-BSIZE LG-DIR
10496 LG-MAX LG-REGIONMAX NCACHE CACHESIZE CACHE LK-CONFLICTS LK-DETECT
10497 LK-MAX-LOCKERS LK-MAX-LOCKS LK-MAX-OBJECTS
10498 LOG-DIRECT LOG-DSYNC LOG-AUTO-REMOVE LOG-IN-MEMORY LOG-ZERO
10499 AUTO-COMMIT CDB-ALLDB DIRECT-DB NOLOCKING NOMMAP NOPANIC
10500 OVERWRITE PANIC-ENVIRONMENT REGION-INIT TXN-NOSYNC TXN-WRITE-NOSYNC YIELDCPU
10501 VERB-CHKPOINT VERB-DEADLOCK VERB-RECOVERY VERB-REPLICATION VERB-WAITSFOR
10502 VERBOSE)</code></span></dt><dd><p>Set some environment options using </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_flags.html"><code class="function">DB_ENV-&gt;set_flags</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_shm_key.html"><code class="function">DB_ENV-&gt;set_shm_key</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_regionmax.html"><code class="function">DB_ENV-&gt;set_lg_regionmax</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_set_config.html"><code class="function">DB_ENV-&gt;log_set_config</code></a> (v4.7+)</td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_timeout.html"><code class="function">DB_ENV-&gt;set_timeout</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_conflicts.html"><code class="function">DB_ENV-&gt;set_lk_conflicts</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_verbose.html"><code class="function">DB_ENV-&gt;set_verbose</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_encrypt.html"><code class="function">DB_ENV-&gt;set_encrypt</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_detect.html"><code class="function">DB_ENV-&gt;set_lk_detect</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_intermediate_dir_mode.html"><code class="function">DB_ENV-&gt;set_intermediate_dir_mode</code></a> (v4.7+)</td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errfile.html"><code class="function">DB_ENV-&gt;set_errfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_lockers.html"><code class="function">DB_ENV-&gt;set_lk_max_lockers</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tmp_dir.html"><code class="function">DB_ENV-&gt;set_tmp_dir</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_msgfile.html"><code class="function">DB_ENV-&gt;set_msgfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_locks.html"><code class="function">DB_ENV-&gt;set_lk_max_locks</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_data_dir.html"><code class="function">DB_ENV-&gt;set_data_dir</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errpfx.html"><code class="function">DB_ENV-&gt;set_errpfx</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_objects.html"><code class="function">DB_ENV-&gt;set_lk_max_objects</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_max.html"><code class="function">DB_ENV-&gt;set_tx_max</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_bsize.html"><code class="function">DB_ENV-&gt;set_lg_bsize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html"><code class="function">DB_ENV-&gt;set_cachesize</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_timestamp.html"><code class="function">DB_ENV-&gt;set_tx_timestamp</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_dir.html"><code class="function">DB_ENV-&gt;set_lg_dir</code></a></td><td> </td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tas_spins.html"><code class="function">DB_ENV-&gt;set_tas_spins</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_max.html"><code class="function">DB_ENV-&gt;set_lg_max</code></a></td><td> </td></tr></table></dd><dt><a id="dbe-get-options"></a><span class="term"><code class="code">(BDB:DBE-GET-OPTIONS dbe
10503 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd><p>Retrieve some environment options.
10504 </p><div class="variablelist"><p class="title"><strong>Values of <em class="replaceable"><code>what</code></em></strong></p><dl class="variablelist"><dt><span class="term">missing<br /></span><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>all options as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
10505 </dd><dt><span class="term"><code class="constant">:TX-TIMESTAMP</code></span></dt><dd>Recover to the time specified by timestamp
10506 rather than to the most current possible date
10507 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tx_timestamp.html"><code class="function">DB_ENV-&gt;get_tx_timestamp</code></a>)
10508 </dd><dt><span class="term"><code class="constant">:TX-MAX</code></span></dt><dd>the number of active transactions
10509 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_max.html"><code class="function">DB_ENV-&gt;set_tx_max</code></a>)
10510 </dd><dt><span class="term"><code class="constant">:DATA-DIR</code></span></dt><dd>list of data directories
10511 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_data_dir.html"><code class="function">DB_ENV-&gt;get_data_dir</code></a>)
10512 </dd><dt><span class="term"><code class="constant">:TMP-DIR</code></span></dt><dd>temporary directory
10513 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tmp_dir.html"><code class="function">DB_ENV-&gt;get_tmp_dir</code></a>).
10514 May be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="constant">:INTERMEDIATE-DIR-MODE</code></span></dt><dd>mode for creating intermediate directories
10515 during recovery (v4.7+)
10516 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_intermediate_dir_mode.html"><code class="function">DB_ENV-&gt;get_intermediate_dir_mode</code></a>).
10517 </dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of verbosity settings
10518 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV-&gt;get_verbose</code></a>).
10519 </dd><dt><span class="term"><code class="constant">:AUTO-COMMIT</code><br /></span><span class="term"><code class="constant">:CDB-ALLDB</code><br /></span><span class="term"><code class="constant">:DIRECT-DB</code><br /></span><span class="term"><code class="constant">:LOG-DIRECT</code><br /></span><span class="term"><code class="constant">:LOG-DSYNC</code><br /></span><span class="term"><code class="constant">:LOG-AUTO-REMOVE</code><br /></span><span class="term"><code class="constant">:LOG-IN-MEMORY</code><br /></span><span class="term"><code class="constant">:LOG-ZERO</code><br /></span><span class="term"><code class="constant">:NOLOCKING</code><br /></span><span class="term"><code class="constant">:NOMMAP</code><br /></span><span class="term"><code class="constant">:NOPANIC</code><br /></span><span class="term"><code class="constant">:OVERWRITE</code><br /></span><span class="term"><code class="constant">:PANIC-ENVIRONMENT</code><br /></span><span class="term"><code class="constant">:REGION-INIT</code><br /></span><span class="term"><code class="constant">:TXN-NOSYNC</code><br /></span><span class="term"><code class="constant">:TXN-WRITE-NOSYNC</code><br /></span><span class="term"><code class="constant">:YIELDCPU</code><br /></span><span class="term"><code class="constant">:VERB-CHKPOINT</code><br /></span><span class="term"><code class="constant">:VERB-DEADLOCK</code><br /></span><span class="term"><code class="constant">:VERB-RECOVERY</code><br /></span><span class="term"><code class="constant">:VERB-REPLICATION</code><br /></span><span class="term"><code class="constant">:VERB-WAITSFOR</code></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether this
10520 option is set or not
10521 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV-&gt;get_verbose</code></a>,
10522 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV-&gt;get_flags</code></a>, and
10523 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_get_config.html"><code class="function">DB_ENV-&gt;log_get_config</code></a>).
10524 </dd><dt><span class="term"><code class="constant">:LG-BSIZE</code></span></dt><dd>log buffer size
10525 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_bsize.html"><code class="function">DB_ENV-&gt;get_lg_bsize</code></a>).
10526 </dd><dt><span class="term"><code class="constant">:LG-DIR</code></span></dt><dd>logging directory
10527 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_dir.html"><code class="function">DB_ENV-&gt;get_lg_dir</code></a>).
10528 </dd><dt><span class="term"><code class="constant">:LG-MAX</code></span></dt><dd>log file size
10529 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_max.html"><code class="function">DB_ENV-&gt;get_lg_max</code></a>).
10530 </dd><dt><span class="term"><code class="constant">:LG-REGIONMAX</code></span></dt><dd>logging region size
10531 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_regionmax.html"><code class="function">DB_ENV-&gt;get_lg_regionmax</code></a>).
10532 </dd><dt><span class="term"><code class="constant">:NCACHE</code><br /></span><span class="term"><code class="constant">:CACHESIZE</code><br /></span><span class="term"><code class="constant">:CACHE</code></span></dt><dd>cache parameters
10533 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV-&gt;get_cachesize</code></a>).
10534 </dd><dt><span class="term"><code class="constant">:LK-CONFLICTS</code></span></dt><dd>lock conflicts matrix
10535 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_conflicts.html"><code class="function">DB_ENV-&gt;get_lk_conflicts</code></a>).
10536 </dd><dt><span class="term"><code class="constant">:LK-DETECT</code></span></dt><dd>automatic deadlock detection
10537 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_detect.html"><code class="function">DB_ENV-&gt;get_lk_detect</code></a>).
10538 </dd><dt><span class="term"><code class="constant">:LK-MAX-LOCKERS</code></span></dt><dd>maximum number of lockers
10539 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_lockers.html"><code class="function">DB_ENV-&gt;get_lk_max_lockers</code></a>).
10540 </dd><dt><span class="term"><code class="constant">:LK-MAX-LOCKS</code></span></dt><dd>maximum number of locks
10541 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_locks.html"><code class="function">DB_ENV-&gt;get_lk_max_locks</code></a>).
10542 </dd><dt><span class="term"><code class="constant">:LK-MAX-OBJECTS</code></span></dt><dd>maximum number of lock objects
10543 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_objects.html"><code class="function">DB_ENV-&gt;get_lk_max_objects</code></a>).
10544 </dd><dt><span class="term"><code class="constant">:TAS-SPINS</code></span></dt><dd>the number of test-and-set spins
10545 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tas_spins.html"><code class="function">DB_ENV-&gt;get_tas_spins</code></a>).
10546 </dd><dt><span class="term"><code class="constant">:SHM-KEY</code></span></dt><dd>base segment ID for shared memory regions
10547 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_shm_key.html"><code class="function">DB_ENV-&gt;get_shm_key</code></a>).
10548 </dd><dt><span class="term"><code class="constant">:LOCK-TIMEOUT</code><br /></span><span class="term"><code class="constant">:TXN-TIMEOUT</code></span></dt><dd>timeout values for locks or transactions in the
10549 database environment
10550 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_timeout.html"><code class="function">DB_ENV-&gt;get_timeout</code></a>).
10551 </dd><dt><span class="term"><code class="constant">:ENCRYPT</code></span></dt><dd>encryption flags
10552 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_encrypt_flags.html"><code class="function">DB_ENV-&gt;get_encrypt_flags</code></a>).
10553 </dd><dt><span class="term"><code class="constant">:ERRFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10554 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errfile.html"><code class="function">DB_ENV-&gt;get_errfile</code></a>).
10555 </dd><dt><span class="term"><code class="constant">:MSGFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10556 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_msgfile.html"><code class="function">DB_ENV-&gt;get_msgfile</code></a>).
10557 </dd><dt><span class="term"><code class="constant">:ERRPFX</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10558 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errpfx.html"><code class="function">DB_ENV-&gt;get_errpfx</code></a>).
10559 </dd><dt><span class="term"><code class="constant">:DB-GID-SIZE</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> of the globally unique
10560 <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> which must be passed to
10561 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnprepare.html"><code class="function">DB_TXN-&gt;prepare</code></a>.
10562 </dd><dt><span class="term"><code class="constant">:HOME</code></span></dt><dd>the home directory when open
10563 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_home.html"><code class="function">DB_ENV-&gt;get_home</code></a>).
10564 </dd><dt><span class="term"><code class="constant">:OPEN</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of flags passed to <a class="link" href="#dbe-open"><code class="function">BDB:DBE-OPEN</code></a>
10565 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_open_flags.html"><code class="function">DB_ENV-&gt;get_open_flags</code></a>).
10566 </dd><dt><span class="term"><code class="constant">:CACHE</code></span></dt><dd>database cache information
10567 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV-&gt;get_cachesize</code></a>).
10568 </dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-operations"></a>33.7.5. Database Operations</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="db-create"></a><span class="term"><code class="code">(BDB:DB-CREATE dbe)</code></span></dt><dd>Create a database handle
10569 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/db_class.html"><code class="function">db_create</code></a>).
10570 </dd><dt><span class="term"><code class="code">(BDB:DB-CLOSE db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> NOSYNC)</code></span></dt><dd>Close a database
10571 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbclose.html"><code class="function">DB-&gt;close</code></a>).
10572 You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DB-DEL dbe key <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10573 TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Delete items from a database
10574 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbdel.html"><code class="function">DB-&gt;del</code></a>).
10575 </dd><dt><span class="term"><code class="code">(BDB:DB-FD db)</code></span></dt><dd>Return the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the database
10576 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbfd.html"><code class="function">DB-&gt;fd</code></a>).
10577 </dd><dt><span class="term"><code class="code">(BDB:DB-GET db key <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> ACTION AUTO-COMMIT
10578 DEGREE-2 DIRTY-READ MULTIPLE RMW TRANSACTION (ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd><p>Get items from a database
10579 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget.html"><code class="function">DB-&gt;get</code></a>).
10580 If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
10581 instead <code class="constant">:NOTFOUND</code> is returned.
10582 <code class="constant">:ACTION</code> should be one of
10583 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:CONSUME</code></td><td><code class="constant">:GET-BOTH</code></td></tr><tr><td><code class="constant">:CONSUME-WAIT</code></td><td><code class="constant">:SET-RECNO</code></td></tr></table><p>
10584 </p></dd><dt><span class="term"><code class="code">(BDB:DB-PUT db key val
10585 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> AUTO-COMMIT ACTION TRANSACTION)</code></span></dt><dd><p>Store items into a database
10586 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbput.html"><code class="function">DB-&gt;put</code></a>).
10587 <code class="constant">:ACTION</code> should be one of
10588 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:APPEND</code></td><td><code class="constant">:NODUPDATA</code></td><td><code class="constant">:NOOVERWRITE</code></td></tr></table><p>
10589 </p></dd><dt><span class="term"><code class="code">(BDB:DB-STAT db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> FAST-STAT
10590 TRANSACTION)</code></span></dt><dd>Return database statistics
10591 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_byteswapped.html"><code class="function">DB-&gt;get_byteswapped</code></a>,
10592 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_type.html"><code class="function">DB-&gt;get_type</code></a>,
10593 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbstat.html"><code class="function">DB-&gt;stat</code></a>).
10594 </dd><dt><a id="db-open"></a><span class="term"><code class="code">(BDB:DB-OPEN db file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10595 DATABASE TYPE MODE FLAGS CREATE DIRTY-READ EXCL NOMMAP RDONLY
10596 THREAD TRUNCATE AUTO-COMMIT TRANSACTION)</code></span></dt><dd><p>Open a database (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbopen.html"><code class="function">DB-&gt;open</code></a>).
10597 <code class="constant">:TYPE</code> should be one of
10598 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:BTREE</code></td><td><code class="constant">:RECNO</code></td></tr><tr><td><code class="constant">:HASH</code></td><td><code class="constant">:UNKNOWN</code> (default)</td></tr><tr><td><code class="constant">:QUEUE</code></td><td> </td></tr></table><p>
10599 <code class="constant">:FLAGS</code> may be the value of a previous call
10600 to <code class="code">(<a class="link" href="#db-get-options"><code class="function">BDB:DB-GET-OPTIONS</code></a> db :OPEN)</code>
10601 </p></dd><dt><span class="term"><code class="code">(BDB:DB-SYNC db)</code></span></dt><dd>Flush a database to stable storage
10602 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbsync.html"><code class="function">DB-&gt;sync</code></a>).
10603 </dd><dt><span class="term"><code class="code">(BDB:DB-TRUNCATE db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10604 TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Empty a database
10605 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbtruncate.html"><code class="function">DB-&gt;truncate</code></a>).
10606 </dd><dt><span class="term"><code class="code">(BDB:DB-UPGRADE db file
10607 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> DUPSORT)</code></span></dt><dd>Upgrade a database
10608 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbupgrade.html"><code class="function">DB-&gt;upgrade</code></a>).
10609 </dd><dt><span class="term"><code class="code">(BDB:DB-RENAME db file database newname)</code></span></dt><dd>Rename a database
10610 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbrename.html"><code class="function">DB-&gt;rename</code></a>).
10611 </dd><dt><span class="term"><code class="code">(BDB:DB-REMOVE db file database)</code></span></dt><dd>Remove a database
10612 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbremove.html"><code class="function">DB-&gt;remove</code></a>).
10613 </dd><dt><span class="term"><code class="code">(BDB:DB-JOIN db cursor-sequence
10614 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> JOIN-NOSORT)</code></span></dt><dd>Create a specialized join cursor for use in
10615 performing equality or natural joins on secondary indices
10616 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbjoin.html"><code class="function">DB-&gt;join</code></a>).
10617 </dd><dt><span class="term"><code class="code">(BDB:DB-KEY-RANGE db key
10618 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> TRANSACTION)</code></span></dt><dd>return an estimate of the proportion of keys that
10619 are less than, equal to, and greater than the specified key
10620 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbkey_range.html"><code class="function">DB-&gt;key_range</code></a>).
10621 The underlying database must be of type Btree.
10622 </dd><dt><span class="term"><code class="code">(BDB:DB-VERIFY db file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10623 DATABASE SALVAGE AGGRESSIVE PRINTABLE NOORDERCHK)</code></span></dt><dd>Verify/salvage a database
10624 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbverify.html"><code class="function">DB-&gt;verify</code></a>).
10625 <code class="constant">:SALVAGE</code>, if supplied, should be the output
10626 file name. <code class="constant">:DATABASE</code>, if supplied,
10627 will force <code class="constant">DB_ORDERCHKONLY</code>.
10628 </dd><dt><a id="with-db"></a><span class="term"><code class="code">(BDB:WITH-DB (var dbe file
10629 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>create</code></em> <em class="replaceable"><code>options</code></em> <em class="replaceable"><code>open</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code></span></dt><dd>Open the database, execute <em class="replaceable"><code>body</code></em>, close it.
10630 <em class="replaceable"><code>create</code></em> is a list of options to be passed to <a class="link" href="#db-create"><code class="function">BDB:DB-CREATE</code></a>,
10631 <em class="replaceable"><code>options</code></em> is a list of options to be passed to <a class="link" href="#db-set-options"><code class="function">BDB:DB-SET-OPTIONS</code></a>,
10632 <em class="replaceable"><code>open</code></em> is a list of options to be passed to <a class="link" href="#db-open"><code class="function">BDB:DB-OPEN</code></a>.
10633 </dd><dt><a id="db-compact"></a><span class="term"><code class="code">(BDB:DB-COMPACT db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10634 TRANSACTION START STOP FREE FILL TIMEOUT PAGES TYPE)</code></span></dt><dd>Call <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcompact.html"><code class="function">DB-&gt;compact</code></a>.
10635 <code class="constant">:FREE</code> is either <code class="constant">:LIST-ONLY</code>
10636 or <code class="constant">:SPACE</code>.
10637 <code class="constant">:FILL</code>, <code class="constant">:TIMEOUT</code>,
10638 <code class="constant">:PAGES</code> are passed in <span class="type">DB_COMPACT</span>.
10639 <code class="constant">:TYPE</code> is how the <code class="varname">end</code> is returned.
10640 The second return value is a <span class="type">BDB:DB-COMPACT</span>.
10641 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-db-config"></a>33.7.6. Database Configuration</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="db-set-options"></a><span class="term"><code class="code">(BDB:DB-SET-OPTIONS db
10642 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> ERRFILE MSGFILE ERRPFX PASSWORD ENCRYPTION NCACHE CACHESIZE CACHE
10643 LORDER PAGESIZE BT-MINKEY H-FFACTOR H-NELEM Q-EXTENTSIZE
10644 RE-DELIM RE-LEN RE-PAD RE-SOURCE
10645 CHKSUM ENCRYPT TXN-NOT-DURABLE DUP DUPSORT INORDER RECNUM REVSPLITOFF
10646 RENUMBER SNAPSHOT)</code></span></dt><dd><p>Set some database options using </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errfile.html"><code class="function">DB_ENV-&gt;set_errfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_pagesize.html"><code class="function">DB-&gt;set_pagesize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_len.html"><code class="function">DB-&gt;set_re_len</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_msgfile.html"><code class="function">DB_ENV-&gt;set_msgfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_bt_minkey.html"><code class="function">DB-&gt;set_bt_minkey</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_pad.html"><code class="function">DB-&gt;set_re_pad</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errpfx.html"><code class="function">DB_ENV-&gt;set_errpfx</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_h_ffactor.html"><code class="function">DB-&gt;set_h_ffactor</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_source.html"><code class="function">DB-&gt;set_re_source</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_encrypt.html"><code class="function">DB-&gt;set_encrypt</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_h_nelem.html"><code class="function">DB-&gt;set_h_nelem</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_flags.html"><code class="function">DB-&gt;set_flags</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_cachesize.html"><code class="function">DB-&gt;set_cachesize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_q_extentsize.html"><code class="function">DB-&gt;set_q_extentsize</code></a></td><td> </td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_lorder.html"><code class="function">DB-&gt;set_lorder</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_delim.html"><code class="function">DB-&gt;set_re_delim</code></a></td><td> </td></tr></table></dd><dt><a id="db-get-options"></a><span class="term"><code class="code">(BDB:DB-GET-OPTIONS db
10647 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd><p>Retrieve some database options.
10648 </p><div class="variablelist"><p class="title"><strong>Values of <em class="replaceable"><code>what</code></em></strong></p><dl class="variablelist"><dt><span class="term">missing<br /></span><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>all options as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
10649 </dd><dt><span class="term"><code class="constant">:FLAGS</code></span></dt><dd>all flags
10650 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV-&gt;get_flags</code></a>).
10651 </dd><dt><span class="term"><code class="constant">:CHKSUM</code><br /></span><span class="term"><code class="constant">:ENCRYPT</code><br /></span><span class="term"><code class="constant">:TXN-NOT-DURABLE</code><br /></span><span class="term"><code class="constant">:DUP</code><br /></span><span class="term"><code class="constant">:DUPSORT</code><br /></span><span class="term"><code class="constant">:INORDER</code><br /></span><span class="term"><code class="constant">:RECNUM</code><br /></span><span class="term"><code class="constant">:REVSPLITOFF</code><br /></span><span class="term"><code class="constant">:RENUMBER</code><br /></span><span class="term"><code class="constant">:SNAPSHOT</code></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether this
10652 option is set or not
10653 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV-&gt;get_verbose</code></a> and
10654 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV-&gt;get_flags</code></a>).
10655 </dd><dt><span class="term"><code class="constant">:CACHE</code></span></dt><dd>database cache information
10656 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_cachesize.html"><code class="function">DB-&gt;get_cachesize</code></a> or
10657 <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV-&gt;get_cachesize</code></a> if the
10658 database was created within an environment).
10659 </dd><dt><span class="term"><code class="constant">:ENCRYPTION</code></span></dt><dd>encryption flags
10660 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_encrypt_flags.html"><code class="function">DB_ENV-&gt;get_encrypt_flags</code></a>).
10661 </dd><dt><span class="term"><code class="constant">:ERRFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10662 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errfile.html"><code class="function">DB_ENV-&gt;get_errfile</code></a>).
10663 </dd><dt><span class="term"><code class="constant">:MSGFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10664 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_msgfile.html"><code class="function">DB_ENV-&gt;get_msgfile</code></a>).
10665 </dd><dt><span class="term"><code class="constant">:ERRPFX</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10666 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errpfx.html"><code class="function">DB_ENV-&gt;get_errpfx</code></a>).
10667 </dd><dt><span class="term"><code class="constant">:PAGESIZE</code></span></dt><dd>database page size
10668 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_pagesize.html"><code class="function">DB-&gt;get_pagesize</code></a>).
10669 </dd><dt><span class="term"><code class="constant">:BT-MINKEY</code></span></dt><dd>the minimum number of key/data pairs intended to
10670 be stored on any single <code class="constant">:BTREE</code> leaf page
10671 underlying source file
10672 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_bt_minkey.html"><code class="function">DB-&gt;get_bt_minkey</code></a>).
10673 </dd><dt><span class="term"><code class="constant">:H-FFACTOR</code></span></dt><dd>the desired density within
10674 the <code class="constant">:HASH</code> table
10675 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_h_ffactor.html"><code class="function">DB-&gt;get_h_ffactor</code></a>).
10676 </dd><dt><span class="term"><code class="constant">:H-NELEM</code></span></dt><dd>an estimate of the final size of
10677 the <code class="constant">:HASH</code> table
10678 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_h_nelem.html"><code class="function">DB-&gt;get_h_nelem</code></a>).
10679 </dd><dt><span class="term"><code class="constant">:Q-EXTENTSIZE</code></span></dt><dd>the size of the extents used to hold pages in
10680 a <code class="constant">:QUEUE</code> database
10681 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_q_extentsize.html"><code class="function">DB-&gt;get_q_extentsize</code></a>).
10682 </dd><dt><span class="term"><code class="constant">:RE-DELIM</code></span></dt><dd>the record delimiter for <code class="constant">:RECNO</code> databases
10683 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_delim.html"><code class="function">DB-&gt;get_re_delim</code></a>).
10684 </dd><dt><span class="term"><code class="constant">:RE-LEN</code></span></dt><dd>database record length
10685 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_len.html"><code class="function">DB-&gt;get_re_len</code></a>).
10686 </dd><dt><span class="term"><code class="constant">:RE-PAD</code></span></dt><dd>database record pad byte
10687 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_pad.html"><code class="function">DB-&gt;get_re_pad</code></a>).
10688 </dd><dt><span class="term"><code class="constant">:RE-SOURCE</code></span></dt><dd>the underlying source file for <code class="constant">:RECNO</code> databases
10689 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_source.html"><code class="function">DB-&gt;get_re_source</code></a>).
10690 </dd><dt><span class="term"><code class="constant">:LORDER</code></span></dt><dd>database byte order
10691 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_lorder.html"><code class="function">DB-&gt;get_lorder</code></a>).
10692 </dd><dt><span class="term"><code class="constant">:DBNAME</code></span></dt><dd>the file name and database name
10693 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_dbname.html"><code class="function">DB-&gt;get_dbname</code></a>)
10694 </dd><dt><span class="term"><code class="constant">:TRANSACTIONAL</code></span></dt><dd>the indicator whether the database is transactional
10695 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_transactional.html"><code class="function">DB-&gt;get_transactional</code></a>).
10696 </dd><dt><span class="term"><code class="constant">:OPEN</code></span></dt><dd>the flags passed to <a class="link" href="#db-open"><code class="function">BDB:DB-OPEN</code></a>
10697 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_open_flags.html"><code class="function">DB-&gt;get_open_flags</code></a>).
10698 </dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Once you call a method for one type of access method,
10699 the handle can only be used for that type.
10700 The methods <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_delim.html"><code class="function">DB-&gt;get_re_delim</code></a>
10701 and <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_source.html"><code class="function">DB-&gt;get_re_source</code></a> are for
10702 a <code class="constant">:RECNO</code> database so you <span class="strong"><strong>cannot</strong></span> call them
10703 (by passing <code class="constant">:RE-DELIM</code>
10704 or <code class="constant">:RE-SOURCE</code> to this function)
10705 and then use the database handle to open a database of different type
10706 (e.g., <code class="constant">:QUEUE</code>).</p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-cursor"></a>33.7.7. Database Cursor Operations</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="make-dbc"></a><span class="term"><code class="code">(BDB:MAKE-DBC db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10707 DEGREE-2 DIRTY-READ WRITECURSOR TRANSACTION)</code></span></dt><dd>Create a cursor handle
10708 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcursor.html"><code class="function">DB-&gt;cursor</code></a>).
10709 </dd><dt><span class="term"><code class="code">(BDB:DBC-CLOSE cursor)</code></span></dt><dd>Close the cursor handle
10710 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcclose.html"><code class="function">DBCursor-&gt;close</code></a>).
10711 You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DBC-COUNT cursor)</code></span></dt><dd>Return count of duplicates
10712 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbccount.html"><code class="function">DBCursor-&gt;count</code></a>).
10713 </dd><dt><span class="term"><code class="code">(BDB:DBC-DEL cursor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> CONSUME)</code></span></dt><dd>Delete by cursor
10714 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcdel.html"><code class="function">DBCursor-&gt;del</code></a>).
10715 </dd><dt><span class="term"><code class="code">(BDB:DBC-DUP cursor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> POSITION)</code></span></dt><dd>Duplicate a cursor
10716 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcdup.html"><code class="function">DBCursor-&gt;dup</code></a>).
10717 </dd><dt><span class="term"><code class="code">(BDB:DBC-GET cursor key data action
10718 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> DEGREE-2 DIRTY-READ MULTIPLE (ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd><p>Retrieve by cursor
10719 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcget.html"><code class="function">DBCursor-&gt;get</code></a>).
10720 If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
10721 <code class="constant">:NOTFOUND</code> or <code class="constant">:KEYEMPTY</code>
10722 is returned instead, as appropriate.
10723 <em class="replaceable"><code>action</code></em> should be one of
10724 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:CURRENT</code></td><td><code class="constant">:GET-RECNO</code></td><td><code class="constant">:NEXT-DUP</code></td><td><code class="constant">:SET</code></td></tr><tr><td><code class="constant">:FIRST</code></td><td><code class="constant">:JOIN-ITEM</code></td><td><code class="constant">:NEXT-NODUP</code></td><td><code class="constant">:SET-RANGE</code></td></tr><tr><td><code class="constant">:GET-BOTH</code></td><td><code class="constant">:LAST</code></td><td><code class="constant">:PREV</code></td><td><code class="constant">:SET-RECNO</code></td></tr><tr><td><code class="constant">:GET-BOTH-RANGE</code></td><td><code class="constant">:NEXT</code></td><td><code class="constant">:PREV-NODUP</code></td><td> </td></tr></table><p>
10725 </p></dd><dt><span class="term"><code class="code">(BDB:DBC-PUT cursor key data flag)</code></span></dt><dd>Store by cursor
10726 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcput.html"><code class="function">DBCursor-&gt;put</code></a>).
10727 </dd><dt><span class="term"><code class="code">(BDB:WITH-DBC (var <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>
10728 <em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>))</code></span></dt><dd>Open a cursor, execute <em class="replaceable"><code>body</code></em>, close it.
10729 <em class="replaceable"><code>options</code></em> are passed to <a class="link" href="#make-dbc"><code class="function">BDB:MAKE-DBC</code></a>.
10730 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-lock"></a>33.7.8. Lock Subsystem</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOCK-DETECT dbe action)</code></span></dt><dd>Perform deadlock detection
10731 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_detect.html"><code class="function">DB_ENV-&gt;lock_detect</code></a>).
10732 </dd><dt><span class="term"><code class="code">(BDB:LOCK-ID dbe)</code></span></dt><dd>Acquire a locker ID
10733 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_id.html"><code class="function">DB_ENV-&gt;lock_id</code></a>).
10734 </dd><dt><span class="term"><code class="code">(BDB:LOCK-ID-FREE dbe id)</code></span></dt><dd>Release a locker ID
10735 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_id_free.html"><code class="function">DB_ENV-&gt;lock_id_free</code></a>).
10736 All associated locks should be released first.
10737 </dd><dt><span class="term"><code class="code">(BDB:LOCK-GET dbe object locker
10738 mode <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> NOWAIT)</code></span></dt><dd>Acquire a lock
10739 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_get.html"><code class="function">DB_ENV-&gt;lock_get</code></a>).
10740 The <span class="type">BDB:DBLOCK</span> object returned by this function will
10741 <span class="strong"><strong>not</strong></span> be released when the environment is closed.
10742 This permits long-lived locks.</dd><dt><span class="term"><code class="code">(BDB:LOCK-PUT dbe lock)</code></span></dt><dd>Release a lock
10743 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_put.html"><code class="function">DB_ENV-&gt;lock_put</code></a>).
10744 </dd><dt><span class="term"><code class="code">(BDB:LOCK-CLOSE lock)</code></span></dt><dd><p class="simpara">Release a lock
10745 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_put.html"><code class="function">DB_ENV-&gt;lock_put</code></a>) using the
10746 environment with which it has been acquired.
10747 This is used to <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <span class="type">BDB:DBLOCK</span> objects.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If that environment has already been closed, you are
10748 in a big trouble (segfault), so you better release your locks or do
10749 not drop them.</p></div></dd><dt><span class="term"><code class="code">(BDB:LOCK-STAT dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10750 STAT-CLEAR)</code></span></dt><dd>Return lock subsystem statistics
10751 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_stat.html"><code class="function">DB_ENV-&gt;lock_stat</code></a>).
10752 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-log"></a>33.7.9. Log Subsystem</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-ARCHIVE dbe
10753 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> ARCH-ABS ARCH-DATA ARCH-LOG ARCH-REMOVE)</code></span></dt><dd>Return a list of log or database filenames
10754 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_archive.html"><code class="function">DB_ENV-&gt;log_archive</code></a>).
10755 </dd><dt><span class="term"><code class="code">(BDB:LOG-FILE dbe lsn)</code></span></dt><dd>Return the name of the file containing the record
10756 named by <em class="replaceable"><code>lsn</code></em>
10757 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_file.html"><code class="function">DB_ENV-&gt;log_file</code></a>).
10758 </dd><dt><span class="term"><code class="code">(BDB:LOG-FLUSH dbe lsn)</code></span></dt><dd>Flush log records to disk
10759 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_flush.html"><code class="function">DB_ENV-&gt;log_flush</code></a>).
10760 </dd><dt><span class="term"><code class="code">(BDB:LOG-PUT dbe data
10761 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :FLUSH)</code></span></dt><dd>Write a log record
10762 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_put.html"><code class="function">DB_ENV-&gt;log_put</code></a>).
10763 </dd><dt><span class="term"><code class="code">(BDB:LOG-STAT dbe
10764 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> STAT-CLEAR)</code></span></dt><dd>Logging subsystem statistics
10765 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_stat.html"><code class="function">DB_ENV-&gt;log_stat</code></a>).
10766 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bdb-log-cursor"></a>33.7.9.1. Log Cursor Operations</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-CURSOR dbe)</code></span></dt><dd>Create a log cursor handle
10767 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_cursor.html"><code class="function">DB_ENV-&gt;log_cursor</code></a>).
10768 </dd><dt><span class="term"><code class="code">(BDB:LOGC-CLOSE logc)</code></span></dt><dd>Close a log cursor handle
10769 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/logcclose.html"><code class="function">DB_LOGC-&gt;close</code></a>).
10770 </dd><dt><span class="term"><code class="code">(BDB:LOGC-GET logc action
10771 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> TYPE ERROR)</code></span></dt><dd><p>Retrieve a log record
10772 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/logcget.html"><code class="function">DB_LOGC-&gt;get</code></a>).
10773 If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
10774 <code class="constant">:NOTFOUND</code> is returned instead.
10775 </p><div class="variablelist"><p class="title"><strong>Valid <em class="replaceable"><code>action</code></em>s</strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:CURRENT</code><br /></span><span class="term"><code class="constant">:FIRST</code><br /></span><span class="term"><code class="constant">:LAST</code><br /></span><span class="term"><code class="constant">:NEXT</code><br /></span><span class="term"><code class="constant">:PREV</code></span></dt><dd>Retrieve the appropriate record.
10776 </dd><dt><span class="term"><span class="type">DB:LSN</span></span></dt><dd>Retrieve the specified record, as
10777 with <code class="constant">DB_SET</code>.
10778 </dd></dl></div><p>
10779 Returns two values: the datum of type specified by the <code class="constant">:TYPE</code>
10780 argument and the <span class="type">DB:LSN</span> value of the record retrieved
10781 (when <em class="replaceable"><code>action</code></em> is a <span class="type">DB:LSN</span>, it
10782 is returned unchanged).
10783 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bdb-log-seq"></a>33.7.9.2. Log Sequence Numbers</h4></div></div></div><p>Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a> to check similarity of <span class="type">BDB:LSN</span> objects.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-COMPARE lsn1 lsn2)</code></span></dt><dd>Compare two Log Sequence Numbers
10784 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/log_compare.html"><code class="function">log_compare</code></a>).
10785 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-mem-pool"></a>33.7.10. Memory Pool Subsystem</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-replication"></a>33.7.11. Replication</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-sequences"></a>33.7.12. Sequences</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-transaction"></a>33.7.13. Transaction Subsystem</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:TXN-BEGIN dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10786 DEGREE-2 PARENT DIRTY-READ NOSYNC NOWAIT SYNC)</code></span></dt><dd>Begin a transaction
10787 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_begin.html"><code class="function">DB_ENV-&gt;txn_begin</code></a>).
10788 </dd><dt><span class="term"><code class="code">(BDB:TXN-ABORT txn)</code></span></dt><dd>Abort a transaction
10789 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnabort.html"><code class="function">DB_TXN-&gt;abort</code></a>).
10790 </dd><dt><span class="term"><code class="code">(BDB:TXN-COMMIT txn <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10791 NOSYNC SYNC)</code></span></dt><dd>Commit a transaction
10792 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txncommit.html"><code class="function">DB_TXN-&gt;commit</code></a>).
10793 </dd><dt><span class="term"><code class="code">(BDB:TXN-DISCARD txn)</code></span></dt><dd>Discard a transaction
10794 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txndiscard.html"><code class="function">DB_TXN-&gt;discard</code></a>).
10795 </dd><dt><span class="term"><code class="code">(BDB:TXN-ID txn)</code></span></dt><dd>Return the transaction's ID
10796 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnid.html"><code class="function">DB_TXN-&gt;id</code></a>).
10797 </dd><dt><span class="term"><code class="code">(BDB:TXN-CHECKPOINT dbe
10798 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> KBYTE MIN FORCE)</code></span></dt><dd>Checkpoint the transaction subsystem
10799 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_checkpoint.html"><code class="function">DB_ENV-&gt;txn_checkpoint</code></a>).
10800 </dd><dt><span class="term"><code class="code">(BDB:TXN-PREPARE txn id)</code></span></dt><dd>Initiate the beginning of a two-phase commit
10801 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnprepare.html"><code class="function">DB_TXN-&gt;prepare</code></a>).
10802 </dd><dt><span class="term"><code class="code">(BDB:TXN-RECOVER dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10803 FIRST NEXT)</code></span></dt><dd>Return a list of prepared but not yet resolved
10804 transactions (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_recover.html"><code class="function">DB_ENV-&gt;txn_recover</code></a>).
10805 </dd><dt><span class="term"><code class="code">(BDB:TXN-SET-TIMEOUT txn
10806 timeout which)</code></span></dt><dd>Set timeout values for locks or transactions for the
10807 specified transaction
10808 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnset_timeout.html"><code class="function">DB_TXN-&gt;set_timeout</code></a>).
10809 </dd><dt><span class="term"><code class="code">(BDB:TXN-STAT dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
10810 STAT-CLEAR)</code></span></dt><dd>Transaction subsystem statistics
10811 (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_stat.html"><code class="function">DB_ENV-&gt;txn_stat</code></a>).
10812 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-key"></a>33.8. Directory Access</h2></div></div></div><p>This module provides some directory access from lisp,
10813 in package <a class="link" href="#dir-key" title="33.8. Directory Access"><strong class="package"><span class="quote">“<span class="quote">LDAP</span>”</span></strong></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
10814 contains the symbol <code class="constant">:DIRKEY</code>.</p><p>3 types of directory keys may exist,
10815 depending on the compilation environment.</p><div class="variablelist"><a id="dir-key-type"></a><p class="title"><strong>valid directory key types</strong></p><dl class="variablelist"><dt><span class="term">:win32</span></dt><dd><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> registry access
10816 </dd><dt><span class="term">:gnome</span></dt><dd><a class="ulink" href="http://library.gnome.org/devel/libgnome/stable/libgnome-gnome-config.html" target="_top">gnome-config</a> access
10817 </dd><dt><span class="term">:ldap</span></dt><dd>LDAP interface via
10818 <a class="ulink" href="http://www.openldap.org" target="_top">OpenLDAP</a> or compatible
10819 </dd></dl></div><p>The following functions and macros are exported (please note that
10820 these features are <span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span> and the API may be modified in the
10821 future).</p><div class="variablelist"><dl class="variablelist"><dt><a id="dir-key-open"></a><span class="term"><code class="code">(<a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a>
10822 <em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<code class="constant">:DIRECTION</code> <code class="constant">:INPUT</code>)
10823 <code class="constant">:IF-DOES-NOT-EXIST</code>)</code></span></dt><dd>Open the directory key under <em class="replaceable"><code>dkey</code></em>, which should
10824 be either an open directory key or a valid <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a>.
10825 The meaning of the <code class="constant">:DIRECTION</code> and <code class="constant">:IF-DOES-NOT-EXIST</code> keyword
10826 arguments is the same as for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>.</dd><dt><a id="dir-key-close"></a><span class="term"><code class="code">(<a class="link" href="#dir-key-close"><code class="function">LDAP:DIR-KEY-CLOSE</code></a>
10827 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Close the directory key. The preferred way is to
10828 use the <a class="link" href="#with-dir-key-open"><code class="function">LDAP:WITH-DIR-KEY-OPEN</code></a> macro.</dd><dt><a id="with-dir-key-open"></a><span class="term"><code class="code">(<a class="link" href="#with-dir-key-open"><code class="function">LDAP:WITH-DIR-KEY-OPEN</code></a> (<em class="replaceable"><code>variable</code></em>
10829 <em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> {<em class="replaceable"><code>option</code></em>}*) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a>
10830 <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Open the directory key (by calling <a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a>
10831 on <em class="replaceable"><code>dkey</code></em>, <em class="replaceable"><code>pathname</code></em> and <em class="replaceable"><code>option</code></em>s), bind it to <em class="replaceable"><code>variable</code></em>,
10832 execute <em class="replaceable"><code>body</code></em>, then close it with <a class="link" href="#dir-key-close"><code class="function">LDAP:DIR-KEY-CLOSE</code></a>.
10833 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-TYPE</code>
10834 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a> of the directory key
10835 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-PATH</code>
10836 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the path of this directory key, which is the
10837 <em class="replaceable"><code>pathname</code></em> argument of <a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a> if <em class="replaceable"><code>dkey</code></em> was a <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a> or the
10838 concatenation of the <em class="replaceable"><code>pathname</code></em> argument and the
10839 <code class="function">ldap:dir-key-path</code> of <em class="replaceable"><code>dkey</code></em>.
10840 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-DIRECTION</code>
10841 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>One of <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code> and <code class="constant">:IO</code>, indicating
10842 the permitted operation on this key and its derivatives.
10843 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-CLOSED-P</code>
10844 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Check whether the key has been closed.
10845 It is not an error to close a closed key.
10846 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-SUBKEY-DELETE</code>
10847 <em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>subkey</code></em>)</code>
10848 <code class="code">(<code class="function">LDAP:DIR-KEY-VALUE-DELETE</code>
10849 <em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>attribute</code></em>)</code></span></dt><dd>Delete the specified subkey or attribute.
10850 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-SUBKEY</code>
10851 <em class="replaceable"><code>dkey</code></em>)</code>
10852 <code class="code">(<code class="function">LDAP:DIR-KEY-ATTRIBUTES</code> <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the list of the subkeys or attributes.
10853 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-VALUE</code> <em class="replaceable"><code>dkey</code></em>
10854 <em class="replaceable"><code>attribute</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10855 <em class="replaceable"><code>default</code></em>)</code></span></dt><dd>Return the value of the specified attribute,
10856 similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a>.
10857 </dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-INFO</code>
10858 <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return some information about the directory key.
10859 This is highly platform-dependent and will probably be removed or
10860 replaced or modified in the future.</dd><dt><a id="with-dir-key-search"></a><span class="term"><code class="code">(<a class="link" href="#with-dir-key-search"><code class="function">LDAP:WITH-DIR-KEY-SEARCH</code></a>
10861 (<em class="replaceable"><code>key-iter</code></em>
10862 <em class="replaceable"><code>atribute-iter</code></em>
10863 <em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <code class="constant">:scope</code>)
10864 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">This is the main way to iterate over the subtree
10865 under the key <em class="replaceable"><code>dkey</code></em>+<em class="replaceable"><code>pathname</code></em>.</p><p class="simpara"><em class="replaceable"><code>key-iter</code></em> is a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> symbol
10866 and is bound via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a> to a macro, each call of which returns
10867 the next subkey.</p><p class="simpara"><em class="replaceable"><code>atribute-iter</code></em> is a symbol and is
10868 bound, when non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, to a macro, each call of which returns two
10869 values - the next attribute and its value.</p><p>The <code class="constant">:scope</code> keyword argument specifies the
10870 scope of the search and can be
10871 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:self</code></span></dt><dd>iterate over the key itself
10872 </dd><dt><span class="term"><code class="constant">:level</code></span></dt><dd>iterate over the children of the key
10873 </dd><dt><span class="term"><code class="constant">:tree</code></span></dt><dd>iterate over the subtree
10874 </dd></dl></div><p class="simpara"><a class="link" href="#with-dir-key-search"><code class="function">LDAP:WITH-DIR-KEY-SEARCH</code></a> is used to implement
10875 <code class="function">LDAP:DIR-KEY-VALUES</code>,
10876 <code class="function">LDAP:DIR-KEY-CHILDREN</code> and
10877 <code class="function">LDAP:DIR-KEY-DUMP-TREE</code> in
10878 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/dirkey/dirkey1.lisp"><code class="filename">modules/dirkey/dirkey1.lisp</code></a>.
10879 </p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="postgresql"></a>33.9. PostgreSQL Database Access</h2></div></div></div><p>This package offers an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to
10880 <a class="ulink" href="http://www.PostgreSQL.org/" target="_top">PostgreSQL</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">SQL</span>”</span></strong>
10881 (nicknamed <strong class="package"><span class="quote">“<span class="quote">POSTGRES</span>”</span></strong>
10882 and <strong class="package"><span class="quote">“<span class="quote">POSTGRESQL</span>”</span></strong>) is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
10883 so you would write <code class="code">(sql:PQconnectdb ...)</code>
10884 when you need to call <a class="pq" href="http://www.postgresql.org/search/?q=PQconnectdb"><code class="function">PQconnectdb</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
10885 contains the symbol <code class="constant">:POSTGRESQL</code>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/postgresql/test.tst"><code class="filename">modules/postgresql/test.tst</code></a>
10886 for sample usage.</p><p>Additionally, some higher level functionality is available (defined
10887 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/postgresql/sql.lisp"><code class="filename">modules/postgresql/sql.lisp</code></a>):</p><div class="variablelist"><dl class="variablelist"><dt><a id="sql:pq-finish"></a><span class="term"><code class="code">(sql:pq-finish
10888 <em class="replaceable"><code>connection</code></em>)</code></span></dt><dd><a class="pq" href="http://www.postgresql.org/search/?q=PQfinish"><code class="function">PQfinish</code></a> the <em class="replaceable"><code>connection</code></em>
10889 and mark it as invalid</dd><dt><a id="sql:pq-clear"></a><span class="term"><code class="code">(sql:pq-clear
10890 <em class="replaceable"><code>result</code></em>)</code></span></dt><dd><a class="pq" href="http://www.postgresql.org/search/?q=PQclear"><code class="function">PQclear</code></a> the <em class="replaceable"><code>result</code></em>
10891 and mark it as invalid</dd><dt><span class="term"><code class="code">(sql:sql-error <em class="replaceable"><code>connection</code></em> <em class="replaceable"><code>result</code></em> <em class="replaceable"><code>format-string</code></em>
10892 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd>finalize <em class="replaceable"><code>connection</code></em> and <em class="replaceable"><code>result</code></em> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an
10893 appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd><dt><a id="sql:sql-connect"></a><span class="term"><code class="code">(sql:sql-connect
10894 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> host port options tty name login password)</code></span></dt><dd>call <a class="pq" href="http://www.postgresql.org/search/?q=PQsetdbLogin"><code class="function">PQsetdbLogin</code></a> and
10895 return the <em class="replaceable"><code>connection</code></em></dd><dt><a id="sql:with-sql-connection"></a><span class="term"><code class="code">(sql:with-sql-connection
10896 (<em class="replaceable"><code>variable</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>option</code></em>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)
10897 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><div class="procedure"><ol class="procedure" type="1"><li class="step"><p>bind <code class="varname">*sql-log*</code>
10898 to the <em class="replaceable"><code>log</code></em> argument</p></li><li class="step"><p>call <code class="function">sql:sql-connect</code> on
10899 <em class="replaceable"><code>option</code></em>s and bind <em class="replaceable"><code>variable</code></em> to the result</p></li><li class="step"><p>execute <em class="replaceable"><code>body</code></em></p></li><li class="step"><p>call <code class="function">sql:pq-finish</code> on
10900 <em class="replaceable"><code>variable</code></em></p></li></ol></div></dd><dt><span class="term"><code class="code">(sql:sql-transaction <em class="replaceable"><code>connection</code></em> <em class="replaceable"><code>command</code></em>
10901 <em class="replaceable"><code>status</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (clear-p <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd>execute the <em class="replaceable"><code>command</code></em> via <em class="replaceable"><code>connection</code></em>;
10902 if the status does not match <em class="replaceable"><code>status</code></em>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed;
10903 if <em class="replaceable"><code>clear-p</code></em> is
10904 non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <code class="function">sql:pq-clear</code> the <em class="replaceable"><code>result</code></em>;
10905 otherwise return it</dd><dt><span class="term"><code class="code">(sql:with-sql-transaction (<em class="replaceable"><code>result</code></em> <em class="replaceable"><code>connection</code></em>
10906 <em class="replaceable"><code>command</code></em> status) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>execure the <em class="replaceable"><code>body</code></em> on the <em class="replaceable"><code>result</code></em> of <em class="replaceable"><code>command</code></em>,
10907 then <code class="function">sql:pq-clear</code> the <em class="replaceable"><code>result</code></em>
10908 </dd><dt><a id="sql:sql-login"></a><span class="term"><code class="code">sql:*sql-login*</code></span></dt><dd>the default <em class="replaceable"><code>login</code></em>
10909 argument to <code class="function">sql:sql-connect</code>
10910 (initially set to <span class="data"><code class="literal">"postgres"</code></span>)
10911 </dd><dt><a id="sql:sql-password"></a><span class="term"><code class="code">sql:*sql-password*</code></span></dt><dd>the default <em class="replaceable"><code>password</code></em>
10912 argument to <code class="function">sql:sql-connect</code>
10913 (initially set to <span class="data"><code class="literal">"postgres"</code></span>)
10914 </dd><dt><a id="sql:sql-log"></a><span class="term"><code class="code">sql:*sql-log*</code></span></dt><dd>when non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>;
10915 <code class="function">sql:sql-connect</code>
10916 and <code class="function">sql:sql-transaction</code>
10917 will write to it (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
10918 </dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="pq" href="http://www.postgresql.org/search/?q=PQfinish"><code class="function">PQfinish</code></a>
10919 and <a class="pq" href="http://www.postgresql.org/search/?q=PQclear"><code class="function">PQclear</code></a>
10920 cannot be called on the same pointer twice, one needs to track their
10921 validity (<code class="function">sql:sql-connect</code>
10922 and <code class="function">sql:sql-transaction</code> take care of that).
10923 See <a class="xref" href="#ex-dffi-validity" title="Example 32.11. Controlling validity of resources">Example 32.11, “Controlling validity of resources”</a>.</p></div><p>For <a class="pq" href="http://www.postgresql.org/search/?q=PQtrace"><code class="function">PQtrace</code></a>, see
10924 <a class="xref" href="#stdio" title="33.2.14. Standard file input and output">Section 33.2.14, “Standard file input and output”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="oracle"></a>33.10. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></div><p>
10925 The <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> module allows a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program to act as client to an
10926 <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database server. The module includes full
10927 SQL support, transactions (including auto-commit), support for most
10928 <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data types (<span class="type">LONG</span>, <span class="type">BLOB</span>,
10929 <span class="type">CLOB</span>, <span class="type">RAW</span>, etc.), automatic conversion
10930 between <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> data types, database connection caching and
10931 retry, concurrent connections to multiple databases, proper handling
10932 of <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> errors, and more.</p><p>The module can be used to build sophisticated <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database
10933 applications in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
10934 symbol <code class="constant">:ORACLE</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-functionality"></a>33.10.1. Functions and Macros in
10935 package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></h3></div></div></div><p>Access to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> is via these functions and macros in
10936 package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong>.
10937 When any <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> function fails, the general Lisp function
10938 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> is called, with the condition string set to
10939 include the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> error number, the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> message text,
10940 and other context of the error (e.g., the text and parse location of a
10941 SQL query).</p><div class="variablelist"><dl class="variablelist"><dt><a id="ora-connect"></a><span class="term"><code class="code">(ORACLE:CONNECT
10942 <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>password</code></em>
10943 <em class="replaceable"><code>server</code></em>
10944 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
10945 <em class="replaceable"><code>schema</code></em>
10946 <em class="replaceable"><code>auto-commit</code></em>
10947 <em class="replaceable"><code>prefetch-buffer-bytes</code></em>
10948 <em class="replaceable"><code>long-len</code></em>
10949 <em class="replaceable"><code>truncate-ok</code></em>)</code></span></dt><dd><p class="simpara">
10950
10951 Connect to an <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database. All subsequent operations will affect
10952 this database until the next call to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. A
10953 single program can access different <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> schemas concurrently by
10954 repeated calls to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. Database connections
10955 are cached and re-used: if you call <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> again
10956 with the same <em class="replaceable"><code>user</code></em>,
10957 <em class="replaceable"><code>schema</code></em>, and
10958 <em class="replaceable"><code>server</code></em>, the previous <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> connection will
10959 be re-used. <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> may not be called inside
10960 <code class="function">WITH-TRANSACTION</code>.
10961
10962 Returns: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if a cached connection was re-used, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if a new
10963 connection was created (and cached).
10964
10965 The meaning of the arguments is as follows:
10966 </p><div class="variablelist"><p class="title"><strong>Arguments for <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>user</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> user ID</dd><dt><span class="term"><em class="replaceable"><code>password</code></em></span></dt><dd>Password for user, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
10967 <em class="replaceable"><code>user</code></em> has no password (!).
10968 </dd><dt><span class="term"><em class="replaceable"><code>server</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> server ID (SID).
10969 </dd><dt><span class="term"><em class="replaceable"><code>schema</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> default schema (default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
10970 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, same as user. This allows you to log on with one user's
10971 id/password but see the database as if you were some other user.
10972 </dd><dt><span class="term"><em class="replaceable"><code>auto-commit</code></em></span></dt><dd>Flag: whether to commit after every operation
10973 (default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>). Set this to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if you intend to do transactions
10974 and call <code class="function">COMMIT</code> explicitly. However,
10975 <code class="function">WITH-TRANSACTION</code> is probably easier.
10976 </dd><dt><span class="term"><em class="replaceable"><code>prefetch-buffer-bytes</code></em></span></dt><dd>Number of bytes to cache from SQL SELECT fetches
10977 (default: 64 Kbytes) If you are very short of memory, or have a slow
10978 connection to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>, you can reduce this to 10k or so.
10979 Alternatively, if you have a fast connection to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> and
10980 regularly do large queries, you can increase throughput by increasing
10981 this value.</dd><dt><span class="term"><em class="replaceable"><code>long-len</code></em></span></dt><dd>Number of bytes to fetch for "long" (LONG, [BC]LOB)
10982 types. Long data that exceeds this size will raise an error, or be
10983 truncated depending on the value of <em class="replaceable"><code>truncate-ok</code></em>
10984 (below). Setting <em class="replaceable"><code>long-len</code></em> to zero and
10985 <em class="replaceable"><code>truncate-ok</code></em> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> will disable long
10986 fetching entirely. If <em class="replaceable"><code>long-len</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
10987 or negative, defaults to 500k bytes.</dd><dt><span class="term"><em class="replaceable"><code>truncate-ok</code></em></span></dt><dd>Flag: if set, allow truncation of LONG columns to
10988 <em class="replaceable"><code>long-len</code></em> bytes on fetch; otherwise, fetches
10989 of LONG columns exceeding <em class="replaceable"><code>long-len</code></em> bytes
10990 will raise an error. Default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd></dl></div></dd><dt><a id="ora-disconnect"></a><span class="term"><code class="code">(ORACLE:DISCONNECT)</code></span></dt><dd>
10991 Disconnect from the database currently connected. No more calls can
10992 be made until <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> is called again. The
10993 connection is closed and removed from the connection cache. Does
10994 nothing if there is no connection. <code class="function">DISCONNECT</code>
10995 may not be called inside <code class="function">WITH-TRANSACTION</code>.
10996 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
10997 </dd><dt><a id="ora-run-sql"></a><span class="term"><code class="code">(ORACLE:RUN-SQL
10998 <em class="replaceable"><code>sql</code></em>
10999 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
11000 <em class="replaceable"><code>params</code></em>
11001 <em class="replaceable"><code>is-select</code></em>)</code></span></dt><dd><p class="simpara">Execute a SQL statement. Must be <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>ed
11002 to a database. Returns the number of rows affected by the SQL operation,
11003 for non-SELECT statements, zero for SELECT statements. For
11004 destructive database operations (INSERT, UPDATE, DELETE), the results
11005 are committed to the database immediately if
11006 <em class="replaceable"><code>auto-commit</code></em> when establishing the current
11007 connection; see <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. The meaning of the
11008 arguments is as follows: </p><div class="variablelist"><p class="title"><strong>Arguments for <code class="function">RUN-SQL</code></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>sql</code></em></span></dt><dd>Text of SQL statement, as a string.
11009 The <em class="replaceable"><code>sql</code></em> statement may contain
11010 <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> "named parameters," e.g. ":myparam" whose values will
11011 be substituted from the parameters given
11012 in <em class="replaceable"><code>params</code></em>.
11013 </dd><dt><span class="term"><em class="replaceable"><code>params</code></em></span></dt><dd>A mapping of the names of the bind-parameters in the
11014 query to their values. The set of named parameters in the query must
11015 match exactly the keys mapped by <em class="replaceable"><code>params</code></em>.
11016 The mapping may be passed as either (1) a hash table whose keys are
11017 the named parameters or (2) a list of pairs, ((name value) (name
11018 value) ...). Parameter values passed from Lisp are converted to the
11019 appropriate <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data types (see <code class="function">FETCH</code>).
11020 </dd><dt><span class="term"><em class="replaceable"><code>is-select</code></em></span></dt><dd>Flag: whether the statement is a SELECT query. You
11021 usually do not need to set this as it is detected by default based on
11022 the SQL text. However, there are situations, such as when a SELECT
11023 query begins with comment, that you need to specify it explicitly.
11024 </dd></dl></div></dd><dt><a id="ora-do-rows"></a><span class="term"><code class="code">(ORACLE:DO-ROWS
11025 <em class="replaceable"><code>vars</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara"> Macro which loops over a SQL SELECT result,
11026 evaluating, for each row in the result, the forms in <em class="replaceable"><code>body</code></em>,
11027 binding symbols given in <em class="replaceable"><code>vars</code></em> to
11028 corresponding database columns in the SELECT result. The
11029 argument <em class="replaceable"><code>vars</code></em> must be a non-empty list of
11030 symbols matching a subset of the columns of an active SELECT query.
11031 If a SELECT column is an <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> expression such as
11032 <code class="literal">SUBSTR(mycol, 1, 10)</code>, it is recommended to use a
11033 column alias, e.g., <code class="literal">SELECT SUBSTR(mycol, 1, 10) AS
11034 myvar</code>, in which case the column alias will be used as the
11035 symbol bound to the column value.</p><p class="simpara">As <code class="function">DO-ROWS</code> expands into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_docm_dost.html" target="_top"><code class="function">DO*</code></a>
11036 loop, it may be terminated prematurely, before all rows are fetched,
11037 by using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> anywhere in <em class="replaceable"><code>body</code></em>.</p><p class="simpara">It is allowed to call <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> in the
11038 <em class="replaceable"><code>body</code></em> of the loop, but only to switch the connection to a database
11039 other than the one that was used to do the SELECT. This is useful
11040 for reading from one database while writing to another.
11041 </p><p class="simpara">In <em class="replaceable"><code>vars</code></em>, instead of a single
11042 symbol, a pair (<em class="replaceable"><code>bound-var</code></em>
11043 <em class="replaceable"><code>"column-name"</code></em>) may be specified, which
11044 will cause values from the SELECTed column or alias ,
11045 <em class="replaceable"><code>column-name</code></em>, to be bound to Lisp variable,
11046 <em class="replaceable"><code>bound-var</code></em>. This is for unusual cases
11047 where a Lisp variable cannot be created with the same name as the
11048 column (e.g., a column named "T"), or when it is inconvenient or
11049 impossible to alias the column with <code class="literal">SELECT ... AS</code>.
11050 </p></dd><dt><a id="ora-fetch"></a><span class="term"><code class="code">(ORACLE:FETCH
11051 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>result-type</code></em>)</code></span></dt><dd><p>Fetch a single row of data. Returns a row of values
11052 corresponding to the columns of an active SELECT statment. The row
11053 data is returned in one of three different forms, depending on the
11054 value of the symbol <em class="replaceable"><code>result-type</code></em>:
11055 </p><div class="variablelist"><p class="title"><strong>Return values for <code class="function">FETCH</code></strong></p><dl class="variablelist"><dt><span class="term"><code class="classname">ARRAY</code></span></dt><dd>Values will be returned in an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> with the
11056 same number of columns as in the SELECT statement, in the same
11057 order. This is the default.</dd><dt><span class="term"><code class="classname">PAIRS</code></span></dt><dd>A list of pairs, <code class="literal">((column, value)
11058 ...)</code> is be returned. The number and order of pairs is
11059 the same as the columns in the SELECT statement.
11060 </dd><dt><span class="term"><code class="classname">HASH</code></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> whose keys are the column names
11061 and whose values are the column values in the row. The SELECT
11062 columns <span class="emphasis"><em>must be unique</em></span> and be valid Lisp
11063 symbols to use this option. If you are SELECTing an expression, you
11064 probably want to use a column alias: <code class="literal">SELECT &lt;expr&gt; AS
11065 some_alias ...</code></dd></dl></div><p>The following data type conversions are done between <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
11066 datatypes and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> data types:
11067 </p><div class="informaltable"><a id="ora-fetch-data-types-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> type</th><th>Converts to/from <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> type</th></tr></thead><tbody><tr><td>Numeric (NUMBER, INTEGER, FLOAT)</td><td>The appropriate <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> numeric type (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>,
11068 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>)</td></tr><tr><td>String (CHAR, VARCHAR, VARCHAR2)</td><td>A <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. Note that CHAR will be padded out to its
11069 full, fixed length as defined in <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>; VARCHAR will be a
11070 string of variable length. Also note that <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> has no
11071 "zero-length string" value - it returns the SQL special value
11072 <code class="constant">NULL</code> which is converted to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (see below).</td></tr><tr><td>DATE</td><td>A string of the form "YYYY-MM-DD HH:MM:SS" where HH is
11073 24-hour form. If you want dates formatted differently, convert
11074 them to strings in <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> using <code class="literal">SELECT
11075 TO_CHAR(mydate, '<em class="replaceable"><code>template</code></em>') AS
11076 mydate</code>; the result will then be returned as a string,
11077 formatted as per <em class="replaceable"><code>template</code></em>.</td></tr><tr><td>RAW, LONG RAW</td><td>A hexadecimal string, with two hex digits for each byte of
11078 <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data. Note that this means the Lisp string will be
11079 twice the size, in bytes, as the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data.</td></tr><tr><td>"Large" types (LONG, BLOB, CLOB)</td><td>A Lisp string of (arbitrary, possibly binary) data. Note
11080 that truncation may occur; see the <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>
11081 parameters <em class="replaceable"><code>long-len</code></em>
11082 and <em class="replaceable"><code>truncate-ok</code></em>.</td></tr><tr><td><code class="constant">NULL</code></td><td>The <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> value <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td></tr></tbody></table></div><p>
11083 </p></dd><dt><a id="ora-fetch-all"></a><span class="term"><code class="code">(ORACLE:FETCH-ALL
11084 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
11085 <em class="replaceable"><code>max-rows</code></em>
11086 <em class="replaceable"><code>result-type</code></em>
11087 <em class="replaceable"><code>item-type</code></em>)</code></span></dt><dd><p class="simpara">Fetch some or all the rows from a query and return
11088 result as a sequence of sequences. Arguments are all optional:
11089 <em class="replaceable"><code>max-rows</code></em> limits the result to
11090 that numbers of rows;
11091 <em class="replaceable"><code>result-type</code></em> is the type of
11092 sequence of the rows, either
11093 '<code class="classname">ARRAY</code> (the default) or
11094 '<code class="classname">LIST</code>;
11095 <em class="replaceable"><code>item-type</code></em> is the type of
11096 sequence of the column values for each row, either
11097 '<code class="classname">ARRAY</code> (the default) or
11098 '<code class="classname">LIST</code>.
11099 Each row fetched always contains the full set of column values SELECTed.
11100 </p><p class="simpara">
11101 <code class="function">FETCH-ALL</code> is often useful in conjunction with
11102 <code class="function">MAP</code> or <code class="function">REDUCE</code> to iterate
11103 over an entire SELECT result to construct a single Lisp value.
11104
11105 </p></dd><dt><a id="ora-peek"></a><span class="term"><code class="code">(ORACLE:PEEK <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
11106 <em class="replaceable"><code>result-type</code></em>)</code></span></dt><dd>
11107
11108 Peek at next row of data (without fetching it). Returns a row a la
11109 <code class="function">FETCH</code>, except does not advance to the next row.
11110 Repeated calls to <code class="function">PEEK</code> will thus return the same
11111 row of data. Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if at EOF. If data is available, returns
11112 row data just as <code class="function">FETCH</code> (see
11113 <code class="function">FETCH</code> for data format and conversions done).
11114 Optional argument <em class="replaceable"><code>result-type</code></em> is the type
11115 of sequence of the column values for the returned row, either
11116 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> (the default) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
11117 <code class="function">PEEK</code> is a useful look-ahead
11118 for database reporting functions that may need to "break" on changes in
11119 data to print headers, summaries, etc.
11120 </dd><dt><a id="ora-columns"></a><span class="term"><code class="code">(ORACLE:COLUMNS)</code></span></dt><dd><p>Returns information on the columns of a SELECT
11121 result, in the form of an array of SQLCOL structures, one for each
11122 result column in the most recent SELECT statement. It is not
11123 necessary to have called <code class="function">FETCH</code> before requesting
11124 column information on the query, however the query must have been
11125 compiled and executed with <code class="function">RUN-SQL</code>. Each SQLCOL
11126 structure has these slots:
11127 </p><div class="variablelist"><p class="title"><strong>Slots of <code class="classname">SQLCOL</code></strong></p><dl class="variablelist"><dt><span class="term">NAME</span></dt><dd>The <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> column name or the expression
11128 selected. If the query used a column alias, <code class="literal">SELECT
11129 <em class="replaceable"><code>expr</code></em> AS
11130 <em class="replaceable"><code>alias</code></em></code>, then
11131 <em class="replaceable"><code>alias</code></em> will be returned as the column name.
11132 </dd><dt><span class="term">TYPE</span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data type (VARCHAR, NUMBER, DATE, ...)
11133 </dd><dt><span class="term">SIZE</span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data length (useful mostly for
11134 character types)</dd><dt><span class="term">SCALE</span></dt><dd>For numeric (NUMBER) types, number of digits to right of
11135 decimal; NIL for FLOAT</dd><dt><span class="term">PRECISION</span></dt><dd>For numeric types, total number of significant
11136 digits (decimal digits for NUMBER, bits for FLOAT)</dd><dt><span class="term">NULL_OK</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <code class="constant">NULL</code>s allowed, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <code class="constant">NULL</code>s are
11137 not allowed.</dd></dl></div><p class="simpara">To access the values of the SQLCOL structures, use the standard
11138 accessor functions, e.g., <code class="literal">(ORACLE:SQLCOL-NAME (elt
11139 (ORACLE:COLUMNS) 0))</code></p></dd><dt><a id="ora-eof"></a><span class="term"><code class="code">(ORACLE:EOF)</code></span></dt><dd>
11140 Returns EOF status. A SELECT query cursor is considered at EOF if the next
11141 FETCH would return no data. Must be connected to a database, and have
11142 an active SELECT statement.
11143 </dd><dt><a id="ora-insert-row"></a><span class="term"><code class="code">(ORACLE:INSERT-ROW
11144 <em class="replaceable"><code>table</code></em>
11145 <em class="replaceable"><code>values</code></em>)</code></span></dt><dd>
11146 Inserts a single row into <em class="replaceable"><code>table</code></em>.
11147 Second argument <em class="replaceable"><code>values</code></em> is a map of
11148 column names to values: either a hash table whose keys are the column
11149 names, or a list of (name, value) pairs. Columns missing from the map
11150 will be given the default <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> value, or <code class="constant">NULL</code>.
11151 Returns the number of rows inserted (i.e., always 1).
11152 </dd><dt><a id="ora-update-row"></a><span class="term"><code class="code">(ORACLE:UPDATE-ROW
11153 <em class="replaceable"><code>table</code></em>
11154 <em class="replaceable"><code>condition</code></em>
11155 <em class="replaceable"><code>vals</code></em>
11156 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
11157 <em class="replaceable"><code>params</code></em>)</code></span></dt><dd>
11158 Updates rows in <em class="replaceable"><code>table</code></em>. Second argument
11159 <em class="replaceable"><code>condition</code></em> is a string expression for a WHERE
11160 clause (without the "WHERE") which determines which rows are updated.
11161 Third argument <em class="replaceable"><code>vals</code></em> is a map of columns to
11162 be updated to their new values: a hash table whose keys are column
11163 names, or list of (name, value) pairs. Optional
11164 <em class="replaceable"><code>params</code></em> specifies values for named
11165 parameters that may occur in <em class="replaceable"><code>condition</code></em>,
11166 e.g., when the condition is a match on a primary key, e.g.: <code class="literal">"pk_column
11167 = :pk_val"</code>. Returns the number of rows updated.
11168 </dd><dt><a id="ora-row-count"></a><span class="term"><code class="code">(ORACLE:ROW-COUNT)</code></span></dt><dd>
11169 For SELECT statements, returns the number of rows
11170 <code class="function">FETCH</code>ed (<span class="strong"><strong>not</strong></span>
11171 <code class="function">PEEK</code>ed) so far. For other statements (e.g.,
11172 INSERT, UPDATE, DELETE), returns the number of rows affected by the
11173 last operation (e.g., inserted, updated, deleted). Must be connected
11174 to a database and have an active SQL statement.
11175 </dd><dt><a id="ora-with-transaction"></a><span class="term"><code class="code">(ORACLE:WITH-TRANSACTION
11176 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a>
11177 <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>
11178
11179 Evaluates the forms in <em class="replaceable"><code>body</code></em> atomically as a
11180 database transaction, ensuring that either all the database operations
11181 done in <em class="replaceable"><code>body</code></em> complete successfully, or none
11182 of them do. If pending (un-committed) changes exist when this macro
11183 is entered, they are <span class="emphasis"><em>rolled back</em></span> (undone), so
11184 that the database is affected only by the subsequent updates inside
11185 <em class="replaceable"><code>body</code></em>. Nesting of
11186 <code class="function">WITH-TRANSACTION</code> blocks is not allowed and will
11187 raise an error. There is no effect on the status of
11188 <em class="replaceable"><code>auto-commit</code></em> given in
11189 <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>; it resumes its previous state when the
11190 macro exits. The value of the <code class="function">WITH-TRANSACTION</code>
11191 expression is that of the last form in <em class="replaceable"><code>body</code></em>.
11192 </dd><dt><a id="ora-commit"></a><span class="term"><code class="code">(ORACLE:COMMIT)</code></span></dt><dd>
11193 Commits (makes permanent) any pending changes to the database. The
11194 <em class="replaceable"><code>auto-commit</code></em> parameter to
11195 <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> must not have been set to use this
11196 function, nor can it be called inside a
11197 <code class="function">WITH-TRANSACTION</code> block. Always returns NIL.
11198 </dd><dt><a id="ora-rollback"></a><span class="term"><code class="code">(ORACLE:ROLLBACK)</code></span></dt><dd>
11199 Rolls back (undoes and abandons) any pending changes to the database.
11200 The <em class="replaceable"><code>auto-commit</code></em> parameter to
11201 <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> must not have been set to use this
11202 function, nor can it be called inside a
11203 <code class="function">WITH-TRANSACTION</code> block. Always returns NIL.
11204 </dd><dt><a id="ora-auto-commit"></a><span class="term"><code class="code">(ORACLE:AUTO-COMMIT)</code></span></dt><dd>
11205 Toggles the state of <em class="replaceable"><code>auto-commit</code></em> initially
11206 given to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> for the current connection.
11207 With <em class="replaceable"><code>auto-commit</code></em> enabled, modifications to
11208 the database are committed (made permanent) after each destructive SQL
11209 operation made with calls to <code class="function">RUN-SQL</code>,
11210 <code class="function">INSERT-ROW</code>, <code class="function">UPDATE_ROW</code>, etc.
11211 With <em class="replaceable"><code>auto-commit</code></em> disabled, transactional
11212 integrity is under the programmer's control and is managed either by
11213 (1) explicitly calling <code class="function">COMMIT</code> or
11214 <code class="function">ROLLBACK</code> to commit or undo the pending
11215 operations, or (2) wrapping code blocks with database operations
11216 inside the <code class="function">WITH-TRANSACTION</code> macro.
11217 <code class="function">AUTO-COMMIT</code> returns the previous status of
11218 <em class="replaceable"><code>auto-commit</code></em>.
11219 <code class="function">AUTO-COMMIT</code> may not be called inside
11220 <code class="function">WITH-TRANSACTION</code>.
11221 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-example"></a>33.10.2. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Example</h3></div></div></div><p>
11222 Below is a simple example script which uses <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>'s demo database
11223 schema, <code class="literal">SCOTT</code>.
11224
11225 </p><pre class="programlisting">
11226 (setf server "orcl") <strong> ; </strong><em class="lineannotation"><span class="lineannotation">; Change this to your server's SID</span></em>
11227 (oracle:connect "scott" "tiger" server)
11228
11229 (oracle:run-sql "SELECT deptno, dname, loc FROM dept ORDER BY DNAME")
11230 (oracle:do-rows (deptno dname loc)
11231 (format t "Dept. no is '~A', " deptno)
11232 (format t "Dept. name is '~A', " dname)
11233 (format t "Dept. loc is '~A'~%" loc))
11234
11235 (oracle:update-row "dept" "dname = :acctval" '(("dname" "NEWACCT")) '(("acctval" "ACCOUNTING")))
11236
11237 (oracle:run-sql "SELECT deptno, dname, loc FROM dept ORDER BY DNAME")
11238 (oracle:do-rows (deptno dname loc)
11239 (format t "Dept. no is '~A', " deptno)
11240 (format t "Dept. name is '~A', " dname)
11241 (format t "Dept. loc is '~A'~%" loc))
11242
11243 (oracle:update-row "dept" "dname = :acctval" '(("dname" "ACCOUNTING")) '(("acctval" "NEWACCT")))
11244 </pre><p>
11245 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-config"></a>33.10.3. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Configuration</h3></div></div></div><p>Obviously, a working <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> environment is required. It is
11246 recommended that you first be able to log on and use the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
11247 SQL*Plus application to test your environment
11248 <span class="strong"><strong>before</strong></span> attempting <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> access via the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> module.
11249 At a minimum you will need to set environment variables
11250 <code class="envar">ORACLE_HOME</code> to the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> base directory and
11251 <code class="envar">LD_LIBRARY_PATH</code> to include
11252 <code class="literal">$<code class="envar">ORACLE_HOME</code>/lib</code> and possibly other
11253 directories.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-build"></a>33.10.4. Building the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Interface</h3></div></div></div><p>The module uses the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Call Interface (<a class="ulink" href="http://www.vivtek.com/oracle.html" target="_top">OCI</a>)
11254 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library. To build the module you will need the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
11255 <a class="ulink" href="http://www.vivtek.com/oracle.html" target="_top">OCI</a> headers and link libraries; as a quick check, make sure
11256 you have the file <code class="filename">oci.h</code> somewhere
11257 under <code class="envar">ORACLE_HOME</code>, probably
11258 in <code class="filename">$<code class="envar">ORACLE_HOME</code>/rdbms/demo/oci.h</code>.</p><p>To build the module into <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, configure with
11259 <span class="command"><strong>./configure ... --with-module=oracle ...</strong></span>.
11260 The <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> will contain the module,
11261 so you will need to use the <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> option to use it.
11262 You can test that you really have the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>-enabled <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> by
11263 evaluating <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> 'oracle:connect)</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It may be necessary to edit file
11264 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/oracle/Makefile.in"><code class="filename">modules/oracle/Makefile.in</code></a>
11265 prior to running <span class="command"><strong>./configure</strong></span>.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="libsvm"></a>33.11. LibSVM Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></dd></dl></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/" target="_top">LibSVM</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">LIBSVM</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
11266 and you do not need the <code class="function">svm_</code> prefix.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11267 contains the symbol <code class="constant">:LIBSVM</code>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/libsvm/test.tst"><code class="filename">modules/libsvm/test.tst</code></a>
11268 for sample usage.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-types"></a>33.11.1. Types</h3></div></div></div><p>All data is kept on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> side as much as possible, so
11269 these foreign types do <span class="strong"><strong>not</strong></span> have a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> counterpart.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="type">node</span></span></dt><dd>Corresponds to <span class="type">svm_node</span>, represented
11270 as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">problem</span></span></dt><dd>Corresponds to <span class="type">svm_problem</span>, represented
11271 as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">parameter</span></span></dt><dd>Corresponds to <span class="type">svm_parameter</span>, represented
11272 as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">model</span></span></dt><dd>Corresponds to <span class="type">svm_model</span>, an opaque
11273 <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-output"></a>33.11.2. Output</h3></div></div></div><p>The output from the library functions goes to
11274 <code class="varname">*libsvm-output*</code>, which is initialized to
11275 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-functions"></a>33.11.3. Functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-problem"></a>33.11.3.1. Functions related to <span class="type">problem</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(problem-l <em class="replaceable"><code>problem</code></em>)</code></span></dt><dd>Return the number of rows in the <em class="replaceable"><code>problem</code></em> (a
11276 <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>)</dd><dt><span class="term"><code class="code">(problem-y <em class="replaceable"><code>problem</code></em>
11277 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>)))</code></span></dt><dd>Return a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>
11278 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> <em class="replaceable"><code>length</code></em>)</code></span> representing the targets in the
11279 <em class="replaceable"><code>problem</code></em> (a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(problem-y-n <em class="replaceable"><code>problem</code></em>
11280 <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>))))</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> representing the <em class="replaceable"><code>n</code></em>th
11281 target in the <em class="replaceable"><code>problem</code></em> (a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).
11282 </dd><dt><span class="term"><code class="code">(problem-x <em class="replaceable"><code>problem</code></em>
11283 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>)))</code></span></dt><dd>Return a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>
11284 node) <em class="replaceable"><code>length</code></em>)</code></span> representing the predictors in the <em class="replaceable"><code>problem</code></em>
11285 (a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(problem-x-n <em class="replaceable"><code>problem</code></em>
11286 <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>))))</code></span></dt><dd>Return the <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> node)</code></span>
11287 representing the <em class="replaceable"><code>n</code></em>th set of predictors in the <em class="replaceable"><code>problem</code></em> (a
11288 <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(make-problem <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> <em class="replaceable"><code>l</code></em> <em class="replaceable"><code>y</code></em>
11289 <em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Allocate a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> representing
11290 a <span class="type">model</span>.</dd><dt><span class="term"><code class="code">(destroy-problem <em class="replaceable"><code>problem</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">problem</span>
11291 object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>problem</code></em>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>You <span class="strong"><strong>must</strong></span> call this function yourself, but only
11292 <span class="strong"><strong>after</strong></span> deallocating all <span class="type">model</span> objects trained from
11293 this <em class="replaceable"><code>problem</code></em>.</p></div></dd><dt><span class="term"><code class="code">(load-problem <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11294 (<em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>))</code></span></dt><dd><p class="simpara">Read a <span class="type">problem</span> from a file in the
11295 libsvm/svmlight format. Return two values: the <span class="type">problem</span>
11296 and max index (i.e., the number of columns).</p><p class="simpara">Messages go to <em class="replaceable"><code>log</code></em>.</p></dd><dt><span class="term"><code class="code">(save-problem <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>problem</code></em>
11297 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>))</code></span></dt><dd><p class="simpara">Write a <span class="type">problem</span> into a file.</p><p class="simpara">Messages go to <em class="replaceable"><code>log</code></em>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-model"></a>33.11.3.2. Functions related to <span class="type">model</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(destroy-model <em class="replaceable"><code>model</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">model</span>
11298 object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>model</code></em>.</p><p class="simpara">Calls <code class="function">svm_destroy_model</code> or
11299 <code class="function">svm_svm_free_and_destroy_model</code>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to call this function yourself, it is
11300 attached to the <em class="replaceable"><code>model</code></em> by <code class="function">train</code>
11301 and <code class="function">load-model</code> via <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p></dd><dt><span class="term"><code class="code">(check-parameter <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Check if the <em class="replaceable"><code>parameter</code></em> is appropriate for the
11302 <em class="replaceable"><code>problem</code></em>.</p><p class="simpara">Calls <code class="function">svm_check_parameter</code>.</p></dd><dt><span class="term"><code class="code">(train <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Train a <span class="type">model</span>.</p><p class="simpara">Calls <code class="function">svm_train</code>
11303 and <code class="function">check-parameter</code>.</p></dd><dt><span class="term"><code class="code">(cross-validation <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>
11304 <em class="replaceable"><code>n</code></em>)</code></span></dt><dd><p class="simpara">Run <em class="replaceable"><code>n</code></em>-fold cross-validation.</p><p class="simpara">Calls <code class="function">svm_cross_validation</code>
11305 and <code class="function">check-parameter</code>.</p></dd><dt><span class="term"><code class="code">(save-model <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>model</code></em>)</code></span></dt><dd><p class="simpara">Write a <span class="type">model</span> into a file.</p><p class="simpara">Calls <code class="function">svm_save_model</code>.</p></dd><dt><span class="term"><code class="code">(load-model <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd><p class="simpara">Read a <span class="type">model</span> from a file.</p><p class="simpara">Calls <code class="function">svm_load_model</code>.</p></dd><dt><span class="term"><code class="code">(get-svm-type <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_svm_type</code>.
11306 </dd><dt><span class="term"><code class="code">(get-nr-class <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_nr_class</code>.
11307 </dd><dt><span class="term"><code class="code">(get-labels <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_labels</code>.
11308 </dd><dt><span class="term"><code class="code">(get-svr-probability <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_svr_probability</code>.
11309 </dd><dt><span class="term"><code class="code">(predict-values <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd><p class="simpara">Return the decision values
11310 (a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>)</code></span>) given
11311 by <em class="replaceable"><code>model</code></em> for <em class="replaceable"><code>x</code></em> (a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> node)</code></span>).
11312 </p><p class="simpara">Calls <code class="function">svm_predict_values</code>.</p></dd><dt><span class="term"><code class="code">(predict <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Call <code class="function">svm_predict</code>.
11313 </dd><dt><span class="term"><code class="code">(predict-probability <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Call <code class="function">svm_predict_probability</code>.
11314 </dd><dt><span class="term"><code class="code">(check-probability-model <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_check_probability_model</code>.
11315 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-parameter"></a>33.11.3.3. Functions related to <span class="type">parameter</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(destroy-parameter <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">parameter</span>
11316 object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>parameter</code></em>.</p><p class="simpara">Does <span class="strong"><strong>not</strong></span> call <code class="function">svm_destroy_param</code>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to call this function yourself, it is
11317 attached to the <em class="replaceable"><code>parameter</code></em> by <code class="function">make-parameter</code>
11318 via <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p></dd><dt><span class="term"><code class="code">(make-parameter <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :v svm_type
11319 kernel_type degree gamma coef0 cache_size eps C nr_weight
11320 weight_label weight nu p shrinking probability)</code></span></dt><dd><p class="simpara">Allocates a new <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> of
11321 type <span class="type">parameter</span> with the supplied slots.</p><p class="simpara">The defaults come from vector <em class="replaceable"><code>v</code></em> (such as returned
11322 by <code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <em class="replaceable"><code>parameter</code></em>)</code>), if supplied, providing
11323 an easy way to copy <em class="replaceable"><code>parameter</code></em>s, otherwise the defaults
11324 for <span class="command"><strong>svm-train</strong></span> are used.</p></dd><dt><span class="term"><code class="code">(parameter-alist <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd>Return the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> representing <em class="replaceable"><code>parameter</code></em>.
11325 </dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pari"></a>33.12. Computer Algebra System PARI</h2></div></div></div><p>This package offers an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="http://pari.math.u-bordeaux.fr/" target="_top">PARI</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">PARI</span>”</span></strong>
11326 is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
11327 symbol <code class="constant">:PARI</code>.</p><p>PARI objects are printed and read using a special
11328 <span class="data"><code class="literal">#Z""</code></span> syntax.</p><p>Most functions accept lisp objects as well as PARI objects and
11329 return PARI objects, which can be converted to lisp using the
11330 <code class="function">pari:pari-to-lisp</code> function.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/pari/test.tst"><code class="filename">modules/pari/test.tst</code></a>
11331 for sample usage.</p><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pari-desc"></a>Available functionality</h3></div></div></div><p>The module interfaces to most of the functions available in GP,
11332 by parsing the file <code class="filename">${prefix}/share/pari/pari.desc</code>,
11333 see <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/pari/desc2lisp.lisp"><code class="filename">modules/pari/desc2lisp.lisp</code></a>.</p><p>Lisp functions are normally named the same as the GP functions
11334 they correspond to or the PARI functions they call, e.g.: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="function">para:quadpoly</code> corresponds to the
11335 eponymous GP function and calls the <code class="function">quadpoly0</code>
11336 PARI function</li><li class="listitem"><code class="function">para:issmall</code> calls the PARI
11337 function <code class="function">issmall</code> which has no GP
11338 analogue</li><li class="listitem"><code class="function">para:random_</code> (note the
11339 <code class="literal">_</code> suffix to avoid clash with the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a>)
11340 corresponds to the GP function <code class="function">random</code> and calls the
11341 <code class="function">genrand</code> PARI function.</li></ul></div><p>
11342 </p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pari-ext"></a>Extending the module</h3></div></div></div><p>Not all PARI functions have a corresponding Lisp function, but one can
11343 remedy that with just a few lines: </p><pre class="programlisting">
11344 (<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a> "libpari.so") ; or pari.dll on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
11345 (pari:pari-call-out (matrix-rank ffi:long) "rank" (x))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">long rank(GEN x);</span></em>
11346 (pari:pari-call-out fibonacci "fibo" ((n ffi:long)))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN fibo(long n);</span></em>
11347 (pari:pari-call-out-prec pari-arctan "gatan" (x))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN gatan(GEN x, long prec);</span></em>
11348 (pari:pari-call-out (equal? boolean) "gequal" (x y))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN gequal(GEN x, GEN y);</span></em>
11349 </pre><p>
11350 (Actually, these four functions are already interfaced to by the module.)
11351 Please feel free to submit additions for
11352 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/pari/pari.lisp"><code class="filename">modules/pari/pari.lisp</code></a>
11353 and <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/pari/test.tst"><code class="filename">modules/pari/test.tst</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pari-prec"></a>Real precision</h3></div></div></div><p>The real precision defaults to <code class="varname">pari:pari-real-precision</code>
11354 which specifies the default precision in decimal digits:
11355 </p><pre class="programlisting">
11356 pari:pari-real-precision
11357 ⇒ <code class="computeroutput">19</code>
11358 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (pari:pari-to-lisp (pari:Pi))))
11359 ⇒ <code class="computeroutput">23</code>
11360 </pre><p>
11361 One can also pass the precision parameter explicitly:
11362 </p><pre class="programlisting">
11363 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (pari:pari-to-lisp (pari:Pi :prec 38))))
11364 ⇒ <code class="computeroutput">41</code>
11365 </pre><p>
11366 Note that the <span class="emphasis"><em>actual</em></span> precision is determined by the
11367 size of the mantissa which can be incremented only in steps of
11368 <code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> 'ffi:ulong)</code> (64 bits or 32 bits).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="matlab"></a>33.13. Matlab Interface</h2></div></div></div><p>This is an interface to the
11369 <a class="ulink" href="https://www.mathworks.com/help/matlab/calling-matlab-engine-from-c-programs-1.html" target="_top">Matlab C API</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">MATLAB</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
11370 so you would write <code class="code">(matlab:engOpen ...)</code>
11371 when you need to call <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/engopen.html"><code class="function">engOpen</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11372 contains the symbol <code class="constant">:MATLAB</code>.</p><p>Additionally, some higher level functionality is available
11373 (see <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/matlab/test.tst"><code class="filename">modules/matlab/test.tst</code></a>
11374 for sample usage):</p><div class="variablelist"><dl class="variablelist"><dt><a id="matlab-matfile-content"></a><span class="term"><code class="code">(matlab:matfile-content mf)</code></span></dt><dd>Return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s naming the
11375 variables in file <em class="replaceable"><code>mf</code></em>
11376 (opened using <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/matopen.html"><code class="function">matOpen</code></a>).
11377 </dd><dt><a id="matlab-command"></a><span class="term"><code class="varname">matlab:*command*</code></span></dt><dd>The default argument to
11378 <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/engopen.html"><code class="function">engOpen</code></a>.
11379 </dd><dt><a id="matlab-engine-v"></a><span class="term"><code class="varname">matlab:*engine*</code></span></dt><dd>The currrently open Matlab engine.
11380 </dd><dt><a id="matlab-engine-f"></a><span class="term"><code class="code">(matlab:engine)</code></span></dt><dd>Make sure <code class="varname">*engine*</code> is valid and
11381 return it.</dd><dt><a id="matlab-with-engine"></a><span class="term"><code class="code">(matlab:with-engine
11382 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> engine command) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Run the <em class="replaceable"><code>body</code></em> wuth the <em class="replaceable"><code>engine</code></em>
11383 bound to a Matlab engine (default <code class="varname">*engine*</code>).
11384 The engine is opened with <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/engopen.html"><code class="function">engOpen</code></a>,
11385 then closed with <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/engclose.html"><code class="function">engClose</code></a>.
11386 </dd><dt><a id="matlab-with-MATfile"></a><span class="term"><code class="code">(matlab:with-MATfile
11387 (file name <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> mode) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/matopen.html"><code class="function">matOpen</code></a> the
11388 matlab file, do the <em class="replaceable"><code>body</code></em>, <a class="matlab" href="https://www.mathworks.com/help/matlab/apiref/matclose.html"><code class="function">matClose</code></a>
11389 it.</dd><dt><a id="copy-lisp-to-mxArray"></a><span class="term"><code class="code">(matlab:copy-lisp-to-mxArray
11390 lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> matlab-matrix)</code></span></dt><dd>Copy data from the 2-dimensional lisp array to the
11391 Matlab matrix.</dd><dt><a id="copy-lisp-to-matlab"></a><span class="term"><code class="code">(matlab:copy-lisp-to-matlab
11392 lisp-array matlab-variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> engine)</code></span></dt><dd>Copy the 2-dimensional lisp array to the Matlab
11393 variable (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>) in the supplied engine (defaults to
11394 <code class="varname">*engine*</code>).</dd><dt><a id="copy-mxArray-to-lisp"></a><span class="term"><code class="code">(matlab:copy-mxArray-to-lisp
11395 matlab-matrix <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> lisp-array)</code></span></dt><dd>Copy the matlab matrix to the 2-dimensional lisp array
11396 (created anew or re-used if supplied).</dd><dt><a id="copy-matlab-to-lisp"></a><span class="term"><code class="code">(matlab:copy-matlab-to-lisp
11397 matlab-variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> engine)</code></span></dt><dd>Copy data from the matlab variable to the
11398 2-dimensional lisp array
11399 (created anew or re-used if supplied).</dd><dt><a id="matlab-invert-matrix"></a><span class="term"><code class="code">(matlab:invert-matrix
11400 lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> engine)</code></span></dt><dd>Invert the lisp matrix using the specified engine.
11401 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="netica"></a>33.14. Netica Interface</h2></div></div></div><p>This is an interface to the <a class="ulink" href="http://norsys.com/netica_c_api.htm" target="_top">Netica C API</a> (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> API version 3.25)
11402 for working with Bayesian belief networks and influence diagrams.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">NETICA</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
11403 e.g., you would write <code class="code">(netica:GetNodeExpectedUtils_bn ...)</code>
11404 when you need to call
11405 <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11406 contains the symbol <code class="constant">:NETICA</code>.</p><p>All public <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions are available as
11407 <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s.</p><p>The functions which are specified to return <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> arrays,
11408 namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLikelihood_bn.html"><code class="function">GetNodeLikelihood_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeProbs_bn.html"><code class="function">GetNodeProbs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLevels_bn.html"><code class="function">GetNodeLevels_bn</code></a></td></tr></table><p> correspond to <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s which return <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>s.
11409 We define low level wrappers for them, namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="function">GetNodeBeliefs</code></td></tr><tr><td><code class="function">GetNodeExpectedUtils</code></td></tr><tr><td><code class="function">GetNodeLikelihood</code></td></tr><tr><td><code class="function">GetNodeProbs</code></td></tr><tr><td><code class="function">GetNodeLevels</code></td></tr></table><p> which return the appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s.</p><p>Additionally, some higher level functionality is available
11410 (see <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/netica/demo.lisp"><code class="filename">modules/netica/demo.lisp</code></a>
11411 for sample usage):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(netica:start-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11412 :license :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNeticaEnviron_ns.html"><code class="function">NewNeticaEnviron_ns</code></a>
11413 and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/InitNetica2_bn.html"><code class="function">InitNetica2_bn</code></a> and print some
11414 statistics; initialize <code class="varname">netica:*env*</code>.
11415 </dd><dt><span class="term"><code class="code">(netica:check-errors <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11416 :env :clear :severity)</code></span></dt><dd>Show and, optionally, clear
11417 (<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ClearError_ns.html"><code class="function">ClearError_ns</code></a>), the errors of the
11418 given severity (<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a>)
11419 and above.
11420 You should call this function after <span class="emphasis"><em>every</em></span> call
11421 to a Netica function. Every wrapper function in this list calls it,
11422 so you do <span class="strong"><strong>not</strong></span> need to call it after a call to a wrapper function.
11423 </dd><dt><span class="term"><code class="code">(netica:error-message error)</code></span></dt><dd><p>Convert netica error to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> containing</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorCategory_ns.html"><code class="function">ErrorCategory_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorNumber_ns.html"><code class="function">ErrorNumber_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorMessage_ns.html"><code class="function">ErrorMessage_ns</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:close-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11424 :env :verbose)</code></span></dt><dd>Terminate the Netica session.
11425 Sets <code class="varname">netica:*env*</code> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
11426 </dd><dt><span class="term"><code class="code">(netica:make-net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :name
11427 :comment :title :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNet_bn.html"><code class="function">NewNet_bn</code></a>,
11428 <a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetTitle_bn.html"><code class="function">SetNetTitle_bn</code></a> and
11429 <a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetComment_bn.html"><code class="function">SetNetComment_bn</code></a>.
11430 </dd><dt><span class="term"><code class="code">(netica:net-info net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :out)</code></span></dt><dd><p>Print some information about the net:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetName_bn.html"><code class="function">GetNetName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetTitle_bn.html"><code class="function">GetNetTitle_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetComment_bn.html"><code class="function">GetNetComment_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetFileName_bn.html"><code class="function">GetNetFileName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetNodes_bn.html"><code class="function">GetNetNodes_bn</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:make-node <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11431 :name :net :kind :levels :states :num-states :title :comment :parents
11432 :cpt :x :y :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNode_bn.html"><code class="function">NewNode_bn</code></a>
11433 with the given name and many other parameters.
11434 </dd><dt><span class="term"><code class="code">(netica:node-info node
11435 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :header :out)</code></span></dt><dd>Print some information about the node, preceded by
11436 the header.</dd><dt><span class="term"><code class="code">(netica:get-beliefs node
11437 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a>
11438 on the node and pretty-print the results when <code class="constant">:VERBOSE</code>
11439 is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(netica:enter-finding net node
11440 state <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/EnterFinding_bn.html"><code class="function">EnterFinding_bn</code></a>
11441 using <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeNamed_bn.html"><code class="function">GetNodeNamed_bn</code></a>
11442 and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetStateNamed_bn.html"><code class="function">GetStateNamed_bn</code></a>.
11443 </dd><dt><span class="term"><code class="code">(netica:save-net net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11444 :file :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/WriteNet_bn.html"><code class="function">WriteNet_bn</code></a>.
11445 </dd><dt><span class="term"><code class="code">(netica:read-net file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11446 :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/ReadNet_bn.html"><code class="function">ReadNet_bn</code></a>.
11447 </dd><dt><span class="term"><code class="code">(netica:with-open-dne-file (var
11448 file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> opts) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&amp;BODY</code></a> body)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewFileStream_ns.html"><code class="function">NewFileStream_ns</code></a>,
11449 execute <em class="replaceable"><code>body</code></em>, then <a class="netica" href="http://norsys.com/onLineAPIManual/functions/DeleteStream_ns.html"><code class="function">DeleteStream_ns</code></a>
11450 - just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a>.</dd><dt><span class="term"><code class="varname">netica:*verbose*</code></span></dt><dd>The log <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>; the default value for
11451 the <code class="constant">:VERBOSE</code> argument (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
11452 </dd><dt><span class="term"><code class="varname">netica:*license*</code></span></dt><dd>The license key provided by
11453 <a class="ulink" href="http://norsys.com/" target="_top">Norsys</a>; the default value
11454 for the <code class="literal">:LICENSE</code> argument.
11455 </dd><dt><span class="term"><code class="varname">netica:*env*</code></span></dt><dd>The Netica environment object; the default value
11456 for the <code class="literal">:ENV</code> argument.
11457 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pcre"></a>33.15. Perl Compatible Regular Expressions</h2></div></div></div><p>This is an interface to <a class="ulink" href="http://www.pcre.org/" target="_top">Perl Compatible Regular Expressions</a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
11458 symbol <code class="constant">:PCRE</code>.</p><div class="variablelist"><a id="pcre-api"></a><p class="title"><strong>PCRE module API</strong></p><dl class="variablelist"><dt><a id="pcre-version"></a><span class="term"><code class="code">(PCRE:PCRE-VERSION)</code></span></dt><dd>Return version information as 4 values: descriptive
11459 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>; 2 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s: major and minor numbers; date <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
11460 </dd><dt><a id="pcre-config"></a><span class="term"><code class="code">(PCRE:PCRE-CONFIG <em class="replaceable"><code>type</code></em>)</code></span></dt><dd><p>Return some information about the PCRE build
11461 configuration. <em class="replaceable"><code>type</code></em> is one of </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="literal">:UTF8</code></td></tr><tr><td><code class="literal">:NEWLINE</code></td></tr><tr><td><code class="literal">:LINK-SIZE</code></td></tr><tr><td><code class="literal">:POSIX-MALLOC-THRESHOLD</code></td></tr><tr><td><code class="literal">:MATCH-LIMIT</code></td></tr><tr><td><code class="literal">:STACKRECURSE</code></td></tr><tr><td><code class="literal">:UNICODE-PROPERTIES </code></td></tr><tr><td><code class="literal">:MATCH-LIMIT-RECURSION</code></td></tr><tr><td><code class="literal">:BSR</code></td></tr></table></dd><dt><a id="pcre-compile"></a><span class="term"><code class="code">(PCRE:PCRE-COMPILE <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :STUDY
11462 :IGNORE-CASE :MULTILINE :DOTALL :EXTENDED :ANCHORED :DOLLAR-ENDONLY
11463 :EXTRA :NOTBOL :NOTEOL :UNGREEDY :NOTEMPTY :NO-AUTO-CAPTURE)</code></span></dt><dd>Compile a pattern, optionally study it.
11464 </dd><dt><a id="pattern-info"></a><span class="term">
11465 <code class="code">(PCRE:PATTERN-INFO <em class="replaceable"><code>pattern</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> request)</code></span></dt><dd><p>Return some information about the <em class="replaceable"><code>pattern</code></em>,
11466 such as </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="literal">:OPTIONS</code></td></tr><tr><td><code class="literal">:SIZE</code></td></tr><tr><td><code class="literal">:CAPTURECOUNT</code></td></tr><tr><td><code class="literal">:BACKREFMAX</code></td></tr><tr><td><code class="literal">:FIRSTBYTE</code></td></tr><tr><td><code class="literal">:FIRSTTABLE</code></td></tr><tr><td><code class="literal">:LASTLITERAL</code></td></tr><tr><td><code class="literal">:NAMEENTRYSIZE</code></td></tr><tr><td><code class="literal">:NAMECOUNT</code></td></tr><tr><td><code class="literal">:NAMETABLE</code></td></tr><tr><td><code class="literal">:STUDYSIZE</code></td></tr><tr><td><code class="literal">:OKPARTIAL</code></td></tr><tr><td><code class="literal">:JCHANGED</code></td></tr><tr><td><code class="literal">:HASCRORLF</code></td></tr><tr><td><code class="literal">:MINLENGTH</code></td></tr></table></dd><dt><a id="pcre-name-to-index"></a><span class="term"><code class="code">(PCRE:PCRE-NAME-TO-INDEX <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Convert the name of the sub-pattern to an index in
11467 the return vector.</dd><dt><a id="pcre-exec"></a><span class="term"><code class="code">(PCRE:PCRE-EXEC <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11468 :WORK-SPACE :DFA :BOOLEAN :OFFSET :ANCHORED :NOTBOL :NOTEOL :NOTEMPTY
11469 :PARTIAL :DFA-SHORTEST :DFA-RESTART :FIRSTLINE :DUPNAMES :NEWLINE-CR
11470 :NEWLINE-LF :NEWLINE-CRLF :NEWLINE-ANY :NEWLINE-ANYCRLF :BSR-ANYCRLF
11471 :BSR-UNICODE :JAVASCRIPT-COMPAT :NO-START-OPTIMIZE :NO-START-OPTIMISE
11472 :PARTIAL-HARD :NOTEMPTY-ATSTART)</code></span></dt><dd><p class="simpara">Execute the compiled <em class="replaceable"><code>pattern</code></em> against the
11473 <em class="replaceable"><code>string</code></em> at the given <em class="replaceable"><code>offset</code></em> with the given options.
11474 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no matches or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
11475 <code class="literal">CAPTURECOUNT+1</code> of <span class="type">PCRE:MATCH</span> structures,
11476 unless <code class="literal">:BOOLEAN</code> was non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case
11477 return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> as an indicator of success, but do not allocate anything.
11478 </p><p class="simpara"><code class="constant">:DFA</code> argument determines
11479 whether <code class="function">pcre_dfa_exec</code> is used instead
11480 of <code class="function">pcre_exec</code> (PCRE v6 and better).</p><p class="simpara"><code class="constant">:WORK-SPACE</code> is only used
11481 for <code class="constant">:DFA</code> and defaults to 20.</p></dd><dt><a id="pcre-match-access"></a><span class="term"><code class="code">(PCRE:MATCH-START <em class="replaceable"><code>match</code></em>)</code><br /></span><span class="term"><code class="code">(PCRE:MATCH-END <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Return the start and end of the <em class="replaceable"><code>match</code></em>. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able.
11482 </dd><dt><a id="match-substring"></a><span class="term"><code class="code">(PCRE:MATCH-SUBSTRING <em class="replaceable"><code>match</code></em> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Return the substring of <em class="replaceable"><code>string</code></em> bounded by <em class="replaceable"><code>match</code></em>.
11483 </dd><dt><a id="match-strings"></a><span class="term"><code class="code">(PCRE:MATCH-STRINGS return-vector <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Return all substrings for all matches found
11484 by <code class="function">PCRE:PCRE-EXEC</code>.
11485 </dd><dt><a id="match-string"></a><span class="term"><code class="code">(PCRE:MATCH-STRING return-vector which
11486 <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>pattern</code></em>)</code></span></dt><dd>Return the substring that matches the given sub-pattern.
11487 If <em class="replaceable"><code>which</code></em> is a name of the sub-pattern (as
11488 opposed to its number), <em class="replaceable"><code>pattern</code></em> must be supplied.
11489 </dd><dt><a id="pcre-matcher"></a><span class="term"><code class="code">(PCRE:PCRE-MATCHER <em class="replaceable"><code>pattern</code></em>)</code></span></dt><dd>A valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS &amp; APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
11490 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="zlib"></a>33.16. Interface to zlib</h2></div></div></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to the <a class="ulink" href="http://zlib.net" target="_top">ZLIB</a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11491 contains the symbol <code class="constant">:ZLIB</code>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(ZLIB:Z-VERSION)</code></span></dt><dd>Return the string version of the underlying library.
11492 </dd><dt><span class="term"><code class="code">(ZLIB:COMPRESS source <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> level)</code></span></dt><dd>Compress the <em class="replaceable"><code>source</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>.
11493 </dd><dt><span class="term"><code class="code">(ZLIB:UNCOMPRESS
11494 source destination-length)</code></span></dt><dd>Uncompress the <em class="replaceable"><code>source</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (returned
11495 by <code class="function">ZLIB:COMPRESS</code>).
11496 <em class="replaceable"><code>destination-length</code></em> should be no less than
11497 the length of the uncompressed <em class="replaceable"><code>source</code></em>.
11498 </dd><dt><span class="term"><code class="code">(ZLIB:COMPRESS-BOUND source-length)</code></span></dt><dd>Return the maximum length of the return value
11499 of <code class="function">ZLIB:COMPRESS</code>.</dd><dt><span class="term"><code class="code">(ZLIB:ERROR-STRING <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd>Return a descriptive string for the supplied <em class="replaceable"><code>error-code</code></em>.
11500 </dd><dt><span class="term"><code class="classname">ZLIB:ZERROR</code></span></dt><dd>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> sometimes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
11501 by <code class="function">ZLIB:COMPRESS</code>
11502 and <code class="function">ZLIB:UNCOMPRESS</code>.
11503 You can find the error code and the caller
11504 using <code class="function">ZLIB:ZERROR-ERRNO</code>
11505 and <code class="function">ZLIB:ZERROR-CALLER</code>.
11506 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rawsock"></a>33.17. Raw Socket Access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></dd><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-intro"></a>33.17.1. Introduction</h3></div></div></div><p>This is the raw socket interface, as described in
11507 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html">&lt;<code class="filename">sys/socket.h</code>&gt;</a>.
11508 Sockets are represented by their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
11509 symbol <code class="constant">:RAWSOCK</code>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="rawsock-use-sockets"></a>Try <code class="classname">SOCKET:SOCKET-STREAM</code> first!</h3><p>For most uses of sockets, the facilities described in
11510 <a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a> are adequate and much more convenient than these.
11511 You are encouraged to consider <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s and ensure that they
11512 are not adequate for your purposes before you use raw sockets.
11513 </p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="rawsock-not-streams"></a>Do <span class="strong"><strong>not</strong></span> use <code class="function">EXT:MAKE-STREAM</code>!</h3><p>You can turn such a raw socket into a usual lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
11514 using <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a>, but you should be <span class="emphasis"><em>extremely</em></span>
11515 careful with such dubious actions!
11516 See the <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
11517 <a class="ulink" href="http://sourceforge.net/mailarchive/message.php?msg_id=7203955" target="_top">mailing list archives</a> for more details.
11518 Note that <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> will duplicate the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a>),
11519 so you <span class="emphasis"><em>still</em></span> have to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> the original raw socket.
11520 </p></div><p>Test file <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/rawsock/test.tst"><code class="filename">modules/rawsock/test.tst</code></a>
11521 and the demos in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/rawsock/demos/"><code class="filename">modules/rawsock/demos/</code></a>
11522 contain plenty of examples.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-func"></a>33.17.2. Single System Call Functions</h3></div></div></div><p>We implement access to
11523 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html"><code class="function">accept</code></a>
11524 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html"><code class="function">bind</code></a>
11525 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html"><code class="function">connect</code></a>
11526 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html"><code class="function">getaddrinfo</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11527 node service protocol socktype family passive canonname numerichost
11528 numericserv v4mapped all addrconfig)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html"><code class="function">getnameinfo</code></a> <em class="replaceable"><code>address</code></em>
11529 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> nofqdn numerichost namereqd numericserv numericscope
11530 dgram)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html"><code class="function">getpeername</code></a>
11531 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html"><code class="function">getsockname</code></a>
11532 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html"><code class="function">htonl</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html"><code class="function">htons</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html"><code class="function">ntohl</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html"><code class="function">ntohs</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html"><code class="function">recv</code></a>
11533 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html"><code class="function">recvfrom</code></a> <em class="replaceable"><code>socket</code></em>
11534 <em class="replaceable"><code>buffer</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html"><code class="function">recvmsg</code></a>
11535 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>message</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html"><code class="function">send</code></a>
11536 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html"><code class="function">sendmsg</code></a>
11537 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>message</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html"><code class="function">sendto</code></a>
11538 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sockatmark.html"><code class="function">sockatmark</code></a>
11539 <em class="replaceable"><code>socket</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a> <em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>protocol</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a> <em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>protocol</code></em>)</code></td></tr></table><p>using same-named lisp functions in package
11540 <strong class="package"><span class="quote">“<span class="quote">RAWSOCK</span>”</span></strong>.
11541 Additionally,</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<code class="function">RAWSOCK:SOCK-CLOSE</code> <em class="replaceable"><code>socket</code></em>)</code>
11542 calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html"><code class="function">close</code></a>.</td></tr><tr><td><code class="code">(<code class="function">RAWSOCK:SOCK-LISTEN</code> <em class="replaceable"><code>socket</code></em>
11543 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>backlog</code></em> SOMAXCONN))</code>
11544 calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html"><code class="function">listen</code></a>.</td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>When the OS does not provide <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a>, it is emulated
11545 using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a> + <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html"><code class="function">connect</code></a> +
11546 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html"><code class="function">accept</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-args"></a>33.17.3. Common arguments</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></div><div class="variablelist"><a id="rawsock-args-list"></a><dl class="variablelist"><dt><span class="term"><span class="type">void*</span> <em class="replaceable"><code>buffer</code></em></span></dt><dd>A <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>. The vector may be adjustable
11547 and have a fill pointer. Whenever a function accepts a <em class="replaceable"><code>buffer</code></em>
11548 argument, it also accepts <code class="constant">:START</code> and <code class="constant">:END</code> keyword arguments
11549 with the usual meaning and defaults. You do not have to supply the
11550 vector length because Lisp can determine it itself, but, if you want
11551 to, you can use <code class="constant">:END</code> argument for that.
11552 </dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>socket</code></em></span></dt><dd>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (returned by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a> or
11553 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a>).</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>family</code></em><br /></span><span class="term"><span class="type">int</span> <em class="replaceable"><code>domain</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for <code class="constant">AF_UNSPEC</code>),
11554 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, or a platform-specific keyword, e.g.,
11555 <code class="constant">:INET</code> stands for <code class="constant">AF_INET</code>.
11556 </dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>type</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for 0); <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>; or a
11557 platform-specific keyword, e.g.,
11558 <code class="constant">:DGRAM</code> stands for <code class="constant">SOCK_DGRAM</code>.
11559 </dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>protocol</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for 0); <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>; a
11560 platform-specific keyword, e.g., <code class="constant">:ETH_P_ARP</code> stands
11561 for <code class="constant">ETH_P_ARP</code>, <code class="constant">:IPPROTO-ICMP</code>
11562 stands for <code class="constant">IPPROTO_ICMP</code>; or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> (passed
11563 to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobyname.html"><code class="function">getprotobyname</code></a>).
11564 </dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>flags</code></em></span></dt><dd>This <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> argument corresponds to keyword
11565 arguments to the Lisp functions. E.g., <code class="function">rawsock:send</code>
11566 accepts <code class="constant">:OOB</code> and <code class="constant">:EOR</code> arguments,
11567 while <code class="function">rawsock:recv</code> accepts <code class="constant">:PEEK</code>,
11568 <code class="constant">:OOB</code> and <code class="constant">:WAITALL</code>.
11569 </dd><dt><span class="term"><span class="type">struct sockaddr</span> <em class="replaceable"><code>address</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <span class="type">RAWSOCK:SOCKADDR</span>
11570 returned by
11571 <a class="link" href="#make-sockaddr"><code class="function">MAKE-SOCKADDR</code></a>.
11572 </dd><dt><span class="term"><span class="type">struct msghdr</span> <em class="replaceable"><code>message</code></em></span></dt><dd><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <span class="type">RAWSOCK:MESSAGE</span>
11573 with the following slots:
11574 </p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">addr</span></p></td><td>
11575 a <a class="link" href="#make-sockaddr"><span class="type">SOCKADDR</span></a>.
11576 </td></tr><tr><td><p><span class="term">iovec</span></p></td><td>
11577 a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</code></span>
11578 (<code class="constant">:START</code> and <code class="constant">:END</code> arguments are applied to this vector)
11579 </td></tr><tr><td><p><span class="term">control</span></p></td><td>
11580 a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span></td></tr><tr><td><p><span class="term">flags</span></p></td><td>
11581 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a></td></tr></tbody></table></div></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="rawsock-plat-dep-constants"></a>33.17.3.1. Platform-dependent Keywords</h4></div></div></div><p>One can extract the list of acceptable platform-dependent
11582 keywords for, e.g., socket domain, using the following code:
11583 </p><pre class="programlisting">
11584 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
11585 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>
11586 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (c)
11587 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "~&amp;error: ~A~%" c)
11588 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDDR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">THIRD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a> c)))))))
11589 (rawsock:socket "bad" <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)))
11590 </pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-return"></a>33.17.4. Return Values</h3></div></div></div><p>The return values of the functions described in section
11591 <a class="xref" href="#rawsock-func" title="33.17.2. Single System Call Functions">Section 33.17.2, “Single System Call Functions”</a> are derived from the return values of
11592 the underlying system call: if, say, the <em class="replaceable"><code>address</code></em> argument is modified
11593 by the system call, two values are returned (in addition to the
11594 possible values coming from the return value of the system call):
11595 the (modified) <em class="replaceable"><code>address</code></em> structure and its new size.
11596 If the system call fails, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-not-implemented"></a>33.17.5. Not Implemented</h3></div></div></div><p>We do not interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a> or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html"><code class="function">poll</code></a>
11597 in this module, they are already available through <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a>.</p><p>We do not interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html"><code class="function">shutdown</code></a>
11598 in this module, it is already available through <a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-errors"></a>33.17.6. Errors</h3></div></div></div><p>Errors in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html"><code class="function">getaddrinfo</code></a>
11599 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html"><code class="function">getnameinfo</code></a> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
11600 as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>s of type <span class="type">RAWSOCK:EAI</span>
11601 using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html"><code class="function">gai_strerror</code></a>.</p><p>Errors in other functions are reported as the usual OS errors
11602 (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html"><code class="function">strerror</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-high-level"></a>33.17.7. High-Level Functions</h3></div></div></div><div class="variablelist"><a id="rawsock-high-level-list"></a><p class="title"><strong>Functions that do not
11603 correspond to a single system call</strong></p><dl class="variablelist"><dt><a id="sock-read"></a><span class="term"><code class="code">(<code class="function">RAWSOCK:SOCK-READ</code>
11604 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code><br /></span><span class="term"><code class="code">(<code class="function">RAWSOCK:SOCK-WRITE</code>
11605 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code></span></dt><dd><p class="simpara">Call one of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>/<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html"><code class="function">readv</code></a>
11606 or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a>/<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html"><code class="function">writev</code></a>
11607 (depending on whether <em class="replaceable"><code>buffer</code></em> is a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> or
11608 a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</code></span>).
11609 Return the number of bytes read or written.</p><p class="simpara">When <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html"><code class="function">readv</code></a> and
11610 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html"><code class="function">writev</code></a> and not available, they are
11611 emulated by repeated calls to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a>.</p><p class="simpara">On <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> we have to use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html"><code class="function">recv</code></a>
11612 instead of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html"><code class="function">send</code></a> instead of
11613 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a> because <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a> do not work on sockets,
11614 only on regular files.</p></dd><dt><a id="rawsock-protocol"></a><span class="term"><code class="code">(RAWSOCK:PROTOCOL
11615 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>protocol</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobyname.html"><code class="function">getprotobyname</code></a>
11616 when <em class="replaceable"><code>protocol</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
11617 or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobynumber.html"><code class="function">getprotobynumber</code></a> when
11618 <em class="replaceable"><code>protocol</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.
11619 Return a <span class="type">RAWSOCK:PROTOCOL</span> structure object.
11620 When <em class="replaceable"><code>protocol</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all known protocols using
11621 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setprotoent.html"><code class="function">setprotoent</code></a>,
11622 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotoent.html"><code class="function">getprotoent</code></a>, and
11623 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endprotoent.html"><code class="function">endprotoent</code></a>.
11624 </dd><dt><a id="rawsock-network"></a><span class="term"><code class="code">(RAWSOCK:NETWORK
11625 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>network</code></em> <em class="replaceable"><code>type</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyname.html"><code class="function">getnetbyname</code></a>
11626 when <em class="replaceable"><code>network</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
11627 or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyaddr.html"><code class="function">getnetbyaddr</code></a> when
11628 <em class="replaceable"><code>network</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.
11629 Return a <span class="type">RAWSOCK:NETWORK</span> structure object.
11630 When <em class="replaceable"><code>network</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all known networks
11631 using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setnetent.html"><code class="function">setnetent</code></a>,
11632 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetent.html"><code class="function">getnetent</code></a>, and
11633 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endnetent.html"><code class="function">endnetent</code></a>.
11634 </dd><dt><a id="rawsock-if-name-index"></a><span class="term"><code class="code">(RAWSOCK:IF-NAME-INDEX
11635 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nametoindex.html"><code class="function">if_nametoindex</code></a>
11636 when <em class="replaceable"><code>what</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and return an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>;
11637 or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_indextoname.html"><code class="function">if_indextoname</code></a> when
11638 <em class="replaceable"><code>what</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
11639 When <em class="replaceable"><code>what</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of
11640 pairs <span class="data"><code class="literal">(<em class="replaceable"><code>index</code></em> . <em class="replaceable"><code>name</code></em>)</code></span>
11641 using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nameindex.html"><code class="function">if_nameindex</code></a>.
11642 </dd><dt><a id="rawsock-ifaddrs"></a><span class="term"><code class="code">(RAWSOCK:IFADDRS
11643 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :FLAGS-OR :FLAGS-AND)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getifaddrs"><code class="function">getifaddrs</code></a>
11644 and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <span class="type">ifaddrs</span> objects, optionally
11645 filtered using flags, e.g., <code class="code">(ifaddrs :flags-or '(<em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em>)
11646 :flags-and '(<em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>))</code> will return a list of objects
11647 which have <span class="strong"><strong>both</strong></span> flags <em class="replaceable"><code>m</code></em> <span class="strong"><strong>and</strong></span> <em class="replaceable"><code>n</code></em> <span class="strong"><strong>and</strong></span> at least one of
11648 <em class="replaceable"><code>k</code></em> <span class="strong"><strong>or</strong></span> <em class="replaceable"><code>l</code></em> set.</dd><dt><a id="rawsock-sockopt"></a><span class="term"><code class="code">(RAWSOCK:SOCKET-OPTION
11649 <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :LEVEL)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (RAWSOCK:SOCKET-OPTION <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>name</code></em>
11650 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> :LEVEL) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html"><code class="function">getsockopt</code></a>
11651 and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a>, returns and sets individual (for specific option
11652 <em class="replaceable"><code>name</code></em> and <em class="replaceable"><code>level</code></em>) and multiple (when <em class="replaceable"><code>name</code></em>
11653 is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and/or <em class="replaceable"><code>level</code></em> is <code class="constant">:ALL</code>) options.
11654 (See also <a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a>.)</dd><dt><a id="rawsock-convert-address"></a><span class="term"><code class="code">(<a class="link" href="#rawsock-convert-address"><code class="function">RAWSOCK:CONVERT-ADDRESS</code></a>
11655 <em class="replaceable"><code>family</code></em> <em class="replaceable"><code>address</code></em>)</code></span></dt><dd><p>Convert between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a>
11656 <em class="replaceable"><code>address</code></em> representations using</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html"><code class="function">inet_addr</code></a></td><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html"><code class="function">inet_ntop</code></a></td></tr><tr><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntoa.html"><code class="function">inet_ntoa</code></a></td><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html"><code class="function">inet_pton</code></a></td></tr></table><p>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s are also accepted for backward
11657 compatibility)</p></dd><dt><a id="make-sockaddr"></a><span class="term"><code class="code">(RAWSOCK:MAKE-SOCKADDR
11658 <em class="replaceable"><code>family</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> <em class="replaceable"><code>data</code></em>)</code></span></dt><dd><p class="simpara">Create a <span class="type">sockaddr</span> object.
11659 <em class="replaceable"><code>data</code></em> should be a sequence of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
11660 (meaning <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-list.html" target="_top"><code class="function">MAKE-LIST</code></a> <em class="replaceable"><code>data</code></em> :initial-element 0)</code>).
11661 When omitted, the standard platform-specific size is used.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It is critical to use <em class="replaceable"><code>data</code></em> of the corrent size (usually
11662 <code class="code">sizeof(struct sockaddr)</code>, but may be something depending
11663 on the protocol to be used).</p></div></dd><dt><span class="term"><code class="code">(RAWSOCK:SOCKADDR-FAMILY <em class="replaceable"><code>address</code></em>)</code></span></dt><dd>Return the symbolic <em class="replaceable"><code>family</code></em> of the
11664 <span class="type">sockaddr</span> object.</dd><dt><span class="term"><code class="code">(RAWSOCK:SOCKADDR-DATA <em class="replaceable"><code>address</code></em>)</code></span></dt><dd><p class="simpara">Return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> displaced to the
11665 <em class="structfield"><code>data</code></em> field of the
11666 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">struct sockaddr</span> object.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Modifying this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>'s content will modify the
11667 <em class="replaceable"><code>address</code></em> argument data!</p></div></dd><dt><a id="rawsock-unix-socket"></a><span class="term"><code class="code">(RAWSOCK:OPEN-UNIX-SOCKET
11668 <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> (<em class="replaceable"><code>type</code></em> <code class="constant">:STREAM</code>))</code></span></dt><dd>Open a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> socket special file.
11669 Returns two values: <em class="replaceable"><code>socket</code></em> and <em class="replaceable"><code>address</code></em>.
11670 </dd><dt><span class="term"><code class="code">(RAWSOCK:OPEN-UNIX-SOCKET-STREAM <em class="replaceable"><code>pathname</code></em>
11671 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> <em class="replaceable"><code>options</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> (<em class="replaceable"><code>type</code></em> <code class="constant">:STREAM</code>)
11672 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>)</code></span></dt><dd>Open a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> socket special file.
11673 Returns two values: <em class="replaceable"><code>stream</code></em> and <em class="replaceable"><code>address</code></em>. <em class="replaceable"><code>type</code></em> is passed
11674 to <code class="function">RAWSOCK:OPEN-UNIX-SOCKET</code>, other <em class="replaceable"><code>options</code></em>
11675 to <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> (but see <a class="xref" href="#rawsock-not-streams" title="Do not use EXT:MAKE-STREAM!">Do <span class="strong"><strong>not</strong></span> use <code class="function">EXT:MAKE-STREAM</code>!</a>).
11676 </dd><dt><span class="term"><code class="code">(RAWSOCK:IPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code>
11677 - <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:ICMPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code>
11678 - <a class="rfc" href="http://www.ietf.org/rfc/rfc792.txt"><code><span class="command"><strong>ICMP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:TCPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code>
11679 - <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:UDPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> start end)</code>
11680 - <a class="rfc" href="http://www.ietf.org/rfc/rfc768.txt"><code><span class="command"><strong>UDP</strong></span></code></a></span></dt><dd><p class="simpara">Compute the appropriate protocol checksum and record
11681 it in the appropriate location. <em class="replaceable"><code>buffer</code></em> is assumed to be a suitable
11682 ethernet frame for the protocol, with the appropriate header etc.</p><p class="simpara">Note that <em class="replaceable"><code>buffer</code></em> is an <span class="emphasis"><em>ethernet frame</em></span>,
11683 starting with 6 bytes of the destination MAC address, 6 bytes of the
11684 source MAC address, and 2 bytes specifying the next level protocol,
11685 (e.g., <code class="literal">#x0800</code> for <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <code class="literal">#x0806</code>
11686 for <a class="rfc" href="http://www.ietf.org/rfc/rfc826.txt"><code><span class="command"><strong>ARP</strong></span></code></a>), i.e., the first 14 bytes of <em class="replaceable"><code>buffer</code></em> are ignored by these
11687 functions.</p><p class="simpara">A typical packet you send is both <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a> and thus
11688 has two checksums, so you would want to call <span class="strong"><strong>two</strong></span> functions.
11689 </p></dd><dt><span class="term"><code class="code">(RAWSOCK:CONFIGDEV <em class="replaceable"><code>socket</code></em>
11690 <em class="replaceable"><code>ifname</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>
11691 <em class="replaceable"><code>promisc</code></em>
11692 <em class="replaceable"><code>noarp</code></em>)</code></span></dt><dd>Set some socket options and <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> <em class="replaceable"><code>address</code></em>
11693 with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html"><code class="function">ioctl</code></a>.
11694 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fastcgi"></a>33.18. The <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></div><p>
11695 The <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> module speeds up <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> CGI
11696 scripts launched by a Web server. Working with a
11697 <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>-enabled Web server such as <a class="ulink" href="https://www.apache.org/" target="_top">Apache</a> with
11698 <a class="ulink" href="https://httpd.apache.org/mod_fcgid/" target="_top">mod_fastcgi</a>, a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program using the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
11699 protocol will run many times faster than a conventional CGI program.
11700 The performance improvements stem from the fact that the script's
11701 process remains running across <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests, eliminating startup
11702 overhead and allowing for caching of data structures and other resources. This
11703 is the same approach used is in other languages (e.g., <a class="ulink" href="http://perl.apache.org" target="_top">mod_perl</a> for Perl). </p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
11704 symbol <code class="constant">:FASTCGI</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-overview"></a>33.18.1. Overview of <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a></h3></div></div></div><p>
11705 Traditional CGI programs work by doing input/output with the Web
11706 server via the following channels:
11707 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
11708 Examining environment variables; e.g., <code class="envar">HTTP_USER_AGENT</code> is the
11709 variable set by the Web server to name the browser used
11710 </li><li class="listitem">
11711 Reading from standard input. E.g., to get input data in a "method=POST" request
11712 </li><li class="listitem">
11713 Writing an <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response document (usually "Content-type:
11714 text/html") to the standard output, for eventual transmission
11715 back to the browser client
11716 </li><li class="listitem">
11717 Writing error messages to the standard error, usually captured
11718 by the Web server and logged in its log files.
11719 </li></ol></div><p>
11720 </p><p>
11721 <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> involves replacing calls the standard routines to do
11722 the above with calls in the <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong> package. These calls will then
11723 work exactly as before when the program is invoked as a CGI, but will
11724 also work when invoked by a <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>-enabled Web server.
11725 </p><p>
11726 <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> programs persist across <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests, and thus incur
11727 startup overhead costs only once. For Lisp Web programs, this overhead
11728 can be substantial: code must be
11729 compiled and loaded, files and databases must be opened, etc. Further,
11730 because the program stays running from <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request to <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request,
11731 it can cache information in memory such as database connections
11732 or large in-memory data structures.
11733
11734 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-functionality"></a>33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></h3></div></div></div><p>Access to
11735 <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> is via these functions in package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong>.
11736
11737 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(FASTCGI:IS-CGI)</code></span></dt><dd>
11738 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program has been launched as a traditional
11739 CGI rather than in <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>. In traditional CGI, program I/O is
11740 via operating system environment variables and standard file streams.
11741 Under <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>, I/O is done directly with the Web server via
11742 the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> protocol.
11743 </dd><dt><span class="term">
11744 <code class="code">(FASTCGI:ACCEPT)</code> <em class="replaceable"><code>cgi-forms</code></em>
11745 <code class="code">(FASTCGI:FINISH)</code>
11746 </span></dt><dd><p class="simpara">
11747 In <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> mode, the program loops,
11748 <code class="function">ACCEPT</code>ing to begin the execution of an <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a>
11749 request, and <code class="function">FINISH</code>ing to signal that the script
11750 is finished writing its response to the <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request. <code class="function">ACCEPT</code>
11751 blocks until the next <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request comes in, returning <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if there is
11752 a new request to handle, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no more <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests will
11753 occur, usually because the Web server itself has terminated, in which
11754 case the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> server loop should also exit.
11755 </p><p>
11756 A typical <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> top-level server loop looks like:
11757 </p><pre class="programlisting">
11758 (do ()
11759 ((not (fastcgi:accept)))
11760 (run-my-script)
11761 (fastcgi:finish))
11762 </pre><p>
11763
11764 </p></dd><dt><span class="term"><code class="code">(FASTCGI:GETENV
11765 <em class="replaceable"><code>varname</code></em>)</code></span></dt><dd>
11766 Use in place of <a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a> to get the value of the environment variable
11767 named <em class="replaceable"><code>varname</code></em>, which should be a string.
11768 Unlike <a class="link" href="#getenv" title="32.8.2. Environment Variables"><code class="function">EXT:GETENV</code></a>, which accesses the actual host operating system environment,
11769 <code class="function">FASTCGI:GETENV</code> obtains its environment via
11770 the Web server, over its FastCGI communications channel.
11771 For more information, see the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Web site.
11772 Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>varname</code></em> is not defined in
11773 the operating system environment. See <a class="ulink" href="http://www.cgi101.com/class/ch3/text.html" target="_top">here</a> for a
11774 list of useful variables. You must first have called
11775 <code class="function">ACCEPT</code> and not yet have called
11776 <code class="function">FINISH</code>. </dd><dt><span class="term"><code class="code">(FASTCGI:WRITE-STDOUT
11777 <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>
11778 Use in place of standard Lisp calls which print to standard output
11779 (i.e., as part of the <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response).
11780 You must first have called <code class="function">ACCEPT</code> and not yet have
11781 called <code class="function">FINISH</code>.
11782 </dd><dt><span class="term"><code class="code">(FASTCGI:WRITE-STDERR
11783 <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>
11784 Use in place of standard Lisp calls which print to
11785 standard error. Rather than being part of
11786 the <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response, data written to standard error are usually
11787 collected by the Web server in its error log. This is useful
11788 for diagnostic purposes.
11789 </dd><dt><span class="term"><code class="code">(FASTCGI:SLURP-STDIN)</code></span></dt><dd>
11790 Reads in the entirety of standard input and returns it as a string.
11791 This is usually done for <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests with
11792 <code class="literal">METHOD="post"</code>, when the data are passed to the CGI
11793 script via standard input rather than via the environment variable
11794 <code class="envar">QUERY_STRING</code>. There is no way to read standard input
11795 in pieces, which could be a problem, say, for <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> uploads of very large files.
11796 </dd><dt><span class="term"><code class="code">(FASTCGI:OUT
11797 <em class="replaceable"><code>tree</code></em>)</code></span></dt><dd>
11798 Like <code class="function">WRITE-STDOUT</code>, except that
11799 <em class="replaceable"><code>tree</code></em>
11800 may be an arbitrarily nested list structure containing (at the leaves)
11801 numbers and strings. For example,
11802 <code class="literal">(FASTCGI:OUT '("foo" (" " 10 " " 20)))</code>
11803 will write the string <code class="literal">"foo 10 20"</code>. This function
11804 is useful when building strings in memory for display.
11805 </dd></dl></div><p>
11806
11807 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-example"></a>33.18.3. <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Example</h3></div></div></div><p>
11808
11809 Below is a simple example CGI script using <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>.
11810
11811 </p><pre class="programlisting">
11812 #!/usr/local/bin/clisp -q -K full
11813
11814 (do ((count 1 (1+ count)))
11815 ((not (fastcgi:accept)) nil)
11816 (fastcgi:out "Content-type: text/plain" #\Newline #\Newline)
11817 (fastcgi:out
11818 "I am running in mode: " (if (fastcgi:is-cgi) "CGI" "FastCGI") #\Newline
11819 "This is execution no.: " count #\Newline
11820 "The browser string is '" (fastcgi:getenv "HTTP_USER_AGENT") "'" #\Newline)
11821 (fastcgi:finish))
11822 </pre><p>
11823
11824 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-build"></a>33.18.4. Building and configuring the
11825 <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Interface</h3></div></div></div><p>
11826 It is necessary to download the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> developers' kit, build it,
11827 and install it, before building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> support.
11828 You also need to upgrade your Web server to speak the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
11829 protocol. For <a class="ulink" href="https://www.apache.org/" target="_top">Apache</a> this means building in <a class="ulink" href="https://httpd.apache.org/mod_fcgid/" target="_top">mod_fastcgi</a>, either statically
11830 or dynamically, and then adding a line to your <a class="ulink" href="https://www.apache.org/" target="_top">Apache</a> config like:
11831 </p><pre class="programlisting">
11832 Addhandler fastcgi-script .fcgi
11833 </pre><p>
11834 After that, you can convert <code class="filename">foo.cgi</code> by linking it
11835 to a script names <code class="filename">foo.fcgi</code>. Since a <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
11836 script is also a valid CGI script, it can be run unmodified in either
11837 mode.
11838 </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dbus"></a>33.19. Interface to D-Bus</h2></div></div></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to the <a class="ulink" href="http://www.freedesktop.org/wiki/Software/dbus" target="_top">D-Bus</a> message bus
11839 system, a simple way for applications to talk to one another.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">DBUS</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
11840 e.g., you would write <code class="code">(dbus:dbus_error_init ...)</code>
11841 when you need to call the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function
11842 <code class="function">dbus_error_init</code>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11843 contains the symbol <code class="constant">:D-BUS</code>.</p><p>All public <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions are available as <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s,
11844 defined in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/dbus/dbus.lisp"><code class="filename">modules/dbus/dbus.lisp</code></a>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/dbus/test.tst"><code class="filename">modules/dbus/test.tst</code></a>
11845 for sample usage.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gtk"></a>33.20. GTK Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="https://www.gtk.org" target="_top">GTK+</a> version 2.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">GTK</span>”</span></strong>
11846 is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
11847 contains the symbol <code class="constant">:GTK</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gtk-hi"></a>33.20.1. High-level functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(glade-load <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Load and connect the UI described in the
11848 <a class="ulink" href="https://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>.</dd><dt><span class="term"><code class="code">(run-glade-file <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Run the widget <em class="replaceable"><code>name</code></em> described in the
11849 <a class="ulink" href="https://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>.</dd><dt><span class="term"><code class="code">(gui <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Run the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> demo GUI described in the
11850 <a class="ulink" href="https://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>, normally a variation
11851 of <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/gtk2/ui.glade"><code class="filename">modules/gtk2/ui.glade</code></a>.
11852 </dd></dl></div></div></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="internals"></a>Part IV. Internals of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Implementation</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#source-files">34. The source files of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt><dd><dl><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#gc">35. Overview of <span class="command"><strong>CLISP</strong></span>'s Garbage Collection</a></span></dt><dd><dl><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></dd><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></dd><dt><span class="chapter"><a href="#extend">36. Extending <span class="command"><strong>CLISP</strong></span> Core</a></span></dt><dd><dl><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bytecode">37. The <span class="command"><strong>CLISP</strong></span> bytecode specification</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dd><dl><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></dd><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></dd></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="source-files"></a>Chapter 34. The source files of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt><dd><dl><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dd><dl><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></dd></dl></div><p>For files in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> binary distributions,
11853 see <a href="clisp.html#files" class="olink">the section called “Files”</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-file-types"></a>34.1. File Types</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">#P"*.d"</code></span></dt><dd>The source files for unpreprocessed <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
11854 </dd><dt><span class="term"><code class="filename">#P".c"</code></span></dt><dd>The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code after
11855 <a class="link" href="#src-preprocessing" title="34.2. Source Pre-Processing">preprocessing</a>;
11856 also the result of compiling some <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms (see <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>).
11857 </dd><dt><span class="term"><code class="filename">#P".lisp"</code></span></dt><dd>The source files for Lisp code.
11858 </dd><dt><span class="term"><code class="filename">#P"*.fas"</code></span></dt><dd>Compiled lisp code (platform-independent <a href="impnotes.html#bytecode" class="olink">bytecode</a>s).
11859 </dd><dt><span class="term"><a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a></span></dt><dd>Lisp <span class="quote">“<span class="quote">header</span>”</span>, produced by
11860 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> and used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-preprocessing"></a>34.2. Source Pre-Processing</h2></div></div></div><p><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> sources are pre-processed with the following tools
11861 before being passed to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/comment5.c"><code class="filename">utils/comment5.c</code></a></span></dt><dd><p class="simpara">Convert <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>-style comments (lines starting
11862 with <code class="literal">"# "</code>) to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>-style comments
11863 (<code class="literal">/**/</code>).</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The use of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>-style comments is deprecated.</p></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/comment5.sed"><code class="filename">utils/comment5.sed</code></a></span></dt><dd>A GNU <span class="command"><strong>sed</strong></span> script that converts
11864 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>-style comments (lines starting with <code class="literal">"# "</code>) to
11865 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>-style comments (<code class="literal">/**/</code>). Functionally equivalent
11866 to <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/comment5.c"><code class="filename">utils/comment5.c</code></a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/varbrace.c"><code class="filename">utils/varbrace.c</code></a></span></dt><dd>Add braces to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> source code, so that variable
11867 declarations (introduced with the pseudo-keyword <code class="literal">var</code>)
11868 can be used within blocks, like in <span class="command"><strong>C++</strong></span>
11869 and <span class="command"><strong>C99</strong></span>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/ccpaux.c"><code class="filename">utils/ccpaux.c</code></a></span></dt><dd>When <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> cannot handle indented directives, remove
11870 the indentation.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/gctrigger.c"><code class="filename">utils/gctrigger.c</code></a></span></dt><dd>Add <code class="function">GCTRIGGER</code> statements at the
11871 head of function bodies (for functions marked with
11872 the <code class="literal">maygc</code> pseudo-keyword).
11873 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/deema.c"><code class="filename">utils/deema.c</code></a></span></dt><dd>When <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> cannot handle empty macro arguments,
11874 insert <code class="literal">_EMA_</code> instead.
11875 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/ccmp2c.c"><code class="filename">utils/ccmp2c.c</code></a></span></dt><dd>For the <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> module only.
11876 Allows <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>-style preprocessing <span class="strong"><strong>before</strong></span> <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> processing.
11877 Should be merged into <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> eventually.
11878 </dd><dt><a id="modprep-file"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/modprep.lisp"><code class="filename">utils/modprep.lisp</code></a></span></dt><dd>For some modules only, see <a class="xref" href="#modprep" title="32.2.7.1. Modprep">Section 32.2.7.1, “Modprep”</a>.
11879 </dd><dt><a id="utils-unicode"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/utils/unicode/"><code class="filename">utils/unicode/</code></a></span></dt><dd><p>Generate NLS files in
11880 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/src/"><code class="filename">src/</code></a>.
11881 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
11882 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/utils/unicode/UnicodeDataFull.txt"><code class="filename">utils/unicode/UnicodeDataFull.txt</code></a>
11883 </span></dt><dd>Character descriptions from <a class="ulink" href="https://www.unicode.org/" target="_top">Unicode</a> <a class="ulink" href="https://www.unicode.org/unicode/reports/tr28/" target="_top">3.2</a>;
11884 used by <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a> and installed in <code class="filename">data/</code>
11885 under <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.</dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-files"></a>34.3. Files</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dd><dl><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dd><dl><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-unpreproc-C"></a>34.3.1. Unpreprocessed <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dd><dl><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-includes"></a>34.3.1.1. Includes</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lispbibl.d"><code class="filename">src/lispbibl.d</code></a></span></dt><dd>main include file</dd><dt><a id="fsubr-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/fsubr.d"><code class="filename">src/fsubr.d</code></a></span></dt><dd>list of all built-in special forms
11886 </dd><dt><a id="subr-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/subr.d"><code class="filename">src/subr.d</code></a></span></dt><dd>list of all built-in functions
11887 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/pseudofun.d"><code class="filename">src/pseudofun.d</code></a></span></dt><dd>list of all <span class="quote">“<span class="quote">pseudo functions</span>”</span>
11888 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/constpack.d"><code class="filename">src/constpack.d</code></a></span></dt><dd>list of packages accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
11889 </dd><dt><a id="constsym-d"></a><span class="term">
11890 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/constsym.d"><code class="filename">src/constsym.d</code></a></span></dt><dd>list of symbols accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
11891 </dd><dt><a id="constobj-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/constobj.d"><code class="filename">src/constobj.d</code></a></span></dt><dd>list of miscellaneous objects accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
11892 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/unix.d"><code class="filename">src/unix.d</code></a></span></dt><dd>include file for the <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> implementations
11893 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/win32.d"><code class="filename">src/win32.d</code></a></span></dt><dd>include file for the <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> based versions
11894 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/xthread.d"><code class="filename">src/xthread.d</code></a></span></dt><dd>include file for thread support
11895 </dd><dt><span class="term"><code class="filename">build/modules.h</code></span></dt><dd>list of foreign <a href="impnotes.html#modules" class="olink">module</a>s, generated at build time
11896 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-modules"></a>34.3.1.2. Internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> Modules</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="spvw-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvw.d"><code class="filename">src/spvw.d</code></a></span></dt><dd><p>Memory management (<a href="impnotes.html#gc" class="olink">garbage-collect</a>ion), startup; some OS interface.
11897 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/avl.d"><code class="filename">src/avl.d</code></a></span></dt><dd>An implementation of AVL (Adelson-Velskii and
11898 Landis) trees.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sort.d"><code class="filename">src/sort.d</code></a></span></dt><dd>A sorting routine.</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvwtabf.d"><code class="filename">src/spvwtabf.d</code></a></span></dt><dd>The table of built-in special operators and functions.
11899 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvwtabs.d"><code class="filename">src/spvwtabs.d</code></a></span></dt><dd>The table of all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
11900 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvwtabo.d"><code class="filename">src/spvwtabo.d</code></a></span></dt><dd>The table of miscellaneous objects accessed by
11901 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.</dd><dt><a id="eval-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/eval.d"><code class="filename">src/eval.d</code></a></span></dt><dd><p>Evaluator (form interpreter) and <a href="impnotes.html#bytecode" class="olink">bytecode</a> interpreter.
11902 </p><div class="variablelist"><dl class="variablelist"><dt><a id="bytecode-d"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/bytecode.d"><code class="filename">src/bytecode.d</code></a></span></dt><dd>List of <a href="impnotes.html#bytecode" class="olink">bytecode</a>s.</dd><dt><a id="lightning-c"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lightning.c"><code class="filename">src/lightning.c</code></a></span></dt><dd>Just-in-time compiler using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/lightning/" target="_top">lightning</a>.</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/control.d"><code class="filename">src/control.d</code></a></span></dt><dd>Special operator interpreter.
11903 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/pathname.d"><code class="filename">src/pathname.d</code></a></span></dt><dd>Pathnames, file- and directory-related functions.
11904 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/stream.d"><code class="filename">src/stream.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s of all kinds: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s,
11905 <a class="link" href="#terminal" title="21.2. Terminal interaction">terminal</a> streams, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>s
11906 etc.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/socket.d"><code class="filename">src/socket.d</code></a></span></dt><dd>Opening <a class="link" href="#socket" title="32.4. Socket Streams">socket</a>s for <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a>/<a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <a class="ulink" href="https://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a>.
11907 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/io.d"><code class="filename">src/io.d</code></a></span></dt><dd>The lisp reader (parser) and printer (including
11908 pretty printer).</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/array.d"><code class="filename">src/array.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s.
11909 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/hashtabl.d"><code class="filename">src/hashtabl.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s.
11910 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/list.d"><code class="filename">src/list.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s.
11911 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/package.d"><code class="filename">src/package.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s.
11912 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/record.d"><code class="filename">src/record.d</code></a></span></dt><dd>Functions dealing with records (structures, closures, etc.)
11913 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sequence.d"><code class="filename">src/sequence.d</code></a></span></dt><dd>The generic <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> functions.
11914 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/funarg.d"><code class="filename">src/funarg.d</code></a></span></dt><dd>Functional arguments, like <code class="constant">:TEST</code> and <code class="constant">:KEY</code>.
11915 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/charstrg.d"><code class="filename">src/charstrg.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s.
11916 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/debug.d"><code class="filename">src/debug.d</code></a></span></dt><dd>The <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> and the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.
11917 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/error.d"><code class="filename">src/error.d</code></a></span></dt><dd><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> handling and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ing.
11918 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/errunix.d"><code class="filename">src/errunix.d</code></a></span></dt><dd><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>-specific error messages.
11919 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/errwin32.d"><code class="filename">src/errwin32.d</code></a></span></dt><dd><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>-specific error messages.
11920 </dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/misc.d"><code class="filename">src/misc.d</code></a></span></dt><dd>Miscellaneous functions.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/time.d"><code class="filename">src/time.d</code></a></span></dt><dd>Timing functions.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/predtype.d"><code class="filename">src/predtype.d</code></a></span></dt><dd>Predicates, type tests.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/symbol.d"><code class="filename">src/symbol.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s.
11921 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/unixaux.d"><code class="filename">src/unixaux.d</code></a></span></dt><dd>Auxiliary functions (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> version only).
11922 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/win32aux.d"><code class="filename">src/win32aux.d</code></a></span></dt><dd>Auxiliary functions (<a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> version only).
11923 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/foreign.d"><code class="filename">src/foreign.d</code></a></span></dt><dd><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> implementation.
11924 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lisparit.d"><code class="filename">src/lisparit.d</code></a></span></dt><dd>Functions dealing with numbers (arithmetic), see
11925 <a class="xref" href="#src-arith" title="34.3.1.3. Number system (arithmetic)">Section 34.3.1.3, “Number system (arithmetic)”</a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/noreadline.d"><code class="filename">src/noreadline.d</code></a></span></dt><dd>Dummy plug-in for the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.
11926 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/zthread.d"><code class="filename">src/zthread.d</code></a></span></dt><dd>MT implementation.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-arith"></a>34.3.1.3. Number system (arithmetic)</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lisparit.d"><code class="filename">src/lisparit.d</code></a></span></dt><dd>initialization, input/output of numbers, lisp functions
11927 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/aridecl.d"><code class="filename">src/aridecl.d</code></a></span></dt><dd>declarations</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/arilev0.d"><code class="filename">src/arilev0.d</code></a></span></dt><dd>arithmetic at the machine level
11928 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/arilev1.d"><code class="filename">src/arilev1.d</code></a></span></dt><dd>digit sequences</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/arilev1c.d"><code class="filename">src/arilev1c.d</code></a></span></dt><dd>operations on digit sequences, written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
11929 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/arilev1i.d"><code class="filename">src/arilev1i.d</code></a></span></dt><dd>operations on digit sequences, as inline functions
11930 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/arilev1e.d"><code class="filename">src/arilev1e.d</code></a></span></dt><dd>operations on digit sequences, bindings to external
11931 routines</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intelem.d"><code class="filename">src/intelem.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: elementary operations
11932 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intlog.d"><code class="filename">src/intlog.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: logical connectives
11933 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intplus.d"><code class="filename">src/intplus.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: addition and subtraction
11934 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intcomp.d"><code class="filename">src/intcomp.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: comparison
11935 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intbyte.d"><code class="filename">src/intbyte.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: byte operations <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_ldb.html" target="_top"><code class="function">LDB</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dpb.html" target="_top"><code class="function">DPB</code></a>
11936 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intmal.d"><code class="filename">src/intmal.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: multiplication
11937 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intdiv.d"><code class="filename">src/intdiv.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: division
11938 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intgcd.d"><code class="filename">src/intgcd.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gcd.html" target="_top"><code class="function">GCD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lcm.html" target="_top"><code class="function">LCM</code></a>
11939 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/int2adic.d"><code class="filename">src/int2adic.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: operations on 2-adic integers
11940 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intsqrt.d"><code class="filename">src/intsqrt.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: square root, n-th root
11941 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intprint.d"><code class="filename">src/intprint.d</code></a></span></dt><dd>subroutines for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> output
11942 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intread.d"><code class="filename">src/intread.d</code></a></span></dt><dd>subroutines for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> input
11943 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/rational.d"><code class="filename">src/rational.d</code></a></span></dt><dd>rational numbers (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>s)
11944 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sfloat.d"><code class="filename">src/sfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s
11945 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ffloat.d"><code class="filename">src/ffloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>s
11946 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/dfloat.d"><code class="filename">src/dfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>s
11947 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lfloat.d"><code class="filename">src/lfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s
11948 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/flo_konv.d"><code class="filename">src/flo_konv.d</code></a></span></dt><dd>conversions between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>s
11949 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/flo_rest.d"><code class="filename">src/flo_rest.d</code></a></span></dt><dd>general <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> operations
11950 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/realelem.d"><code class="filename">src/realelem.d</code></a></span></dt><dd>elementary functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> numbers
11951 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/realrand.d"><code class="filename">src/realrand.d</code></a></span></dt><dd>random numbers
11952 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/realtran.d"><code class="filename">src/realtran.d</code></a></span></dt><dd>transcendental functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> numbers
11953 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/compelem.d"><code class="filename">src/compelem.d</code></a></span></dt><dd>elementary functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers
11954 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/comptran.d"><code class="filename">src/comptran.d</code></a></span></dt><dd>transcendental functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers
11955 </dd></dl></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="src-ari-asm"></a>34.3.1.3.1. External routines for the arithmetic
11956 system, written in assembly language</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_sparc.d"><code class="filename">src/ari_asm_sparc.d</code></a></span></dt><dd>written in SPARC assembler
11957 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_sparc64.d"><code class="filename">src/ari_asm_sparc64.d</code></a></span></dt><dd>written in 64-bit SPARC assembler
11958 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_i386.d"><code class="filename">src/ari_asm_i386.d</code></a></span></dt><dd>written in i386/i486 assembler
11959 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_mips.d"><code class="filename">src/ari_asm_mips.d</code></a></span></dt><dd>written in MIPS assembler
11960 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_mips64.d"><code class="filename">src/ari_asm_mips64.d</code></a></span></dt><dd>written in 64-bit MIPS assembler
11961 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_hppa.d"><code class="filename">src/ari_asm_hppa.d</code></a></span></dt><dd>written in HPPA-1.0 assembler
11962 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ari_asm_arm.d"><code class="filename">src/ari_asm_arm.d</code></a></span></dt><dd>written in ARM assembler
11963 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-asm-sp"></a>34.3.1.4. External routines for accessing the
11964 stack, written in assembly language</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sp_asm_m68k.d"><code class="filename">src/sp_asm_m68k.d</code></a></span></dt><dd>written in 68000 assembler, MIT syntax
11965 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sp_asm_sparc.d"><code class="filename">src/sp_asm_sparc.d</code></a></span></dt><dd>written in SPARC assembler
11966 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sp_asm_sparc64.d"><code class="filename">src/sp_asm_sparc64.d</code></a></span></dt><dd>written in 64-bit SPARC assembler
11967 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sp_asm_i386.d"><code class="filename">src/sp_asm_i386.d</code></a></span></dt><dd>written in i386/i486 assembler
11968 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/sp_asm_mips.d"><code class="filename">src/sp_asm_mips.d</code></a></span></dt><dd>written in MIPS assembler
11969 </dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-asm-misc"></a>34.3.2. Other assembly language stuff</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/asm-i386.sh"><code class="filename">src/asm-i386.sh</code></a></span></dt><dd>converts i386 assembler from Linux/i386 format (with MIT
11970 syntax) to a macro syntax
11971 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/asm-i386.h"><code class="filename">src/asm-i386.h</code></a></span></dt><dd>expands i386 assembler in macro syntax to either MIT
11972 or Intel syntax</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/noexecstack.h"><code class="filename">src/noexecstack.h</code></a></span></dt><dd>Ensures that a hand-written assembly-language file does
11973 not force an executable stack in the process that executes. This is needed
11974 because the GNU binutils developers, when adding some security feature
11975 in 2005, favoured backward compatibility of already built object files, at
11976 the detriment of programmers who write assembly-language. For more details, see
11977 <a class="ulink" href="https://git.savannah.gnu.org/gitweb/?p=libffcall.git;a=blob;f=porting-tools/execstack/README" target="_top">the
11978 notes in GNU libffcall</a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-lisp"></a>34.3.3. Lisp source files</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="init-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/init.lisp"><code class="filename">src/init.lisp</code></a></span></dt><dd>the first file to be loaded during bootstrapping,
11979 loads everything else</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/defseq.lisp"><code class="filename">src/defseq.lisp</code></a></span></dt><dd>defines the usual sequence types for the generic
11980 sequence functions</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/backquote.lisp"><code class="filename">src/backquote.lisp</code></a></span></dt><dd>implements the backquote read macro
11981 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/defmacro.lisp"><code class="filename">src/defmacro.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/macros1.lisp"><code class="filename">src/macros1.lisp</code></a></span></dt><dd>the most important macros
11982 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/macros2.lisp"><code class="filename">src/macros2.lisp</code></a></span></dt><dd>some other macros
11983 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/defs1.lisp"><code class="filename">src/defs1.lisp</code></a></span></dt><dd>miscellaneous definitions
11984 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/timezone.lisp"><code class="filename">src/timezone.lisp</code></a></span></dt><dd>site-dependent definition of time zone, except for
11985 <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/places.lisp"><code class="filename">src/places.lisp</code></a></span></dt><dd>macros using <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s, definitions of most standard
11986 and extensiion <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s</dd><dt><a id="floatprint-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/floatprint.lisp"><code class="filename">src/floatprint.lisp</code></a></span></dt><dd>defines <a class="link" href="#write-float-decimal" title="22.2. Printing Floats sec_22-1-3-1-3"><code class="function">SYS::WRITE-FLOAT-DECIMAL</code></a> for printing floating
11987 point numbers in base 10</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/type.lisp"><code class="filename">src/type.lisp</code></a></span></dt><dd>functions working with <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a>s: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a>,
11988 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/defstruct.lisp"><code class="filename">src/defstruct.lisp</code></a></span></dt><dd>implements the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>
11989 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/format.lisp"><code class="filename">src/format.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a>
11990 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/room.lisp"><code class="filename">src/room.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>
11991 (see also <a class="xref" href="#room" title="25.3.1. Function ROOM">Section 25.3.1, “Function <code class="function">ROOM</code>”</a>)</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/savemem.lisp"><code class="filename">src/savemem.lisp</code></a></span></dt><dd>see <a class="xref" href="#image" title="31.2. Saving an Image">Section 31.2, “Saving an Image”</a>
11992 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/xcharin.lisp"><code class="filename">src/xcharin.lisp</code></a> (optional)</span></dt><dd>implements extended character input for <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
11993 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/keyboard.lisp"><code class="filename">src/keyboard.lisp</code></a> (optional)</span></dt><dd>implements the macro <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
11994 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/runprog.lisp"><code class="filename">src/runprog.lisp</code></a></span></dt><dd>implements the functions <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> etc.
11995 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/query.lisp"><code class="filename">src/query.lisp</code></a></span></dt><dd>implements the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">Y-OR-N-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">YES-OR-NO-P</code></a>
11996 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/reploop.lisp"><code class="filename">src/reploop.lisp</code></a></span></dt><dd>support for the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> and the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
11997 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/dribble.lisp"><code class="filename">src/dribble.lisp</code></a></span></dt><dd>implements the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> and
11998 <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="function">EXT:DRIBBLE-STREAM</code></a>
11999 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/complete.lisp"><code class="filename">src/complete.lisp</code></a></span></dt><dd>implements completion, see <a class="xref" href="#terminal" title="21.2. Terminal interaction">Section 21.2, “Terminal interaction”</a>.
12000 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/describe.lisp"><code class="filename">src/describe.lisp</code></a></span></dt><dd>implements functions <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>, <a href="impnotes.html#apropos" class="olink"><code class="function">APROPOS</code></a>,
12001 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/trace.lisp"><code class="filename">src/trace.lisp</code></a></span></dt><dd><a class="link" href="#trace" title="25.2.6. Macro TRACE">tracer</a>
12002 </dd><dt><a id="macros3-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/macros3.lisp"><code class="filename">src/macros3.lisp</code></a> (optional)</span></dt><dd>macros <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF &amp; EXT:LETF*"><code class="function">EXT:LETF*</code></a>, <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a>, <a class="link" href="#with-collect" title="31.11.4. Macro EXT:WITH-COLLECT"><code class="function">EXT:WITH-COLLECT</code></a>,
12003 function <a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a>.</dd><dt><a id="config-lisp"></a><span class="term"><code class="filename">build/config.lisp</code></span></dt><dd><p>site-dependent configuration, a user-modified
12004 copy of one of the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/cfgunix.lisp"><code class="filename">src/cfgunix.lisp</code></a></span></dt><dd>for <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/cfgwin32.lisp"><code class="filename">src/cfgwin32.lisp</code></a></span></dt><dd>for the <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
12005 </dd></dl></div><p>
12006 See <a class="xref" href="#customize" title="31.12. Customizing CLISP behavior">Section 31.12, “Customizing <span class="command"><strong>CLISP</strong></span> behavior”</a>.</p></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a></span></dt><dd>compiles Lisp code to <a href="impnotes.html#bytecode" class="olink">bytecode</a>
12007 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/functions.lisp"><code class="filename">src/functions.lisp</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> et al
12008 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/disassem.lisp"><code class="filename">src/disassem.lisp</code></a></span></dt><dd>the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
12009 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/defs2.lisp"><code class="filename">src/defs2.lisp</code></a></span></dt><dd>miscellaneous [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] definitions
12010 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/loop.lisp"><code class="filename">src/loop.lisp</code></a></span></dt><dd>implements the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]-compatible <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> macro
12011 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos.lisp"><code class="filename">src/clos.lisp</code></a></span></dt><dd><p>loads the various parts of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-package.lisp"><code class="filename">src/clos-package.lisp</code></a></span></dt><dd>declares the imports and exports of the
12012 <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> package</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-macros.lisp"><code class="filename">src/clos-macros.lisp</code></a></span></dt><dd>defines some internal macros used by the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
12013 implementation</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class0.lisp"><code class="filename">src/clos-class0.lisp</code></a></span></dt><dd>defines the <code class="classname">class-version</code>
12014 structure</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-metaobject1.lisp"><code class="filename">src/clos-metaobject1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a> class
12015 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-slotdef1.lisp"><code class="filename">src/clos-slotdef1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> class and its
12016 subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-slotdef2.lisp"><code class="filename">src/clos-slotdef2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
12017 <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-slotdef3.lisp"><code class="filename">src/clos-slotdef3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
12018 <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-stablehash1.lisp"><code class="filename">src/clos-stablehash1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> class
12019 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-stablehash2.lisp"><code class="filename">src/clos-stablehash2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
12020 <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-specializer1.lisp"><code class="filename">src/clos-specializer1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> class and its subclasses
12021 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-specializer2.lisp"><code class="filename">src/clos-specializer2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
12022 <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-specializer3.lisp"><code class="filename">src/clos-specializer3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
12023 <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class1.lisp"><code class="filename">src/clos-class1.lisp</code></a></span></dt><dd>defines the <code class="classname">potential-class</code>
12024 class and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class2.lisp"><code class="filename">src/clos-class2.lisp</code></a></span></dt><dd>implements the mapping from class names to classes
12025 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class3.lisp"><code class="filename">src/clos-class3.lisp</code></a></span></dt><dd>implements the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, class definition
12026 and class redefinition</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class4.lisp"><code class="filename">src/clos-class4.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods
12027 for <code class="classname">potential-class</code> and its
12028 subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class5.lisp"><code class="filename">src/clos-class5.lisp</code></a></span></dt><dd>implements the special logic of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>,
12029 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> etc.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-class6.lisp"><code class="filename">src/clos-class6.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
12030 <code class="classname">potential-class</code> objects
12031 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-method1.lisp"><code class="filename">src/clos-method1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> class and its subclasses
12032 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-method2.lisp"><code class="filename">src/clos-method2.lisp</code></a></span></dt><dd>implements the bulk of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
12033 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-method3.lisp"><code class="filename">src/clos-method3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
12034 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-method4.lisp"><code class="filename">src/clos-method4.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>
12035 objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-methcomb1.lisp"><code class="filename">src/clos-methcomb1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a> class
12036 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-methcomb2.lisp"><code class="filename">src/clos-methcomb2.lisp</code></a></span></dt><dd>implements method combination (part 2 of generic
12037 function dispatch and execution) and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a> macro
12038 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-methcomb3.lisp"><code class="filename">src/clos-methcomb3.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
12039 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-methcomb4.lisp"><code class="filename">src/clos-methcomb4.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a>
12040 objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun1.lisp"><code class="filename">src/clos-genfun1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> class and its
12041 metaclass, superclass and subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun2a.lisp"><code class="filename">src/clos-genfun2a.lisp</code></a></span></dt><dd>implements part 1 of generic function dispatch and
12042 execution</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun2b.lisp"><code class="filename">src/clos-genfun2b.lisp</code></a></span></dt><dd>implements part 3 of generic function dispatch and
12043 execution</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun3.lisp"><code class="filename">src/clos-genfun3.lisp</code></a></span></dt><dd>implements creation of generic function objects,
12044 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun4.lisp"><code class="filename">src/clos-genfun4.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
12045 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-genfun5.lisp"><code class="filename">src/clos-genfun5.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>
12046 objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-slots1.lisp"><code class="filename">src/clos-slots1.lisp</code></a></span></dt><dd>implements low-level slot access, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-slots.html" target="_top"><code class="function">WITH-SLOTS</code></a>,
12047 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-accessors.html" target="_top"><code class="function">WITH-ACCESSORS</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-slots2.lisp"><code class="filename">src/clos-slots2.lisp</code></a></span></dt><dd>defines the generic functions that deal with slot access
12048 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-dependent.lisp"><code class="filename">src/clos-dependent.lisp</code></a></span></dt><dd>implements notification from metaobjects to
12049 dependent objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-print.lisp"><code class="filename">src/clos-print.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>
12050 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clos-custom.lisp"><code class="filename">src/clos-custom.lisp</code></a></span></dt><dd>provides user customization of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
12051 </dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/gray.lisp"><code class="filename">src/gray.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html" target="_top">STREAM-DEFINITION-BY-USER:GENERIC-FUNCTIONS</a>
12052 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/fill-out.lisp"><code class="filename">src/fill-out.lisp</code></a></span></dt><dd>implements <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a>
12053 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/disassem.lisp"><code class="filename">src/disassem.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
12054 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/condition.lisp"><code class="filename">src/condition.lisp</code></a></span></dt><dd>implements the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> Condition System (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-9.html"><span class="command"><strong>CLCS</strong></span></a>)
12055 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/gstream.lisp"><code class="filename">src/gstream.lisp</code></a> (optional)</span></dt><dd>generic stream default methods,
12056 see <a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/foreign1.lisp"><code class="filename">src/foreign1.lisp</code></a></span></dt><dd><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> implementation.
12057 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/screen.lisp"><code class="filename">src/screen.lisp</code></a></span></dt><dd>the screen access package, see <a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a>
12058 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/edit.lisp"><code class="filename">src/edit.lisp</code></a>
12059 (optional)</span></dt><dd>the screen editor (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a>), <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a>
12060 </dd><dt><a id="inspect-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/inspect.lisp"><code class="filename">src/inspect.lisp</code></a></span></dt><dd>implements <a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a> (tty and <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> frontends)
12061 </dd><dt><a id="clhs-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/clhs.lisp"><code class="filename">src/clhs.lisp</code></a></span></dt><dd>implements <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a>, <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a>
12062 </dd><dt><a id="exporting-lisp"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/exporting.lisp"><code class="filename">src/exporting.lisp</code></a></span></dt><dd>Macros that export their definienda,
12063 see <a class="xref" href="#exporting" title="32.2.7.3. Exporting">Section 32.2.7.3, “Exporting”</a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/threads.lisp"><code class="filename">src/threads.lisp</code></a></span></dt><dd>MT interface</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/german.lisp"><code class="filename">src/german.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/french.lisp"><code class="filename">src/french.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spanish.lisp"><code class="filename">src/spanish.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/russian.lisp"><code class="filename">src/russian.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/danish.lisp"><code class="filename">src/danish.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/dutch.lisp"><code class="filename">src/dutch.lisp</code></a></span></dt><dd><a class="link" href="#i18n" title="31.4. Internationalization of CLISP">i18n</a> user messages
12064 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-ext-mod"></a>34.3.4. External Modules</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/"><code class="filename">modules/</code></a></span></dt><dd>individual external module sources
12065 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-doc"></a>34.3.5. Documentation</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="src-news"></a><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/NEWS"><code class="filename">src/NEWS</code></a></span></dt><dd>the list of the user-visible changes
12066 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_README"><code class="filename">src/_README</code></a></span></dt><dd><p>master for the distribution's README</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_README.en"><code class="filename">src/_README.en</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_README.de"><code class="filename">src/_README.de</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_README.es"><code class="filename">src/_README.es</code></a></span></dt><dd>translations of
12067 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_README"><code class="filename">src/_README</code></a>
12068 </dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a></span></dt><dd><a class="ulink" href="https://docbook.org/" target="_top">DocBook</a>/<a class="ulink" href="https://www.w3.org/XML/" target="_top">XML</a> sources for the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12069 <a href="clisp.html#clisp" class="olink">manual page</a>
12070 </dd><dt><span class="term"><code class="filename"><em class="replaceable"><code>build-dir</code></em>/clisp.1</code></span></dt><dd>the platform-specific
12071 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html"><span class="command"><strong>man</strong></span></a> manual page,
12072 generated from <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a>
12073 at <span class="emphasis"><em>build</em></span> time</dd><dt><span class="term"><code class="filename"><em class="replaceable"><code>build-dir</code></em>/clisp.html</code></span></dt><dd>the platform-specific <a class="ulink" href="https://www.w3.org/html/" target="_top">HTML</a> manual page,
12074 generated from <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a>
12075 at <span class="emphasis"><em>build</em></span> time</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impnotes.xml.in"><code class="filename">doc/impnotes.xml.in</code></a></span></dt><dd><p>the master <a class="ulink" href="https://docbook.org/" target="_top">DocBook</a>/<a class="ulink" href="https://www.w3.org/XML/" target="_top">XML</a> file for these
12076 implementation notes; includes the following files</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/cl-ent.xml"><code class="filename">doc/cl-ent.xml</code></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-independent general <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>-related entities
12077 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/clhs-ent.xml"><code class="filename">doc/clhs-ent.xml</code></a></span></dt><dd>generated list of [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] entities
12078 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impent.xml"><code class="filename">doc/impent.xml</code></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific entities
12079 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/unix-ent.xml"><code class="filename">doc/unix-ent.xml</code></a></span></dt><dd><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>-related entities
12080 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/mop-ent.xml"><code class="filename">doc/mop-ent.xml</code></a></span></dt><dd><a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a>-related entities
12081 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impbody.xml"><code class="filename">doc/impbody.xml</code></a></span></dt><dd>most of <a class="xref" href="#clhs-chapters" title="Part I. Chapters or the Common Lisp HyperSpec">Part I, “Chapters or the Common Lisp HyperSpec”</a>
12082 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impissue.xml"><code class="filename">doc/impissue.xml</code></a></span></dt><dd><a class="xref" href="#issues" title="Chapter 28. X3J13 Issue Index [CLHS-ic]">Chapter 28, <em>X3J13 Issue Index [CLHS-ic]</em></a>
12083 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/gray.xml"><code class="filename">doc/gray.xml</code></a></span></dt><dd><a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>
12084 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/mop.xml"><code class="filename">doc/mop.xml</code></a></span></dt><dd><a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a>
12085 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impext.xml"><code class="filename">doc/impext.xml</code></a></span></dt><dd><a class="xref" href="#ext-p-indep" title="Chapter 31. Platform Independent Extensions">Chapter 31, <em>Platform Independent Extensions</em></a> and
12086 <a class="xref" href="#ext-platform" title="Chapter 32. Platform Specific Extensions">Chapter 32, <em>Platform Specific Extensions</em></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impbyte.xml"><code class="filename">doc/impbyte.xml</code></a></span></dt><dd>this <a class="xref" href="#internals" title="Part IV. Internals of the CLISP Implementation">Part IV, “Internals of the <span class="command"><strong>CLISP</strong></span> Implementation”</a>
12087 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/faq.xml"><code class="filename">doc/faq.xml</code></a></span></dt><dd><a class="xref" href="#faq" title="Appendix A. Frequently Asked Questions (With Answers) about CLISP">Appendix A, <em>Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></em></a>
12088 </dd><dt><span class="term"><code class="filename">modules/**/*.xml</code></span></dt><dd>individual external module documentation
12089 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/Symbol-Table.text"><code class="filename">doc/Symbol-Table.text</code></a></span></dt><dd>the mapping between lisp symbols and element IDs
12090 in these notes (see <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>),
12091 installed in <code class="filename">data/</code> under <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.
12092 </dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impnotes.html"><code class="filename">doc/impnotes.html</code></a></span></dt><dd>these <a class="ulink" href="https://www.w3.org/html/" target="_top">HTML</a> implementation notes,
12093 generated from <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/impnotes.xml.in"><code class="filename">doc/impnotes.xml.in</code></a>
12094 at <span class="emphasis"><em>release</em></span> time</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-i18n"></a>34.3.6. Internationalization</h3></div></div></div><p>These files are usually updated a couple of weeks before a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12095 release using <span class="command"><strong>make -f Makefile.devel tp-mail</strong></span>,
12096 see also <a class="xref" href="#src-external" title="34.3.8. Externally maintained files">Section 34.3.8, “Externally maintained files”</a>.</p><p>We use the
12097 <a class="ulink" href="http://translationproject.org/domain/clisp.html" target="_top">Translation
12098 project</a> and the above command sends the updated files to the
12099 translators.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">src/po/*.pot</code></span></dt><dd>list of translatable messages (<span class="quote">“<span class="quote">portable
12100 object template</span>”</span>)</dd><dt><span class="term"><code class="filename">src/po/*.po</code></span></dt><dd>translated messages (<span class="quote">“<span class="quote">portable objects</span>”</span>)
12101 </dd><dt><span class="term"><code class="filename">src/po/*.gmo</code></span></dt><dd>translated messages (<span class="quote">“<span class="quote"><a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> format message
12102 objects</span>”</span>)</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-conf-unix"></a>34.3.7. Automatic configuration on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="http://www.mingw.org/" target="_top"><span class="platform">MinGW</span></a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/configure"><code class="filename">configure</code></a></span></dt><dd>the main configuration script
12103 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/version.sh"><code class="filename">version.sh</code></a></span></dt><dd>specifies the current <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version
12104 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/configure.in"><code class="filename">src/configure.in</code></a></span></dt><dd>lists features to be checked
12105 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/src/m4/"><code class="filename">src/m4/</code></a></span></dt><dd><p class="simpara">a repertoire of features.
12106 Use with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a> 2.62</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/m4/clisp.m4"><code class="filename">src/m4/clisp.m4</code></a></span></dt><dd><p>This file defines the macro <code class="function">CL_CLISP</code>
12107 which takes two optional parameters:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">features-list</span></dt><dd>The list of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> features to check.
12108 E.g., passing <code class="code">[foo bar]</code> results
12109 in <code class="varname">cl_cv_clisp_FOO</code>
12110 and <code class="varname">cl_cv_clisp_BAR</code> being defined
12111 to <span class="returnvalue">yes</span>
12112 or <span class="returnvalue">no</span>, depending on the value of
12113 <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>, i.e., on the return value
12114 of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> "#+FOO \"yes\" #-FOO \"no\"")</code>.
12115 </dd><dt><span class="term">required</span></dt><dd><p class="simpara">Determines whether <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> should fail
12116 if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> or one of the requested features is missing.</p><p class="simpara">Should be <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/true.html"><span class="command"><strong>true</strong></span></a> (the
12117 default) or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/false.html"><span class="command"><strong>false</strong></span></a>.</p></dd></dl></div><p class="simpara">Calling this macro causes the generated <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> to
12118 accept the option <code class="option">--with-clisp="clisp command line"</code>
12119 which allows one to use a specific <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> installation instead of
12120 <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> in <code class="envar">PATH</code>.</p><p>In addition to the aforementioned per-feature variables,
12121 this macro defines the follwing variables:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="varname">cl_cv_clisp_version</code></span></dt><dd>The return value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a>.
12122 </dd><dt><span class="term"><code class="varname">cl_cv_clisp_libdir</code></span></dt><dd>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a> of <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.
12123 </dd><dt><span class="term"><code class="varname">cl_cv_clisp_linkset</code></span></dt><dd>The directory of the current <a href="impnotes.html#linkset" class="olink">linking set</a>.
12124 </dd></dl></div><p>
12125 It also substitues the following variables:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="envar">CLISP_LINKKIT</code></td></tr><tr><td><code class="envar">CLISP_FILES</code></td></tr><tr><td><code class="envar">CLISP_LIBS</code></td></tr><tr><td><code class="envar">CLISP_CFLAGS</code></td></tr><tr><td><code class="envar">CLISP_CPPFLAGS</code></td></tr></table><p>
12126 (taken from <code class="filename">$cl_cv_clisp_linkset/<a class="link" href="#makevars">makevars</a></code>)
12127 and <code class="envar">CLISP</code> (the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> command line).</p><p class="simpara">This file is installed in <code class="filename">/usr/share/aclocal</code>
12128 by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make install</strong></span></a>.</p></dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/configure"><code class="filename">src/configure</code></a></span></dt><dd>configuration script, generated from
12129 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/configure.in"><code class="filename">src/configure.in</code></a>
12130 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/intparam.c"><code class="filename">src/intparam.c</code></a></span></dt><dd>figures out some machine parameters (word size,
12131 endianness etc.)</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/floatparam.c"><code class="filename">src/floatparam.c</code></a></span></dt><dd>figures out some floating point arithmetics parameters
12132 (rounding, epsilons etc.)</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/config.h.in"><code class="filename">src/config.h.in</code></a></span></dt><dd>header file master, generated from
12133 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/configure.in"><code class="filename">src/configure.in</code></a>.
12134 <code class="filename"><em class="replaceable"><code>build-dir</code></em>/config.h</code>
12135 contains the values of the features discovered by
12136 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/configure"><code class="filename">src/configure</code></a>.
12137 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/makemake.in"><code class="filename">src/makemake.in</code></a></span></dt><dd>makefile construction script master
12138 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_clisp.c"><code class="filename">src/_clisp.c</code></a></span></dt><dd>master for the distribution's driver program
12139 </dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/_distmakefile"><code class="filename">src/_distmakefile</code></a></span></dt><dd>master for the distribution's Makefile
12140 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-external"></a>34.3.8. Externally maintained files</h3></div></div></div><p>The externally maintained files are usually updated a couple of
12141 weeks before a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> release using
12142 <span class="command"><strong>make -f Makefile.devel pre-release</strong></span>,
12143 see also <a class="xref" href="#src-i18n" title="34.3.6. Internationalization">Section 34.3.6, “Internationalization”</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/src/gllib/"><code class="filename">src/gllib/</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/src/glm4/"><code class="filename">src/glm4/</code></a></span></dt><dd><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top">autoconf</a> files from <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/gnulib/" target="_top">Portability Library</a>;
12144 updated using <span class="command"><strong>make -f Makefile.devel gnulib-imported</strong></span>
12145 at top level.</dd><dt><span class="term"><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/tree/master/src/build-aux/"><code class="filename">src/build-aux/</code></a></span></dt><dd>various shell scripts, updated using
12146 <span class="command"><strong>make -f Makefile.devel build-aux-update</strong></span>
12147 at top level.</dd></dl></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="gc"></a>Chapter 35. Overview of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s Garbage Collection</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></dd><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></div><div class="abstract"><p class="title"><strong>Abstract</strong></p><p>These are internals, which are of interest only to the
12148 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers. If you do not read <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>,
12149 this chapter is probably not for you.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="internals-intro"></a>35.1. Introduction</h2></div></div></div><p>Knowing that most <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> implementations are buggy and/or slow,
12150 and because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> needs to perform <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has its
12151 own memory management subsystem in files <code class="filename">src/spvw*.d</code>,
12152 see <a class="xref" href="#src-modules" title="34.3.1.2. Internal C Modules">Section 34.3.1.2, “Internal <span class="command"><strong>C</strong></span> Modules”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lisp-obj-in-c"></a>35.2. Lisp objects in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="orderedlist"><p class="title"><strong>Three kinds of storage are distinguished:</strong></p><ol class="orderedlist" type="1"><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data (the <span class="quote">“<span class="quote">heap</span>”</span>), i.e. storage
12153 which contains <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s and is managed by the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or.
12154 </li><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> stack (called <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>), contains <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12155 <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s visible to the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or</li><li class="listitem"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> data (including program text, data,
12156 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed memory)</li></ol></div><p>A <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object is one word, containing a tag (partial type
12157 information) and either immediate data or a pointer to storage.
12158 Pointers to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> data have tag = <code class="literal">machine_type</code> = 0,
12159 pointers to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> stack have tag = <code class="literal">system_type</code>,
12160 most other pointers point to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data.</p><div class="variablelist"><a id="immediate-o"></a><p class="title"><strong>Immediate objects</strong></p><dl class="variablelist"><dt><span class="term">32-bit CPU</span></dt><dd><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td></tr></table></dd><dt><span class="term">64-bit CPU</span></dt><dd><p>In addition to the above, </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> (with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a>)</td></tr></table></dd></dl></div><p>Let us turn to those <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects that consume regular <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> memory.
12161 Every <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object has a size which is determined when the object is
12162 allocated (using one of the <code class="function">allocate_*()</code> routines).
12163 The size can be computed from the type tag and - if necessary
12164 - the length field of the object's header. The length field always
12165 contains the number of elements of the object. The number of bytes is
12166 given by the function <code class="function">objsize()</code>.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects which contain exactly 2 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects
12167 (i.e. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>s) are
12168 stored in a separate area and occupy 2 words each.
12169 All other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects have <span class="quote">“<span class="quote">varying</span>”</span> length
12170 (more precisely, not a fixed length) and include a word for <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
12171 purposes at their beginning.</p><p>The garbage collector is invoked every now and then by
12172 <code class="function">allocate_*()</code> calls according to certain heuristics.
12173 It marks all objects which are <span class="quote">“<span class="quote">alive</span>”</span>
12174 (may be reached from the <span class="quote">“<span class="quote">roots</span>”</span>),
12175 compacts these objects and unmarks them.
12176 Non-live objects are lost; their storage is reclaimed.</p><p>2-pointer objects are compacted by a simple hole-filling
12177 algorithm: fill the left-most object into the right-most hole, and so
12178 on, until the objects are contiguous at the right and the hole is
12179 contiguous at the left.</p><p>Variable-length objects are compacted by sliding them down (their
12180 address decreases).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="typecodes"></a>35.3. Object Pointer Representations</h2></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implements two ways of representing object pointers.
12181 (An object pointer, <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>, contains a
12182 pointer to the memory location of the object, or - for <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>
12183 - all bits of the object itself.)
12184 Both of them have some things in common:
12185 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">There is a distinction between <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s
12186 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s, etc) and
12187 heap allocated objects.</li><li class="listitem">All object pointers are typed, i.e. contain a few
12188 bits of information about the type of the pointed-to object. At a
12189 minimum, these bits must allow to distinguish immediate and
12190 heap-allocated objects.</li><li class="listitem">Not all of the type information is contained in the
12191 object pointer. For example, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> objects can change their type
12192 when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called. To avoid scanning all the heap for
12193 references when this happens, the class information is stored in the
12194 heap allocated object, not in the object pointer.</li></ul></div><p>The <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> object representation has a minimum of type
12195 bits in the object pointer, namely, 2 bits. They allow to distinguish
12196 <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s (which have some more type bits), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es (which
12197 have no type bits in the heap, since they occupy just two words in the
12198 heap, with no header), other heap objects (many, from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>s
12199 to <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>s), and <span class="type">Subr</span>s. Most object types are
12200 distinguished by looking a the <em class="structfield"><code>rectype</code></em> field
12201 in the header of the heap object.</p><p>The <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> object representation has about two dozen of types
12202 encoded in 6 or 7 bits in the object pointer.
12203 Typically these are the upper 8 bits of a word (on a 32-bit machine) or
12204 the upper 16 bits or 32 bits of a word (on a 64-bit machine).
12205 The particular values of the typecodes allow many common operations to
12206 be performed with a single bit test (e.g. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_consp.html" target="_top"><code class="function">CONSP</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_minuspcm_plusp.html" target="_top"><code class="function">MINUSP</code></a> for a
12207 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> are bit tests) or range check.
12208 However, the <em class="structfield"><code>rectype</code></em> field still exists for
12209 many types, because there are many built-in types which do not need a
12210 particularly fast type test.</p><p>Which object representation is chosen is decided at build time
12211 depending on the available preprocessor definitions. You can define
12212 <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> or <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> to force one or the other.</p><p>One might expect that <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> is faster than <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a>
12213 because it does not need to make as many memory accesses. This effect
12214 is, however, hardly measurable in practice (certainly not more than 5%
12215 faster). Apparently because, first, the situations where the type of an
12216 object is requested but then the object is not looked into are rare.
12217 It is much more common to look into an object, regardless of its type.
12218 Second, due to the existence of data caches in the CPU, accessing a heap
12219 location twice, once for the type test and then immediately afterwards
12220 for the data, is not significantly slower than just accessing the
12221 data.</p><p><a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> is problematic on 32-bit machines, when you want to
12222 use more than 16 MB of memory, because the type bits (at bit 31..24)
12223 interfere with the bits of a heap address. For this reason,
12224 <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> is the default on 32-bit platforms.</p><p><a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> is problematic on platforms whose object alignment
12225 is less than 4. This affects only the mc680x0 CPU; however, here the
12226 alignment can usually be guaranteed through some <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="memory-models"></a>35.4. Memory Models</h2></div></div></div><p>There are 6 memory models. Which one is used, depends on the
12227 operating system and is determined at build time.</p><div class="variablelist"><p class="title"><strong>Memory Models</strong></p><dl class="variablelist"><dt><span class="term">SPVW_MIXED_BLOCKS_OPPOSITE</span></dt><dd><p>The heap consists of one block of fixed length
12228 (allocated at startup).
12229 The variable-length objects are allocated from the left, the 2-pointer
12230 objects are allocated from the right.
12231 There is a hole between them.
12232 When the hole shrinks to 0, <a href="impnotes.html#gc" class="olink">garbage-collect</a> is invoked.
12233 <a href="impnotes.html#gc" class="olink">garbage-collect</a> slides the variable-length objects to the left and concentrates
12234 the 2-pointer objects at the right end of the block again.
12235 When no more room is available, some reserve area beyond the right end
12236 of the block is halved, and the 2-pointer objects are moved to the
12237 right accordingly.
12238 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Simple management.
12239 </td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
12240 </td></tr><tr><td><p><span class="term">(-)</span></p></td><td>The total heap size is limited.
12241 </td></tr></tbody></table></div><p>
12242 </p></dd><dt><span class="term">SPVW_MIXED_BLOCKS_OPPOSITE &amp; TRIVIALMAP_MEMORY</span></dt><dd><p>The heap consists of two big blocks, one for
12243 variable-length objects and one for 2-pointer objects.
12244 The former one has a hole to the right and is extensible to the right,
12245 the latter one has a hole to the left and is extensible to the left.
12246 Similar to the previous model, except that the hole is unmapped.
12247 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
12248 application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
12249 </td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only when SINGLEMAP_MEMORY is
12250 possible as well.</td></tr></tbody></table></div><p>
12251 </p></dd><dt><span class="term">SPVW_MIXED_BLOCKS_STAGGERED &amp; TRIVIALMAP_MEMORY</span></dt><dd><p>The heap consists of two big blocks, one for
12252 variable-length objects and one for 2-pointer objects.
12253 Both have a hole to the right, but are extensible to the right.
12254 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
12255 application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
12256 </td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only when SINGLEMAP_MEMORY is
12257 possible as well.</td></tr></tbody></table></div><p>
12258 </p></dd><dt><span class="term">SPVW_MIXED_PAGES</span></dt><dd><p>The heap consists of many small pages (usually around 8 KB).
12259 There are two kinds of pages: one for 2-pointer objects, one for
12260 variable-length objects.
12261 The set of all pages of a fixed kind is called a "Heap".
12262 Each page has its hole (free space) at its end.
12263 For every heap, the pages are kept sorted according to the size of
12264 their hole, using AVL trees.
12265 The <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is invoked when the used space has grown by 25% since the
12266 last GC; until that point new pages are allocated from the OS.
12267 The GC compacts the data in each page separately:
12268 data is moved to the left. Emptied pages are given back to the OS.
12269 If the holes then make up more than 25% of the occupied storage, a
12270 second GC turn moves objects across pages, from nearly empty ones to
12271 nearly full ones, with the aim to free as many pages as possible.
12272 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(-)</span></p></td><td>Every allocation requires AVL tree operations,
12273 thus slower</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
12274 application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Works on operating systems which do not provide
12275 large contiguous areas.</td></tr></tbody></table></div><p>
12276 </p></dd><dt><span class="term">SPVW_PURE_PAGES</span></dt><dd><p>Just like SPVW_MIXED_PAGES, except that every page
12277 contains data of only a single type tag, i.e. there is a Heap for
12278 every type tag.
12279 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(-)</span></p></td><td>Every allocation requires AVL tree operations,
12280 thus slower</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
12281 application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Works on operating systems which do not provide
12282 large contiguous areas.</td></tr><tr><td><p><span class="term">(-)</span></p></td><td>More fragmentation because objects of different
12283 type never fit into the same page.</td></tr></tbody></table></div></dd><dt><span class="term">SPVW_PURE_BLOCKS</span></dt><dd><p>There is a big block of storage for each type tag.
12284 Each of these blocks has its data to the left and the hole to the
12285 right, but these blocks are extensible to the right (because there is
12286 enough room between them).
12287 A <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered when the allocation amount since the
12288 last GC reaches 50% of the amount of used space at the last GC, but at
12289 least 512 KB.
12290 The <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion cleans up each block separately: data is moved left.
12291 </p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
12292 application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No 16 MB total size limit.
12293 </td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only in combination with SINGLEMAP_MEMORY.
12294 </td></tr></tbody></table></div><p>
12295 </p></dd></dl></div><p>In page based memory models, an object larger than a page is the
12296 only object carried by its pages.
12297 There are no small objects in pages belonging to a big object.</p><p>The following combinations of memory model and
12298 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html"><code class="function">mmap</code></a> tricks are possible (the number
12299 indicates the order in which the respective models have been
12300 developed):</p><div class="table"><a id="mem-models-comb-typecodes"></a><p class="title"><strong>Table 35.1. Memory models with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a></strong></p><div class="table-contents"><table class="table" summary="Memory models with TYPECODES" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center"><a class="xref" href="#MMC-A">A</a></th><th align="center"><a class="xref" href="#MMC-B">B</a></th><th align="center"><a class="xref" href="#MMC-C">C</a></th><th align="center"><a class="xref" href="#MMC-D">D</a></th></tr></thead><tbody><tr><td align="center">SPVW_MIXED_BLOCKS_OPPOSITE</td><td align="center">1</td><td align="center">9</td><td align="center"> </td><td align="center">8</td></tr><tr><td align="center">SPVW_MIXED_BLOCKS_STAGGERED</td><td align="center"> </td><td align="center">6</td><td align="center"> </td><td align="center">7</td></tr><tr><td align="center">SPVW_PURE_BLOCKS</td><td align="center"> </td><td align="center"> </td><td align="center">4</td><td align="center">5</td></tr><tr><td align="center">SPVW_MIXED_PAGES</td><td align="center">2</td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">SPVW_PURE_PAGES</td><td align="center">3</td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="mem-models-comb-heapcodes"></a><p class="title"><strong>Table 35.2. Memory models with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a></strong></p><div class="table-contents"><table class="table" summary="Memory models with HEAPCODES" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center"><a class="xref" href="#MMC-A">A</a></th><th align="center"><a class="xref" href="#MMC-B">B</a></th><th align="center"><a class="xref" href="#MMC-D">D</a></th></tr></thead><tbody><tr><td align="center">SPVW_MIXED_BLOCKS_OPPOSITE</td><td align="center">*</td><td align="center">*</td><td align="center">*</td></tr><tr><td align="center">SPVW_MIXED_BLOCKS_STAGGERED</td><td align="center"> </td><td align="center">*</td><td align="center">*</td></tr><tr><td align="center">SPVW_MIXED_PAGES</td><td align="center">*</td><td align="center"> </td><td align="center"> </td></tr></tbody></table></div></div><br class="table-break" /><div class="orderedlist"><p class="title"><strong>Legend to
12301 <a class="xref" href="#mem-models-comb-typecodes" title="Table 35.1. Memory models with TYPECODES">Table 35.1, “Memory models with <span class="strong"><strong><code class="option">TYPECODES</code></strong></span>”</a> and
12302 <a class="xref" href="#mem-models-comb-heapcodes" title="Table 35.2. Memory models with HEAPCODES">Table 35.2, “Memory models with <span class="strong"><strong><code class="option">HEAPCODES</code></strong></span>”</a></strong></p><ol class="orderedlist" type="A"><li class="listitem"><a id="MMC-A"></a>no MAP_MEMORY</li><li class="listitem"><a id="MMC-B"></a>TRIVIALMAP_MEMORY</li><li class="listitem"><a id="MMC-C"></a>SINGLEMAP_MEMORY</li><li class="listitem"><a id="MMC-D"></a>GENERATIONAL_GC</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gc-safety"></a>35.5. The burden of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion upon the rest of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-moves-data"></a>35.5.1. Lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> invalidation</h3></div></div></div><p>Every subroutine marked with <span class="quote">“<span class="quote">can trigger GC</span>”</span>
12303 or <code class="literal">maygc</code> may invoke <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
12304 The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or moves all the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> non-<a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s and updates the pointers.
12305 But the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or looks only at the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and not in the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
12306 variables. (Anything else would not be portable.)
12307 Therefore at every "unsafe" point, i.e. every call to such a subroutine,
12308 all the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variables of type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>
12309 <span class="strong"><strong>MUST BE ASSUMED TO BECOME GARBAGE</strong></span>.
12310 (Except for <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s that are known to be unmovable,
12311 e.g. <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s or <span class="type">Subr</span>s.)
12312 Pointers inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data (e.g. to the characters of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
12313 or to the elements of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>) become
12314 <span class="strong"><strong>INVALID</strong></span> as well.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-lisp-in-C"></a>35.5.2. Managing Lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a></h3></div></div></div><p>The workaround is usually to allocate all the needed <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data
12315 first and do the rest of the computation with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variables,
12316 without calling unsafe routines, and without worrying about <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.</p><p>Alternatively, you can save a lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> using
12317 macros <code class="function">pushSTACK()</code> and <code class="function">popSTACK()</code>.
12318 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>One should <span class="strong"><strong>not</strong></span> mix these macros with functions
12319 which modify <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> in one statement because <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> may execute
12320 different parts of the statement out of order.
12321 E.g.,</p><pre class="programlisting">pushSTACK(listof(4));</pre><p>
12322 is <span class="emphasis"><em>illegal</em></span> while
12323 </p><pre class="programlisting">pushSTACK(STACK_0);</pre><p>
12324 is <span class="emphasis"><em>legal</em></span>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-alloccount"></a>35.5.3. Run-time GC-safety checks</h3></div></div></div><p>Run-time GC-safety checking is available when you build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12325 with a C++ compiler, e.g.:
12326 <a id="clisp-config-gxx"></a></p><pre class="screen">
12327 <strong><code class="prompt">$</code></strong> ./configure 'CC=g++' <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> build-g-gxx
12328 </pre><p>
12329 When built like this, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/abort.html"><code class="function">abort</code></a>
12330 when you reference GC-unsafe data after an allocation (which could have
12331 triggered a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion), and <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> will pinpoint the trouble spot.</p><p>Specifically, when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is configured
12332 as <a class="link" href="#clisp-config-gxx">above</a>, there is a
12333 global integer variable <code class="varname">alloccount</code> and the <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>
12334 structure contains an integer <em class="structfield"><code>allocstamp</code></em>
12335 slot. If these two integers are not the same, the <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> is invalid.
12336 By playing with <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>, you should be able to figure out the precise spot
12337 where an allocation increments <code class="varname">alloccount</code>
12338 <span class="strong"><strong>after</strong></span> the object has been retrieved from a GC-visible location.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-mem-prot"></a>35.5.4. Memory protection</h3></div></div></div><p>Generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or uses memory protection, so when passing pointers
12339 into the lisp heap to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions, you may encounter errors
12340 (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a>=<code class="constant">EFAULT</code>) unless you call
12341 <code class="function">handle_fault_range(protection,region_start,region_end)</code>
12342 on the appropriate memory region. See files </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/unixaux.d"><code class="filename">src/unixaux.d</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/win32aux.d"><code class="filename">src/win32aux.d</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/syscalls/calls.c"><code class="filename">modules/syscalls/calls.c</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a></td></tr></table><p> for examples.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="foreign-pointers"></a>35.6. Foreign Pointers</h2></div></div></div><p>Pointers to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions and to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed data can be
12343 hidden in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects of type <span class="type">machine_type</span>;
12344 <a href="impnotes.html#gc" class="olink">garbage-collect</a> will not modify its value.
12345 But one should not dare to assume that a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> stack pointer
12346 or the address of a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function in a shared library satisfies the
12347 same requirements.</p><p>If another pointer is to be viewed as a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object, it is best
12348 to box it, e.g. in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-bit-vector.html" target="_top"><code class="classname">SIMPLE-BIT-VECTOR</code></a> or in an
12349 <span class="type">Fpointer</span> (using <code class="function">allocate_fpointer()</code>.)</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="nextgc-factor"></a>35.7. Forcing or inhibiting Garbage Collections</h2></div></div></div><p>Here are some tips to debug <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion-related problems.</p><p>It is possible to force <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions to occur at specific points, by inserting
12350 calls to <code class="function">EXT:GC</code> in the code.</p><p>It is also possible to make <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions more frequent overall, by use of the
12351 command-line option <code class="option">-nextgc-factor</code>. This option specifies a
12352 factor that gets applied to the amount of space that can be consumed before
12353 the next <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered. If you specify a factor smaller than 1, the
12354 frequency of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions is increased. For example,
12355 <code class="literal"><code class="option">-nextgc-factor</code> 0.001</code> reduces the
12356 "Bytes available until next GC" value displayed by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a> function by a
12357 factor of 1000, and thus makes <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions 1000 times more frequent.</p><p>It is equally possible to make <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions less frequent. To this effect,
12358 you pass to <code class="option">-nextgc-factor</code> a value larger than 1. For example,
12359 <code class="literal"><code class="option">-nextgc-factor</code> 1e9</code> multiplies the
12360 "Bytes available until next GC" value displayed by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a> function with a
12361 factor of 1000000000, and thus effectively inhibits <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions entirely.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gc-mt"></a>35.8. Garbage Collection and Multithreading</h2></div></div></div><p>While the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is executing, all other threads must stop.
12362 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has a copying <a href="impnotes.html#gc" class="olink">garbage-collect</a>or, so anything else would require a write
12363 barrier during the scan phase and a read barrier during the move phase.</p><p><a id="gc-mt-pin"></a><strong>Pinned heap objects. </strong>Heap objects may be <span class="emphasis"><em>pinned</em></span> - they will not
12364 move during <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion. Used when execution is blocked in a
12365 foreign/system call and a pointer into the heap is passed to non-lisp
12366 land. The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or tries to minimize the holes in the heap introduced
12367 by the <span class="emphasis"><em>pinning</em></span> process.
12368 See also the note about system calls in
12369 <a class="xref" href="#clisp-h" title="32.2.7.2. clisp.h">Section 32.2.7.2, “clisp.h”</a>.</p><p><a id="gc-mt-safe-points"></a><strong>Safe points. </strong>The threads may be stopped only at certain safe points.
12370 Currently implemented safe points are:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Any heap allocation (actually before the
12371 allocation itself).</li><li class="listitem">Possibly blocking system call.</li><li class="listitem">Some places that may introduce infinite non-consing
12372 loops.</li></ol></div><p>
12373 Basically any thread that conses or can block in a system call will
12374 not stop the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion from executing. There are still places where infinite
12375 non-consing loop without safe point may be reached (TODO: find and fix)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="extend"></a>Chapter 36. Extending <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Core</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></div><p>You are urged to use <a class="link" href="#modules" title="32.2. External Modules">External
12376 Modules</a> instead of adding built-in functions.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> which allows you
12377 to access <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> libraries in an easy way (including creating
12378 <a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>s dynamically).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="add-fun"></a>36.1. Adding a built-in function</h2></div></div></div><p>In the rare cases when you really need to modify <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12379 internals and add a truly built-in function, you should read the
12380 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> sources for inspiration and enlightenment, choose a file where
12381 your brand-new built-in function should go to, and then ...
12382 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">add the <code class="function">LISPFUN</code>
12383 form and the implementation there</li><li class="listitem">add the <code class="function">LISPFUN</code> header to
12384 file <a class="link" href="#subr-d"><code class="filename">subr.d</code></a></li><li class="listitem">declare the function name in file <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a> in
12385 the appropriate package (probably <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>, if there is no specific
12386 package)</li><li class="listitem">if your function accepts keyword arguments, then you must
12387 make sure that the keyword symbols are declared in <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a>
12388 </li><li class="listitem">see the example in <a class="xref" href="#modprep" title="32.2.7.1. Modprep">Section 32.2.7.1, “Modprep”</a> for
12389 argument passing and returning values</li><li class="listitem">export your function name from the appropriate
12390 package in file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a></li><li class="listitem">when you are done, you should run
12391 <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make check-sources</strong></span></a> in your build directory:
12392 this will check that the definitions (source files) and the declarations
12393 (<a class="link" href="#subr-d"><code class="filename">subr.d</code></a> and <a class="link" href="#fsubr-d"><code class="filename">fsubr.d</code></a>) are in sync.</li></ul></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Be very careful with the <span class="emphasis"><em>GC-unsafe</em></span>
12394 functions! Always remember about <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a>!</p></div><p>These instructions are intentionally terse - you are encouraged to
12395 use <a href="impnotes.html#modules" class="olink">module</a>s and/or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> instead of adding built-ins directly.
12396 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="add-var"></a>36.2. Adding a built-in variable</h2></div></div></div><p>If you must be able to access the Lisp variable in the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
12397 code, follow these steps:
12398 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">declare the variable name
12399 in <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a> in the appropriate package
12400 (probably <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a>, if there is no specific package);
12401 </li><li class="listitem">add a <code class="function">define_variable()</code> call
12402 in function <code class="function">init_symbol_values()</code>
12403 in file <a class="link" href="#spvw-d"><code class="filename">spvw.d</code></a></li><li class="listitem">export your variable name from the appropriate
12404 package in file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="recompile"></a>36.3. Recompilation</h2></div></div></div><p><span class="emphasis"><em>Any</em></span> change that forces <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a> to remake <code class="filename">lisp.run</code>,
12405 will force recompilation of all <code class="filename">#P".lisp"</code> files and
12406 re-dumping of <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a>, which may be time-consuming. This is not
12407 always necessary, depending on what kind of change you introduced.
12408 </p><p>On the other hand, if you change any of the following files:
12409 </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#constobj-d"><code class="filename">constobj.d</code></a></td></tr><tr><td><a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a></td></tr><tr><td><a class="link" href="#fsubr-d"><code class="filename">fsubr.d</code></a></td></tr><tr><td><a class="link" href="#subr-d"><code class="filename">subr.d</code></a></td></tr></table><p>
12410 your <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> will <span class="emphasis"><em>have</em></span> to be re-dumped.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="byte-version"></a>Warning</h3><p>If you change the signature of any
12411 system function mentioned in the <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>* arrays in
12412 file <a class="link" href="#eval-d"><code class="filename">eval.d</code></a>, all the <code class="filename">#P".fas"</code> files will
12413 become obsolete and will need to be recompiled.
12414 You will need to add a note to that effect to the <a class="link" href="#src-news"><code class="filename">src/NEWS</code></a> file
12415 and augment the object <code class="literal">version</code> in file <a class="link" href="#constobj-d"><code class="filename">constobj.d</code></a>.
12416 <span class="emphasis"><em>Please try to avoid this as much as possible</em></span>.
12417 </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="bytecode"></a>Chapter 37. The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> bytecode specification</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dd><dl><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></dd><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="byte-intro"></a>37.1. Introduction</h2></div></div></div><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiler compiles <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> programs into instruction codes
12418 for a virtual processor. This bytecode is optimized for saving space in
12419 the most common cases of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> programs. The main advantages/drawbacks
12420 of this approach, compared to native code compilation, are:
12421 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bytecode compiled programs are a lot smaller than
12422 when compiled to native code. This results in better use of CPU
12423 caches, and in less virtual memory paging. Users perceive this as good
12424 responsiveness.</li><li class="listitem">Maximum execution speed (throughput in tight loops)
12425 is limited.</li><li class="listitem">Since no bytecode instructions are provided for
12426 <span class="quote">“<span class="quote">unsafe</span>”</span> operations (like unchecked array accesses,
12427 or <span class="quote">“<span class="quote">fast</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>), programs run with all safety
12428 checks enabled even when compiled.</li><li class="listitem">Execution speed of a program can easily be
12429 understood by looking at the output of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> function.
12430 A rule of thumb is that every elementary instruction costs 1 time
12431 unit, whereas a function call costs 3 to 4 time units.
12432 </li><li class="listitem">Needing to do no type inference, the compiler is
12433 pretty straightforward and fast. As a consequence, the definition of
12434 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> generic functions, which needs to compile small pieces of
12435 generated code, is not perceived to be slow.</li><li class="listitem">The compiler is independent from the hardware CPU.
12436 Different back-ends, one for each hardware CPU, are not needed. As a
12437 consequence, the compiler is fairly small (and would have been easily
12438 maintainable if it were written in a less kludgey way...), and it is
12439 impossible for the compiler writer to introduce CPU dependent bugs.
12440 </li></ul></div><p>
12441 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="vm"></a>37.2. The virtual machine</h2></div></div></div><p>The bytecode can be thought of as being interpreted by a virtual
12442 processor. The engine which interprets the bytecode (the
12443 <span class="quote">“<span class="quote">implementation of the virtual machine</span>”</span>) is either a
12444 <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function (<code class="function">interpret_bytecode</code> in <a class="link" href="#eval-d"><code class="filename">eval.d</code></a>),
12445 or a just-in-time compiler which translates a function's bytecode into
12446 hardware CPU instructions the first time said function is called,
12447 see <a class="xref" href="#compile-jit" title="3.2.1.1. Just-In-Time Native Compilation">Section 3.2.1.1, “Just-In-Time Native Compilation”</a>.</p><p>The virtual machine is a stack machine with two stacks:
12448 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a></span></dt><dd>a stack for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects and frames
12449 (<span class="quote">“<span class="quote">Lisp stack</span>”</span>).</dd><dt><span class="term"><a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a></span></dt><dd>a stack for other data and pointers
12450 (<span class="quote">“<span class="quote">Program stack</span>”</span>).</dd></dl></div><p>This two-stack architecture permits to save an unlimited number of
12451 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> (needed for handling of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>),
12452 without <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3]. Also, in a world with a compacting no-ambiguous-roots
12453 garbage collector, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> must only hold <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects, and <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> can
12454 hold all the other data belonging to a frame, which would not fit into
12455 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> without tagging/untagging overhead.</p><p>The scope of <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> is only valid for a given function
12456 invocation. Whereas the amount of <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> space needed for executing a
12457 function (excluding other function calls) is unlimited, the amount of
12458 <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> space needed is known a priori, at compile time. When a function
12459 is called, no relation is specified between the caller's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and the
12460 callee's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and between the caller's <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> and the callee's <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>.
12461 The bytecode is designed so that outgoing arguments on the caller's
12462 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> can be shared by the caller's incoming arguments area (on the
12463 callee's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>), but a virtual machine implementation may also copy
12464 outgoing arguments to incoming arguments instead of sharing them.</p><p>The virtual machine has a special data structure,
12465 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>, containing the <span class="quote">“<span class="quote">top of stack</span>”</span>,
12466 specially adapted to <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>:
12467 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a></span></dt><dd>an unsigned integer.
12468 </dd><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a></span></dt><dd>the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a>, a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object.
12469 If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> = 0, this is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_space</code></a></span></dt><dd>all values except the first one, an array of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12470 objects.</dd></dl></div><p>The contents of <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> is short-lived.
12471 It does not survive a function call, not even a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.</p><p>The interpretation of some bytecode instructions depends on a
12472 constant, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>. This is a CPU-dependent number, the value of
12473 <code class="varname">SYSTEM::*JMPBUF-SIZE*</code>. In <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, it is defined as
12474 <code class="literal">ceiling(sizeof(jmp_buf),sizeof(void*))</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="comp-fun"></a>37.3. The structure of compiled functions</h2></div></div></div><p>A compiled function consists of two objects: The function itself,
12475 containing the references to all <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects needed for the bytecode,
12476 and a byte vector containing only immediate data, including the bytecode
12477 proper.</p><p>Typically, the byte vector is about twice as large as the function
12478 vector. The separation thus helps the garbage collector (since the byte
12479 vector does not need to be scanned for pointers).</p><p>A function looks like this
12480 (cf. the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">Cclosure</span>):
12481 </p><div class="variablelist"><dl class="variablelist"><dt><a id="func-name"></a><span class="term">name</span></dt><dd>This is the name of the function, normally a symbol
12482 or a list of the form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>)</code>.
12483 It is used for printing the function and for error messages.
12484 This field is immutable.</dd><dt><a id="func-codevec"></a><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a></span></dt><dd>This is the byte-code vector, a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>.
12485 This field is immutable.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[]</span></dt><dd>The remaining fields in the function object are
12486 references to other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects. These references are immutable,
12487 which is why they are called <span class="quote">“<span class="quote">constants</span>”</span>.
12488 (The referenced <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects can be mutable objects,
12489 such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s, however.)
12490 </dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">The Exception to the Immutability Rule</h3><p>When a generic function's dispatch code is installed, the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a>
12491 and <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a> fields are destructively modified.</p></div><p>Some of the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a> can play special roles.
12492 A function looks like this, in more detail:
12493 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">name</span></dt><dd>see <a class="xref" href="#func-name">name</a>.
12494 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a></span></dt><dd>see <a class="xref" href="#func-codevec"><code class="literal">codevec</code></a>.
12495 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>*</span></dt><dd>At most one object, representing the closed-up
12496 variables, representing the variables of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in
12497 which this function was defined. It is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>, which
12498 looks like this: <span class="data"><code class="literal">#(<em class="replaceable"><code>next</code></em>
12499 <em class="replaceable"><code>value<sub>1</sub></code></em> ...
12500 <em class="replaceable"><code>value<sub>n</sub></code></em>)</code></span>
12501 where <em class="replaceable"><code>value<sub>1</sub></code></em>, ...,
12502 <em class="replaceable"><code>value<sub>n</sub></code></em>
12503 are the values of the closed-up variables,
12504 and <em class="replaceable"><code>next</code></em> is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> having the same
12505 structure.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>*</span></dt><dd>Objects representing closed-up <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> tags,
12506 representing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> tags of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in which
12507 this function was defined. Each is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> containing in the
12508 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> part: either a frame pointer to the block frame, or <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span>.
12509 The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is the block's name, for error messages only.
12510 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a>*</span></dt><dd>Objects representing closed-up <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags,
12511 representing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in which
12512 this function was defined. Each is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> containing in the
12513 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> part: either a frame pointer to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, or
12514 <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span> if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> has already been left. The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is a
12515 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> containing the names of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags,
12516 for error messages only.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a>*</span></dt><dd>If the function was defined with a <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>
12517 containing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>, here come the symbols ("keywords"), in their
12518 correct order. They are used by the interpreter during function call.
12519 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">other-const</code></a>*</span></dt><dd>Other objects needed by the function's bytecode.
12520 </dd></dl></div><p>
12521 </p><p>If <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a> are all absent,
12522 the function is called <span class="emphasis"><em>autonomous</em></span>.
12523 This is the case if the function does not refer to lexical variables,
12524 blocks or tags defined in compile code outside of the function.
12525 In particular, it is the case if the function is defined in a null
12526 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><p>If some <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, or <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a> are
12527 present, the function (a <span class="quote">“<span class="quote">closure</span>”</span>) is created at runtime.
12528 The compiler only generates a prototype, containing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> values
12529 instead of each <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a>.
12530 At runtime, a function is created by copying this prototype and
12531 replacing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> values by the definitive ones.</p><p>The list <span class="data"><code class="literal">(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a>*
12532 <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">other-const</code></a>*)</code></span> normally does not contain duplicates, because
12533 the compiler removes duplicates when possible. (Duplicates can occur
12534 nevertheless, through the use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_load-time-value.html" target="_top"><code class="function">LOAD-TIME-VALUE</code></a>.)</p><p>The <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a> looks like this
12535 (cf. the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">Codevec</span>):
12536 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">spdepth_1</code> (2 bytes)</span></dt><dd>The 1st part of the maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth.
12537 </dd><dt><span class="term"><code class="literal">spdepth_jmpbufsize</code> (2 bytes)</span></dt><dd>The <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> part of the maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth.
12538 The maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth (precomputed by the compiler) is given by
12539 <code class="literal">spdepth_1 + spdepth_jmpbufsize * <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a></code>.
12540 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> (2 bytes)</span></dt><dd>Number of required parameters.
12541 </dd><dt><span class="term"><code class="literal">numopt</code> (2 bytes)</span></dt><dd>Number of optional parameters.
12542 </dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a> (1 byte)</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">bit 0</span></dt><dd>set if the function has the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> parameter
12543 </dd><dt><span class="term">bit 7</span></dt><dd>set if the function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> parameters
12544 </dd><dt><span class="term">bit 6</span></dt><dd>set if the function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;ALLOW-OTHER-KEYS</code></a>
12545 </dd><dt><span class="term">bit 4</span></dt><dd>set if the function is a generic function
12546 </dd><dt><span class="term">bit 3</span></dt><dd>set if the function is a generic function and its
12547 effective method shall be returned (instead of being executed)
12548 </dd><dt><span class="term">bit 2</span></dt><dd>set if the full original <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is kept in the
12549 closure object, see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>
12550 </dd><dt><span class="term">bit 1</span></dt><dd>set if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
12551 is kept in the closure object, see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>
12552 </dd></dl></div></dd><dt><span class="term"><code class="literal">signature</code> (1 byte)</span></dt><dd>An abbreviation code depending on
12553 <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>, <code class="literal">numopt</code>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a>.
12554 It is used for speeding up the function
12555 call.</dd><dt><span class="term"><code class="literal">numkey</code> (2 bytes, only if the
12556 function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>)</span></dt><dd>The number of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> parameters.
12557 </dd><dt><span class="term"><code class="literal">keyconsts</code> (2 bytes, only if the
12558 function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>)</span></dt><dd>The offset of the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a> in the function.
12559 </dd><dt><span class="term"><code class="literal">byte</code>* (any number of bytes)</span></dt><dd>The bytecode instructions.
12560 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="instr-struct"></a>37.4. The general structure of the instructions</h2></div></div></div><p>All instructions consist of one byte, denoting the opcode, and
12561 some number of operands.</p><p>The conversion from a byte (in the range 0..255) to the opcode is
12562 performed by lookup in the table contained in the file <a class="link" href="#bytecode-d"><code class="filename">bytecode.d</code></a>.</p><p>There are the following types of operands, denoted by different
12563 letters:
12564 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>k</code></em>, <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>m</code></em>, <em class="replaceable"><code>l</code></em></span></dt><dd>A (nonnegative) numeric operand.
12565 The next byte is read.
12566 If its bit 7 is zero, then the bits 6..0 give the value (7 bits).
12567 If its bit 7 is one, then the bits 6..0 and the subsequent byte
12568 together form the value (15 bits).
12569 </dd><dt><span class="term"><em class="replaceable"><code>b</code></em></span></dt><dd>A (nonnegative) 1-byte operand.
12570 The next byte is read and is the value.
12571 </dd><dt><span class="term"><em class="replaceable"><code>label</code></em></span></dt><dd>A label operand.
12572 A signed numeric operand is read: The next byte is read.
12573 If its bit 7 is zero, then the bits 6..0 give the value
12574 (7 bits, sign-extended).
12575 If its bit 7 is one, then the bits 6..0 and the subsequent byte
12576 together form the value (15 bits, sign-extended).
12577 If the latter 15-bit result is zero, then four more bytes are read
12578 and put together (32 bits, sign-extended).
12579 Finally, the bytecode pointer for the target is computed as the
12580 current bytecode pointer (pointing after the operand just read), plus
12581 the signed numeric operand.
12582 </dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="instr-set"></a>37.5. The instruction set</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-const"></a>37.5.1. Instructions for constants</h3></div></div></div><div class="informaltable"><a id="instr-const-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(PUSH-NIL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Push <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>s into the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
12583 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load the function's <em class="replaceable"><code>n</code></em>th constant into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>],
12584 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-lex-var"></a>37.5.2. Instructions for lexical variables</h3></div></div></div><div class="informaltable"><a id="instr-lex-var-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load a directly accessible local variable into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),
12585 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load an indirectly accessible local variable into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12586 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+ <em class="replaceable"><code>n</code></em>),
12587 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in the same function and
12588 directly accessible, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>),
12589 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in an outer function,
12590 into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>v</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>,
12591 <em class="replaceable"><code>m</code></em> times do: <em class="replaceable"><code>v</code></em> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0),
12592 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,<em class="replaceable"><code>m</code></em>),
12593 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADIC <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in the same function and
12594 indirectly accessible, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12595 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>),
12596 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into a directly accessible local variable.</td><td align="center">*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12597 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into an indirectly accessible local variable.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12598 *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+ <em class="replaceable"><code>n</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12599 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in the same
12600 function and directly accessible.</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),1+m) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12601 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in an outer
12602 function.</td><td align="center"><em class="replaceable"><code>v</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>,
12603 <em class="replaceable"><code>m</code></em> times do: <em class="replaceable"><code>v</code></em> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0),
12604 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,<em class="replaceable"><code>m</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12605 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREIC <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in the same
12606 function and indirectly accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12607 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12608 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-dyn-var"></a>37.5.3. Instructions for dynamic variables</h3></div></div></div><div class="informaltable"><a id="instr-dyn-var-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(GETVALUE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load a symbol's value into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := symbol-value(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]),
12609 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SETVALUE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into a symbol's value.</td><td align="center">symbol-value(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12610 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BIND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Bind a symbol dynamically.</td><td align="center">Bind the value of the symbol
12611 <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] to <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12612 implicitly <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3,
12613 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBIND1)</code></span></td><td align="center">Dissolve one binding frame.</td><td align="center">Unbind the binding frame <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> is pointing to,
12614 implicitly <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBIND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Dissolve <em class="replaceable"><code>n</code></em> binding frames.</td><td align="center"><em class="replaceable"><code>n</code></em> times do:
12615 Unbind the binding frame <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> is pointing to, thereby
12616 incrementing <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12617 Thus, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 1+2*<em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(PROGV)</code></span></td><td align="center">Bind a set of symbols dynamically to a set of values.</td><td align="center"><em class="replaceable"><code>symbols</code></em> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,
12618 *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12619 build a single binding frame binding the symbols in
12620 <em class="replaceable"><code>symbols</code></em> to the values in <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12621 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-stack"></a>37.5.4. Instructions for stack operations</h3></div></div></div><div class="informaltable"><a id="instr-stack-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(PUSH)</code></span></td><td align="center">Push one object onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12622 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(POP)</code></span></td><td align="center">Pop one object from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIP <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> pointer.
12623 Remove <em class="replaceable"><code>n</code></em> objects from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> + <em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIPI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> pointer. Remove an unknown
12624 number of objects from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12625 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>),
12626 <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>+1,
12627 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> + <em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIPSP <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> pointer.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12628 <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-jump"></a>37.5.5. Instructions for control flow, jumps</h3></div></div></div><div class="informaltable"><a id="instr-jump-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(SKIP&amp;RET <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Clean up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and return from the function.</td><td align="center"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>,
12629 return from the function, returning values.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIP&amp;RETGF <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Clean up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and return from the generic
12630 function.</td><td align="center">If bit 3 is set in the function's <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a>,
12631 then <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1,
12632 and return from the function.
12633 Otherwise: if the current function has no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> argument,
12634 then <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>,
12635 apply <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> to the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> arguments
12636 still on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and
12637 return from the function.
12638 Else <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>-1,
12639 apply <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> to the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> arguments and the
12640 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a> argument, all still on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and
12641 return from the function.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMP <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>.</td><td align="center">PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is true.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is false.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIF1 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em> and forget secondary values,
12642 if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is true.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
12643 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOT1 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em> and forget secondary values,
12644 if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is false.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
12645 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFATOM <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not a cons.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not a cons, PC := <em class="replaceable"><code>label</code></em>.
12646 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFCONSP <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is a cons.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is a cons, PC := <em class="replaceable"><code>label</code></em>.
12647 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFEQ <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the top-of-stack.</td><td align="center">If eq(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++), PC := <em class="replaceable"><code>label</code></em>.
12648 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOTEQ <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>
12649 to the top-of-stack.</td><td align="center">If not eq(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++), PC := <em class="replaceable"><code>label</code></em>.
12650 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFEQTO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>,
12651 if the top-of-stack is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to a constant.</td><td align="center">If eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]), PC := <em class="replaceable"><code>label</code></em>.
12652 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOTEQTO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if the top-of-stack is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>
12653 to a constant.</td><td align="center">If not eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]), PC := <em class="replaceable"><code>label</code></em>.
12654 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPHASH <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Table-driven jump, depending on <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td><td align="center">Lookup <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> in the hash table <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
12655 (The hash table's test is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>.)
12656 If found, the hash table value is a signed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>,
12657 jump to it: PC := PC + value. Else jump to <em class="replaceable"><code>label</code></em>.
12658 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPHASHV <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Table-driven jump, depending on <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
12659 inside a generic function.</td><td align="center">Lookup <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> in the hash table <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[0],<em class="replaceable"><code>n</code></em>).
12660 (The hash table's test is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>.)
12661 If found, the hash table value is a signed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>,
12662 jump to it: PC := PC + value. Else jump to <em class="replaceable"><code>label</code></em>.
12663 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Subroutine call.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := function. Then start interpreting the
12664 bytecode at <em class="replaceable"><code>label</code></em>, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> undefined.
12665 When a <span class="byte"><code class="literal">(RET)</code></span> is encountered,
12666 program execution is resumed at the instruction after
12667 <span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>)</code></span>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPTAIL <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>
12668 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Tail subroutine call.</td><td align="center"><em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">&gt;=</code></a> <em class="replaceable"><code>m</code></em>.
12669 The <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> frame of size <em class="replaceable"><code>n</code></em> is reduced to size <em class="replaceable"><code>m</code></em>:
12670 {*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<em class="replaceable"><code>m</code></em>), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1)} :=
12671 {*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>m</code></em>-1)}.
12672 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += n-m.
12673 *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := function.
12674 Then jump to <em class="replaceable"><code>label</code></em>, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> undefined.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-env"></a>37.5.6. Instructions for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>,
12675 creation of closures</h3></div></div></div><div class="informaltable"><a id="instr-env-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(VENV)</code></span></td><td align="center">Load the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[0], <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MAKE-VECTOR1&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> used for closed-up variables.</td><td align="center"><em class="replaceable"><code>v</code></em> := new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> of size <em class="replaceable"><code>n</code></em>+1.
12676 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
12677 *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <em class="replaceable"><code>v</code></em>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a closure by copying the prototype and filling in
12678 the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</td><td align="center"><em class="replaceable"><code>f</code></em> := copy-function(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>]).
12679 For <em class="replaceable"><code>i</code></em>=0,..,<em class="replaceable"><code>n</code></em>-1:
12680 <em class="replaceable"><code>f</code></em>_<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[i] := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1-<em class="replaceable"><code>i</code></em>).
12681 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.
12682 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <em class="replaceable"><code>f</code></em>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-funcall"></a>37.5.7. Instructions for function calls</h3></div></div></div><div class="informaltable"><a id="instr-funcall-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(CALL <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with <em class="replaceable"><code>k</code></em> arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called
12683 with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>k</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
12684 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>k</code></em>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL0 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 0 arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called with 0 arguments.
12685 The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 1 argument.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called with one argument *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
12686 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 2 arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called
12687 with two arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+1) and *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
12688 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>[<em class="replaceable"><code>b</code></em>].
12689 The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12690 (including <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> or
12691 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> parameters).
12692 The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>[256+<em class="replaceable"><code>b</code></em>].
12693 The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12694 (including <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a> or
12695 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> parameters).
12696 The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>R[<em class="replaceable"><code>b</code></em>].
12697 The minimum number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12698 and <em class="replaceable"><code>m</code></em> additional arguments as well.
12699 The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLC)</code></span></td><td align="center">Calls a computed compiled function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>s.</td><td align="center">Calls the compiled function <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
12700 The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12701 (including <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
12702 parameters).
12703 The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLCKEY)</code></span></td><td align="center">Calls a computed compiled function with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a>s.</td><td align="center">Calls the compiled function <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
12704 The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12705 (including <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;OPTIONAL</code></a>
12706 or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&amp;KEY</code></a> parameters).
12707 The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a computed function.</td><td align="center">Calls the function *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>)
12708 with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
12709 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>+1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a computed function with an unknown number of arguments.</td><td align="center">Calls the function *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>)
12710 with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)
12711 and a list of additional arguments <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
12712 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>+1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-optkey"></a>37.5.8. Instructions for optional
12713 and keyword parameters</h3></div></div></div><div class="informaltable"><a id="instr-optkey-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(PUSH-UNBOUND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Push <em class="replaceable"><code>n</code></em> <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>s into the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>.
12714 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNLIST <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Destructure a proper <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</td><td align="center">0 ≤ <em class="replaceable"><code>m</code></em> ≤ <em class="replaceable"><code>n</code></em>.
12715 <em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12716 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>).
12717 During the last <em class="replaceable"><code>m</code></em> iterations, the list <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>
12718 may already have reached its end;
12719 in this case, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>.
12720 At the end, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> must be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
12721 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNLIST* <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Destructure a proper or dotted <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</td><td align="center">0 ≤ <em class="replaceable"><code>m</code></em> ≤ <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>n</code></em> &gt; 0.
12722 <em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12723 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>).
12724 During the last <em class="replaceable"><code>m</code></em> iterations, the list <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>
12725 may already have reached its end;
12726 in this case, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>.
12727 At the end, after <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>s, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
12728 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFBOUNDP <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if a local variable is not unbound.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is not <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>,
12729 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.
12730 Else: Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>..</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BOUNDP <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>, depending on whether a local
12731 variable is bound.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is not <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>,
12732 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.
12733 Else: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBOUND-&gt;NIL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">If a local variable is unbound, assign a default value
12734 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> to it.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is <span class="data"><code class="literal">#&lt;UNBOUND&gt;</code></span>,
12735 *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-mulval"></a>37.5.9. Instructions for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a></h3></div></div></div><div class="informaltable"><a id="instr-mulval-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(VALUES0)</code></span></td><td align="center">Load no values into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 0</td></tr><tr><td align="center"><span class="byte"><code class="literal">(VALUES1)</code></span></td><td align="center">Forget secondary values.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>-TO-MV <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Pop the first <em class="replaceable"><code>n</code></em> objects from <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center">Load values(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)) into
12736 values. <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MV-TO-<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>)</code></span></td><td align="center">Save values on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">Push the <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> values onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12737 (in order: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> comes first).
12738 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(NV-TO-<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Save <em class="replaceable"><code>n</code></em> values on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">Push the first <em class="replaceable"><code>n</code></em> values onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
12739 (in order: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> comes first).
12740 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <em class="replaceable"><code>n</code></em>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MV-TO-LIST)</code></span></td><td align="center">Convert <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> into a list.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := list of values, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST-TO-MV)</code></span></td><td align="center">Convert a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> into <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</td><td align="center">Call the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> as argument.
12741 The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MVCALLP)</code></span></td><td align="center">Start a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_multiple-value-call.html" target="_top"><code class="function">MULTIPLE-VALUE-CALL</code></a> invocation.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MVCALL)</code></span></td><td align="center">Finish a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_multiple-value-call.html" target="_top"><code class="function">MULTIPLE-VALUE-CALL</code></a> invocation.</td><td align="center">newSTACK := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++.
12742 Call the function *(newSTACK-1), passing it
12743 *(newSTACK-2), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0) as arguments.
12744 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := newSTACK. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-block"></a>37.5.10. Instructions for
12745 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_return-from.html" target="_top"><code class="function">RETURN-FROM</code></a></h3></div></div></div><div class="informaltable"><a id="instr-block-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(BLOCK-OPEN <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame.</td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12746 The topmost (third) object in the block frame is
12747 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>],frame-pointer) (its <em class="replaceable"><code>block-cons</code></em>).
12748 Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_return-from.html" target="_top"><code class="function">RETURN-FROM</code></a> to this frame, execution will continue at <em class="replaceable"><code>label</code></em>.
12749 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>..</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BLOCK-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3,
12750 <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>. Mark the <em class="replaceable"><code>block-cons</code></em> as invalid.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(RETURN-FROM <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Leave a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> whose <em class="replaceable"><code>block-cons</code></em> is given.</td><td align="center"><em class="replaceable"><code>block-cons</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
12751 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) = <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
12752 Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) is a frame-pointer.
12753 Unwind the stack up to this frame, pass it values.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(RETURN-FROM-I <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Leave a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> whose <em class="replaceable"><code>block-cons</code></em> is indirectly accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12754 <em class="replaceable"><code>block-cons</code></em> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>).
12755 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) = <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
12756 Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) is a frame-pointer.
12757 Unwind the stack up to this frame, pass it values.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-tagbody"></a>37.5.11. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_go.html" target="_top"><code class="function">GO</code></a></h3></div></div></div><div class="informaltable"><a id="instr-tagbody-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-OPEN <em class="replaceable"><code>m</code></em>
12758 <em class="replaceable"><code>label<sub>1</sub></code></em> ...
12759 <em class="replaceable"><code>label<sub>n</sub></code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame.</td><td align="center">Fetch <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>], this is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> with
12760 <em class="replaceable"><code>n</code></em> elements, then decode <em class="replaceable"><code>n</code></em> label operands.
12761 Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3+<em class="replaceable"><code>n</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12762 The third object in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame is
12763 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>],frame-pointer) (the <em class="replaceable"><code>tagbody-cons</code></em>)
12764 Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_go.html" target="_top"><code class="function">GO</code></a> to tag <em class="replaceable"><code>label</code></em> of this frame, execution
12765 will continue at <em class="replaceable"><code>label<sub>l</sub></code></em>.
12766 Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-CLOSE-NIL)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, and load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12767 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3+<em class="replaceable"><code>m</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12768 Mark the <em class="replaceable"><code>tagbody-cons</code></em> as invalid.
12769 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12770 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3+<em class="replaceable"><code>m</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12771 Mark the <em class="replaceable"><code>tagbody-cons</code></em> as invalid.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(GO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> whose <em class="replaceable"><code>tagbody-cons</code></em> is given.</td><td align="center"><em class="replaceable"><code>tagbody-cons</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
12772 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) = <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
12773 Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) is a frame-pointer. Unwind the stack up
12774 to this frame, pass it the number <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(GO-I <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> whose <em class="replaceable"><code>tagbody-cons</code></em> is indirectly
12775 accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
12776 <em class="replaceable"><code>tagbody-cons</code></em> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>).
12777 If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) = <span class="data"><code class="literal">#&lt;DISABLED&gt;</code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
12778 Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) is a frame-pointer. Unwind the stack up
12779 to this frame, pass it the number <em class="replaceable"><code>label</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-catch"></a>37.5.12. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_throw.html" target="_top"><code class="function">THROW</code></a></h3></div></div></div><div class="informaltable"><a id="instr-catch-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(CATCH-OPEN <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> as tag.
12780 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12781 Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_throw.html" target="_top"><code class="function">THROW</code></a> to this tag execution continues at
12782 <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CATCH-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
12783 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(THROW)</code></span></td><td align="center">Non-local exit to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center"><em class="replaceable"><code>tag</code></em> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++.
12784 Search the innermost <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame with tag
12785 <em class="replaceable"><code>tag</code></em> on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, unwind the
12786 stack up to it, pass it values.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-unwind"></a>37.5.13. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a></h3></div></div></div><div class="informaltable"><a id="instr-unwind-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-OPEN
12787 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame.</td><td align="center">Create an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame.
12788 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12789 When the stack will be unwound by a non-local exit,
12790 values will be saved on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and execution will be
12791 transferred to <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-NORMAL-EXIT)</code></span></td><td align="center">Dissolve an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame, and start the cleanup
12792 code.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
12793 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12794 *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
12795 Save the values on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12796 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-CLOSE)</code></span></td><td align="center">Terminate the cleanup code.</td><td align="center">newSTACK := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++. Load
12797 values(*(newSTACK-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)) into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.
12798 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := newSTACK. SPword1 := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++, SPword2 := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++.
12799 Continue depending on SPword1 and SPword2.
12800 If both are 0, simply continue execution.
12801 If SPword2 is 0 but SPword1 is nonzero, interpret it as a
12802 label and jump to it.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-CLEANUP)</code></span></td><td align="center">Dissolve an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame, and execute the cleanup
12803 code like a subroutine call.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
12804 get <em class="replaceable"><code>label</code></em> out of the frame.
12805 <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
12806 *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := PC, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
12807 Save the values on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>.
12808 PC := <em class="replaceable"><code>label</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-handler"></a>37.5.14. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a></h3></div></div></div><div class="informaltable"><a id="instr-handler-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(HANDLER-OPEN <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a handler frame.</td><td align="center">Create a handler frame, using <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] which
12809 contains the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> types, the corresponding labels and
12810 the current <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth (= function entry <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> - current <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>).
12811 </td></tr><tr><td align="center"><span class="byte"><code class="literal">(HANDLER-BEGIN&amp;PUSH)</code></span></td><td align="center">Start a handler.</td><td align="center">Restore the same <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> state as after the HANDLER-OPEN.
12812 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> that was passed to the handler,
12813 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.
12814 *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-inline"></a>37.5.15. Instructions for some inlined
12815 functions</h3></div></div></div><div class="informaltable"><a id="instr-inline-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(NOT)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := not(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(EQ)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12816 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CAR)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CDR)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONS)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := cons(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12817 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SYMBOL-FUNCTION)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12818 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SVREF)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12819 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SVSET)</code></span></td><td align="center">Inlined call to <code class="function">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a></code>.</td><td align="center"><em class="replaceable"><code>arg1</code></em> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+1),
12820 <em class="replaceable"><code>arg2</code></em> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0), <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2.
12821 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>arg2</code></em>,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>) :=
12822 <em class="replaceable"><code>arg1</code></em>.
12823 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <em class="replaceable"><code>arg1</code></em>,
12824 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)),
12825 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST* <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST*</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST*</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,
12826 *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0),<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
12827 <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-combo"></a>37.5.16. Combined instructions</h3></div></div></div><p>The most frequent short sequences of instructions have an
12828 equivalent combined instruction. They are only present for space and
12829 speed optimization. The only exception is
12830 <span class="byte"><code class="literal">FUNCALL&amp;SKIP&amp;RETGF</code></span>, which is needed for
12831 generic functions.</p><div class="informaltable"><a id="instr-combo-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">equivalent</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(NIL&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(NIL) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(T&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(T) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADI&amp;PUSH <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADC&amp;PUSH <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADV&amp;PUSH <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(POP&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(POP) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(GETVALUE&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(GETVALUE <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(JSR&amp;PUSH <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE&amp;PUSH <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL&amp;PUSH <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&amp;PUSH <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&amp;PUSH <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&amp;PUSH <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLC&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLC) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLCKEY&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLCKEY) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CAR&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CAR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CDR&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CDR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONS&amp;PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONS) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LIST <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST*&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LIST* <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(NIL&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(NIL) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(T&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(T) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;STOREC <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>k</code></em>) (STOREC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&amp;STORE <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&amp;STORE <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&amp;STORE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;CDR&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CDR) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;CONS&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>+1) (CONS) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;INC&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1+) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;DEC&amp;STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1-) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;CAR&amp;STORE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>m</code></em>) (CAR) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&amp;JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&amp;JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&amp;JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&amp;JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&amp;JMPIF <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&amp;JMPIFNOT <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&amp;JMPIF <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&amp;JMPIFNOT <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&amp;JMPIF <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&amp;JMPIFNOT <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;CAR&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CAR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;CDR&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CDR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;INC&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1+) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;DEC&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1-) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&amp;SYMBOL-FUNCTION <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&amp;SYMBOL-FUNCTION&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&amp;SYMBOL-FUNCTION&amp;STORE <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY&amp;SKIP&amp;RET <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>) (SKIP&amp;RET <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL&amp;SKIP&amp;RETGF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>) (SKIP&amp;RETGF <em class="replaceable"><code>k</code></em>)</code></span></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-shortcut"></a>37.5.17. Shortcut instructions</h3></div></div></div><p>There are special one-byte instructions (without explicit
12832 operands) for the following frequent instructions:</p><div class="informaltable"><a id="instr-shortcut-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">operand range</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> &lt; 15</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> &lt; 25</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> &lt; 21</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&amp;PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> &lt; 30</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> &lt; 8</td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compiler-introspection"></a>37.6. Examining compiled closures</h2></div></div></div><p>The functions described here are defined
12833 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a>
12834 and <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/record.d"><code class="filename">src/record.d</code></a>
12835 and can be used to examine the internals of a compiled closure.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>These function are <span class="emphasis"><em>internal</em></span> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12836 functions, their names are <span class="strong"><strong>not</strong></span> exported, this section is
12837 <span class="strong"><strong>not</strong></span> supposed to be comprehensive and is <span class="strong"><strong>not</strong></span> guaranteed to be
12838 up to date. It is intended for aspiring <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> hackers who are
12839 supposed to graduate to reading the sources right away. All others
12840 should stick with the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>.</p></div><p><a id="closure-name"></a><strong>Closure name. </strong>The normal way to extract the name of a closure is
12841 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a>:
12842 </p><pre class="programlisting">
12843 (defun my-plus-1 (x y) (declare (compile)) (+ x y))
12844 ⇒ <code class="computeroutput">MY-PLUS-1</code>
12845 (function-lambda-expression #'my-plus-1)
12846 ⇒ <code class="computeroutput">(LAMBDA (X Y) (DECLARE (COMPILE)) (+ X Y))</code> ;
12847 ⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
12848 ⇒ <code class="computeroutput">MY-PLUS-1</code>
12849 ;; works only on closure objects
12850 (sys::closure-name #'my-plus-1)
12851 ⇒ <code class="computeroutput">MY-PLUS-1</code></pre><p><a id="closure-codevec"></a><strong>Closure bytecode. </strong>The actual bytecode vector (if you modify it, you can get a
12852 segfault when the function is executed):</p><pre class="programlisting">
12853 (sys::closure-codevec #'my-plus-1)
12854 ⇒ <code class="computeroutput">#(0 0 0 0 2 0 0 0 6 3 174 174 51 2 53 25 3)</code></pre><p><a id="closure-consts"></a><strong>Closure constants. </strong>A closure can depend on external and internal values:
12855 </p><pre class="programlisting">
12856 (let ((x 123) (y 456))
12857 (defun my-plus-2 (z) (declare (compile)) (+ x y z)))
12858 ⇒ <code class="computeroutput">MY-PLUS-2</code>
12859 (sys::closure-consts #'my-plus-2)
12860 ⇒ <code class="computeroutput">(#(Y 456 X 123 NIL) 3 1)</code></pre><p>
12861 Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> to see how the constants are used.</p><p><a id="signature"></a><strong>Closure signature. </strong>Function <code class="function">SYS::SIGNATURE</code> returns 8 values:
12862 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">required parameter count</li><li class="listitem">optional parameters count</li><li class="listitem">rest-p</li><li class="listitem">key-p</li><li class="listitem">keyword-p</li><li class="listitem">allow-other-keys-p</li><li class="listitem">byte-list (codevec as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>)</li><li class="listitem">const-list</li></ol></div><p><a id="closure-LAP"></a><strong>Mnemonic bytecodes. </strong>One can convert between numeric and mnemonic bytecodes
12863 (<span class="quote">“<span class="quote">LAP</span>”</span> stands for <span class="quote">“<span class="quote">Lisp Assembly Program</span>”</span>):
12864 </p><pre class="programlisting">
12865 (multiple-value-bind (req-num opt-num rest-p key-p keyword-list
12866 allow-other-keys-p byte-list const-list)
12867 (sys::signature #'my-plus-1)
12868 (sys::disassemble-LAP byte-list const-list))
12869 ⇒ <code class="computeroutput">((0 LOAD&amp;PUSH 2) (1 LOAD&amp;PUSH 2) (2 CALLSR 2 53) (5 SKIP&amp;RET 3))</code>
12870 (sys::assemble-LAP (mapcar #'rest *))
12871 ⇒ <code class="computeroutput">(174 174 51 2 53 25 3)</code></pre><p>
12872 </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bytecode-design"></a>37.7. Bytecode Design</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></div><p>This section offers some insight into bytecode design in the form
12873 of questions and answers.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="byte-when-add-q"></a>37.7.1. When to add a new bytecode?</h3></div></div></div><div class="abstract"><p class="title"><strong>Question:</strong></p><p>Does it make sense to define a new bytecode instruction for
12874 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>? Why? Why not?</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="byte-when-add-a"></a>Answer: Is it speed critical?</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> is a glorified <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> binding
12875 for <code class="varname">SYSTEM::*ACTIVE-RESTARTS*</code> and could well profit
12876 from a separate bytecode: it would make it non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3].
12877 (Remember that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s have dynamic extent and therefore do not
12878 really need to be heap allocated.)</p><p>The reason <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> has its own bytecodes and
12879 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> does not is that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> can occur in inner
12880 computation loops, whereas <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> occurs only as part of
12881 user-interface programming and therefore not in inner loops where its
12882 consing could hurt much.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="byte-jmptail-q"></a>37.7.2. Why <a class="link" href="#instr-jump" title="37.5.5. Instructions for control flow, jumps">JMPTAIL</a>?</h3></div></div></div><div class="abstract"><p class="title"><strong>Question:</strong></p><p>Consider this function and its disassembly:
12883 </p><pre class="programlisting">
12884 (defun foo (x y) (if (or (= x 0) (= y 0)) (+ x y) (foo y (1- x))))
12885 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> 'foo)
12886 8 (LOAD&amp;PUSH 1)
12887 9 (LOAD&amp;DEC&amp;PUSH 3)
12888 11 (JMPTAIL 2 5 L0)</pre><p>
12889 Why are the arguments pushed onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, just to be popped off of
12890 it during the <span class="byte"><code class="literal">JMPTAIL</code></span>?
12891 Why not a sequence of <span class="byte"><code class="literal">LOAD</code></span>,
12892 <span class="byte"><code class="literal">STORE</code></span> and
12893 <span class="byte"><code class="literal">SKIP</code></span> instructions
12894 followed by a <span class="byte"><code class="literal">JMP</code></span>?
12895 </p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="byte-jmptail-a"></a>Answer: This is a shortcut for the most common use</h4></div></div></div><p>Using <span class="byte"><code class="literal">JMPTAIL</code></span> requires 3
12896 instructions, <span class="byte"><code class="literal">JMP</code></span> requires more.
12897 When <span class="byte"><code class="literal">JMPTAIL</code></span> needs to be called, we
12898 usually have some stuff close to the top of the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> which will
12899 become the new arguments, and some junk between these new arguments
12900 and the closure object. <span class="byte"><code class="literal">JMPTAIL</code></span>
12901 removes the junk. <span class="byte"><code class="literal">JMPTAIL</code></span> is a
12902 convenient shortcut which shortens the bytecode - because typically
12903 one would really have to clean-up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> by hand or make the
12904 calculations in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a>
12905 more complicated.</p></div></div></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="appendices"></a>Part V. Appendices</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="appendix"><a href="#faq">A. Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="appendix"><a href="#fdl">B. GNU Free Documentation License</a></span></dt><dt><span class="appendix"><a href="#gpl">C. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></dd></dl></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="faq"></a>Appendix A. Frequently Asked Questions (With Answers)
12906 about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="abstract"><a id="faq-abstract"></a><p class="title"><strong>Abstract</strong></p><p>This is a list of frequently asked questions about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> on the
12907 <a class="link" href="#faq-mailing-lists" title="A.1.1.6.">CLISP mailing lists</a>
12908 and the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.lang.lisp">comp.lang.lisp</a>.
12909 <span class="emphasis"><em>All</em></span> the legitimate technical question are addressed
12910 in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> documentation (<a href="impnotes.html#impnotes-top" class="olink"><span class="command"><strong>CLISP</strong></span> impnotes</a>,
12911 <a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a>, <a href="clisp-link.html#clisp-link" class="olink"><span class="refentrytitle">clisp-link</span>(1)</a>), and for such
12912 questions this list provides a link into the docs.
12913 The frequently asked <a class="link" href="#faq-meta" title="Meta Information">political</a> questions
12914 are answered here in <span class="emphasis"><em>full</em></span> detail (meaning that no
12915 further explanations of the issues could be provided).</p><p>Please submit more questions (and answers!)
12916 to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>.</p></div><div class="qandaset"><h2 class="title"><a id="faq-set"></a>FAQ</h2><dl><dt>A.1. <a href="#faq-meta">Meta Information</a></dt><dd><dl><dt>A.1.1. <a href="#faq-meta-misc">Miscellaneous</a></dt><dd><dl><dt>A.1.1.1. <a href="#faq-fine">What is
12917 “FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
12918 documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
12919 - why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
12920 [ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
12921 ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
12922 is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
12923 report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
12924 do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
12925 debug CLISP?</a></dt></dl></dd><dt>A.1.2. <a href="#faq-menorah">Logo</a></dt><dd><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
12926 is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
12927 political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
12928 the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
12929 promote a political agenda is unprofessional!</a></dt></dl></dd></dl></dd><dt>A.2. <a href="#faq-run">Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></a></dt><dd><dl><dt>A.2.1. <a href="#faq-defun">Why are floats printed in binary?</a></dt><dt>A.2.2. <a href="#faq-ide">Where is the IDE?</a></dt><dt>A.2.3. <a href="#faq-opt">What are the
12930 command line arguments?</a></dt><dt>A.2.4. <a href="#faq-debugger">How
12931 do I get out of the debugger?</a></dt><dt>A.2.5. <a href="#faq-ext">What CLISP
12932 extensions are available?</a></dt><dt>A.2.6. <a href="#faq-rc">Where is the
12933 init (“RC”) file on my platform?</a></dt><dt>A.2.7. <a href="#faq-modules">Where
12934 are the modules with which I built CLISP?</a></dt><dt>A.2.8. <a href="#faq-gui">How do I create
12935 a GUI
12936 for my CLISP program?</a></dt></dl></dd><dt>A.3. <a href="#faq-delivery">Application Delivery</a></dt><dd><dl><dt>A.3.1. <a href="#faq-exec">How do I
12937 create an executable file with all my code in it?</a></dt><dt>A.3.2. <a href="#faq-licensing">When
12938 I deliver my application with CLISP, does it have to be covered by
12939 the GNU GPL?</a></dt></dl></dd><dt>A.4. <a href="#faq-trouble">Troubles</a></dt><dd><dl><dt>A.4.1. <a href="#faq-bin-distrib">Where
12940 is the binary distribution for my platform?</a></dt><dt>A.4.2. <a href="#faq-bin-distrib-prev">But a previous release had a binary
12941 distribution for my platform, why does not the current one?</a></dt><dt>A.4.3. <a href="#faq-build">Why does not
12942 CLISP build on my platform?</a></dt><dt>A.4.4. <a href="#faq-with-prefix">
12943 Why is the --with-libsigsegv-prefix option ignored
12944 by the configure script on my 64-bit machine?</a></dt><dt>A.4.5. <a href="#faq-enc-err">What do charset errors mean?</a></dt><dt>A.4.6. <a href="#faq-rl-tab">What does
12945 this message mean: “Display all 1259
12946 possibilities? (y or n)”</a></dt><dt>A.4.7. <a href="#faq-no-rl">Why does
12947 not command line editing work?</a></dt><dt>A.4.8. <a href="#faq-stack">How do I
12948 avoid stack overflow?</a></dt><dt>A.4.9. <a href="#faq-self-mod">Why does my function return different values on each
12949 invocation and then hangs forever?</a></dt><dt>A.4.10. <a href="#faq-fp">Is floating point arithmetic broken?</a></dt><dt>A.4.11. <a href="#faq-random">Is RANDOM broken?</a></dt><dt>A.4.12. <a href="#faq-pp-newline">Why is an extra line break
12950 inserted by the pretty printer?</a></dt><dt>A.4.13. <a href="#faq-warning">How do I disable this annoying
12951 warning?</a></dt><dt>A.4.14. <a href="#faq-scope">Why does DEFVAR affect previously defined lexical closures?</a></dt><dt>A.4.15. <a href="#faq-bad-error">The error message is not helpful!</a></dt><dt>A.4.16. <a href="#faq-other-problem">Why is the function FOO
12952 broken?!</a></dt></dl></dd></dl><table border="0" style="width: 100%;"><colgroup><col align="left" width="1%" /><col /></colgroup><tbody><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-meta"></a>A.1. Meta Information</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.1. <a href="#faq-meta-misc">Miscellaneous</a></dt><dd><dl><dt>A.1.1.1. <a href="#faq-fine">What is
12953 “FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
12954 documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
12955 - why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
12956 [ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
12957 ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
12958 is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
12959 report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
12960 do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
12961 debug CLISP?</a></dt></dl></dd><dt>A.1.2. <a href="#faq-menorah">Logo</a></dt><dd><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
12962 is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
12963 political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
12964 the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
12965 promote a political agenda is unprofessional!</a></dt></dl></dd></dl></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h4 class="title"><a id="faq-meta-misc"></a>A.1.1. Miscellaneous</h4></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.1.1. <a href="#faq-fine">What is
12966 “FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
12967 documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
12968 - why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
12969 [ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
12970 ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
12971 is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
12972 report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
12973 do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
12974 debug CLISP?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-fine"></a><a id="faq-fine-q"></a><p><strong>A.1.1.1.</strong></p></td><td align="left" valign="top"><p>What is
12975 <span class="quote">“<span class="quote">FAQ fine</span>”</span>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>We levy a fine of 10 zorkmids for
12976 <a class="link" href="#faq-help" title="A.1.1.5.">asking a question</a> that is answered
12977 with a link to this <a class="link" href="#faq" title="Appendix A. Frequently Asked Questions (With Answers) about CLISP">FAQ</a> document.
12978 We further levy a fine of 1 zorkmid for asking a question that is answered
12979 with a link to the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#impnotes-top" title="Implementation Notes for GNU CLISP">manual</a>.
12980 The fines are payable to the person who answered the questions.
12981 The definition of a <span class="quote">“<span class="quote">zorkmid</span>”</span> is left to the sole
12982 discretion of the <span class="emphasis"><em>payer</em></span>.</p><p>This should <span class="strong"><strong>not</strong></span> discourage you from asking questions, but
12983 rather <span class="strong"><strong>encourage</strong></span> you to
12984 <span class="strong"><strong>read</strong></span> the manual and
12985 <span class="strong"><strong>answer</strong></span> questions from other users.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-doc"></a><a id="faq-doc-q"></a><p><strong>A.1.1.2.</strong></p></td><td align="left" valign="top"><p>The official <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
12986 documentation sucks - is anything better available?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>As with all generic complaints, the answer to this one is
12987 <a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top"><acronym class="acronym" title="Patches Thoughtfully Considered">PTC</acronym></a>.</p><p>Additionally, the nightly builds of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation
12988 notes documenting the current <a class="ulink" href="https://git-scm.com/" target="_top">Git</a> <code class="literal">default</code> branch
12989 are available at <a class="ulink" href="http://clisp.org/beta/impnotes/" target="_top">http://clisp.org/beta/impnotes/</a>.
12990 It contains both the documentation for the new features and the
12991 general improvements in the documentation.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-gpl"></a><a id="faq-gpl-q"></a><p><strong>A.1.1.3.</strong></p></td><td align="left" valign="top"><p>License
12992 - why <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/doc/Why-CLISP-is-under-GPL">Because
12993 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a></a>.</p><p>Note that this does <span class="strong"><strong>not</strong></span> necessarily prevent you from distributing
12994 your proprietary products based on <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. See <span class="emphasis"><em>Note</em></span>
12995 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/COPYRIGHT"><code class="filename">COPYRIGHT</code></a> and
12996 <a class="xref" href="#faq-licensing" title="A.3.2.">Q: A.3.2</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ansi"></a><a id="faq-ansi-q"></a><p><strong>A.1.1.4.</strong></p></td><td align="left" valign="top"><p>What about
12997 [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] compliance?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#purports_to_conform"><span class="emphasis"><em>purports to
12998 conform</em></span></a> to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification, so all
12999 deviations in </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code></pre><p>
13000 from the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] are bugs and are not (yet) fixed only due
13001 to lack of resources.</p><p>On the other hand, some decisions made by the ANSI X3J13 committee
13002 were not as justified from the <span class="emphasis"><em>technical</em></span> point of
13003 view as were most of them, and some of those questionable decisions
13004 were made <span class="strong"><strong>after</strong></span> the alternative behavior has already been implemented
13005 in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers took pains to modify <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to
13006 unconditionally comply with the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification in all cases
13007 <a class="link" href="#ansi" title="31.10. Maximum ANSI CL compliance">except for a handful of situations where they
13008 believed that the committee had made a mistake</a>, in which cases
13009 the committee behavior is <span class="emphasis"><em>still</em></span> optionally
13010 available.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not start in the ansi mode by default for
13011 historical reasons and this is not about to change.
13012 <a class="link" href="#image" title="31.2. Saving an Image">Dumping an image</a> or
13013 <a href="clisp.html#opt-ansi" class="olink">passing a command line
13014 argument</a> are easy enough.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-help"></a><a id="faq-help-q"></a><p><strong>A.1.1.5.</strong></p></td><td align="left" valign="top"><p>How do I
13015 ask for help?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p></td><td align="left" valign="top"><p>Type <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> and hit <span class="keycap"><strong>Enter</strong></span>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Human</strong></p></td><td align="left" valign="top"><p>Politely - please refer to <a class="rfc" href="http://www.ietf.org/rfc/rfc1855.txt"><code>Netiquette</code></a>.</p><p>If you have a question about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, you have the following options
13016 (listed in the order of decreasing audience size):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.lang.lisp">comp.lang.lisp</a></span></dt><dd>This is the right place to ask all general Lisp
13017 questions, such as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_charcm_schar.html">"how
13018 do I access a character in a string?"</a></dd><dt><span class="term"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> User Mailing
13019 List <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd><p class="simpara">This is the right place to ask user-level
13020 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific questions, such as <span class="quote">“<span class="quote">"how do I save my <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13021 <a href="impnotes.html#image" class="olink">memory image</a>?"</span>”</span>.</p><p class="simpara">See also <a class="xref" href="#faq-bugs" title="A.1.1.8.">Q: A.1.1.8</a>.</p></dd><dt><span class="term"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Developer Mailing
13022 List <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>This is the right place to discuss <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internals,
13023 problems with the current development sources, submit patches,
13024 offer help.</dd><dt><span class="term"><a class="ulink" href="https://sourceforge.net/p/clisp/_members/" target="_top">Individual <span class="command"><strong>CLISP</strong></span> developers</a></span></dt><dd><p class="simpara">This is <span class="emphasis"><em>never</em></span> the right thing to
13025 do, unless you want to <span class="emphasis"><em>hire</em></span> this developer to do
13026 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> consulting (commercial support, custom enhancements etc).
13027 This is actually for your own benefit: the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers are very
13028 busy, they might get weeks to answer your question,
13029 and some other user may be able to help you in the meantine;
13030 as well as for the benefit of the other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> users,
13031 since the mailing lists are publicly archived (you are encouraged
13032 to <a class="ulink" href="http://clisp.org/#search" target="_top">search</a> them
13033 before asking).</p><p class="simpara">Please do <span class="strong"><strong>not</strong></span> copy your messages to the individual
13034 developers.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Mailing lists are member-only</h3><p>To avoid spam, we require that you subscribe before you can
13035 post to a mailing list.
13036 Alternatively, you can post to the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13037 <a class="ulink" href="https://sourceforge.net/p/clisp/discussion/3816/" target="_top">web
13038 forum</a> and your message will be forwarded to
13039 the <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> mailing list.</p><p>Alternatively, you can ask on
13040 <a class="ulink" href="http://stackoverflow.com/questions/tagged/clisp" target="_top">StackOverflow</a>
13041 with tags <code class="literal">clisp</code> and/or <code class="literal">common-lisp</code>.
13042 </p></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-mailing-lists"></a><a id="faq-mailing-lists-q"></a><p><strong>A.1.1.6.</strong></p></td><td align="left" valign="top"><p>Which mailing lists should I subscribe to?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Cross-posting in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13043 <a class="ulink" href="https://sourceforge.net/p/clisp/mailman/" target="_top">mailing lists</a>
13044 is very actively discouraged and is virtually non-existent,
13045 thus you can subscribe to all mailing lists that are relevant to you
13046 without getting duplicate messages:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a></span></dt><dd>Extremely low-level moderated list, you should
13047 definitely subscribe to this list if you have any interest in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>
13048 or <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> whatsoever.</dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd>Subscribe to this list of you use <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> and want
13049 to ask (and answer!) questions. If you subscribe to this list, you
13050 probably want to subscribe to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a> too.
13051 </dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>Subscribe to this list if you want to influence
13052 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developments; <a class="ulink" href="https://git-scm.com/" target="_top">Git</a> commit notes go here (as a daily digest).
13053 If you subscribe to this list, you probably want to subscribe
13054 to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>
13055 <span class="strong"><strong>and</strong></span> <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a> too.</dd></dl></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rejected"></a><a id="faq-rejected-q"></a><p><strong>A.1.1.7.</strong></p></td><td align="left" valign="top"><p>Why
13056 is my mail to a mailing list rejected?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> mailing lists get a lot of spam, so the
13057 maintainers have to take care to protect the users. If you get a note
13058 that <span class="quote">“<span class="quote">your message is held for moderator's approval</span>”</span>, you
13059 can safely <span class="strong"><strong>assume that it went
13060 to <code class="filename">/dev/null</code></strong></span>
13061 and try again, noting the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a></span></dt><dd>do not mail here without a prior discussion
13062 on <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
13063 or <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>subscriber-only, you <span class="strong"><strong>must</strong></span> post
13064 from a <span class="strong"><strong>subscribed address</strong></span>,
13065 no exceptions (see <a class="link" href="#faq-help" title="A.1.1.5.">above</a>)
13066 </dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd><p>used to be the only open list (it is closed now), so
13067 it is filtered especially aggressively:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">no <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a> mail (no <a class="ulink" href="https://www.w3.org/html/" target="_top">HTML</a> formatting, no
13068 attachments - send the URL instead)</li><li class="listitem">the list address must be in <code class="literal">CC</code>
13069 or <code class="literal">TO</code>, not <code class="literal">BCC</code>.
13070 </li><li class="listitem">do not mention <span class="quote">“<span class="quote">virgin</span>”</span>,
13071 <span class="quote">“<span class="quote">penis</span>”</span> or <span class="quote">“<span class="quote">viagra</span>”</span> in
13072 the <code class="literal">Subject</code> line.</li></ul></div></dd></dl></div><p>If you do not like this policy, please volunteer to maintain the
13073 mailing lists - you will be required to go through all the
13074 <span class="quote">“<span class="quote">held for moderator's approval</span>”</span> mail and approve/discard
13075 as appropriate at least twice a day.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bugs"></a><a id="faq-bugs-q"></a><p><strong>A.1.1.8.</strong></p></td><td align="left" valign="top"><p>How do I
13076 report bugs?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a href="clisp.html#bugs" class="olink">Patiently</a>!
13077 </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-contrib"></a><a id="faq-contrib-q"></a><p><strong>A.1.1.9.</strong></p></td><td align="left" valign="top"><p>How
13078 do I help?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Please read <a class="xref" href="#extend" title="Chapter 36. Extending CLISP Core">Chapter 36, <em>Extending <span class="command"><strong>CLISP</strong></span> Core</em></a> and submit your patch,
13079 together with a <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/ChangeLog"><code class="filename">src/ChangeLog</code></a>
13080 entry (see other entries there for inspiration),
13081 to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a> (if it is small) or
13082 <a class="ulink" href="https://sourceforge.net/p/clisp/patches/" target="_top">SourceForge patch tracker</a>.</p><p>See <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/CodingStyle"><code class="filename">src/CodingStyle</code></a> for the
13083 style one should follow.</p><p>The patch should be created using <a class="ulink" href="https://git-scm.com/" target="_top">Git</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-debug"></a><a id="faq-debug-q"></a><p><strong>A.1.1.10.</strong></p></td><td align="left" valign="top"><p>How do I
13084 debug <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a id="with-debug"></a><strong>Configuring for debugging. </strong>Passing <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> to the top-level <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> script does not
13085 just replace <code class="option">-O</code> with <code class="option">-g</code>
13086 in the <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> invocation, it also disables some optimizations
13087 (registers, assembly, generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or) and enables
13088 some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html"><code class="function">printf</code></a> calls (mostly before error
13089 messages caused by system calls).
13090 This means that some bugs might be exhibited by the normal build but
13091 <span class="strong"><strong>not</strong></span> by the <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> one (and vice versa).
13092 If that is the case, please <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> normally but edit the
13093 <code class="filename">Makefile</code> and replace the <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> optimization
13094 options (<code class="option">-O</code> et al) with <code class="option">-g</code> before
13095 running <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>.</p><p><a id="faq-debug-core"></a><strong>Debugging the core. </strong></p><pre class="screen">
13096 <strong><code class="prompt">$</code></strong> ./configure <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> --cbc build-g
13097 <strong><code class="prompt">$</code></strong> cd build-g
13098 <strong><code class="prompt">$</code></strong> gdb lisp.run <em class="lineannotation"><span class="lineannotation">;; or lisp.exe on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a></span></em>
13099 <strong><code class="prompt">(gdb)</code></strong> boot
13100 <strong><code class="prompt">(gdb)</code></strong> run
13101 </pre><p><a id="faq-debug-module"></a><strong>Debugging
13102 module <code class="literal">foo</code>. </strong></p><pre class="screen">
13103 <strong><code class="prompt">$</code></strong> ./configure <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> --with-module=foo --cbc build-g
13104 <strong><code class="prompt">$</code></strong> cd build-g
13105 <strong><code class="prompt">$</code></strong> gdb full/lisp.run <em class="lineannotation"><span class="lineannotation">;; or lisp.exe on <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="https://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a></span></em>
13106 <strong><code class="prompt">(gdb)</code></strong> full
13107 <strong><code class="prompt">(gdb)</code></strong> run</pre><p>
13108 When debugging a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> module, use <span class="command"><strong>base</strong></span>
13109 instead of <span class="command"><strong>full</strong></span> and <span class="command"><strong>boot</strong></span> above.
13110 </p><p><a id="faq-debug-gengc"></a><strong>The impact of generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or. </strong>If your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built with generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or, you will see
13111 plenty of spurious segfaults (that's how the generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or
13112 works). At the end of <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/.gdbinit"><code class="filename">src/.gdbinit</code></a>
13113 you will find the following suggested <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> commands:
13114 </p><pre class="programlisting">handle SIGSEGV noprint nostop
13115 break sigsegv_handler_failed</pre><p>
13116 which will stop execution on a <span class="emphasis"><em>dangerous</em></span> segfault.
13117 You can find out whether this is needed by examining the output of the
13118 following command:
13119 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> --version | grep GENERATIONAL_GC</pre><p>
13120 </p><p><a id="faq-debug-gdbinit"></a><strong>Useful commands. </strong>You are encouraged to make use of commands defined in
13121 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/.gdbinit"><code class="filename">src/.gdbinit</code></a>,
13122 such as</p><table border="0" summary="Simple list" class="simplelist"><tr><td><span class="command"><strong>boot</strong></span></td><td><span class="command"><strong>run_mod_test</strong></span></td><td><span class="command"><strong>xout</strong></span></td></tr><tr><td><span class="command"><strong>base</strong></span></td><td><span class="command"><strong>run_all_tests</strong></span></td><td><span class="command"><strong>zout</strong></span></td></tr><tr><td><span class="command"><strong>full</strong></span></td><td><span class="command"><strong>run_ansi_tests</strong></span></td><td><span class="command"><strong>zbacktrace</strong></span></td></tr><tr><td><span class="command"><strong>run_test</strong></span></td><td><span class="command"><strong>run_ansi_tests_compiled</strong></span></td><td> </td></tr></table><p>and others; <span class="command"><strong>help <em class="replaceable"><code>command</code></em></strong></span> in <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>
13123 will tell you what <em class="replaceable"><code>command</code></em> does.</p><p><a id="faq-debug-macros"></a><strong>Macros. </strong><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> makes heavy use of <a class="ulink" href="https://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros
13124 (e.g., <code class="function">pushSTACK</code>), which can complicate debugging
13125 in <a class="ulink" href="https://www.sourceware.org/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>. The macros are defined
13126 in <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/lispbibl.d"><code class="filename">src/lispbibl.d</code></a>, but the maze
13127 of conditionals may be hard to navigate. If you are using <a class="ulink" href="https://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a>, you
13128 can do <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make lispbibl.h</strong></span></a> and then
13129 examine the definitions in the generated <code class="filename">lispbibl.h</code>.
13130 See also bottom of <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/spvw_debug.d"><code class="filename">src/spvw_debug.d</code></a>.
13131 </p><p><a id="faq-debug-binary-search"></a><strong>Binary Search in Time. </strong>When you encounter a <span class="emphasis"><em>regression error</em></span> (i.e.,
13132 something worked in a previous version of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, but does not work in
13133 the current version) which we cannot reproduce, we will often ask you to
13134 figure out which specific <a class="ulink" href="https://git-scm.com/" target="_top">Git</a> commit introduced it.
13135 The way to figure that out is to use <span class="command"><strong>git bisect</strong></span>.
13136 </p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h4 class="title"><a id="faq-menorah"></a>A.1.2. Logo</h4></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
13137 is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
13138 political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
13139 the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
13140 promote a political agenda is unprofessional!</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-why"></a><a id="faq-menorah-why-q"></a><p><strong>A.1.2.1.</strong></p></td><td align="left" valign="top"><p>Why
13141 is <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using menorah as the logo?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Whimsical</strong></p></td><td align="left" valign="top"><p>If you must have some answer and you do not care whether it is
13142 correct or not, you may simply think that <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> brings
13143 the <span class="emphasis"><em>Light</em></span> to a programmer, and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is a
13144 vehicle that carries the <span class="emphasis"><em>Light</em></span>.</p><p>Accordingly, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> enables you to <span class="emphasis"><em>see</em></span> the
13145 truth, thus you can pronounce it as <span class="emphasis"><em>see-lisp</em></span>.
13146 Alternatively, if you are a <span class="emphasis"><em>seasoned</em></span> expert,
13147 you might pronounce it as <span class="emphasis"><em>sea-lisp</em></span>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Historical</strong></p></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has been using the menorah for the logo since the project was
13148 first started in the late 1980-ies by Bruno Haible and Michael Stoll.
13149 This <span class="emphasis"><em>probably</em></span> reflects the authors' affection
13150 toward the Jewish people, Judaism or the State of Israel
13151 (neither of the two original authors is Jewish by birth).
13152 You may ask the original authors for details yourself.
13153 Both of them are very busy though, so do not expect a prompt reply.
13154 </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-current"></a><a id="faq-menorah-current-q"></a><p><strong>A.1.2.2.</strong></p></td><td align="left" valign="top"><p>Shouldn't the logo be changed now due to the current
13155 political developments in the Middle East?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers, both the original creators and the
13156 current maintainers, do not subscribe to the mainstream view that
13157 blames the Jews for everything from high oil prices and Islamic
13158 extremism to El Niño and global warming (or cooling, whatever
13159 the looming disaster du jour is).</p><p>Moreover, today, when Jews are being pushed out of the American
13160 and European academic institutions with various obscene
13161 <a class="ulink" href="http://www.adl.org/israel-international/m/bds/" target="_top">boycott</a>
13162 and <a class="ulink" href="http://www.divestmentwatch.com/" target="_top">divestment</a>
13163 campaigns, it is crucial for all of us to stand together against
13164 the resurgence of Nazism.</p><p>For more information, please see:
13165 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.camera.org/" target="_top">Committee for
13166 Accuracy in Middle East Reporting in America</a></li><li class="listitem"><a class="ulink" href="http://www.iris.org.il/" target="_top">Information
13167 Regarding Israel's Security</a></li><li class="listitem"><a class="ulink" href="http://www.memri.org/" target="_top">Middle East
13168 Media Research Institute</a></li><li class="listitem"><a class="ulink" href="http://www.mideasttruth.com/" target="_top">YES to
13169 peace, NO to terror</a></li><li class="listitem"><a class="ulink" href="http://www.mideasttruth.com/links.html" target="_top">More
13170 links</a></li></ul></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-other"></a><a id="faq-menorah-other-q"></a><p><strong>A.1.2.3.</strong></p></td><td align="left" valign="top"><p>Aren't there other political issues of concern?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Yes, there are! For example, in 1989 the
13171 <a class="ulink" href="http://sds.podval.org/commies.html" target="_top">communist</a>
13172 government of the <a class="ulink" href="http://www.chinasupport.net/" target="_top">People's
13173 Republic of China</a> murdered some 3000+
13174 student human rights protesters at the Tienanmen square in Beijing,
13175 and people appear to have already forgotten this crime.
13176 A note to that effect was kept in the file
13177 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/timezone.lisp"><code class="filename">src/timezone.lisp</code></a>
13178 until 2002, when it was decided that is was not visible enough there
13179 and it was moved here.</p><p>We also oppose <a class="ulink" href="http://swpat.ffii.org/" target="_top">software
13180 patents</a> and support other liberal (i.e., pro-liberty) causes.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-users"></a><a id="faq-menorah-users-q"></a><p><strong>A.1.2.4.</strong></p></td><td align="left" valign="top"><p>Aren't you afraid of losing some users who are offended by
13181 the logo?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Do you have in mind people like
13182 <a class="ulink" href="https://groups.google.com/d/msg/gnu.emacs.help/R7wEPCJXuaI/r-5lmxlY9vQJ" target="_top">this</a> one?
13183 Good riddance!</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-unprofessional"></a><a id="faq-menorah-unprofessional-q"></a><p><strong>A.1.2.5.</strong></p></td><td align="left" valign="top"><p>Using software to
13184 promote a political agenda is unprofessional!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Expressing their opinion is a perfectly natural thing for the
13185 authors, be it artistic preferences, political views or religious beliefs.
13186 The use of the menorah has its roots somewhere between these areas,
13187 and the authors are proud to display it.
13188 If you are unlucky enough to have lost the freedom to express your
13189 opinion, due to the constraints of a government, society, religion,
13190 or expectations of <span class="quote">“<span class="quote">professional relationships</span>”</span>,
13191 the Free World condoles with you.
13192 The authors of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> are not operating under such constraints.
13193 If you are unhappy about their artistic preferences, political views or
13194 religious beliefs, you are free to ignore them.</p><p>Many scientists have been doing art, politics and religion.
13195 René Descartes and Isaak Newton combined mathematics and Christianity.
13196 Albert Einstein helped the U.S. to counter the danger of an atomic bomb
13197 in the hands of the Nazis.
13198 Bram Moolenaar, the author of <a class="ulink" href="http://www.vim.org/" target="_top">VIM</a>,
13199 promotes charitable donations to Uganda.</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-run"></a>A.2. Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.2.1. <a href="#faq-defun">Why are floats printed in binary?</a></dt><dt>A.2.2. <a href="#faq-ide">Where is the IDE?</a></dt><dt>A.2.3. <a href="#faq-opt">What are the
13200 command line arguments?</a></dt><dt>A.2.4. <a href="#faq-debugger">How
13201 do I get out of the debugger?</a></dt><dt>A.2.5. <a href="#faq-ext">What CLISP
13202 extensions are available?</a></dt><dt>A.2.6. <a href="#faq-rc">Where is the
13203 init (“RC”) file on my platform?</a></dt><dt>A.2.7. <a href="#faq-modules">Where
13204 are the modules with which I built CLISP?</a></dt><dt>A.2.8. <a href="#faq-gui">How do I create
13205 a GUI
13206 for my CLISP program?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-defun"></a><a id="faq-defun-q"></a><p><strong>A.2.1.</strong></p></td><td align="left" valign="top"><p>Why are floats printed in binary?</p><p>Where is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Pass <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> to the <a href="clisp.html#runtime" class="olink">runtime</a> (<code class="filename">lisp.run</code>
13207 or <code class="filename">lisp.exe</code>).
13208 Or, better yet, use the driver <code class="filename">clisp</code> (or
13209 <code class="filename">clisp.exe</code>) instead of invoking the <a href="clisp.html#runtime" class="olink">runtime</a>
13210 directly.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ide"></a><a id="faq-ide-q"></a><p><strong>A.2.2.</strong></p></td><td align="left" valign="top"><p>Where is the <acronym class="acronym" title="Integrated Development Environment">IDE</acronym>?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="https://www.gnu.org/software/emacs/" target="_top">Emacs</a>-based</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.gnu.org/software/emacs/manual/html_node/emacs/External-Lisp.html" target="_top"><code class="function">run-lisp</code></a></li><li class="listitem"><a class="ulink" href="https://common-lisp.net/project/slime/" target="_top">SLIME</a></li><li class="listitem"><a class="ulink" href="https://sourceforge.net/projects/ilisp/" target="_top">ILISP</a></li><li class="listitem"><a class="ulink" href="http://cl-cookbook.sourceforge.net/windows.html" target="_top">The Common Lisp Cookbook</a></li></ul></div></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>non-<a class="ulink" href="https://www.gnu.org/software/emacs/" target="_top">Emacs</a>-based</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="" href="http://www.google.com/search?q=VisualCLisp">VisualCLisp</a></li><li class="listitem"><a class="ulink" href="http://jabberwocky.sourceforge.net/" target="_top">Jabberwocky</a></li><li class="listitem"><a class="ulink" href="http://gclisp.sourceforge.net/" target="_top">GClisp</a></li><li class="listitem"><a class="ulink" href="https://common-lisp.net/project/phemlock/" target="_top">Portable Hemlock</a></li></ul></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-opt"></a><a id="faq-opt-q"></a><p><strong>A.2.3.</strong></p></td><td align="left" valign="top"><p>What are the
13211 command line arguments?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-debugger"></a><a id="faq-debugger-q"></a><p><strong>A.2.4.</strong></p></td><td align="left" valign="top"><p>How
13212 do I get out of the debugger?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#repl" title="25.1. Top Level Loop sec_25-1-1">Section 25.1, “Top Level Loop sec_25-1-1”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ext"></a><a id="faq-ext-q"></a><p><strong>A.2.5.</strong></p></td><td align="left" valign="top"><p>What <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13213 extensions are available?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>bundled</strong></p></td><td align="left" valign="top"><p>Quite a few modules are
13214 <a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">included</a> with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>,
13215 pass <code class="option">--with-module=...</code> to <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>
13216 to build them and see <a class="xref" href="#faq-modules" title="A.2.7.">Q: A.2.7</a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>3rd party</strong></p></td><td align="left" valign="top"><p>See the <span class="emphasis"><em>incomplete</em></span> list of
13217 <a class="ulink" href="http://clisp.org/resources.html#software" target="_top">Common
13218 Lisp software running in <span class="command"><strong>CLISP</strong></span></a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><acronym class="acronym" title="Do It Yourself">DIY</acronym></strong></p></td><td align="left" valign="top"><p>See <a class="xref" href="#modules" title="32.2. External Modules">Section 32.2, “External Modules”</a> and <a class="xref" href="#dffi" title="32.3. The Foreign Function Call Facility">Section 32.3, “The Foreign Function Call Facility”</a>
13219 for information on how to interface with external <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> libraries.
13220 </p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a></strong></p></td><td align="left" valign="top"><div class="itemizedlist"><p class="title"><strong>Very Frequently Asked!</strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with
13221 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/src/inspect.lisp"><code class="filename">src/inspect.lisp</code></a>
13222 which implements a rudimentary <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server</li><li class="listitem"><a class="ulink" href="http://clocc.sourceforge.net/clocc/src/donc/http.lisp" target="_top">CLOCC/src/donc/</a> has an <a class="ulink" href="https://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server</li><li class="listitem"><a class="ulink" href="http://clocc.sourceforge.net/clocc/src/cllib/url.lisp" target="_top">CLOCC/src/cllib/</a> handles URLs</li><li class="listitem"><a class="ulink" href="http://www.cliki.net/mod_lisp" target="_top">mod_lisp</a>
13223 hooks lisp into <a class="ulink" href="https://www.apache.org/" target="_top">Apache</a></li></ul></div><p>Both <a class="ulink" href="http://allegroserve.sourceforge.net/" target="_top">AllegroServe</a>
13224 and <a class="ulink" href="https://en.wikipedia.org/wiki/CL-HTTP" target="_top">CL-HTTP</a>
13225 require <a class="link" href="#mt" title="32.5. Multiple Threads of Execution">multithreading</a> and do not work
13226 with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> yet.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rc"></a><a id="faq-rc-q"></a><p><strong>A.2.6.</strong></p></td><td align="left" valign="top"><p>Where is the
13227 init (<span class="quote">“<span class="quote">RC</span>”</span>) file on my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Read the file <code class="filename">&lt;clisp.html#opt-norc&gt;</code>
13228 in your build directory or binary distribution (this is the version of
13229 the user manual <a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a> for your platform).</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-modules"></a><a id="faq-modules-q"></a><p><strong>A.2.7.</strong></p></td><td align="left" valign="top"><p>Where
13230 are the modules with which I built <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>In the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>. Run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> like this:
13231 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full</pre><p>Unless your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was configured with option <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>, you
13232 should instead use <code class="code">(<a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> <em class="replaceable"><code>name</code></em>)</code> where <em class="replaceable"><code>name</code></em> is
13233 a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, e.g., <span class="quote">“<span class="quote"><span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span></span>”</span>, or <span class="quote">“<span class="quote">clx</span>”</span>
13234 (for either <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> or <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span>, whichever is installed),
13235 or <span class="quote">“<span class="quote">linux</span>”</span> (for <span class="module"><a href="https://gitlab.com/gnu-clisp/clisp/tree/master/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span>) etc.
13236 This is more reliable because the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> may include many modules
13237 which you do not need and, in fact, <span class="strong"><strong>cannot</strong></span> use because they require
13238 external libraries not installed on your system.</p><p>Making <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> the default <a href="impnotes.html#linkset" class="olink">linking set</a> has some advantages:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Shared Library Hell</span></dt><dd>Avoid problems when a module requires a shared
13239 library, and that shared library is not present (or is present but
13240 with wrong version) on your system.</dd><dt><span class="term">Smaller Images Are Faster</span></dt><dd>Adding things to the heap increases working
13241 set size causing a slowdown, which is especially important for
13242 small to medium applications.</dd><dt><span class="term">Uniform User Experience</span></dt><dd>Composition of the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> is up to the
13243 packager, while <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> is the same on all platforms.
13244 </dd></dl></div><p>See <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> for more information
13245 (<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/11678654/" target="_top">https://sourceforge.net/p/clisp/mailman/message/11678654/</a>).</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-gui"></a><a id="faq-gui-q"></a><p><strong>A.2.8.</strong></p></td><td align="left" valign="top"><p>How do I create
13246 a <acronym class="acronym" title="Graphical User Interface">GUI</acronym>
13247 for my <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Use module <span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span>: create <code class="filename">ui.glade</code>
13248 with <a class="ulink" href="https://glade.gnome.org/" target="_top">Glade</a>, then do</p><pre class="screen">
13249 <strong><code class="prompt">$</code></strong> ./configure --with-module=gtk2 --cbc build-gtk
13250 <strong><code class="prompt">$</code></strong> ./build-gtk/clisp <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(gtk:run-glade-file "ui.glade")'</pre><p>There are many other options,
13251 see <a class="ulink" href="http://clisp.org/resources.html#software" target="_top">"Common
13252 Lisp software running in <span class="command"><strong>CLISP</strong></span>"</a>.</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-delivery"></a>A.3. Application Delivery</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.3.1. <a href="#faq-exec">How do I
13253 create an executable file with all my code in it?</a></dt><dt>A.3.2. <a href="#faq-licensing">When
13254 I deliver my application with CLISP, does it have to be covered by
13255 the GNU GPL?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-exec"></a><a id="faq-exec-q"></a><p><strong>A.3.1.</strong></p></td><td align="left" valign="top"><p>How do I
13256 create an executable file with all my code in it?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Use <a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>, see also <a class="xref" href="#quickstart" title="32.6. Quickstarting delivery with CLISP">Section 32.6, “Quickstarting delivery with <span class="command"><strong>CLISP</strong></span>”</a>.
13257 </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-licensing"></a><a id="faq-licensing-q"></a><p><strong>A.3.2.</strong></p></td><td align="left" valign="top"><p>When
13258 I deliver my application with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, does it have to be covered by
13259 the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Not necessarily.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is <a class="ulink" href="http://www.gnu.org/philosophy/free-sw.html" target="_top">Free
13260 Software</a>, covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>, with special
13261 terms governing the distribution of applications that run in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
13262 The precise terms can be found in the
13263 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/COPYRIGHT"><code class="filename">COPYRIGHT</code></a>
13264 file contained in the source and binary distributions of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
13265 Here is an informal clarification of what these terms mean in practice.
13266 Please refer to the said <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/COPYRIGHT"><code class="filename">COPYRIGHT</code></a>
13267 file when in doubt.</p><p>In many cases, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not force an application to be covered
13268 by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>. Nevertheless, we encourage you to release your software
13269 under an open source license. The benefits of such a license for
13270 your users are numerous, in particular they are free to modify the
13271 application when their needs/requirements change, and they are free to
13272 recompile the application when they upgrade their machine or operating
13273 system.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <span class="emphasis"><em>extensions</em></span>, i.e. programs which need
13274 to access non-portable <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internal symbols (in the packages
13275 <a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a>, <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>, <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, etc), must be covered by <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>
13276 as well.</p><p>Other programs running in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> have to or need not to be placed
13277 under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>, depending on their distribution form:
13278
13279 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Programs distributed as Lisp source or <code class="filename">#P".fas"</code>
13280 files can be distributed without restrictions coming from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
13281 </li><li class="listitem">Programs distributed as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#image" class="olink">memory image</a>s can be
13282 distributed only if accompanied with the non-<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <code class="filename">#P".fas"</code> files
13283 which make up the <a href="impnotes.html#image" class="olink">memory image</a>, and a <code class="filename">Makefile</code> (or clear textual
13284 instructions) for rebuilding the <a href="impnotes.html#image" class="olink">memory image</a>.</li><li class="listitem">If you need to distribute a modified <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13285 executable (for example, incorporating additional <a href="impnotes.html#modules" class="olink">module</a>s written
13286 in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>), you must distribute its full source under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.
13287 If you are not satisfied with this, you can instead put the additional
13288 <a href="impnotes.html#modules" class="olink">module</a>s into a separate (non-<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>) program, with which your Lisp
13289 program will communicate via <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s.</li></ul></div></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-trouble"></a>A.4. Troubles</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.4.1. <a href="#faq-bin-distrib">Where
13290 is the binary distribution for my platform?</a></dt><dt>A.4.2. <a href="#faq-bin-distrib-prev">But a previous release had a binary
13291 distribution for my platform, why does not the current one?</a></dt><dt>A.4.3. <a href="#faq-build">Why does not
13292 CLISP build on my platform?</a></dt><dt>A.4.4. <a href="#faq-with-prefix">
13293 Why is the --with-libsigsegv-prefix option ignored
13294 by the configure script on my 64-bit machine?</a></dt><dt>A.4.5. <a href="#faq-enc-err">What do charset errors mean?</a></dt><dt>A.4.6. <a href="#faq-rl-tab">What does
13295 this message mean: “Display all 1259
13296 possibilities? (y or n)”</a></dt><dt>A.4.7. <a href="#faq-no-rl">Why does
13297 not command line editing work?</a></dt><dt>A.4.8. <a href="#faq-stack">How do I
13298 avoid stack overflow?</a></dt><dt>A.4.9. <a href="#faq-self-mod">Why does my function return different values on each
13299 invocation and then hangs forever?</a></dt><dt>A.4.10. <a href="#faq-fp">Is floating point arithmetic broken?</a></dt><dt>A.4.11. <a href="#faq-random">Is RANDOM broken?</a></dt><dt>A.4.12. <a href="#faq-pp-newline">Why is an extra line break
13300 inserted by the pretty printer?</a></dt><dt>A.4.13. <a href="#faq-warning">How do I disable this annoying
13301 warning?</a></dt><dt>A.4.14. <a href="#faq-scope">Why does DEFVAR affect previously defined lexical closures?</a></dt><dt>A.4.15. <a href="#faq-bad-error">The error message is not helpful!</a></dt><dt>A.4.16. <a href="#faq-other-problem">Why is the function FOO
13302 broken?!</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bin-distrib"></a><a id="faq-bin-distrib-q"></a><p><strong>A.4.1.</strong></p></td><td align="left" valign="top"><p>Where
13303 is the binary distribution for my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> maintainers do not offer <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> binary
13304 distributions, we believe that software packagers specializing on a
13305 particular platform are in a better position to provide quality binaries.
13306 Indeed, the section <span class="quote">“<span class="quote">Get CLISP</span>”</span> on the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s home
13307 page points to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> packages for all major <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and <a class="ulink" href="http://www.bsd.org/" target="_top"><span class="platform">*BSD</span></a>
13308 variants.</p><p>The only exception is <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> for which there is no centralized
13309 packager: <span class="emphasis"><em>usually</em></span>, after each <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> release,
13310 a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> user <span class="emphasis"><em>volunteers</em></span> to build a <a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a>
13311 binary package, which we then distribute at
13312 <a class="ulink" href="https://sourceforge.net/projects/clisp/files/" target="_top">https://sourceforge.net/projects/clisp/files/</a>.
13313 </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bin-distrib-prev"></a><a id="faq-bin-distrib-prev-q"></a><p><strong>A.4.2.</strong></p></td><td align="left" valign="top"><p>But a previous release <span class="emphasis"><em>had</em></span> a binary
13314 distribution for my platform, why does not the current one?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>It was probably contributed by a user who did not (yet?)
13315 contribute a binary distribution for the current release. You can
13316 find out who contributed a specific binary distribution by looking at
13317 the release notes in the <a class="ulink" href="https://sourceforge.net" target="_top">SourceForge</a>
13318 <a class="ulink" href="https://sourceforge.net/projects/clisp/files/" target="_top">Files</a> section.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-build"></a><a id="faq-build-q"></a><p><strong>A.4.3.</strong></p></td><td align="left" valign="top"><p>Why does not
13319 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build on my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Please see file
13320 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/unix/PLATFORMS"><code class="filename">unix/PLATFORMS</code></a> in your source
13321 distribution for information about some known troublesome platforms
13322 as well as instructions on porting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to new platforms.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-with-prefix"></a><a id="faq-with-prefix-q"></a><p><strong>A.4.4.</strong></p></td><td align="left" valign="top"><p>
13323 Why is the <code class="option">--with-libsigsegv-prefix</code> option ignored
13324 by the <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> script on my 64-bit machine?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See a note on <span class="quote">“<span class="quote">bi-arch systems</span>”</span> in section 2 of
13325 <a class="clisp-cvs" href="https://gitlab.com/gnu-clisp/clisp/blob/master/unix/INSTALL"><code class="filename">unix/INSTALL</code></a> in your source distribution
13326 (for the impatient: pass <code class="option">--libdir=='${exec_prefix}/lib64'</code>
13327 to the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libsigsegv/" target="_top">libsigsegv</a> <a class="ulink" href="https://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>).</p><p>See these threads which discuss the situation in depth:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="https://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00070.html" target="_top">https://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00070.html</a></td></tr><tr><td><a class="ulink" href="http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html" target="_top">http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html</a></td></tr></table></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-enc-err"></a><a id="faq-enc-err-q"></a><p><strong>A.4.5.</strong></p></td><td align="left" valign="top"><p>What do these error messages
13328 mean: <span class="quote">“<span class="quote"><code class="computeroutput">invalid byte #x94 in
13329 CHARSET:ASCII conversion</code></span>”</span> and
13330 <span class="quote">“<span class="quote"><code class="computeroutput">character #\u00B3 cannot be represented in the
13331 character set CHARSET:ASCII</code></span>”</span>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>This means that you are trying to read (<span class="quote">“<span class="quote">invalid
13332 byte</span>”</span>) or write (<span class="quote">“<span class="quote">character cannot be represented</span>”</span>)
13333 a non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> character from (or to) a character stream which has
13334 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>. The default is described in
13335 <a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a>.</p><p>This may also be caused by filesystem access.
13336 If you have files with names incompatible with your <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>,
13337 filesystem access (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>) will <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
13338 You will need to set <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> or pass <code class="option"><a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a></code> to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
13339 Using a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>, such as <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>,
13340 should help you avoid this error.</p><p>Note that this error may be signaled by the <span class="quote">“<span class="quote">Print</span>”</span>
13341 part of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> and <span class="strong"><strong>not</strong></span> by the function you call.
13342 E.g., if file <code class="filename">"foo"</code> contains non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters,
13343 you will see such an error when you type</p><pre class="programlisting">
13344 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (s "foo" :direction :input <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>)
13345 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
13346 </pre><p> If instead you type </p><pre class="programlisting">
13347 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (s "foo" :direction :input <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>)
13348 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> l (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
13349 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
13350 </pre><p> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will just print <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and signal the error
13351 when you type <code class="literal">l</code>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rl-tab"></a><a id="faq-rl-tab-q"></a><p><strong>A.4.6.</strong></p></td><td align="left" valign="top"><p>What does
13352 this message mean: <span class="quote">“<span class="quote"><code class="computeroutput">Display all 1259
13353 possibilities? (y or n)</code></span>”</span></p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> for command line editing and
13354 <a href="clisp.html#completion" class="olink">completion</a>.
13355 You get this <span class="quote">“<span class="quote">Display all 1259 possibilities</span>”</span> message
13356 (and sometimes many screens of symbols) when you
13357 hit <span class="keycode">TAB</span> too many times in an inappropriate place.
13358 <a href="clisp.html#opt-ilisp" class="olink">You can turn this feature
13359 off</a> if you are using <a class="ulink" href="https://www.gnu.org/software/emacs/" target="_top">Emacs</a>. It is a good idea
13360 <a class="ulink" href="http://www.w3.org/MarkUp/html3/literal.html" target="_top">not</a> to
13361 use <span class="keycode">TAB</span>s in your code.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-no-rl"></a><a id="faq-no-rl-q"></a><p><strong>A.4.7.</strong></p></td><td align="left" valign="top"><p>Why does
13362 not command line editing work?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#readline" title="21.2.1. Command line editing with GNU readline">Section 21.2.1, “Command line editing with GNU readline”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-stack"></a><a id="faq-stack-q"></a><p><strong>A.4.8.</strong></p></td><td align="left" valign="top"><p>How do I
13363 avoid stack overflow?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has <a class="link" href="#vm" title="37.2. The virtual machine"><span class="strong"><strong>two</strong></span> stacks</a>, the
13364 <span class="quote">“<span class="quote">program stack</span>”</span> and the <span class="quote">“<span class="quote">lisp stack</span>”</span>,
13365 and both may occasionally overflow.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Generic</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">You will always get a stack overflow when you try
13366 to print a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#circular">circular</a> object (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>,
13367 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> etc) and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
13368 Just set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">You will always get a stack overflow on infinite
13369 recursion.</li><li class="listitem">Some simple functions (like
13370 <a class="ulink" href="http://en.wikipedia.org/wiki/Ackermann_function" target="_top">Ackermann's</a>)
13371 recurse more than you might expect and can run out of stack on
13372 relatively small inputs.</li><li class="listitem">Compiled code uses less stack (and memory) and is
13373 faster.</li><li class="listitem">If you really do need more Lisp stack, you can
13374 increase it by telling <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to pre-allocate more memory using
13375 <code class="option"><a href="clisp.html#opt-memsize" class="olink">-m</a></code> or <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</li><li class="listitem">If you get a segmentation fault after (or instead
13376 of) a <span class="quote">“<span class="quote">program stack overflow</span>”</span> message, please make
13377 sure that you had <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="https://www.gnu.org/software/libsigsegv/" target="_top">libsigsegv</a> installed when you configured and
13378 built <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</li></ul></div></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Specific</strong></p></td><td align="left" valign="top"><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><p>You have several option, use whichever is applicable
13379 to your situation:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">modify the
13380 global <code class="filename">SYSTEM.INI</code></li><li class="listitem">modify the <code class="filename">PIF</code>
13381 that you use to invoke <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13382 (<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/9033347/" target="_top">https://sourceforge.net/p/clisp/mailman/message/9033347/</a>)</li><li class="listitem">or set the program stack (of the run
13383 times <span class="command"><strong>base/lisp.exe</strong></span> or
13384 <span class="command"><strong>full/lisp.exe</strong></span>, <span class="strong"><strong>not</strong></span> the driver
13385 <span class="command"><strong>clisp.exe</strong></span>) using <span class="command"><strong>editbin</strong></span>
13386 (<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/9033144/" target="_top">https://sourceforge.net/p/clisp/mailman/message/9033144/</a>); you can find the
13387 current stack size using <span class="command"><strong>dumpbin</strong></span>.
13388 </li></ul></div></dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>Increase program stack with <span class="command"><strong>ulimit
13389 -s</strong></span> (or <span class="command"><strong>limit stacksize</strong></span> if you are using
13390 <a class="ulink" href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_top"><code class="literal">csh</code></a>) to at least 8 MB.
13391 </dd></dl></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-self-mod"></a><a id="faq-self-mod-q"></a><p><strong>A.4.9.</strong></p></td><td align="left" valign="top"><p>Why does my function return different values on each
13392 invocation and then hangs forever?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The following code modifies itself:
13393 </p><pre class="programlisting">(defun my-func ()<strong> ; </strong><em class="lineannotation"><span class="lineannotation">modifies internal data!</span></em>
13394 (let ((var '(a b c)))
13395 (nconc var '(1 2 3))))</pre><p>
13396 and will not work as one would naively expect:</p><pre class="programlisting">
13397 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
13398 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> #'my-func)
13399 ⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
13400 (BLOCK MY-FUNC (LET ((VAR '(A B C))) (NCONC VAR '(1 2 3)))))</code>
13401 (my-func)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">the first invocation</span></em>
13402 ⇒ <code class="computeroutput">(a b c 1 2 3)</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">modifies the internal data:</span></em>
13403 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> #'my-func)
13404 ⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
13405 (BLOCK MY-FUNC (LET ((VAR '(A B C . #1=(1 2 3)))) (NCONC VAR '#1#))))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">note shared structure!</span></em>
13406 (my-func)
13407 ⇒ <code class="computeroutput">(A B C . #1=(1 2 3 . #1#))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#circular_list">circular list</a>!</span></em>
13408 (function-lambda-expression #'my-func )
13409 ⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
13410 (BLOCK MY-FUNC (LET ((VAR '(A B C . #1=(1 2 3 . #1#)))) (NCONC VAR '#1#))))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">note circular value of var</span></em>
13411 (my-func)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">hangs because <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> cannot handle a circular argument</span></em></pre><p>Instead you must do
13412 </p><pre class="programlisting">(defun my-func ()
13413 (let ((var (copy-list '(a b c))))
13414 (nconc var (copy-list '(1 2 3)))))</pre><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> will show the constants in your compiled functions
13415 (see <a class="xref" href="#bytecode" title="Chapter 37. The CLISP bytecode specification">Chapter 37, <em>The <span class="command"><strong>CLISP</strong></span> bytecode specification</em></a> for the explanation of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
13416 output.) As you see above, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> works for the
13417 interpreted ones.</p><p>See <a class="ulink" href="http://norvig.com/luv-slides.ps" target="_top">Lisp Programming
13418 Style</a> for more useful information.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-fp"></a><a id="faq-fp-q"></a><p><strong>A.4.10.</strong></p></td><td align="left" valign="top"><p>Why don't floating point arithmetic
13419 return what I want?</p><pre class="programlisting">
13420 (- 1.1 0.9)
13421 ⇒ <code class="computeroutput">0.20000005</code>
13422 </pre></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>inexact</strong></p></td><td align="left" valign="top"><p>Floating point arithmetic is
13423 inherently <span class="emphasis"><em>inexact</em></span>, so this <span class="strong"><strong>not</strong></span> a bug,
13424 at least not a bug in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
13425 You may argue that this is a bug in <a class="ulink" href="https://en.wikipedia.org/wiki/IEEE_754" target="_top">IEEE 754</a>,
13426 but, before you do, please make sure that you do know
13427 <a class="ulink" href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" target="_top">What
13428 Every Computer Scientist Should Know About Floating-Point Arithmetic</a>
13429 (or are at least familiar with the
13430 <a class="ulink" href="http://floating-point-gui.de/" target="_top">light version</a> thereof).
13431 </p><p>See also <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>
13432 (<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12275968/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12275968/</a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12275958/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12275958/</a>).</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>exact</strong></p></td><td align="left" valign="top"><p>If you want <span class="emphasis"><em>exact</em></span>
13433 calculations, use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>s:</p><pre class="programlisting">
13434 (- 11/10 9/10)
13435 ⇒ <code class="computeroutput">1/5</code></pre><p>
13436 </p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-random"></a><a id="faq-random-q"></a><p><strong>A.4.11.</strong></p></td><td align="left" valign="top"><p>Why does
13437 </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
13438 always print the same number?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Reproducibility is important.
13439 See <a class="xref" href="#random-state" title="12.2.7. Random-State Operations sec_12-1-7">Section 12.2.7, “Random-State Operations sec_12-1-7”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-pp-newline"></a><a id="faq-pp-newline-q"></a><p><strong>A.4.12.</strong></p></td><td align="left" valign="top"><p>Why is an extra line break
13440 inserted by the pretty printer?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*">the section called “Variable <code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code>”</a>.</p><p>For example, here you are pretty-printing two objects: a
13441 one-liner <span class="keysym">#\Q</span> and a two-liner <span class="keycode">CR</span>+<span class="keycode">LF</span>,
13442 and a line break is inserted between them so that they are printed on
13443 separate lines: </p><pre class="programlisting">
13444 (defparameter crlf (coerce '(#\Return #\Linefeed) 'string))
13445 ⇒ <code class="computeroutput">CRLF</code>
13446 (map 'list #'char-code (format nil "Q~a" crlf))
13447 ⇒ <code class="computeroutput">(81 10 13 10)</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">not (81 13 10) !</span></em>
13448 </pre><p>When you want <span class="keycode">CR</span>+<span class="keycode">LF</span>-terminated lines, use <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>
13449 argument when opening your <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-warning"></a><a id="faq-warning-q"></a><p><strong>A.4.13.</strong></p></td><td align="left" valign="top"><p>How do I disable this annoying
13450 warning?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> often issues <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>s when it encounters
13451 suspicious behavior. It is best to fix your code rather than to
13452 suppress them. To figure out where the warning is coming from, do
13453 <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>)</code> and examine
13454 the stack in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> to see where the warning is coming from.</p><p>If everything else fails, read the
13455 <a class="link" href="#impnotes-top" title="Implementation Notes for GNU CLISP">manual</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-scope"></a><a id="faq-scope-q"></a><p><strong>A.4.14.</strong></p></td><td align="left" valign="top"><p>Why does <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> affect previously defined lexical closures?</p><pre class="programlisting">
13456 (defun adder (val) (lambda (x) (+ x val)))
13457 ⇒ <code class="computeroutput">ADDER</code>
13458 (setq add-10 (adder 10))
13459 ⇒ <code class="computeroutput">ADD-10</code>
13460 (funcall add-10 32)
13461 ⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
13462 (defvar val 12)
13463 ⇒ <code class="computeroutput">VAL</code>
13464 (funcall add-10 0)
13465 ⇒ <code class="computeroutput">12</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">why not 10?!</span></em>
13466 </pre></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Explanation</strong></p></td><td align="left" valign="top"><p>The above code does not conform to [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], therefore <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
13467 can produce arbitrary results.
13468 See <a class="xref" href="#semantic-constraints" title="3.2.2.3. Semantic Constraints sec_3-2-2-3">Section 3.2.2.3, “Semantic Constraints sec_3-2-2-3”</a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Remedy</strong></p></td><td align="left" valign="top"><p>Always follow the naming convention for global special variables
13469 defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a> (e.g., <code class="varname">*FOO*</code>)
13470 and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> (e.g., <code class="varname">+BAR+</code>).</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>More</strong></p></td><td align="left" valign="top"><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/13174197/" target="_top">https://sourceforge.net/p/clisp/mailman/message/13174197/</a></td></tr><tr><td><a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/13174204/" target="_top">https://sourceforge.net/p/clisp/mailman/message/13174204/</a></td></tr></table></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bad-error"></a><a id="faq-bad-error-q"></a><p><strong>A.4.15.</strong></p></td><td align="left" valign="top"><p>The error message is not helpful!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Sometimes an error message contains a compound object
13471 whose content you want to examine. Often this object will be available
13472 for <a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a>ion via the <span class="command"><strong>Inspect</strong></span> command (see
13473 <a class="xref" href="#debugger-deb-step-1" title="Table 25.3. Commands common to the debugger and the stepper">Table 25.3, “Commands common to the debugger and the stepper”</a>). E.g., </p><pre class="screen">
13474 *** - READ: input stream #&lt;INPUT STRING-INPUT-STREAM&gt; ends within an object
13475 The following restarts are available:
13476 ABORT :R1 ABORT
13477 <strong><code class="prompt">Break 4 [1]&gt;</code></strong> <big><strong class="userinput"><code>:i</code></strong></big>
13478 #&lt;SYSTEM::SIMPLE-END-OF-FILE #x000333CB82F8&gt;: standard object
13479 type: SYSTEM::SIMPLE-END-OF-FILE
13480 0 [$STREAM]: #&lt;INPUT STRING-INPUT-STREAM&gt;
13481 1 [$FORMAT-CONTROL]:
13482 "~S: input stream ~S ends within an object
13483 "
13484 2 [$FORMAT-ARGUMENTS]: (READ #&lt;INPUT STRING-INPUT-STREAM&gt;)
13485 <strong><code class="prompt">INSPECT-- type :h for help; :q to return to the REPL ---&gt;</code></strong> <big><strong class="userinput"><code>0</code></strong></big>
13486 #&lt;INPUT STRING-INPUT-STREAM&gt;: atom
13487 type: STRING-STREAM
13488 class: #1=#&lt;BUILT-IN-CLASS STRING-STREAM&gt;
13489 <strong><code class="prompt">INSPECT-- type :h for help; :q to return to the REPL ---&gt;</code></strong> <big><strong class="userinput"><code>:d</code></strong></big>
13490
13491 #&lt;INPUT STRING-INPUT-STREAM&gt; is an input-stream. It reads from "(foo" from 0 to 4 at 4.
13492 </pre></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-other-problem"></a><a id="faq-other-problem-q"></a><p><strong>A.4.16.</strong></p></td><td align="left" valign="top"><p>Why is the function <code class="function">FOO</code>
13493 broken?!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>When confronted with unexpected behavior,
13494 try looking in the <a class="xref" href="#impnotes-top" title="Implementation Notes for GNU CLISP"><span class="command"><strong>CLISP</strong></span> impnotes</a>.</p><p>E.g., <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> is different from the <a class="ulink" href="https://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>
13495 implementation, so, to find out how to get the results you want,
13496 you should search the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation notes for "DIRECTORY".</p><p>Alternatively, since the implementation notes are organized in
13497 parallel to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> belongs to the
13498 <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-20.html">Chapter 20</a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>],
13499 you can just go to <a class="xref" href="#files" title="Chapter 20. Files chap-20">Chapter 20, <em>Files chap-20</em></a> in impnotes and look
13500 for "DIRECTORY" <a class="link" href="#directory" title="20.3.2. Function DIRECTORY">there</a>.
13501 </p></td></tr></tbody></table></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="fdl"></a>Appendix B. GNU Free Documentation License</h2></div></div></div><p>Version 1.3, 3 November 2008</p><p>
13502 Copyright © 2000, 2001, 2002, 2007, 2008
13503 <a class="ulink" href="https://www.fsf.org/" target="_top">Free Software Foundation, Inc.</a>
13504 </p><p>
13505 Everyone is permitted to copy and distribute verbatim copies of this
13506 license document, but changing it is not allowed.
13507 </p><h3><a id="section0"></a>
13508 0. PREAMBLE
13509 </h3><p>
13510 The purpose of this License is to make a manual, textbook, or other
13511 functional and useful document “free” in the sense of freedom:
13512 to assure everyone the effective freedom to copy and redistribute it, with
13513 or without modifying it, either commercially or
13514 noncommercially. Secondarily, this License preserves for the author and
13515 publisher a way to get credit for their work, while not being considered
13516 responsible for modifications made by others.
13517 </p><p>
13518 This License is a kind of “copyleft”, which means that
13519 derivative works of the document must themselves be free in the same
13520 sense. It complements the GNU General Public License, which is a copyleft
13521 license designed for free software.
13522 </p><p>
13523 We have designed this License in order to use it for manuals for free
13524 software, because free software needs free documentation: a free program
13525 should come with manuals providing the same freedoms that the software
13526 does. But this License is not limited to software manuals; it can be used
13527 for any textual work, regardless of subject matter or whether it is
13528 published as a printed book. We recommend this License principally for
13529 works whose purpose is instruction or reference.
13530 </p><h3><a id="section1"></a>
13531 1. APPLICABILITY AND DEFINITIONS
13532 </h3><p>
13533 This License applies to any manual or other work, in any medium, that
13534 contains a notice placed by the copyright holder saying it can be
13535 distributed under the terms of this License. Such a notice grants a
13536 world-wide, royalty-free license, unlimited in duration, to use that work
13537 under the conditions stated herein. The “Document”, below,
13538 refers to any such manual or work. Any member of the public is a licensee,
13539 and is addressed as “you”. You accept the license if you copy,
13540 modify or distribute the work in a way requiring permission under
13541 copyright law.
13542 </p><p>
13543 A “Modified Version” of the Document means any work containing
13544 the Document or a portion of it, either copied verbatim, or with
13545 modifications and/or translated into another language.
13546 </p><p>
13547 A “Secondary Section” is a named appendix or a front-matter
13548 section of the Document that deals exclusively with the relationship of
13549 the publishers or authors of the Document to the Document’s overall
13550 subject (or to related matters) and contains nothing that could fall
13551 directly within that overall subject. (Thus, if the Document is in part a
13552 textbook of mathematics, a Secondary Section may not explain any
13553 mathematics.) The relationship could be a matter of historical connection
13554 with the subject or with related matters, or of legal, commercial,
13555 philosophical, ethical or political position regarding them.
13556 </p><p>
13557 The “Invariant Sections” are certain Secondary Sections whose
13558 titles are designated, as being those of Invariant Sections, in the notice
13559 that says that the Document is released under this License. If a section
13560 does not fit the above definition of Secondary then it is not allowed to
13561 be designated as Invariant. The Document may contain zero Invariant
13562 Sections. If the Document does not identify any Invariant Sections then
13563 there are none.
13564 </p><p>
13565 The “Cover Texts” are certain short passages of text that are
13566 listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says
13567 that the Document is released under this License. A Front-Cover Text may
13568 be at most 5 words, and a Back-Cover Text may be at most 25 words.
13569 </p><p>
13570 A “Transparent” copy of the Document means a machine-readable
13571 copy, represented in a format whose specification is available to the
13572 general public, that is suitable for revising the document
13573 straightforwardly with generic text editors or (for images composed of
13574 pixels) generic paint programs or (for drawings) some widely available
13575 drawing editor, and that is suitable for input to text formatters or for
13576 automatic translation to a variety of formats suitable for input to text
13577 formatters. A copy made in an otherwise Transparent file format whose
13578 markup, or absence of markup, has been arranged to thwart or discourage
13579 subsequent modification by readers is not Transparent. An image format is
13580 not Transparent if used for any substantial amount of text. A copy that is
13581 not “Transparent” is called “Opaque”.
13582 </p><p>
13583 Examples of suitable formats for Transparent copies include plain ASCII
13584 without markup, Texinfo input format, LaTeX input format, SGML or XML
13585 using a publicly available DTD, and standard-conforming simple HTML,
13586 PostScript or PDF designed for human modification. Examples of transparent
13587 image formats include PNG, XCF and JPG. Opaque formats include proprietary
13588 formats that can be read and edited only by proprietary word processors,
13589 SGML or XML for which the DTD and/or processing tools are not generally
13590 available, and the machine-generated HTML, PostScript or PDF produced by
13591 some word processors for output purposes only.
13592 </p><p>
13593 The “Title Page” means, for a printed book, the title page
13594 itself, plus such following pages as are needed to hold, legibly, the
13595 material this License requires to appear in the title page. For works in
13596 formats which do not have any title page as such, “Title Page”
13597 means the text near the most prominent appearance of the work’s
13598 title, preceding the beginning of the body of the text.
13599 </p><p>
13600 The “publisher” means any person or entity that distributes
13601 copies of the Document to the public.
13602 </p><p>
13603 A section “Entitled XYZ” means a named subunit of the Document
13604 whose title either is precisely XYZ or contains XYZ in parentheses
13605 following text that translates XYZ in another language. (Here XYZ stands
13606 for a specific section name mentioned below, such as
13607 “Acknowledgements”, “Dedications”,
13608 “Endorsements”, or “History”.) To “Preserve
13609 the Title” of such a section when you modify the Document means that
13610 it remains a section “Entitled XYZ” according to this
13611 definition.
13612 </p><p>
13613 The Document may include Warranty Disclaimers next to the notice which
13614 states that this License applies to the Document. These Warranty
13615 Disclaimers are considered to be included by reference in this License,
13616 but only as regards disclaiming warranties: any other implication that
13617 these Warranty Disclaimers may have is void and has no effect on the
13618 meaning of this License.
13619 </p><h3><a id="section2"></a>
13620 2. VERBATIM COPYING
13621 </h3><p>
13622 You may copy and distribute the Document in any medium, either
13623 commercially or noncommercially, provided that this License, the copyright
13624 notices, and the license notice saying this License applies to the
13625 Document are reproduced in all copies, and that you add no other
13626 conditions whatsoever to those of this License. You may not use technical
13627 measures to obstruct or control the reading or further copying of the
13628 copies you make or distribute. However, you may accept compensation in
13629 exchange for copies. If you distribute a large enough number of copies you
13630 must also follow the conditions in section 3.
13631 </p><p>
13632 You may also lend copies, under the same conditions stated above, and you
13633 may publicly display copies.
13634 </p><h3><a id="section3"></a>
13635 3. COPYING IN QUANTITY
13636 </h3><p>
13637 If you publish printed copies (or copies in media that commonly have
13638 printed covers) of the Document, numbering more than 100, and the
13639 Document’s license notice requires Cover Texts, you must enclose
13640 the copies in covers that carry, clearly and legibly, all these Cover
13641 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
13642 back cover. Both covers must also clearly and legibly identify you as the
13643 publisher of these copies. The front cover must present the full title
13644 with all words of the title equally prominent and visible. You may add
13645 other material on the covers in addition. Copying with changes limited to
13646 the covers, as long as they preserve the title of the Document and satisfy
13647 these conditions, can be treated as verbatim copying in other respects.
13648 </p><p>
13649 If the required texts for either cover are too voluminous to fit legibly,
13650 you should put the first ones listed (as many as fit reasonably) on the
13651 actual cover, and continue the rest onto adjacent pages.
13652 </p><p>
13653 If you publish or distribute Opaque copies of the Document numbering more
13654 than 100, you must either include a machine-readable Transparent copy
13655 along with each Opaque copy, or state in or with each Opaque copy a
13656 computer-network location from which the general network-using public has
13657 access to download using public-standard network protocols a complete
13658 Transparent copy of the Document, free of added material. If you use the
13659 latter option, you must take reasonably prudent steps, when you begin
13660 distribution of Opaque copies in quantity, to ensure that this Transparent
13661 copy will remain thus accessible at the stated location until at least one
13662 year after the last time you distribute an Opaque copy (directly or
13663 through your agents or retailers) of that edition to the public.
13664 </p><p>
13665 It is requested, but not required, that you contact the authors of the
13666 Document well before redistributing any large number of copies, to give
13667 them a chance to provide you with an updated version of the Document.
13668 </p><h3><a id="section4"></a>
13669 4. MODIFICATIONS
13670 </h3><p>
13671 You may copy and distribute a Modified Version of the Document under the
13672 conditions of sections 2 and 3 above, provided that you release the
13673 Modified Version under precisely this License, with the Modified Version
13674 filling the role of the Document, thus licensing distribution and
13675 modification of the Modified Version to whoever possesses a copy of it. In
13676 addition, you must do these things in the Modified Version:
13677 </p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem">
13678 Use in the Title Page (and on the covers, if any) a title distinct
13679 from that of the Document, and from those of previous versions (which
13680 should, if there were any, be listed in the History section of the
13681 Document). You may use the same title as a previous version if the
13682 original publisher of that version gives permission.
13683 </li><li class="listitem">
13684 List on the Title Page, as authors, one or more persons or entities
13685 responsible for authorship of the modifications in the Modified
13686 Version, together with at least five of the principal authors of the
13687 Document (all of its principal authors, if it has fewer than five),
13688 unless they release you from this requirement.
13689 </li><li class="listitem">
13690 State on the Title page the name of the publisher of the Modified
13691 Version, as the publisher.
13692 </li><li class="listitem">
13693 Preserve all the copyright notices of the Document.
13694 </li><li class="listitem">
13695 Add an appropriate copyright notice for your modifications adjacent to
13696 the other copyright notices.
13697 </li><li class="listitem">
13698 Include, immediately after the copyright notices, a license notice
13699 giving the public permission to use the Modified Version under the
13700 terms of this License, in the form shown in the Addendum below.
13701 </li><li class="listitem">
13702 Preserve in that license notice the full lists of Invariant Sections
13703 and required Cover Texts given in the Document’s license
13704 notice.
13705 </li><li class="listitem">
13706 Include an unaltered copy of this License.
13707 </li><li class="listitem">
13708 Preserve the section Entitled “History”, Preserve its
13709 Title, and add to it an item stating at least the title, year, new
13710 authors, and publisher of the Modified Version as given on the Title
13711 Page. If there is no section Entitled “History” in the
13712 Document, create one stating the title, year, authors, and publisher
13713 of the Document as given on its Title Page, then add an item
13714 describing the Modified Version as stated in the previous sentence.
13715 </li><li class="listitem">
13716 Preserve the network location, if any, given in the Document for
13717 public access to a Transparent copy of the Document, and likewise the
13718 network locations given in the Document for previous versions it was
13719 based on. These may be placed in the “History”
13720 section. You may omit a network location for a work that was published
13721 at least four years before the Document itself, or if the original
13722 publisher of the version it refers to gives permission.
13723 </li><li class="listitem">
13724 For any section Entitled “Acknowledgements” or
13725 “Dedications”, Preserve the Title of the section, and
13726 preserve in the section all the substance and tone of each of the
13727 contributor acknowledgements and/or dedications given therein.
13728 </li><li class="listitem">
13729 Preserve all the Invariant Sections of the Document, unaltered in
13730 their text and in their titles. Section numbers or the equivalent are
13731 not considered part of the section titles.
13732 </li><li class="listitem">
13733 Delete any section Entitled “Endorsements”. Such a section
13734 may not be included in the Modified Version.
13735 </li><li class="listitem">
13736 Do not retitle any existing section to be Entitled
13737 “Endorsements” or to conflict in title with any Invariant
13738 Section.
13739 </li><li class="listitem">
13740 Preserve any Warranty Disclaimers.
13741 </li></ol></div><p>
13742 If the Modified Version includes new front-matter sections or appendices
13743 that qualify as Secondary Sections and contain no material copied from the
13744 Document, you may at your option designate some or all of these sections
13745 as invariant. To do this, add their titles to the list of Invariant
13746 Sections in the Modified Version’s license notice. These titles
13747 must be distinct from any other section titles.
13748 </p><p>
13749 You may add a section Entitled “Endorsements”, provided it
13750 contains nothing but endorsements of your Modified Version by various
13751 parties — for example, statements of peer review or that the text
13752 has been approved by an organization as the authoritative definition of a
13753 standard.
13754 </p><p>
13755 You may add a passage of up to five words as a Front-Cover Text, and a
13756 passage of up to 25 words as a Back-Cover Text, to the end of the list of
13757 Cover Texts in the Modified Version. Only one passage of Front-Cover Text
13758 and one of Back-Cover Text may be added by (or through arrangements made
13759 by) any one entity. If the Document already includes a cover text for the
13760 same cover, previously added by you or by arrangement made by the same
13761 entity you are acting on behalf of, you may not add another; but you may
13762 replace the old one, on explicit permission from the previous publisher
13763 that added the old one.
13764 </p><p>
13765 The author(s) and publisher(s) of the Document do not by this License give
13766 permission to use their names for publicity for or to assert or imply
13767 endorsement of any Modified Version.
13768 </p><h3><a id="section5"></a>
13769 5. COMBINING DOCUMENTS
13770 </h3><p>
13771 You may combine the Document with other documents released under this
13772 License, under the terms defined in section 4 above for modified versions,
13773 provided that you include in the combination all of the Invariant Sections
13774 of all of the original documents, unmodified, and list them all as
13775 Invariant Sections of your combined work in its license notice, and that
13776 you preserve all their Warranty Disclaimers.
13777 </p><p>
13778 The combined work need only contain one copy of this License, and multiple
13779 identical Invariant Sections may be replaced with a single copy. If there
13780 are multiple Invariant Sections with the same name but different contents,
13781 make the title of each such section unique by adding at the end of it, in
13782 parentheses, the name of the original author or publisher of that section
13783 if known, or else a unique number. Make the same adjustment to the section
13784 titles in the list of Invariant Sections in the license notice of the
13785 combined work.
13786 </p><p>
13787 In the combination, you must combine any sections Entitled
13788 “History” in the various original documents, forming one
13789 section Entitled “History”; likewise combine any sections
13790 Entitled “Acknowledgements”, and any sections Entitled
13791 “Dedications”. You must delete all sections Entitled
13792 “Endorsements”.
13793 </p><h3><a id="section6"></a>
13794 6. COLLECTIONS OF DOCUMENTS
13795 </h3><p>
13796 You may make a collection consisting of the Document and other documents
13797 released under this License, and replace the individual copies of this
13798 License in the various documents with a single copy that is included in
13799 the collection, provided that you follow the rules of this License for
13800 verbatim copying of each of the documents in all other respects.
13801 </p><p>
13802 You may extract a single document from such a collection, and distribute
13803 it individually under this License, provided you insert a copy of this
13804 License into the extracted document, and follow this License in all other
13805 respects regarding verbatim copying of that document.
13806 </p><h3><a id="section7"></a>
13807 7. AGGREGATION WITH INDEPENDENT WORKS
13808 </h3><p>
13809 A compilation of the Document or its derivatives with other separate and
13810 independent documents or works, in or on a volume of a storage or
13811 distribution medium, is called an “aggregate” if the copyright
13812 resulting from the compilation is not used to limit the legal rights of
13813 the compilation’s users beyond what the individual works
13814 permit. When the Document is included in an aggregate, this License does
13815 not apply to the other works in the aggregate which are not themselves
13816 derivative works of the Document.
13817 </p><p>
13818 If the Cover Text requirement of section 3 is applicable to these copies
13819 of the Document, then if the Document is less than one half of the entire
13820 aggregate, the Document’s Cover Texts may be placed on covers that
13821 bracket the Document within the aggregate, or the electronic equivalent of
13822 covers if the Document is in electronic form. Otherwise they must appear
13823 on printed covers that bracket the whole aggregate.
13824 </p><h3><a id="section8"></a>
13825 8. TRANSLATION
13826 </h3><p>
13827 Translation is considered a kind of modification, so you may distribute
13828 translations of the Document under the terms of section 4. Replacing
13829 Invariant Sections with translations requires special permission from
13830 their copyright holders, but you may include translations of some or all
13831 Invariant Sections in addition to the original versions of these Invariant
13832 Sections. You may include a translation of this License, and all the
13833 license notices in the Document, and any Warranty Disclaimers, provided
13834 that you also include the original English version of this License and the
13835 original versions of those notices and disclaimers. In case of a
13836 disagreement between the translation and the original version of this
13837 License or a notice or disclaimer, the original version will prevail.
13838 </p><p>
13839 If a section in the Document is Entitled “Acknowledgements”,
13840 “Dedications”, or “History”, the requirement
13841 (section 4) to Preserve its Title (section 1) will typically require
13842 changing the actual title.
13843 </p><h3><a id="section9"></a>
13844 9. TERMINATION
13845 </h3><p>
13846 You may not copy, modify, sublicense, or distribute the Document except as
13847 expressly provided under this License. Any attempt otherwise to copy,
13848 modify, sublicense, or distribute it is void, and will automatically
13849 terminate your rights under this License.
13850 </p><p>
13851 However, if you cease all violation of this License, then your license
13852 from a particular copyright holder is reinstated (a) provisionally, unless
13853 and until the copyright holder explicitly and finally terminates your
13854 license, and (b) permanently, if the copyright holder fails to notify you
13855 of the violation by some reasonable means prior to 60 days after the
13856 cessation.
13857 </p><p>
13858 Moreover, your license from a particular copyright holder is reinstated
13859 permanently if the copyright holder notifies you of the violation by some
13860 reasonable means, this is the first time you have received notice of
13861 violation of this License (for any work) from that copyright holder, and
13862 you cure the violation prior to 30 days after your receipt of the notice.
13863 </p><p>
13864 Termination of your rights under this section does not terminate the
13865 licenses of parties who have received copies or rights from you under this
13866 License. If your rights have been terminated and not permanently
13867 reinstated, receipt of a copy of some or all of the same material does not
13868 give you any rights to use it.
13869 </p><h3><a id="section10"></a>
13870 10. FUTURE REVISIONS OF THIS LICENSE
13871 </h3><p>
13872 The Free Software Foundation may publish new, revised versions of the GNU
13873 Free Documentation License from time to time. Such new versions will be
13874 similar in spirit to the present version, but may differ in detail to
13875 address new problems or concerns. See
13876 <a class="ulink" href="https://www.gnu.org/licenses/" target="_top">https://www.gnu.org/licenses/</a>.
13877 </p><p>
13878 Each version of the License is given a distinguishing version number. If
13879 the Document specifies that a particular numbered version of this License
13880 “or any later version” applies to it, you have the option of
13881 following the terms and conditions either of that specified version or of
13882 any later version that has been published (not as a draft) by the Free
13883 Software Foundation. If the Document does not specify a version number of
13884 this License, you may choose any version ever published (not as a draft)
13885 by the Free Software Foundation. If the Document specifies that a proxy
13886 can decide which future versions of this License can be used, that
13887 proxy’s public statement of acceptance of a version permanently
13888 authorizes you to choose that version for the Document.
13889 </p><h3><a id="section11"></a>
13890 11. RELICENSING
13891 </h3><p>
13892 “Massive Multiauthor Collaboration Site” (or “MMC
13893 Site”) means any World Wide Web server that publishes copyrightable
13894 works and also provides prominent facilities for anybody to edit those
13895 works. A public wiki that anybody can edit is an example of such a
13896 server. A “Massive Multiauthor Collaboration” (or
13897 “MMC”) contained in the site means any set of copyrightable
13898 works thus published on the MMC site.
13899 </p><p>
13900 “CC-BY-SA” means the Creative Commons Attribution-Share Alike
13901 3.0 license published by Creative Commons Corporation, a not-for-profit
13902 corporation with a principal place of business in San Francisco,
13903 California, as well as future copyleft versions of that license published
13904 by that same organization.
13905 </p><p>
13906 “Incorporate” means to publish or republish a Document, in
13907 whole or in part, as part of another Document.
13908 </p><p>
13909 An MMC is “eligible for relicensing” if it is licensed under
13910 this License, and if all works that were first published under this
13911 License somewhere other than this MMC, and subsequently incorporated in
13912 whole or in part into the MMC, (1) had no cover texts or invariant
13913 sections, and (2) were thus incorporated prior to November 1, 2008.
13914 </p><p>
13915 The operator of an MMC Site may republish an MMC contained in the site
13916 under CC-BY-SA on the same site at any time before August 1, 2009,
13917 provided the MMC is eligible for relicensing.
13918 </p><h3><a id="addendum"></a>
13919 ADDENDUM: How to use this License for your documents
13920 </h3><p>
13921 To use this License in a document you have written, include a copy of the
13922 License in the document and put the following copyright and license
13923 notices just after the title page:
13924 </p><pre class="screen">Copyright © YEAR YOUR NAME
13925
13926 Permission is granted to copy, distribute and/or modify this document under the
13927 terms of the GNU Free Documentation License, Version 1.3 or any later version
13928 published by the Free Software Foundation; with no Invariant Sections, no
13929 Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
13930 the section entitled “GNU Free Documentation License”.</pre><p>
13931 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
13932 replace the “with… Texts.” line with this:
13933 </p><pre class="screen">with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
13934 being LIST, and with the Back-Cover Texts being LIST.</pre><p>
13935 If you have Invariant Sections without Cover Texts, or some other
13936 combination of the three, merge those two alternatives to suit the
13937 situation.
13938 </p><p>
13939 If your document contains nontrivial examples of program code, we
13940 recommend releasing these examples in parallel under your choice of free
13941 software license, such as the GNU General Public License, to permit their
13942 use in free software.
13943 </p></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="gpl"></a>Appendix C. GNU General Public License</h2></div><div><p class="releaseinfo">Version 2, June 1991</p></div><div><p class="copyright">Copyright © 1989, 1991 Free Software Foundation, Inc.</p></div><div><div class="legalnotice"><a id="gpl-legalnotice"></a><p>
13944 Free Software Foundation, Inc.
13945 <a class="ulink" href="https://fsf.org/" target="_top">https://fsf.org/</a>.
13946 </p><p>Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p></div></div><div><p class="pubdate">Version 2, June 1991</p></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-1"></a>C.1. Preamble</h2></div></div></div><p>The licenses for most software are designed to take away your
13947 freedom to share and change it. By contrast, the GNU General Public License is
13948 intended to guarantee your freedom to share and change
13949 free software - to make sure the software is free for all its users.
13950 This General Public License applies to most of the Free Software
13951 Foundation's software and to any other program whose authors commit
13952 to using it. (Some other Free Software Foundation software is covered
13953 by the GNU Library General Public License instead.) You can apply it
13954 to your programs, too.</p><p>When we speak of free software, we are referring to freedom, not price.
13955 Our General Public Licenses are designed to make sure that you have the
13956 freedom to distribute copies of free software (and charge for this
13957 service if you wish), that you receive source code or can get it if you
13958 want it, that you can change the software or use pieces of it in new free
13959 programs; and that you know you can do these things.</p><p>To protect your rights, we need to make restrictions that forbid anyone
13960 to deny you these rights or to ask you to surrender the rights. These
13961 restrictions translate to certain responsibilities for you if you distribute
13962 copies of the software, or if you modify it.</p><p>For example, if you distribute copies of such a program, whether gratis or
13963 for a fee, you must give the recipients all the rights that you have. You
13964 must make sure that they, too, receive or can get the source code. And you
13965 must show them these terms so they know their rights.</p><p>We protect your rights with two steps:
13966 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>copyright the software, and</p></li><li class="listitem"><p>offer you this license which gives you legal permission to copy,
13967 distribute and/or modify the software.</p></li></ol></div><p>
13968 </p><p>Also, for each author's protection and ours, we want to make certain that
13969 everyone understands that there is no warranty for this free software. If
13970 the software is modified by someone else and passed on, we want its
13971 recipients to know that what they have is not the original, so that any
13972 problems introduced by others will not reflect on the original authors'
13973 reputations.</p><p>Finally, any free program is threatened constantly by software patents.
13974 We wish to avoid the danger that redistributors of a free program will
13975 individually obtain patent licenses, in effect making the program
13976 proprietary. To prevent this, we have made it clear that any patent must be
13977 licensed for everyone's free use or not licensed at all.</p><p>The precise terms and conditions for copying, distribution and modification
13978 follow.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-2"></a>C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-0"></a>C.2.1. Section 0</h3></div></div></div><p>This License applies to any program or other work which contains a notice
13979 placed by the copyright holder saying it may be distributed under the terms
13980 of this General Public License. The <span class="quote">“<span class="quote">Program</span>”</span>, below, refers to any such
13981 program or work, and a
13982 <span class="quote">“<span class="quote">work based on the Program</span>”</span> means either
13983 the Program or any derivative work under copyright law: that is to say, a
13984 work containing the Program or a portion of it, either verbatim or with
13985 modifications and/or translated into another language. (Hereinafter, translation
13986 is included without limitation in the term
13987 <span class="quote">“<span class="quote">modification</span>”</span>.) Each licensee is addressed as <span class="quote">“<span class="quote">you</span>”</span>.</p><p>Activities other than copying, distribution and modification are not covered by
13988 this License; they are outside its scope. The act of running the Program is not
13989 restricted, and the output from the Program is covered only if its contents
13990 constitute a work based on the Program (independent of having been made by running
13991 the Program). Whether that is true depends on what the Program does.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-1"></a>C.2.2. Section 1</h3></div></div></div><p>You may copy and distribute verbatim copies of the Program's source code as you
13992 receive it, in any medium, provided that you conspicuously and appropriately
13993 publish on each copy an appropriate copyright notice and disclaimer of warranty;
13994 keep intact all the notices that refer to this License and to the absence of any
13995 warranty; and give any other recipients of the Program a copy of this License
13996 along with the Program.</p><p>You may charge a fee for the physical act of transferring a copy, and you may at
13997 your option offer warranty protection in exchange for a fee.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-2"></a>C.2.3. Section 2</h3></div></div></div><p>You may modify your copy or copies of the Program or any portion of it, thus
13998 forming a work based on the Program, and copy and distribute such modifications
13999 or work under the terms of
14000 <a class="link" href="#gpl-2-1" title="C.2.2. Section 1">Section 1</a> above, provided
14001 that you also meet all of these conditions:
14002 </p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>You must cause the modified files to carry prominent notices stating that
14003 you changed the files and the date of any change.</p></li><li class="listitem"><p>You must cause any work that you distribute or publish, that in whole or
14004 in part contains or is derived from the Program or any part thereof, to be
14005 licensed as a whole at no charge to all third parties under the terms of
14006 this License.</p></li><li class="listitem"><p>If the modified program normally reads commands interactively when run, you
14007 must cause it, when started running for such interactive use in the most
14008 ordinary way, to print or display an announcement including an appropriate
14009 copyright notice and a notice that there is no warranty (or else, saying
14010 that you provide a warranty) and that users may redistribute the program
14011 under these conditions, and telling the user how to view a copy of this
14012 License. (Exception: If the Program itself is interactive but does not
14013 normally print such an announcement, your work based on the Program is not
14014 required to print an announcement.)</p></li></ol></div><p>
14015 </p><p>These requirements apply to the modified work as a whole. If identifiable sections
14016 of that work are not derived from the Program, and can be reasonably considered
14017 independent and separate works in themselves, then this License, and its terms,
14018 do not apply to those sections when you distribute them as separate works. But when
14019 you distribute the same sections as part of a whole which is a work based on the
14020 Program, the distribution of the whole must be on the terms of this License, whose
14021 permissions for other licensees extend to the entire whole, and thus to each and
14022 every part regardless of who wrote it.</p><p>Thus, it is not the intent of this section to claim rights or contest your rights
14023 to work written entirely by you; rather, the intent is to exercise the right to control
14024 the distribution of derivative or collective works based on the Program.</p><p>In addition, mere aggregation of another work not based on the Program with the Program
14025 (or with a work based on the Program) on a volume of a storage or distribution medium
14026 does not bring the other work under the scope of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-3"></a>C.2.4. Section 3</h3></div></div></div><p>You may copy and distribute the Program (or a work based on it, under
14027 <a class="link" href="#gpl-2-2" title="C.2.3. Section 2">Section 2</a> in object code or executable form under the terms of
14028 <a class="link" href="#gpl-2-1" title="C.2.2. Section 1">Sections 1</a> and
14029 <a class="link" href="#gpl-2-2" title="C.2.3. Section 2">2</a> above provided that you also do one of the following:
14030 </p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>Accompany it with the complete corresponding machine-readable source code, which
14031 must be distributed under the terms of Sections 1 and 2 above on a medium
14032 customarily used for software interchange; or,</p></li><li class="listitem"><p>Accompany it with a written offer, valid for at least three years, to give any
14033 third party, for a charge no more than your cost of physically performing source
14034 distribution, a complete machine-readable copy of the corresponding source code,
14035 to be distributed under the terms of Sections 1 and 2 above on a medium customarily
14036 used for software interchange; or,</p></li><li class="listitem"><p>Accompany it with the information you received as to the offer to distribute
14037 corresponding source code. (This alternative is allowed only for noncommercial
14038 distribution and only if you received the program in object code or executable form
14039 with such an offer, in accord with Subsection b above.)</p></li></ol></div><p>
14040 </p><p>The source code for a work means the preferred form of the work for making modifications
14041 to it. For an executable work, complete source code means all the source code for all modules
14042 it contains, plus any associated interface definition files, plus the scripts used to control
14043 compilation and installation of the executable. However, as a special exception, the source
14044 code distributed need not include anything that is normally distributed (in either source or
14045 binary form) with the major components (compiler, kernel, and so on) of the operating system
14046 on which the executable runs, unless that component itself accompanies the executable.</p><p>If distribution of executable or object code is made by offering access to copy from a
14047 designated place, then offering equivalent access to copy the source code from the same place
14048 counts as distribution of the source code, even though third parties are not compelled to
14049 copy the source along with the object code.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-4"></a>C.2.5. Section 4</h3></div></div></div><p>You may not copy, modify, sublicense, or distribute the Program except as expressly provided
14050 under this License. Any attempt otherwise to copy, modify, sublicense or distribute the
14051 Program is void, and will automatically terminate your rights under this License. However,
14052 parties who have received copies, or rights, from you under this License will not have their
14053 licenses terminated so long as such parties remain in full compliance.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-5"></a>C.2.6. Section 5</h3></div></div></div><p>You are not required to accept this License, since you have not signed it. However, nothing
14054 else grants you permission to modify or distribute the Program or its derivative works.
14055 These actions are prohibited by law if you do not accept this License. Therefore, by modifying
14056 or distributing the Program (or any work based on the Program), you indicate your acceptance
14057 of this License to do so, and all its terms and conditions for copying, distributing or
14058 modifying the Program or works based on it.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-6"></a>C.2.7. Section 6</h3></div></div></div><p>Each time you redistribute the Program (or any work based on the Program), the recipient
14059 automatically receives a license from the original licensor to copy, distribute or modify
14060 the Program subject to these terms and conditions. You may not impose any further restrictions
14061 on the recipients' exercise of the rights granted herein. You are not responsible for enforcing
14062 compliance by third parties to this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-7"></a>C.2.8. Section 7</h3></div></div></div><p>If, as a consequence of a court judgment or allegation of patent infringement or for any other
14063 reason (not limited to patent issues), conditions are imposed on you (whether by court order,
14064 agreement or otherwise) that contradict the conditions of this License, they do not excuse you
14065 from the conditions of this License. If you cannot distribute so as to satisfy simultaneously
14066 your obligations under this License and any other pertinent obligations, then as a consequence
14067 you may not distribute the Program at all. For example, if a patent license would not permit
14068 royalty-free redistribution of the Program by all those who receive copies directly or
14069 indirectly through you, then the only way you could satisfy both it and this License would be
14070 to refrain entirely from distribution of the Program.</p><p>If any portion of this section is held invalid or unenforceable under any particular circumstance,
14071 the balance of the section is intended to apply and the section as a whole is intended to apply
14072 in other circumstances.</p><p>It is not the purpose of this section to induce you to infringe any patents or other property
14073 right claims or to contest validity of any such claims; this section has the sole purpose of
14074 protecting the integrity of the free software distribution system, which is implemented by public
14075 license practices. Many people have made generous contributions to the wide range of software
14076 distributed through that system in reliance on consistent application of that system; it is up
14077 to the author/donor to decide if he or she is willing to distribute software through any other
14078 system and a licensee cannot impose that choice.</p><p>This section is intended to make thoroughly clear what is believed to be a consequence of the
14079 rest of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-8"></a>C.2.9. Section 8</h3></div></div></div><p>If the distribution and/or use of the Program is restricted in certain countries either by patents
14080 or by copyrighted interfaces, the original copyright holder who places the Program under this License
14081 may add an explicit geographical distribution limitation excluding those countries, so that
14082 distribution is permitted only in or among countries not thus excluded. In such case, this License
14083 incorporates the limitation as if written in the body of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-9"></a>C.2.10. Section 9</h3></div></div></div><p>The Free Software Foundation may publish revised and/or new versions of the General Public License
14084 from time to time. Such new versions will be similar in spirit to the present version, but may differ
14085 in detail to address new problems or concerns.</p><p>Each version is given a distinguishing version number. If the Program specifies a version number of
14086 this License which applies to it and <span class="quote">“<span class="quote">any later version</span>”</span>, you have the option of following the terms
14087 and conditions either of that version or of any later version published by the Free Software
14088 Foundation. If the Program does not specify a version number of this License, you may choose any
14089 version ever published by the Free Software Foundation.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-10"></a>C.2.11. Section 10</h3></div></div></div><p>If you wish to incorporate parts of the Program into other free programs whose distribution
14090 conditions are different, write to the author to ask for permission. For software which is copyrighted
14091 by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions
14092 for this. Our decision will be guided by the two goals of preserving the free status of all
14093 derivatives of our free software and of promoting the sharing and reuse of software generally.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-11"></a>C.2.12. NO WARRANTY Section 11</h3></div></div></div><p>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
14094 PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
14095 OTHER PARTIES PROVIDE THE PROGRAM <span class="quote">“<span class="quote">AS IS</span>”</span> WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
14096 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
14097 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
14098 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-12"></a>C.2.13. Section 12</h3></div></div></div><p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
14099 ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
14100 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
14101 USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
14102 INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
14103 ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
14104 DAMAGES.</p><p>END OF TERMS AND CONDITIONS</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-3"></a>C.3. How to Apply These Terms to Your New Programs</h2></div></div></div><p>If you develop a new program, and you want it to be of the greatest
14105 possible use to the public, the best way to achieve this is to make it
14106 free software which everyone can redistribute and change under these terms.</p><p>To do so, attach the following notices to the program. It is safest
14107 to attach them to the start of each source file to most effectively
14108 convey the exclusion of warranty; and each file should have at least
14109 the <span class="quote">“<span class="quote">copyright</span>”</span> line and a pointer to where the full notice is found.</p><p>&lt;one line to give the program's name and a brief idea of what it does.&gt;
14110 Copyright (C) &lt;year&gt; &lt;name of author&gt;</p><p>This program is free software; you can redistribute it and/or modify
14111 it under the terms of the GNU General Public License as published by
14112 the Free Software Foundation; either version 2 of the License, or
14113 (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful,
14114 but WITHOUT ANY WARRANTY; without even the implied warranty of
14115 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14116 GNU General Public License for more details.</p><p>You should have received a copy of the GNU General Public License
14117 along with this program; if not, see <a class="ulink" href="https://www.gnu.org/licenses/" target="_top">https://www.gnu.org/licenses/</a>.</p><p>Also add information on how to contact you by electronic and paper mail.</p><p>If the program is interactive, make it output a short notice like this
14118 when it starts in an interactive mode:</p><p>Gnomovision version 69, Copyright (C) year name of author
14119 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type <span class="quote">“<span class="quote">show w</span>”</span>.
14120 This is free software, and you are welcome to redistribute it
14121 under certain conditions; type <span class="quote">“<span class="quote">show c</span>”</span> for details.</p><p>The hypothetical commands <span class="quote">“<span class="quote">show w</span>”</span> and <span class="quote">“<span class="quote">show c</span>”</span> should
14122 show the appropriate parts of the General Public License. Of course, the commands you
14123 use may be called something other than <span class="quote">“<span class="quote">show w</span>”</span> and <span class="quote">“<span class="quote">show c</span>”</span>;
14124 they could even be mouse-clicks or menu items--whatever suits your program.</p><p>You should also get your employer (if you work as a programmer) or your
14125 school, if any, to sign a <span class="quote">“<span class="quote">copyright disclaimer</span>”</span> for the program, if
14126 necessary. Here is a sample; alter the names:</p><p>Yoyodyne, Inc., hereby disclaims all copyright interest in the program
14127 <span class="quote">“<span class="quote">Gnomovision</span>”</span> (which makes passes at compilers) written by James Hacker.</p><p>&lt;signature of Moe Ghoul&gt;, 1 April 1989
14128 Moe Ghoul, President of Vice</p><p>This General Public License does not permit incorporating your program into
14129 proprietary programs. If your program is a subroutine library, you may
14130 consider it more useful to permit linking proprietary applications with the
14131 library. If this is what you want to do, use the GNU Library General
14132 Public License instead of this License.</p></div></div></div><div class="index"><div class="titlepage"><div><div><h1 class="title"><a id="idx"></a>Index</h1></div></div></div><div xmlns:xlink="http://www.w3.org/1999/xlink" class="index"><div class="indexdiv"><h3>Symbols</h3><dl><dt id="ientry-idm12947">*COMPILE-WARNINGS*, <a class="indexterm" href="#compile-warn">Function COMPILE-FILE</a></dt><dt id="ientry-idm13399">*COMPILED-FILE-TYPES*, <a class="indexterm" href="#compiled-types">Function LOAD</a></dt><dt id="ientry-idm27989">*CURRENT-LANGUAGE*
14133 , <a class="indexterm" href="#curr-lang">The Language</a></dt><dt id="ientry-idm14703">*EDITOR*, <a class="indexterm" href="#editor">Function ED</a></dt><dt id="ientry-idm8294">*EQ-HASHFUNCTION*, <a class="indexterm" href="#eq-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm8316">*EQL-HASHFUNCTION*, <a class="indexterm" href="#eql-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm8326">*EQUAL-HASHFUNCTION*, <a class="indexterm" href="#equal-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm29128">*FOREIGN-ENCODING*
14134 , <a class="indexterm" href="#foreign-enc">Default encodings</a></dt><dt id="ientry-idm17801">*FORWARD-REFERENCED-CLASS-MISDESIGN*, <a class="indexterm" href="#frc-bad">Inheritance Structure of Metaobject Classes</a></dt><dt id="ientry-idm14646">*INSPECT-LENGTH*, <a class="indexterm" href="#inspect-length">Function INSPECT</a></dt><dt id="ientry-idm13377">*LOAD-COMPILING*, <a class="indexterm" href="#load-comp">Function LOAD</a></dt><dt id="ientry-idm13361">*LOAD-ECHO*, <a class="indexterm" href="#load-echo">Function LOAD</a></dt><dt id="ientry-idm13466">*LOAD-OBSOLETE-ACTION*, <a class="indexterm" href="#load-obs">Function LOAD</a></dt><dt id="ientry-idm29116">*MISC-ENCODING*
14135 , <a class="indexterm" href="#misc-enc">Default encodings</a></dt><dt id="ientry-idm29036">*PATHNAME-ENCODING*
14136 , <a class="indexterm" href="#path-enc">Default encodings</a></dt><dt id="ientry-idm13393">*SOURCE-FILE-TYPES*, <a class="indexterm" href="#source-types">Function LOAD</a></dt><dt id="ientry-idm29104">*TERMINAL-ENCODING*
14137 , <a class="indexterm" href="#term-enc">Default encodings</a></dt><dt id="ientry-idm8441">*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*, <a class="indexterm" href="#hashtable-gc-rehash-warn">Interaction between HASH-TABLEs and garbage-collection</a></dt><dt id="ientry-idm31217">*WINDOW*
14138 , <a class="indexterm" href="#scr-win">Random Screen Access</a></dt></dl></div><div class="indexdiv"><h3>C</h3><dl><dt id="ientry-idm32998">callback, <a class="indexterm" href="#def-call-in-callback">Overview</a>, <a class="indexterm" href="#def-call-in-callback-main">Foreign functions</a></dt><dt id="ientry-idm17917">class</dt><dd><dl><dt>anonymous, <a class="indexterm" href="#class-anonymous">Initialization of Anonymous Classes</a></dt><dt>finalization, <a class="indexterm" href="#class-finalization">Class Finalization Protocol</a></dt><dt>interposed, <a class="indexterm" href="#class-interposed">Implementation and User Specialization</a></dt></dl></dd></dl></div><div class="indexdiv"><h3>D</h3><dl><dt id="ientry-idm34885">DEFAULT-FOREIGN-LANGUAGE
14139 , <a class="indexterm" href="#dflt-ffi-lang">The choice of the C flavor</a></dt><dt id="ientry-idm28024">DEFINTERNATIONAL
14140 , <a class="indexterm" href="#def-i-l">The Language</a></dt><dt id="ientry-idm28009">DEFLANGUAGE, <a class="indexterm" href="#deflang">The Language</a></dt><dt id="ientry-idm28039">DEFLOCALIZED, <a class="indexterm" href="#defloc">The Language</a></dt></dl></div><div class="indexdiv"><h3>E</h3><dl><dt id="ientry-idm10514">endianness, <a class="indexterm" href="#endianness-i">Binary input, READ-BYTE, EXT:READ-INTEGER &amp; EXT:READ-FLOAT</a></dt></dl></div><div class="indexdiv"><h3>F</h3><dl><dt id="ientry-idm1793">final delimiter, <a class="indexterm" href="#fin-delim">Special Symbols sec_1-4-1-3</a></dt><dt id="ientry-idm32585">foreign function, <a class="indexterm" href="#dffi-ff">Introduction</a></dt><dd><dl><dt>anonymous, <a class="indexterm" href="#dffi-ff-a">Foreign functions</a></dt><dt>call-in, <a class="indexterm" href="#dffi-ff-call-in">Foreign functions</a></dt><dt>call-out, <a class="indexterm" href="#dffi-ff-call-out">Foreign functions</a></dt><dt>named, <a class="indexterm" href="#dffi-ff-n">Foreign functions</a></dt></dl></dd><dt id="ientry-idm34894">foreign
14141 variable, <a class="indexterm" href="#dffi-fv">Foreign variables</a></dt><dt id="ientry-idm12654">FORMAT</dt><dd><dl><dt>~!, <a class="indexterm" href="#format-bang">Formatted Output sec_22-3</a></dt><dt>~., <a class="indexterm" href="#format-dot">Formatted Output sec_22-3</a></dt></dl></dd></dl></div><div class="indexdiv"><h3>G</h3><dl><dt id="ientry-idm15046">GC, <a class="indexterm" href="#gc-func">Function EXT:GC
14142 </a></dt><dt id="ientry-idm3422">GENERIC-FLET, <a class="indexterm" href="#gen-flet">Deviations from ANSI CL standard</a></dt><dt id="ientry-idm3427">GENERIC-LABELS, <a class="indexterm" href="#gen-labels">Deviations from ANSI CL standard</a></dt></dl></div><div class="indexdiv"><h3>L</h3><dl><dt id="ientry-idm31424">linking set, <a class="indexterm" href="#linkseti">Linking Set</a></dt><dt id="ientry-idm28051">LOCALIZED, <a class="indexterm" href="#localized">The Language</a></dt></dl></div><div class="indexdiv"><h3>M</h3><dl><dt id="ientry-idm12052">MAKE-BUFFERED-INPUT-STREAM, <a class="indexterm" href="#stream-buffer-i">Functions EXT:MAKE-BUFFERED-INPUT-STREAM
14143 and EXT:MAKE-BUFFERED-OUTPUT-STREAM
14144 </a></dt><dt id="ientry-idm12056">MAKE-BUFFERED-OUTPUT-STREAM, <a class="indexterm" href="#stream-buffer-o">Functions EXT:MAKE-BUFFERED-INPUT-STREAM
14145 and EXT:MAKE-BUFFERED-OUTPUT-STREAM
14146 </a></dt><dt id="ientry-idm17214">metaobject, <a class="indexterm" href="#mop-mo">Metaobjects</a></dt><dd><dl><dt>class, <a class="indexterm" href="#mop-class-mo">Classes</a></dt><dt>generic function, <a class="indexterm" href="#mop-gen-fun-mo">Generic Functions</a></dt><dt>implementation-specific, <a class="indexterm" href="#mo-impl">Implementation and User Specialization</a></dt><dt>method, <a class="indexterm" href="#mop-method-mo">Methods</a></dt><dt>method combination, <a class="indexterm" href="#mop-meth-comp-mo">Method Combinations</a></dt><dt>portable, <a class="indexterm" href="#mo-portable">Implementation and User Specialization</a></dt><dt>slot definition, <a class="indexterm" href="#mop-slot-def-mo">Slot Definitions</a></dt><dd><dl><dt>direct, <a class="indexterm" href="#mop-dsd-mo">Slot Definitions</a></dt><dt>effective, <a class="indexterm" href="#mop-esd-mo">Slot Definitions</a></dt></dl></dd><dt>specializer, <a class="indexterm" href="#spec-mo">Specializers</a></dt><dt>specified, <a class="indexterm" href="#mo-specified">Implementation and User Specialization</a></dt><dt>standard, <a class="indexterm" href="#std-mo">Inheritance Structure of Metaobject Classes</a></dt></dl></dd><dt id="ientry-idm17195">metaobject class, <a class="indexterm" href="#mo-cl">Metaobjects</a></dt><dd><dl><dt>basic, <a class="indexterm" href="#mop-ba-mo-cl">Metaobjects</a></dt></dl></dd><dt id="ientry-idm17932">method</dt><dd><dl><dt>effective, <a class="indexterm" href="#effective-method">Generic Function Invocation Protocol</a></dt><dt>extends, <a class="indexterm" href="#method-extends">Implementation and User Specialization</a></dt><dt>function, <a class="indexterm" href="#me-func">Generic Function Invocation Protocol</a>, <a class="indexterm" href="#method-lambda">Processing Method Bodies</a></dt><dt>overrides, <a class="indexterm" href="#method-overrides">Implementation and User Specialization</a></dt><dt>promoted, <a class="indexterm" href="#method-promoted">Implementation and User Specialization</a></dt><dt>specialized, <a class="indexterm" href="#method-specialized">Implementation and User Specialization</a></dt></dl></dd><dt id="ientry-idm4077">METHOD-CALL-ERROR, <a class="indexterm" href="#meth-call-err">Standard Method Combination sec_7-6-6-2</a></dt><dt id="ientry-idm4092">METHOD-CALL-TYPE-ERROR, <a class="indexterm" href="#meth-call-type-err">Standard Method Combination sec_7-6-6-2</a></dt><dt id="ientry-idm31369">module, <a class="indexterm" href="#module">Module Set</a></dt><dd><dl><dt>name, <a class="indexterm" href="#module-name">Module Set</a></dt></dl></dd><dt id="ientry-idm31381">module set, <a class="indexterm" href="#modseti">Module Set</a></dt></dl></div><div class="indexdiv"><h3>N</h3><dl><dt id="ientry-idm4058">NO-PRIMARY-METHOD, <a class="indexterm" href="#no-prim">Standard Method Combination sec_7-6-6-2</a></dt></dl></div><div class="indexdiv"><h3>P</h3><dl><dt id="ientry-idm5160">PACKAGE</dt><dd><dl><dt>case-inverted, <a class="indexterm" href="#pack-case-inverted">Package Case-Sensitivity</a></dt><dt>case-sensitive, <a class="indexterm" href="#pack-case-sensitive">Package Case-Sensitivity</a></dt><dt>modern, <a class="indexterm" href="#pack-modern">Package Case-Sensitivity</a></dt></dl></dd><dt id="ientry-idm4902">PACKAGE-LOCK, <a class="indexterm" href="#pack-lock-f">Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2</a></dt></dl></div><div class="indexdiv"><h3>R</h3><dl><dt id="ientry-idm15018">ROOM, <a class="indexterm" href="#room-func">Function ROOM</a></dt></dl></div><div class="indexdiv"><h3>S</h3><dl><dt id="ientry-idm24900">slot</dt><dd><dl><dt>directly
14147 accessible, <a class="indexterm" href="#slot-directly-accessible">Instance Structure Protocol</a></dt><dt>location, <a class="indexterm" href="#slot-location">Instance Structure Protocol</a></dt></dl></dd><dt id="ientry-idm2273">SYMBOL-MACRO-EXPAND, <a class="indexterm" href="#symbol-mex">Macro DEFINE-SYMBOL-MACRO</a></dt></dl></div><div class="indexdiv"><h3>T</h3><dl><dt id="ientry-idm14676">TIMES, <a class="indexterm" href="#times">Macro TIME</a></dt><dt id="ientry-idm1870">token</dt><dd><dl><dt>reserved, <a class="indexterm" href="#res-token">Symbols as Tokens sec_2-3-4</a></dt></dl></dd><dt id="ientry-idm35022">trampoline, <a class="indexterm" href="#dffi-trampoline">Callbacks and memory management</a></dt></dl></div><div class="indexdiv"><h3>V</h3><dl><dt id="ientry-idm3886">visually similar, <a class="indexterm" href="#visually-similar">Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</a></dt></dl></div><div class="indexdiv"><h3>W</h3><dl><dt id="ientry-idm38461">WITH-OUTPUT-TO-PRINTER
14148 , <a class="indexterm" href="#with-print">Printing</a></dt><dt id="ientry-idm4959">WITHOUT-PACKAGE-LOCK, <a class="indexterm" href="#without-pack-lock">Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2</a></dt></dl></div></div></div><div class="bibliography"><div class="titlepage"><div><div><h1 class="title"><a id="references"></a>References</h1></div></div></div><div class="bibliodiv"><h3 class="title"><a id="ref-books"></a>Books</h3><div class="biblioentry"><a id="CLtL1"></a><p>[<abbr class="abbrev">CLtL1</abbr>] <span class="authorgroup"><span class="firstname">Guy L.</span> <span class="surname">Steele</span>, <span class="lineage">Jr.</span>. </span><span class="title"><em>Common Lisp: the Language (1st Edition)</em>. </span><span class="pubdate">1984. </span><span class="pagenums">465 pages. </span>ISBN 0-932376-41-X. <span class="publisher"><span class="publishername">Digital Press. </span></span></p></div><div class="biblioentry"><a id="CLtL2"></a><p>[<abbr class="abbrev">CLtL2</abbr>] <span class="authorgroup"><span class="firstname">Guy L.</span> <span class="surname">Steele</span>, <span class="lineage">Jr.</span>. </span><span class="title"><em><a class="ulink" href="https://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html" target="_top">Common Lisp: the Language (2nd Edition)</a></em>. </span><span class="pubdate">1990. </span><span class="pagenums">1032 pages. </span>ISBN 1-555-58041-6. <span class="publisher"><span class="publishername">Digital Press. </span></span></p></div><div class="biblioentry"><a id="amop"></a><p>[<abbr class="abbrev">AMOP</abbr>] <span class="authorgroup"><span class="firstname">Gregor</span> <span class="surname">Kiczales</span>, <span class="firstname">Jim</span> <span class="surname">des Rivieres</span>, and <span class="firstname">Daniel G.</span> <span class="surname">Bobrow</span>. </span><span class="title"><em><a class="ulink" href="http://mop.lisp.se/" target="_top">The Art of the Metaobject
14149 Protocol</a></em>. </span><span class="pubdate">1991. </span><span class="pagenums">335 pages. </span>ISBN 0-262-61074-4. <span class="publisher"><span class="publishername"><a class="ulink" href="https://mitpress.mit.edu" target="_top">MIT
14150 Press</a>. </span></span></p></div></div><div class="bibliodiv"><h3 class="title"><a id="ref-ansi"></a>ANSI standard documents</h3><div class="biblioentry"><a id="ansi-cl"></a><p>[<abbr class="abbrev">ANSI CL</abbr>] ANSI CL standard<span class="pubdate">1994. </span><span class="title"><em><a class="ulink" href="https://webstore.ansi.org" target="_top">ANSI</a> INCITS 226-1994 (R1999)
14151 Information Technology - Programming Language - Common Lisp
14152 [formerly ANSI X3.226-1994 (R1999)]</em>. </span></p></div><div class="biblioentry"><a id="CLHS"></a><p>[<abbr class="abbrev">CLHS</abbr>] Common Lisp HyperSpec<span class="title"><em><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/FrontMatter/" target="_top">Common Lisp HyperSpec</a></em>. </span></p></div></div></div></div><div class="bookinfo"><hr /><table width="100%" summary="impnotes meta info"><th><td align="left">These notes document <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version 2.49.95+</td><td align="right">Last modified: 2024-11-23</td></th></table></div><div class="custom-footer"><hr /><table width="100%"><tr><td align="left"><a href="http://clisp.org"><img src="clisp.png" width="48" height="48" alt="[CLISP home]" /></a></td></tr></table></div><hr /><form method="get" action="http://www.google.com/custom" target="_top"><table width="100%" border="0"><tr><td nowrap="nowrap" align="center"><input type="hidden" name="domains" value="clisp.org" /><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="50" maxlength="255" id="sbi" value="Implementation Notes for GNU CLISP" /><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb" /></td></tr><tr><td nowrap="nowrap" align="center"><input type="radio" name="sitesearch" value="" checked="1" id="ss0" /><label for="ss0" title="Search the Web"><small>Web</small></label><input type="radio" name="sitesearch" value="clisp.org" id="ss1" /><label for="ss1" title="Search clisp.org"><small>clisp.org</small></label><input type="hidden" name="client" value="pub-4445255502750357" /><input type="hidden" name="forid" value="1" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="oe" value="UTF-8" /><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:000000;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:48;LW:48;L:http://clisp.cons.org/clisp.png;S:http://clisp.cons.org;FORID:1" /><input type="hidden" name="hl" value="en" /></td></tr></table></form><hr /></body></html>