- FUNCTION: not updating crossref correctly\r
-- UI word wrap: sometimes a space appears at the front\r
- need line and paragraph spacing\r
- update HTML stream\r
- help cross-referencing\r
- if cell is rebound, and we allocate c objects, bang\r
- runtime primitives like fopen: check for null input\r
- -with combinators are awkward\r
-- cleanups:\r
- alien/compiler\r
- inference/shuffle\r
- inference-words inline-block\r
- io/buffer - use aliens not integers\r
- alien/malloc - use aliens not integers\r
- ui/line-editor - don't use variables\r
- amd64 to do:\r
- alien calls\r
- port ffi to win64\r
- stream server can hang because of exception handler limitations\r
- better i/o scheduler\r
- if two tasks write to a unix stream, the buffer can overflow\r
-- inference bug\r
-\r
- font problem: http://iarc1.ece.utexas.edu/~erg/font-bug.JPG\r
-\r
- implement 3.3 floor 4.7 ceiling 4.5 truncate\r
\r
ALL TESTS BELOW FAIL ON x86 linux 32bit\r
" was already attempted, and failed" append3
inference-error ;
-TUPLE: rstate label quot base-case? ;
+TUPLE: rstate label base-case? ;
: nest-node ( -- dataflow current )
dataflow-graph get dataflow-graph off
r> current-node set ;
: with-recursive-state ( word label base-case quot -- )
- >r >r over word-def r> <rstate> cons
- recursive-state [ cons ] change r>
+ >r <rstate> cons recursive-state [ cons ] change r>
nest-node 2slip unnest-node ; inline
: inline-block ( word base-case -- node-block variables )
#! control flow by throwing an exception or restoring a
#! continuation.
[
- recursive-state get init-inference over >r inline-block
- nip [ terminated? get effect ] bind r>
+ dup inferring-base-case set
+ recursive-state get init-inference
+ over >r inline-block nip
+ [ terminated? get effect ] bind r>
] with-scope over consume/produce over [ terminate ] when ;
GENERIC: apply-word
#! A primitive with an unknown stack effect.
no-effect ;
+: save-effect ( word terminates effect -- )
+ inferring-base-case get [
+ 3drop
+ ] [
+ >r dupd "terminates" set-word-prop r>
+ "infer-effect" set-word-prop
+ ] if ;
+
M: compound apply-word ( word -- )
#! Infer a compound word's stack effect.
[
- dup dup f infer-compound
- >r "terminates" set-word-prop r>
- "infer-effect" set-word-prop
+ dup f infer-compound save-effect
] [
swap t "no-effect" set-word-prop rethrow
] recover ;