0.8.8.13:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 4 Mar 2004 11:12:45 +0000 (11:12 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 4 Mar 2004 11:12:45 +0000 (11:12 +0000)
CONCATENATED-STREAM-STREAMS fix
... yes, do discard streams.  The old behaviour said "keep streams
around for closing", but that's actually the user's job.

NEWS
src/code/stream.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 83d872a..87fd587 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2332,6 +2332,8 @@ changes in sbcl-0.8.9 relative to sbcl-0.8.8:
        2, 8 or 16.
     ** ECHO-STREAMs no longer attempt to echo the end of file value to
        their output stream on EOF from read.
+    ** CONCATENATED-STREAM-STREAMS discards constituent streams which
+       have been read to end-of-file.
 
 planned incompatible changes in 0.8.x:
   * (not done yet, but planned:) When the profiling interface settles
index 47667bd..5de7271 100644 (file)
                          (&rest streams &aux (current streams)))
            (:copier nil))
   ;; The car of this is the substream we are reading from now.
-  current
-  ;; This is a list of all the substreams there ever were. We need to
-  ;; remember them so that we can close them.
-  ;;
-  ;; FIXME: ANSI says this is supposed to be the list of streams that
-  ;; we still have to read from. So either this needs to become a
-  ;; private member %STREAM (with CONCATENATED-STREAM-STREAMS a wrapper
-  ;; around it which discards closed files from the head of the list)
-  ;; or we need to update it as we run out of files.
-  (streams nil :type list :read-only t))
+  (streams nil :type list))
 (def!method print-object ((x concatenated-stream) stream)
   (print-unreadable-object (x stream :type t :identity t)
     (format stream
 
 (macrolet ((in-fun (name fun)
             `(defun ,name (stream eof-error-p eof-value)
-               (do ((current (concatenated-stream-current stream)
-                             (cdr current)))
-                   ((null current)
+               (do ((streams (concatenated-stream-streams stream)
+                             (cdr streams)))
+                   ((null streams)
                     (eof-or-lose stream eof-error-p eof-value))
-                 (let* ((stream (car current))
+                 (let* ((stream (car streams))
                         (result (,fun stream nil nil)))
                    (when result (return result)))
-                 (pop (concatenated-stream-current stream))))))
+                 (pop (concatenated-stream-streams stream))))))
   (in-fun concatenated-in read-char)
   (in-fun concatenated-bin read-byte))
 
 (defun concatenated-n-bin (stream buffer start numbytes eof-errorp)
-  (do ((current (concatenated-stream-current stream) (cdr current))
+  (do ((streams (concatenated-stream-streams stream) (cdr streams))
        (current-start start)
        (remaining-bytes numbytes))
       ((null current)
       (incf current-start bytes-read)
       (decf remaining-bytes bytes-read)
       (when (zerop remaining-bytes) (return numbytes)))
-    (setf (concatenated-stream-current stream) (cdr current))))
+    (setf (concatenated-stream-streams stream) (cdr streams))))
 
 (defun concatenated-misc (stream operation &optional arg1 arg2)
-  (let ((left (concatenated-stream-current stream)))
+  (let ((left (concatenated-stream-streams stream)))
     (when left
       (let* ((current (car left)))
        (case operation
                                       :listen)
                              (stream-misc-dispatch current :listen))))
               (cond ((eq stuff :eof)
-                     ;; Advance CURRENT, and try again.
-                     (pop (concatenated-stream-current stream))
+                     ;; Advance STREAMS, and try again.
+                     (pop (concatenated-stream-streams stream))
                      (setf current
-                           (car (concatenated-stream-current stream)))
+                           (car (concatenated-stream-streams stream)))
                      (unless current
                        ;; No further streams. EOF.
                        (return :eof)))
index 5565e61..8c2d905 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.8.12"
+"0.8.8.13"