Declare COERCE and two helpers as EXPLICIT-CHECK.
[sbcl.git] / src / pcl / gray-streams.lisp
blobdeba28d9bef12cc027e65d7e7b735d5170397aab
1 ;;;; Gray streams implementation for SBCL, based on the Gray streams
2 ;;;; implementation for CMU CL, based on the stream-definition-by-user
3 ;;;; proposal by David N. Gray.
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
8 ;;;; This software is in the public domain and is provided with
9 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
10 ;;;; more information.
12 (in-package "SB-GRAY")
14 ;;; BUG-OR-ERROR: because we have extensible streams, wherewith the
15 ;;; user is responsible for some of the protocol implementation, it's
16 ;;; not necessarily a bug in SBCL itself if we fall through to one of
17 ;;; these default methods.
18 ;;;
19 ;;; FIXME: there's a lot of similarity in these Gray stream
20 ;;; implementation generic functions. All of them could (maybe
21 ;;; should?) have two default methods: one on STREAM calling
22 ;;; BUG-OR-ERROR, and one on T signalling a TYPE-ERROR.
23 (defmacro bug-or-error (stream fun)
24 `(error
25 "~@<The stream ~S has no suitable method for ~S, ~
26 and so has fallen through to this method. If you think that this is ~
27 a bug, please report it to the applicable authority (bugs in SBCL itself ~
28 should go to the mailing lists referenced from ~
29 <http://www.sbcl.org/>).~@:>"
30 ,stream ,fun))
32 (fmakunbound 'stream-element-type)
34 (defgeneric stream-element-type (stream)
35 #+sb-doc
36 (:documentation
37 "Return a type specifier for the kind of object returned by the
38 STREAM. The class FUNDAMENTAL-CHARACTER-STREAM provides a default method
39 which returns CHARACTER."))
41 (defmethod stream-element-type ((stream ansi-stream))
42 (ansi-stream-element-type stream))
44 (defmethod stream-element-type ((stream fundamental-character-stream))
45 'character)
47 (defmethod stream-element-type ((stream stream))
48 (bug-or-error stream 'stream-element-type))
50 (defmethod stream-element-type ((non-stream t))
51 (error 'type-error :datum non-stream :expected-type 'stream))
53 (defgeneric pcl-open-stream-p (stream)
54 #+sb-doc
55 (:documentation
56 "Return true if STREAM is not closed. A default method is provided
57 by class FUNDAMENTAL-STREAM which returns true if CLOSE has not been
58 called on the stream."))
60 (defmethod pcl-open-stream-p ((stream ansi-stream))
61 (ansi-stream-open-stream-p stream))
63 (defmethod pcl-open-stream-p ((stream fundamental-stream))
64 (stream-open-p stream))
66 (defmethod pcl-open-stream-p ((stream stream))
67 (bug-or-error stream 'open-stream-p))
69 (defmethod pcl-open-stream-p ((non-stream t))
70 (error 'type-error :datum non-stream :expected-type 'stream))
72 ;;; bootstrapping hack
73 (pcl-open-stream-p (make-string-output-stream))
74 (setf (fdefinition 'open-stream-p) #'pcl-open-stream-p)
76 (defgeneric pcl-close (stream &key abort)
77 #+sb-doc
78 (:documentation
79 "Close the given STREAM. No more I/O may be performed, but
80 inquiries may still be made. If :ABORT is true, an attempt is made
81 to clean up the side effects of having created the stream."))
83 (defmethod pcl-close ((stream ansi-stream) &key abort)
84 (ansi-stream-close stream abort))
86 (defmethod pcl-close ((stream fundamental-stream) &key abort)
87 (declare (ignore abort))
88 (setf (stream-open-p stream) nil)
91 (progn
92 ;; KLUDGE: Get in a call to PCL-CLOSE with a string-output-stream before
93 ;; setting it as CLOSE. Otherwise using NAMED-LAMBDAs as DFUNs causes a
94 ;; vicious metacircle from FORMAT NIL somewhere in the compiler. This is
95 ;; enough to get the dispatch settled down before we need it.
96 (pcl-close (make-string-output-stream))
97 (setf (fdefinition 'close) #'pcl-close))
99 (let ()
100 (fmakunbound 'input-stream-p)
102 (defgeneric input-stream-p (stream)
103 #+sb-doc
104 (:documentation "Can STREAM perform input operations?"))
106 (defmethod input-stream-p ((stream ansi-stream))
107 (ansi-stream-input-stream-p stream))
109 (defmethod input-stream-p ((stream fundamental-stream))
110 nil)
112 (defmethod input-stream-p ((stream fundamental-input-stream))
115 (defmethod input-stream-p ((stream stream))
116 (bug-or-error stream 'input-stream-p))
118 (defmethod input-stream-p ((non-stream t))
119 (error 'type-error :datum non-stream :expected-type 'stream)))
121 (let ()
122 (fmakunbound 'interactive-stream-p)
124 (defgeneric interactive-stream-p (stream)
125 #+sb-doc
126 (:documentation "Is STREAM an interactive stream?"))
128 (defmethod interactive-stream-p ((stream ansi-stream))
129 (funcall (ansi-stream-misc stream) stream :interactive-p))
131 (defmethod interactive-stream-p ((stream fundamental-stream))
132 nil)
134 (defmethod interactive-stream-p ((stream stream))
135 (bug-or-error stream 'interactive-stream-p))
137 (defmethod interactive-stream-p ((non-stream t))
138 (error 'type-error :datum non-stream :expected-type 'stream)))
140 (let ()
141 (fmakunbound 'output-stream-p)
143 (defgeneric output-stream-p (stream)
144 #+sb-doc
145 (:documentation "Can STREAM perform output operations?"))
147 (defmethod output-stream-p ((stream ansi-stream))
148 (ansi-stream-output-stream-p stream))
150 (defmethod output-stream-p ((stream fundamental-stream))
151 nil)
153 (defmethod output-stream-p ((stream fundamental-output-stream))
156 (defmethod output-stream-p ((stream stream))
157 (bug-or-error stream 'output-stream-p))
159 (defmethod output-stream-p ((non-stream t))
160 (error 'type-error :datum non-stream :expected-type 'stream)))
162 ;;; character input streams
164 ;;; A character input stream can be created by defining a class that
165 ;;; includes FUNDAMENTAL-CHARACTER-INPUT-STREAM and defining methods
166 ;;; for the generic functions below.
168 (defgeneric stream-read-char (stream)
169 #+sb-doc
170 (:documentation
171 "Read one character from the stream. Return either a
172 character object, or the symbol :EOF if the stream is at end-of-file.
173 Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM must define a
174 method for this function."))
176 (defgeneric stream-unread-char (stream character)
177 #+sb-doc
178 (:documentation
179 "Undo the last call to STREAM-READ-CHAR, as in UNREAD-CHAR.
180 Return NIL. Every subclass of FUNDAMENTAL-CHARACTER-INPUT-STREAM
181 must define a method for this function."))
183 (defgeneric stream-read-char-no-hang (stream)
184 #+sb-doc
185 (:documentation
186 "This is used to implement READ-CHAR-NO-HANG. It returns either a
187 character, or NIL if no input is currently available, or :EOF if
188 end-of-file is reached. The default method provided by
189 FUNDAMENTAL-CHARACTER-INPUT-STREAM simply calls STREAM-READ-CHAR; this
190 is sufficient for file streams, but interactive streams should define
191 their own method."))
193 (defmethod stream-read-char-no-hang ((stream fundamental-character-input-stream))
194 (stream-read-char stream))
196 (defgeneric stream-peek-char (stream)
197 #+sb-doc
198 (:documentation
199 "This is used to implement PEEK-CHAR; this corresponds to PEEK-TYPE of NIL.
200 It returns either a character or :EOF. The default method calls
201 STREAM-READ-CHAR and STREAM-UNREAD-CHAR."))
203 (defmethod stream-peek-char ((stream fundamental-character-input-stream))
204 (let ((char (stream-read-char stream)))
205 (unless (eq char :eof)
206 (stream-unread-char stream char))
207 char))
209 (defgeneric stream-listen (stream)
210 #+sb-doc
211 (:documentation
212 "This is used by LISTEN. It returns true or false. The default method uses
213 STREAM-READ-CHAR-NO-HANG and STREAM-UNREAD-CHAR. Most streams should
214 define their own method since it will usually be trivial and will
215 always be more efficient than the default method."))
217 (defmethod stream-listen ((stream fundamental-character-input-stream))
218 (let ((char (stream-read-char-no-hang stream)))
219 (when (characterp char)
220 (stream-unread-char stream char)
221 t)))
223 (defgeneric stream-read-line (stream)
224 #+sb-doc
225 (:documentation
226 "This is used by READ-LINE. A string is returned as the first value. The
227 second value is true if the string was terminated by end-of-file
228 instead of the end of a line. The default method uses repeated
229 calls to STREAM-READ-CHAR."))
231 (defmethod stream-read-line ((stream fundamental-character-input-stream))
232 (let ((res (make-string 80))
233 (len 80)
234 (index 0))
235 (loop
236 (let ((ch (stream-read-char stream)))
237 (cond ((eq ch :eof)
238 (return (values (%shrink-vector res index) t)))
240 (when (char= ch #\newline)
241 (return (values (%shrink-vector res index) nil)))
242 (when (= index len)
243 (setq len (* len 2))
244 (let ((new (make-string len)))
245 (replace new res)
246 (setq res new)))
247 (setf (schar res index) ch)
248 (incf index)))))))
250 (defgeneric stream-clear-input (stream)
251 #+sb-doc
252 (:documentation
253 "This is like CL:CLEAR-INPUT, but for Gray streams, returning NIL.
254 The default method does nothing."))
256 (defmethod stream-clear-input ((stream fundamental-character-input-stream))
257 nil)
258 (defmethod stream-clear-input ((stream stream))
259 (bug-or-error stream 'stream-clear-input))
260 (defmethod stream-clear-input ((non-stream t))
261 (error 'type-error :datum non-stream :expected-type 'stream))
263 (defgeneric stream-read-sequence (stream seq &optional start end)
264 #+sb-doc
265 (:documentation
266 "This is like CL:READ-SEQUENCE, but for Gray streams."))
268 ;;; Destructively modify SEQ by reading elements from STREAM. That
269 ;;; part of SEQ bounded by START and END is destructively modified by
270 ;;; copying successive elements into it from STREAM. If the end of
271 ;;; file for STREAM is reached before copying all elements of the
272 ;;; subsequence, then the extra elements near the end of sequence are
273 ;;; not updated, and the index of the next element is returned.
274 (defun basic-io-type-stream-read-sequence (stream seq start end read-fun)
275 (declare (type sequence seq)
276 (type stream stream)
277 (type index start)
278 (type sequence-end end)
279 (type function read-fun)
280 (values index))
281 (let ((end (or end (length seq))))
282 (declare (type index end))
283 (etypecase seq
284 (list
285 (do ((rem (nthcdr start seq) (rest rem))
286 (i start (1+ i)))
287 ((or (endp rem) (>= i end)) i)
288 (declare (type list rem)
289 (type index i))
290 (let ((el (funcall read-fun stream)))
291 (when (eq el :eof)
292 (return i))
293 (setf (first rem) el))))
294 (vector
295 (with-array-data ((data seq) (offset-start start) (offset-end end))
296 (do ((i offset-start (1+ i)))
297 ((>= i offset-end) end)
298 (declare (type index i))
299 (let ((el (funcall read-fun stream)))
300 (when (eq el :eof)
301 (return (+ start (- i offset-start))))
302 (setf (aref data i) el))))))))
304 (defmethod stream-read-sequence ((stream fundamental-character-input-stream)
305 (seq sequence)
306 &optional (start 0) (end nil))
307 (basic-io-type-stream-read-sequence stream seq start end
308 #'stream-read-char))
310 (defmethod stream-read-sequence ((stream fundamental-binary-input-stream)
311 (seq sequence)
312 &optional (start 0) (end nil))
313 (basic-io-type-stream-read-sequence stream seq start end
314 #'stream-read-byte))
317 ;;; character output streams
319 ;;; A character output stream can be created by defining a class that
320 ;;; includes FUNDAMENTAL-CHARACTER-OUTPUT-STREAM and defining methods
321 ;;; for the generic functions below.
323 (defgeneric stream-write-char (stream character)
324 #+sb-doc
325 (:documentation
326 "Write CHARACTER to STREAM and return CHARACTER. Every
327 subclass of FUNDAMENTAL-CHARACTER-OUTPUT-STREAM must have a method
328 defined for this function."))
330 (defgeneric stream-line-column (stream)
331 (:method ((stream sb-int:form-tracking-stream))
332 (cdr (sb-int:line/col-from-charpos stream)))
333 #+sb-doc
334 (:documentation
335 "Return the column number where the next character
336 will be written, or NIL if that is not meaningful for this stream.
337 The first column on a line is numbered 0. This function is used in
338 the implementation of PPRINT and the FORMAT ~T directive. For every
339 character output stream class that is defined, a method must be
340 defined for this function, although it is permissible for it to
341 always return NIL."))
343 (defmethod stream-line-column ((stream fundamental-character-output-stream))
344 nil)
346 ;;; STREAM-LINE-LENGTH is a CMU CL extension to Gray streams.
347 ;;; FIXME: Should we support it? Probably not..
348 (defgeneric stream-line-length (stream)
349 #+sb-doc
350 (:documentation "Return the stream line length or NIL."))
352 (defmethod stream-line-length ((stream fundamental-character-output-stream))
353 nil)
355 (defgeneric stream-start-line-p (stream)
356 #+sb-doc
357 (:documentation
358 "Is STREAM known to be positioned at the beginning of a line?
359 It is permissible for an implementation to always return
360 NIL. This is used in the implementation of FRESH-LINE. Note that
361 while a value of 0 from STREAM-LINE-COLUMN also indicates the
362 beginning of a line, there are cases where STREAM-START-LINE-P can be
363 meaningfully implemented although STREAM-LINE-COLUMN can't be. For
364 example, for a window using variable-width characters, the column
365 number isn't very meaningful, but the beginning of the line does have
366 a clear meaning. The default method for STREAM-START-LINE-P on class
367 FUNDAMENTAL-CHARACTER-OUTPUT-STREAM uses STREAM-LINE-COLUMN, so if
368 that is defined to return NIL, then a method should be provided for
369 either STREAM-START-LINE-P or STREAM-FRESH-LINE."))
371 (defmethod stream-start-line-p ((stream fundamental-character-output-stream))
372 (eql (stream-line-column stream) 0))
374 (defgeneric stream-write-string (stream string &optional start end)
375 #+sb-doc
376 (:documentation
377 "This is used by WRITE-STRING. It writes the string to the stream,
378 optionally delimited by start and end, which default to 0 and NIL.
379 The string argument is returned. The default method provided by
380 FUNDAMENTAL-CHARACTER-OUTPUT-STREAM uses repeated calls to
381 STREAM-WRITE-CHAR."))
383 (defmethod stream-write-string ((stream fundamental-character-output-stream)
384 string &optional (start 0) end)
385 (declare (string string)
386 (fixnum start))
387 (let ((end (or end (length string))))
388 (declare (fixnum end))
389 (do ((pos start (1+ pos)))
390 ((>= pos end))
391 (declare (type index pos))
392 (stream-write-char stream (aref string pos))))
393 string)
395 (defgeneric stream-terpri (stream)
396 #+sb-doc
397 (:documentation
398 "Writes an end of line, as for TERPRI. Returns NIL. The default
399 method does (STREAM-WRITE-CHAR stream #\NEWLINE)."))
401 (defmethod stream-terpri ((stream fundamental-character-output-stream))
402 (stream-write-char stream #\Newline))
404 (defgeneric stream-fresh-line (stream)
405 #+sb-doc
406 (:documentation
407 "Outputs a new line to the Stream if it is not positioned at the
408 beginning of a line. Returns T if it output a new line, nil
409 otherwise. Used by FRESH-LINE. The default method uses
410 STREAM-START-LINE-P and STREAM-TERPRI."))
412 (defmethod stream-fresh-line ((stream fundamental-character-output-stream))
413 (unless (stream-start-line-p stream)
414 (stream-terpri stream)
417 (defgeneric stream-finish-output (stream)
418 #+sb-doc
419 (:documentation
420 "Attempts to ensure that all output sent to the Stream has reached
421 its destination, and only then returns false. Implements
422 FINISH-OUTPUT. The default method does nothing."))
424 (defmethod stream-finish-output ((stream fundamental-output-stream))
425 nil)
426 (defmethod stream-finish-output ((stream stream))
427 (bug-or-error stream 'stream-finish-output))
428 (defmethod stream-finish-output ((non-stream t))
429 (error 'type-error :datum non-stream :expected-type 'stream))
431 (defgeneric stream-force-output (stream)
432 #+sb-doc
433 (:documentation
434 "Attempts to force any buffered output to be sent. Implements
435 FORCE-OUTPUT. The default method does nothing."))
437 (defmethod stream-force-output ((stream fundamental-output-stream))
438 nil)
439 (defmethod stream-force-output ((stream stream))
440 (bug-or-error stream 'stream-force-output))
441 (defmethod stream-force-output ((non-stream t))
442 (error 'type-error :datum non-stream :expected-type 'stream))
444 (defgeneric stream-clear-output (stream)
445 #+sb-doc
446 (:documentation
447 "This is like CL:CLEAR-OUTPUT, but for Gray streams: clear the given
448 output STREAM. The default method does nothing."))
450 (defmethod stream-clear-output ((stream fundamental-output-stream))
451 nil)
452 (defmethod stream-clear-output ((stream stream))
453 (bug-or-error stream 'stream-clear-output))
454 (defmethod stream-clear-output ((non-stream t))
455 (error 'type-error :datum non-stream :expected-type 'stream))
457 (defgeneric stream-advance-to-column (stream column)
458 #+sb-doc
459 (:documentation
460 "Write enough blank space so that the next character will be
461 written at the specified column. Returns true if the operation is
462 successful, or NIL if it is not supported for this stream. This is
463 intended for use by by PPRINT and FORMAT ~T. The default method uses
464 STREAM-LINE-COLUMN and repeated calls to STREAM-WRITE-CHAR with a
465 #\SPACE character; it returns NIL if STREAM-LINE-COLUMN returns NIL."))
467 (defmethod stream-advance-to-column ((stream fundamental-character-output-stream)
468 column)
469 (let ((current-column (stream-line-column stream)))
470 (when current-column
471 (let ((fill (- column current-column)))
472 (dotimes (i fill)
473 (stream-write-char stream #\Space)))
474 T)))
476 (defgeneric stream-write-sequence (stream seq &optional start end)
477 #+sb-doc
478 (:documentation
479 "This is like CL:WRITE-SEQUENCE, but for Gray streams."))
481 ;;; Write the elements of SEQ bounded by START and END to STREAM.
482 (defun basic-io-type-stream-write-sequence (stream seq start end write-fun)
483 (declare (type sequence seq)
484 (type stream stream)
485 (type index start)
486 (type sequence-end end)
487 (type function write-fun)
488 (values sequence))
489 (let ((end (or end (length seq))))
490 (declare (type index start end))
491 (etypecase seq
492 (list
493 (do ((rem (nthcdr start seq) (rest rem))
494 (i start (1+ i)))
495 ((or (endp rem) (>= i end)) seq)
496 (declare (type list rem)
497 (type index i))
498 (funcall write-fun stream (first rem))))
499 (vector
500 (do ((i start (1+ i)))
501 ((>= i end) seq)
502 (declare (type index i))
503 (funcall write-fun stream (aref seq i)))))))
505 (defmethod stream-write-sequence ((stream fundamental-character-output-stream)
506 (seq sequence)
507 &optional (start 0) (end nil))
508 (typecase seq
509 (string
510 (stream-write-string stream seq start end))
512 (basic-io-type-stream-write-sequence stream seq start end
513 #'stream-write-char))))
516 ;;; binary streams
518 ;;; Binary streams can be created by defining a class that includes
519 ;;; either FUNDAMENTAL-BINARY-INPUT-STREAM or
520 ;;; FUNDAMENTAL-BINARY-OUTPUT-STREAM (or both) and defining a method
521 ;;; for STREAM-ELEMENT-TYPE and for one or both of the following
522 ;;; generic functions.
524 (defgeneric stream-read-byte (stream)
525 #+sb-doc
526 (:documentation
527 "Used by READ-BYTE; returns either an integer, or the symbol :EOF
528 if the stream is at end-of-file."))
530 (defmethod stream-read-byte ((stream stream))
531 (bug-or-error stream 'stream-read-byte))
532 (defmethod stream-read-byte ((non-stream t))
533 (error 'type-error :datum non-stream :expected-type 'stream))
535 (defgeneric stream-write-byte (stream integer)
536 #+sb-doc
537 (:documentation
538 "Implements WRITE-BYTE; writes the integer to the stream and
539 returns the integer as the result."))
541 (defmethod stream-write-byte ((stream stream) integer)
542 (bug-or-error stream 'stream-write-byte))
543 (defmethod stream-write-byte ((non-stream t) integer)
544 (error 'type-error :datum non-stream :expected-type 'stream))
546 ;; Provide a reasonable default for binary Gray streams. We might be
547 ;; able to do better by specializing on the sequence type, but at
548 ;; least the behaviour is reasonable. --tony 2003/05/08.
549 (defmethod stream-write-sequence ((stream fundamental-binary-output-stream)
550 (seq sequence)
551 &optional (start 0) (end nil))
552 (basic-io-type-stream-write-sequence stream seq start end
553 #'stream-write-byte))
555 (defgeneric stream-file-position (stream &optional position-spec)
556 #+sb-doc
557 (:documentation
558 "Used by FILE-POSITION. Returns or changes the current position within STREAM."))
560 (defmethod stream-file-position ((stream ansi-stream) &optional position-spec)
561 (ansi-stream-file-position stream position-spec))
563 (defmethod stream-file-position ((stream t) &optional position-spec)
564 (declare (ignore stream position-spec))
565 nil)
568 ;;; This is not in the Gray stream proposal, so it is left here
569 ;;; as example code.
571 ;;; example character output stream encapsulating a lisp-stream
572 (defun make-character-output-stream (lisp-stream)
573 (declare (type lisp-stream lisp-stream))
574 (make-instance 'character-output-stream :lisp-stream lisp-stream))
576 (defmethod open-stream-p ((stream character-output-stream))
577 (open-stream-p (character-output-stream-lisp-stream stream)))
579 (defmethod close ((stream character-output-stream) &key abort)
580 (close (character-output-stream-lisp-stream stream) :abort abort))
582 (defmethod input-stream-p ((stream character-output-stream))
583 (input-stream-p (character-output-stream-lisp-stream stream)))
585 (defmethod output-stream-p ((stream character-output-stream))
586 (output-stream-p (character-output-stream-lisp-stream stream)))
588 (defmethod stream-write-char ((stream character-output-stream) character)
589 (write-char character (character-output-stream-lisp-stream stream)))
591 (defmethod stream-line-column ((stream character-output-stream))
592 (charpos (character-output-stream-lisp-stream stream)))
594 (defmethod stream-line-length ((stream character-output-stream))
595 (line-length (character-output-stream-lisp-stream stream)))
597 (defmethod stream-finish-output ((stream character-output-stream))
598 (finish-output (character-output-stream-lisp-stream stream)))
600 (defmethod stream-force-output ((stream character-output-stream))
601 (force-output (character-output-stream-lisp-stream stream)))
603 (defmethod stream-clear-output ((stream character-output-stream))
604 (clear-output (character-output-stream-lisp-stream stream)))
606 ;;; example character input stream encapsulating a lisp-stream
608 (defun make-character-input-stream (lisp-stream)
609 (declare (type lisp-stream lisp-stream))
610 (make-instance 'character-input-stream :lisp-stream lisp-stream))
612 (defmethod open-stream-p ((stream character-input-stream))
613 (open-stream-p (character-input-stream-lisp-stream stream)))
615 (defmethod close ((stream character-input-stream) &key abort)
616 (close (character-input-stream-lisp-stream stream) :abort abort))
618 (defmethod input-stream-p ((stream character-input-stream))
619 (input-stream-p (character-input-stream-lisp-stream stream)))
621 (defmethod output-stream-p ((stream character-input-stream))
622 (output-stream-p (character-input-stream-lisp-stream stream)))
624 (defmethod stream-read-char ((stream character-input-stream))
625 (read-char (character-input-stream-lisp-stream stream) nil :eof))
627 (defmethod stream-unread-char ((stream character-input-stream) character)
628 (unread-char character (character-input-stream-lisp-stream stream)))
630 (defmethod stream-read-char-no-hang ((stream character-input-stream))
631 (read-char-no-hang (character-input-stream-lisp-stream stream) nil :eof))
633 #+nil
634 (defmethod stream-peek-char ((stream character-input-stream))
635 (peek-char nil (character-input-stream-lisp-stream stream) nil :eof))
637 #+nil
638 (defmethod stream-listen ((stream character-input-stream))
639 (listen (character-input-stream-lisp-stream stream)))
641 (defmethod stream-clear-input ((stream character-input-stream))
642 (clear-input (character-input-stream-lisp-stream stream)))