1 ! Copyright (C) 2021 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
4 USING: alien alien.c-types alien.destructors alien.libraries
5 alien.syntax classes.struct combinators system ;
7 IN: compression.zstd.ffi
10 { [ os windows? ] [ "zstd-1.dll" ] }
11 { [ os macosx? ] [ "libzstd.dylib" ] }
12 { [ os unix? ] [ "libzstd.so" ] }
13 } cond cdecl add-library >>
17 FUNCTION: uint ZSTD_versionNumber ( )
19 FUNCTION: c-string ZSTD_versionString ( )
23 FUNCTION: size_t ZSTD_compress ( void* dst, size_t dstCapacity,
24 void* src, size_t srcSize,
25 int compressionLevel )
27 FUNCTION: size_t ZSTD_decompress ( void* dst, size_t dstCapacity,
28 void* src, size_t compressedSize )
30 FUNCTION: ulonglong ZSTD_getFrameContentSize ( void *src, size_t srcSize )
32 FUNCTION: size_t ZSTD_findFrameContentSize ( void *src, size_t srcSize )
36 FUNCTION: size_t ZSTD_compressBounds ( size_t srcSize )
38 FUNCTION: uint ZSTD_isError ( size_t code )
40 FUNCTION: c-string ZSTD_getErrorName ( size_t code )
42 FUNCTION: int ZSTD_minCLevel ( )
44 FUNCTION: int ZSTD_maxCLevel ( )
46 FUNCTION: int ZSTD_defaultCLevel ( )
50 TYPEDEF: void ZSTD_CCtx
51 FUNCTION: ZSTD_CCtx* ZSTD_createCCtx ( )
52 FUNCTION: size_t ZSTD_freeCCtx ( ZSTD_CCtx* cctx )
53 DESTRUCTOR: ZSTD_freeCCtx
55 FUNCTION: size_t ZSTD_compressCCtx ( ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, void* src, size_t srcSize, int compressionLevel )
57 TYPEDEF: void ZSTD_DCtx
58 FUNCTION: ZSTD_DCtx* ZSTD_createDCtx ( )
59 FUNCTION: size_t ZSTD_freeDCtx ( ZSTD_DCtx* dctx )
60 DESTRUCTOR: ZSTD_freeDCtx
62 FUNCTION: size_t ZSTD_decompressCCtx ( ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, void* src, size_t srcSize )
63 FUNCTION: size_t ZSTD_decompressStream_simpleArgs ( ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, size_t* dstPos, void* src, size_t srcSize, size_t* srcPos )
73 STRUCT: ZSTD_outBuffer
79 ! Streaming compression
81 TYPEDEF: void ZSTD_CStream
83 FUNCTION: ZSTD_CStream* ZSTD_createCStream ( )
84 FUNCTION: size_t ZSTD_freeCStream ( ZSTD_CStream* zcs )
86 ENUM: ZSTD_EndDirective
91 FUNCTION: size_t ZSTD_compressStream2 ( ZSTD_CCtx* cctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input, ZSTD_EndDirective endOp )
92 FUNCTION: size_t ZSTD_CStreamInSize ( )
93 FUNCTION: size_t ZSTD_CStreamOutSize ( )
95 FUNCTION: size_t ZSTD_initCStream ( ZSTD_CStream* zcs, int compressionLevel )
96 FUNCTION: size_t ZSTD_compressStream ( ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input )
97 FUNCTION: size_t ZSTD_flushStream ( ZSTD_CStream* zcs, ZSTD_outBuffer* output )
98 FUNCTION: size_t ZSTD_endStream ( ZSTD_CStream* zcs, ZSTD_outBuffer* output )
100 ! Streaming decompression
102 TYPEDEF: void ZSTD_DStream
104 FUNCTION: ZSTD_DStream* ZSTD_createDStream ( )
105 FUNCTION: size_t ZSTD_freeDStream ( ZSTD_DStream* zds )
106 FUNCTION: size_t ZSTD_initDStream ( ZSTD_DStream* zds )
107 FUNCTION: size_t ZSTD_decompressStream ( ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input )
108 FUNCTION: size_t ZSTD_DStreamInSize ( )
109 FUNCTION: size_t ZSTD_DStreamOutSize ( )
111 DESTRUCTOR: ZSTD_freeDStream