diff --git a/basis/io/encodings/asian/asian.factor b/basis/io/encodings/asian/asian.factor new file mode 100644 index 0000000000..64e4c03208 --- /dev/null +++ b/basis/io/encodings/asian/asian.factor @@ -0,0 +1,50 @@ +! Copyright (C) 2009 Yun, Jonghyouk. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel math.parser sequences io.files io.encodings.ascii +splitting assocs hashtables accessors ; +IN: io.encodings.asian + + + + + ; + +: parse-line ( line -- code-unicode ) + split-column [ parse-hex ] map ; + +: lines>(n>u) ( lines -- n>u ) + drop-comments [ parse-line ] map >hashtable ; + +: file>(n>u) ( filename -- n>u ) + ascii file-lines lines>(n>u) ; + +: (n>u)>(u>n) ( n>u -- u>n ) + [ swap ] assoc-map ; + +PRIVATE> + +TUPLE: code-table n>u u>n ; + +C: code-table + +: * ( filename -- code-table ) + file>(n>u) dup (n>u)>(u>n) ; + +GENERIC: n>u ( n code-table -- u ) + +M: code-table n>u ( n code-table -- u ) n>u>> at ; + +GENERIC: u>n ( u code-table -- n ) + +M: code-table u>n ( u code-table -- n ) u>n>> at ; + + diff --git a/basis/io/encodings/asian/authors.txt b/basis/io/encodings/asian/authors.txt new file mode 100644 index 0000000000..171a5f9219 --- /dev/null +++ b/basis/io/encodings/asian/authors.txt @@ -0,0 +1 @@ +Yun, Jonghyouk \ No newline at end of file