]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/unicode/collation/collation.factor
use radix literals
[factor.git] / basis / unicode / collation / collation.factor
index ea0487c703525e8c9b311ebdf8f7e5484e3ca269..50d032dd18f827ff3ef2e8352eda718f2db2015f 100644 (file)
@@ -25,7 +25,7 @@ TUPLE: weight primary secondary tertiary ignorable? ;
 : parse-ducet ( file -- ducet )\r
     data [ [ parse-keys ] [ parse-weight ] bi* ] H{ } assoc-map-as ;\r
 \r
-"vocab:unicode/collation/allkeys.txt" parse-ducet to: ducet\r
+"vocab:unicode/collation/allkeys.txt" parse-ducet \ ducet set-value\r
 \r
 ! Fix up table for long contractions\r
 : help-one ( assoc key -- )\r
@@ -43,17 +43,17 @@ ducet insert-helpers
 \r
 : base ( char -- base )\r
     {\r
-        { [ dup HEX: 3400 HEX:  4DB5 between? ] [ drop HEX: FB80 ] } ! Extension A\r
-        { [ dup HEX: 20000 HEX: 2A6D6 between? ] [ drop HEX: FB80 ] } ! Extension B\r
-        { [ dup HEX: 4E00 HEX: 9FC3 between? ] [ drop HEX: FB40 ] } ! CJK\r
-        [ drop HEX: FBC0 ] ! Other\r
+        { [ dup 0x3400 0x4DB5 between? ] [ drop 0xFB80 ] } ! Extension A\r
+        { [ dup 0x20000 0x2A6D6 between? ] [ drop 0xFB80 ] } ! Extension B\r
+        { [ dup 0x4E00 0x9FC3 between? ] [ drop 0xFB40 ] } ! CJK\r
+        [ drop 0xFBC0 ] ! Other\r
     } cond ;\r
 \r
 : AAAA ( char -- weight )\r
-    [ base ] [ -15 shift ] bi + HEX: 20 2 f weight boa ;\r
+    [ base ] [ -15 shift ] bi + 0x20 2 f weight boa ;\r
 \r
 : BBBB ( char -- weight )\r
-    HEX: 7FFF bitand HEX: 8000 bitor 0 0 f weight boa ;\r
+    0x7FFF bitand 0x8000 bitor 0 0 f weight boa ;\r
 \r
 : illegal? ( char -- ? )\r
     { [ "Noncharacter_Code_Point" property? ] [ category "Cs" = ] } 1|| ;\r
@@ -82,7 +82,7 @@ ducet insert-helpers
 \r
 : add ( char -- )\r
     dup blocked? [ 1string , ] [\r
-        dup possible-bases dup length\r
+        dup possible-bases dup length iota\r
         [ ?combine ] with with any?\r
         [ drop ] [ 1string , ] if\r
     ] if ;\r
@@ -101,7 +101,7 @@ ducet insert-helpers
     map [ zero? not ] filter % 0 , ; inline\r
 \r
 : variable-weight ( weight -- )\r
-    dup ignorable?>> [ primary>> ] [ drop HEX: FFFF ] if , ;\r
+    dup ignorable?>> [ primary>> ] [ drop 0xFFFF ] if , ;\r
 \r
 : weights>bytes ( weights -- byte-array )\r
     [\r
@@ -149,10 +149,8 @@ PRIVATE>
 : quaternary= ( str1 str2 -- ? )\r
     0 insensitive= ;\r
 \r
-<PRIVATE\r
 : w/collation-key ( str -- {str,key} )\r
     [ collation-key ] keep 2array ;\r
-PRIVATE>\r
 \r
 : sort-strings ( strings -- sorted )\r
     [ w/collation-key ] map natural-sort values ;\r