Commit | Line | Data |
---|---|---|
f9a8037d C |
1 | |
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | CHAPTER 6 | |
9 | ||
10 | ||
11 | System Functions | |
12 | ||
13 | ||
14 | ||
15 | ||
16 | This chapter describes the functions used to interact | |
17 | with internal components of the Lisp system and operating | |
18 | system. | |
19 | ||
20 | (allocate 's_type 'x_pages) | |
21 | ||
22 | WHERE: s_type is one of the FRANZ LISP data types | |
23 | described in 1.3. | |
24 | ||
25 | RETURNS: x_pages. | |
26 | ||
27 | SIDE EFFECT: FRANZ LISP attempts to allocate x_pages of | |
28 | type s_type. If there aren't x_pages of | |
29 | memory left, no space will be allocated | |
30 | and an error will occur. The storage that | |
31 | is allocated is not given to the caller, | |
32 | instead it is added to the free storage | |
33 | list of s_type. The functions _\bs_\be_\bg_\bm_\be_\bn_\bt and | |
34 | _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt allocate blocks of storage | |
35 | and return it to the caller. | |
36 | ||
37 | (argv 'x_argnumb) | |
38 | ||
39 | RETURNS: a symbol whose pname is the x_argnumb_\bt_\bh argu- | |
40 | ment (starting at 0) on the command line which | |
41 | invoked the current lisp. | |
42 | ||
43 | NOTE: if x_argnumb is less than zero, a fixnum whose | |
44 | value is the number of arguments on the command | |
45 | line is returned. (_\ba_\br_\bg_\bv _\b0) returns the name of | |
46 | the lisp you are running. | |
47 | ||
48 | (baktrace) | |
49 | ||
50 | RETURNS: nil | |
51 | ||
52 | SIDE EFFECT: the lisp runtime stack is examined and the | |
53 | name of (most) of the functions currently | |
54 | in execution are printed, most active | |
55 | first. | |
56 | ||
57 | NOTE: this will occasionally miss the names of compiled | |
58 | lisp functions due to incomplete information on | |
59 | the stack. If you are tracing compiled code, | |
60 | then _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be won't be able to interpret the | |
61 | ||
62 | ||
63 | System Functions 6-1 | |
64 | ||
65 | ||
66 | ||
67 | ||
68 | ||
69 | ||
70 | ||
71 | System Functions 6-2 | |
72 | ||
73 | ||
74 | stack unless (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bn_\bi_\bl) was done. | |
75 | See the function _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk for another way of | |
76 | printing the lisp runtime stack. This misspel- | |
77 | ling is from Maclisp. | |
78 | ||
79 | (chdir 's_path) | |
80 | ||
81 | RETURNS: t iff the system call succeeds. | |
82 | ||
83 | SIDE EFFECT: the current directory set to s_path. Among | |
84 | other things, this will affect the default | |
85 | location where the input/output functions | |
86 | look for and create files. | |
87 | ||
88 | NOTE: _\bc_\bh_\bd_\bi_\br follows the standard UNIX conventions, if | |
89 | s_path does not begin with a slash, the default | |
90 | path is changed to the current path with s_path | |
91 | appended. _\bC_\bh_\bd_\bi_\br employs tilde-expansion (dis- | |
92 | cussed in Chapter 5). | |
93 | ||
94 | (command-line-args) | |
95 | ||
96 | RETURNS: a list of the arguments typed on the command | |
97 | line, either to the lisp interpreter, or saved | |
98 | lisp dump, or application compiled with the | |
99 | autorun option (liszt -r). | |
100 | ||
101 | (deref 'x_addr) | |
102 | ||
103 | RETURNS: The contents of x_addr, when thought of as a | |
104 | longword memory location. | |
105 | ||
106 | NOTE: This may be useful in constructing arguments to C | |
107 | functions out of `dangerous' areas of memory. | |
108 | ||
109 | (dumplisp s_name) | |
110 | ||
111 | RETURNS: nil | |
112 | ||
113 | SIDE EFFECT: the current lisp is dumped to the named | |
114 | file. When s_name is executed, you will | |
115 | be in a lisp in the same state as when the | |
116 | dumplisp was done. | |
117 | ||
118 | NOTE: dumplisp will fail if one tries to write over the | |
119 | current running file. UNIX does not allow you to | |
120 | modify the file you are running. | |
121 | ||
122 | ||
123 | ||
124 | ||
125 | ||
126 | \e9 | |
127 | ||
128 | \e9 Printed: January 31, 1984 | |
129 | ||
130 | ||
131 | ||
132 | ||
133 | ||
134 | ||
135 | ||
136 | System Functions 6-3 | |
137 | ||
138 | ||
139 | (eval-when l_time g_exp1 ...) | |
140 | ||
141 | SIDE EFFECT: l_time may contain any combination of the | |
142 | symbols _\bl_\bo_\ba_\bd, _\be_\bv_\ba_\bl, and _\bc_\bo_\bm_\bp_\bi_\bl_\be. The | |
143 | effects of load and compile is discussed | |
144 | in 12.3.2.1 compiler. If eval is present | |
145 | however, this simply means that the | |
146 | expressions g_exp1 and so on are evaluated | |
147 | from left to right. If eval is not | |
148 | present, the forms are not evaluated. | |
149 | ||
150 | (exit ['x_code]) | |
151 | ||
152 | RETURNS: nothing (it never returns). | |
153 | ||
154 | SIDE EFFECT: the lisp system dies with exit code x_code | |
155 | or 0 if x_code is not specified. | |
156 | ||
157 | (fake 'x_addr) | |
158 | ||
159 | RETURNS: the lisp object at address x_addr. | |
160 | ||
161 | NOTE: This is intended to be used by people debugging | |
162 | the lisp system. | |
163 | ||
164 | (fork) | |
165 | ||
166 | RETURNS: nil to the child process and the process | |
167 | number of the child to the parent. | |
168 | ||
169 | SIDE EFFECT: A copy of the current lisp system is made | |
170 | in memory and both lisp systems now begin | |
171 | to run. This function can be used | |
172 | interactively to temporarily save the | |
173 | state of Lisp (as shown below), but you | |
174 | must be careful that only one of the | |
175 | lisp's interacts with the terminal after | |
176 | the fork. The _\bw_\ba_\bi_\bt function is useful for | |
177 | this. | |
178 | ||
179 | ||
180 | ||
181 | ||
182 | ||
183 | ||
184 | ||
185 | ||
186 | ||
187 | ||
188 | ||
189 | ||
190 | ||
191 | \e9 | |
192 | ||
193 | \e9 Printed: January 31, 1984 | |
194 | ||
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 | ||
201 | System Functions 6-4 | |
202 | ||
203 | ||
204 | ||
205 | ____________________________________________________ | |
206 | ||
207 | -> (_\bs_\be_\bt_\bq _\bf_\bo_\bo '_\bb_\ba_\br) ;; set a variable | |
208 | bar | |
209 | -> (_\bc_\bo_\bn_\bd ((_\bf_\bo_\br_\bk)(_\bw_\ba_\bi_\bt))) ;; duplicate the lisp system and | |
210 | nil ;; make the parent wait | |
211 | -> _\bf_\bo_\bo ;; check the value of the variable | |
212 | bar | |
213 | -> (_\bs_\be_\bt_\bq _\bf_\bo_\bo '_\bb_\ba_\bz) ;; give it a new value | |
214 | baz | |
215 | -> _\bf_\bo_\bo ;; make sure it worked | |
216 | baz | |
217 | -> (_\be_\bx_\bi_\bt) ;; exit the child | |
218 | (5274 . 0) ;; the _\bw_\ba_\bi_\bt function returns this | |
219 | -> _\bf_\bo_\bo ;; we check to make sure parent was | |
220 | bar ;; not modified. | |
221 | ____________________________________________________ | |
222 | ||
223 | ||
224 | ||
225 | ||
226 | (gc) | |
227 | ||
228 | RETURNS: nil | |
229 | ||
230 | SIDE EFFECT: this causes a garbage collection. | |
231 | ||
232 | NOTE: The function _\bg_\bc_\ba_\bf_\bt_\be_\br is not called automatically | |
233 | after this function finishes. Normally the user | |
234 | doesn't have to call _\bg_\bc since garbage collection | |
235 | occurs automatically whenever internal free lists | |
236 | are exhausted. | |
237 | ||
238 | (gcafter s_type) | |
239 | ||
240 | WHERE: s_type is one of the FRANZ LISP data types | |
241 | listed in 1.3. | |
242 | ||
243 | NOTE: this function is called by the garbage collector | |
244 | after a garbage collection which was caused by | |
245 | running out of data type s_type. This function | |
246 | should determine if more space need be allocated | |
247 | and if so should allocate it. There is a default | |
248 | gcafter function but users who want control over | |
249 | space allocation can define their own -- but note | |
250 | that it must be an nlambda. | |
251 | ||
252 | ||
253 | ||
254 | ||
255 | ||
256 | \e9 | |
257 | ||
258 | \e9 Printed: January 31, 1984 | |
259 | ||
260 | ||
261 | ||
262 | ||
263 | ||
264 | ||
265 | ||
266 | System Functions 6-5 | |
267 | ||
268 | ||
269 | (getenv 's_name) | |
270 | ||
271 | RETURNS: a symbol whose pname is the value of s_name in | |
272 | the current UNIX environment. If s_name | |
273 | doesn't exist in the current environment, a | |
274 | symbol with a null pname is returned. | |
275 | ||
276 | (hashtabstat) | |
277 | ||
278 | RETURNS: a list of fixnums representing the number of | |
279 | symbols in each bucket of the oblist. | |
280 | ||
281 | NOTE: the oblist is stored a hash table of buckets. | |
282 | Ideally there would be the same number of symbols | |
283 | in each bucket. | |
284 | ||
285 | (help [sx_arg]) | |
286 | ||
287 | SIDE EFFECT: If sx_arg is a symbol then the portion of | |
288 | this manual beginning with the description | |
289 | of sx_arg is printed on the terminal. If | |
290 | sx_arg is a fixnum or the name of one of | |
291 | the appendicies, that chapter or appendix | |
292 | is printed on the terminal. If no argu- | |
293 | ment is provided, _\bh_\be_\bl_\bp prints the options | |
294 | that it recognizes. The program `more' is | |
295 | used to print the manual on the terminal; | |
296 | it will stop after each page and will con- | |
297 | tinue after the space key is pressed. | |
298 | ||
299 | (include s_filename) | |
300 | ||
301 | RETURNS: nil | |
302 | ||
303 | SIDE EFFECT: The given filename is _\bl_\bo_\ba_\bded into the | |
304 | lisp. | |
305 | ||
306 | NOTE: this is similar to load except the argument is | |
307 | not evaluated. Include means something special | |
308 | to the compiler. | |
309 | ||
310 | (include-if 'g_predicate s_filename) | |
311 | ||
312 | RETURNS: nil | |
313 | ||
314 | SIDE EFFECT: This has the same effect as include, but | |
315 | is only actuated if the predicate is non- | |
316 | nil. | |
317 | ||
318 | ||
319 | ||
320 | ||
321 | \e9 | |
322 | ||
323 | \e9 Printed: January 31, 1984 | |
324 | ||
325 | ||
326 | ||
327 | ||
328 | ||
329 | ||
330 | ||
331 | System Functions 6-6 | |
332 | ||
333 | ||
334 | (includef 's_filename) | |
335 | ||
336 | RETURNS: nil | |
337 | ||
338 | SIDE EFFECT: this is the same as _\bi_\bn_\bc_\bl_\bu_\bd_\be except the | |
339 | argument is evaluated. | |
340 | ||
341 | (includef-if 'g_predicate s_filename) | |
342 | ||
343 | RETURNS: nil | |
344 | ||
345 | SIDE EFFECT: This has the same effect as includef, but | |
346 | is only actuated if the predicate is non- | |
347 | nil. | |
348 | ||
349 | (maknum 'g_arg) | |
350 | ||
351 | RETURNS: the address of its argument converted into a | |
352 | fixnum. | |
353 | ||
354 | (monitor ['xs_maxaddr]) | |
355 | ||
356 | RETURNS: t | |
357 | ||
358 | SIDE EFFECT: If xs_maxaddr is t then profiling of the | |
359 | entire lisp system is begun. If | |
360 | xs_maxaddr is a fixnum then profiling is | |
361 | done only up to address xs_maxaddr. If | |
362 | xs_maxaddr is not given, then profiling is | |
363 | stopped and the data obtained is written | |
364 | to the file 'mon.out' where it can be | |
365 | analyzed with the UNIX 'prof' program. | |
366 | ||
367 | NOTE: this function only works if the lisp system has | |
368 | been compiled in a special way, otherwise, an | |
369 | error is invoked. | |
370 | ||
371 | (opval 's_arg ['g_newval]) | |
372 | ||
373 | RETURNS: the value associated with s_arg before the | |
374 | call. | |
375 | ||
376 | SIDE EFFECT: If g_newval is specified, the value asso- | |
377 | ciated with s_arg is changed to g_newval. | |
378 | ||
379 | NOTE: _\bo_\bp_\bv_\ba_\bl keeps track of storage allocation. If s_arg | |
380 | is one of the data types then _\bo_\bp_\bv_\ba_\bl will return a | |
381 | list of three fixnums representing the number of | |
382 | items of that type in use, the number of pages | |
383 | allocated and the number of items of that type | |
384 | per page. You should never try to change the | |
385 | value _\bo_\bp_\bv_\ba_\bl associates with a data type using | |
386 | _\bo_\bp_\bv_\ba_\bl. | |
387 | ||
388 | ||
389 | Printed: January 31, 1984 | |
390 | ||
391 | ||
392 | ||
393 | ||
394 | ||
395 | ||
396 | ||
397 | System Functions 6-7 | |
398 | ||
399 | ||
400 | If s_arg is _\bp_\ba_\bg_\be_\bl_\bi_\bm_\bi_\bt then _\bo_\bp_\bv_\ba_\bl will return (and | |
401 | set if g_newval is given) the maximum amount of | |
402 | lisp data pages it will allocate. This limit | |
403 | should remain small unless you know your program | |
404 | requires lots of space as this limit will catch | |
405 | programs in infinite loops which gobble up | |
406 | memory. | |
407 | ||
408 | (*process 'st_command ['g_readp ['g_writep]]) | |
409 | ||
410 | RETURNS: either a fixnum if one argument is given, or a | |
411 | list of two ports and a fixnum if two or three | |
412 | arguments are given. | |
413 | ||
414 | NOTE: *_\bp_\br_\bo_\bc_\be_\bs_\bs starts another process by passing | |
415 | st_command to the shell (it first tries /bin/csh, | |
416 | then it tries /bin/sh if /bin/csh doesn't exist). | |
417 | If only one argument is given to *_\bp_\br_\bo_\bc_\be_\bs_\bs, *_\bp_\br_\bo_\b- | |
418 | _\bc_\be_\bs_\bs waits for the new process to die and then | |
419 | returns the exit code of the new process. If | |
420 | more two or three arguments are given, *_\bp_\br_\bo_\bc_\be_\bs_\bs | |
421 | starts the process and then returns a list which, | |
422 | depending on the value of g_readp and g_writep, | |
423 | may contain i/o ports for communcating with the | |
424 | new process. If g_writep is non-null, then a | |
425 | port will be created which the lisp program can | |
426 | use to send characters to the new process. If | |
427 | g_readp is non-null, then a port will be created | |
428 | which the lisp program can use to read characters | |
429 | from the new process. The value returned by | |
430 | *_\bp_\br_\bo_\bc_\be_\bs_\bs is (readport writeport pid) where read- | |
431 | port and writeport are either nil or a port based | |
432 | on the value of g_readp and g_writep. Pid is the | |
433 | process id of the new process. Since it is hard | |
434 | to remember the order of g_readp and g_writep, | |
435 | the functions *_\bp_\br_\bo_\bc_\be_\bs_\bs-_\bs_\be_\bn_\bd and *_\bp_\br_\bo_\bc_\be_\bs_\bs-_\br_\be_\bc_\be_\bi_\bv_\be | |
436 | were written to perform the common functions. | |
437 | ||
438 | (*process-receive 'st_command) | |
439 | ||
440 | RETURNS: a port which can be read. | |
441 | ||
442 | SIDE EFFECT: The command st_command is given to the | |
443 | shell and it is started running in the | |
444 | background. The output of that command is | |
445 | available for reading via the port | |
446 | returned. The input of the command pro- | |
447 | cess is set to /dev/null. | |
448 | ||
449 | ||
450 | ||
451 | ||
452 | \e9 | |
453 | ||
454 | \e9 Printed: January 31, 1984 | |
455 | ||
456 | ||
457 | ||
458 | ||
459 | ||
460 | ||
461 | ||
462 | System Functions 6-8 | |
463 | ||
464 | ||
465 | (*process-send 'st_command) | |
466 | ||
467 | RETURNS: a port which can be written to. | |
468 | ||
469 | SIDE EFFECT: The command st_command is given to the | |
470 | shell and it is started runing in the | |
471 | background. The lisp program can provide | |
472 | input for that command by sending charac- | |
473 | ters to the port returned by this func- | |
474 | tion. The output of the command process | |
475 | is set to /dev/null. | |
476 | ||
477 | (process s_pgrm [s_frompipe s_topipe]) | |
478 | ||
479 | RETURNS: if the optional arguments are not present a | |
480 | fixnum which is the exit code when s_prgm | |
481 | dies. If the optional arguments are present, | |
482 | it returns a fixnum which is the process id of | |
483 | the child. | |
484 | ||
485 | NOTE: This command is obsolete. New programs should | |
486 | use one of the *_\bp_\br_\bo_\bc_\be_\bs_\bs commands given above. | |
487 | ||
488 | SIDE EFFECT: If s_frompipe and s_topipe are given, they | |
489 | are bound to ports which are pipes which | |
490 | direct characters from FRANZ LISP to the | |
491 | new process and to FRANZ LISP from the new | |
492 | process respectively. _\bP_\br_\bo_\bc_\be_\bs_\bs forks a | |
493 | process named s_prgm and waits for it to | |
494 | die iff there are no pipe arguments given. | |
495 | ||
496 | (ptime) | |
497 | ||
498 | RETURNS: a list of two elements. The first is the | |
499 | amount of processor time used by the lisp sys- | |
500 | tem so far, and the second is the amount of | |
501 | time used by the garbage collector so far. | |
502 | ||
503 | NOTE: the time is measured in those units used by the | |
504 | _\bt_\bi_\bm_\be_\bs(2) system call, usually 60_\bt_\bhs of a second. | |
505 | The first number includes the second number. The | |
506 | amount of time used by garbage collection is not | |
507 | recorded until the first call to ptime. This is | |
508 | done to prevent overhead when the user is not | |
509 | interested in garbage collection times. | |
510 | ||
511 | ||
512 | ||
513 | ||
514 | ||
515 | ||
516 | ||
517 | \e9 | |
518 | ||
519 | \e9 Printed: January 31, 1984 | |
520 | ||
521 | ||
522 | ||
523 | ||
524 | ||
525 | ||
526 | ||
527 | System Functions 6-9 | |
528 | ||
529 | ||
530 | (reset) | |
531 | ||
532 | SIDE EFFECT: the lisp runtime stack is cleared and the | |
533 | system restarts at the top level by exe- | |
534 | cuting a (_\bf_\bu_\bn_\bc_\ba_\bl_\bl _\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl _\bn_\bi_\bl). | |
535 | ||
536 | (restorelisp 's_name) | |
537 | ||
538 | SIDE EFFECT: this reads in file s_name (which was | |
539 | created by _\bs_\ba_\bv_\be_\bl_\bi_\bs_\bp) and then does a | |
540 | (_\br_\be_\bs_\be_\bt). | |
541 | ||
542 | NOTE: This is only used on VMS systems where _\bd_\bu_\bm_\bp_\bl_\bi_\bs_\bp | |
543 | cannot be used. | |
544 | ||
545 | (retbrk ['x_level]) | |
546 | ||
547 | WHERE: x_level is a small integer of either sign. | |
548 | ||
549 | SIDE EFFECT: The default error handler keeps a notion | |
550 | of the current level of the error caught. | |
551 | If x_level is negative, control is thrown | |
552 | to this default error handler whose level | |
553 | is that many less than the present, or to | |
554 | _\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl if there aren't enough. If | |
555 | x_level is non-negative, control is passed | |
556 | to the handler at that level. If x_level | |
557 | is not present, the value -1 is taken by | |
558 | default. | |
559 | ||
560 | (*rset 'g_flag) | |
561 | ||
562 | RETURNS: g_flag | |
563 | ||
564 | SIDE EFFECT: If g_flag is non nil then the lisp system | |
565 | will maintain extra information about | |
566 | calls to _\be_\bv_\ba_\bl and _\bf_\bu_\bn_\bc_\ba_\bl_\bl. This record | |
567 | keeping slows down the evaluation but this | |
568 | is required for the functions _\be_\bv_\ba_\bl_\bh_\bo_\bo_\bk, | |
569 | _\bf_\bu_\bn_\bc_\ba_\bl_\bl_\bh_\bo_\bo_\bk, and _\be_\bv_\ba_\bl_\bf_\br_\ba_\bm_\be to work. To | |
570 | debug compiled lisp code the transfer | |
571 | tables should be unlinked: | |
572 | (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bn_\bi_\bl) | |
573 | ||
574 | ||
575 | ||
576 | ||
577 | ||
578 | ||
579 | ||
580 | ||
581 | ||
582 | \e9 | |
583 | ||
584 | \e9 Printed: January 31, 1984 | |
585 | ||
586 | ||
587 | ||
588 | ||
589 | ||
590 | ||
591 | ||
592 | System Functions 6-10 | |
593 | ||
594 | ||
595 | (savelisp 's_name) | |
596 | ||
597 | RETURNS: t | |
598 | ||
599 | SIDE EFFECT: the state of the Lisp system is saved in | |
600 | the file s_name. It can be read in by | |
601 | _\br_\be_\bs_\bt_\bo_\br_\be_\bl_\bi_\bs_\bp. | |
602 | ||
603 | NOTE: This is only used on VMS systems where _\bd_\bu_\bm_\bp_\bl_\bi_\bs_\bp | |
604 | cannot be used. | |
605 | ||
606 | (segment 's_type 'x_size) | |
607 | ||
608 | WHERE: s_type is one of the data types given in 1.3 | |
609 | ||
610 | RETURNS: a segment of contiguous lispvals of type | |
611 | s_type. | |
612 | ||
613 | NOTE: In reality, _\bs_\be_\bg_\bm_\be_\bn_\bt returns a new data cell of | |
614 | type s_type and allocates space for x_size - 1 | |
615 | more s_type's beyond the one returned. _\bS_\be_\bg_\bm_\be_\bn_\bt | |
616 | always allocates new space and does so in 512 | |
617 | byte chunks. If you ask for 2 fixnums, segment | |
618 | will actually allocate 128 of them thus wasting | |
619 | 126 fixnums. The function _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt is a | |
620 | smarter space allocator and should be used when- | |
621 | ever possible. | |
622 | ||
623 | (shell) | |
624 | ||
625 | RETURNS: the exit code of the shell when it dies. | |
626 | ||
627 | SIDE EFFECT: this forks a new shell and returns when | |
628 | the shell dies. | |
629 | ||
630 | (showstack) | |
631 | ||
632 | RETURNS: nil | |
633 | ||
634 | SIDE EFFECT: all forms currently in evaluation are | |
635 | printed, beginning with the most recent. | |
636 | For compiled code the most that showstack | |
637 | will show is the function name and it may | |
638 | miss some functions. | |
639 | ||
640 | ||
641 | ||
642 | ||
643 | ||
644 | ||
645 | ||
646 | ||
647 | \e9 | |
648 | ||
649 | \e9 Printed: January 31, 1984 | |
650 | ||
651 | ||
652 | ||
653 | ||
654 | ||
655 | ||
656 | ||
657 | System Functions 6-11 | |
658 | ||
659 | ||
660 | (signal 'x_signum 's_name) | |
661 | ||
662 | RETURNS: nil if no previous call to signal has been | |
663 | made, or the previously installed s_name. | |
664 | ||
665 | SIDE EFFECT: this declares that the function named | |
666 | s_name will handle the signal number | |
667 | x_signum. If s_name is nil, the signal is | |
668 | ignored. Presently only four UNIX signals | |
669 | are caught. They and their numbers are: | |
670 | Interrupt(2), Floating exception(8), | |
671 | Alarm(14), and Hang-up(1). | |
672 | ||
673 | (sizeof 'g_arg) | |
674 | ||
675 | RETURNS: the number of bytes required to store one | |
676 | object of type g_arg, encoded as a fixnum. | |
677 | ||
678 | (small-segment 's_type 'x_cells) | |
679 | ||
680 | WHERE: s_type is one of fixnum, flonum and value. | |
681 | ||
682 | RETURNS: a segment of x_cells data objects of type | |
683 | s_type. | |
684 | ||
685 | SIDE EFFECT: This may call _\bs_\be_\bg_\bm_\be_\bn_\bt to allocate new | |
686 | space or it may be able to fill the | |
687 | request on a page already allocated. The | |
688 | value returned by _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt is usually | |
689 | stored in the data subpart of an array | |
690 | object. | |
691 | ||
692 | (sstatus g_type g_val) | |
693 | ||
694 | RETURNS: g_val | |
695 | ||
696 | SIDE EFFECT: If g_type is not one of the special | |
697 | sstatus codes described in the next few | |
698 | pages this simply sets g_val as the value | |
699 | of status type g_type in the system status | |
700 | property list. | |
701 | ||
702 | ||
703 | ||
704 | ||
705 | ||
706 | ||
707 | ||
708 | ||
709 | ||
710 | ||
711 | ||
712 | \e9 | |
713 | ||
714 | \e9 Printed: January 31, 1984 | |
715 | ||
716 | ||
717 | ||
718 | ||
719 | ||
720 | ||
721 | ||
722 | System Functions 6-12 | |
723 | ||
724 | ||
725 | (sstatus appendmap g_val) | |
726 | ||
727 | RETURNS: g_val | |
728 | ||
729 | SIDE EFFECT: If g_val is non-null when _\bf_\ba_\bs_\bl is told to | |
730 | create a load map, it will append to the | |
731 | file name given in the _\bf_\ba_\bs_\bl command, | |
732 | rather than creating a new map file. The | |
733 | initial value is nil. | |
734 | ||
735 | (sstatus automatic-reset g_val) | |
736 | ||
737 | RETURNS: g_val | |
738 | ||
739 | SIDE EFFECT: If g_val is non-null when an error occurs | |
740 | which no one wants to handle, a _\br_\be_\bs_\be_\bt will | |
741 | be done instead of entering a primitive | |
742 | internal break loop. The initial value is | |
743 | t. | |
744 | ||
745 | (sstatus chainatom g_val) | |
746 | ||
747 | RETURNS: g_val | |
748 | ||
749 | SIDE EFFECT: If g_val is non nil and a _\bc_\ba_\br or _\bc_\bd_\br of a | |
750 | symbol is done, then nil will be returned | |
751 | instead of an error being signaled. This | |
752 | only affects the interpreter, not the com- | |
753 | piler. The initial value is nil. | |
754 | ||
755 | (sstatus dumpcore g_val) | |
756 | ||
757 | RETURNS: g_val | |
758 | ||
759 | SIDE EFFECT: If g_val is nil, FRANZ LISP tells UNIX | |
760 | that a segmentation violation or bus error | |
761 | should cause a core dump. If g_val is non | |
762 | nil then FRANZ LISP will catch those | |
763 | errors and print a message advising the | |
764 | user to reset. | |
765 | ||
766 | NOTE: The initial value for this flag is nil, and only | |
767 | those knowledgeable of the innards of the lisp | |
768 | system should ever set this flag non nil. | |
769 | ||
770 | ||
771 | ||
772 | ||
773 | ||
774 | ||
775 | ||
776 | ||
777 | \e9 | |
778 | ||
779 | \e9 Printed: January 31, 1984 | |
780 | ||
781 | ||
782 | ||
783 | ||
784 | ||
785 | ||
786 | ||
787 | System Functions 6-13 | |
788 | ||
789 | ||
790 | (sstatus dumpmode x_val) | |
791 | ||
792 | RETURNS: x_val | |
793 | ||
794 | SIDE EFFECT: All subsequent _\bd_\bu_\bm_\bp_\bl_\bi_\bs_\bp's will be done in | |
795 | mode x_val. x_val may be either 413 or | |
796 | 410 (decimal). | |
797 | ||
798 | NOTE: the advantage of mode 413 is that the dumped Lisp | |
799 | can be demand paged in when first started, which | |
800 | will make it start faster and disrupt other users | |
801 | less. The initial value is 413. | |
802 | ||
803 | (sstatus evalhook g_val) | |
804 | ||
805 | RETURNS: g_val | |
806 | ||
807 | SIDE EFFECT: When g_val is non nil, this enables the | |
808 | evalhook and funcallhook traps in the | |
809 | evaluator. See 14.4 for more details. | |
810 | ||
811 | (sstatus feature g_val) | |
812 | ||
813 | RETURNS: g_val | |
814 | ||
815 | SIDE EFFECT: g_val is added to the (_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be_\bs) | |
816 | list, | |
817 | ||
818 | (sstatus gcstrings g_val) | |
819 | ||
820 | RETURNS: g_val | |
821 | ||
822 | SIDE EFFECT: if g_val is non-null, and if string gar- | |
823 | bage collection was enabled when the lisp | |
824 | system was compiled, string space will be | |
825 | garbage collected. | |
826 | ||
827 | NOTE: the default value for this is nil since in most | |
828 | applications garbage collecting strings is a | |
829 | waste of time. | |
830 | ||
831 | (sstatus ignoreeof g_val) | |
832 | ||
833 | RETURNS: g_val | |
834 | ||
835 | SIDE EFFECT: If g_val is non-null when an end of file | |
836 | (CNTL-D on UNIX) is typed to the standard | |
837 | top-level interpreter, it will be ignored | |
838 | rather then cause the lisp system to exit. | |
839 | If the the standard input is a file or | |
840 | pipe then this has no effect, an EOF will | |
841 | always cause lisp to exit. The initial | |
842 | value is nil. | |
843 | ||
844 | ||
845 | Printed: January 31, 1984 | |
846 | ||
847 | ||
848 | ||
849 | ||
850 | ||
851 | ||
852 | ||
853 | System Functions 6-14 | |
854 | ||
855 | ||
856 | (sstatus nofeature g_val) | |
857 | ||
858 | RETURNS: g_val | |
859 | ||
860 | SIDE EFFECT: g_val is removed from the status features | |
861 | list if it was present. | |
862 | ||
863 | (sstatus translink g_val) | |
864 | ||
865 | RETURNS: g_val | |
866 | ||
867 | SIDE EFFECT: If g_val is nil then all transfer tables | |
868 | are cleared and further calls through the | |
869 | transfer table will not cause the fast | |
870 | links to be set up. If g_val is the sym- | |
871 | bol _\bo_\bn then all possible transfer table | |
872 | entries will be linked and the flag will | |
873 | be set to cause fast links to be set up | |
874 | dynamically. Otherwise all that is done | |
875 | is to set the flag to cause fast links to | |
876 | be set up dynamically. The initial value | |
877 | is nil. | |
878 | ||
879 | NOTE: For a discussion of transfer tables, see 12.8. | |
880 | ||
881 | (sstatus uctolc g_val) | |
882 | ||
883 | RETURNS: g_val | |
884 | ||
885 | SIDE EFFECT: If g_val is not nil then all unescaped | |
886 | capital letters in symbols read by the | |
887 | reader will be converted to lower case. | |
888 | ||
889 | NOTE: This allows FRANZ LISP to be compatible with sin- | |
890 | gle case lisp systems (e.g. Maclisp, Interlisp | |
891 | and UCILisp). | |
892 | ||
893 | (status g_code) | |
894 | ||
895 | RETURNS: the value associated with the status code | |
896 | g_code if g_code is not one of the special | |
897 | cases given below | |
898 | ||
899 | ||
900 | ||
901 | ||
902 | ||
903 | ||
904 | ||
905 | ||
906 | ||
907 | ||
908 | \e9 | |
909 | ||
910 | \e9 Printed: January 31, 1984 | |
911 | ||
912 | ||
913 | ||
914 | ||
915 | ||
916 | ||
917 | ||
918 | System Functions 6-15 | |
919 | ||
920 | ||
921 | (status ctime) | |
922 | ||
923 | RETURNS: a symbol whose print name is the current time | |
924 | and date. | |
925 | ||
926 | EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bc_\bt_\bi_\bm_\be) = |Sun Jun 29 16:51:26 1980| | |
927 | ||
928 | NOTE: This has been made obsolete by _\bt_\bi_\bm_\be-_\bs_\bt_\br_\bi_\bn_\bg, | |
929 | described below. | |
930 | ||
931 | (status feature g_val) | |
932 | ||
933 | RETURNS: t iff g_val is in the status features list. | |
934 | ||
935 | (status features) | |
936 | ||
937 | RETURNS: the value of the features code, which is a | |
938 | list of features which are present in this | |
939 | system. You add to this list with | |
940 | (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be '_\bg__\bv_\ba_\bl) and test if feature | |
941 | g_feat is present with | |
942 | (_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be '_\bg__\bf_\be_\ba_\bt). | |
943 | ||
944 | (status isatty) | |
945 | ||
946 | RETURNS: t iff the standard input is a terminal. | |
947 | ||
948 | (status localtime) | |
949 | ||
950 | RETURNS: a list of fixnums representing the current | |
951 | time. | |
952 | ||
953 | EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bl_\bo_\bc_\ba_\bl_\bt_\bi_\bm_\be) = (3 51 13 31 6 81 5 211 | |
954 | 1) | |
955 | means 3_\br_\bd second, 51_\bs_\bt minute, 13_\bt_\bh hour (1 | |
956 | p.m), 31_\bs_\bt day, month 6 (0 = January), year 81 | |
957 | (0 = 1900), day of the week 5 (0 = Sunday), | |
958 | 211_\bt_\bh day of the year and daylight savings | |
959 | time is in effect. | |
960 | ||
961 | (status syntax s_char) | |
962 | ||
963 | NOTE: This function should not be used. See the | |
964 | description of _\bg_\be_\bt_\bs_\by_\bn_\bt_\ba_\bx (in Chapter 7) for a | |
965 | replacement. | |
966 | ||
967 | ||
968 | ||
969 | ||
970 | ||
971 | ||
972 | ||
973 | \e9 | |
974 | ||
975 | \e9 Printed: January 31, 1984 | |
976 | ||
977 | ||
978 | ||
979 | ||
980 | ||
981 | ||
982 | ||
983 | System Functions 6-16 | |
984 | ||
985 | ||
986 | (status undeffunc) | |
987 | ||
988 | RETURNS: a list of all functions which transfer table | |
989 | entries point to but which are not defined at | |
990 | this point. | |
991 | ||
992 | NOTE: Some of the undefined functions listed could be | |
993 | arrays which have yet to be created. | |
994 | ||
995 | (status version) | |
996 | ||
997 | RETURNS: a string which is the current lisp version | |
998 | name. | |
999 | ||
1000 | EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bv_\be_\br_\bs_\bi_\bo_\bn) = "Franz Lisp, Opus 38.61" | |
1001 | ||
1002 | (syscall 'x_index ['xst_arg1 ...]) | |
1003 | ||
1004 | RETURNS: the result of issuing the UNIX system call | |
1005 | number x_index with arguments xst_arg_\bi. | |
1006 | ||
1007 | NOTE: The UNIX system calls are described in section 2 | |
1008 | of the UNIX Programmer's manual. If xst_arg_\bi is a | |
1009 | fixnum, then its value is passed as an argument, | |
1010 | if it is a symbol then its pname is passed and | |
1011 | finally if it is a string then the string itself | |
1012 | is passed as an argument. Some useful syscalls | |
1013 | are: | |
1014 | (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b2_\b0) returns process id. | |
1015 | (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b1_\b3) returns the number of seconds since | |
1016 | Jan 1, 1970. | |
1017 | (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b1_\b0 '_\bf_\bo_\bo) will unlink (delete) the file | |
1018 | foo. | |
1019 | ||
1020 | (sys:access 'st_filename 'x_mode) | |
1021 | (sys:chmod 'st_filename 'x_mode) | |
1022 | (sys:gethostname) | |
1023 | (sys:getpid) | |
1024 | (sys:getpwnam 'st_username) | |
1025 | (sys:link 'st_oldfilename 'st_newfilename) | |
1026 | (sys:time) | |
1027 | (sys:unlink 'st_filename) | |
1028 | ||
1029 | NOTE: We have been warned that the actual system call | |
1030 | numbers may vary among different UNIX systems. | |
1031 | Users concerned about portability may wish to use | |
1032 | this group of functions. Another advantage is | |
1033 | that tilde-expansion is performed on all filename | |
1034 | arguments. These functions do what is described | |
1035 | in the system call section of your UNIX manual. | |
1036 | ||
1037 | _\bs_\by_\bs:_\bg_\be_\bt_\bp_\bw_\bn_\ba_\bm returns a vector of four entries | |
1038 | from the password file, being the user name, user | |
1039 | ||
1040 | ||
1041 | Printed: January 31, 1984 | |
1042 | ||
1043 | ||
1044 | ||
1045 | ||
1046 | ||
1047 | ||
1048 | ||
1049 | System Functions 6-17 | |
1050 | ||
1051 | ||
1052 | id, group id, and home directory. | |
1053 | ||
1054 | (time-string ['x_seconds]) | |
1055 | ||
1056 | RETURNS: an ascii string giving the time and date which | |
1057 | was x_seconds after UNIX's idea of creation | |
1058 | (Midnight, Jan 1, 1970 GMT). If no argument | |
1059 | is given, time-string returns the current | |
1060 | date. This supplants (_\bs_\bt_\ba_\bt_\bu_\bs _\bc_\bt_\bi_\bm_\be), and may | |
1061 | be used to make the results of _\bf_\bi_\bl_\be_\bs_\bt_\ba_\bt more | |
1062 | intelligible. | |
1063 | ||
1064 | (top-level) | |
1065 | ||
1066 | RETURNS: nothing (it never returns) | |
1067 | ||
1068 | NOTE: This function is the top-level read-eval-print | |
1069 | loop. It never returns any value. Its main | |
1070 | utility is that if you redefine it, and do a | |
1071 | (reset) then the redefined (top-level) is then | |
1072 | invoked. The default top-level for Franz, allow | |
1073 | one to specify his own printer or reader, by | |
1074 | binding the symbols top-level-printer and top- | |
1075 | level-reader. One can let the default top-level | |
1076 | do most of the drudgery in catching _\br_\be_\bs_\be_\bt's, and | |
1077 | reading in .lisprc files, by binding the symbol | |
1078 | user-top-level, to a routine that concerns itself | |
1079 | only with the read-eval-print loop. | |
1080 | ||
1081 | (wait) | |
1082 | ||
1083 | RETURNS: a dotted pair (_\bp_\br_\bo_\bc_\be_\bs_\bs_\bi_\bd . _\bs_\bt_\ba_\bt_\bu_\bs) when the | |
1084 | next child process dies. | |
1085 | ||
1086 | ||
1087 | ||
1088 | ||
1089 | ||
1090 | ||
1091 | ||
1092 | ||
1093 | ||
1094 | ||
1095 | ||
1096 | ||
1097 | ||
1098 | ||
1099 | ||
1100 | ||
1101 | ||
1102 | ||
1103 | ||
1104 | \e9 | |
1105 | ||
1106 | \e9 Printed: January 31, 1984 | |
1107 | ||
1108 | ||
1109 |