Commit Graph

137 Commits (080e44aac642f2b13d23d400ceaa015b8c142c05)

Author SHA1 Message Date
John Benediktsson e292492653 io.streams.sequence: faster stream-read-until. 2012-07-11 18:26:41 -07:00
John Benediktsson ab2c150363 io.streams.memory: adding with-memory-reader. 2012-06-18 17:24:21 -07:00
Joe Groff eee483654a use radix literals 2011-11-23 19:03:40 -08:00
Joe Groff ce6669d87d io.files: add file-reader, file-writer mixins
This lets us do some trickery so that the stream-element-type propagates from <file-reader>/<file-writer>. For #376.
2011-11-09 14:43:39 -08:00
Joe Groff 8aebe4677b constants for special object hardcoded literals 2011-11-02 12:54:50 -07:00
Joe Groff cb6f175ef8 vm: dispatch signal handlers through subprimitive
We also need to save C ABI volatile registers before calling the signal handler in order to be able to reliably resume. Add signal-handler and leaf-signal-handler subprimitives to preserve volatile registers before invoking the signal handler C function.
2011-10-27 21:18:18 -07:00
John Benediktsson a13676f3b6 Remove stack effects from HELP: declarations. 2011-10-20 19:36:11 -07:00
Joe Groff b230b306f5 io: input-stream and output-stream mixins 2011-10-18 16:25:09 -07:00
Joe Groff 7adce45340 io.streams.sequence: missed a USING: 2011-10-17 21:23:10 -07:00
Joe Groff 7b4e62b87f io.streams.c: remove -seek and -tell methods
M: c-stream stream-seek was broken and bootstrap doesn't need it so save some code.
2011-10-17 21:23:10 -07:00
Joe Groff d35c67dde4 more stream-seekable? and stream-length methods
- limited-streams and throw-on-eof-streams
- string-readers and byte-readers
2011-10-17 21:23:09 -07:00
Joe Groff 0c225d1e8d io.streams.c: help-lint 2011-10-17 21:23:08 -07:00
Joe Groff 7cf22250ce clean up forwarding stream-read-partial-unsafe
Now that "io" provides a method on object for stream-read-partial-unsafe that forwards to stream-read-unsafe, individual stream class that don't implement partial reads don't need to provide such a method themselves.
2011-10-17 21:23:06 -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 f6b54c50cc io.streams.memory: implement stream-read-unsafe
(The actual method is in alien.data due to bootstrap load order issues.)
2011-10-17 21:22:59 -07:00
Joe Groff 9737ca956f io.streams.sequence: change to provide read-unsafe
Change io.streams.sequence and its children io.streams.byte-array and io.streams.string to implement the -unsafe protocol and mixin noncopying-reader.
2011-10-17 21:22:59 -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 0497bbb365 io.streams.c: Document fputc primitive 2011-10-17 21:22:58 -07:00
Joe Groff 3bd23a9840 bootstrap, io.streams.c: use new fread primitive
Change the fread primitive to fread-unsafe, matching the new primitive in the VM, and update the implementation of c-reader to implement stream-read-unsafe and stream-read in terms of fread-unsafe
2011-10-17 21:22:58 -07:00
John Benediktsson 0e3d598e69 specialized-arrays: performed some cleanup.
Specifically,
    •   Created >c-array to be replacement for >T-array.
    •   Created cast-array to be generic replacement for all T-array-cast words.
    •   Created c-array@ to be generic replacement for T-array@ words.
    •   Replaced usages of <T-array> with T <c-array>
    •   Replaced usages of <direct-T-array> with T <c-direct-array>
    •   Replaced usages of >T-array with T >c-array
    •   Replaced usages of T-array-cast with T cast-array
    •   Replaced usages of malloc-T-array with T malloc-array.
    •   Removed malloc-T-array.
    •   Removed T-array-cast.
    •   Removed T-array@.
    •   Removed >T-array.

I also added (but didn't change any code to use):
    •   T c-array-type, returns T-array
    •   T c-array?, returns T-array?
    •   c-array{ T ... }, returns T-array{ ... }

Bootstraps just find on Mac OS X.  Also `load-all test-all` works for me.
2011-09-26 11:37:51 -07:00
Doug Coleman 41eb5cae4b Make sure 0 read always returns f. Fixes issue #70.
More unit tests, fix read-until to return f f sometimes
Rename ((read-until)) to read-until-loop. Fix the stack effect declarations of (read) and handle-readln.
2011-09-09 18:51:06 -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
Slava Pestov 776f184ed0 serialize, io.streams.byte-array: fix unit tests for utf8 encoding strictness 2010-08-25 17:51:44 -07:00
Slava Pestov 500882d603 io: missed a few byte-array>int-array in unit tests 2010-05-19 16:22:39 -04:00
Slava Pestov 2dde82ffff Slices over specialized arrays can now be passed to C functions, written to binary output streams, and given to malloc-byte-array 2010-02-25 04:50:31 +13: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
Slava Pestov 790674cf89 Rename kernel.private:getenv/setenv to special-object/set-special-object to mirror recent renaming on the VM side 2010-01-13 18:08:18 +13:00
Slava Pestov 742126cadc threads, io.streams.c: cleanups 2009-12-15 07:20:41 -05:00
Slava Pestov 08b6ebc7fa Factor source files should not be executable 2009-11-21 17:50:43 -06:00
Doug Coleman b5fd809209 memq? -> member-eq?, sorted-memq? -> sorted-member-eq? 2009-10-28 15:02:00 -05:00
Doug Coleman aabaccff5e fix a bunch of typos in docs 2009-10-21 17:40:43 -05:00
Doug Coleman 60145e983e add unit test for c stream-tell 2009-10-03 19:07:16 -05:00
Doug Coleman 9a777b0969 support limited-streams correctly for seekable streams 2009-10-03 18:27:09 -05:00
Keith Lazuka 8f79ea91ba docs: change $subsection to $subsections 2009-10-02 12:15:48 -04:00
Slava Pestov 50641a5059 Disposables are now registered in a global disposables set. To take advantage of this, subclass disposable instead of providing a disposed slot and call new-disposable instead of new. tools.disposables defines two words, 'disposable.' and 'leaks', to help track down resource lifetime problems 2009-08-24 02:26:13 -05:00
Slava Pestov a742145fd9 compiler.tree.modular-arithmetic: >fixnum elimination and value info annotations were too aggressive 2009-08-17 01:20:25 -05:00
Doug Coleman d1ce837569 Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places, minor refactoring 2009-08-13 19:21:44 -05:00
Slava Pestov f2ab6a261a Clean up init-stdio implementations and move io.streams.null to basis 2009-05-12 03:35:48 -05:00
Slava Pestov cd64833360 clean up contents and lines words; contents never outputs f now 2009-05-10 16:39:51 -05:00
Slava Pestov dbd4b8ddb8 Fix test failures 2009-05-04 13:10:56 -05:00
Slava Pestov d991690a47 Merge branch 'master' of git://factorcode.org/git/factor 2009-05-04 05:16:47 -05:00
Slava Pestov 4d438a3edd Remove cruddy string encoding/decoding code from VM 2009-05-02 13:45:38 -05:00
Doug Coleman 4057332535 add a few usages of iota, remove most 1+ and 1- from core 2009-05-01 19:58:24 -05:00
Doug Coleman ed5f913aab fix unit tests that call lines or contents 2009-05-01 16:38:04 -05:00
Slava Pestov 9907bd9fe2 Add fseek primitive so that c-streams can seek. This lets the UI work without native IO 2009-04-03 10:16:25 -05:00
Slava Pestov f97389503f Fix stream-read-until on byte-readers 2009-03-27 19:26:16 -05:00
Slava Pestov 07a5a46009 Add stream-element-type generic word 2009-03-15 17:11:18 -05:00