X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fgray-streams.lisp;h=f4b407604a6b1d706ec85891e595de154e200c2f;hb=416152f084604094445a758ff399871132dff2bd;hp=e764068b515f8505b7f0950340670f4d49b5a8e7;hpb=cea4896b2482b7b2b429c1631d774b4cfbc0efba;p=sbcl.git diff --git a/src/pcl/gray-streams.lisp b/src/pcl/gray-streams.lisp index e764068..f4b4076 100644 --- a/src/pcl/gray-streams.lisp +++ b/src/pcl/gray-streams.lisp @@ -33,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)) @@ -54,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)) @@ -74,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))))) @@ -205,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) @@ -319,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))) @@ -343,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)) @@ -415,3 +426,4 @@ (defmethod stream-clear-input ((stream character-input-stream)) (clear-input (character-input-stream-lisp-stream stream))) +|#