Strict wrapper for encodings

db4
Daniel Ehrenberg 2008-03-21 21:47:16 -04:00
parent 4cfd62c373
commit 86efc8467c
5 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1 @@
Daniel Ehrenberg

View File

@ -0,0 +1,6 @@
USING: io.encodings.strict io.encodings.ascii tools.test
arrays io.encodings.string ;
IN: io.encodings.strict.test
[ { HEX: fffd } ] [ { 128 } ascii decode >array ] unit-test
[ { 128 } ascii strict decode ] must-fail

View File

@ -0,0 +1,18 @@
! Copyright (C) 2008 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: io.encodings kernel accessors inspector ;
IN: io.encodings.strict
TUPLE: strict code ;
C: strict strict
TUPLE: decode-error ;
: decode-error ( -- * ) \ decode-error construct-empty throw ;
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 ;

View File

@ -0,0 +1 @@
Strict wrapper for encodings

View File

@ -0,0 +1 @@
text