Minor reshufflings as a result of style stack removal

darcs
slava 2006-06-14 06:16:53 +00:00
parent 4c54d0765f
commit 490c8f4835
8 changed files with 44 additions and 24 deletions

View File

@ -5,6 +5,8 @@
+ httpd: + httpd:
- outliners don't work - outliners don't work
- browser responder doesn't work - browser responder doesn't work
- fix remaining HTML stream issues
- update for file style prop becoming presented <file>
- fix this: - fix this:
@ -28,13 +30,10 @@
- constant branch folding - constant branch folding
- cocoa: starting the UI with +foo switches opens them as files - cocoa: starting the UI with +foo switches opens them as files
+ refactor style stack code so that nested styles are handled at a lower-level + refactor style stack code so that nested styles are handled at a lower-level
- with-style & with-stream-style
- in HTML, we can nest div tags, etc - in HTML, we can nest div tags, etc
- fix prettyprinter's highlighting of non-leaves looks bad - prettyprinter's highlighting of non-leaves looks bad
- maybe even go from markup to HTML?
- fix remaining HTML stream issues
- need to present $list in a useful way
- better line spacing in ui and html - related issue - better line spacing in ui and html - related issue
- get rid of style stack
+ fix compiled gc check + fix compiled gc check
- there was a performance hit, investigate - there was a performance hit, investigate

View File

@ -29,15 +29,15 @@ strings styles ;
: <resource-reader> ( path -- stream ) : <resource-reader> ( path -- stream )
resource-path <file-reader> ; resource-path <file-reader> ;
TUPLE: file path ; TUPLE: pathname string ;
: (file.) ( name path -- ) : (file.) ( name path -- )
file associate format ; <pathname> write-object ;
DEFER: directory. DEFER: directory.
: (directory.) ( name path -- ) : (directory.) ( name path -- )
>r "/" append r> dup <file> swap [ directory. ] curry >r "/" append r> dup <pathname> swap [ directory. ] curry
write-outliner terpri ; write-outliner terpri ;
: file. ( dir name -- ) : file. ( dir name -- )

View File

@ -1,10 +1,13 @@
! Copyright (C) 2006 Slava Pestov. ! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
IN: io IN: io
USING: generic hashtables kernel namespaces strings ; USING: arrays generic hashtables kernel namespaces strings ;
TUPLE: nested-style-stream style ; TUPLE: nested-style-stream style ;
: with-style ( style quot -- )
>r stdio get <nested-style-stream> r> with-stream* ; inline
: do-nested-style ( style stream -- style delegate ) : do-nested-style ( style stream -- style delegate )
[ nested-style-stream-style hash-union ] keep delegate ; [ nested-style-stream-style hash-union ] keep delegate ;
@ -25,11 +28,12 @@ M: nested-style-stream stream-write
M: nested-style-stream stream-write1 M: nested-style-stream stream-write1
>r ch>string r> H{ } swap do-nested-style stream-format ; >r ch>string r> H{ } swap do-nested-style stream-format ;
: do-nested-quot ( quot style stream -- quot style stream )
do-nested-style
>r [ swap \ with-style 3array >quotation ] keep r> ;
M: nested-style-stream with-nested-stream M: nested-style-stream with-nested-stream
do-nested-style with-nested-stream ; do-nested-quot with-nested-stream ;
M: nested-style-stream with-stream-table M: nested-style-stream with-stream-table
do-nested-style with-stream-table ; do-nested-quot with-stream-table ;
: with-style ( style quot -- )
>r stdio get <nested-style-stream> r> with-stream* ; inline

View File

@ -15,7 +15,7 @@ GENERIC: stream-flush ( stream -- )
GENERIC: stream-terpri ( stream -- ) GENERIC: stream-terpri ( stream -- )
GENERIC: stream-format ( string style stream -- ) GENERIC: stream-format ( string style stream -- )
GENERIC: with-nested-stream ( quot style stream -- ) GENERIC: with-nested-stream ( quot style stream -- )
GENERIC: with-stream-table ( quot grid style stream -- ) GENERIC: with-stream-table ( grid quot style stream -- )
: stream-print ( string stream -- ) : stream-print ( string stream -- )
[ stream-write ] keep stream-terpri ; [ stream-write ] keep stream-terpri ;

View File

@ -26,11 +26,14 @@ M: sbuf stream-flush drop ;
swap dup length <reversed> swap dup length <reversed>
[ zero? rot [ call ] keep swap ] 2map nip ; inline [ zero? rot [ call ] keep swap ] 2map nip ; inline
M: plain-writer with-stream-table ( quot grid style stream -- ) M: plain-writer with-stream-table ( grid quot style stream -- )
nip -rot [ [ swap string-out ] map-with ] map-with [
nip swap
[ [ swap string-out ] map-with ] map-with
flip [ format-column ] map-last flip [ format-column ] map-last
flip [ " " join ] map flip [ " " join ] map
[ swap stream-print ] each-with ; [ print ] each
] with-stream* ;
! Reversed string buffers support the stream input protocol. ! Reversed string buffers support the stream input protocol.
M: sbuf stream-read1 ( sbuf -- char/f ) M: sbuf stream-read1 ( sbuf -- char/f )

View File

@ -0,0 +1,14 @@
IN: temporary
USING: io kernel math namespaces styles test ;
! Make sure everything here works...
[ ">> + <<" ] [
[
[
H{ { highlight t } } [
H{ } [ "+" write ] with-nesting
] with-style
] string-out
] with-scope
] unit-test

View File

@ -74,7 +74,7 @@ SYMBOL: failures
"collections/strings" "collections/namespaces" "collections/strings" "collections/namespaces"
"collections/vectors" "collections/sequences" "collections/vectors" "collections/sequences"
"collections/queues" "generic" "tuple" "parser" "collections/queues" "generic" "tuple" "parser"
"parse-number" "init" "io/io" "parse-number" "init" "io/io" "io/nested-style"
"words" "prettyprint" "random" "stream" "math/bitops" "words" "prettyprint" "random" "stream" "math/bitops"
"math/math-combinators" "math/rational" "math/float" "math/math-combinators" "math/rational" "math/float"
"math/complex" "math/irrational" "math/complex" "math/irrational"

View File

@ -94,8 +94,8 @@ M: object-button gadget-help ( button -- string )
[ pick pick >r >r -rot styled-pane r> r> rot ] map [ pick pick >r >r -rot styled-pane r> r> rot ] map
] map 2nip <grid> 5 over set-grid-gap <default-border> ; ] map 2nip <grid> 5 over set-grid-gap <default-border> ;
M: pane with-stream-table ( quot grid style pane -- ) M: pane with-stream-table ( grid quot style pane -- )
>r swap <pane-grid> r> print-gadget ; >r rot <pane-grid> r> print-gadget ;
M: pane with-nested-stream ( quot style stream -- ) M: pane with-nested-stream ( quot style stream -- )
>r styled-pane r> write-gadget ; >r styled-pane r> write-gadget ;