Changeset 5427


Ignore:
Timestamp:
Oct 25, 2006, 7:36:00 PM (18 years ago)
Author:
Gary Byers
Message:

%BIVALENT-IOBLOCK-READ-U8-BYTE (and variants): always clear the untyi-char.

%ENCODED-IOBLOCK-PEEK-CHAR: the read-char-when-locked function needs an argument.

SETUP-IOBLOCK-OUTPUT: there are no special output functions for bivalent streams.

%IOBLOCK-BINARY-READ-VECTOR: clear any untyi char.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-streams.lisp

    r5418 r5427  
    476476(defun %bivalent-ioblock-read-u8-byte (ioblock)
    477477  (declare (optimize (speed 3) (safety 0)))
    478   (if (ioblock-untyi-char ioblock)
    479     (setf (ioblock-untyi-char ioblock) nil))
     478  (setf (ioblock-untyi-char ioblock) nil)
    480479  (let* ((buf (ioblock-inbuf ioblock))
    481480         (idx (io-buffer-idx buf))
     
    10501049  (declare (optimize (speed 3) (safety 0)))
    10511050  (check-ioblock-owner ioblock)
    1052   (if (ioblock-untyi-char ioblock)
    1053     (prog1 (%char-code (ioblock-untyi-char ioblock))
    1054       (setf (ioblock-untyi-char ioblock) nil))
     1051  (setf (ioblock-untyi-char ioblock) nil)
    10551052    (let* ((buf (ioblock-inbuf ioblock))
    10561053           (idx (io-buffer-idx buf))
     
    10641061      (setf (io-buffer-idx buf) (the fixnum (1+ idx)))
    10651062      (aref (the (simple-array (unsigned-byte 8) (*))
    1066               (io-buffer-buffer buf)) idx))))
     1063              (io-buffer-buffer buf)) idx)))
    10671064
    10681065(defun %private-ioblock-read-u8-byte (ioblock)
     
    10741071  (declare (optimize (speed 3) (safety 0)))
    10751072  (with-ioblock-input-lock-grabbed (ioblock)
    1076     (if (ioblock-untyi-char ioblock)
    1077       (prog1 (%char-code (ioblock-untyi-char ioblock))
    1078         (setf (ioblock-untyi-char ioblock) nil))
    1079       (let* ((buf (ioblock-inbuf ioblock))
    1080              (idx (io-buffer-idx buf))
    1081              (limit (io-buffer-count buf)))
    1082         (declare (fixnum idx limit))
    1083         (when (= idx limit)
    1084           (unless (%ioblock-advance ioblock t)
    1085             (return-from %bivalent-locked-ioblock-read-u8-byte :eof))
    1086           (setq idx (io-buffer-idx buf)
    1087                 limit (io-buffer-count buf)))
    1088         (setf (io-buffer-idx buf) (the fixnum (1+ idx)))
    1089         (aref (the (simple-array (unsigned-byte 8) (*))
    1090                 (io-buffer-buffer buf)) idx)))))
     1073    (setf (ioblock-untyi-char ioblock) nil)
     1074    (let* ((buf (ioblock-inbuf ioblock))
     1075           (idx (io-buffer-idx buf))
     1076           (limit (io-buffer-count buf)))
     1077      (declare (fixnum idx limit))
     1078      (when (= idx limit)
     1079        (unless (%ioblock-advance ioblock t)
     1080          (return-from %bivalent-locked-ioblock-read-u8-byte :eof))
     1081        (setq idx (io-buffer-idx buf)
     1082              limit (io-buffer-count buf)))
     1083      (setf (io-buffer-idx buf) (the fixnum (1+ idx)))
     1084      (aref (the (simple-array (unsigned-byte 8) (*))
     1085              (io-buffer-buffer buf)) idx))))
    10911086
    10921087(defun %locked-ioblock-read-u8-byte (ioblock)
     
    13221317(defun %encoded-ioblock-peek-char (ioblock)
    13231318  (or (ioblock-untyi-char ioblock)
    1324       (let* ((ch (funcall (ioblock-read-char-when-locked-function ioblock))))
     1319      (let* ((ch (funcall (ioblock-read-char-when-locked-function ioblock) ioblock)))
    13251320        (unless (eq ch :eof)
    13261321          (setf (ioblock-untyi-char ioblock) ch))
     
    23412336         (inbuf (io-buffer-buffer in))
    23422337         (rbf (ioblock-read-byte-when-locked-function ioblock)))
     2338    (setf (ioblock-untyi-char ioblock) nil)
    23432339    (if (not (= (the fixnum (typecode inbuf))
    23442340                (the fixnum (typecode vector))))
     
    24172413  (unless (= 0 (the fixnum (ioblock-element-shift ioblock)))
    24182414    (error "Can't read vector from stream ~s" (ioblock-stream ioblock)))
     2415  (setf (ioblock-untyi-char ioblock) nil)
    24192416  (do* ((i start)
    24202417        (rbf (ioblock-read-byte-when-locked-function ioblock))
     
    28802877      (setf (ioblock-write-byte-function ioblock)
    28812878            (cond ((= subtag target::subtag-u8-vector)
    2882                    (if character-p
    2883                      ;; The bivalent case, at least for now
    2884                      (progn
    2885                        (setf (ioblock-write-byte-when-locked-function ioblock)
    2886                              '%bivalent-ioblock-write-u8-byte)
    2887                        (case sharing
    2888                          (:private '%bivalent-private-ioblock-write-u8-byte)
    2889                          (:lock '%bivalent-locked-ioblock-write-u8-byte)
    2890                          (t '%bivalent-ioblock-write-u8-byte)))
    2891                      (progn
     2879                    (progn
    28922880                       (setf (ioblock-write-byte-when-locked-function ioblock)
    28932881                             '%ioblock-write-u8-byte)
     
    28952883                         (:private '%private-ioblock-write-u8-byte)
    28962884                         (:lock '%locked-ioblock-write-u8-byte)
    2897                          (t '%ioblock-write-u8-byte)))))
     2885                         (t '%ioblock-write-u8-byte))))
    28982886                  ((= subtag target::subtag-s8-vector)
    28992887                   (setf (ioblock-write-byte-when-locked-function ioblock)
Note: See TracChangeset for help on using the changeset viewer.