Minor bug fixes
							parent
							
								
									8c61791364
								
							
						
					
					
						commit
						3a6d9e912f
					
				| 
						 | 
				
			
			@ -13,11 +13,13 @@ TUPLE: euc { table biassoc } ;
 | 
			
		|||
    HEX: 0 HEX: ff between? ;
 | 
			
		||||
 | 
			
		||||
M: euc encode-char ( char stream encoding -- )
 | 
			
		||||
    swapd table>> value-at dup byte?
 | 
			
		||||
    [ swap stream-write1 ] [
 | 
			
		||||
        h>b/b swap 2byte-array
 | 
			
		||||
        swap stream-write
 | 
			
		||||
    ] if ;
 | 
			
		||||
    swapd table>> value-at [
 | 
			
		||||
        dup byte?
 | 
			
		||||
        [ swap stream-write1 ] [
 | 
			
		||||
            h>b/b swap 2byte-array
 | 
			
		||||
            swap stream-write
 | 
			
		||||
        ] if
 | 
			
		||||
    ] [ encode-error ] if* ;
 | 
			
		||||
 | 
			
		||||
: euc-multibyte? ( ch -- ? )
 | 
			
		||||
    HEX: 81 HEX: fe between? ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
! Copyright (C) 2009 Yun, Jonghyouk.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: help.syntax help.markup ;
 | 
			
		||||
IN: io.encodings.korean.johab
 | 
			
		||||
IN: io.encodings.johab
 | 
			
		||||
 | 
			
		||||
ABOUT: johab
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
! Copyright (C) 2009 Yun, Jonghyouk.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: arrays byte-arrays io io.encodings io.encodings.euc-kr assocs
 | 
			
		||||
USING: arrays byte-arrays io io.encodings io.encodings.johab assocs
 | 
			
		||||
io.encodings.string io.streams.string io.encodings.euc.private words
 | 
			
		||||
kernel locals multiline namespaces sequences strings tools.test ;
 | 
			
		||||
IN: io.encodings.johab.tests
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +16,8 @@ IN: io.encodings.johab.tests
 | 
			
		|||
[ HEX: 3133 ] [ HEX: 8444 johab>unicode ] unit-test
 | 
			
		||||
[ HEX: 8A5D ] [ HEX: AD4F unicode>johab ] unit-test
 | 
			
		||||
 | 
			
		||||
: phrase-unicode ( -- s )
 | 
			
		||||
    "\u00b3d9\u00d574\u00bb3c\u00acfc \u00bc31\u00b450\u00c0b0\u00c774!" ;
 | 
			
		||||
 | 
			
		||||
: phrase-johab ( -- s )
 | 
			
		||||
    B{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,10 +35,10 @@ TUPLE: jis assoc ;
 | 
			
		|||
: make-jis ( filename -- jis )
 | 
			
		||||
    flat-file>biassoc [ nip ] assoc-filter jis boa ;
 | 
			
		||||
 | 
			
		||||
"vocab:io/encodings/japanese/CP932.txt"
 | 
			
		||||
"vocab:io/encodings/shift-jis/CP932.txt"
 | 
			
		||||
make-jis to: windows-31j-table
 | 
			
		||||
 | 
			
		||||
"vocab:io/encodings/japanese/sjis-0208-1997-std.txt"
 | 
			
		||||
"vocab:io/encodings/shift-jis/sjis-0208-1997-std.txt"
 | 
			
		||||
make-jis to: shift-jis-table
 | 
			
		||||
 | 
			
		||||
: small? ( char -- ? )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue