Changeset 4904


Ignore:
Timestamp:
Jul 24, 2006, 1:43:19 AM (18 years ago)
Author:
Gary Byers
Message:

FILE-STREAM is now abstract (and some sublasses may get that way);
FUNDAMENTAL-FILE-STREAM is an implementation of it (and BASIC-FILE-STREAM soon will be.)

File:
1 edited

Legend:

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

    r4900 r4904  
    277277
    278278;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    279 (defclass file-stream (fd-stream)
     279(defclass fundamental-file-stream (fd-stream file-stream)
    280280    ((filename :initform nil :initarg :filename :accessor file-stream-filename)
    281281     (actual-filename :initform nil :initarg :actual-filename)
     
    284284 
    285285
    286 (defmethod stream-filename ((s file-stream))
     286(defmethod stream-filename ((s fundamental-file-stream))
    287287  (file-stream-filename s))
    288288
     
    290290  (slot-value s 'actual-filename))
    291291
    292 (defmethod (setf stream-filename) (new (s file-stream))
     292(defmethod (setf stream-filename) (new (s fundamental-file-stream))
    293293  (setf (file-stream-filename s) new))
    294294
    295 (defmethod (setf stream-actual-filename) (new (s file-stream))
     295(defmethod (setf stream-actual-filename) (new (s fundamental-file-stream))
    296296  (setf (slot-value s 'actual-filename) new))
    297297
    298 (defmethod print-object ((s file-stream) out)
     298(defmethod print-object ((s fundamental-file-stream) out)
    299299  (print-unreadable-object (s out :type t :identity t)
    300300    (let* ((file-ioblock (stream-ioblock s nil)))
     
    304304        (format out ":closed")))))
    305305           
    306 (defmethod stream-create-ioblock ((stream file-stream) &rest args &key)
     306(defmethod stream-create-ioblock ((stream fundamental-file-stream) &rest args &key)
    307307  (declare (dynamic-extent args))
    308308  (apply #'make-file-ioblock :stream stream args))
    309309
    310 (defclass file-input-stream (file-stream fd-input-stream)
    311     ())
    312 
    313 (defclass file-output-stream (file-stream fd-output-stream)
    314     ())
    315 
    316 (defclass file-io-stream (file-stream fd-io-stream)
    317     ())
    318 
    319 (defclass file-character-input-stream (file-input-stream
     310(defclass fundamental-file-input-stream (fundamental-file-stream fd-input-stream)
     311    ())
     312
     313(defclass fundamental-file-output-stream (fundamental-file-stream fd-output-stream)
     314    ())
     315
     316(defclass fundamental-file-io-stream (fundamental-file-stream fd-io-stream)
     317    ())
     318
     319(defclass fundamental-file-character-input-stream (fundamental-file-input-stream
    320320                                          fd-character-input-stream)
    321321    ())
    322322
    323 (defclass file-character-output-stream (file-output-stream
    324                                            fd-character-output-stream)
    325     ())
    326 
    327 (defclass file-character-io-stream (file-io-stream
     323(defclass fundamental-file-character-output-stream (fundamental-file-output-stream
     324                                                    fd-character-output-stream)
     325    ())
     326
     327(defclass fundamental-file-character-io-stream (fundamental-file-io-stream
    328328                                       fd-character-io-stream)
    329329    ())
    330330
    331 (defclass file-binary-input-stream (file-input-stream
    332                                        fd-binary-input-stream)
    333     ())
    334 
    335 (defclass file-binary-output-stream (file-output-stream
    336                                         fd-binary-output-stream)
    337     ())
    338 
    339 (defclass file-binary-io-stream (file-io-stream fd-binary-io-stream)
     331(defclass fundamental-file-binary-input-stream (fundamental-file-input-stream
     332                                                fd-binary-input-stream)
     333    ())
     334
     335(defclass fundamental-file-binary-output-stream (fundamental-file-output-stream
     336                                                 fd-binary-output-stream)
     337    ())
     338
     339(defclass fundamental-file-binary-io-stream (fundamental-file-io-stream fd-binary-io-stream)
    340340    ())
    341341
     
    345345;;; like that.)
    346346
    347 (defmethod stream-clear-input ((f file-input-stream))
     347(defmethod stream-clear-input ((f fundamental-file-input-stream))
    348348  (with-stream-ioblock-input (file-ioblock f :speedy t)
    349349    (call-next-method)
     
    351351    nil))
    352352   
    353 (defmethod stream-clear-input ((f file-io-stream))
     353(defmethod stream-clear-input ((f fundamental-file-io-stream))
    354354  (with-stream-ioblock-input (file-ioblock f :speedy t)
    355355    (stream-force-output f)             
     
    358358    nil))
    359359
    360 (defmethod stream-clear-output ((f file-output-stream))
     360(defmethod stream-clear-output ((f fundamental-file-output-stream))
    361361  (with-stream-ioblock-output (file-ioblock f :speedy t)
    362362    (call-next-method)
     
    437437    (file-ioblock-seek file-ioblock newoctetpos)))
    438438
    439 (defmethod stream-position ((stream file-input-stream) &optional newpos)
     439(defmethod stream-position ((stream fundamental-file-input-stream) &optional newpos)
    440440  (with-stream-ioblock-input (file-ioblock stream :speedy t)
    441441    (%ioblock-input-file-position file-ioblock newpos)))
     
    443443
    444444
    445 (defmethod stream-position ((stream file-output-stream) &optional newpos)
     445(defmethod stream-position ((stream fundamental-file-output-stream) &optional newpos)
    446446  (with-stream-ioblock-output (file-ioblock stream :speedy t)
    447447    (%ioblock-output-file-position file-ioblock newpos)))
     
    449449
    450450
    451 (defmethod stream-position ((stream file-io-stream) &optional newpos)
     451(defmethod stream-position ((stream fundamental-file-io-stream) &optional newpos)
    452452  (with-stream-ioblock-input (file-ioblock stream :speedy t)
    453453    (%ioblock-io-file-position file-ioblock newpos)))
     
    455455
    456456
    457 (defmethod stream-length ((stream file-input-stream) &optional newlen)
     457(defmethod stream-length ((stream fundamental-file-input-stream) &optional newlen)
    458458  (with-stream-ioblock-input (file-ioblock stream :speedy t)
    459459    (%ioblock-input-file-length file-ioblock newlen)))
     
    461461
    462462
    463 (defmethod stream-length ((s file-output-stream) &optional newlen)
     463(defmethod stream-length ((s fundamental-file-output-stream) &optional newlen)
    464464  (with-stream-ioblock-output (file-ioblock s :speedy t)
    465465    (%ioblock-output-file-length file-ioblock newlen)))
    466466
    467 (defmethod stream-length ((s file-io-stream) &optional newlen)
     467(defmethod stream-length ((s fundamental-file-io-stream) &optional newlen)
    468468  (with-stream-ioblock-input (file-ioblock s :speedy t)
    469469    (%ioblock-output-file-length file-ioblock newlen)))
    470470
    471 (defmethod close ((s file-stream) &key abort)
     471(defmethod close ((s fundamental-file-stream) &key abort)
    472472  (when (open-stream-p s)
    473473    (let* ((ioblock (stream-ioblock s t))
     
    487487  (if char-p
    488488    (if (and in-p out-p)
    489       'file-character-io-stream
     489      'fundamental-file-character-io-stream
    490490      (if in-p
    491         'file-character-input-stream
     491        'fundamental-file-character-input-stream
    492492        (if out-p
    493           'file-character-output-stream
    494           'file-stream)))
     493          'fundamental-file-character-output-stream
     494          'fundamental-file-stream)))
    495495    (if (and in-p out-p)
    496       'file-binary-io-stream
     496      'fundamental-file-binary-io-stream
    497497      (if in-p
    498         'file-binary-input-stream
     498        'fundamental-file-binary-input-stream
    499499        (if out-p
    500           'file-binary-output-stream
    501           'file-stream)))))
     500          'fundamental-file-binary-output-stream
     501          'fundamental-file-stream)))))
    502502
    503503(defun make-file-stream (filename
     
    634634                fstream))))))))
    635635
    636 (defmethod stream-external-format ((s file-stream))
     636(defmethod stream-external-format ((s fundamental-file-stream))
    637637  (file-stream-external-format s))
    638638
Note: See TracChangeset for help on using the changeset viewer.