compression.lzw: better naming

db4
Keith Lazuka 2009-09-26 15:17:52 -04:00
parent e7db217c1f
commit f5c4fbb10c
2 changed files with 6 additions and 5 deletions

View File

@ -25,11 +25,11 @@ HELP: lzw-read
} }
{ $description "Read the next LZW code." } ; { $description "Read the next LZW code." } ;
HELP: lzw-read* HELP: lzw-process-next-code
{ $values { $values
{ "lzw" lzw } { "quot" quotation } { "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: <lzw-uncompress> HELP: <lzw-uncompress>
{ $values { $values

View File

@ -75,7 +75,7 @@ M: gif-lzw code-space-full?
: clear-code? ( lzw code -- ? ) swap clear-code>> = ; : clear-code? ( lzw code -- ? ) swap clear-code>> = ;
DEFER: handle-clear-code DEFER: handle-clear-code
: lzw-read* ( lzw quot: ( lzw code -- ) -- ) : lzw-process-next-code ( lzw quot: ( lzw code -- ) -- )
[ lzw-read ] dip { [ lzw-read ] dip {
{ [ 3dup drop end-of-information? ] [ 3drop ] } { [ 3dup drop end-of-information? ] [ 3drop ] }
{ [ 3dup drop clear-code? ] [ 2drop handle-clear-code ] } { [ 3dup drop clear-code? ] [ 2drop handle-clear-code ] }
@ -90,7 +90,7 @@ DEFER: lzw-uncompress-char
[ write-code ] [ write-code ]
[ code>old-code ] bi [ code>old-code ] bi
lzw-uncompress-char lzw-uncompress-char
] lzw-read* ; ] lzw-process-next-code ;
: handle-uncompress-code ( lzw -- lzw ) : handle-uncompress-code ( lzw -- lzw )
dup code-in-table? [ dup code-in-table? [
@ -109,7 +109,8 @@ DEFER: lzw-uncompress-char
] if ; ] if ;
: lzw-uncompress-char ( lzw -- ) : 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 ) : lzw-uncompress ( bitstream code-size class -- byte-array )
<lzw-uncompress> <lzw-uncompress>