Changeset 5081


Ignore:
Timestamp:
Sep 3, 2006, 1:20:08 PM (18 years ago)
Author:
Gary Byers
Message:

More missing BASIC-STREAM methods.

File:
1 edited

Legend:

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

    r5066 r5081  
    14151415  (generic-character-read-vector stream vector start end))
    14161416
     1417
    14171418(defmethod stream-read-vector ((stream fundamental-binary-input-stream)
    14181419                               vector start end)
     
    14251426        (return i)
    14261427        (setf (uvref vector i) b)))))
     1428
     1429
    14271430
    14281431
     
    15341537  (apply #'make-ioblock :stream stream args))
    15351538
     1539(defmethod stream-read-vector ((stream basic-character-input-stream)
     1540                               vector start end)
     1541  (generic-character-read-vector stream vector start end))
     1542
     1543(defmethod stream-read-vector ((stream basic-binary-input-stream)
     1544                               vector start end)
     1545  (declare (fixnum start end))
     1546  (do* ((i start (1+ i)))
     1547       ((= i end) end)
     1548    (declare (fixnum i))
     1549    (let* ((b (stream-read-byte stream)))
     1550      (if (eq b :eof)
     1551        (return i)
     1552        (setf (uvref vector i) b)))))
    15361553
    15371554(defun stream-is-closed (s)
     
    23742391  (with-stream-ioblock-input (ioblock stream :speedy t)
    23752392    (funcall (ioblock-read-byte-function ioblock) ioblock)))
     2393
     2394(defmethod stream-read-byte ((stream basic-binary-input-stream))
     2395  (let* ((ioblock (basic-stream-ioblock stream)))
     2396    (with-ioblock-input-locked (ioblock)
     2397      (funcall (ioblock-read-byte-function ioblock) ioblock))))
    23762398
    23772399(defmethod stream-eofp ((stream buffered-input-stream-mixin))
     
    26002622                 (%ioblock-force-output ioblock nil))))))))))
    26012623
     2624(defmethod stream-write-vector ((stream basic-binary-output-stream)
     2625                                vector start end)
     2626  (declare (fixnum start end))
     2627  (let* ((ioblock (basic-stream-ioblock stream)))
     2628    (with-ioblock-output-locked (ioblock)
     2629    (let* ((out (ioblock-outbuf ioblock))
     2630           (buf (io-buffer-buffer out))
     2631           (written 0)
     2632           (limit (io-buffer-limit out))
     2633           (total (- end start))
     2634           (buftype (typecode buf)))
     2635      (declare (fixnum buftype written total limit))
     2636      (if (not (= (the fixnum (typecode vector)) buftype))
     2637        (do* ((i start (1+ i)))
     2638             ((= i end))
     2639          (let ((byte (uvref vector i)))
     2640            (when (characterp byte)
     2641              (setq byte (char-code byte)))
     2642            (%ioblock-write-byte ioblock byte)))
     2643        (do* ((pos start (+ pos written))
     2644              (left total (- left written)))
     2645             ((= left 0))
     2646          (declare (fixnum pos left))
     2647          (setf (ioblock-dirty ioblock) t)
     2648          (let* ((index (io-buffer-idx out))
     2649                 (count (io-buffer-count out))
     2650                 (avail (- limit index)))
     2651            (declare (fixnum index avail count))
     2652            (cond
     2653              ((= (setq written avail) 0)
     2654               (%ioblock-force-output ioblock nil))
     2655              (t
     2656               (if (> written left)
     2657                 (setq written left))
     2658               (%copy-ivector-to-ivector
     2659                vector
     2660                (ioblock-elements-to-octets ioblock pos)
     2661                buf
     2662                (ioblock-elements-to-octets ioblock index)
     2663                (ioblock-elements-to-octets ioblock written))
     2664               (setf (ioblock-dirty ioblock) t)
     2665               (incf index written)
     2666               (if (> index count)
     2667                 (setf (io-buffer-count out) index))
     2668               (setf (io-buffer-idx out) index)
     2669               (if (= index  limit)
     2670                 (%ioblock-force-output ioblock nil)))))))))))
     2671
     2672(defmethod stream-read-vector ((stream basic-character-input-stream)
     2673                               vector start end)
     2674  (declare (fixnum start end))
     2675  (if (not (typep vector 'simple-base-string))
     2676    (call-next-method)
     2677    (let* ((ioblock (basic-stream-ioblock stream)))
     2678      (with-ioblock-input-locked (ioblock)
     2679        (%ioblock-character-read-vector ioblock vector start end)))))
     2680
     2681(defmethod stream-read-vector ((stream basic-binary-input-stream)
     2682                               vector start end)
     2683  (declare (fixnum start end))
     2684  (if (typep vector 'simple-base-string)
     2685    (call-next-method)
     2686    (let* ((ioblock (basic-stream-ioblock stream)))
     2687      (with-ioblock-input-locked (ioblock)
     2688        (%ioblock-binary-read-vector ioblock vector start end)))))
     2689
    26022690(defmethod stream-read-vector ((stream buffered-character-input-stream-mixin)
    26032691                               vector start end)
     
    26082696      (%ioblock-character-read-vector ioblock vector start end))))
    26092697
     2698
     2699
    26102700(defmethod stream-read-vector ((stream buffered-binary-input-stream-mixin)
    26112701                               vector start end)
     
    26152705    (with-stream-ioblock-input (ioblock stream :speedy t)
    26162706      (%ioblock-binary-read-vector ioblock vector start end))))
     2707
     2708
    26172709
    26182710(defloadvar *fd-set-size*
Note: See TracChangeset for help on using the changeset viewer.