: parse-color ( line -- name color )
first4
[ [ string>number 255 /f ] tri@ 1.0 <rgba> ] dip
- [ blank? ] trim-head { { CHAR: \s CHAR: - } } substitute swap ;
+ [ blank? ] trim-head H{ { CHAR: \s CHAR: - } } substitute swap ;
: parse-colors ( lines -- assoc )
[ "!" head? not ] filter
[ { } quot with-datastack drop did-not-fail t ] [ drop f f ] recover ;
: experiment-title ( word -- string )
- "(" ?head drop ")" ?tail drop { { CHAR: - CHAR: \s } } substitute >title ;
+ "(" ?head drop ")" ?tail drop
+ H{ { CHAR: - CHAR: \s } } substitute >title ;
MACRO: <experiment> ( word -- )
[ stack-effect in>> length dup ]
: escape-nulls ( str -- str' )
#! Replace nulls with something else since Pango uses null-terminated
#! strings
- { { 0 CHAR: zero-width-no-break-space } } substitute ;
+ H{ { 0 CHAR: zero-width-no-break-space } } substitute ;
: unpack-selection ( layout string/selection -- layout )
dup selection? [
: history-list ( interactor -- alist )
history>> elements>>
- [ dup string>> { { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
+ [ dup string>> H{ { CHAR: \n CHAR: \s } } substitute ] { } map>assoc
<reversed> ;
: history-completions ( short interactor -- seq )
: process-names ( data -- names-hash )
1 swap (process-data) [
- >lower { { CHAR: \s CHAR: - } } substitute swap
+ >lower H{ { CHAR: \s CHAR: - } } substitute swap
] H{ } assoc-map-as ;
: multihex ( hexstring -- string )
PRIVATE>
: vocab-dir ( vocab -- dir )
- vocab-name { { CHAR: . CHAR: / } } substitute ;
+ vocab-name H{ { CHAR: . CHAR: / } } substitute ;
: append-vocab-dir ( vocab str/f -- path )
[ vocab-name "." split ] dip
IN: mason.platform
: (platform) ( os cpu -- string )
- { { CHAR: . CHAR: - } } substitute "-" glue ;
+ H{ { CHAR: . CHAR: - } } substitute "-" glue ;
: platform ( -- string )
target-os get name>> target-cpu get name>> (platform)
XML-NS: inkscape-name http://www.inkscape.org/namespaces/inkscape
: svg-string>number ( string -- number )
- { { CHAR: E CHAR: e } } substitute "e" split1
+ H{ { CHAR: E CHAR: e } } substitute "e" split1
[ string>number ] [ [ string>number 10^ ] [ 1 ] if* ] bi* *
>float ;
add-mixin-instance define-class-tuple ;
:: define-c++-method ( class-name generic name types effect virtual -- )
- [ name % "_" % class-name { { CHAR: : CHAR: _ } } substitute % ] "" make :> name'
+ [ name % "_" % class-name H{ { CHAR: : CHAR: _ } } substitute % ] "" make :> name'
effect [ in>> "self" suffix ] [ out>> ] bi <effect> :> effect'
types class-name "*" append suffix :> types'
effect in>> "," join :> args
: cify-type ( str -- str' )
dup word? [ name>> ] when
- { { CHAR: - CHAR: space } } substitute ;
+ H{ { CHAR: - CHAR: space } } substitute ;
: factorize-type ( str -- str' )
cify-type
name c-type fields>> [
class swap
{
- [ name>> { { CHAR: space CHAR: - } } substitute ]
+ [ name>> H{ { CHAR: space CHAR: - } } substitute ]
[ type>> ] [ reader>> ] [ writer>> ]
} cleave define-struct-accessors
] each ;