Debian Codegraph @

src/doc/old-manual/intro.xmlf

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE book [
3 <!ENTITY % eclent SYSTEM "ecl.ent">
4 %eclent;
5 ]>
6 <book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
7 <preface xml:id="preface">
8 <title>Preface</title>
9
10 <section xml:id="preface.words">
11 <title>About this book</title>
12
13 <para>This manual is part of the &ECL; software system. It documents
14 deviations of &ECL; from the &ANSI; standard, as well as extensions, daily
15 working process (compiling files, loading sources, creating programs, etc)
16 and the internals of this implementation.</para>
17
18 <para>This book is not intended as a source to learn &CommonLisp;. There are
19 other tutorials and textbooks available in the Net which serve this
20 purpose. The homepage of the <ulink url="http://www.lisp.org">Association of
21 Lisp Users</ulink> contains a good list of links of such teaching and
22 learning material.</para>
23
24 <para>This book is structured into three parts. We begin with <xref
25 linkend="part.standards"/> documents all parts of the standard which are left as
26 <emphasis>implementation specific</emphasis>. For instance, precision of
27 floating point numbers, available character sets, actual input/output
28 protocols, etc.</para>
29
30 <para><xref linkend="part.extensions"/> introduces all features which are
31 specific to &ECL; and which lay outside the standard. This includes
32 configuring, building and installing &ECL; multiprocessing capabilities,
33 graphics libraries, interfacing with the operating system, etc.</para>
34
35 <para><xref linkend="part.internals"/> deals with the internals of the
36 implementation. This part is only intended for experienced programmers that
37 want to learn how &ECL; does its work and wish to extend it, customize it or
38 port it to new architectures. This part of the documentation is the most
39 fragile one and prone to change.</para>
40
41 <important><para>Missing highlights</para></important>
42 </section>
43
44 <section xml:id="preface.what.is.ecl">
45 <title>What is &ECL;?</title>
46
47 <para>&ECL; is an implementation of the Common-Lisp language that was
48 developed by Giuseppe Attardi's up from the Kyoto Common-Lisp. See <xref
49 linkend="preface.credits"></xref> for the history of the code you are up to
50 use.</para>
51
52 <para>&ECL; (ECL for short) uses standard C calling conventions for Lisp
53 compiled functions, which allows C programs to easily call Lisp functions
54 and vice versa. No foreign function interface is required: data can be
55 exchanged between C and Lisp with no need for conversion.</para>
56
57 <para>&ECL; is based on a Common Runtime Support (CRS) which provides basic
58 facilities for memory management, dynamic loading and dumping of binary
59 images, support for multiple threads of execution. The CRS is built into a
60 library that can be linked with the code of the application. &ECL; is
61 modular: main modules are the program development tools (top level,
62 debugger, trace, stepper), the compiler, and CLOS. A native implementation
63 of CLOS is available in &ECL;: one can configure &ECL; with or without CLOS.
64 A runtime version of &ECL; can be built with just the modules which are
65 required by the application.</para>
66
67 <para>The &ECL; compiler compiles from Lisp to C, and then invokes
68 the GNU C compiler to produce binaries. While former releases of ECL
69 adhere to the the reference of the language given in &Steele84;, the
70 aim of &ECL; is now to achieve maximum compliance with ANSI
71 Common-Lisp, the most up to date standard for Common-Lisp.</para>
72 <para>Throughout this manual we will describe the &ECL; implementation and
73 how it differs from &ANSI; and &Steele84;. In general, as
74 work in &ECL; is completed section by section, we will drop compatibility
75 with &Steele84; and the corresponding chapter will be updated to
76 document <emphasis>only</emphasis> the differences with &ANSI;.</para>
77
78 </section>
79 <section xml:id="Credits">
80 <title>Credits</title>
81
82 <para>The &ECL; project is an implementation of the Common-Lisp language
83 that aims to comply with the ANSI Common-Lisp standard. The first ECL
84 implementations were developed by Giuseppe Attardi's who produced an
85 interpreter and compiler fully conformat with the Common-Lisp as reported
86 in <citetitle>Steele:84</citetitle>. ECL derives itself mostly from Kyoto
87 Common-Lisp, an implementation developed at the Research Institute for
88 Mathematical Sciences (RIMS), Kyoto University, with the cooperation of
89 Nippon Data General Corporation. The main developers of Kyoto Common-Lisp
90 were Taiichi Yuasa and Masami Hagiya, of the Research Institute for
91 Mathematical Sciences, at Kyoto University.</para>
92
93 <para>We must thank Juan Jose Garcia Ripoll, Giuseppe Attardi, Yuasa and
94 Hagiya for their wonderful work with preceding implementations and for
95 putting them in the Public Domain under the GNU General Public License as
96 published by the Free Software Foundation. Without them this product would
97 have never been possible.</para>
98
99 <para>This document is an update of the original ECL documentation, which was based
100 in part on the material in [Yuasa:85, see <xref linkend="Bibliography"></xref>]</para>
101
102 <para>The following people or organizations must be credited for support in the
103 development of Kyoto Common-Lisp: Prof. Reiji Nakajima at RIMS, Kyoto University;
104 Nippon Data General Corporation; Teruo Yabe; Toshiyasu Harada; Takashi Suzuki;
105 Kibo Kurokawa; Data General Corporation; Richard Gabriel; Daniel Weinreb; Skef
106 Wholey; Carl Hoffman; Naruhiko Kawamura; Takashi Sakuragawa; Akinori Yonezawa;
107 Etsuya Shibayama; Hagiwara Laboratory; Shuji Doshita; Takashi Hattori.</para>
108 <para>William F. Schelter improved KCL in several areas and developed Austin Kyoto
109 Common-Lisp (AKCL). Many ideas and code from AKCL have been incorporated in
110 &ECL;.</para>
111
112 <para>The following is the full list of contributors to ECL: Taiichi Yuasa and
113 Masami Hagiya (KCL), William F. Schelter (Dynamic loader, conservative Gc),
114 Giuseppe Attardi (Top-level, trace, stepper, compiler, CLOS, multithread),
115 Marcus Daniels (Linux port) Cornelis van der Laan (FreeBSD port) David Rudloff
116 (NeXT port) Dan Stanger, Don Cohen, and Brian Spilsbury.</para>
117
118 <para>We have to thank for the following pieces of software that have helped in the
119 development of &ECL;</para>
120
121 <variablelist>
122 <varlistentry>
123 <term>Bruno Haible</term>
124 <listitem>
125 <para>For the Cltl2-compliance test</para>
126 </listitem>
127 </varlistentry>
128 <varlistentry>
129 <term>Peter Van Eynde</term>
130 <listitem>
131 <para>For the ANSI-compliance test</para>
132 </listitem>
133 </varlistentry>
134 <varlistentry>
135 <term>Symbolic's Inc.</term>
136 <listitem>
137 <para>For the ANSI-compliant LOOP macro.</para>
138 </listitem>
139 </varlistentry>
140 </variablelist>
141
142 <para>The &ECL; project also owes a lot to the people who have tested this program
143 and contributed with suggestions and error messages: Eric Marsden, Hannu
144 Koivisto and Jeff Bowden, and others whose name I may have omitted.</para>
145 </section>
146
147 <section xml:id="Copyright">
148 <title>Copyright</title>
149 <para role="continues">Copyright &copy; 2015 Daniel Kochmański</para>
150 <para role="continues">Copyright &copy; 2000 Juan Jose Garcia Ripoll</para>
151 <para role="continues">Copyright &copy; 1990, 1991, 1993 Giuseppe Attardi</para>
152 <para role="continues">Copyright &copy; 1984 Taiichi Yuasa and Masami Hagiya</para>
153 <para role="continues">All Rights Reserved</para>
154 <para role="continues">Summary:</para>
155 <blockquote>
156 <para>Permission is granted to use, copy, modify this program,
157 EXCEPT that the copyright notice must be reproduced on copies, and
158 credit should be given to the authors where it is due.
159 WE MAKE NO WARRANTY AND ACCEPT NO LIABILITY FOR THIS PROGRAM.</para>
160 </blockquote>
161 <para role="continues">In detail:</para>
162 <orderedlist numeration="arabic">
163 <listitem>
164 <para>Permission to use, copy, modify this software and its documentation
165 for any purpose is hereby granted without fee, provided that</para>
166 <itemizedlist mark="bullet">
167 <listitem>
168 <para>the above copyright notice appears in all copies,</para>
169 </listitem>
170 <listitem>
171 <para>both that copyright notice and this permission notice appears in supporting documentation, and that</para>
172 </listitem>
173 <listitem>
174 <para>you cause modified files to carry prominent notices stating that you changed the files and the date of any change.</para>
175 </listitem>
176 </itemizedlist>
177 </listitem>
178 <listitem>
179 <para>Please notify us if you are going to sell this software or its documentation
180 for profit.</para>
181 </listitem>
182 <listitem>
183 <para>WE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
184 WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL WE BE LIABLE FOR
185 ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
186 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
187 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
188 USE OR PERFORMANCE OF THIS SOFTWARE.</para>
189 </listitem>
190 </orderedlist>
191 <para role="continues">Additionally:</para>
192 <blockquote>
193 <para>&ECL; is free software; you can redistribute it and/or modify it
194 under the terms of the GNU Library General Public License as published
195 by the Free Software Foundation; either version 2 of the License, or
196 (at your option) any later version; see file 'Copying'.</para>
197 <para>This program is distributed in the hope that it will be useful,
198 but WITHOUT ANY WARRANTY; without even the implied warranty of
199 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200 GNU Library General Public License for more details.</para>
201 <para>You should have received a copy of the GNU Library General Public License
202 along with this program; if not, write to the Free Software
203 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</para>
204 </blockquote>
205 <para role="continues">Address for reporting bugs, comments, suggestions:</para>
206 <blockquote>
207 <para><ulink url="mailto:worm@@arrakis.es"></ulink></para>
208 </blockquote>
209 </section>
210
211 <section xml:id="Building-ECL">
212 <title>Building ECL</title>
213 <orderedlist numeration="arabic">
214 <listitem>
215 <para>Obtain the distribution from <ulink url="http://ecls.sourceforge.net">http://ecls.sourceforge.net</ulink>.
216 The distribution is in a gzip-compressed tar file named like
217 <filename>ecl.tgz</filename></para>
218 </listitem>
219 <listitem>
220 <para>Prepare a directory (hereafter called <firstterm>ECL directory</firstterm>) for
221 ECL. In the following examples, we suppose that the <emphasis>ECL
222 directory</emphasis> is <filename>/usr/local/bin/ecl</filename>.</para>
223 </listitem>
224 <listitem>
225 <para>Extract the content from the compressed tar file.<screen>
226 $ zcat ecl.tgz | tar xf -
227 </screen></para>
228 </listitem>
229 <listitem>
230 <para>An auto configuration mechanism allows you to perform a standard
231 installation with the following commands:<screen>
232 $ ./configure
233 </screen>This example will prepare to install executable files, manual pages and
234 info files in standard directories like <filename>/usr/local/bin</filename>,
235 <filename>/usr/local/share/man/man1</filename>.</para>
236 </listitem>
237 <listitem>
238 <para>If you don't have access rights to these directories, you should
239 give to configure alternate places. Try <literal>./configure --help</literal> for
240 instructions on how to supply this information to configure, but
241 a good starting point is<screen>
242 $ ./configure --prefix=$HOME
243 </screen></para>
244 </listitem>
245 <listitem>
246 <para>Next you must build the program and install it<screen>
247 $ make
248 $ make install
249 </screen></para>
250 </listitem>
251 </orderedlist>
252 <para>At the end of installation, the destination directories will contain
253 several files. If you have not modified these directories when
254 invoking <filename>configure</filename> the layout should be</para>
255 <informaltable>
256 <tgroup cols="2">
257 <colspec colwidth="50*"></colspec>
258 <colspec colwidth="50*"></colspec>
259 <tbody>
260 <row>
261 <entry><emphasis role="bold">Executable files:</emphasis></entry>
262 <entry></entry>
263 </row>
264 <row>
265 <entry><filename>$HOME/bin/ecl</filename></entry>
266 <entry>the &ECL; interpreter and compiler</entry>
267 </row>
268 <row>
269 <entry><emphasis role="bold">Help documents:</emphasis></entry>
270 <entry></entry>
271 </row>
272 <row>
273 <entry><filename>$HOME/lib/ecl/help.doc</filename></entry>
274 <entry>data for the online help</entry>
275 </row>
276 <row>
277 <entry><filename>$HOME/man/man1/ecl.1</filename></entry>
278 <entry>manual page for &ECL;</entry>
279 </row>
280 <row>
281 <entry><filename>$HOME/info/ecl.info</filename></entry>
282 <entry>this manual you are reading</entry>
283 </row>
284 <row>
285 <entry><emphasis role="bold">Library files and headers:</emphasis></entry>
286 <entry></entry>
287 </row>
288 <row>
289 <entry><filename>$HOME/lib/ecl/libecl.a</filename></entry>
290 <entry>the core library in C</entry>
291 </row>
292 <row>
293 <entry><filename>$HOME/lib/ecl/libgmp.a</filename></entry>
294 <entry>GNU library for bignums</entry>
295 </row>
296 <row>
297 <entry><filename>$HOME/lib/ecl/libgc.a</filename></entry>
298 <entry>Boehm-Weiser garbage collector</entry>
299 </row>
300 <row>
301 <entry><filename>$HOME/lib/ecl/*.a</filename></entry>
302 <entry>Other lisp compiled code</entry>
303 </row>
304 <row>
305 <entry><filename>$HOME/lib/ecl/ecl/</filename></entry>
306 <entry>Header files</entry>
307 </row>
308 </tbody>
309 </tgroup>
310 </informaltable>
311 <para>You can remove all intermediate files produced during installation with the
312 command <literal>make clean</literal>.</para>
313 </section>
314
315 <section xml:id="Invoking-ECL">
316 <title>Entering and leaving &ECL;</title>
317 <para>&ECL; is invoked by the command <literal>ecl</literal>.</para>
318 <para><screen>
319 % ecl
320 ECL (Embeddable Common-Lisp) 0.0e
321 Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
322 Copyright (C) 1993 Giuseppe Attardi
323 Copyright (C) 2000 Juan J. Garcia-Ripoll
324 ECL is free software, and you are welcome to redistribute it
325 under certain conditions; see file 'Copyright' for details.
326 Type :h for Help. Top level.
327 &gt;
328 </screen></para>
329 <para>When invoked, &ECL; will print the banner and initialize the system. The
330 date in the &ECL; banner identifies the revision of &ECL;. <literal>Version
331 (0.8) 05/14/1993</literal> is the value of the function
332 <literal>lisp-implementation-version</literal>.</para>
333 <para>If there exists a file named <filename>init.lsp</filename> in the current working directory,
334 &ECL; successively evaluates the forms in the file, immediately after the
335 system initialization. The user may set up his or her own &ECL; environment
336 (e.g., the memory configuration) with <filename>init.lsp</filename>.</para>
337 <para>After the initialization, &ECL; enters the <firstterm>top-level loop</firstterm> and prints
338 the prompt `<literal>&gt;</literal>'.</para>
339 <para><screen>
340 Type :h for Help. Top level.
341 &gt;
342 </screen></para>
343 <para>The prompt indicates that &ECL; is now ready to receive a form from the
344 terminal and to evaluate it.</para>
345 <para>Usually, the current package (i.e., the value of <replaceable>*package*</replaceable>) is the user
346 package, and the prompt appears as above. If, however, the current package is
347 other than the user package, then the prompt will be prefixed by the package
348 name.</para>
349 <para><screen>
350 &gt; (in-package 'cl)
351 #&lt;"COMMON-LISP" package&gt;
352 COMMON-LISP&gt; (in-package 'system)
353 #&lt;"SYSTEM" package&gt;
354 SYSTEM&gt;
355 </screen></para>
356 <para>To exit from &ECL;, call the function <literal>quit</literal>.</para>
357 <para><screen>
358 &gt;(quit)
359 Bye.
360 %
361 </screen></para>
362 <para>Alternatively, you may type ^D, i.e. press the key <keycap>D</keycap> while pressing
363 down the control key (<keycap>Ctrl</keycap>).</para>
364 <para><screen>
365 &gt;^DBye.
366 %
367 </screen></para>
368 <para>You can disable ^D as the exit command by setting to <literal>T</literal> the
369 following variable:</para>
370 <blockquote>
371 <screen><indexterm role="vr"><primary>*ignore-eof-on-terminal-io*</primary></indexterm>&#151; System: <varname>*ignore-eof-on-terminal-io*</varname></screen>
372 <para>This variable controls whether an end of file character (normally ^D)
373 should terminate the session. The default value is ().</para>
374 </blockquote>
375 <para>The top-level loop of &ECL; is almost the same as that defined in Section
376 20.2 of &Steele84;. Since the input from the terminal is in line
377 mode, each top-level form should be followed by a newline. If more than one
378 value is returned by the evaluation of the top-level form, the values will be
379 printed successively. If no value is returned, then nothing will be printed.<screen>
380 &gt;(values 1 2)
381 1
382 2
383 &gt;(values)
384
385 &gt;
386 </screen></para>
387 <para>When an error is signalled, control will enter the break loop.<screen>
388 &gt;(defun foo (x) (bar x))
389 foo
390
391 &gt;(defun bar (y) (bee y y))
392 bar
393
394 &gt;(foo 'lish)
395 Error: The function BEE is undefined.
396 Error signalled by BAR.
397
398 Broken at BAR.
399 &gt;&gt;
400 </screen></para>
401 <para>`<literal>&gt;&gt;</literal>' in the last line is the prompt of the break loop. Like in the
402 top-level loop, the prompt will be prefixed by the current package name, if the
403 current package is other than the <literal>user</literal> package.</para>
404 <para>To go back to the top-level loop, type <literal>:q</literal></para>
405 <para><screen>
406 &gt;&gt;:q
407
408 Top level.
409 &gt;
410 </screen></para>
411 <para>See Section 5.4 for the details of the break loop.</para>
412 <para>The terminal interrupt (usually caused by typing ^C (Control-<literal>C</literal>))
413 is a kind of error. It breaks the running program and calls the break level
414 loop.</para>
415 <para>Example:<screen>
416 &gt;(defun foo () (do () (nil)))
417 foo
418
419 &gt;(foo)
420 ^C
421 Correctable error: Console interrupt.
422 Signalled by DO.
423
424 Broken at FOO.
425 &gt;&gt;
426 </screen></para>
427 </section>
428 </preface>
429 </book>
430 <!-- Keep this comment at the end of the file
431 Local variables:
432 mode: nxml
433 sgml-parent-document: "ecl.xml"
434 sgml-indent-step: 1
435 nxml-child-indent: 1
436 nxml-outline-child-indent:1
437 fill-column: 79
438 End:
439 -->