From 40f31f66804f11d074f065c0ab34827f6637a95e Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sun, 23 Jul 2000 14:58:46 +0000
Subject: [PATCH] Fix the handling of :unread and :clear-input in the stream
 misc functions synonym-misc, two-way-misc, and concatenated-misc. These
 streams encapsulate other input streams which may have an input buffer so
 they need to call unread-char and clear-input on the encapsulated stream
 rather than directly calling the encapsulated streams misc method as the misc
 methods are below the layer of the input buffer.

---
 code/stream.lisp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/code/stream.lisp b/code/stream.lisp
index 276a6defc..abb5a239e 100644
--- a/code/stream.lisp
+++ b/code/stream.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.41 2000/06/17 06:34:07 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.42 2000/07/23 14:58:46 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -804,6 +804,8 @@
 	  (:listen (or (/= (the fixnum (lisp-stream-in-index syn))
 			   in-buffer-length)
 		       (funcall (lisp-stream-misc syn) syn :listen)))
+	  (:clear-input (clear-input syn))
+	  (:unread (unread-char arg1 syn))
 	  (t
 	   (funcall (lisp-stream-misc syn) syn operation arg1 arg2)))
 	(stream-misc-dispatch syn operation arg1 arg2))))
@@ -869,10 +871,8 @@
        (if out-lisp-stream-p
 	   (funcall (lisp-stream-misc out) out operation arg1 arg2)
 	   (stream-misc-dispatch out operation arg1 arg2)))
-      ((:clear-input :unread)
-       (if in-lisp-stream-p
-	   (funcall (lisp-stream-misc in) in operation arg1 arg2)
-	   (stream-misc-dispatch in operation arg1 arg2)))
+      (:clear-input (clear-input in))
+      (:unread (unread-char arg1 in))
       (:element-type
        (let ((in-type (stream-element-type in))
 	     (out-type (stream-element-type out)))
@@ -951,6 +951,8 @@
 		      (return nil))))))
 	  (:close
 	   (set-closed-flame stream))
+	  (:clear-input (clear-input current))
+	  (:unread (unread-char arg1 current))
 	  (t
 	   (if (lisp-stream-p current)
 	       (funcall (lisp-stream-misc current) current operation arg1 arg2)
-- 
GitLab