digitalmars.D - std.stream updates
- Ben Hinkle (21/21) Mar 29 2005 Here are some std.stream updates that I would like to send to Walter. Pl...
- Ben Hinkle (4/4) Mar 29 2005 oops. forgot two things:
- Vathix (6/9) Mar 29 2005 Would be nice if BufferedStream used malloc memory instead of GC memory....
- Ben Hinkle (10/19) Mar 29 2005 Interesting idea. It would need a dtor to free the buffer, too. I'll try...
- Regan Heath (12/21) Mar 29 2005 What about:
- Ben Hinkle (4/18) Mar 29 2005 These would be nice but I think they should be added with dchar support
- Regan Heath (6/27) Mar 30 2005 Oh. Good point.
Here are some std.stream updates that I would like to send to Walter. Please comment if you have concerns: - replace uint buffer lengths with size_t in APIs like read/write etc - add opApply to Stream and InputStream (due to Regan Heath) int opApply(int delegate(inout char[] line) dg) int pApply(int delegate(inout size_t n, inout char[] line) dg) int opApply(int delegate(inout wchar[] line) dg) int opApply(int delegate(inout size_t n, inout wchar[] line) dg) - move readable/writeable/seekable tests from contracts to the body since phobos is compiled in release mode and users can easily try to write to a stream with writeable = false. - return "this" from writef and writefln to allow chaining (eg flush) - fix TArrayStream read/write to check for "eof" and add contracts (Derick Eddington) - make SliceStream preserve the source buffer position and pay attention to isOpen (Derick) - implement available() for more stream types (Derick) - move the initialization of the BOMs to the initializer instead of the module constructor. - make isopen protected (from private) so that subclasses can see it. - more unittest (Derick and Ben)
Mar 29 2005
oops. forgot two things: - copyFrom changes: fix count bug, preserve source position if seekable, and use a fixed-size transfer buffer (Derick and Ben) - SliceStream only preserves source position if seekable.
Mar 29 2005
"Ben Hinkle" <ben.hinkle gmail.com> wrote in news:d2bn8p$1h15$1 digitaldaemon.com:Here are some std.stream updates that I would like to send to Walter. Please comment if you have concerns:Would be nice if BufferedStream used malloc memory instead of GC memory. The buffer is never externally referenced, never contains pointers, and doesn't really need to be preinitialized, so it should speed it up even more.
Mar 29 2005
"Vathix" <vathix dprogramming.com> wrote in message news:Xns96287F045CC5Avathixdprogrammingco 63.105.9.61..."Ben Hinkle" <ben.hinkle gmail.com> wrote in news:d2bn8p$1h15$1 digitaldaemon.com:Interesting idea. It would need a dtor to free the buffer, too. I'll try some performance tests to see if it helps. It might be too small to notice for most cases but if one opens gobs of streams I suppose the buffers would add up. The buffer is also public so one can tell the ctor to not make a buffer (pass 0 for the buffer size) and fill the field yourself. I would rather lean towards keeping things using "new" and request that the GC be smart about allocating byte arrays and strings and other non-pointer-holding arrays from non-scanned memory.Here are some std.stream updates that I would like to send to Walter. Please comment if you have concerns:Would be nice if BufferedStream used malloc memory instead of GC memory. The buffer is never externally referenced, never contains pointers, and doesn't really need to be preinitialized, so it should speed it up even more.
Mar 29 2005
On Tue, 29 Mar 2005 09:04:08 -0500, Ben Hinkle <ben.hinkle gmail.com> wrote:Here are some std.stream updates that I would like to send to Walter. Please comment if you have concerns: - replace uint buffer lengths with size_t in APIs like read/write etc - add opApply to Stream and InputStream (due to Regan Heath) int opApply(int delegate(inout char[] line) dg) int pApply(int delegate(inout size_t n, inout char[] line) dg) int opApply(int delegate(inout wchar[] line) dg) int opApply(int delegate(inout size_t n, inout wchar[] line) dg)What about: int opApply(int delegate(inout dchar[] line) dg) int opApply(int delegate(inout size_t n, inout dchar[] line) dg) int opApply(int delegate(inout char c) dg) int opApply(int delegate(inout size_t n, inout char c) dg) int opApply(int delegate(inout wchar c) dg) int opApply(int delegate(inout size_t n, inout wchar c) dg) int opApply(int delegate(inout dchar c) dg) int opApply(int delegate(inout size_t n, inout dchar c) dg) Regan
Mar 29 2005
These would be nice but I think they should be added with dchar support through all of std.stream. Currently std.stream doesn't read/write dchar[] strings or lines.- add opApply to Stream and InputStream (due to Regan Heath) int opApply(int delegate(inout char[] line) dg) int pApply(int delegate(inout size_t n, inout char[] line) dg) int opApply(int delegate(inout wchar[] line) dg) int opApply(int delegate(inout size_t n, inout wchar[] line) dg)What about: int opApply(int delegate(inout dchar[] line) dg) int opApply(int delegate(inout size_t n, inout dchar[] line) dg)int opApply(int delegate(inout char c) dg) int opApply(int delegate(inout size_t n, inout char c) dg) int opApply(int delegate(inout wchar c) dg) int opApply(int delegate(inout size_t n, inout wchar c) dg) int opApply(int delegate(inout dchar c) dg) int opApply(int delegate(inout size_t n, inout dchar c) dg)Are these for completeness or do you have a practical application in mind?
Mar 29 2005
On Tue, 29 Mar 2005 19:37:20 -0500, Ben Hinkle <ben.hinkle gmail.com> wrote:Oh. Good point.These would be nice but I think they should be added with dchar support through all of std.stream. Currently std.stream doesn't read/write dchar[] strings or lines.- add opApply to Stream and InputStream (due to Regan Heath) int opApply(int delegate(inout char[] line) dg) int pApply(int delegate(inout size_t n, inout char[] line) dg) int opApply(int delegate(inout wchar[] line) dg) int opApply(int delegate(inout size_t n, inout wchar[] line) dg)What about: int opApply(int delegate(inout dchar[] line) dg) int opApply(int delegate(inout size_t n, inout dchar[] line) dg)It seemed to me that if one preferred to foreach over lines. One might also prefer to foreach over chars. Reganint opApply(int delegate(inout char c) dg) int opApply(int delegate(inout size_t n, inout char c) dg) int opApply(int delegate(inout wchar c) dg) int opApply(int delegate(inout size_t n, inout wchar c) dg) int opApply(int delegate(inout dchar c) dg) int opApply(int delegate(inout size_t n, inout dchar c) dg)Are these for completeness or do you have a practical application in mind?
Mar 30 2005