lz4-hs-0.1.0.0: src/Codec/Lz4/Foreign.chs
module Codec.Lz4.Foreign ( -- * Blocks
lZ4VersionNumber
, lZ4VersionString
, lZ4CompressDefault
, lZ4DecompressSafe
, lZ4CompressBound
-- * Frames
, lZ4FIsError
, lZ4FGetErrorName
, lZ4FGetVersion
, lZ4FCreateCompressionContext
, lZ4FFreeCompressionContext
, lZ4FHeaderSizeMax
, lZ4FCompressBegin
, lZ4FCompressBound
, lZ4FCompressUpdate
, lZ4FCompressEnd
, lZ4FCreateDecompressionContext
, lZ4FFreeDecompressionContext
, lZ4FDecompress
-- * Types
, LZ4FErrorCode
, LzCtx
, LzCtxPtr
, LzDecompressionCtx
, LzDecompressionCtxPtr
) where
import Foreign.C.String (CString)
import Foreign.C.Types (CInt, CUInt, CULong)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (castPtr, Ptr)
import Foreign.Storable (peek)
#include <lz4.h>
#include <lz4frame.h>
{# fun pure LZ4_versionNumber as ^ {} -> `CInt' #}
{# fun pure LZ4_versionString as ^ {} -> `String' #}
{# fun LZ4_compress_default as ^ { `CString', `CString', `CInt' , `CInt' } -> `CInt' #}
{# fun LZ4_decompress_safe as ^ { `CString', `CString', `CInt' , `CInt' } -> `CInt' #}
{# fun pure LZ4_compressBound as ^ { `CInt' } -> `CInt' #}
type LZ4FErrorCode = {# type LZ4F_errorCode_t #}
{# typedef LZ4F_errorCode_t LZ4FErrorCode #}
{# fun pure LZ4F_isError as ^ { `LZ4FErrorCode' } -> `Bool' #}
{# fun pure LZ4F_getErrorName as ^ { `LZ4FErrorCode' } -> `String' #}
{# fun pure LZ4F_getVersion as ^ {} -> `CUInt' #}
data LzCtx
{# pointer *LZ4F_cctx as LzCtxPtr foreign finalizer LZ4F_freeCompressionContext as ^ -> LzCtx #}
{# fun LZ4F_createCompressionContext as ^ { alloca- `Ptr LzCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #}
data LzPreferences
{# pointer *LZ4F_preferences_t as LzPreferencesPtr -> LzPreferences #}
lZ4FHeaderSizeMax :: Integral a => a
lZ4FHeaderSizeMax = {# const LZ4F_HEADER_SIZE_MAX #}
{# fun LZ4F_compressBegin as ^ { `LzCtxPtr', castPtr `Ptr a', `CULong', `LzPreferencesPtr' } -> `CULong' #}
{# fun pure LZ4F_compressBound as ^ { `CULong', `LzPreferencesPtr' } -> `CULong' #}
data LzCompressOptions
{# pointer *LZ4F_compressOptions_t as LzCompressOptionsPtr -> LzCompressOptions #}
{# fun LZ4F_compressUpdate as ^
{ `LzCtxPtr'
, castPtr `Ptr a'
, `CULong'
, castPtr `Ptr b'
, `CULong'
, `LzCompressOptionsPtr'
} -> `CULong'
#}
{# fun LZ4F_compressEnd as ^
{ `LzCtxPtr', castPtr `Ptr a', `CULong', `LzCompressOptionsPtr' } -> `CULong' #}
data LzDecompressionCtx
{# pointer *LZ4F_dctx as LzDecompressionCtxPtr foreign finalizer LZ4F_freeDecompressionContext as ^ -> LzDecompressionCtx #}
{# fun LZ4F_createDecompressionContext as ^ { alloca- `Ptr LzDecompressionCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #}
data LzDecompressOptions
{# pointer *LZ4F_decompressOptions_t as LzDecompressOptionsPtr -> LzDecompressOptions #}
{# fun LZ4F_decompress as ^
{ `LzDecompressionCtxPtr'
, castPtr `Ptr a'
, id `Ptr CULong'
, castPtr `Ptr b'
, id `Ptr CULong'
, `LzDecompressOptionsPtr'
} -> `CULong'
#}