{-# LINE 1 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Unsafe #-}
{-# OPTIONS_GHC -fno-warn-dodgy-foreign-imports #-}
module Codec.Compression.Lzlib.FFI
(
c'LZ_min_dictionary_bits
, c'LZ_min_dictionary_size
, c'LZ_max_dictionary_size
, c'LZ_max_dictionary_bits
, c'LZ_min_match_len_limit
, c'LZ_max_match_len_limit
, LzEncoder
, c'LZ_compress_open
, c'LZ_compress_close
, cp'LZ_compress_close
, c'LZ_compress_finish
, c'LZ_compress_restart_member
, c'LZ_compress_sync_flush
, c'LZ_compress_read
, c'LZ_compress_write
, c'LZ_compress_write_size
, c'LZ_compress_errno
, c'LZ_compress_finished
, c'LZ_compress_member_finished
, c'LZ_compress_data_position
, c'LZ_compress_member_position
, c'LZ_compress_total_in_size
, c'LZ_compress_total_out_size
, LzDecoder
, c'LZ_decompress_open
, c'LZ_decompress_close
, cp'LZ_decompress_close
, c'LZ_decompress_finish
, c'LZ_decompress_reset
, c'LZ_decompress_sync_to_member
, c'LZ_decompress_read
, c'LZ_decompress_write
, c'LZ_decompress_write_size
, c'LZ_decompress_errno
, c'LZ_decompress_finished
, c'LZ_decompress_member_finished
, c'LZ_decompress_member_version
, c'LZ_decompress_dictionary_size
, c'LZ_decompress_data_crc
, c'LZ_decompress_data_position
, c'LZ_decompress_member_position
, c'LZ_decompress_total_in_size
, c'LZ_decompress_total_out_size
, C'LZ_Errno
, LzErrno(..), toLzErrno
, c'lzlib_version_check
) where
import Foreign
import Foreign.C
import Internal
foreign import capi unsafe "hs_lzlib.h hs_lzlib_version_check" c'lzlib_version_check :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_min_dictionary_bits" c'LZ_min_dictionary_bits :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_min_dictionary_size" c'LZ_min_dictionary_size :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_max_dictionary_bits" c'LZ_max_dictionary_bits :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_max_dictionary_size" c'LZ_max_dictionary_size :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_min_match_len_limit" c'LZ_min_match_len_limit :: CInt
foreign import capi unsafe "hs_lzlib.h LZ_max_match_len_limit" c'LZ_max_match_len_limit :: CInt
foreign import capi "hs_lzlib.h LZ_compress_open" c'LZ_compress_open :: CInt -> CInt -> CULLong -> IO (Ptr LzEncoder)
foreign import capi "hs_lzlib.h LZ_compress_close" c'LZ_compress_close :: Ptr LzEncoder -> IO CInt
foreign import capi "hs_lzlib.h hs_lzlib_compress_close_addr" cp'LZ_compress_close :: FunPtr (Ptr LzEncoder -> IO ())
foreign import capi "hs_lzlib.h LZ_compress_finish" c'LZ_compress_finish :: Ptr LzEncoder -> IO CInt
foreign import capi "hs_lzlib.h LZ_compress_restart_member" c'LZ_compress_restart_member :: Ptr LzEncoder -> CULLong -> IO CInt
foreign import capi "hs_lzlib.h LZ_compress_sync_flush" c'LZ_compress_sync_flush :: Ptr LzEncoder -> IO CInt
foreign import capi "hs_lzlib.h LZ_compress_read" c'LZ_compress_read :: Ptr LzEncoder -> Ptr Word8 -> CInt -> IO CInt
foreign import capi "hs_lzlib.h LZ_compress_write" c'LZ_compress_write :: Ptr LzEncoder -> Ptr Word8 -> CInt -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_compress_write_size" c'LZ_compress_write_size :: Ptr LzEncoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_compress_errno" c'LZ_compress_errno :: Ptr LzEncoder -> IO C'LZ_Errno
foreign import capi unsafe "hs_lzlib.h LZ_compress_finished" c'LZ_compress_finished :: Ptr LzEncoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_compress_member_finished" c'LZ_compress_member_finished :: Ptr LzEncoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_compress_data_position" c'LZ_compress_data_position :: Ptr LzEncoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_compress_member_position" c'LZ_compress_member_position :: Ptr LzEncoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_compress_total_in_size" c'LZ_compress_total_in_size :: Ptr LzEncoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_compress_total_out_size" c'LZ_compress_total_out_size :: Ptr LzEncoder -> IO CULLong
foreign import capi "hs_lzlib.h LZ_decompress_open" c'LZ_decompress_open :: IO (Ptr LzDecoder)
foreign import capi "hs_lzlib.h LZ_decompress_close" c'LZ_decompress_close :: Ptr LzDecoder -> IO CInt
foreign import capi "hs_lzlib.h hs_lzlib_decompress_close_addr" cp'LZ_decompress_close :: FunPtr (Ptr LzDecoder -> IO ())
foreign import capi "hs_lzlib.h LZ_decompress_finish" c'LZ_decompress_finish :: Ptr LzDecoder -> IO CInt
foreign import capi "hs_lzlib.h LZ_decompress_reset" c'LZ_decompress_reset :: Ptr LzDecoder -> IO CInt
foreign import capi "hs_lzlib.h LZ_decompress_sync_to_member" c'LZ_decompress_sync_to_member :: Ptr LzDecoder -> IO CInt
foreign import capi "hs_lzlib.h LZ_decompress_read" c'LZ_decompress_read :: Ptr LzDecoder -> Ptr Word8 -> CInt -> IO CInt
foreign import capi "hs_lzlib.h LZ_decompress_write" c'LZ_decompress_write :: Ptr LzDecoder -> Ptr Word8 -> CInt -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_write_size" c'LZ_decompress_write_size :: Ptr LzDecoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_errno" c'LZ_decompress_errno :: Ptr LzDecoder -> IO C'LZ_Errno
foreign import capi unsafe "hs_lzlib.h LZ_decompress_finished" c'LZ_decompress_finished :: Ptr LzDecoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_member_finished" c'LZ_decompress_member_finished :: Ptr LzDecoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_member_version" c'LZ_decompress_member_version :: Ptr LzDecoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_dictionary_size" c'LZ_decompress_dictionary_size :: Ptr LzDecoder -> IO CInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_data_crc" c'LZ_decompress_data_crc :: Ptr LzDecoder -> IO CUInt
foreign import capi unsafe "hs_lzlib.h LZ_decompress_data_position" c'LZ_decompress_data_position :: Ptr LzDecoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_decompress_member_position" c'LZ_decompress_member_position :: Ptr LzDecoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_decompress_total_in_size" c'LZ_decompress_total_in_size :: Ptr LzDecoder -> IO CULLong
foreign import capi unsafe "hs_lzlib.h LZ_decompress_total_out_size" c'LZ_decompress_total_out_size :: Ptr LzDecoder -> IO CULLong
type C'LZ_Errno = Word32
{-# LINE 189 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
data LzErrno
= LzOk
| LzBadArgument
| LzMemError
| LzSequenceError
| LzHeaderError
| LzUnexpectedEof
| LzDataError
| LzLibraryError
| LzUnknown
deriving (Eq,Show,Typeable)
instance Exception LzErrno
toLzErrno :: C'LZ_Errno -> LzErrno
toLzErrno eno = case eno of
0 -> LzOk
{-# LINE 211 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
1 -> LzBadArgument
{-# LINE 212 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
2 -> LzMemError
{-# LINE 213 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
3 -> LzSequenceError
{-# LINE 214 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
4 -> LzHeaderError
{-# LINE 215 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
5 -> LzUnexpectedEof
{-# LINE 216 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
6 -> LzDataError
{-# LINE 217 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
7 -> LzLibraryError
{-# LINE 218 "src/Codec/Compression/Lzlib/FFI.hsc" #-}
_ -> LzUnknown