Doug Coleman
c3dcf43e03
core/basis: trim down using lists
2011-11-30 23:15:42 -08:00
Joe Groff
b50ffc6da0
io: implement stream protocols on f
...
Fixes deployed applications that write to output-stream
2011-11-28 20:36:34 -08:00
Joe Groff
0617838fb9
io: clean up some mess
2011-11-09 19:11:04 -08:00
Joe Groff
f5bdff14f6
io: fix each-block-slice typo
2011-11-09 18:06:58 -08:00
Joe Groff
53d027928c
io: more hot-rodding for #376
...
* Change the interface of read-into to return a slice and an eof boolean separately so the compiler can optimize the slice.
* Add an each-stream-block-slice combinator that behaves like each-block but reuses a preallocated buffer for every iteration.
* Pull some strings in the stream-read-into implementation to further improve type propagation and bounds check elimination.
2011-11-09 17:22:01 -08:00
Joe Groff
1de810f416
io:read: don't resize output buffer if unnecessary
...
Even with a short-circuit test in the VM primitives, resize still has an overly high runtime cost in tight loops. For #376 .
2011-11-09 14:29:12 -08:00
Doug Coleman
2a6c59a305
Add with-error>output word and test
2011-10-19 00:56:11 -07:00
Joe Groff
b230b306f5
io: input-stream and output-stream mixins
2011-10-18 16:25:09 -07:00
Joe Groff
8ae554ef6e
io: error stream combinators
...
* with-error-stream(*)
* with-output+error-stream(*) -- sets output and error stream to same stream
* with-output>error -- sets output stream to error stream for scope
* with-input-output+error-streams(*) -- like with-streams, but sets output and error to same stream
2011-10-18 15:13:33 -07:00
Joe Groff
35a5bdabc3
formatting
2011-10-17 21:23:36 -07:00
Joe Groff
a73dc7b4b5
io: remove higher-order stack effects
...
More stack checker breakage
2011-10-17 21:23:10 -07:00
Joe Groff
10bcb933db
io: document new words
2011-10-17 21:23:09 -07:00
Joe Groff
21e2fdc25c
io: stream-read-into and stream-read-partial-into
...
Safe user-facing wrappers for stream-read-unsafe.
2011-10-17 21:23:08 -07:00
Joe Groff
372f7c6614
io: stream-contents, -seekable?, -length generics
...
stream-contents is extremely slow on decoder streams when implemented with each-block, and it can be implemented very quickly for streams of known length using stream-read-unsafe. Make it generic and provide some off-the-shelf implementations using each-block, a read1 loop, or length + read-unsafe. Provide new stream-seekable? and stream-length generics that can be implemented by stream implementations that know their size.
2011-10-17 21:23:07 -07:00
Joe Groff
c4d9599a00
io: get variables out of stream-copy loop
2011-10-17 21:23:07 -07:00
Joe Groff
2e1f72697f
io: default methods for extended stream protocols
...
Provide default implementations of all the input-stream methods in terms of stream-read1 and of all the output-stream methods in terms of stream-write1.
2011-10-17 21:23:06 -07:00
Joe Groff
28af1529bc
io: add read-unsafe and read-partial-unsafe words
...
Add shortcut words to operate on the input-stream like the other stream methods have. Make all those words inline too just for fun.
2011-10-17 21:23:05 -07:00
Joe Groff
1e37b525a3
kill noncopying-reader mixin, stream-read generic
...
Now that all streams have been updated to implement the stream-read-unsafe protocol, take out the noncopying-reader shim. Turn stream-read and stream-read-partial into plain functions over the -unsafe generics.
2011-10-17 21:23:05 -07:00
Joe Groff
e2e9ce991d
io: remove each-block* because it's not useful
2011-10-17 21:23:03 -07:00
Joe Groff
b3d7c1575d
io: tweak each-block* to be byte- or char-agnostic
2011-10-17 21:23:02 -07:00
Joe Groff
cb0f50029a
io: nab io.streams.peek's stream-exemplar-growable
...
Rename stream-element-examplar to stream-exemplar to match.
2011-10-17 21:23:01 -07:00
Joe Groff
65b3984490
io: non-copying each-block and contents variants
...
each-(stream-)block* is like each-block but takes a buffer object and reads into it repeatedly. (stream-)contents* determines the stream length then does a single stream-read-unsafe into a preallocated buffers. Both functions currently only work for byte-arrays (and contents* only for seekable streams), so they can't replace the non-starred versions completely just yet.
2011-10-17 21:23:00 -07:00
Joe Groff
db68af8df5
io, io.streams.c: factor noncopying-reader mixin
...
Instances of the mixin implement stream-read and stream-read-partial in terms of stream-read-unsafe and stream-read-partial-unsafe, respectively.
2011-10-17 21:22:58 -07:00
Joe Groff
d8f5004776
io: non-copying binary stream read generics
...
Add generics stream-read-unsafe and stream-read-partial-unsafe, which take a buffer pointer and return a count of bytes read instead of returning a freshly allocated byte array.
2011-10-17 21:22:57 -07:00
John Benediktsson
25438d721b
io: improve stack effects.
2011-03-25 18:30:52 -07:00
John Benediktsson
c326a0d771
io: implement "stream-contents" in terms of "each-stream-block".
2011-03-25 13:58:16 -07:00
John Benediktsson
a52adf7160
io: improve signature of each-block and each-line.
2011-03-25 12:20:51 -07:00
Slava Pestov
d865b366dd
Remove stream-peek and stream-peek1, re-implement dns vocab to not need this abstraction
2010-10-08 18:55:13 -07:00
Doug Coleman
1c344420ce
Implement and document stream-peek
2010-10-08 06:34:19 -07:00
Doug Coleman
a5c1cc33be
Add stream-peek1 and remove it from images.gif and dns. Add sequence-peek but not stream-peek (yet?)
2010-10-08 06:34:17 -07:00
Slava Pestov
a2eb56d399
io: fix with-streams to dispose the output stream first, move (stream-seek) word to io.streams.sequence where it belongs
2010-09-12 22:07:23 -07:00
Doug Coleman
fbe868289c
Fix with-streams: if the first dispose throws an error, the second dispose never gets called
2010-09-12 00:26:14 -05:00
Doug Coleman
ce0d76a580
Clean up vocabulary list, remove unused/poorly-named word from io
2010-07-09 13:32:09 -05:00
Slava Pestov
d2d466de29
Language change: tuple slot setter words with stack effect ( value object -- ) are now named FOO<< instead of (>>FOO)
2010-05-06 17:21:02 -04:00
Joe Groff
906a86ae2d
mop up compiler errors from macosx load-all
2010-03-09 00:56:07 -08:00
Slava Pestov
c1e7a3ffc2
Specialized arrays, structs and other objects responding to the >c-ptr / byte-length protocol can now be written to binary streams
2010-02-24 20:18:41 +13:00
Doug Coleman
8ae200d419
Rename accumulator to collector, pusher to selector
2010-01-22 15:00:53 -06:00
Doug Coleman
76261256da
triyng to rice crc32 a bit
2009-12-13 02:03:06 -06:00
Joe Groff
01c0b93c97
swap around io combinators to avoid a bunch of redundant "input-stream get"s in each-line, each-block, contents, etc.
2009-10-23 00:07:19 -05:00
Doug Coleman
9a777b0969
support limited-streams correctly for seekable streams
2009-10-03 18:27:09 -05:00
Slava Pestov
cd64833360
clean up contents and lines words; contents never outputs f now
2009-05-10 16:39:51 -05:00
Doug Coleman
4cef8ff880
rename lines to stream-lines
...
rename cnotents to stream-contents
2009-05-01 10:41:27 -05:00
Slava Pestov
07a5a46009
Add stream-element-type generic word
2009-03-15 17:11:18 -05:00
Slava Pestov
cd53c2bd37
produce and produce-as: don't need third quotation either
2009-02-28 15:31:34 -06:00
Samuel Tardieu
087d931c36
Remove the tail argument from do/until/while
2009-02-18 02:41:14 +01:00
Doug Coleman
2820b9fc99
better error handling on unix seek, unit tests
2009-02-07 11:23:00 -06:00
Doug Coleman
bc0521f88a
make seeking support the full lseek options, add seeking on output ports, remove seeking from decoders..
2009-02-07 10:30:51 -06:00
Doug Coleman
f6f716c4e3
unix support for stream seeking
2009-02-07 01:03:12 -06:00
Slava Pestov
c7c37f5f5c
Update I/O docs to talk about elements instead of characters, and add each-block combinator which generalizes contents just like each-line generalizes lines
2009-01-22 19:08:20 -06:00
Slava Pestov
4204fd495f
Move formatted stream output words to io.styles; they didn't belong in core, and this reduces deployed image size
2009-01-13 17:12:43 -06:00