From 1ad96ad319e11617d861e477621925cd6c744f4a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 10 Jan 2008 22:03:34 -0500 Subject: [PATCH] Updating XML and Unicode for recent changes --- extra/assocs/lib/lib.factor | 2 +- extra/const/const.factor | 2 +- extra/delegate/delegate-docs.factor | 3 +- extra/unicode/breaks/breaks.factor | 16 +++++---- .../categories/categories-tests.factor | 2 +- extra/unicode/data/data.factor | 36 +++++++++---------- extra/unicode/normalize/normalize.factor | 6 ++-- extra/unicode/syntax/syntax.factor | 4 +-- extra/xml/utilities/utilities.factor | 2 +- extra/xml/xml-docs.factor | 3 +- 10 files changed, 39 insertions(+), 37 deletions(-) diff --git a/extra/assocs/lib/lib.factor b/extra/assocs/lib/lib.factor index b71982f1f2..0181514ab4 100644 --- a/extra/assocs/lib/lib.factor +++ b/extra/assocs/lib/lib.factor @@ -18,7 +18,7 @@ IN: assocs.lib ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : set-hash-stack ( value key seq -- ) - dupd [ key? ] curry* find-last nip set-at ; + dupd [ key? ] when find-last nip set-at ; : at-default ( key assoc -- value/key ) dupd at [ nip ] when* ; diff --git a/extra/const/const.factor b/extra/const/const.factor index 589f5f7fc0..59d65edaae 100644 --- a/extra/const/const.factor +++ b/extra/const/const.factor @@ -2,7 +2,7 @@ USING: kernel parser words sequences ; IN: const : define-const ( word value -- ) - [ parsed ] curry dupd define-compound + [ parsed ] curry dupd define t "parsing" set-word-prop ; : CONST: diff --git a/extra/delegate/delegate-docs.factor b/extra/delegate/delegate-docs.factor index 5ceeac42bb..f123c3a802 100644 --- a/extra/delegate/delegate-docs.factor +++ b/extra/delegate/delegate-docs.factor @@ -1,4 +1,5 @@ -USING: delegate help.syntax help.markup ; +USING: help.syntax help.markup ; +IN: delegate HELP: define-protocol { $values { "wordlist" "a sequence of words" } { "protocol" "a word for the new protocol" } } diff --git a/extra/unicode/breaks/breaks.factor b/extra/unicode/breaks/breaks.factor index 8c3dffcc2d..fc1e3071e7 100644 --- a/extra/unicode/breaks/breaks.factor +++ b/extra/unicode/breaks/breaks.factor @@ -30,10 +30,9 @@ CATEGORY: grapheme-control Zl Zp Cc Cf ; concat >set ; : other-extend-lines ( -- lines ) - "extra/unicode/PropList.txt" resource-path lines ; + "extra/unicode/PropList.txt" resource-path file-lines ; DEFER: other-extend -<< other-extend-lines process-other-extend \ other-extend define-value >> CATEGORY: (extend) Me Mn ; : extend? ( ch -- ? ) @@ -79,11 +78,6 @@ SYMBOL: table graphemes Extend connect-after ; DEFER: grapheme-table -<< - init-grapheme-table table - [ make-grapheme-table finish-table ] with-variable - \ grapheme-table define-value ->> : grapheme-break? ( class1 class2 -- ? ) grapheme-table nth nth not ; @@ -125,3 +119,11 @@ DEFER: grapheme-table : prev-grapheme ( i str -- prev-i ) prev-grapheme-step (prev-grapheme) ; + +[ + other-extend-lines process-other-extend \ other-extend define-value + + init-grapheme-table table + [ make-grapheme-table finish-table ] with-variable + \ grapheme-table define-value +] with-compilation-unit diff --git a/extra/unicode/categories/categories-tests.factor b/extra/unicode/categories/categories-tests.factor index 6bbe6b057a..81868709e3 100644 --- a/extra/unicode/categories/categories-tests.factor +++ b/extra/unicode/categories/categories-tests.factor @@ -3,5 +3,5 @@ USING: tools.test kernel unicode.categories words sequences unicode.syntax ; [ { f f t t f t t f f t } ] [ CHAR: A { blank? letter? LETTER? Letter? digit? printable? alpha? control? uncased? character? -} [ execute ] curry* map ] unit-test +} [ execute ] with map ] unit-test [ "Nd" ] [ CHAR: 3 category ] unit-test diff --git a/extra/unicode/data/data.factor b/extra/unicode/data/data.factor index 49f77a61d8..e112471c28 100644 --- a/extra/unicode/data/data.factor +++ b/extra/unicode/data/data.factor @@ -1,6 +1,6 @@ -USING: assocs math kernel sequences io.files hashtables quotations -splitting arrays math.parser combinators.lib hash2 byte-arrays words -namespaces words ; +USING: assocs math kernel sequences io.files hashtables +quotations splitting arrays math.parser combinators.lib hash2 +byte-arrays words namespaces words compiler.units ; IN: unicode.data ! Convenience functions @@ -116,19 +116,7 @@ DEFER: class-map DEFER: compat-map DEFER: category-map DEFER: name-map - -<< - load-data - dup process-names \ name-map define-value - 13 over process-data \ simple-lower define-value - 12 over process-data tuck \ simple-upper define-value - 14 over process-data swapd union \ simple-title define-value - dup process-combining \ class-map define-value - dup process-canonical \ canonical-map define-value - \ combine-map define-value - dup process-compat \ compat-map define-value - process-category \ category-map define-value ->> +DEFER: special-casing : canonical-entry ( char -- seq ) canonical-map at ; : combine-chars ( a b -- char/f ) combine-map hash2 ; @@ -144,6 +132,16 @@ DEFER: name-map [ length 5 = ] subset [ [ set-code-point ] each ] H{ } make-assoc ; -DEFER: special-casing - -<< load-special-casing \ special-casing define-value >> +[ + load-data + dup process-names \ name-map define-value + 13 over process-data \ simple-lower define-value + 12 over process-data tuck \ simple-upper define-value + 14 over process-data swapd union \ simple-title define-value + dup process-combining \ class-map define-value + dup process-canonical \ canonical-map define-value + \ combine-map define-value + dup process-compat \ compat-map define-value + process-category \ category-map define-value + load-special-casing \ special-casing define-value +] with-compilation-unit diff --git a/extra/unicode/normalize/normalize.factor b/extra/unicode/normalize/normalize.factor index a1386d84ae..86a922793f 100644 --- a/extra/unicode/normalize/normalize.factor +++ b/extra/unicode/normalize/normalize.factor @@ -1,5 +1,5 @@ -USING: sequences namespaces unicode.data kernel combinators.lib math -unicode arrays ; +USING: sequences namespaces unicode.data kernel combinators.lib +math arrays ; IN: unicode.normalize ! Utility word @@ -89,7 +89,7 @@ IN: unicode.normalize swap [ [ dup hangul? [ hangul>jamo % drop ] [ dup rot call [ % ] [ , ] ?if ] if - ] curry* each ] "" make* + ] with each ] "" make* dup reorder ] if ; inline diff --git a/extra/unicode/syntax/syntax.factor b/extra/unicode/syntax/syntax.factor index 3992a73c1f..91d46d179f 100644 --- a/extra/unicode/syntax/syntax.factor +++ b/extra/unicode/syntax/syntax.factor @@ -20,10 +20,10 @@ IN: unicode.syntax category# categories nth ; : >category-array ( categories -- bitarray ) - categories [ swap member? ] curry* map >bit-array ; + categories [ swap member? ] with map >bit-array ; : as-string ( strings -- bit-array ) - concat "\"" tuck 3append parse first ; + concat "\"" tuck 3append eval ; : [category] ( categories -- quot ) [ diff --git a/extra/xml/utilities/utilities.factor b/extra/xml/utilities/utilities.factor index 5175711408..d6814851ee 100755 --- a/extra/xml/utilities/utilities.factor +++ b/extra/xml/utilities/utilities.factor @@ -23,7 +23,7 @@ M: process-missing error. : PROCESS: CREATE dup H{ } clone "xtable" set-word-prop - dup [ run-process ] curry define-compound ; parsing + dup [ run-process ] curry define ; parsing : TAG: scan scan-word diff --git a/extra/xml/xml-docs.factor b/extra/xml/xml-docs.factor index 785538332a..a941e0de92 100644 --- a/extra/xml/xml-docs.factor +++ b/extra/xml/xml-docs.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2005, 2006 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax kernel xml xml.data xml.errors +USING: help.markup help.syntax kernel xml.data xml.errors xml.writer state-parser xml.tokenize xml.utilities xml.entities strings sequences io ; +IN: xml HELP: string>xml { $values { "string" "a string" } { "xml" "an xml document" } }