Changeset 10424


Ignore:
Timestamp:
Aug 11, 2008, 1:32:43 AM (11 years ago)
Author:
gb
Message:

Store the class-wrapper (not the class) in a BASIC-STREAM.

Location:
trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-clos-boot.lisp

    r10423 r10424  
    11871187           (istruct-cell-info (%svref instance 0)))
    11881188          ((eql typecode target::subtag-basic-stream)
    1189            (%class.own-wrapper (basic-stream.class instance)))
     1189           (basic-stream.wrapper instance))
    11901190          ((typep instance 'funcallable-standard-object)
    11911191           (gf.instance.class-wrapper instance))
     
    22832283                          *istruct-class*)))))
    22842284        (setf (%svref v target::subtag-basic-stream)
    2285               #'(lambda (b) (basic-stream.class b)))
     2285              #'(lambda (b) (%wrapper-class (basic-stream.wrapper b))))
    22862286        (setf (%svref v target::subtag-instance)
    22872287              #'%class-of-instance)
  • trunk/source/level-1/l1-streams.lisp

    r10279 r10424  
    521521             (count (io-buffer-count inbuf)))
    522522        (unless (= count 0)
    523           (let* ((start (max (- idx (* 5 size)) 0))
    524                  (end (min (+ idx (* 5 size)) count))
     523          (let* ((start (max (- idx (* 10 size)) 0))
     524                 (end (min (+ idx (* 10 size)) count))
    525525                 (string (make-string (funcall (character-encoding-length-of-vector-encoding-function encoding) buffer start end))))
    526526            (funcall (character-encoding-vector-decode-function encoding)
     
    36593659(defun allocate-basic-stream (class)
    36603660  (if (subtypep class 'basic-file-stream)
    3661     (gvector :basic-stream class 0 nil nil nil nil nil)
    3662     (gvector :basic-stream class 0 nil nil)))
     3661    (gvector :basic-stream (%class-own-wrapper class) 0 nil nil nil nil nil)
     3662    (gvector :basic-stream (%class-own-wrapper class) 0 nil nil)))
    36633663
    36643664
     
    42364236
    42374237(defstatic *string-output-stream-class* (make-built-in-class 'string-output-stream 'string-stream 'basic-character-output-stream))
     4238(defstatic *string-output-stream-class-wrapper* (%class-own-wrapper *string-output-stream-class*))
    42384239
    42394240(defstatic *fill-pointer-string-output-stream-class* (make-built-in-class 'fill-pointer-string-output-stream 'string-output-stream))
     
    42534254;;; *string-output-stream-class*
    42544255(defun %close-string-output-stream (stream ioblock)
    4255   (when (eq (basic-stream.class stream)
    4256             *string-output-stream-class*)
     4256  (when (eq (basic-stream.wrapper stream)
     4257            *string-output-stream-class-wrapper*)
    42574258    (without-interrupts
    42584259     (setf (ioblock-stream ioblock) (pool.data %string-output-stream-ioblocks%)
     
    42624263  (declare (dynamic-extent keys))
    42634264  (let* ((recycled (and stream
    4264                         (eq (basic-stream.class stream)
    4265                             *string-output-stream-class*)
     4265                        (eq (basic-stream.wrapper stream)
     4266                            *string-output-stream-class-wrapper*)
    42664267                        (without-interrupts
    42674268                         (let* ((data (pool.data %string-output-stream-ioblocks%)))
     
    44094410
    44104411(defun make-simple-string-output-stream ()
     4412  ;; There's a good chance that we'll get a recycled ioblock
     4413  ;; that already has a string; if not, we defer actually
     4414  ;; creating a usable string until write-char
    44114415  (%%make-string-output-stream *string-output-stream-class*
    4412                                (make-string 40)
     4416                               ""
    44134417                               'string-output-stream-ioblock-write-char
    44144418                               'string-output-stream-ioblock-write-simple-string))
     
    44684472
    44694473(defstatic *indenting-string-output-stream-class* (make-built-in-class 'indenting-string-output-stream 'string-output-stream))
    4470 
     4474(defstatic *indenting-string-output-stream-class-wrapper* (%class-own-wrapper *indenting-string-output-stream-class*))
    44714475
    44724476
     
    45094513(defun (setf indenting-string-output-stream-indent) (new stream)
    45104514  (if (and (typep stream 'basic-stream)
    4511            (eq (basic-stream.class stream) *indenting-string-output-stream-class*))
     4515           (eq (basic-stream.wrapper stream) *indenting-string-output-stream-class-wrapper*))
    45124516    (setf (getf (basic-stream.info stream) 'indent) new)
    45134517    (report-bad-arg stream 'indenting-string-output-stream)))
     
    45154519
    45164520(defun get-output-stream-string (s)
    4517   (let* ((class (if (typep s 'basic-stream) (basic-stream.class s))))
     4521 (let* ((class (if (typep s 'basic-stream) (%wrapper-class (basic-stream.wrapper s)))))
    45184522    (or (eq class *string-output-stream-class*)
    45194523        (eq class *truncating-string-output-stream-class*)
     
    45354539;;; String input streams.
    45364540(defstatic *string-input-stream-class* (make-built-in-class 'string-input-stream 'string-stream 'basic-character-input-stream))
    4537 
     4541(defstatic *string-input-stream-class-wrapper* (%class-own-wrapper *string-input-stream-class*))
    45384542(defstruct (string-input-stream-ioblock (:include string-stream-ioblock))
    45394543  (start 0)
     
    45464550(defun string-input-stream-index (s)
    45474551  (if (and (typep s 'basic-stream)
    4548            (eq *string-input-stream-class* (basic-stream.class s)))
     4552           (eq *string-input-stream-class-wrapper* (basic-stream.wrapper s)))
    45494553    (let* ((ioblock (basic-stream-ioblock s)))
    45504554      (- (string-input-stream-ioblock-index ioblock)
     
    45604564             (end (string-input-stream-ioblock-end ioblock))
    45614565             (string (string-stream-ioblock-string ioblock)))
    4562         (subseq string (max (- idx 5) start) (min (+ idx 5) end))))))
     4566        (subseq string (max (- idx 10) start) (min (+ idx 10) end))))))
    45634567   
    45644568
     
    47184722
    47194723(defun string-stream-string (s)
    4720   (let* ((class (if (typep s 'basic-stream) (basic-stream.class s))))
     4724  (let* ((class (if (typep s 'basic-stream) (%wrapper-class (basic-stream.wrapper s)))))
    47214725    (or (eq class *string-output-stream-class*)
    47224726        (eq class *truncating-string-output-stream-class*)
  • trunk/source/library/lispequ.lisp

    r10422 r10424  
    13191319;;; "basic" (e.g., builtin, non-extensible) streams.
    13201320(def-accessors (basic-stream) %svref
    1321   basic-stream.class                    ; a class object
     1321  basic-stream.wrapper                  ; a class wrapper
    13221322  basic-stream.flags                    ; fixnum; bits.
    13231323  basic-stream.state                    ; typically an ioblock
Note: See TracChangeset for help on using the changeset viewer.