From f5c4fbb10c9bc0038639f82e98fb8c9319ed92f7 Mon Sep 17 00:00:00 2001 From: Keith Lazuka Date: Sat, 26 Sep 2009 15:17:52 -0400 Subject: [PATCH] compression.lzw: better naming --- basis/compression/lzw/lzw-docs.factor | 4 ++-- basis/compression/lzw/lzw.factor | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/basis/compression/lzw/lzw-docs.factor b/basis/compression/lzw/lzw-docs.factor index 3e738a3649..c43a2d5a37 100644 --- a/basis/compression/lzw/lzw-docs.factor +++ b/basis/compression/lzw/lzw-docs.factor @@ -25,11 +25,11 @@ HELP: lzw-read } { $description "Read the next LZW code." } ; -HELP: lzw-read* +HELP: lzw-process-next-code { $values { "lzw" lzw } { "quot" quotation } } -{ $description "Read the next LZW code and call " { $snippet "quot" } " with the lzw object and the LZW code only if the code is neither the Clear Code nor the End of Information Code. If it does read a Clear Code, this combinator will take care of handling the Clear Code for you." } ; +{ $description "Read the next LZW code and, assuming that the code is neither the Clear Code nor the End of Information Code, conditionally processes it by calling " { $snippet "quot" } " with the lzw object and the LZW code. If it does read a Clear Code, this combinator will take care of handling the Clear Code for you." } ; HELP: { $values diff --git a/basis/compression/lzw/lzw.factor b/basis/compression/lzw/lzw.factor index 43752584d3..72de6f828c 100644 --- a/basis/compression/lzw/lzw.factor +++ b/basis/compression/lzw/lzw.factor @@ -75,7 +75,7 @@ M: gif-lzw code-space-full? : clear-code? ( lzw code -- ? ) swap clear-code>> = ; DEFER: handle-clear-code -: lzw-read* ( lzw quot: ( lzw code -- ) -- ) +: lzw-process-next-code ( lzw quot: ( lzw code -- ) -- ) [ lzw-read ] dip { { [ 3dup drop end-of-information? ] [ 3drop ] } { [ 3dup drop clear-code? ] [ 2drop handle-clear-code ] } @@ -90,7 +90,7 @@ DEFER: lzw-uncompress-char [ write-code ] [ code>old-code ] bi lzw-uncompress-char - ] lzw-read* ; + ] lzw-process-next-code ; : handle-uncompress-code ( lzw -- lzw ) dup code-in-table? [ @@ -109,7 +109,8 @@ DEFER: lzw-uncompress-char ] if ; : lzw-uncompress-char ( lzw -- ) - [ >>code handle-uncompress-code lzw-uncompress-char ] lzw-read* ; + [ >>code handle-uncompress-code lzw-uncompress-char ] + lzw-process-next-code ; : lzw-uncompress ( bitstream code-size class -- byte-array )