module Bindings.Lzma where
import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word
type C'lzma_ret = CUInt
c'LZMA_OK = 0
c'LZMA_OK :: (Num a) => a
c'LZMA_STREAM_END = 1
c'LZMA_STREAM_END :: (Num a) => a
c'LZMA_NO_CHECK = 2
c'LZMA_NO_CHECK :: (Num a) => a
c'LZMA_UNSUPPORTED_CHECK = 3
c'LZMA_UNSUPPORTED_CHECK :: (Num a) => a
c'LZMA_GET_CHECK = 4
c'LZMA_GET_CHECK :: (Num a) => a
c'LZMA_MEM_ERROR = 5
c'LZMA_MEM_ERROR :: (Num a) => a
c'LZMA_MEMLIMIT_ERROR = 6
c'LZMA_MEMLIMIT_ERROR :: (Num a) => a
c'LZMA_FORMAT_ERROR = 7
c'LZMA_FORMAT_ERROR :: (Num a) => a
c'LZMA_OPTIONS_ERROR = 8
c'LZMA_OPTIONS_ERROR :: (Num a) => a
c'LZMA_DATA_ERROR = 9
c'LZMA_DATA_ERROR :: (Num a) => a
c'LZMA_BUF_ERROR = 10
c'LZMA_BUF_ERROR :: (Num a) => a
c'LZMA_PROG_ERROR = 11
c'LZMA_PROG_ERROR :: (Num a) => a
type C'lzma_action = CUInt
c'LZMA_RUN = 0
c'LZMA_RUN :: (Num a) => a
c'LZMA_SYNC_FLUSH = 1
c'LZMA_SYNC_FLUSH :: (Num a) => a
c'LZMA_FULL_FLUSH = 2
c'LZMA_FULL_FLUSH :: (Num a) => a
c'LZMA_FINISH = 3
c'LZMA_FINISH :: (Num a) => a
c'LZMA_TELL_NO_CHECK = 1
c'LZMA_TELL_NO_CHECK :: (Num a) => a
c'LZMA_TELL_UNSUPPORTED_CHECK = 2
c'LZMA_TELL_UNSUPPORTED_CHECK :: (Num a) => a
c'LZMA_TELL_ANY_CHECK = 4
c'LZMA_TELL_ANY_CHECK :: (Num a) => a
c'LZMA_CONCATENATED = 8
c'LZMA_CONCATENATED :: (Num a) => a
type C'lzma_check = CUInt
c'LZMA_CHECK_NONE = 0
c'LZMA_CHECK_NONE :: (Num a) => a
c'LZMA_CHECK_CRC32 = 1
c'LZMA_CHECK_CRC32 :: (Num a) => a
c'LZMA_CHECK_CRC64 = 4
c'LZMA_CHECK_CRC64 :: (Num a) => a
c'LZMA_CHECK_SHA256 = 10
c'LZMA_CHECK_SHA256 :: (Num a) => a
c'LZMA_PRESET_DEFAULT = 6
c'LZMA_PRESET_DEFAULT :: (Num a) => a
c'LZMA_PRESET_LEVEL_MASK = 31
c'LZMA_PRESET_LEVEL_MASK :: (Num a) => a
c'LZMA_PRESET_EXTREME = 2147483648
c'LZMA_PRESET_EXTREME :: (Num a) => a
data C'lzma_stream = C'lzma_stream{
c'lzma_stream'next_in :: Ptr CUChar,
c'lzma_stream'avail_in :: CSize,
c'lzma_stream'total_in :: CULong,
c'lzma_stream'next_out :: Ptr CUChar,
c'lzma_stream'avail_out :: CSize,
c'lzma_stream'total_out :: CULong
} deriving (Eq,Show)
p'lzma_stream'next_in p = plusPtr p 0
p'lzma_stream'next_in :: Ptr (C'lzma_stream) -> Ptr (Ptr CUChar)
p'lzma_stream'avail_in p = plusPtr p 8
p'lzma_stream'avail_in :: Ptr (C'lzma_stream) -> Ptr (CSize)
p'lzma_stream'total_in p = plusPtr p 16
p'lzma_stream'total_in :: Ptr (C'lzma_stream) -> Ptr (CULong)
p'lzma_stream'next_out p = plusPtr p 24
p'lzma_stream'next_out :: Ptr (C'lzma_stream) -> Ptr (Ptr CUChar)
p'lzma_stream'avail_out p = plusPtr p 32
p'lzma_stream'avail_out :: Ptr (C'lzma_stream) -> Ptr (CSize)
p'lzma_stream'total_out p = plusPtr p 40
p'lzma_stream'total_out :: Ptr (C'lzma_stream) -> Ptr (CULong)
instance Storable C'lzma_stream where
sizeOf _ = 136
alignment _ = 8
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 8
v2 <- peekByteOff p 16
v3 <- peekByteOff p 24
v4 <- peekByteOff p 32
v5 <- peekByteOff p 40
return $ C'lzma_stream v0 v1 v2 v3 v4 v5
poke p (C'lzma_stream v0 v1 v2 v3 v4 v5) = do
pokeByteOff p 0 v0
pokeByteOff p 8 v1
pokeByteOff p 16 v2
pokeByteOff p 24 v3
pokeByteOff p 32 v4
pokeByteOff p 40 v5
return ()
foreign import ccall "lzma_code" c'lzma_code
:: Ptr C'lzma_stream -> C'lzma_action -> IO C'lzma_ret
foreign import ccall "&lzma_code" p'lzma_code
:: FunPtr (Ptr C'lzma_stream -> C'lzma_action -> IO C'lzma_ret)
foreign import ccall "lzma_end" c'lzma_end
:: Ptr C'lzma_stream -> IO ()
foreign import ccall "&lzma_end" p'lzma_end
:: FunPtr (Ptr C'lzma_stream -> IO ())
foreign import ccall "lzma_memusage" c'lzma_memusage
:: Ptr C'lzma_stream -> IO CULong
foreign import ccall "&lzma_memusage" p'lzma_memusage
:: FunPtr (Ptr C'lzma_stream -> IO CULong)
foreign import ccall "lzma_memlimit_get" c'lzma_memlimit_get
:: Ptr C'lzma_stream -> IO CULong
foreign import ccall "&lzma_memlimit_get" p'lzma_memlimit_get
:: FunPtr (Ptr C'lzma_stream -> IO CULong)
foreign import ccall "lzma_memlimit_set" c'lzma_memlimit_set
:: Ptr C'lzma_stream -> CULong -> IO C'lzma_ret
foreign import ccall "&lzma_memlimit_set" p'lzma_memlimit_set
:: FunPtr (Ptr C'lzma_stream -> CULong -> IO C'lzma_ret)
foreign import ccall "lzma_easy_encoder_memusage" c'lzma_easy_encoder_memusage
:: CInt -> IO CULong
foreign import ccall "&lzma_easy_encoder_memusage" p'lzma_easy_encoder_memusage
:: FunPtr (CInt -> IO CULong)
foreign import ccall "lzma_easy_decoder_memusage" c'lzma_easy_decoder_memusage
:: CInt -> IO CULong
foreign import ccall "&lzma_easy_decoder_memusage" p'lzma_easy_decoder_memusage
:: FunPtr (CInt -> IO CULong)
foreign import ccall "lzma_easy_encoder" c'lzma_easy_encoder
:: Ptr C'lzma_stream -> CInt -> C'lzma_check -> IO C'lzma_ret
foreign import ccall "&lzma_easy_encoder" p'lzma_easy_encoder
:: FunPtr (Ptr C'lzma_stream -> CInt -> C'lzma_check -> IO C'lzma_ret)
foreign import ccall "lzma_auto_decoder" c'lzma_auto_decoder
:: Ptr C'lzma_stream -> CULong -> CUInt -> IO C'lzma_ret
foreign import ccall "&lzma_auto_decoder" p'lzma_auto_decoder
:: FunPtr (Ptr C'lzma_stream -> CULong -> CUInt -> IO C'lzma_ret)
pokeNextIn :: Ptr C'lzma_stream -> Ptr a -> IO ()
pokeNextIn = (\hsc_ptr -> pokeByteOff hsc_ptr 0)
pokeAvailIn :: Ptr C'lzma_stream -> CSize -> IO ()
pokeAvailIn = (\hsc_ptr -> pokeByteOff hsc_ptr 8)
pokeNextOut :: Ptr C'lzma_stream -> Ptr a -> IO ()
pokeNextOut = (\hsc_ptr -> pokeByteOff hsc_ptr 24)
pokeAvailOut :: Ptr C'lzma_stream -> CSize -> IO ()
pokeAvailOut = (\hsc_ptr -> pokeByteOff hsc_ptr 32)
peekNextIn :: Ptr C'lzma_stream -> IO (Ptr a)
peekNextIn = (\hsc_ptr -> peekByteOff hsc_ptr 0)
peekAvailIn :: Ptr C'lzma_stream -> IO CSize
peekAvailIn = (\hsc_ptr -> peekByteOff hsc_ptr 8)
peekNextOut :: Ptr C'lzma_stream -> IO (Ptr a)
peekNextOut = (\hsc_ptr -> peekByteOff hsc_ptr 24)
peekAvailOut :: Ptr C'lzma_stream -> IO CSize
peekAvailOut = (\hsc_ptr -> peekByteOff hsc_ptr 32)