2008-03-21 21:47:16 -04:00
|
|
|
! Copyright (C) 2008 Daniel Ehrenberg
|
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-07-02 01:20:01 -04:00
|
|
|
USING: io.encodings kernel accessors summary ;
|
2008-03-21 21:47:16 -04:00
|
|
|
IN: io.encodings.strict
|
|
|
|
|
|
|
|
|
|
TUPLE: strict code ;
|
|
|
|
|
C: strict strict
|
|
|
|
|
|
|
|
|
|
TUPLE: decode-error ;
|
2008-04-13 16:06:27 -04:00
|
|
|
: decode-error ( -- * ) \ decode-error new throw ;
|
2008-03-21 21:47:16 -04:00
|
|
|
M: decode-error summary
|
|
|
|
|
drop "Error in decoding input stream" ;
|
|
|
|
|
|
|
|
|
|
M: strict <decoder>
|
|
|
|
|
code>> <decoder> [ strict ] change-code ;
|
|
|
|
|
|
|
|
|
|
M: strict decode-char
|
|
|
|
|
code>> decode-char dup replacement-char = [ decode-error ] when ;
|