]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/encodings/iso2022/iso2022.factor
use radix literals
[factor.git] / basis / io / encodings / iso2022 / iso2022.factor
index a057df28e0aa2a0b90e60b2fba0b1568b4fbafe4..1a8b66c3c01d53ad0cc477e2123c9ae2b9a1b8b5 100644 (file)
@@ -13,12 +13,12 @@ VALUE: jis201
 VALUE: jis208
 VALUE: jis212
 
-"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc to: jis201
-"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc to: jis208
-"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc to: jis212
+"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc \ jis201 set-value
+"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc \ jis208 set-value
+"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc \ jis212 set-value
 
 VALUE: ascii
-128 unique >biassoc to: ascii
+128 iota unique >biassoc \ ascii set-value
 
 TUPLE: iso2022-state type ;
 
@@ -31,7 +31,7 @@ M: iso2022 <encoder>
 M: iso2022 <decoder>
     make-iso-coder <decoder> ;
 
-<< SYNTAX: ESC HEX: 16 parsed ; >>
+<< SYNTAX: ESC 0x16 suffix! ; >>
 
 CONSTANT: switch-ascii B{ ESC CHAR: ( CHAR: B }
 CONSTANT: switch-jis201 B{ ESC CHAR: ( CHAR: J }
@@ -56,7 +56,7 @@ M:: iso2022-state encode-char ( char stream encoding -- )
     char encoding type>> value? [
         char find-type
         [ stream stream-write ]
-        [ encoding (>>type) ] bi*
+        [ encoding type<< ] bi*
     ] unless
     char encoding type>> value-at stream stream-write-num ;
 
@@ -92,7 +92,7 @@ M:: iso2022-state decode-char ( stream encoding -- char )
     stream stream-read1 {
         { ESC [
             stream read-escape [
-                encoding (>>type)
+                encoding type<<
                 stream encoding decode-char
             ] [ replacement-char ] if*
         ] }