Handbook
Glossary
zstd-uncompress-stream-frame ( -- byte-array )
Vocabulary
compression
.
zstd
Inputs
None
Outputs
byte-array
an
object
Definition
USING:
accessors
alien.c-types
alien.data
byte-arrays
byte-vectors
compression.zstd.ffi
destructors
io
kernel
math
sequences
;
IN:
compression.zstd
::
zstd-uncompress-stream-frame
( -- byte-array )
ZSTD_DStreamInSize
:>
in-size
ZSTD_DStreamOutSize
:>
out-size in-size
<byte-vector>
:>
in out-size
<byte-array>
:>
out out-size
<byte-vector>
:>
accum
[
ZSTD_createDCtx
&ZSTD_freeDCtx
:>
dctx 0
size_t
<ref>
:>
in-pos 0
size_t
<ref>
:>
out-pos in
[
underlying>>
read-into
drop
length
]
[
set-length
]
bi
[
dctx out out-size out-pos in in
length
in-pos
ZSTD_decompressStream_simpleArgs
check-zstd-error
out out-pos
size_t
deref
head-slice
accum
push-all
in-pos
size_t
deref
in-size
=
[
in
[
underlying>>
read-into
drop
length
]
[
set-length
]
bi
0 in-pos 0
size_t
set-alien-value
]
when
zero?
[
f
]
[
in-pos
size_t
deref
in-size
=
out-pos
size_t
deref
out-size
<
and
not
0 out-pos 0
size_t
set-alien-value
]
if
]
loop
accum
B{
}
like
]
with-destructors
;