[cl-plus-ssl-cvs] CVS trivial-gray-streams
avodonosov
avodonosov at common-lisp.net
Sat Nov 1 03:13:23 UTC 2008
Update of /project/cl-plus-ssl/cvsroot/trivial-gray-streams
In directory cl-net:/tmp/cvs-serv17925
Modified Files:
mixin.lisp
Log Message:
better CLISP support for stream-read-sequence, stream-write-sequence
--- /project/cl-plus-ssl/cvsroot/trivial-gray-streams/mixin.lisp 2008/09/10 16:36:29 1.6
+++ /project/cl-plus-ssl/cvsroot/trivial-gray-streams/mixin.lisp 2008/11/01 03:13:22 1.7
@@ -69,8 +69,38 @@
((s trivial-gray-stream-mixin) seq start end)
(stream-write-sequence s seq start end)))
+;; up to version 2.43 there were no
+;; stream-read-sequence, stream-write-sequence
+;; functions in CLISP
+#+clisp
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (when (find-symbol "STREAM-READ-SEQUENCE" "GRAY")
+ (pushnew :clisp-has-stream-read/write-sequence *features*)))
+
#+clisp
(progn
+
+ #+clisp-has-stream-read/write-sequence
+ (defmethod gray:stream-read-sequence
+ (seq (s trivial-gray-stream-mixin) &key start end)
+ (stream-read-sequence s seq (or start 0) (or end (length seq))))
+
+ #+clisp-has-stream-read/write-sequence
+ (defmethod gray:stream-write-sequence
+ (seq (s trivial-gray-stream-mixin) &key start end)
+ (stream-write-sequence s seq (or start 0) (or end (length seq))))
+
+ ;; Even despite the stream-read/write-sequence are present in newer
+ ;; CLISP, it's better to provide stream-(read/write)-(byte/char)-sequence
+ ;; methods too.
+ ;; Example: if fundamental-binary-input-stream comes in the
+ ;; class precedence list of your user-defined stream before
+ ;; the trivial-gray-steam-mixin, the default CLISP's implementation
+ ;; of the gray:stream-read-sequence will be used; and this default
+ ;; implementation calls the gray:stream-read-byte-sequence.
+ ;; Therefore we override gray:stream-read-byte-sequence and call
+ ;; our stream-read-sequence.
+
(defmethod gray:stream-read-byte-sequence
((s trivial-gray-stream-mixin)
seq
More information about the cl-plus-ssl-cvs
mailing list