Joe Groff
225d10b4dd
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
1c85631611
io: get variables out of stream-copy loop
2011-10-17 21:23:07 -07:00
Joe Groff
09f55f82fa
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
805b0372da
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
aaec2eb1ac
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
6f12322bda
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
d2855bbf09
io: remove each-block* because it's not useful
2011-10-17 21:23:03 -07:00
Joe Groff
5e2d95ebb2
io.encodings: decoders can't really seek or tell
2011-10-17 21:23:03 -07:00
Joe Groff
73b6648b0e
io.encodings: re-encrypt into stack-ese for core
2011-10-17 21:23:03 -07:00
Joe Groff
008ef0afd7
io.encodings: read-unsafe for decoders†
...
† currently uses locals, so not bootstrappable
2011-10-17 21:23:02 -07:00
Joe Groff
ffacdaf0da
io.encodings: encoded/decoded length hints
...
Add guess-encoded-length and guess-decoded-length generics that encodings can implement to provide hints as to how large the translation product will be, for sizing vectors and things like that.
2011-10-17 21:23:02 -07:00
Joe Groff
9082d05582
io: tweak each-block* to be byte- or char-agnostic
2011-10-17 21:23:02 -07:00
Joe Groff
d54824cb40
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
8261c941c2
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
b79d7158be
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
d5f4b6f155
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
66bb07bbcf
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
2518f1c0e9
io.streams.c: Document fputc primitive
2011-10-17 21:22:58 -07:00
Joe Groff
5a072c57a6
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
Joe Groff
ef8a179f34
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
Doug Coleman
f21fee3b73
Rename complete-effect to scan-effect
2011-10-17 10:25:27 -07:00
John Benediktsson
81714b8dc3
More lint cleanups.
2011-10-16 19:33:16 -07:00
John Benediktsson
c8732657b7
Cleanup more lint warnings.
2011-10-16 13:01:58 -07:00
John Benediktsson
6f1c44b46d
Cleanup some lint warnings.
2011-10-15 19:19:44 -07:00
Joe Groff
9894a6ade5
continuations: document full effect of cleanup
...
We can't yet apply the effect because of #138 but we can at least document it.
2011-10-14 14:45:21 -07:00
John Benediktsson
d61de12011
Cleanup more lint warnings.
2011-10-14 12:31:46 -07:00
John Benediktsson
378786599d
Cleanup lint warnings.
2011-10-14 11:47:24 -07:00
Joe Groff
f8ec85fd06
kernel: higher-order effects for *keep
2011-10-14 10:45:02 -07:00
John Benediktsson
312704ae68
math.parser: cleanup uses of 16/8/2 >base/base>.
2011-10-14 10:09:12 -07:00
John Benediktsson
6417f36397
namespaces: adding a "with-global" word to replace "global [ ] bind".
2011-10-13 17:21:59 -07:00
John Benediktsson
7a36e50c6a
generic.parser: adding tests.
2011-10-13 16:49:54 -07:00
John Benediktsson
4558bf3414
Change method parsing to validate stack effects. Fixes #236 .
2011-10-13 16:41:17 -07:00
John Benediktsson
1987deb359
Fix M: stack effects.
2011-10-13 16:41:17 -07:00
Doug Coleman
ba7a005e88
Link ?first ?second ?last from an article.
2011-10-13 15:53:31 -07:00
John Benediktsson
4baf14972f
sequences: adding ?last for symmetry.
2011-10-13 13:04:24 -07:00
John Benediktsson
3207244c60
sequences: define ?first and ?second.
2011-10-13 12:53:46 -07:00
John Benediktsson
0075b6bc28
sequences: adding find-index.
2011-10-12 19:41:54 -07:00
John Benediktsson
afc07c0e05
io.binary: make le> and be> faster (20% and 75%, respectively).
...
Removed primitive byte-array>bignum and digit_stream_to_bignum from vm/.
2011-10-11 21:13:30 -07:00
Doug Coleman
cca76e0f6e
Rename forget-struct-slot-accessors -> forget-slot-accessors
2011-10-06 13:21:18 -07:00
John Benediktsson
7a4ffd92ed
classes.tuple: can't assume hashcode* returns fixnum.
2011-10-06 11:53:50 -07:00
John Benediktsson
3e20365cbe
Revert "sequences: change to use tuple-hashcode algorithm, make string-hashcode work like old sequence-hashcode."
...
This reverts commit 7b7b0d4542
.
2011-10-06 08:37:05 -07:00
John Benediktsson
7b76c26bc0
sequences: change to use tuple-hashcode algorithm, make string-hashcode work like old sequence-hashcode.
2011-10-05 19:22:50 -07:00
Doug Coleman
be3eebf719
Document reset-class, forget-class, forget-method. Use lookup-method in see, fix gpu.render for method->lookup-method renaming. Fixes #232 .
2011-10-04 10:40:48 -07:00
John Benediktsson
fec4cf9109
io.encodings.utf8: assume streams are largely ascii.
...
Results in 30% faster file-contents for test file and 7% faster benchmark.xml.
2011-10-03 21:49:21 -07:00
Doug Coleman
bf8bf46d16
Update docs for lookup-method.
2011-10-03 15:55:53 -07:00
Doug Coleman
181f11faa8
Make M\ throw an error upon lookup failure. Change method -> ?lookup-method, lookup-method is the throwing version of ?lookup-method. Fixes #229 .
2011-10-03 15:49:49 -07:00
Slava Pestov
dabbe35bd9
concurrency.mailboxes: linked-thread's error reporting should still work even when debugger.threads is not loaded. This addresses part of #95
2011-10-03 00:24:37 -07:00
Slava Pestov
daf40ea0c6
Fix infinite loop and empty-dlist error when an error is thrown from a callback running in a thread other than the initial thread. This addresses part of issue #92
2011-10-02 21:59:09 -07:00
John Benediktsson
baceee8c50
hashtables: moving hash-combine to hashtables.
2011-10-02 20:29:49 -07:00
Doug Coleman
8504b17aad
Rename spread>quot to deep-spread>quot, and spread>quot-shallow to shallow-spread>quot.
2011-10-02 20:25:39 -07:00
Doug Coleman
447466bf45
Clean up a parser docs as per suggestions.
2011-10-02 20:08:23 -07:00
John Benediktsson
83b11b401f
words: since word names can be tuples (i'm looking at you smalltalk), use a combining hash function inspired by boost::hash_combine.
2011-10-02 18:46:49 -07:00
Doug Coleman
38feae0e8f
Spread now infers with the correct stack effect. Make spread>quot-shallow which trims empty quotations off the head of the spread sequence. Fixes #139 .
2011-10-02 18:35:01 -07:00
John Benediktsson
3b72b641e0
Fix help-lint errors for recent hashtable changes.
2011-10-02 17:49:11 -07:00
John Benediktsson
195d5834d4
classes.tuple: switch to python's tuplehash(). Fixes #153 .
2011-10-02 13:49:45 -07:00
John Benediktsson
4ad888b530
hashtables: switch to quadratic probing.
2011-10-02 13:49:45 -07:00
John Benediktsson
98e7793799
words: prevent zero hashcodes. Fixes #222 .
2011-10-02 13:49:45 -07:00
Doug Coleman
671f19d70f
Remove all non-core uses of (scan-token)
...
Add scan-datum
Add scan-number
Document more words
Fixes #225 .
2011-10-02 12:00:08 -07:00
John Benediktsson
2a234bec02
effects: removing split-shuffle.
2011-10-02 09:26:40 -07:00
John Benediktsson
0fb43fb864
sequences: removing 2unclip-slice.
2011-10-02 09:26:20 -07:00
Doug Coleman
76580da5d5
Refactor the lexer/parser to expose friendlier words for scanning tokens. The preferred top-level words now throw an exception on EOF.
...
CREATE -> scan-new
CREATE-CLASS -> scan-new-class
CREATE-WORD -> scan-new-word
CREATE-GENERIC -> scan-new-generic
scan -> (scan-token)
scan-token now throws on eof
(scan-word) returns word/number/f
scan-word now throws on eof
scan-word-name expects a non-number
Fixes #183 .
Fixes #209 .
2011-09-29 11:28:28 -07:00
John Benediktsson
86923107db
classes.tuple: error-class should call-next-method before resetting itself.
2011-09-26 11:54:55 -07:00
John Benediktsson
4f42c72012
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
John Benediktsson
be68b9d539
assocs: improve stack effect docs for "?at".
2011-09-26 11:32:20 -07:00
John Benediktsson
f099cd5b4c
classes.tuple: adding test cases for error-class and support forget-class.
2011-09-26 11:00:32 -07:00
John Benediktsson
7ef1aecf88
Defining an "error-class", and printing error tuples out with ERROR:. See #188 .
2011-09-26 11:00:32 -07:00
Doug Coleman
82a28a082b
Remove extraneous using from math/
2011-09-25 19:32:35 -07:00
John Benediktsson
605c2b265e
vocabs: adding docs for 'parent-vocab?' and 'parent-vocabs'.
2011-09-25 18:36:20 -07:00
John Benediktsson
46df742317
vocabs: adding 'parent-vocab?' and 'parent-vocabs'.
2011-09-25 18:32:03 -07:00
John Benediktsson
a916bebcfe
Fixing docs for recent stack effects additions.
2011-09-24 22:08:54 -07:00
John Benediktsson
f6ee4c5a55
math.order: Removing stack effect (not quite right).
2011-09-23 17:46:49 -07:00
John Benediktsson
3c1356bf69
Adding stack effects.
2011-09-23 17:46:40 -07:00
Doug Coleman
c96289ef62
Fix sequences docs for change-nth stack effect and example needed using section
2011-09-21 10:09:03 -05:00
John Benediktsson
a002b7aa5f
sequences: adding stack effects for change-nth, map-integers, and interleave.
2011-09-19 20:49:57 -07:00
John Benediktsson
d142dbb456
Revert "classes.singleton: fix "summary" of singletons. Fixes #145."
...
This reverts commit d820c86974
.
2011-09-19 17:46:52 -07:00
John Benediktsson
ac75393fbd
Revert "classes.mixin: fix definitions for MIXIN:."
...
This reverts commit f625612f89
.
2011-09-19 17:46:40 -07:00
John Benediktsson
8827cbdba1
classes.mixin: fix definitions for MIXIN:.
2011-09-19 17:22:50 -07:00
John Benediktsson
46c417370f
classes.singleton: fix "summary" of singletons. Fixes #145 .
2011-09-19 16:49:11 -07:00
Joe Groff
2bd6de9a02
slots: pre-create the "at", "nth", and "global" slots to make deterministic the currently nondeterministic ambiguity between accessors:change-* and assocs:change-at, sequences:change-nth, and namespaces:change-global
2011-09-19 10:03:43 -07:00
Doug Coleman
f6bdebb36b
Revert "spread>quot now outputs empty quotations where you would expect so that things like { [ ] [ ] } spread infer as ( x x -- x x ) instead of ( -- )"
...
This causes problems in bootstrap and in make-images. Revisit sometime in the future...
This reverts commit 004b20df12
.
2011-09-18 23:41:49 -05:00
Doug Coleman
15f44a7276
spread>quot now outputs empty quotations where you would expect so that things like { [ ] [ ] } spread infer as ( x x -- x x ) instead of ( -- )
...
Fixes #139
2011-09-18 23:23:53 -05:00
Doug Coleman
bf2a96e9e0
Remove Windows CE from core/ basis/ and build-support/
...
Rename the winnt singleton to windows in core/ basis/ extra/
Rename boot images winnt -> windows
Fixes #84 .
2011-09-18 23:19:06 -05:00
John Benediktsson
e8dad98240
sets: update docs for "combine".
2011-09-17 08:14:14 -07:00
John Benediktsson
842327f3df
lexer: more clear code.
2011-09-17 08:14:13 -07:00
John Benediktsson
c77611f07b
assocs: adding tests for "assoc-stack".
2011-09-17 08:14:13 -07:00
Joe Groff
8e36e0221d
words: move change-word-prop from delegate.private to words
2011-09-15 15:55:54 -07:00
Joe Groff
a5788c4205
alien.strings: handle symbol arrays in symbol>string
2011-09-13 15:10:48 -07:00
Doug Coleman
7e6d031cc8
Fix string docs.
2011-09-13 15:45:56 -05:00
Slava Pestov
7c3827190b
Tease out symbol name and library in undefined_symbol() handler, for friendlier errors when calling an unresolved C function name. Fixes #93
2011-09-12 00:56:24 -07:00
Doug Coleman
1b20b0c476
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
Doug Coleman
035cc310d9
Fix for parser-notes? being removed
2011-09-07 04:59:35 -05:00
Doug Coleman
5fce2d0f27
Make "quiet" true by default. Disable quiet mode for listener, bootstrap, and deploy tool.
...
Move "quiet" to parser-quiet? in parser.notes. Change a few places where quiet was handle wrong.
2011-09-06 17:58:12 -07:00
John Benediktsson
29f6011817
hash-sets: remove unused import.
2011-09-06 11:26:29 -07:00
Slava Pestov
9c29511eb4
Add test case to memory-tests.factor for recent large object allocation bug
2011-09-05 16:47:32 -07:00
Slava Pestov
ed9cf9e4fd
Move some primitives from memory and memory.private to tools.memory.private, add data-heap and code-heap words that wrap the struct for you
2011-09-05 16:47:29 -07:00
John Benediktsson
e8aa41ae57
hash-sets: simpler <hash-set>.
2011-09-03 16:38:42 -07:00
John Benediktsson
21c30b37ee
sets: adding test for cardinality of arrays.
2011-09-03 16:34:33 -07:00
John Benediktsson
f2aa8ec876
hash-sets: initialize hashtable capacity to length of sequence.
2011-09-03 14:46:26 -07:00
John Benediktsson
c99e6d79cd
math: fix docs for 'when-zero'.
2011-09-02 21:13:29 -07:00
John Benediktsson
e2cca82fca
sets: fix cardinality of sequences, and speed up subset?.
2011-08-27 20:20:56 -07:00