From 3909c42962baf269781d053d4848200f29d3bd6c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 21 Nov 2008 22:31:05 -0600 Subject: [PATCH] clean up teh newb code --- basis/mime/multipart/multipart.factor | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/basis/mime/multipart/multipart.factor b/basis/mime/multipart/multipart.factor index 433e89ed41..5e9949c70c 100644 --- a/basis/mime/multipart/multipart.factor +++ b/basis/mime/multipart/multipart.factor @@ -24,38 +24,32 @@ TUPLE: multipart-stream stream n leftover separator ; [ f ] change-leftover [ n>> ] [ stream>> ] bi stream-read [ ?append ] keep not ; -: multipart-split ( bytes separator -- before after ? empty? ) - #! first boolean: return true if found - #! second boolean: true if sequence= - 2dup sequence= [ - 2drop f f f t - ] [ - split1 dup >boolean f - ] if ; +: multipart-split ( bytes separator -- before after seq=? ) + 2dup sequence= [ 2drop f f t ] [ split1 f ] if ; PRIVATE> :: multipart-step ( stream bytes end-stream? separator quot: ( bytes -- ) -- ? end-stream? ) #! return t to loop again - bytes separator multipart-split [ + bytes separator multipart-split [ dup >boolean ] dip [ ! separator == input 3drop f quot call f ] [ [ ! found - [ [ quot call ] unless-empty ] + [ quot unless-empty ] [ stream (>>leftover) - [ quot call ] unless-empty + quot unless-empty ] if-empty f quot call f ] [ ! not found drop end-stream? [ - [ quot call ] unless-empty f + quot unless-empty f ] [ separator length 1- ?cut* stream (>>leftover) - [ quot call ] unless-empty t + quot unless-empty t ] if ] if ] if stream leftover>> end-stream? not or ;