]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/unicode/normalize/normalize.factor
factor: trim some using lists
[factor.git] / basis / unicode / normalize / normalize.factor
index ee9e1dcad35fb70171fc74f1bdf2f25be92589b4..cc22e6d339feaaab058c751e545dc51c3bd06dce 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays ascii combinators
-combinators.short-circuit hints kernel locals make math
+combinators.short-circuit hints kernel make math
 math.order sbufs sequences sorting.insertion strings
 unicode.data vectors ;
 IN: unicode.normalize
@@ -89,23 +89,6 @@ HINTS: (nfd) string ;
 
 HINTS: (nfkd) string ;
 
-PRIVATE>
-
-: nfd ( string -- nfd )
-    [ (nfd) ] with-string ;
-
-: nfkd ( string -- nfkd )
-    [ (nfkd) ] with-string ;
-
-: string-append ( s1 s2 -- string )
-    [ append ] keep
-    0 over ?nth non-starter?
-    [ length dupd reorder-back ] [ drop ] if ;
-
-HINTS: string-append string string ;
-
-<PRIVATE
-
 ! Normalization -- Composition
 
 : initial-medial? ( str i -- ? )
@@ -114,17 +97,17 @@ HINTS: string-append string string ;
 : --final? ( str i -- ? )
     2 + swap ?nth final? ;
 
-: imf, ( str i -- str i )
+: imf% ( str i -- str i )
     [ tail-slice first3 jamo>hangul , ]
     [ 3 + ] 2bi ;
 
-: im, ( str i -- str i )
+: im% ( str i -- str i )
     [ tail-slice first2 final-base jamo>hangul , ]
     [ 2 + ] 2bi ;
 
 : compose-jamo ( str i -- str i )
     2dup initial-medial? [
-        2dup --final? [ imf, ] [ im, ] if
+        2dup --final? [ imf% ] [ im% ] if
     ] [ 2dup swap nth , 1 + ] if ;
 
 : pass-combining ( str -- str i )
@@ -154,7 +137,7 @@ DEFER: compose-iter
 
 : try-noncombining ( state char -- state )
     [ drop ] [ [ char>> ] dip combine-chars ] 2bi
-    [ >>char to f >>last-class compose-iter ] when* ; inline
+    [ >>char to f >>last-class compose-iter ] when* ; inline recursive
 
 : compose-iter ( state -- state )
     dup current [
@@ -189,9 +172,3 @@ DEFER: compose-iter
 HINTS: combine string ;
 
 PRIVATE>
-
-: nfc ( string -- nfc )
-    [ (nfd) combine ] with-string ;
-
-: nfkc ( string -- nfkc )
-    [ (nfkd) combine ] with-string ;