1
0
Fork 0
cl-sites/ecl.common-lisp.dev/static/manual/Invoking-ECL.html

310 lines
10 KiB
HTML
Raw Permalink Normal View History

2024-12-24 19:15:49 +01:00
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Invoking ECL (ECL Manual)</title>
<meta name="description" content="Invoking ECL (ECL Manual)">
<meta name="keywords" content="Invoking ECL (ECL Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Indexes.html" rel="index" title="Indexes">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="User_0027s-guide.html" rel="up" title="User's guide">
<link href="The-break-loop.html" rel="next" title="The break loop">
<link href="Building-ECL.html" rel="prev" title="Building ECL">
<style type="text/css">
<!--
/* colors */
div.example {margin-left: 3.2em}
kbd.key {font-style: normal}
span.r {font-family: initial; font-weight: normal; font-style: normal}
@media (prefers-color-scheme: dark) {
/* dark theme */
html { color: seashell;
background: #1A1A1A; }
body { background: #1A1A1A; }
th { border-bottom: 2px solid lightgray; }
h1, h2, h3, h4, h5 { background-image: linear-gradient(to left, #202020, #3A3A3A); }
code, var, code a { color: darkorange;
background: #2A2A2A; }
a { color: seashell; }
pre { background: #2A2A2A;
color: seashell;
/* mark longer code block with stripe on the left */
border-left: 5px solid darkorange;
padding-left: 10px; }
pre.screen { background: #2A2A2A;
border: 1px solid lightgray; }
pre.programlisting { background: #2A2A2A;
border-left: 1px solid lightgray;
border-top: 1px solid lightgray; }
/* we need a light background in order for the images to be readable */
img { background: white }
}
@media (prefers-color-scheme: light) {
/* light theme */
html { background: white }
body { background: white }
th { border-bottom: 2px solid gray; }
h1, h2, h3, h4, h5 { background: lightgray; }
code, var, code a { color: darkred;
background: whitesmoke; }
a { color: #000; }
pre { background: whitesmoke;
color: black;
/* mark longer code block with stripe on the left */
border-left: 5px solid darkred;
padding-left: 10px; }
pre.screen { background: #EEE;
border: 1px solid black; }
pre.programlisting { background: #EEEEEE;
border-left: 1px solid black;
border-top: 1px solid black; }
}
body {
margin: 1em 125px 0 10%;
line-height: 1.5em;
padding: 0 2em 1em 2em;
font: 13px Verdana,Arial, sans-serif
}
ul, dd, dl, dt { margin-top: 0; margin-bottom: 0; }
p, code, td, dl, dt {
line-height: 1.5em;
}
table {
font: inherit;
border-collapse: collapse;
}
th, td {
vertical-align: top;
}
h1, h2, h3 { padding-left: 15px; }
h4, h5 { padding-left: 5px; }
code, pre {
font-size: 1em;
font-family: monospace;
}
var {
font-size: 1em;
}
/* links inside code appear the same as the code itself */
code a {
font-weight: normal;
text-decoration: none;
}
/* but get an underline when hovering */
code a:hover {
text-decoration: underline;
}
/* ordinary links appear in bold */
a { font-weight: bold; }
pre.verbatim {
margin: 0 0 0 0;
}
pre {
overflow: auto;
}
pre.screen {
font-weight: bold;
padding: 0.5em;
}
pre.programlisting {
padding: 0.5em;
}
div p { padding: 0 2em }
li p { padding: 0; margin: 0 }
hr { display: none; }
div.funcsynopsis p {
text-indent: -2em;
}
div.variablelist {
padding: 0 2em;
}
.type, .funcsynopsis, .symbol {
font-family: monospace;
}
.type, .symbol, .replaceable {
white-space: nowrap;
}
-->
</style>
</head>
<body lang="en">
<div class="section-level-extent" id="Invoking-ECL">
<div class="nav-panel">
<p>
Next: <a href="The-break-loop.html" accesskey="n" rel="next">The break loop</a>, Previous: <a href="Building-ECL.html" accesskey="p" rel="prev">Building ECL</a>, Up: <a href="User_0027s-guide.html" accesskey="u" rel="up">User&rsquo;s guide</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Entering-and-leaving-Embeddable-Common-Lisp">1.2 Entering and leaving <b class="b"><span class="r">Embeddable Common Lisp</span></b></h3>
<p><b class="b"><span class="r">Embeddable Common Lisp</span></b> is invoked by the command <code class="code">ecl</code>.
</p>
<div class="example">
<pre class="example-preformatted">% ecl
ECL (Embeddable Common-Lisp) 0.0e
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2015 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
Top level in: #&lt;process TOP-LEVEL&gt;.
&gt;
</pre></div>
<p>When invoked, <b class="b"><span class="r">Embeddable Common Lisp</span></b> will print the banner and initialize the system.
The number in the <b class="b"><span class="r">Embeddable Common Lisp</span></b> banner identifies the revision of
<b class="b"><span class="r">Embeddable Common Lisp</span></b>. <code class="code">0.0e</code> is the value of the function
<code class="code">lisp-implementation-version</code>.
</p>
<p>Unless user specifies <code class="code">--norc</code> flag when invoking the <b class="b"><span class="r">Embeddable Common Lisp</span></b>, it
will look for the initialization files <samp class="file">~/.ecl</samp> and
<samp class="file">~/.eclrc</samp>. If he wants to load his own file from the current
directory, then he should pass the file path to the <code class="code">--load</code>
parameter:
</p><div class="example">
<pre class="example-preformatted">% ecl --norc --load init.lisp
</pre></div>
<p>After the initialization, <b class="b"><span class="r">Embeddable Common Lisp</span></b> enters the <em class="dfn">top-level loop</em> and
prints the prompt &lsquo;<code class="code">&gt;</code>&rsquo;.
</p>
<div class="example">
<pre class="example-preformatted">Type :h for Help. Top level.
&gt;
</pre></div>
<p>The prompt indicates that <b class="b"><span class="r">Embeddable Common Lisp</span></b> is now ready to receive a form from the
terminal and to evaluate it.
</p>
<p>Usually, the current package (i.e., the value of <code class="code">*package*</code>) is the
user package, and the prompt appears as above. If, however, the current
package is other than the user package, then the prompt will be prefixed
with the package name.
</p>
<div class="example">
<pre class="example-preformatted">&gt; (in-package &quot;CL&quot;)
#&lt;&quot;COMMON-LISP&quot; package&gt;
COMMON-LISP&gt; (in-package &quot;SYSTEM&quot;)
#&lt;&quot;SI&quot; package&gt;
SI&gt;
</pre></div>
<p>To exit from <b class="b"><span class="r">Embeddable Common Lisp</span></b>, call the function <code class="code"><a class="ref" href="Operating-System-Interface.html#ext_003aquit">ext:quit</a></code>.
</p>
<div class="example">
<pre class="example-preformatted">&gt; (quit)
%
</pre></div>
<p>Alternatively, you may type <code class="code">^D</code> on UNIX-like operating systems,
i.e. press the key <kbd class="key">D</kbd>
while pressing down the control key (<kbd class="key">Ctrl</kbd>),
on Windows, you should use <code class="code">^Z</code> followed by a return.
</p>
<div class="example">
<pre class="example-preformatted">&gt; ^D
%
</pre></div>
<p>The top-level loop of <b class="b"><span class="r">Embeddable Common Lisp</span></b> is almost the same as that defined in
Section 20.2 of [see <a class="pxref" href="Bibliography.html">Steele:84</a>]. Since the input from the terminal
is in line mode, each top-level form should be followed by a newline.
If more than one value is returned by the evaluation of the top-level
form, the values will be printed successively. If no value is returned,
then nothing will be printed.
</p><div class="example">
<pre class="example-preformatted">&gt; (values 1 2)
1
2
&gt; (values)
&gt;
</pre></div>
<p>When an error is signaled, control will enter the break loop.
</p><div class="example">
<pre class="example-preformatted">&gt; (defun foo (x) (bar x))
foo
&gt; (defun bar (y) (bee y y))
bar
&gt; (foo 'lish)
Condition of type: UNDEFINED-FUNCTION
The function BEE is undefined.
Available restarts:
1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
Broken at FOO. In: #&lt;process TOP-LEVEL&gt;.
&gt;&gt;
</pre></div>
<p>&lsquo;<code class="code">&gt;&gt;</code>&rsquo; in the last line is the prompt of the break loop. Like in
the top-level loop, the prompt will be prefixed by the current package
name, if the current package is other than the <code class="code">cl-user</code> package.
</p>
<p>To go back to the top-level loop, type <code class="code">:q</code>
</p>
<div class="example">
<pre class="example-preformatted">&gt;&gt;:q
Top level in: #&lt;process TOP-LEVEL&gt;.
&gt;
</pre></div>
<p>If more restarts are present, user may invoke them with by typing
<code class="code">:rN</code>, where <kbd class="key">N</kbd> is the restart number. For instance to pick
the restart number two, type <code class="code">:r2</code>.
</p>
<p>See [<a class="ref" href="The-break-loop.html">The break loop</a>] for the details of the break loop.
</p>
<p>The terminal interrupt (usually caused by typing ^C(Control-<code class="code">C</code>)) is a kind of error. It breaks the running program
and calls the break level loop.
</p>
<p>Example:
</p><div class="example">
<pre class="example-preformatted">&gt; (defun foo () (do () (nil)))
foo
&gt; (foo)
^C
Condition of type: INTERACTIVE-INTERRUPT
Console interrupt.
Available restarts:
1. (CONTINUE) CONTINUE
2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
Broken at FOO. In: #&lt;process TOP-LEVEL&gt;.
&gt;&gt;
</pre></div>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="The-break-loop.html" accesskey="n" rel="next">The break loop</a>, Previous: <a href="Building-ECL.html" accesskey="p" rel="prev">Building ECL</a>, Up: <a href="User_0027s-guide.html" accesskey="u" rel="up">User&rsquo;s guide</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>