~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to info/system.texi

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
@node Operating System, Structures, Symbols, Top
 
4
@chapter Operating System
 
5
 
 
6
@menu
 
7
* Command Line::                
 
8
* Operating System Definitions::  
 
9
@end menu
 
10
 
 
11
@node Command Line, Operating System Definitions, Operating System, Operating System
 
12
@section Command Line
 
13
 
 
14
The variable si::*command-args* is set to the list of strings passed
 
15
in when gcl is invoked.
 
16
 
 
17
Various flags are understood.
 
18
@vtable @code
 
19
@item -eval
 
20
Call read and then eval on the command argument following @code{-eval}
 
21
@item -load
 
22
Load the file whose pathname is specified after @code{-load}.
 
23
@item -f
 
24
Replace si::*command-args* by the the list starting after @code{-f}.
 
25
Open the file following @code{-f} for input, skip the first line, and then
 
26
read and eval the rest of the forms in the file.   This can be used
 
27
as with the shells to write small shell programs:
 
28
@example
 
29
#!/usr/local/bin/gcl.exe -f
 
30
(format t "hello world ~a~%" (nth 1 si::*command-args*))
 
31
@end example
 
32
The value si::*command-args* will have the appropriate value.
 
33
Thus if the above 2 line file is made executable and called @file{foo}
 
34
then
 
35
@example
 
36
tutorial% foo billy
 
37
hello world billy
 
38
@end example
 
39
@noindent
 
40
NOTE:  On many systems (eg SunOs) the first line of an executable script file
 
41
such as:
 
42
@example
 
43
#!/usr/local/bin/gcl.exe -f
 
44
@end example
 
45
only reads the first 32 characters!   So if your pathname where the executable
 
46
together with the '-f' amount to more than 32 characters the file will not
 
47
be recognized.   Also the executable must be the actual large binary file,
 
48
[or a link to it], 
 
49
and not just a @code{/bin/sh} script.   In latter case the
 
50
@code{/bin/sh} interpreter would get invoked on the file.
 
51
 
 
52
Alternately one could invoke the file @file{foo} without making it
 
53
executable:
 
54
@example
 
55
tutorial% gcl -f foo "from bill"
 
56
hello world from bill
 
57
@end example
 
58
 
 
59
Finally perhaps the best way (why do we save the best for last..
 
60
I guess because we only figure it out after all the others..)
 
61
The following file @file{myhello} has 4 lines: 
 
62
@example
 
63
#!/bin/sh
 
64
#| Lisp will skip the next 2 lines on reading
 
65
exec gcl   -f "$0" $@
 
66
|#
 
67
(format t "hello world ~a~%" (nth 1 si::*command-args*))
 
68
@end example
 
69
 
 
70
@example
 
71
marie% chmod a+x myhello
 
72
marie% myhello bill
 
73
hello world bill
 
74
@end example
 
75
 
 
76
The advantage of this method is that @file{gcl} can itself
 
77
be a shell script, which sets up environment and
 
78
so on.   Also the normal path will be searched to find @file{gcl}
 
79
The disadvantage is that this would cause 2 invocations of @file{sh}
 
80
and one invocation of @file{gcl}.   The plan using @file{gcl.exe}
 
81
bypasses the @file{sh} entirely.  Inded invoking @file{gcl.exe} to
 
82
print @file{hello world} is faster on most systems than a similar
 
83
@file{csh} or @file{bash} script, but slightly slower than the old
 
84
@file{sh}.   
 
85
 
 
86
 
 
87
@item -batch
 
88
Do not enter the command print loop.  Useful if the other command line
 
89
arguments do something.  Do not print the License and acknowledgement
 
90
information.  Note if your program does print any License information,
 
91
it must print the GCL header information also.
 
92
@item -dir
 
93
Directory where the executable binary that is running is located.
 
94
Needed by save and friends.  This gets set as si::*system-directory*
 
95
@item -libdir
 
96
@example
 
97
   -libdir @file{/d/wfs/gcl-2.0/}
 
98
@end example
 
99
would mean that the files like gcl-tk/tk.o would be found by
 
100
concatting the path to the libdir path, ie in
 
101
@example
 
102
@file{/d/wfs/gcl-2.0/gcl-tk/tk.o}
 
103
@end example
 
104
@item -compile
 
105
Invoke the compiler on the filename following @code{-compile}.
 
106
Other flags affect compilation.
 
107
@item -o-file
 
108
If nil follows @code{-o-file} then do not produce an @code{.o} file.
 
109
@item -c-file
 
110
If @code{-c-file} is specified, leave the intermediate @code{.c} file there.
 
111
@item -h-file
 
112
If @code{-h-file} is specified, leave the intermediate @code{.h} file there.
 
113
@item -data-file
 
114
If @code{-data-file} is specified, leave the intermediate @code{.data} file there.
 
115
@item -system-p
 
116
If @code{-system-p} is specified then invoke @code{compile-file} with the
 
117
@code{:system-p t} keyword argument, meaning that the C init function
 
118
will bear a name based on the name of the file, so that it may be invoked
 
119
by name by C code.
 
120
@end vtable
 
121
 
 
122
@node Operating System Definitions,  , Command Line, Operating System
 
123
@section Operating System Definitions
 
124
 
 
125
@defun GET-DECODED-TIME ()
 
126
Package:LISP
 
127
 
 
128
Returns the current time in decoded time format.  Returns nine values: second,
 
129
minute, hour, date, month, year, day-of-week, daylight-saving-time-p, and
 
130
time-zone.
 
131
 
 
132
 
 
133
@end defun
 
134
 
 
135
@defun HOST-NAMESTRING (pathname)
 
136
Package:LISP
 
137
 
 
138
Returns the host part of PATHNAME as a string.
 
139
 
 
140
 
 
141
@end defun
 
142
 
 
143
@defun RENAME-FILE (file new-name)
 
144
Package:LISP
 
145
 
 
146
Renames the file FILE to NEW-NAME.  FILE may be a string, a pathname, or
 
147
a stream.
 
148
 
 
149
 
 
150
@end defun
 
151
 
 
152
@defun FILE-AUTHOR (file)
 
153
Package:LISP
 
154
 
 
155
Returns the author name of the specified file, as a string.
 
156
FILE may be a string or a stream
 
157
 
 
158
 
 
159
@end defun
 
160
 
 
161
@defun PATHNAME-HOST (pathname)
 
162
Package:LISP
 
163
 
 
164
Returns the host slot of PATHNAME.
 
165
 
 
166
 
 
167
@end defun
 
168
 
 
169
@defun FILE-POSITION (file-stream &optional position)
 
170
Package:LISP
 
171
 
 
172
Sets the file pointer of the specified file to POSITION, if POSITION is given.
 
173
Otherwise, returns the current file position of the specified file.
 
174
 
 
175
 
 
176
@end defun
 
177
 
 
178
@defun DECODE-UNIVERSAL-TIME (universal-time &optional (timezone -9))
 
179
Package:LISP
 
180
 
 
181
Converts UNIVERSAL-TIME into a decoded time at the TIMEZONE.
 
182
Returns nine values: second, minute, hour, date, month (1 - 12), year,
 
183
day-of-week (0 - 6), daylight-saving-time-p, and time-zone.
 
184
TIMEZONE in GCL defaults to 6, the time zone of Austin, Texas.
 
185
 
 
186
 
 
187
@end defun
 
188
 
 
189
@defun USER-HOMEDIR-PATHNAME (&optional host)
 
190
Package:LISP
 
191
 
 
192
Returns the home directory of the logged in user as a pathname.  HOST
 
193
is ignored.
 
194
 
 
195
 
 
196
@end defun
 
197
 
 
198
 
 
199
@defvar *MODULES* 
 
200
Package:LISP
 
201
A list of names of the modules that have been loaded into GCL.
 
202
 
 
203
 
 
204
@end defvar
 
205
 
 
206
@defun SHORT-SITE-NAME ()
 
207
Package:LISP
 
208
 
 
209
Returns a string that identifies the physical location of the current GCL.
 
210
 
 
211
 
 
212
@end defun
 
213
 
 
214
@defun DIRECTORY (name)
 
215
Package:LISP
 
216
 
 
217
Returns a list of files that match NAME.  NAME may be a string, a pathname,
 
218
or a file stream.
 
219
 
 
220
 
 
221
@end defun
 
222
 
 
223
@defun SOFTWARE-VERSION ()
 
224
Package:LISP
 
225
 
 
226
Returns a string that identifies the software version of the software
 
227
under which GCL is currently running.
 
228
 
 
229
 
 
230
@end defun
 
231
 
 
232
@defvr {Constant} INTERNAL-TIME-UNITS-PER-SECOND 
 
233
Package:LISP
 
234
The number of internal time units that fit into a second.
 
235
 
 
236
 
 
237
@end defvr
 
238
 
 
239
@defun ENOUGH-NAMESTRING (pathname &optional (defaults *default-pathname-defaults*))
 
240
Package:LISP
 
241
 
 
242
Returns a string which uniquely identifies PATHNAME with respect to
 
243
DEFAULTS.
 
244
 
 
245
 
 
246
@end defun
 
247
 
 
248
@defun REQUIRE (module-name &optional (pathname))
 
249
Package:LISP
 
250
 
 
251
If the specified module is not present, then loads the appropriate file(s).
 
252
PATHNAME may be a single pathname or it may be a list of pathnames.
 
253
 
 
254
 
 
255
@end defun
 
256
 
 
257
@defun ENCODE-UNIVERSAL-TIME (second minute hour date month year &optional (timezone ))
 
258
Package:LISP
 
259
 
 
260
Does the inverse operation of DECODE-UNIVERSAL-TIME.
 
261
 
 
262
 
 
263
@end defun
 
264
 
 
265
@defun LISP-IMPLEMENTATION-VERSION ()
 
266
Package:LISP
 
267
 
 
268
Returns a string that tells you when the current GCL implementation is
 
269
brought up.
 
270
 
 
271
 
 
272
@end defun
 
273
 
 
274
@defun MACHINE-INSTANCE ()
 
275
Package:LISP
 
276
 
 
277
Returns a string that identifies the machine instance of the machine
 
278
on which GCL is currently running.
 
279
 
 
280
 
 
281
@end defun
 
282
 
 
283
@defun ROOM (&optional (x t))
 
284
Package:LISP
 
285
 
 
286
Displays information about storage allocation in the following format.
 
287
 
 
288
@itemize @asis
 
289
 
 
290
@item
 
291
for each type class
 
292
@itemize @asis
 
293
@item
 
294
the number of pages so-far allocated for the type class
 
295
@item
 
296
the maximum number of pages for the type class
 
297
@item
 
298
the percentage of used cells to cells so-far allocated
 
299
@item
 
300
the number of times the garbage collector has been called to
 
301
          collect cells of the type class
 
302
@item
 
303
the implementation types that belongs to the type class
 
304
@end itemize
 
305
@item
 
306
the number of pages actually allocated for contiguous blocks
 
307
@item
 
308
the maximum number of pages for contiguous blocks
 
309
@item
 
310
the number of times the garbage collector has been called to collect
 
311
  contiguous blocks
 
312
@item
 
313
the number of pages in the hole
 
314
@item
 
315
the maximum number of pages for relocatable blocks
 
316
@item
 
317
the number of times the garbage collector has been called to collect
 
318
  relocatable blocks
 
319
@item
 
320
the total number of pages allocated for cells
 
321
@item
 
322
the total number of pages allocated
 
323
@item
 
324
the number of available pages
 
325
@item
 
326
the number of pages GCL can use.
 
327
 
 
328
The number of times the garbage collector has been called is not shown,
 
329
if the number is zero.  The optional X is ignored.
 
330
@end itemize
 
331
 
 
332
@end defun
 
333
 
 
334
@defun GET-UNIVERSAL-TIME ()
 
335
Package:LISP
 
336
 
 
337
Returns the current time as a single integer in universal time format.
 
338
 
 
339
 
 
340
@end defun
 
341
 
 
342
@defun GET-INTERNAL-RUN-TIME ()
 
343
Package:LISP
 
344
 
 
345
Returns the run time in the internal time format.  This is useful for
 
346
finding CPU usage.  If the operating system allows, a second value
 
347
containing CPU usage of child processes is returned.
 
348
 
 
349
 
 
350
@end defun
 
351
 
 
352
@defvar *DEFAULT-PATHNAME-DEFAULTS* 
 
353
Package:LISP
 
354
The default pathname-defaults pathname.
 
355
 
 
356
 
 
357
@end defvar
 
358
 
 
359
@defun LONG-SITE-NAME ()
 
360
Package:LISP
 
361
 
 
362
Returns a string that identifies the physical location of the current GCL.
 
363
 
 
364
 
 
365
@end defun
 
366
 
 
367
@defun DELETE-FILE (file)
 
368
Package:LISP
 
369
 Deletes FILE.
 
370
 
 
371
 
 
372
@end defun
 
373
 
 
374
@defun GET-INTERNAL-REAL-TIME ()
 
375
Package:LISP
 
376
 
 
377
Returns the real time in the internal time format.  This is useful for
 
378
finding elapsed time.
 
379
 
 
380
 
 
381
@end defun
 
382
 
 
383
@defun MACHINE-TYPE ()
 
384
Package:LISP
 
385
 
 
386
Returns a string that identifies the machine type of the machine
 
387
on which GCL is currently running.
 
388
 
 
389
 
 
390
@end defun
 
391
 
 
392
@deffn {Macro} TIME 
 
393
Package:LISP
 
394
 
 
395
Syntax:
 
396
@example
 
397
(time form)
 
398
@end example
 
399
 
 
400
Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*.
 
401
 
 
402
 
 
403
@end deffn
 
404
 
 
405
@defun SOFTWARE-TYPE ()
 
406
Package:LISP
 
407
 
 
408
Returns a string that identifies the software type of the software
 
409
under which GCL is currently running.
 
410
 
 
411
 
 
412
@end defun
 
413
 
 
414
@defun LISP-IMPLEMENTATION-TYPE ()
 
415
Package:LISP
 
416
 
 
417
Returns a string that tells you that you are using a version of GCL.
 
418
 
 
419
 
 
420
@end defun
 
421
 
 
422
@defun SLEEP (n)
 
423
Package:LISP
 
424
 
 
425
This function causes execution to be suspended for N seconds.  N may
 
426
be any non-negative, non-complex number.
 
427
 
 
428
 
 
429
@end defun