File: system.texi

package info (click to toggle)
gcl 2.6.14-19
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 60,804 kB
  • sloc: ansic: 177,407; lisp: 151,508; asm: 128,169; sh: 22,510; cpp: 11,923; tcl: 3,181; perl: 2,930; makefile: 2,360; sed: 334; yacc: 226; lex: 95; awk: 30; fortran: 24; csh: 23
file content (458 lines) | stat: -rwxr-xr-x 11,217 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458


@node Operating System, Structures, Symbols, Top
@chapter Operating System

@menu
* Command Line::                
* Operating System Definitions::  
@end menu

@node Command Line, Operating System Definitions, Operating System, Operating System
@section Command Line

The variable si::*command-args* is set to the list of strings passed
in when gcl is invoked.

Various flags are understood.
@vtable @code
@item -eval
Call read and then eval on the command argument following @code{-eval}
@item -load
Load the file whose pathname is specified after @code{-load}.
@item -f
Replace si::*command-args* by the the list starting after @code{-f}.
Open the file following @code{-f} for input, skip the first line, and then
read and eval the rest of the forms in the file.   This can be used
as with the shells to write small shell programs:
@example
#!/usr/local/bin/gcl.exe -f
(format t "hello world ~a~%" (nth 1 si::*command-args*))
@end example
The value si::*command-args* will have the appropriate value.
Thus if the above 2 line file is made executable and called @file{foo}
then
@example
tutorial% foo billy
hello world billy
@end example
@noindent
NOTE:  On many systems (eg SunOs) the first line of an executable script file
such as:
@example
#!/usr/local/bin/gcl.exe -f
@end example
only reads the first 32 characters!   So if your pathname where the executable
together with the '-f' amount to more than 32 characters the file will not
be recognized.   Also the executable must be the actual large binary file,
[or a link to it], 
and not just a @code{/bin/sh} script.   In latter case the
@code{/bin/sh} interpreter would get invoked on the file.

Alternately one could invoke the file @file{foo} without making it
executable:
@example
tutorial% gcl -f foo "from bill"
hello world from bill
@end example

Finally perhaps the best way (why do we save the best for last..
I guess because we only figure it out after all the others..)
The following file @file{myhello} has 4 lines: 
@example
#!/bin/sh
#| Lisp will skip the next 2 lines on reading
exec gcl   -f "$0" $@
|#
(format t "hello world ~a~%" (nth 1 si::*command-args*))
@end example

@example
marie% chmod a+x myhello
marie% myhello bill
hello world bill
@end example

The advantage of this method is that @file{gcl} can itself
be a shell script, which sets up environment and
so on.   Also the normal path will be searched to find @file{gcl}
The disadvantage is that this would cause 2 invocations of @file{sh}
and one invocation of @file{gcl}.   The plan using @file{gcl.exe}
bypasses the @file{sh} entirely.  Inded invoking @file{gcl.exe} to
print @file{hello world} is faster on most systems than a similar
@file{csh} or @file{bash} script, but slightly slower than the old
@file{sh}.   


@item -batch
Do not enter the command print loop.  Useful if the other command line
arguments do something.  Do not print the License and acknowledgement
information.  Note if your program does print any License information,
it must print the GCL header information also.
@item -dir
Directory where the executable binary that is running is located.
Needed by save and friends.  This gets set as si::*system-directory*
@item -libdir
@example
   -libdir @file{/d/wfs/gcl-2.0/}
@end example
would mean that the files like gcl-tk/tk.o would be found by
concatting the path to the libdir path, ie in
@example
@file{/d/wfs/gcl-2.0/gcl-tk/tk.o}
@end example
@item -compile
Invoke the compiler on the filename following @code{-compile}.
Other flags affect compilation.
@item -o-file
If nil follows @code{-o-file} then do not produce an @code{.o} file.
@item -c-file
If @code{-c-file} is specified, leave the intermediate @code{.c} file there.
@item -h-file
If @code{-h-file} is specified, leave the intermediate @code{.h} file there.
@item -data-file
If @code{-data-file} is specified, leave the intermediate @code{.data} file there.
@item -system-p
If @code{-system-p} is specified then invoke @code{compile-file} with the
@code{:system-p t} keyword argument, meaning that the C init function
will bear a name based on the name of the file, so that it may be invoked
by name by C code.
@end vtable

@node Operating System Definitions,  , Command Line, Operating System
@section Operating System Definitions

@defun GET-DECODED-TIME ()
Package:LISP

Returns the current time in decoded time format.  Returns nine values: second,
minute, hour, date, month, year, day-of-week, daylight-saving-time-p, and
time-zone.


@end defun

@defun HOST-NAMESTRING (pathname)
Package:LISP

Returns the host part of PATHNAME as a string.


@end defun

@defun RENAME-FILE (file new-name)
Package:LISP

Renames the file FILE to NEW-NAME.  FILE may be a string, a pathname, or
a stream.


@end defun

@defun FILE-AUTHOR (file)
Package:LISP

Returns the author name of the specified file, as a string.
FILE may be a string or a stream


@end defun

@defun PATHNAME-HOST (pathname)
Package:LISP

Returns the host slot of PATHNAME.


@end defun

@defun FILE-POSITION (file-stream &optional position)
Package:LISP

Sets the file pointer of the specified file to POSITION, if POSITION is given.
Otherwise, returns the current file position of the specified file.


@end defun

@defun DECODE-UNIVERSAL-TIME (universal-time &optional (timezone -9))
Package:LISP

Converts UNIVERSAL-TIME into a decoded time at the TIMEZONE.
Returns nine values: second, minute, hour, date, month (1 - 12), year,
day-of-week (0 - 6), daylight-saving-time-p, and time-zone.
TIMEZONE in GCL defaults to 6, the time zone of Austin, Texas.


@end defun

@defun USER-HOMEDIR-PATHNAME (&optional host)
Package:LISP

Returns the home directory of the logged in user as a pathname.  HOST
is ignored.


@end defun


@defvar *MODULES* 
Package:LISP
A list of names of the modules that have been loaded into GCL.


@end defvar

@defun SHORT-SITE-NAME ()
Package:LISP

Returns a string that identifies the physical location of the current GCL.


@end defun

@defun DIRECTORY (name)
Package:LISP

Returns a list of files that match NAME.  NAME may be a string, a pathname,
or a file stream.


@end defun

@defun SOFTWARE-VERSION ()
Package:LISP

Returns a string that identifies the software version of the software
under which GCL is currently running.


@end defun

@defvr {Constant} INTERNAL-TIME-UNITS-PER-SECOND 
Package:LISP
The number of internal time units that fit into a second.


@end defvr

@defun ENOUGH-NAMESTRING (pathname &optional (defaults *default-pathname-defaults*))
Package:LISP

Returns a string which uniquely identifies PATHNAME with respect to
DEFAULTS.


@end defun

@defun REQUIRE (module-name &optional (pathname))
Package:LISP

If the specified module is not present, then loads the appropriate file(s).
PATHNAME may be a single pathname or it may be a list of pathnames.


@end defun

@defun ENCODE-UNIVERSAL-TIME (second minute hour date month year &optional (timezone ))
Package:LISP

Does the inverse operation of DECODE-UNIVERSAL-TIME.


@end defun

@defun LISP-IMPLEMENTATION-VERSION ()
Package:LISP

Returns a string that tells you when the current GCL implementation is
brought up.


@end defun

@defun MACHINE-INSTANCE ()
Package:LISP

Returns a string that identifies the machine instance of the machine
on which GCL is currently running.


@end defun

@defun ROOM (&optional (x t))
Package:LISP

Displays information about storage allocation in the following format.

@itemize @asis{}

@item
for each type class
@itemize @asis{}
@item
the number of pages so-far allocated for the type class
@item
the maximum number of pages for the type class
@item
the percentage of used cells to cells so-far allocated
@item
the number of times the garbage collector has been called to
	  collect cells of the type class
@item
the implementation types that belongs to the type class
@end itemize
@item
the number of pages actually allocated for contiguous blocks
@item
the maximum number of pages for contiguous blocks
@item
the number of times the garbage collector has been called to collect
  contiguous blocks
@item
the number of pages in the hole
@item
the maximum number of pages for relocatable blocks
@item
the number of times the garbage collector has been called to collect
  relocatable blocks
@item
the total number of pages allocated for cells
@item
the total number of pages allocated
@item
the number of available pages
@item
the number of pages GCL can use.

The number of times the garbage collector has been called is not shown,
if the number is zero.  The optional X is ignored.
@end itemize

@end defun

@defun GET-UNIVERSAL-TIME ()
Package:LISP

Returns the current time as a single integer in universal time format.


@end defun

@defun GET-INTERNAL-RUN-TIME ()
Package:LISP

Returns the run time in the internal time format.  This is useful for
finding CPU usage.  If the operating system allows, a second value
containing CPU usage of child processes is returned.


@end defun

@defvar *DEFAULT-PATHNAME-DEFAULTS* 
Package:LISP
The default pathname-defaults pathname.


@end defvar

@defun LONG-SITE-NAME ()
Package:LISP

Returns a string that identifies the physical location of the current GCL.


@end defun

@defun DELETE-FILE (file)
Package:LISP
 Deletes FILE.


@end defun

@defun GET-INTERNAL-REAL-TIME ()
Package:LISP

Returns the real time in the internal time format.  This is useful for
finding elapsed time.


@end defun

@defun MACHINE-TYPE ()
Package:LISP

Returns a string that identifies the machine type of the machine
on which GCL is currently running.


@end defun

@deffn {Macro} TIME 
Package:LISP

Syntax:
@example
(time form)
@end example

Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*.


@end deffn

@defun SOFTWARE-TYPE ()
Package:LISP

Returns a string that identifies the software type of the software
under which GCL is currently running.


@end defun

@defun LISP-IMPLEMENTATION-TYPE ()
Package:LISP

Returns a string that tells you that you are using a version of GCL.


@end defun

@defun SLEEP (n)
Package:LISP

This function causes execution to be suspended for N seconds.  N may
be any non-negative, non-complex number.


@end defun

@defun BREAK-ON-FLOATING-POINT-EXCEPTIONS (&key division-by-zero
                                                floating-point-invalid-operation
                                                floating-point-overflow
                                                floating-point-underflow
                                                floating-point-inexact)
Package:SI

Break on the specified IEEE floating point error conditions.  With no
arguments, report the exceptions currently trapped.  Disable the break
by setting the key to nil, e.g.

   > (break-on-floaing-point-exceptions :division-by-zero t)
   (DIVISION-BY-ZERO)

   > (break-on-floaing-point-exceptions)
   (DIVISION-BY-ZERO)

   > (break-on-floaing-point-exceptions :division-by-zero nil)
   NIL

On some of the most common platforms, the offending instruction will be
disassembled, and the register arguments looked up in the saved context
and reported in as operands.  Within the error handler, addresses may be
disassembled, and other registers inspected, using the functions defined
in gcl_fpe.lsp.

@end defun