io.encodings.latin1: re-implement M\ latin1 encode-string.
parent
1b3a07ca44
commit
f43f88e7f0
|
@ -1,11 +1,17 @@
|
|||
USING: io io.encodings io.encodings.iana kernel math ;
|
||||
USING: io io.encodings io.encodings.iana kernel math sequences ;
|
||||
|
||||
IN: io.encodings.latin1
|
||||
|
||||
SINGLETON: latin1
|
||||
|
||||
: latin1-encode ( char -- byte )
|
||||
dup 256 < [ encode-error ] unless ; inline
|
||||
|
||||
M: latin1 encode-char
|
||||
drop over 256 < [ stream-write1 ] [ encode-error ] if ;
|
||||
drop [ latin1-encode ] dip stream-write1 ;
|
||||
|
||||
M: latin1 encode-string
|
||||
drop [ [ latin1-encode ] B{ } map-as ] dip stream-write ;
|
||||
|
||||
M: latin1 decode-char
|
||||
drop stream-read1 [
|
||||
|
|
Loading…
Reference in New Issue