io.encodings.korean cp949, johab encode-char/decode-char refactoring...

db4
Yun, Jonghyouk 2009-02-28 15:57:14 +09:00
parent 017fc8f1bf
commit fc1199358c
1 changed files with 14 additions and 5 deletions

View File

@ -77,13 +77,22 @@ VALUE: johab-table
[ HEX: E0 HEX: F9 between? ] [ HEX: E0 HEX: F9 between? ]
tri { } 3sequence [ t? ] any? ; tri { } 3sequence [ t? ] any? ;
M:: johab encode-char ( char stream encoding -- ) :: encode-char-mb ( c stream quot-conv: ( c -- c2 ) quot-mb?: ( c -- ? ) -- )
char unicode>johab byte? c quot-conv call quot-mb? call
[ char 1byte-array stream stream-write ] [ [
char unicode>johab c quot-conv call
h>b/b swap 2byte-array h>b/b swap 2byte-array
stream stream-write stream stream-write
] if ; ]
[ c 1byte-array stream drop drop
stream-write
]
if ;
M: johab encode-char ( char stream encoding -- )
drop [ unicode>johab ] [ byte? not ] encode-char-mb ;
: johab-decode-char-step2 ( c stream -- char ) : johab-decode-char-step2 ( c stream -- char )
stream-read1 stream-read1