... |
... |
@@ -604,19 +604,34 @@ |
604
|
604
|
:skipped-char-form ()
|
605
|
605
|
:eof-detected-form (eof-or-lose stream eof-errorp eof-value))))))
|
606
|
606
|
|
607
|
|
-(defun listen (&optional (stream *standard-input*) (width 1))
|
608
|
|
- "Returns T if a character is available on the given Stream."
|
|
607
|
+(defun listen (&optional (stream *standard-input*) (width 1 width-p))
|
|
608
|
+ _N"Returns T if a character is available on the given Stream.
|
|
609
|
+ Argument Width is only used by instances of SIMPLE-STREAM. If
|
|
610
|
+ Stream is a LISP-STREAM or FUNDAMENTAL-STREAM, passing more
|
|
611
|
+ than one argument is invalid."
|
609
|
612
|
(declare (type streamlike stream))
|
610
|
613
|
(let ((stream (in-synonym-of stream)))
|
611
|
614
|
(stream-dispatch stream
|
612
|
615
|
;; simple-stream
|
613
|
616
|
(stream::%listen stream width)
|
614
|
617
|
;; lisp-stream
|
615
|
|
- (or (/= (the fixnum (lisp-stream-in-index stream)) in-buffer-length)
|
616
|
|
- ;; Test for t explicitly since misc methods return :eof sometimes.
|
617
|
|
- (eq (funcall (lisp-stream-misc stream) stream :listen) t))
|
|
618
|
+ (progn
|
|
619
|
+ (when width-p
|
|
620
|
+ (error 'kernel:simple-program-error
|
|
621
|
+ :function-name 'listen
|
|
622
|
+ :format-control (intl:gettext "Invalid number of arguments: ~S")
|
|
623
|
+ :format-arguments (list 2)))
|
|
624
|
+ (or (/= (the fixnum (lisp-stream-in-index stream)) in-buffer-length)
|
|
625
|
+ ;; Test for t explicitly since misc methods return :eof sometimes.
|
|
626
|
+ (eq (funcall (lisp-stream-misc stream) stream :listen) t)))
|
618
|
627
|
;; fundamental-stream
|
619
|
|
- (stream-listen stream))))
|
|
628
|
+ (progn
|
|
629
|
+ (when width-p
|
|
630
|
+ (error 'kernel:simple-program-error
|
|
631
|
+ :function-name 'listen
|
|
632
|
+ :format-control (intl:gettext "Invalid number of arguments: ~S")
|
|
633
|
+ :format-arguments (list 2)))
|
|
634
|
+ (stream-listen stream)))))
|
620
|
635
|
|
621
|
636
|
(defun read-char-no-hang (&optional (stream *standard-input*)
|
622
|
637
|
(eof-errorp t) eof-value recursive-p)
|