Jon Boone pushed to branch issue-143-ansi-compliance-failure-listen-extra-argument at cmucl / cmucl
Commits:
-
873fa8b1
by Jon Boone at 2023-05-03T19:33:09-04:00
1 changed file:
Changes:
| ... | ... | @@ -605,7 +605,10 @@ |
| 605 | 605 | :eof-detected-form (eof-or-lose stream eof-errorp eof-value))))))
|
| 606 | 606 | |
| 607 | 607 | (defun listen (&optional (stream *standard-input*) (width 1 width-p))
|
| 608 | - "Returns T if a character is available on the given Stream."
|
|
| 608 | + _N"Returns T if a character is available on the given Stream.
|
|
| 609 | + Argument width is only used by streams of type simple-stream.
|
|
| 610 | + If stream is of type lisp-stream or fundamental-stream,
|
|
| 611 | + passing more than one argument is invalid. "
|
|
| 609 | 612 | (declare (type streamlike stream))
|
| 610 | 613 | (let ((stream (in-synonym-of stream)))
|
| 611 | 614 | (stream-dispatch stream
|
| ... | ... | @@ -622,7 +625,13 @@ |
| 622 | 625 | ;; Test for t explicitly since misc methods return :eof sometimes.
|
| 623 | 626 | (eq (funcall (lisp-stream-misc stream) stream :listen) t)))
|
| 624 | 627 | ;; fundamental-stream
|
| 625 | - (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)))))
|
|
| 626 | 635 | |
| 627 | 636 | (defun read-char-no-hang (&optional (stream *standard-input*)
|
| 628 | 637 | (eof-errorp t) eof-value recursive-p)
|