[Git][cmucl/cmucl][issue-143-ansi-compliance-failure-listen-extra-argument] Fix #143 - add gray-stream support and update docstring

Jon Boone (@jboone) gitlab at common-lisp.net
Wed May 3 23:33:31 UTC 2023



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
Fix #143 - add gray-stream support and update docstring

- - - - -


1 changed file:

- src/code/stream.lisp


Changes:

=====================================
src/code/stream.lisp
=====================================
@@ -605,7 +605,10 @@
 	   :eof-detected-form (eof-or-lose stream eof-errorp eof-value))))))
 
 (defun listen (&optional (stream *standard-input*) (width 1 width-p))
-  "Returns T if a character is available on the given Stream."
+  _N"Returns T if a character is available on the given Stream.
+  Argument width is only used by streams of type simple-stream.
+  If stream is of type lisp-stream or fundamental-stream,
+  passing more than one argument is invalid. "
   (declare (type streamlike stream))
   (let ((stream (in-synonym-of stream)))
     (stream-dispatch stream
@@ -622,7 +625,13 @@
             ;; Test for t explicitly since misc methods return :eof sometimes.
             (eq (funcall (lisp-stream-misc stream) stream :listen) t)))
       ;; fundamental-stream
-      (stream-listen stream))))
+      (progn
+	(when width-p
+	  (error 'kernel:simple-program-error
+		 :function-name 'listen
+		 :format-control (intl:gettext "Invalid number of arguments: ~S")
+		 :format-arguments (list 2)))
+	(stream-listen stream)))))
 
 (defun read-char-no-hang (&optional (stream *standard-input*)
 				    (eof-errorp t) eof-value recursive-p)



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/873fa8b1049aea0c7165ef3828387fc569258a65

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/873fa8b1049aea0c7165ef3828387fc569258a65
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230503/f9cb58b9/attachment-0001.html>


More information about the cmucl-cvs mailing list