Changeset 917


Ignore:
Timestamp:
Feb 16, 2005, 7:35:24 PM (17 years ago)
Author:
bryan
Message:

fill in some missing methods for echo-streams and concatenated-streams.

(defmethod stream-read-char-no-hang ((s echo-stream))
(defmethod stream-read-byte ((s echo-stream))
(defmethod stream-read-line ((s echo-stream))
(defmethod stream-read-vector ((s echo-stream) vector start end)

(defmethod stream-read-char-no-hang ((s concatenated-stream))
(defmethod stream-peek-char ((s concatenated-stream))
(defmethod stream-read-line ((s concatenated-stream))
(defmethod stream-read-list ((s concatenated-stream) list count)
(defmethod stream-read-vector ((s concatenated-stream) vector start end)

File:
1 edited

Legend:

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

    r885 r917  
    13081308  (setf (slot-value s 'did-untyi) c))
    13091309
     1310(defmethod stream-read-char-no-hang ((s echo-stream))
     1311  (let* ((char (stream-read-char-no-hang (echo-stream-input-stream s))))
     1312    (unless (eq char :eof)
     1313      (if (slot-value s 'did-untyi)
     1314        (setf (slot-value s 'did-untyi) nil)
     1315        (stream-write-char (echo-stream-output-stream s) char)))
     1316    char))
     1317
    13101318(defmethod stream-clear-input ((s echo-stream))
    13111319  (call-next-method)
    13121320  (setf (slot-value s 'did-untyi) nil))
     1321
     1322(defmethod stream-read-byte ((s echo-stream))
     1323  (let* ((byte (stream-read-byte (echo-stream-input-stream s))))
     1324    (unless (eq byte :eof)
     1325      (stream-write-byte (echo-stream-output-stream s) byte))
     1326    byte))
     1327
     1328(defmethod stream-read-line ((s echo-stream))
     1329  (generic-read-line s))
     1330
     1331(defmethod stream-read-vector ((s echo-stream) vector start end)
     1332  (if (subtypep (stream-element-type s) 'character)
     1333      (generic-character-read-vector s vector start end)
     1334    (generic-binary-read-vector s vector start end)))
    13131335
    13141336(defun make-echo-stream (input-stream output-stream)
     
    13461368        (return ch)))))
    13471369
     1370(defmethod stream-read-char-no-hang ((s concatenated-stream))
     1371  (do* ((c (concatenated-stream-current-input-stream s)
     1372           (concatenated-stream-next-input-stream s)))
     1373       ((null c) :eof)
     1374    (let* ((ch (stream-read-char-no-hang c)))
     1375      (unless (eq ch :eof)
     1376        (return ch)))))
     1377
    13481378(defmethod stream-read-byte ((s concatenated-stream))
    13491379  (do* ((c (concatenated-stream-current-input-stream s)
     
    13531383      (unless (eq b :eof)
    13541384        (return b)))))
     1385
     1386(defmethod stream-peek-char ((s concatenated-stream))
     1387  (do* ((c (concatenated-stream-current-input-stream s)
     1388       (concatenated-stream-next-input-stream s)))
     1389       ((null c) :eof)
     1390    (let* ((ch (stream-peek-char c)))
     1391      (unless (eq ch :eof)
     1392        (return ch)))))
     1393
     1394(defmethod stream-read-line ((s concatenated-stream))
     1395  (generic-read-line s))
     1396
     1397(defmethod stream-read-list ((s concatenated-stream) list count)
     1398  (generic-character-read-list s list count))
     1399
     1400(defmethod stream-read-vector ((s concatenated-stream) vector start end)
     1401  (if (subtypep (stream-element-type s) 'character)
     1402      (generic-character-read-vector s vector start end)
     1403    (generic-binary-read-vector s vector start end)))
    13551404
    13561405(defmethod stream-unread-char ((s concatenated-stream) char)
Note: See TracChangeset for help on using the changeset viewer.