io.streams.limited: remove unlimit*

db4
Joe Groff 2010-07-09 13:52:15 -07:00
parent 57fb4267ab
commit 0bdc1514fd
5 changed files with 2 additions and 52 deletions

View File

@ -51,7 +51,6 @@ ERROR: no-boundary ;
SYMBOL: upload-limit SYMBOL: upload-limit
: read-multipart-data ( request -- mime-parts ) : read-multipart-data ( request -- mime-parts )
unlimited-input
upload-limit get limited-input upload-limit get limited-input
[ "content-type" header ] [ "content-type" header ]
[ "content-length" header string>number limited-input ] bi [ "content-length" header string>number limited-input ] bi

View File

@ -366,7 +366,7 @@ ERROR: not-a-jpeg-image ;
[ [
parse-marker { SOI } = [ not-a-jpeg-image ] unless parse-marker { SOI } = [ not-a-jpeg-image ] unless
parse-headers parse-headers
unlimited-input contents <loading-jpeg> contents <loading-jpeg>
] with-input-stream ; ] with-input-stream ;
PRIVATE> PRIVATE>

View File

@ -27,13 +27,6 @@ HELP: limit-stream
} }
} ; } ;
HELP: unlimit-stream
{ $values
{ "stream" "an input stream" }
{ "stream'" "a stream" }
}
{ $description "Returns the underlying stream of a limited stream." } ;
HELP: limited-stream HELP: limited-stream
{ $values { $values
{ "value" "a limited-stream class" } { "value" "a limited-stream class" }
@ -44,18 +37,11 @@ HELP: limited-input
{ $values { "limit" integer } } { $values { "limit" integer } }
{ $description "Wraps the current " { $link input-stream } " in a " { $link limited-stream } "." } ; { $description "Wraps the current " { $link input-stream } " in a " { $link limited-stream } "." } ;
HELP: unlimited-input
{ $description "Returns the underlying stream of the limited-stream stored in " { $link input-stream } "." } ;
ARTICLE: "io.streams.limited" "Limited input streams" ARTICLE: "io.streams.limited" "Limited input streams"
"The " { $vocab-link "io.streams.limited" } " vocabulary wraps a stream to behave as if it had only a limited number of bytes, either throwing an error or returning " { $link f } " upon reaching the end. Limiting a non-seekable stream keeps a byte count and triggers the end-of-stream behavior when this byte count has been reached. However, limiting a seekable stream creates a window of bytes that supports seeking and re-reading of bytes in that window." $nl "The " { $vocab-link "io.streams.limited" } " vocabulary wraps a stream to behave as if it had only a limited number of bytes, either throwing an error or returning " { $link f } " upon reaching the end. Limiting a non-seekable stream keeps a byte count and triggers the end-of-stream behavior when this byte count has been reached. However, limiting a seekable stream creates a window of bytes that supports seeking and re-reading of bytes in that window." $nl
"Wrap a stream in a limited stream:" "Wrap a stream in a limited stream:"
{ $subsections limited-stream } { $subsections limited-stream }
"Wrap the current " { $link input-stream } " in a limited stream:" "Wrap the current " { $link input-stream } " in a limited stream:"
{ $subsections limited-input } { $subsections limited-input } ;
"Unlimits a limited stream:"
{ $subsections unlimit-stream }
"Unlimits the current " { $link input-stream } ":"
{ $subsections unlimited-input } ;
ABOUT: "io.streams.limited" ABOUT: "io.streams.limited"

View File

@ -54,35 +54,6 @@ IN: io.streams.limited.tests
4 over stream-read drop 10 swap stream-read 4 over stream-read drop 10 swap stream-read
] unit-test ] unit-test
[ t ]
[
"abc" <string-reader> 3 limit-stream unlimit-stream
"abc" <string-reader> =
] unit-test
[ t ]
[
"abc" <string-reader> 3 limit-stream unlimit-stream
"abc" <string-reader> =
] unit-test
[ t ]
[
[
"resource:license.txt" utf8 <file-reader> &dispose
3 limit-stream unlimit-stream
"resource:license.txt" utf8 <file-reader> &dispose
[ decoder? ] both?
] with-destructors
] unit-test
[ "asdf" ] [
"asdf" <string-reader> 2 <limited-stream> [
unlimited-input contents
] with-input-stream
] unit-test
! pipes are duplex and not seekable ! pipes are duplex and not seekable
[ "as" ] [ [ "as" ] [
latin1 <pipe> [ 2 <limited-stream> ] change-in latin1 <pipe> [ 2 <limited-stream> ] change-in

View File

@ -39,12 +39,6 @@ M: object unlimit-stream ( stream -- stream' ) ;
: limited-input ( limit -- ) : limited-input ( limit -- )
[ input-stream ] dip '[ _ limit-stream ] change ; [ input-stream ] dip '[ _ limit-stream ] change ;
: unlimited-input ( -- )
input-stream [ unlimit-stream ] change ;
: with-unlimited-stream ( stream quot -- )
[ clone unlimit-stream ] dip call ; inline
: with-limited-stream ( stream limit quot -- ) : with-limited-stream ( stream limit quot -- )
[ limit-stream ] dip call ; inline [ limit-stream ] dip call ; inline