read-lengths ( count table reader -- lengths )


Vocabulary
compression.deflate.private

Inputs
countan object
tablean object
readeran object


Outputs
lengthsan object


Definition


:: read-lengths ( count table reader -- lengths )
V{ } clone :> lengths
[ lengths length count < ] [
table reader read-code :> code code 16 <
[ code lengths push ] [
code {
{
16
[
lengths empty? ~quotation~ when
lengths last 2 reader read-bits 3 +
]
}
{ 17 [ 0 3 reader read-bits 3 + ] }
{ 18 [ 0 7 reader read-bits 11 + ] }
} case :> ( value n ) lengths length n + count >
[ "too many code lengths" invalid-deflate ] when n
[ value lengths push ] times
] if
] while lengths ;