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

« back to all changes in this revision

Viewing changes to info/io.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
@node Streams and Reading, Special Forms and Functions, Lists, Top
 
2
@chapter Streams and Reading
 
3
 
 
4
@defun MAKE-ECHO-STREAM (input-stream output-stream)
 
5
Package:LISP
 
6
 
 
7
Returns a bidirectional stream which gets its input from INPUT-STREAM and
 
8
sends its output to OUTPUT-STREAM.  In addition, all input is echoed to
 
9
OUTPUT-STREAM.
 
10
 
 
11
 
 
12
@end defun
 
13
 
 
14
@defvar *READTABLE* 
 
15
Package:LISP
 
16
The current readtable.
 
17
 
 
18
 
 
19
@end defvar
 
20
 
 
21
@defun LOAD (filename &key (verbose *load-verbose*) (print nil) (if-does-not-exist :error))
 
22
Package:LISP
 
23
 
 
24
Loads the file named by FILENAME into GCL.
 
25
 
 
26
 
 
27
@end defun
 
28
 
 
29
@defun OPEN (filename &key (direction :input) (element-type 'string-char) (if-exists :error) (if-does-not-exist :error))
 
30
Package:LISP
 
31
 
 
32
Opens the file specified by FILENAME, which may be a string, a pathname,
 
33
or a stream.  Returns a stream for the open file.
 
34
DIRECTION is  :INPUT, :OUTPUT, :IO or :PROBE.
 
35
ELEMENT-TYPE is  STRING-CHAR, (UNSIGNED-BYTE n),
 
36
UNSIGNED-BYTE, (SIGNED-BYTE n), SIGNED-BYTE, CHARACTER, BIT, (MOD n), or
 
37
:DEFAULT.
 
38
IF-EXISTS is :ERROR, :NEW-VERSION, :RENAME,
 
39
:RENAME-AND-DELETE, :OVERWRITE, :APPEND, :SUPERSEDE, or NIL.
 
40
IF-DOES-NOT-EXIST is  :ERROR, :CREATE, or NIL.
 
41
 
 
42
If FILENAME begins with a vertical pipe sign: '|'  then the resulting
 
43
stream is actually a one way pipe.   It will be open for reading
 
44
or writing depending on the direction given.   The rest
 
45
of FILENAME in this case is passed to the /bin/sh command.   See
 
46
the posix description of popen for more details.
 
47
@example
 
48
(setq pipe (open "| wc < /tmp/jim"))
 
49
(format t "File has ~%d lines" (read pipe))
 
50
(close pipe)
 
51
@end example
 
52
 
 
53
@end defun
 
54
 
 
55
@defvar *PRINT-BASE* 
 
56
Package:LISP
 
57
The radix in which the GCL printer prints integers and rationals.
 
58
The value must be an integer from 2 to 36, inclusive.
 
59
 
 
60
 
 
61
@end defvar
 
62
 
 
63
@defun MAKE-STRING-INPUT-STREAM (string &optional (start 0) (end (length string)))
 
64
Package:LISP
 
65
 
 
66
Returns an input stream which will supply the characters of String between
 
67
Start and End in order.
 
68
 
 
69
 
 
70
@end defun
 
71
 
 
72
@defun PPRINT (object &optional (stream *standard-output*))
 
73
Package:LISP
 
74
 
 
75
Pretty-prints OBJECT.  Returns OBJECT.  Equivalent to
 
76
        (WRITE :STREAM STREAM :PRETTY T)
 
77
The SI:PRETTY-PRINT-FORMAT property N (which must be a non-negative integer)
 
78
of a symbol SYMBOL controls the pretty-printing of form
 
79
        (SYMBOL f1 ... fN fN+1 ... fM)
 
80
in such a way that the subforms fN+1, ..., fM are regarded as the 'body' of
 
81
the entire form.  For instance, the property value of 2 is initially given
 
82
to the symbol DO.
 
83
 
 
84
 
 
85
@end defun
 
86
 
 
87
@defvar *READ-DEFAULT-FLOAT-FORMAT* 
 
88
Package:LISP
 
89
The floating-point format the GCL reader uses when reading floating-point
 
90
numbers that have no exponent marker or have e or E for an exponent marker.
 
91
Must be one of SHORT-FLOAT, SINGLE-FLOAT, DOUBLE-FLOAT, and LONG-FLOAT.
 
92
 
 
93
 
 
94
@end defvar
 
95
 
 
96
@defun READ-PRESERVING-WHITESPACE (&optional (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursive-p nil))
 
97
Package:LISP
 
98
 
 
99
Reads an object from STREAM, preserving the whitespace that followed the
 
100
object.
 
101
 
 
102
 
 
103
@end defun
 
104
 
 
105
@defun STREAMP (x)
 
106
Package:LISP
 
107
 
 
108
Returns T if X is a stream object; NIL otherwise.
 
109
 
 
110
 
 
111
@end defun
 
112
 
 
113
 
 
114
@defun SET-DISPATCH-MACRO-CHARACTER (disp-char sub-char function &optional (readtable *readtable*))
 
115
Package:LISP
 
116
 
 
117
Causes FUNCTION to be called when the DISP-CHAR followed by SUB-CHAR is
 
118
read.
 
119
 
 
120
 
 
121
@end defun
 
122
 
 
123
@deffn {Macro} WITH-OUTPUT-TO-STRING 
 
124
Package:LISP
 
125
 
 
126
Syntax:
 
127
@example
 
128
(with-output-to-string (var [string]) @{decl@}* @{form@}*)
 
129
@end example
 
130
 
 
131
Binds VAR to a string output stream that puts characters into STRING, which
 
132
defaults to a new string.  The stream is automatically closed on exit and
 
133
the string is returned.
 
134
 
 
135
 
 
136
@end deffn
 
137
 
 
138
@defun FILE-LENGTH (file-stream)
 
139
Package:LISP
 
140
 
 
141
Returns the length of the specified file stream.
 
142
 
 
143
 
 
144
@end defun
 
145
 
 
146
@defvar *PRINT-CASE* 
 
147
Package:LISP
 
148
The case in which the GCL printer should print ordinary symbols.
 
149
The value must be one of the keywords :UPCASE, :DOWNCASE, and :CAPITALIZE.
 
150
 
 
151
 
 
152
@end defvar
 
153
 
 
154
@defun PRINT (object &optional (stream *standard-output*))
 
155
Package:LISP
 
156
 
 
157
Outputs a newline character, and then prints OBJECT in the mostly readable
 
158
representation.  Returns OBJECT.  Equivalent to
 
159
        (PROGN (TERPRI STREAM) (WRITE OBJECT :STREAM STREAM :ESCAPE T)).
 
160
 
 
161
 
 
162
@end defun
 
163
 
 
164
@defun SET-MACRO-CHARACTER (char function &optional (non-terminating-p nil) (readtable *readtable*))
 
165
Package:LISP
 
166
 
 
167
Causes CHAR to be a macro character that, when seen by READ, causes FUNCTION
 
168
to be called.
 
169
 
 
170
 
 
171
@end defun
 
172
 
 
173
@defun FORCE-OUTPUT (&optional (stream *standard-output*))
 
174
Package:LISP
 
175
 
 
176
Attempts to force any buffered output to be sent.
 
177
 
 
178
 
 
179
@end defun
 
180
 
 
181
@defvar *PRINT-ARRAY* 
 
182
Package:LISP
 
183
Whether the GCL printer should print array elements.
 
184
 
 
185
 
 
186
@end defvar
 
187
 
 
188
@defun STREAM-ELEMENT-TYPE (stream)
 
189
Package:LISP
 
190
 
 
191
Returns a type specifier for the kind of object returned by STREAM.
 
192
 
 
193
 
 
194
@end defun
 
195
 
 
196
@defun WRITE-BYTE (integer stream)
 
197
Package:LISP
 
198
 
 
199
Outputs INTEGER to the binary stream STREAM.  Returns INTEGER.
 
200
 
 
201
 
 
202
@end defun
 
203
 
 
204
@defun MAKE-CONCATENATED-STREAM (&rest streams)
 
205
Package:LISP
 
206
 
 
207
Returns a stream which takes its input from each of the STREAMs in turn,
 
208
going on to the next at end of stream.
 
209
 
 
210
 
 
211
@end defun
 
212
 
 
213
@defun PRIN1 (object &optional (stream *standard-output*))
 
214
Package:LISP
 
215
 
 
216
Prints OBJECT in the mostly readable representation.  Returns OBJECT.
 
217
Equivalent to (WRITE OBJECT :STREAM STREAM :ESCAPE T).
 
218
 
 
219
 
 
220
@end defun
 
221
 
 
222
@defun PRINC (object &optional (stream *standard-output*))
 
223
Package:LISP
 
224
 
 
225
Prints OBJECT without escape characters.  Returns OBJECT.  Equivalent to
 
226
        (WRITE OBJECT :STREAM STREAM :ESCAPE NIL).
 
227
 
 
228
 
 
229
@end defun
 
230
 
 
231
@defun CLEAR-OUTPUT (&optional (stream *standard-output*))
 
232
Package:LISP
 
233
 
 
234
Clears the output stream STREAM.
 
235
 
 
236
 
 
237
@end defun
 
238
 
 
239
@defun TERPRI (&optional (stream *standard-output*))
 
240
Package:LISP
 
241
 
 
242
Outputs a newline character.
 
243
 
 
244
 
 
245
@end defun
 
246
 
 
247
@defun FINISH-OUTPUT (&optional (stream *standard-output*))
 
248
Package:LISP
 
249
 
 
250
Attempts to ensure that all output sent to STREAM has reached its destination,
 
251
and only then returns.
 
252
 
 
253
 
 
254
@end defun
 
255
 
 
256
@deffn {Macro} WITH-OPEN-FILE 
 
257
Package:LISP
 
258
 
 
259
Syntax:
 
260
@example
 
261
(with-open-file (stream filename @{options@}*) @{decl@}* @{form@}*)
 
262
@end example
 
263
 
 
264
Opens the file whose name is FILENAME, using OPTIONs, and binds the variable
 
265
STREAM to a stream to/from the file.  Then evaluates FORMs as a PROGN.
 
266
The file is automatically closed on exit.
 
267
 
 
268
 
 
269
@end deffn
 
270
 
 
271
@deffn {Special Form} DO 
 
272
Package:LISP
 
273
 
 
274
Syntax:
 
275
@example
 
276
(do (@{(var [init [step]])@}*) (endtest @{result@}*)
 
277
          @{decl@}* @{tag | statement@}*)
 
278
@end example
 
279
 
 
280
Creates a NIL block, binds each VAR to the value of the corresponding INIT,
 
281
and then executes STATEMENTs repeatedly until ENDTEST is satisfied.  After
 
282
each iteration, assigns to each VAR the value of the corresponding STEP.  When
 
283
ENDTEST is satisfied, evaluates RESULTs as a PROGN and returns the value(s) of
 
284
the last RESULT (or NIL if no RESULTs are supplied).  Performs variable
 
285
bindings and assignments all at once, just like LET and PSETQ do.
 
286
 
 
287
 
 
288
@end deffn
 
289
 
 
290
@defun READ-FROM-STRING (string &optional (eof-error-p t) (eof-value nil) &key (start 0) (end (length string)) (preserve-whitespace nil))
 
291
Package:LISP
 
292
 
 
293
Reads an object from STRING.
 
294
 
 
295
 
 
296
@end defun
 
297
 
 
298
@defun WRITE-STRING (string &optional (stream *standard-output*) &key (start 0) (end (length string)))
 
299
Package:LISP
 
300
 
 
301
Outputs STRING and returns it.
 
302
 
 
303
 
 
304
@end defun
 
305
 
 
306
@defvar *PRINT-LEVEL* 
 
307
Package:LISP
 
308
How many levels deep the GCL printer should print.  Unlimited if NIL.
 
309
 
 
310
 
 
311
@end defvar
 
312
 
 
313
@defvar *PRINT-RADIX* 
 
314
Package:LISP
 
315
Whether the GCL printer should print the radix indicator when printing
 
316
integers and rationals.
 
317
 
 
318
 
 
319
@end defvar
 
320
 
 
321
@defun Y-OR-N-P (&optional (format-string nil) &rest args)
 
322
Package:LISP
 
323
 
 
324
Asks the user a question whose answer is either 'Y' or 'N'.  If FORMAT-STRING
 
325
is non-NIL, then FRESH-LINE operation is performed, a message is printed as
 
326
if FORMAT-STRING and ARGs were given to FORMAT, and then a prompt
 
327
"(Y or N)" is printed.  Otherwise, no prompt will appear.
 
328
 
 
329
 
 
330
@end defun
 
331
 
 
332
@defun MAKE-BROADCAST-STREAM (&rest streams)
 
333
Package:LISP
 
334
 
 
335
Returns an output stream which sends its output to all of the given streams.
 
336
 
 
337
 
 
338
@end defun
 
339
 
 
340
@defun READ-CHAR (&optional (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursive-p nil))
 
341
Package:LISP
 
342
 
 
343
Reads a character from STREAM.
 
344
 
 
345
 
 
346
@end defun
 
347
 
 
348
@defun PEEK-CHAR (&optional (peek-type nil) (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursive-p nil))
 
349
Package:LISP
 
350
 
 
351
Peeks at the next character in the input stream STREAM.
 
352
 
 
353
 
 
354
@end defun
 
355
 
 
356
@defun OUTPUT-STREAM-P (stream)
 
357
Package:LISP
 
358
 
 
359
Returns non-nil if STREAM can handle output operations; NIL otherwise.
 
360
 
 
361
 
 
362
@end defun
 
363
 
 
364
@defvar *QUERY-IO* 
 
365
Package:LISP
 
366
The query I/O stream.
 
367
 
 
368
 
 
369
@end defvar
 
370
 
 
371
@defvar *READ-BASE* 
 
372
Package:LISP
 
373
The radix that the GCL reader reads numbers in.
 
374
 
 
375
 
 
376
@end defvar
 
377
 
 
378
@deffn {Macro} WITH-OPEN-STREAM 
 
379
Package:LISP
 
380
 
 
381
Syntax:
 
382
@example
 
383
(with-open-stream (var stream) @{decl@}* @{form@}*)
 
384
@end example
 
385
 
 
386
Evaluates FORMs as a PROGN with VAR bound to the value of STREAM.  The stream
 
387
is automatically closed on exit.
 
388
 
 
389
 
 
390
@end deffn
 
391
 
 
392
@deffn {Macro} WITH-INPUT-FROM-STRING 
 
393
Package:LISP
 
394
 
 
395
Syntax:
 
396
@example
 
397
(with-input-from-string (var string @{keyword value@}*) @{decl@}*
 
398
@{form@}*)
 
399
@end example
 
400
 
 
401
Binds VAR to an input stream that returns characters from STRING and evaluates
 
402
the FORMs.  The stream is automatically closed on exit.  Allowed keywords are
 
403
:INDEX, :START, and :END.
 
404
 
 
405
 
 
406
@end deffn
 
407
 
 
408
@defun CLEAR-INPUT  (&optional (stream *standard-input*))
 
409
Package:LISP
 
410
 Clears the input
 
411
stream STREAM.
 
412
 
 
413
 
 
414
@end defun
 
415
 
 
416
@defvar *TERMINAL-IO* 
 
417
Package:LISP
 
418
The terminal I/O stream.
 
419
 
 
420
 
 
421
@end defvar
 
422
 
 
423
@defun LISTEN (&optional (stream *standard-input*))
 
424
Package:LISP
 
425
 
 
426
Returns T if a character is available on STREAM; NIL otherwise.  This function
 
427
does not correctly work in some versions of GCL because of the lack of such
 
428
mechanism in the underlying operating system.
 
429
 
 
430
 
 
431
@end defun
 
432
 
 
433
@defun MAKE-PATHNAME (&key (defaults (parse-namestring "" (pathname-host *default-pathname-defaults*))) (host (pathname-host defaults)) (device (pathname-device defaults)) (directory (pathname-directory defaults)) (name (pathname-name defaults)) (type (pathname-type defaults)) (version (pathname-version defaults)))
 
434
Package:LISP
 
435
 
 
436
Create a pathname from HOST, DEVICE, DIRECTORY, NAME, TYPE and VERSION.
 
437
 
 
438
 
 
439
@end defun
 
440
 
 
441
@defun PATHNAME-TYPE (pathname)
 
442
Package:LISP
 
443
 
 
444
Returns the type slot of PATHNAME.
 
445
 
 
446
 
 
447
@end defun
 
448
 
 
449
@defvar *PRINT-GENSYM* 
 
450
Package:LISP
 
451
Whether the GCL printer should prefix symbols with no home package
 
452
with "#:".
 
453
 
 
454
 
 
455
@end defvar
 
456
 
 
457
@defun READ-LINE (&optional (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursive-p nil))
 
458
Package:LISP
 
459
 
 
460
Returns a line of text read from STREAM as a string, discarding the newline
 
461
character.
 
462
 
 
463
Note that when using line at a time input under unix,
 
464
input forms will always be followed by a #\newline.   Thus if you
 
465
do
 
466
 
 
467
>(read-line)
 
468
""
 
469
nil
 
470
 
 
471
the empty string will be returned.  After lisp reads the (read-line)
 
472
it then invokes (read-line).  This happens before it does anything
 
473
else and so happens before the newline character immediately following
 
474
(read-line) has been read.  Thus read-line immediately encounters a
 
475
#\newline and so returns the empty string.  If there had been other
 
476
characters before the #\newline it would have been different:
 
477
 
 
478
>(read-line) how are you
 
479
" how are you"
 
480
nil
 
481
 
 
482
If you want to throw away "" input, you can do that with
 
483
the following:
 
484
 
 
485
(sloop::sloop while (equal (setq input (read-line)) ""))
 
486
 
 
487
You may also want to use character at a time input, but that
 
488
makes input editing harder.
 
489
nicolas% stty cbreak
 
490
nicolas% gcl
 
491
GCL (GNU Common Lisp)  Version(1.1.2) Mon Jan  9 12:58:22 MET 1995
 
492
Licensed under GNU Public Library License
 
493
Contains Enhancements by W. Schelter
 
494
 
 
495
>(let ((ifilename nil))
 
496
    (format t "~%Input file name: ")
 
497
    (setq ifilename (read-line)))
 
498
Input file name: /tmp/myfile
 
499
"/tmp/myfile"
 
500
 
 
501
>(bye)Bye.
 
502
 
 
503
 
 
504
 
 
505
 
 
506
@end defun
 
507
 
 
508
@defun WRITE-TO-STRING (object &key (escape *print-escape*) (radix *print-radix*) (base *print-base*) (circle *print-circle*) (pretty *print-pretty*) (level *print-level*) (length *print-length*) (case *print-case*) (array *print-array*) (gensym *print-gensym*))
 
509
Package:LISP
 
510
 
 
511
Returns as a string the printed representation of OBJECT in the specified
 
512
mode.  See the variable docs of *PRINT-...* for the mode.
 
513
 
 
514
 
 
515
@end defun
 
516
 
 
517
@defun PATHNAMEP (x)
 
518
Package:LISP
 
519
 
 
520
Returns T if X is a pathname object; NIL otherwise.
 
521
 
 
522
 
 
523
@end defun
 
524
 
 
525
@defun READTABLEP (x)
 
526
Package:LISP
 
527
 
 
528
Returns T if X is a readtable object; NIL otherwise.
 
529
 
 
530
 
 
531
@end defun
 
532
 
 
533
@defun READ (&optional (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursivep nil))
 
534
Package:LISP
 
535
 
 
536
Reads in the next object from STREAM.
 
537
 
 
538
 
 
539
@end defun
 
540
 
 
541
@defun NAMESTRING (pathname)
 
542
Package:LISP
 
543
 
 
544
Returns the full form of PATHNAME as a string.
 
545
 
 
546
 
 
547
@end defun
 
548
 
 
549
@defun UNREAD-CHAR (character &optional (stream *standard-input*))
 
550
Package:LISP
 
551
 
 
552
Puts CHARACTER back on the front of the input stream STREAM.
 
553
 
 
554
 
 
555
@end defun
 
556
 
 
557
@defun CLOSE (stream &key (abort nil))
 
558
Package:LISP
 
559
 
 
560
Closes STREAM.  A non-NIL value of :ABORT indicates an abnormal termination.
 
561
 
 
562
 
 
563
@end defun
 
564
 
 
565
@defvar *PRINT-LENGTH* 
 
566
Package:LISP
 
567
How many elements the GCL printer should print at each level of nested data
 
568
object.  Unlimited if NIL.
 
569
 
 
570
 
 
571
@end defvar
 
572
 
 
573
@defun SET-SYNTAX-FROM-CHAR (to-char from-char &optional (to-readtable *readtable*) (from-readtable nil))
 
574
Package:LISP
 
575
 
 
576
Makes the syntax of TO-CHAR in TO-READTABLE be the same as the syntax of
 
577
FROM-CHAR in FROM-READTABLE.
 
578
 
 
579
 
 
580
@end defun
 
581
 
 
582
@defun INPUT-STREAM-P (stream)
 
583
Package:LISP
 
584
 
 
585
Returns non-NIL if STREAM can handle input operations; NIL otherwise.
 
586
 
 
587
 
 
588
@end defun
 
589
 
 
590
@defun PATHNAME (x)
 
591
Package:LISP
 
592
 
 
593
Turns X into a pathname.  X may be a string, symbol, stream, or pathname.
 
594
 
 
595
 
 
596
@end defun
 
597
 
 
598
@defun FILE-NAMESTRING (pathname)
 
599
Package:LISP
 
600
 
 
601
Returns the written representation of PATHNAME as a string.
 
602
 
 
603
 
 
604
@end defun
 
605
 
 
606
@defun MAKE-DISPATCH-MACRO-CHARACTER (char &optional (non-terminating-p nil) (readtable *readtable*))
 
607
Package:LISP
 
608
 
 
609
Causes the character CHAR to be a dispatching macro character in READTABLE.
 
610
 
 
611
 
 
612
@end defun
 
613
 
 
614
@defvar *STANDARD-OUTPUT* 
 
615
Package:LISP
 
616
The default output stream used by the GCL printer.
 
617
 
 
618
 
 
619
@end defvar
 
620
 
 
621
@defun MAKE-TWO-WAY-STREAM (input-stream output-stream)
 
622
Package:LISP
 
623
 
 
624
Returns a bidirectional stream which gets its input from INPUT-STREAM and
 
625
sends its output to OUTPUT-STREAM.
 
626
 
 
627
 
 
628
@end defun
 
629
 
 
630
@defvar *PRINT-ESCAPE* 
 
631
Package:LISP
 
632
Whether the GCL printer should put escape characters whenever appropriate.
 
633
 
 
634
 
 
635
@end defvar
 
636
 
 
637
@defun COPY-READTABLE (&optional (from-readtable *readtable*) (to-readtable nil))
 
638
Package:LISP
 
639
 
 
640
Returns a copy of the readtable FROM-READTABLE.  If TO-READTABLE is non-NIL,
 
641
then copies into TO-READTABLE.  Otherwise, creates a new readtable.
 
642
 
 
643
 
 
644
@end defun
 
645
 
 
646
@defun DIRECTORY-NAMESTRING (pathname)
 
647
Package:LISP
 
648
 
 
649
Returns the directory part of PATHNAME as a string.
 
650
 
 
651
 
 
652
@end defun
 
653
 
 
654
@defun TRUENAME (pathname)
 
655
Package:LISP
 
656
 
 
657
Returns the pathname for the actual file described by PATHNAME.
 
658
 
 
659
 
 
660
@end defun
 
661
 
 
662
@defvar *READ-SUPPRESS* 
 
663
Package:LISP
 
664
When the value of this variable is NIL, the GCL reader operates normally.
 
665
When it is non-NIL, then the reader parses input characters but much of what
 
666
is read is not interpreted.
 
667
 
 
668
 
 
669
@end defvar
 
670
 
 
671
@defun GET-DISPATCH-MACRO-CHARACTER (disp-char sub-char &optional (readtable *readtable*))
 
672
Package:LISP
 
673
 
 
674
Returns the macro-character function for SUB-CHAR under DISP-CHAR.
 
675
 
 
676
 
 
677
@end defun
 
678
 
 
679
@defun PATHNAME-DEVICE (pathname)
 
680
Package:LISP
 
681
 
 
682
Returns the device slot of PATHNAME.
 
683
 
 
684
 
 
685
@end defun
 
686
 
 
687
@defun READ-CHAR-NO-HANG (&optional (stream *standard-input*) (eof-error-p t) (eof-value nil) (recursive-p nil))
 
688
Package:LISP
 
689
 
 
690
Returns the next character from STREAM if one is available; NIL otherwise.
 
691
 
 
692
 
 
693
@end defun
 
694
 
 
695
@defun FRESH-LINE (&optional (stream *standard-output*))
 
696
Package:LISP
 
697
 
 
698
Outputs a newline if it is not positioned at the beginning of a line.  Returns
 
699
T if it output a newline; NIL otherwise.
 
700
 
 
701
 
 
702
@end defun
 
703
 
 
704
@defun WRITE-CHAR (char &optional (stream *standard-output*))
 
705
Package:LISP
 
706
 
 
707
Outputs CHAR and returns it.
 
708
 
 
709
 
 
710
@end defun
 
711
 
 
712
@defun PARSE-NAMESTRING (thing &optional host (defaults *default-pathname-defaults*) &key (start 0) (end (length thing)) (junk-allowed nil))
 
713
Package:LISP
 
714
 
 
715
Parses a string representation of a pathname into a pathname.  HOST
 
716
is ignored.
 
717
 
 
718
 
 
719
@end defun
 
720
 
 
721
@defun PATHNAME-DIRECTORY (pathname)
 
722
Package:LISP
 
723
 
 
724
Returns the directory slot of PATHNAME.
 
725
 
 
726
 
 
727
@end defun
 
728
 
 
729
@defun GET-MACRO-CHARACTER (char &optional (readtable *readtable*))
 
730
Package:LISP
 
731
 
 
732
Returns the function associated with CHAR and, as a second value, returns
 
733
the non-terminating-p flag.
 
734
 
 
735
 
 
736
@end defun
 
737
 
 
738
@defun FORMAT (destination control-string &rest arguments)
 
739
Package:LISP
 
740
 
 
741
Provides various facilities for formatting output.
 
742
DESTINATION controls where the result will go.  If DESTINATION is T, then
 
743
the output is sent to the standard output stream.  If it is NIL, then the
 
744
output is returned in a string as the value of the call.  Otherwise,
 
745
DESTINATION must be a stream to which the output will be sent.
 
746
 
 
747
CONTROL-STRING is a string to be output, possibly with embedded
 
748
formatting directives, which are flagged with the escape character
 
749
"~".  Directives generally expand into additional text to be output,
 
750
usually consuming one or more of ARGUMENTs in the process.
 
751
 
 
752
 
 
753
 
 
754
A few useful directives are:
 
755
@example
 
756
 
 
757
~A, ~nA, ~n@@A  Prints one argument as if by PRINC
 
758
~S, ~nS, ~n@@S  Prints one argument as if by PRIN1
 
759
~D, ~B, ~O, ~X  Prints one integer in decimal, binary, octal, and hexa
 
760
~%              Does TERPRI
 
761
~&              Does FRESH-LINE
 
762
@end example
 
763
 
 
764
where n is the minimal width of the field in which the object is printed.
 
765
~nA and ~nS put padding spaces on the right; ~n@@A and ~n@@S put on the left.
 
766
 
 
767
@example
 
768
~R  is for printing numbers in various formats.
 
769
 
 
770
  ~nR   prints arg in radix n.
 
771
  ~R    prints arg as a cardinal english number: two
 
772
  ~:R   prints arg as an ordinal english number: third
 
773
  ~@@R   prints arg as an a Roman Numeral: VII
 
774
  ~:@@R   prints arg as an old Roman Numeral: IIII
 
775
 
 
776
~C prints a character.
 
777
  ~:C represents non printing characters by their pretty names,eg Space
 
778
  ~@@C uses the #\ syntax to allow the reader to read it.
 
779
 
 
780
~F prints a floating point number arg.
 
781
  The full form is ~w,d,k,overflowchar,padcharF
 
782
  w represents the total width of the printed representation (variable if
 
783
    not present)
 
784
  d the number of fractional digits to display
 
785
    (format nil "~,2f" 10010.0314) --> "10010.03"
 
786
  k arg is multiplied by 10^k before printing it as a decimal number.
 
787
  overflowchar width w characters copies of the overflow character will
 
788
    be printed.   eg(format t "X>~5,2,,'?F<X" 100.034) --> X>?????<X
 
789
  padchar is the character to pad with
 
790
    (format t "X>~10,2,1,'?,'bF<X" 100.03417) -->X>bbb1000.34<X
 
791
  @@ makes + sign print if the arg is positive
 
792
 
 
793
~@@[print-if-true~]
 
794
@end example
 
795
   if arg is not nil, then it is retained as an arg for further printing,
 
796
   otherwise it is used up
 
797
 
 
798
@example
 
799
   (format nil "~@@[x = ~d~]~a" nil 'bil) --> "BIL"
 
800
   (format nil "~@@[x = ~d ~]~a" 8) --> "x = 8 BIL"
 
801
@end example
 
802
 
 
803
 
 
804
@end defun
 
805
 
 
806
@defun PATHNAME-NAME (pathname)
 
807
Package:LISP
 
808
 
 
809
Returns the name slot of PATHNAME.
 
810
 
 
811
 
 
812
@end defun
 
813
 
 
814
@defun MAKE-STRING-OUTPUT-STREAM ()
 
815
Package:LISP
 
816
 
 
817
Returns an output stream which will accumulate all output given it for
 
818
the benefit of the function GET-OUTPUT-STREAM-STRING.
 
819
 
 
820
 
 
821
@end defun
 
822
 
 
823
@defun MAKE-SYNONYM-STREAM (symbol)
 
824
Package:LISP
 
825
 
 
826
Returns a stream which performs its operations on the stream which is the
 
827
value of the dynamic variable named by SYMBOL.
 
828
 
 
829
 
 
830
@end defun
 
831
 
 
832
@defvar *LOAD-VERBOSE* 
 
833
Package:LISP
 
834
The default for the VERBOSE argument to LOAD.
 
835
 
 
836
 
 
837
@end defvar
 
838
 
 
839
@defvar *PRINT-CIRCLE* 
 
840
Package:LISP
 
841
Whether the GCL printer should take care of circular lists.
 
842
 
 
843
 
 
844
@end defvar
 
845
 
 
846
@defvar *PRINT-PRETTY* 
 
847
Package:LISP
 
848
Whether the GCL printer should pretty-print.  See the function doc of PPRINT
 
849
for more information about pretty-printing.
 
850
 
 
851
 
 
852
@end defvar
 
853
 
 
854
@defun FILE-WRITE-DATE (file)
 
855
Package:LISP
 
856
 
 
857
Returns the time at which the specified file is written, as an integer in
 
858
universal time format.  FILE may be a string or a stream.
 
859
 
 
860
 
 
861
@end defun
 
862
 
 
863
@defun PRIN1-TO-STRING (object)
 
864
Package:LISP
 
865
 
 
866
Returns as a string the printed representation of OBJECT in the mostly
 
867
readable representation.
 
868
Equivalent to (WRITE-TO-STRING OBJECT :ESCAPE T).
 
869
 
 
870
 
 
871
@end defun
 
872
 
 
873
@defun MERGE-PATHNAMES (pathname &optional (defaults *default-pathname-defaults*) default-version)
 
874
Package:LISP
 
875
 
 
876
Fills in unspecified slots of PATHNAME from DEFAULTS.  DEFAULT-VERSION
 
877
is ignored in GCL.
 
878
 
 
879
 
 
880
@end defun
 
881
 
 
882
@defun READ-BYTE (stream &optional (eof-error-p t) (eof-value nil))
 
883
Package:LISP
 
884
 
 
885
Reads the next byte from STREAM.
 
886
 
 
887
 
 
888
@end defun
 
889
 
 
890
@defun PRINC-TO-STRING (object)
 
891
Package:LISP
 
892
 
 
893
Returns as a string the printed representation of OBJECT without escape
 
894
characters.  Equivalent to
 
895
        (WRITE-TO-STRING OBJECT :ESCAPE NIL).
 
896
 
 
897
 
 
898
@end defun
 
899
 
 
900
@defvar *STANDARD-INPUT* 
 
901
Package:LISP
 
902
The default input stream used by the GCL reader.
 
903
 
 
904
 
 
905
@end defvar
 
906
 
 
907
@defun PROBE-FILE (file)
 
908
Package:LISP
 
909
 
 
910
Returns the truename of file if the file exists.
 
911
Returns NIL otherwise.
 
912
 
 
913
 
 
914
@end defun
 
915
 
 
916
@defun PATHNAME-VERSION (pathname)
 
917
Package:LISP
 
918
 
 
919
Returns the version slot of PATHNAME.
 
920
 
 
921
 
 
922
@end defun
 
923
 
 
924
@defun WRITE-LINE (string &optional (stream *standard-output*) &key (start 0) (end (length string)))
 
925
Package:LISP
 
926
 
 
927
Outputs STRING and then outputs a newline character.  Returns STRING.
 
928
 
 
929
 
 
930
@end defun
 
931
 
 
932
@defun WRITE (object &key (stream *standard-output*) (escape *print-escape*) (radix *print-radix*) (base *print-base*) (circle *print-circle*) (pretty *print-pretty*) (level *print-level*) (length *print-length*) (case *print-case*) (array *print-array*) (gensym *print-gensym*))
 
933
Package:LISP
 
934
 
 
935
Prints OBJECT in the specified mode.  See the variable docs of *PRINT-...*
 
936
for the mode.
 
937
 
 
938
 
 
939
@end defun
 
940
 
 
941
@defun GET-OUTPUT-STREAM-STRING (stream)
 
942
Package:LISP
 
943
 
 
944
Returns a string of all the characters sent to STREAM made by
 
945
MAKE-STRING-OUTPUT-STREAM since the last call to this function.
 
946
 
 
947
 
 
948
@end defun
 
949
 
 
950
@defun READ-DELIMITED-LIST (char &optional (stream *standard-input*) (recursive-p nil))
 
951
Package:LISP
 
952
 
 
953
Reads objects from STREAM until the next character after an object's
 
954
representation is CHAR.  Returns a list of the objects read.
 
955
 
 
956
 
 
957
@end defun
 
958
 
 
959
@defun READLINE-ON ()
 
960
Package:SI
 
961
 
 
962
Begins readline command editing mode when possible.  In addition to
 
963
the basic readline editing features, command word completion is
 
964
implemented according to the following scheme:
 
965
 
 
966
[[pkg]:[:]]txt
 
967
 
 
968
pkg -- an optional package specifier.  Defaults to the current
 
969
package.  The symbols in this package and those in the packages in
 
970
this package's use list will be searched.
 
971
 
 
972
:[:] -- an optional internal/external specifier.  Defaults to
 
973
external.  The keyword package is denoted by a single colon at the
 
974
beginning of the token.  Only symbols of this type will be searched
 
975
for completion.
 
976
 
 
977
txt -- a string.  Symbol names beginning with this string are
 
978
completed.  The comparison is case insensitive.
 
979
 
 
980
 
 
981
@end defun 
 
982
 
 
983
@defun READLINE-OFF ()
 
984
Package:SI
 
985
 
 
986
Disables readline command editing mode.
 
987
 
 
988
@end defun 
 
989
 
 
990
@defvar *READLINE-PREFIX* 
 
991
Package:SI
 
992
 
 
993
A string implicitly prepended to input text for use in readline
 
994
command completion.  If this string contains one or more colons, it is
 
995
used to specify the default package and internal/external setting for
 
996
searched symbols in the case that the supplied text itself contains no
 
997
explicit package specification.  If this string contains characters
 
998
after the colon(s), or contains no colons at all, it is treated as a
 
999
symbol name prefix.  In this case, the prefix is matched first, then
 
1000
the supplied text, and the completion returned is relative to the
 
1001
supplied text itself, i.e. contains no prefix.  For example, the
 
1002
setting ``maxima::$'' will complete input text ``int'' according to
 
1003
the internal symbols in the maxima package of the form
 
1004
``maxima::$int...'', and return suggestions to the user of the form
 
1005
``int...''.
 
1006
 
 
1007
@end defvar
 
1008