X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fgray-streams.lisp;h=f4b407604a6b1d706ec85891e595de154e200c2f;hb=dec94b039e8ec90baf21463df839a6181de606f6;hp=f279a726513b85a96aa007bea96ea910df5006e1;hpb=8fc5fda05f92d69c95b47e4ad7561d91dab18c3e;p=sbcl.git diff --git a/src/pcl/gray-streams.lisp b/src/pcl/gray-streams.lisp index f279a72..f4b4076 100644 --- a/src/pcl/gray-streams.lisp +++ b/src/pcl/gray-streams.lisp @@ -9,9 +9,6 @@ ;;;; warranty. See the COPYING and CREDITS files for more information. (in-package "SB-GRAY") - -(sb-int:file-comment - "$Header$") (fmakunbound 'stream-element-type) @@ -36,10 +33,10 @@ called on the stream.")) (defmethod pcl-open-stream-p ((stream lisp-stream)) - (not (eq (sb-impl::lisp-stream-in stream) #'sb-impl::closed-flame))) + (not (eq (lisp-stream-in stream) #'closed-flame))) (defmethod pcl-open-stream-p ((stream fundamental-stream)) - nil) + (stream-open-p stream)) ;;; bootstrapping hack (pcl-open-stream-p (make-string-output-stream)) @@ -57,17 +54,22 @@ (funcall (lisp-stream-misc stream) stream :close abort)) t) +(defmethod pcl-close ((stream fundamental-stream) &key abort) + (declare (ignore abort)) + (setf (stream-open-p stream) nil) + t) + (setf (fdefinition 'close) #'pcl-close) (fmakunbound 'input-stream-p) (defgeneric input-stream-p (stream) #+sb-doc - (:documentation "Returns non-nil if the given Stream can perform input operations.")) + (:documentation "Return non-nil if the given Stream can perform input operations.")) (defmethod input-stream-p ((stream lisp-stream)) - (and (not (eq (sb-impl::lisp-stream-in stream) #'sb-impl::closed-flame)) - (or (not (eq (sb-impl::lisp-stream-in stream) #'ill-in)) + (and (not (eq (lisp-stream-in stream) #'closed-flame)) + (or (not (eq (lisp-stream-in stream) #'ill-in)) (not (eq (lisp-stream-bin stream) #'ill-bin))))) (defmethod input-stream-p ((stream fundamental-input-stream)) @@ -77,10 +79,10 @@ (defgeneric output-stream-p (stream) #+sb-doc - (:documentation "Returns non-nil if the given Stream can perform output operations.")) + (:documentation "Return non-nil if the given Stream can perform output operations.")) (defmethod output-stream-p ((stream lisp-stream)) - (and (not (eq (sb-impl::lisp-stream-in stream) #'sb-impl::closed-flame)) + (and (not (eq (lisp-stream-in stream) #'closed-flame)) (or (not (eq (lisp-stream-out stream) #'ill-out)) (not (eq (lisp-stream-bout stream) #'ill-bout))))) @@ -208,6 +210,9 @@ defined for this function, although it is permissible for it to always return NIL.")) +(defmethod stream-line-column ((stream fundamental-character-output-stream)) + nil) + ;;; STREAM-LINE-LENGTH is a CMU CL extension to Gray streams. ;;; FIXME: Should we support it? Probably not.. (defgeneric stream-line-length (stream) @@ -322,7 +327,7 @@ (let ((current-column (stream-line-column stream))) (when current-column (let ((fill (- column current-column))) - (dotimes-fixnum (i fill) + (dotimes (i fill) (stream-write-char stream #\Space))) T))) @@ -346,6 +351,9 @@ "Implements WRITE-BYTE; writes the integer to the stream and returns the integer as the result.")) +#| +This is not in the gray-stream proposal, so it is left here +as example code. ;;; example character output stream encapsulating a lisp-stream (defun make-character-output-stream (lisp-stream) (declare (type lisp-stream lisp-stream)) @@ -418,3 +426,4 @@ (defmethod stream-clear-input ((stream character-input-stream)) (clear-input (character-input-stream-lisp-stream stream))) +|#