Treat a limit of f as unlimited instead of throwing an error
parent
2c1f7b9293
commit
e12f0f2280
|
@ -76,3 +76,9 @@ IN: io.streams.limited.tests
|
|||
[ decoder? ] both?
|
||||
] with-destructors
|
||||
] unit-test
|
||||
|
||||
[ "HELL" ] [
|
||||
"HELLO"
|
||||
[ f stream-throws limit-input 4 read ]
|
||||
with-string-reader
|
||||
] unit-test
|
|
@ -22,7 +22,7 @@ M: decoder limit ( stream limit mode -- stream' )
|
|||
[ clone ] 2dip '[ _ _ limit ] change-stream ;
|
||||
|
||||
M: object limit ( stream limit mode -- stream' )
|
||||
<limited-stream> ;
|
||||
over [ <limited-stream> ] [ 2drop ] if ;
|
||||
|
||||
GENERIC: unlimited ( stream -- stream' )
|
||||
|
||||
|
@ -32,9 +32,11 @@ M: decoder unlimited ( stream -- stream' )
|
|||
M: object unlimited ( stream -- stream' )
|
||||
stream>> stream>> ;
|
||||
|
||||
: limit-input ( limit mode -- ) input-stream [ -rot limit ] change ;
|
||||
: limit-input ( limit mode -- )
|
||||
[ input-stream ] 2dip '[ _ _ limit ] change ;
|
||||
|
||||
: unlimited-input ( -- ) input-stream [ unlimited ] change ;
|
||||
: unlimited-input ( -- )
|
||||
input-stream [ unlimited ] change ;
|
||||
|
||||
: with-unlimited-stream ( stream quot -- )
|
||||
[ clone unlimited ] dip call ; inline
|
||||
|
|
Loading…
Reference in New Issue