1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
5
<title>GCL SI Manual: GCL Specific</title>
7
<meta name="description" content="GCL SI Manual: GCL Specific">
8
<meta name="keywords" content="GCL SI Manual: GCL Specific">
9
<meta name="resource-type" content="document">
10
<meta name="distribution" content="global">
11
<meta name="Generator" content="makeinfo">
12
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
13
<link href="index.html#Top" rel="start" title="Top">
14
<link href="Function-and-Variable-Index.html#Function-and-Variable-Index" 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="index.html#Top" rel="up" title="Top">
17
<link href="Bignums.html#Bignums" rel="next" title="Bignums">
18
<link href="Type.html#Type" rel="prev" title="Type">
19
<style type="text/css">
21
a.summary-letter {text-decoration: none}
22
blockquote.smallquotation {font-size: smaller}
23
div.display {margin-left: 3.2em}
24
div.example {margin-left: 3.2em}
25
div.indentedblock {margin-left: 3.2em}
26
div.lisp {margin-left: 3.2em}
27
div.smalldisplay {margin-left: 3.2em}
28
div.smallexample {margin-left: 3.2em}
29
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
30
div.smalllisp {margin-left: 3.2em}
31
kbd {font-style:oblique}
32
pre.display {font-family: inherit}
33
pre.format {font-family: inherit}
34
pre.menu-comment {font-family: serif}
35
pre.menu-preformatted {font-family: serif}
36
pre.smalldisplay {font-family: inherit; font-size: smaller}
37
pre.smallexample {font-size: smaller}
38
pre.smallformat {font-family: inherit; font-size: smaller}
39
pre.smalllisp {font-size: smaller}
40
span.nocodebreak {white-space:nowrap}
41
span.nolinebreak {white-space:nowrap}
42
span.roman {font-family:serif; font-weight:normal}
43
span.sansserif {font-family:sans-serif; font-weight:normal}
44
ul.no-bullet {list-style: none}
51
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
52
<a name="GCL-Specific"></a>
55
Next: <a href="C-Interface.html#C-Interface" accesskey="n" rel="next">C Interface</a>, Previous: <a href="Type.html#Type" accesskey="p" rel="prev">Type</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
58
<a name="GCL-Specific-1"></a>
59
<h2 class="chapter">15 GCL Specific</h2>
62
<dt><a name="index-SYSTEM"></a>Function: <strong>SYSTEM</strong> <em>(string)</em></dt>
65
<p>GCL specific: Executes a Shell command as if STRING is an input to the
66
Shell. Not all versions of GCL support this function. At least on
67
POSIX systems, this call should return two integers represeting the
68
exit status and any possible terminating signal respectively.
74
<dt><a name="index-_002aTMP_002dDIR_002a"></a>Variable: <strong>*TMP-DIR*</strong></dt>
75
<dd><p>Package:COMPILER
76
GCL specific: Directory in which temporary “gazonk” files used by the
77
compiler are to be created.
83
<dt><a name="index-_002aIGNORE_002dMAXIMUM_002dPAGES_002a"></a>Variable: <strong>*IGNORE-MAXIMUM-PAGES*</strong></dt>
85
GCL specific: Tells the GCL memory manager whether (non-NIL) or not (NIL) it
86
should expand memory whenever the maximum allocatable pages have been used
93
<dt><a name="index-_002aOPTIMIZE_002dMAXIMUM_002dPAGES_002a"></a>Variable: <strong>*OPTIMIZE-MAXIMUM-PAGES*</strong></dt>
96
<p>GCL specific: Tells the GCL memory manager whether to attempt to
97
adjust the maximum allowable pages for each type to approximately
98
optimize the garbage collection load in the current process. Defaults
99
to T. Set to NIL if you care more about memory usage than runtime.
105
<dt><a name="index-MACHINE_002dVERSION"></a>Function: <strong>MACHINE-VERSION</strong> <em>()</em></dt>
108
<p>Returns a string that identifies the machine version of the machine
109
on which GCL is currently running.
115
<dt><a name="index-BY"></a>Function: <strong>BY</strong> <em>()</em></dt>
118
<p>GCL specific: Exits from GCL.
124
<dt><a name="index-DEFCFUN"></a>Macro: <strong>DEFCFUN</strong></dt>
128
</p><div class="example">
129
<pre class="example">(defcfun header n {element}*)
133
<p>GCL specific: Defines a C-language function which calls Lisp functions
134
and/or handles Lisp objects. HEADER gives the header of the C
135
function as a string. Non-negative-integer is the number of the main
136
stack entries used by the C function, primarily for protecting Lisp
137
objects from being garbage-collected. Each ELEMENT may give a C code
138
fragment as a string, or it may be a list
139
((symbol {arg}*) {place}*)
140
which, when executed, calls the Lisp function named by SYMBOL with the
141
specified arguments and saves the value(s) to the specified places.
142
The DEFCFUN form has the above meanings only after compiled; The GCL
143
interpreter simply ignores this form.
145
<p>An example which defines a C function list2 of two arguments, but which
146
calls the ’lisp’ function CONS by name, and refers to the constant ’NIL.
147
Note to be loaded by <code>load</code> the function should be static.
150
<p>(defCfun "static object list2(x,y) object x,y;" 0
151
"object z;"
155
"return(z);"
158
<p>In lisp the operations in the body would be
166
</p><div class="example">
167
<pre class="example">
168
(defCfun header non-negative-integer
170
| ( function-symbol { value }* )
171
| (( function-symbol { value }* ) { place }* ) })
176
{ C-expr | ( C-type C-expr ) }
183
{ object | int | char | float | double }
193
<dt><a name="index-CLINES"></a>Macro: <strong>CLINES</strong></dt>
197
</p><div class="example">
198
<pre class="example">(clines {string}*)
201
<p>GCL specific: The GCL compiler embeds STRINGs into the intermediate C
202
language code. The interpreter ignores this form.
208
<dt><a name="index-ALLOCATE"></a>Function: <strong>ALLOCATE</strong> <em>(type number &optional (really-allocate nil))</em></dt>
211
<p>GCL specific: Sets the maximum number of pages for the type class of the
212
GCL implementation type TYPE to NUMBER. If REALLY-ALLOCATE is given a
213
non-NIL value, then the specified number of pages will be allocated
220
<dt><a name="index-GBC"></a>Function: <strong>GBC</strong> <em>(x)</em></dt>
223
<p>GCL specific: Invokes the garbage collector (GC) with the collection level
224
specified by X. NIL as the argument causes GC to collect cells only. T as
225
the argument causes GC to collect everything.
231
<dt><a name="index-SAVE"></a>Function: <strong>SAVE</strong> <em>(pathname)</em></dt>
234
<p>GCL specific: Saves the current GCL core image into a program file specified
235
by PATHNAME. This function depends on the version of GCL. The function
236
si::save-system is to be preferred in almost all circumstances. Unlike
237
save, it makes the relocatable section permanent, and causes no future gc of
238
currently loaded .o files.
243
<dt><a name="index-HELP_002a"></a>Function: <strong>HELP*</strong> <em>(string &optional (package 'lisp))</em></dt>
246
<p>GCL specific: Prints the documentation associated with those symbols in the
247
specified package whose print names contain STRING as substring. STRING may
248
be a symbol, in which case the print-name of that symbol is used. If PACKAGE
249
is NIL, then all packages are searched.
255
<dt><a name="index-DEFLA"></a>Macro: <strong>DEFLA</strong></dt>
259
</p><div class="example">
260
<pre class="example">(defla name lambda-list {decl | doc}* {form}*)
263
<p>GCL specific: Used to DEFine Lisp Alternative. For the interpreter, DEFLA is
264
equivalent to DEFUN, but the compiler ignores this form.
270
<dt><a name="index-PROCLAMATION"></a>Function: <strong>PROCLAMATION</strong> <em>(decl-spec)</em></dt>
273
<p>GCL specific: Returns T if the specified declaration is globally in effect;
274
NIL otherwise. See the doc of DECLARE for possible DECL-SPECs.
280
<dt><a name="index-DEFENTRY"></a>Macro: <strong>DEFENTRY</strong></dt>
284
</p><div class="example">
285
<pre class="example">(defentry name arg-types c-function)
289
<p>GCL specific: The compiler defines a Lisp function whose body consists of a
290
calling sequence to the C language function specified by C-FUNCTION. The
291
interpreter ignores this form. The ARG-TYPES specifies the C types of the
292
arguments which C-FUNCTION requires. The list of allowed types is (object
293
char int float double string). Code will be produced to coerce from a lisp
294
object to the appropriate type before passing the argument to the C-FUNCTION.
295
The c-function should be of the form (c-result-type c-fname) where
296
c-result-type is a member of (void object char int float double string).
297
c-fname may be a symbol (in which case it will be downcased) or a string. If
298
c-function is not a list, then (object c-function) is assumed. In order
299
for C code to be loaded in by <code>load</code> you should declare any
300
variables and functions to be static. If you will link them in
301
at build time, of course you are allowed to define new externals.
303
<div class="example">
304
<pre class="example"> Sample usage:
306
;; JOE takes X a lisp string and Y a fixnum and returns a character.
307
(clines "#include \"foo.ch\"")
308
(defentry joe (string int) (char "our_c_fun"))
311
/* C function for extracting the i'th element of a string */
312
static char our_c_fun(p,i)
321
<p>One must be careful of storage allocation issues when passing a string.
322
If the C code invokes storage allocation (either by calling <code>malloc</code>
323
or <code>make_cons</code> etc), then there is a possibility of a garbage
324
collection, so that if the string passed was not constructed with
325
<code>:static t</code> when its array was constructed, then it could move.
326
If the C function may allocate storage, then you should pass a copy:
327
</p><div class="example">
328
<pre class="example">(defun safe-c-string (x)
329
(let* ((n (length x))
330
(a (make-array (+ n 1) :element-type 'string-char
331
:static t :fill-pointer n)))
332
(si::copy-array-portion x y 0 0 n)
333
(setf (aref a n) (code-char 0)))
341
<dt><a name="index-COPY_002dARRAY_002dPORTION"></a>Function: <strong>COPY-ARRAY-PORTION</strong> <em>(x,y,i1,i2,n1)</em></dt>
343
Copy elements from X to Y starting at X[i1] to Y[i2] and doing N1
344
elements if N1 is supplied otherwise, doing the length of X - I1
345
elements. If the types of the arrays are not the same, this has
346
implementation dependent results.
350
<dt><a name="index-BYE"></a>Function: <strong>BYE</strong> <em>( &optional (exit-status 0))</em></dt>
353
<p>GCL specific: Exits from GCL with exit-status.
359
<dt><a name="index-USE_002dFAST_002dLINKS"></a>Function: <strong>USE-FAST-LINKS</strong> <em>(turn-on)</em></dt>
362
<p>GCL specific: If TURN-ON is not nil, the fast link mechanism is enabled,
363
so that ordinary function calls will not appear in the invocation stack,
364
and calls will be much faster. This is the default. If you anticipate
365
needing to see a stack trace in the debugger, then you should turn this
371
<table class="menu" border="0" cellspacing="0">
372
<tr><td align="left" valign="top">• <a href="Bignums.html#Bignums" accesskey="1">Bignums</a>:</td><td> </td><td align="left" valign="top">
379
Next: <a href="C-Interface.html#C-Interface" accesskey="n" rel="next">C Interface</a>, Previous: <a href="Type.html#Type" accesskey="p" rel="prev">Type</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>