1 ! Copyright (C) 2008 Daniel Ehrenberg.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors io io.encodings io.encodings.private kernel
4 math sequences strings ;
11 over 127 <= [ stream-write1 ] [ encode-error ] if ; inline
15 GENERIC: ascii> ( string -- byte-array )
18 [ dup 127 <= [ encode-error ] unless ] B{ } map-as ; inline
23 [ string>byte-array-fast ] if ; inline
27 M: ascii encode-string
29 [ ascii> ] dip stream-write ;
34 dup 127 <= [ >fixnum ] [ drop replacement-char ] if
37 M: ascii decode-until (decode-until) ;