X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fgray-streams.lisp;h=b273412ff0c08d0aa100011caa14ad34cc63325b;hb=77869604fc3eb4417a630651e5fe40e74342ee59;hp=02a3a06a7bf9ad1a3dcb6da7ec6567c073b49211;hpb=8eb6f7d3da3960c827b704e23b5a47008274be7d;p=sbcl.git diff --git a/src/pcl/gray-streams.lisp b/src/pcl/gray-streams.lisp index 02a3a06..b273412 100644 --- a/src/pcl/gray-streams.lisp +++ b/src/pcl/gray-streams.lisp @@ -21,7 +21,7 @@ which returns CHARACTER.")) (defmethod stream-element-type ((stream ansi-stream)) - (funcall (ansi-stream-misc stream) stream :element-type)) + (ansi-stream-element-type stream)) (defmethod stream-element-type ((stream fundamental-character-stream)) 'character) @@ -34,7 +34,7 @@ called on the stream.")) (defmethod pcl-open-stream-p ((stream ansi-stream)) - (not (eq (ansi-stream-in stream) #'closed-flame))) + (ansi-stream-open-stream-p stream)) (defmethod pcl-open-stream-p ((stream fundamental-stream)) (stream-open-p stream)) @@ -51,9 +51,7 @@ to clean up the side effects of having created the stream.")) (defmethod pcl-close ((stream ansi-stream) &key abort) - (when (open-stream-p stream) - (funcall (ansi-stream-misc stream) stream :close abort)) - t) + (ansi-stream-close stream abort)) (defmethod pcl-close ((stream fundamental-stream) &key abort) (declare (ignore abort)) @@ -69,9 +67,7 @@ (:documentation "Can STREAM perform input operations?")) (defmethod input-stream-p ((stream ansi-stream)) - (and (not (eq (ansi-stream-in stream) #'closed-flame)) - (or (not (eq (ansi-stream-in stream) #'ill-in)) - (not (eq (ansi-stream-bin stream) #'ill-bin))))) + (ansi-stream-input-stream-p stream)) (defmethod input-stream-p ((stream fundamental-input-stream)) t) @@ -83,9 +79,7 @@ (:documentation "Can STREAM perform output operations?")) (defmethod output-stream-p ((stream ansi-stream)) - (and (not (eq (ansi-stream-in stream) #'closed-flame)) - (or (not (eq (ansi-stream-out stream) #'ill-out)) - (not (eq (ansi-stream-bout stream) #'ill-bout))))) + (ansi-stream-output-stream-p stream)) (defmethod output-stream-p ((stream fundamental-output-stream)) t) @@ -232,6 +226,13 @@ &optional (start 0) (end nil)) (basic-io-type-stream-read-sequence stream seq start end #'stream-read-char)) + +(defmethod stream-read-sequence ((stream fundamental-binary-input-stream) + (seq sequence) + &optional (start 0) (end nil)) + (basic-io-type-stream-read-sequence stream seq start end + #'stream-read-byte)) + ;;; character output streams ;;; @@ -288,7 +289,7 @@ (defmethod stream-start-line-p ((stream fundamental-character-output-stream)) (eql (stream-line-column stream) 0)) -(defgeneric stream-write-string (stream string &optional (start 0) end) +(defgeneric stream-write-string (stream string &optional start end) #+sb-doc (:documentation "This is used by WRITE-STRING. It writes the string to the stream, @@ -436,6 +437,16 @@ (:documentation "Implements WRITE-BYTE; writes the integer to the stream and returns the integer as the result.")) + +;; Provide a reasonable default for binary Gray streams. We might be +;; able to do better by specializing on the sequence type, but at +;; least the behaviour is reasonable. --tony 2003/05/08. +(defmethod stream-write-sequence ((stream fundamental-binary-output-stream) + (seq sequence) + &optional (start 0) (end nil)) + (basic-io-type-stream-write-sequence stream seq start end + #'stream-write-byte)) + ;;; This is not in the Gray stream proposal, so it is left here ;;; as example code.