* improvement: support for executable cores on NetBSD (thanks to
Richard Kreuter)
* new feature: added a RESTART-FRAME debugger command
+ * new feature: new generic function SB-GRAY:STREAM-FILE-POSITION can
+ be used to provide an implementation for FILE-POSITION on Gray streams
+ (thanks to Eric Marsden)
* optimization: the function call overhead in code compiled with
a high DEBUG optimization setting is significantly
* bug fix: an error is signaled for attempts to use READ-SEQUENCE
@include fun-common-lisp-stream-element-type.texinfo
@include fun-common-lisp-close.texinfo
-
+@include fun-sb-gray-stream-file-position.texinfo
"FUNDAMENTAL-INPUT-STREAM" "FUNDAMENTAL-OUTPUT-STREAM"
"FUNDAMENTAL-STREAM"
"STREAM-ADVANCE-TO-COLUMN" "STREAM-CLEAR-INPUT"
- "STREAM-CLEAR-OUTPUT" "STREAM-FINISH-OUTPUT" "STREAM-FORCE-OUTPUT"
+ "STREAM-CLEAR-OUTPUT" "STREAM-FILE-POSITION" "STREAM-FINISH-OUTPUT" "STREAM-FORCE-OUTPUT"
"STREAM-FRESH-LINE" "STREAM-LINE-COLUMN" "STREAM-LINE-LENGTH"
"STREAM-LISTEN" "STREAM-PEEK-CHAR" "STREAM-READ-BYTE"
"STREAM-READ-CHAR" "STREAM-READ-CHAR-NO-HANG" "STREAM-READ-LINE"
(- +ansi-stream-in-buffer-length+
(ansi-stream-in-index stream)))))))))))
-
(defun file-position (stream &optional position)
- (ansi-stream-file-position stream position))
+ (if (ansi-stream-p stream)
+ (ansi-stream-file-position stream position)
+ (stream-file-position stream position)))
;;; This is a literal translation of the ANSI glossary entry "stream
;;; associated with a file".
(error 'type-error :datum non-stream :expected-type 'stream))
(defgeneric stream-read-sequence (stream seq &optional start end)
+ #+sb-doc
(:documentation
"This is like CL:READ-SEQUENCE, but for Gray streams."))
T)))
(defgeneric stream-write-sequence (stream seq &optional start end)
+ #+sb-doc
(:documentation
"This is like CL:WRITE-SEQUENCE, but for Gray streams."))
(basic-io-type-stream-write-sequence stream seq start end
#'stream-write-byte))
+(defgeneric stream-file-position (stream &optional position-spec)
+ #+sb-doc
+ (:documentation
+ "Used by FILE-POSITION. Returns or changes the current position within STREAM."))
+
+(defmethod stream-file-position ((stream ansi-stream) &optional position-spec)
+ (ansi-stream-file-position stream position-spec))
+
+(defmethod stream-file-position ((stream t) &optional position-spec)
+ (declare (ignore stream position-spec))
+ nil)
+
\f
;;; This is not in the Gray stream proposal, so it is left here
;;; as example code.
(defclass character-output-stream (fundamental-character-output-stream)
((lisp-stream :initarg :lisp-stream
- :accessor character-output-stream-lisp-stream)))
+ :accessor character-output-stream-lisp-stream)
+ (position :initform 42 :accessor character-output-stream-position)))
(defclass character-input-stream (fundamental-character-input-stream)
((lisp-stream :initarg :lisp-stream
(defmethod stream-clear-output ((stream character-output-stream))
(clear-output (character-output-stream-lisp-stream stream)))
+
+(defmethod stream-file-position ((stream character-output-stream) &optional new-value)
+ (if new-value
+ (setf (character-output-stream-position stream) new-value)
+ (character-output-stream-position stream)))
\f
;;;; example character input stream encapsulating a lisp-stream
((eq byte :eof))
(write-byte byte our-bin-to-char-output))))
test-string))))
+
+\f
+
+;;; Minimal test of file-position
+(let ((stream (make-instance 'character-output-stream)))
+ (assert (= (file-position stream) 42))
+ (assert (file-position stream 50))
+ (assert (= (file-position stream) 50)))
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.1.22"
+"1.0.1.23"