Debian Codegraph @

info/gcl-si/Command-Line.html

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>Command Line (GCL SI Manual)</title>
7
8 <meta name="description" content="Command Line (GCL SI Manual)">
9 <meta name="keywords" content="Command Line (GCL SI Manual)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="Function-and-Variable-Index.html" rel="index" title="Function and Variable Index">
15 <link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
16 <link href="Operating-System.html" rel="up" title="Operating System">
17 <link href="Operating-System-Definitions.html" rel="next" title="Operating System Definitions">
18 <link href="Operating-System.html" rel="prev" title="Operating System">
19 <style type="text/css">
20 <!--
21 a.summary-letter {text-decoration: none}
22 blockquote.indentedblock {margin-right: 0em}
23 div.display {margin-left: 3.2em}
24 div.example {margin-left: 3.2em}
25 div.lisp {margin-left: 3.2em}
26 kbd {font-style: oblique}
27 pre.display {font-family: inherit}
28 pre.format {font-family: inherit}
29 pre.menu-comment {font-family: serif}
30 pre.menu-preformatted {font-family: serif}
31 span.nolinebreak {white-space: nowrap}
32 span.roman {font-family: initial; font-weight: normal}
33 span.sansserif {font-family: sans-serif; font-weight: normal}
34 ul.no-bullet {list-style: none}
35 -->
36 </style>
37
38
39 </head>
40
41 <body lang="en">
42 <span id="Command-Line"></span><div class="header">
43 <p>
44 Next: <a href="Operating-System-Definitions.html" accesskey="n" rel="next">Operating System Definitions</a>, Previous: <a href="Operating-System.html" accesskey="p" rel="prev">Operating System</a>, Up: <a href="Operating-System.html" accesskey="u" rel="up">Operating System</a> &nbsp; [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p>
45 </div>
46 <hr>
47 <span id="Command-Line-1"></span><h3 class="section">9.1 Command Line</h3>
48
49 <p>The variable si::*command-args* is set to the list of strings passed
50 in when gcl is invoked.
51 </p>
52 <p>Various flags are understood.
53 </p><dl compact="compact">
54 <dt><code>-eval</code>
55 <span id="index-_002deval"></span>
56 </dt>
57 <dd><p>Call read and then eval on the command argument following <code>-eval</code>
58 </p></dd>
59 <dt><code>-load</code>
60 <span id="index-_002dload"></span>
61 </dt>
62 <dd><p>Load the file whose pathname is specified after <code>-load</code>.
63 </p></dd>
64 <dt><code>-f</code>
65 <span id="index-_002df"></span>
66 </dt>
67 <dd><p>Replace si::*command-args* by the the list starting after <code>-f</code>.
68 Open the file following <code>-f</code> for input, skip the first line, and then
69 read and eval the rest of the forms in the file. This can be used
70 as with the shells to write small shell programs:
71 </p><div class="example">
72 <pre class="example">#!/usr/local/bin/gcl.exe -f
73 (format t &quot;hello world ~a~%&quot; (nth 1 si::*command-args*))
74 </pre></div>
75 <p>The value si::*command-args* will have the appropriate value.
76 Thus if the above 2 line file is made executable and called <samp>foo</samp>
77 then
78 </p><div class="example">
79 <pre class="example">tutorial% foo billy
80 hello world billy
81 </pre></div>
82 <p>NOTE: On many systems (eg SunOs) the first line of an executable script file
83 such as:
84 </p><div class="example">
85 <pre class="example">#!/usr/local/bin/gcl.exe -f
86 </pre></div>
87 <p>only reads the first 32 characters! So if your pathname where the executable
88 together with the &rsquo;-f&rsquo; amount to more than 32 characters the file will not
89 be recognized. Also the executable must be the actual large binary file,
90 [or a link to it],
91 and not just a <code>/bin/sh</code> script. In latter case the
92 <code>/bin/sh</code> interpreter would get invoked on the file.
93 </p>
94 <p>Alternately one could invoke the file <samp>foo</samp> without making it
95 executable:
96 </p><div class="example">
97 <pre class="example">tutorial% gcl -f foo &quot;from bill&quot;
98 hello world from bill
99 </pre></div>
100
101 <p>Finally perhaps the best way (why do we save the best for last..
102 I guess because we only figure it out after all the others..)
103 The following file <samp>myhello</samp> has 4 lines:
104 </p><div class="example">
105 <pre class="example">#!/bin/sh
106 #| Lisp will skip the next 2 lines on reading
107 exec gcl -f &quot;$0&quot; $&nbsp;|#
108 (format t &quot;hello world ~a~%&quot; (nth 1 si::*command-args*))
109 </pre></div>
110
111 <div class="example">
112 <pre class="example">marie% chmod a+x myhello
113 marie% myhello bill
114 hello world bill
115 </pre></div>
116
117 <p>The advantage of this method is that <samp>gcl</samp> can itself
118 be a shell script, which sets up environment and
119 so on. Also the normal path will be searched to find <samp>gcl</samp>
120 The disadvantage is that this would cause 2 invocations of <samp>sh</samp>
121 and one invocation of <samp>gcl</samp>. The plan using <samp>gcl.exe</samp>
122 bypasses the <samp>sh</samp> entirely. Inded invoking <samp>gcl.exe</samp> to
123 print <samp>hello world</samp> is faster on most systems than a similar
124 <samp>csh</samp> or <samp>bash</samp> script, but slightly slower than the old
125 <samp>sh</samp>.
126 </p>
127
128 </dd>
129 <dt><code>-batch</code>
130 <span id="index-_002dbatch"></span>
131 </dt>
132 <dd><p>Do not enter the command print loop. Useful if the other command line
133 arguments do something. Do not print the License and acknowledgement
134 information. Note if your program does print any License information,
135 it must print the GCL header information also.
136 </p></dd>
137 <dt><code>-dir</code>
138 <span id="index-_002ddir"></span>
139 </dt>
140 <dd><p>Directory where the executable binary that is running is located.
141 Needed by save and friends. This gets set as si::*system-directory*
142 </p></dd>
143 <dt><code>-libdir</code>
144 <span id="index-_002dlibdir"></span>
145 </dt>
146 <dd><div class="example">
147 <pre class="example"> -libdir <samp>/d/wfs/gcl-2.0/</samp>
148 </pre></div>
149 <p>would mean that the files like gcl-tk/tk.o would be found by
150 concatting the path to the libdir path, ie in
151 </p><div class="example">
152 <pre class="example"><samp>/d/wfs/gcl-2.0/gcl-tk/tk.o</samp>
153 </pre></div>
154 </dd>
155 <dt><code>-compile</code>
156 <span id="index-_002dcompile"></span>
157 </dt>
158 <dd><p>Invoke the compiler on the filename following <code>-compile</code>.
159 Other flags affect compilation.
160 </p></dd>
161 <dt><code>-o-file</code>
162 <span id="index-_002do_002dfile"></span>
163 </dt>
164 <dd><p>If nil follows <code>-o-file</code> then do not produce an <code>.o</code> file.
165 </p></dd>
166 <dt><code>-c-file</code>
167 <span id="index-_002dc_002dfile"></span>
168 </dt>
169 <dd><p>If <code>-c-file</code> is specified, leave the intermediate <code>.c</code> file there.
170 </p></dd>
171 <dt><code>-h-file</code>
172 <span id="index-_002dh_002dfile"></span>
173 </dt>
174 <dd><p>If <code>-h-file</code> is specified, leave the intermediate <code>.h</code> file there.
175 </p></dd>
176 <dt><code>-data-file</code>
177 <span id="index-_002ddata_002dfile"></span>
178 </dt>
179 <dd><p>If <code>-data-file</code> is specified, leave the intermediate <code>.data</code> file there.
180 </p></dd>
181 <dt><code>-system-p</code>
182 <span id="index-_002dsystem_002dp"></span>
183 </dt>
184 <dd><p>If <code>-system-p</code> is specified then invoke <code>compile-file</code> with the
185 <code>:system-p t</code> keyword argument, meaning that the C init function
186 will bear a name based on the name of the file, so that it may be invoked
187 by name by C code.
188 </p></dd>
189 </dl>
190
191 <hr>
192 <div class="header">
193 <p>
194 Next: <a href="Operating-System-Definitions.html" accesskey="n" rel="next">Operating System Definitions</a>, Previous: <a href="Operating-System.html" accesskey="p" rel="prev">Operating System</a>, Up: <a href="Operating-System.html" accesskey="u" rel="up">Operating System</a> &nbsp; [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p>
195 </div>
196
197
198
199 </body>
200 </html>