Changeset 9949


Ignore:
Timestamp:
Jul 10, 2008, 9:00:42 AM (11 years ago)
Author:
gb
Message:

BASIC-STREAMs store the class-wrapper, not the class.

Try to provide more characters of context info on STREAM-ERRORs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-streams.lisp

    r9741 r9949  
    512512             (count (io-buffer-count inbuf)))
    513513        (unless (= count 0)
    514           (let* ((start (max (- idx (* 5 size)) 0))
    515                  (end (min (+ idx (* 5 size)) count))
     514          (let* ((start (max (- idx (* 10 size)) 0))
     515                 (end (min (+ idx (* 10 size)) count))
    516516                 (string (make-string (funcall (character-encoding-length-of-vector-encoding-function encoding) buffer start end))))
    517517            (funcall (character-encoding-vector-decode-function encoding)
     
    36303630(defun allocate-basic-stream (class)
    36313631  (if (subtypep class 'basic-file-stream)
    3632     (gvector :basic-stream class 0 nil nil nil nil nil)
    3633     (gvector :basic-stream class 0 nil nil)))
     3632    (gvector :basic-stream (%class-own-wrapper class) 0 nil nil nil nil nil)
     3633    (gvector :basic-stream (%class-own-wrapper class) 0 nil nil)))
    36343634
    36353635
     
    42074207
    42084208(defstatic *string-output-stream-class* (make-built-in-class 'string-output-stream 'string-stream 'basic-character-output-stream))
     4209(defstatic *string-output-stream-class-wrapper* (%class-own-wrapper *string-output-stream-class*))
    42094210
    42104211(defstatic *fill-pointer-string-output-stream-class* (make-built-in-class 'fill-pointer-string-output-stream 'string-output-stream))
     
    42244225;;; *string-output-stream-class*
    42254226(defun %close-string-output-stream (stream ioblock)
    4226   (when (eq (basic-stream.class stream)
    4227             *string-output-stream-class*)
     4227  (when (eq (basic-stream.wrapper stream)
     4228            *string-output-stream-class-wrapper*)
    42284229    (without-interrupts
    42294230     (setf (ioblock-stream ioblock) (pool.data %string-output-stream-ioblocks%)
     
    42334234  (declare (dynamic-extent keys))
    42344235  (let* ((recycled (and stream
    4235                         (eq (basic-stream.class stream)
    4236                             *string-output-stream-class*)
     4236                        (eq (basic-stream.wrapper stream)
     4237                            *string-output-stream-class-wrapper*)
    42374238                        (without-interrupts
    42384239                         (let* ((data (pool.data %string-output-stream-ioblocks%)))
     
    44424443
    44434444(defstatic *indenting-string-output-stream-class* (make-built-in-class 'indenting-string-output-stream 'string-output-stream))
    4444 
     4445(defstatic *indenting-string-output-stream-class-wrapper* (%class-own-wrapper *indenting-string-output-stream-class*))
    44454446
    44464447
     
    44834484(defun (setf indenting-string-output-stream-indent) (new stream)
    44844485  (if (and (typep stream 'basic-stream)
    4485            (eq (basic-stream.class stream) *indenting-string-output-stream-class*))
     4486           (eq (basic-stream.wrapper stream) *indenting-string-output-stream-class-wrapper*))
    44864487    (setf (getf (basic-stream.info stream) 'indent) new)
    44874488    (report-bad-arg stream 'indenting-string-output-stream)))
     
    44894490
    44904491(defun get-output-stream-string (s)
    4491   (let* ((class (if (typep s 'basic-stream) (basic-stream.class s))))
     4492 (let* ((class (if (typep s 'basic-stream) (%wrapper-class (basic-stream.wrapper s)))))
    44924493    (or (eq class *string-output-stream-class*)
    44934494        (eq class *truncating-string-output-stream-class*)
     
    45094510;;; String input streams.
    45104511(defstatic *string-input-stream-class* (make-built-in-class 'string-input-stream 'string-stream 'basic-character-input-stream))
    4511 
     4512(defstatic *string-input-stream-class-wrapper* (%class-own-wrapper *string-input-stream-class*))
    45124513(defstruct (string-input-stream-ioblock (:include string-stream-ioblock))
    45134514  (start 0)
     
    45204521(defun string-input-stream-index (s)
    45214522  (if (and (typep s 'basic-stream)
    4522            (eq *string-input-stream-class* (basic-stream.class s)))
     4523           (eq *string-input-stream-class-wrapper* (basic-stream.wrapper s)))
    45234524    (let* ((ioblock (basic-stream-ioblock s)))
    45244525      (- (string-input-stream-ioblock-index ioblock)
     
    45344535             (end (string-input-stream-ioblock-end ioblock))
    45354536             (string (string-stream-ioblock-string ioblock)))
    4536         (subseq string (max (- idx 5) start) (min (+ idx 5) end))))))
     4537        (subseq string (max (- idx 10) start) (min (+ idx 10) end))))))
    45374538   
    45384539
     
    46934694
    46944695(defun string-stream-string (s)
    4695   (let* ((class (if (typep s 'basic-stream) (basic-stream.class s))))
     4696  (let* ((class (if (typep s 'basic-stream) (%wrapper-class (basic-stream.wrapper s)))))
    46964697    (or (eq class *string-output-stream-class*)
    46974698        (eq class *truncating-string-output-stream-class*)
Note: See TracChangeset for help on using the changeset viewer.