From edi at agharta.de Thu Jan 4 00:58:44 2007 From: edi at agharta.de (Edi Weitz) Date: Thu, 04 Jan 2007 01:58:44 +0100 Subject: [flexi-streams-devel] Re: Flexi-streams: in-memory-stream not subclassing flexi-stream? In-Reply-To: <87irfop6m1.fsf@free.fr> (Eric Marsden's message of "Wed, 03 Jan 2007 14:44:38 +0100") References: <87irfop6m1.fsf@free.fr> Message-ID: Hi Eric, On Wed, 03 Jan 2007 14:44:38 +0100, Eric Marsden wrote: > Thanks for flexi-streams, I am starting to use it in some projects, > and it is most useful! You're welcome... :) > In flexi-streams version 0.9.1 the class IN-MEMORY-STREAM does not > inherit from FLEXI-STREAM. Is there a fundamental reason for there > not to be a common ancestor class to these two stream classes? Yes. The reason from my point of view is that both classes are completely unrelated (except that they both inherit from STREAM, of course). In-memory streams are binary streams layered atop Lisp sequences, flexi streams are character streams layered atop Lisp streams. Flexi streams are there to provide portable external formats and the ability to changes these on the fly. In-memory streams are there to provide a binary equivalent to WITH-INPUT-FROM-STRING and related ANSI functionality. Flexi streams are a thin layer above an existing stream, in-memory streams create a new "virtual" stream from an unrelated data structure. They happen to be defined in the same open source library, but that's just because I was too lazy to start a separate project for in-memory streams... :) > It would be useful when doing CLOS or TYPECASE dispatch on various > types of streams. What would be a real-world scenario where you'd like to treat a flexi stream like an in-memory stream? Cheers, Edi. [Cc to mailing list.] From ctdean at sokitomi.com Sun Jan 7 06:34:18 2007 From: ctdean at sokitomi.com (Chris Dean) Date: Sat, 06 Jan 2007 22:34:18 -0800 Subject: [flexi-streams-devel] byte-transformer for in-memory streams Message-ID: I have a need in my code to use in-memory streams that read and write from strings using read-byte and write-byte. I could convert back and forth using octets-to-string and string-to-octets. For example: (octets-to-string (with-output-to-sequence (out) (write-byte 65 out))) => "A" But I wish to avoid the garbage created by this conversion process. I propose an addition to flexi-streams that allows in-memory streams to use a function to transform each byte as it is written and read from a sequence. For example: (with-output-to-sequence (out :element-type 'base-char :byte-transformer #'code-char) (write-byte 65 out)) => "A" with-input-from-sequence has a similar change. A patch is attached. Comments and request for changes welcome. I use flexi-streams all the time. A great package! Thanks for all your hard work on it. Cheers, Chris Dean -------------- next part -------------- A non-text attachment was scrubbed... Name: flexi-stream-transformer.patch Type: text/x-patch Size: 8156 bytes Desc: not available URL: From edi at agharta.de Tue Jan 9 23:25:41 2007 From: edi at agharta.de (Edi Weitz) Date: Wed, 10 Jan 2007 00:25:41 +0100 Subject: [flexi-streams-devel] New release 0.10.0 (Was: byte-transformer for in-memory streams) In-Reply-To: (Chris Dean's message of "Sat, 06 Jan 2007 22:34:18 -0800") References: Message-ID: On Sat, 06 Jan 2007 22:34:18 -0800, Chris Dean wrote: > I propose an addition to flexi-streams that allows in-memory streams > to use a function to transform each byte as it is written and read > from a sequence. Thanks for the patch. This is in 0.10.0 now. > I use flexi-streams all the time. A great package! Thanks for all > your hard work on it. You're welcome... :) From reddaly at gmail.com Thu Jan 11 01:13:07 2007 From: reddaly at gmail.com (Red Daly) Date: Wed, 10 Jan 2007 17:13:07 -0800 Subject: [flexi-streams-devel] simple bug in in-memory-streams, affects hunchentoot. fix included Message-ID: <45A58F23.8040704@gmail.com> Hi, I have been quietly using Hunchentoot for a while. when I asdf-installed the latest version of it, I got an error that traced down the latest flexi-streams. make-in-memory-input-stream was changed to use keyword arguments instead of optional arguments, which broke the macro with-input-from-sequence. Here is a fixed version: (defmacro with-input-from-sequence ((var sequence &key start end transformer) &body body) "Creates an IN-MEMORY input stream from SEQUENCE using the parameters START and END, binds VAR to this stream and then executes the code in BODY. A function TRANSFORMER may optionally be specified to transform the returned octets. The stream is automatically closed on exit from WITH-INPUT-FROM-SEQUENCE, no matter whether the exit is normal or abnormal. The return value of this macro is the return value of BODY." (with-rebinding (sequence) `(let (,var) (unwind-protect (progn (setq ,var (make-in-memory-input-stream ,sequence :start (or ,start 0) :end (or ,end (length ,sequence)) :transformer ,transformer)) , at body) (when ,var (close ,var)))))) I didn't see anything else affected. i've also attached a diff thanks, red daly -------------- next part -------------- A non-text attachment was scrubbed... Name: flexi-in-memory-bug.diff Type: text/x-patch Size: 502 bytes Desc: not available URL: From edi at agharta.de Thu Jan 11 07:28:28 2007 From: edi at agharta.de (Edi Weitz) Date: Thu, 11 Jan 2007 08:28:28 +0100 Subject: [flexi-streams-devel] New release 0.10.1 (Was: simple bug in in-memory-streams, affects hunchentoot. fix included) In-Reply-To: <45A58F23.8040704@gmail.com> (Red Daly's message of "Wed, 10 Jan 2007 17:13:07 -0800") References: <45A58F23.8040704@gmail.com> Message-ID: On Wed, 10 Jan 2007 17:13:07 -0800, Red Daly wrote: > make-in-memory-input-stream was changed to use keyword arguments > instead of optional arguments, which broke the macro > with-input-from-sequence. Ugh, yeah, sorry - my bad. Fixed now. Thanks a lot, Edi. From edi at agharta.de Thu Jan 11 23:42:33 2007 From: edi at agharta.de (Edi Weitz) Date: Fri, 12 Jan 2007 00:42:33 +0100 Subject: [flexi-streams-devel] New release 0.10.2 In-Reply-To: (Edi Weitz's message of "Thu, 11 Jan 2007 08:28:28 +0100") References: <45A58F23.8040704@gmail.com> Message-ID: Sorry, had to fix another bug I made... :( http://weitz.de/files/flexi-streams.tar.gz