diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index ab2d2f5336..019ca26adc 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,9 +1,5 @@ -- make-frame should compile - - httpd search tools -[2:45pm] tathi: Factor's text display is a bit odd sometimes, until you mouse over (or click, if there's no "live" text) -[2:48pm] tathi: it appears to be using the font metrics from the sprite tuple, but re-using the texture from the previous letter -[2:59pm] tathi: hmm...and it looks like it's only be happening the first time you use a given character (from a given font face) +- remaining HTML issues need fixing + io: @@ -16,7 +12,11 @@ + ui: -- why aren't some words compiled? +[2:45pm] tathi: Factor's text display is a bit odd sometimes, until you mouse over (or click, if there's no "live" text) +[2:48pm] tathi: it appears to be using the font metrics from the sprite tuple, but re-using the texture from the previous letter +[2:59pm] tathi: hmm...and it looks like it's only be happening the first time you use a given character (from a given font face) +- make-frame should compile +- why aren't some cocoa words compiled? - editor: - delegation issue with fields and interactors - multi-line inserts @@ -45,8 +45,6 @@ - 'show' doesn't work if invoked from a listener on an object which is itself inspected in the listener - ui uses too much cpu time idling -- too many motion events, etc -- remaining HTML issues need fixing - see if its possible to only repaint dirty regions - x11 title bars are funny - fix top level window positioning diff --git a/doc/handbook/cookbook.facts b/doc/handbook/cookbook.facts index 0bdcfde86b..fda051367e 100644 --- a/doc/handbook/cookbook.facts +++ b/doc/handbook/cookbook.facts @@ -207,7 +207,7 @@ ARTICLE: "cookbook-io" "I/O cookbook" } "Send some bytes to a remote host:" { $code - "\"myhost\" 1033 [ { 12 17 102 } write ] with-stream" + "\"myhost\" 1033 [ { 12 17 102 } write ] with-stream" } { $references { } diff --git a/library/collections/hashtables.factor b/library/collections/hashtables.factor index aad7f82601..cbc385638f 100644 --- a/library/collections/hashtables.factor +++ b/library/collections/hashtables.factor @@ -15,12 +15,16 @@ TUPLE: tombstone ; : probe ( keys i -- hash i ) 2 + over length mod ; inline : (key@) ( key keys i -- n ) - 3dup swap nth-unsafe { - { [ dup ((tombstone)) eq? ] [ 2drop probe (key@) ] } - { [ dup ((empty)) eq? ] [ 2drop 3drop -1 ] } - { [ = ] [ 2nip ] } - { [ t ] [ probe (key@) ] } - } cond ; + #! cond form expanded by hand for better interpreter speed + 3dup swap nth-unsafe dup ((tombstone)) eq? [ + 2drop probe (key@) + ] [ + dup ((empty)) eq? [ + 2drop 3drop -1 + ] [ + = [ 2nip ] [ probe (key@) ] if + ] if + ] if ; inline : key@ ( key hash -- n ) hash-array 2dup hash@ (key@) ; inline @@ -38,11 +42,16 @@ TUPLE: tombstone ; swap over set-hash-array init-hash ; : (new-key@) ( key keys i -- n ) - 3dup swap nth-unsafe { - { [ dup ((empty)) eq? ] [ 2drop 2nip ] } - { [ = ] [ 2nip ] } - { [ t ] [ probe (new-key@) ] } - } cond ; inline + #! cond form expanded by hand for better interpreter speed + 3dup swap nth-unsafe dup ((empty)) eq? [ + 2drop 2nip + ] [ + = [ + 2nip + ] [ + probe (new-key@) + ] if + ] if ; inline : new-key@ ( key hash -- n ) hash-array 2dup hash@ (new-key@) ; inline @@ -241,8 +250,27 @@ M: hashtable hashcode ( hash -- n ) : ?hash* ( key hash/f -- value/f ) dup [ hash* ] [ 2drop f f ] if ; +IN: hashtables-internals + +: (hash-stack) ( key i seq -- value ) + over 0 < [ + 3drop f + ] [ + 3dup nth-unsafe dup [ + hash* [ + >r 3drop r> + ] [ + drop >r 1- r> (hash-stack) + ] if + ] [ + 2drop >r 1- r> (hash-stack) + ] if + ] if ; + +IN: hashtables + : hash-stack ( key seq -- value ) - [ dupd hash-member? ] find-last nip ?hash ; + dup length 1- swap (hash-stack) ; : hash-intersect ( hash1 hash2 -- hash1/\hash2 ) [ drop swap hash ] hash-subset-with ; diff --git a/library/compiler/inference/branches.factor b/library/compiler/inference/branches.factor index 72f99c25be..f3a570604f 100644 --- a/library/compiler/inference/branches.factor +++ b/library/compiler/inference/branches.factor @@ -4,6 +4,10 @@ IN: inference USING: arrays errors generic hashtables interpreter kernel math namespaces parser prettyprint sequences strings vectors words ; +: add-inputs ( n stack -- stack ) + tuck length - dup 0 > + [ value-vector dup rot nappend ] [ drop ] if ; + : unify-lengths ( seq -- seq ) #! Pad all vectors to the same length. If one vector is #! shorter, pad it with unknown results at the bottom. diff --git a/library/compiler/inference/dataflow.factor b/library/compiler/inference/dataflow.factor index 9747528793..26584cbf3d 100644 --- a/library/compiler/inference/dataflow.factor +++ b/library/compiler/inference/dataflow.factor @@ -33,8 +33,11 @@ M: node = eq? ; : out-node ( outputs) >r f { } r> { } { } ; : meta-d-node meta-d get clone in-node ; -: d-tail ( n -- list ) meta-d get tail* ; -: r-tail ( n -- list ) meta-r get tail* ; +: d-tail ( n -- list ) + dup zero? [ drop f ] [ meta-d get tail* ] if ; + +: r-tail ( n -- list ) + dup zero? [ drop f ] [ meta-r get tail* ] if ; : node-child node-children first ; diff --git a/library/compiler/inference/inference.factor b/library/compiler/inference/inference.factor index 89b5b41f31..0d7bb1414e 100644 --- a/library/compiler/inference/inference.factor +++ b/library/compiler/inference/inference.factor @@ -48,13 +48,13 @@ SYMBOL: d-in : value-vector ( n -- vector ) [ drop ] map >vector ; -: add-inputs ( n stack -- stack ) - tuck length - dup 0 > - [ value-vector swap append ] [ drop ] if ; - : ensure-values ( n -- ) - dup meta-d get length [-] d-in [ + ] change - meta-d [ add-inputs ] change ; + meta-d get length 2dup > [ + - dup d-in [ + ] change + value-vector meta-d [ dupd nappend ] change + ] [ + 2drop + ] if ; : effect ( -- { in# out# } ) #! After inference is finished, collect information. diff --git a/library/compiler/inference/words.factor b/library/compiler/inference/words.factor index 484fee55d8..d9f14e79a3 100644 --- a/library/compiler/inference/words.factor +++ b/library/compiler/inference/words.factor @@ -7,10 +7,12 @@ IN: inference : consume-values ( n node -- ) over ensure-values - over 0 rot node-inputs [ pop-d 2drop ] each ; + over 0 rot node-inputs + meta-d get [ length swap - ] keep set-length ; : produce-values ( n node -- ) - over [ drop push-d ] each 0 swap node-outputs ; + >r [ drop ] map dup r> set-node-out-d + meta-d get swap nappend ; : consume/produce ( word effect -- ) #! Add a node to the dataflow graph that consumes and diff --git a/library/ui/text/editor.factor b/library/ui/text/editor.factor index 86253ce607..40626bbd2e 100644 --- a/library/ui/text/editor.factor +++ b/library/ui/text/editor.factor @@ -3,7 +3,7 @@ IN: gadgets-text USING: arrays errors freetype gadgets gadgets-borders gadgets-buttons gadgets-frames gadgets-labels gadgets-scrolling -io kernel math models namespaces opengl sequences +gadgets-theme io kernel math models namespaces opengl sequences strings styles ; TUPLE: editor