Changeset 4914


Ignore:
Timestamp:
Jul 27, 2006, 11:49:15 PM (18 years ago)
Author:
Gary Byers
Message:

READ-BYTE for BASIC-STREAMs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/streams.lisp

    r4908 r4914  
    4545
    4646(defun read-char (&optional input-stream (eof-error-p t) eof-value recursive-p)
    47   (declare (ignore recursive-p))
     47  (declare (ignore recursive-p)
     48           (optimize (speed 3) (space 0)))
    4849  (setq input-stream (designated-input-stream input-stream))
    49   (check-eof
    50    (if (typep input-stream 'basic-stream)
    51      (let* ((ioblock (basic-stream.state input-stream)))
    52        (if ioblock
     50  (if (typep input-stream 'basic-stream)
     51    (let* ((ioblock (basic-stream.state input-stream)))
     52      (if ioblock
     53        (check-eof
    5354         (funcall (ioblock-read-char-function ioblock) ioblock)
    54          (error "~s is closed" input-stream)))
    55      (stream-read-char input-stream))
    56    input-stream
    57    eof-error-p
    58    eof-value))
     55         input-stream eof-error-p eof-value)
     56        (stream-is-closed input-stream)))
     57    (check-eof (stream-read-char input-stream)
     58               input-stream
     59               eof-error-p
     60               eof-value)))
    5961
    6062(defun unread-char (char &optional input-stream)
     
    8890
    8991(defun read-byte (stream &optional (eof-error-p t) eof-value)
    90   (check-eof
    91    (stream-read-byte stream)
    92    stream
    93    eof-error-p
    94    eof-value))
     92  (if (typep stream 'basic-stream)
     93    (let* ((ioblock (basic-stream.state stream)))
     94      (if ioblock
     95        (check-eof (funcall (ioblock-read-byte-function ioblock) ioblock)
     96                   stream
     97                   eof-error-p
     98                   eof-value)
     99        (stream-is-closed ioblock)))
     100    (check-eof
     101     (stream-read-byte stream)
     102     stream
     103     eof-error-p
     104     eof-value)))
    95105
    96106;;;;;;;;;;;; OUTPUT STREAMS
Note: See TracChangeset for help on using the changeset viewer.