Changeset 5582


Ignore:
Timestamp:
Dec 4, 2006, 8:21:12 AM (18 years ago)
Author:
Gary Byers
Message:

Default STREAM-POSITION method for STREAMs, returns NIL.
STREAM-POSITION method for STRING-INPUT-STREAMs.

File:
1 edited

Legend:

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

    r5580 r5582  
    7777(defmethod stream-element-type ((x t))
    7878  (report-bad-arg x 'stream))
     79
     80(defmethod stream-position ((s stream) &optional newpos)
     81  (declare (ignore newpos)))
    7982
    8083;;; For input streams:
     
    43914394
    43924395
     4396(defmethod stream-position ((s string-input-stream) &optional newpos)
     4397  (let* ((ioblock (basic-stream-ioblock s))
     4398         (start (string-input-stream-ioblock-start ioblock))
     4399         (idx (string-input-stream-ioblock-index ioblock))
     4400         (end (string-input-stream-ioblock-end ioblock)))
     4401    (declare (fixnum end idx start))
     4402    (if newpos
     4403      (let* ((limit (- end start)))
     4404        (declare (fixnum limit))
     4405        (if (and (typep newpos 'fixnum)
     4406                 (>= (the fixnum newpos) 0)
     4407                 (< (the fixnum newpos) limit))
     4408          (progn
     4409            (setf (string-input-stream-ioblock-index ioblock)
     4410                  (the fixnum (+ start (the fixnum newpos))))
     4411            newpos)
     4412          (report-bad-arg newpos `(integer 0 (,limit)))))
     4413      (the fixnum (- idx start)))))
     4414   
     4415 
    43934416
    43944417(defun string-input-stream-ioblock-read-char (ioblock)
Note: See TracChangeset for help on using the changeset viewer.