{-# LINE 1 "src/Bindings/Lzma.hsc" #-}

{-# LINE 2 "src/Bindings/Lzma.hsc" #-}

{-# LINE 3 "src/Bindings/Lzma.hsc" #-}

{-# LINE 4 "src/Bindings/Lzma.hsc" #-}

{-# LINE 5 "src/Bindings/Lzma.hsc" #-}

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

{-# LINE 8 "src/Bindings/Lzma.hsc" #-}

-- lzma_ret
type C'lzma_ret = CUInt

{-# LINE 11 "src/Bindings/Lzma.hsc" #-}
c'LZMA_OK = 0
c'LZMA_OK :: (Num a) => a

{-# LINE 12 "src/Bindings/Lzma.hsc" #-}
c'LZMA_STREAM_END = 1
c'LZMA_STREAM_END :: (Num a) => a

{-# LINE 13 "src/Bindings/Lzma.hsc" #-}
c'LZMA_NO_CHECK = 2
c'LZMA_NO_CHECK :: (Num a) => a

{-# LINE 14 "src/Bindings/Lzma.hsc" #-}
c'LZMA_UNSUPPORTED_CHECK = 3
c'LZMA_UNSUPPORTED_CHECK :: (Num a) => a

{-# LINE 15 "src/Bindings/Lzma.hsc" #-}
c'LZMA_GET_CHECK = 4
c'LZMA_GET_CHECK :: (Num a) => a

{-# LINE 16 "src/Bindings/Lzma.hsc" #-}
c'LZMA_MEM_ERROR = 5
c'LZMA_MEM_ERROR :: (Num a) => a

{-# LINE 17 "src/Bindings/Lzma.hsc" #-}
c'LZMA_MEMLIMIT_ERROR = 6
c'LZMA_MEMLIMIT_ERROR :: (Num a) => a

{-# LINE 18 "src/Bindings/Lzma.hsc" #-}
c'LZMA_FORMAT_ERROR = 7
c'LZMA_FORMAT_ERROR :: (Num a) => a

{-# LINE 19 "src/Bindings/Lzma.hsc" #-}
c'LZMA_OPTIONS_ERROR = 8
c'LZMA_OPTIONS_ERROR :: (Num a) => a

{-# LINE 20 "src/Bindings/Lzma.hsc" #-}
c'LZMA_DATA_ERROR = 9
c'LZMA_DATA_ERROR :: (Num a) => a

{-# LINE 21 "src/Bindings/Lzma.hsc" #-}
c'LZMA_BUF_ERROR = 10
c'LZMA_BUF_ERROR :: (Num a) => a

{-# LINE 22 "src/Bindings/Lzma.hsc" #-}
c'LZMA_PROG_ERROR = 11
c'LZMA_PROG_ERROR :: (Num a) => a

{-# LINE 23 "src/Bindings/Lzma.hsc" #-}

-- lzma_action
type C'lzma_action = CUInt

{-# LINE 26 "src/Bindings/Lzma.hsc" #-}
c'LZMA_RUN = 0
c'LZMA_RUN :: (Num a) => a

{-# LINE 27 "src/Bindings/Lzma.hsc" #-}
c'LZMA_SYNC_FLUSH = 1
c'LZMA_SYNC_FLUSH :: (Num a) => a

{-# LINE 28 "src/Bindings/Lzma.hsc" #-}
c'LZMA_FULL_FLUSH = 2
c'LZMA_FULL_FLUSH :: (Num a) => a

{-# LINE 29 "src/Bindings/Lzma.hsc" #-}
c'LZMA_FINISH = 3
c'LZMA_FINISH :: (Num a) => a

{-# LINE 30 "src/Bindings/Lzma.hsc" #-}

-- lzma_flags
c'LZMA_TELL_NO_CHECK = 1
c'LZMA_TELL_NO_CHECK :: (Num a) => a

{-# LINE 33 "src/Bindings/Lzma.hsc" #-}
c'LZMA_TELL_UNSUPPORTED_CHECK = 2
c'LZMA_TELL_UNSUPPORTED_CHECK :: (Num a) => a

{-# LINE 34 "src/Bindings/Lzma.hsc" #-}
c'LZMA_TELL_ANY_CHECK = 4
c'LZMA_TELL_ANY_CHECK :: (Num a) => a

{-# LINE 35 "src/Bindings/Lzma.hsc" #-}
c'LZMA_CONCATENATED = 8
c'LZMA_CONCATENATED :: (Num a) => a

{-# LINE 36 "src/Bindings/Lzma.hsc" #-}

-- lzma_check
type C'lzma_check = CUInt

{-# LINE 39 "src/Bindings/Lzma.hsc" #-}
c'LZMA_CHECK_NONE = 0
c'LZMA_CHECK_NONE :: (Num a) => a

{-# LINE 40 "src/Bindings/Lzma.hsc" #-}
c'LZMA_CHECK_CRC32 = 1
c'LZMA_CHECK_CRC32 :: (Num a) => a

{-# LINE 41 "src/Bindings/Lzma.hsc" #-}
c'LZMA_CHECK_CRC64 = 4
c'LZMA_CHECK_CRC64 :: (Num a) => a

{-# LINE 42 "src/Bindings/Lzma.hsc" #-}
c'LZMA_CHECK_SHA256 = 10
c'LZMA_CHECK_SHA256 :: (Num a) => a

{-# LINE 43 "src/Bindings/Lzma.hsc" #-}

c'LZMA_PRESET_DEFAULT = 6
c'LZMA_PRESET_DEFAULT :: (Num a) => a

{-# LINE 45 "src/Bindings/Lzma.hsc" #-}
c'LZMA_PRESET_LEVEL_MASK = 31
c'LZMA_PRESET_LEVEL_MASK :: (Num a) => a

{-# LINE 46 "src/Bindings/Lzma.hsc" #-}
c'LZMA_PRESET_EXTREME = 2147483648
c'LZMA_PRESET_EXTREME :: (Num a) => a

{-# LINE 47 "src/Bindings/Lzma.hsc" #-}

-- lzma_stream

{-# LINE 50 "src/Bindings/Lzma.hsc" #-}

{-# LINE 51 "src/Bindings/Lzma.hsc" #-}

{-# LINE 52 "src/Bindings/Lzma.hsc" #-}

{-# LINE 53 "src/Bindings/Lzma.hsc" #-}

{-# LINE 54 "src/Bindings/Lzma.hsc" #-}

{-# LINE 55 "src/Bindings/Lzma.hsc" #-}

{-# LINE 56 "src/Bindings/Lzma.hsc" #-}
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 ()

{-# LINE 57 "src/Bindings/Lzma.hsc" #-}

-- figure out what to put here?
-- #cinline LZMA_STREAM_INIT , IO <lzma_stream>

-- base.h
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)

{-# LINE 63 "src/Bindings/Lzma.hsc" #-}
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 ())

{-# LINE 64 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 65 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 66 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 67 "src/Bindings/Lzma.hsc" #-}

-- container.h
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)

{-# LINE 70 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 71 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 72 "src/Bindings/Lzma.hsc" #-}
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)

{-# LINE 73 "src/Bindings/Lzma.hsc" #-}

pokeNextIn :: Ptr C'lzma_stream -> Ptr a -> IO ()
pokeNextIn = (\hsc_ptr -> pokeByteOff hsc_ptr 0)
{-# LINE 76 "src/Bindings/Lzma.hsc" #-}

pokeAvailIn :: Ptr C'lzma_stream -> CSize -> IO ()
pokeAvailIn = (\hsc_ptr -> pokeByteOff hsc_ptr 8)
{-# LINE 79 "src/Bindings/Lzma.hsc" #-}

pokeNextOut :: Ptr C'lzma_stream -> Ptr a -> IO ()
pokeNextOut = (\hsc_ptr -> pokeByteOff hsc_ptr 24)
{-# LINE 82 "src/Bindings/Lzma.hsc" #-}

pokeAvailOut :: Ptr C'lzma_stream -> CSize -> IO ()
pokeAvailOut = (\hsc_ptr -> pokeByteOff hsc_ptr 32)
{-# LINE 85 "src/Bindings/Lzma.hsc" #-}

peekNextIn :: Ptr C'lzma_stream -> IO (Ptr a)
peekNextIn = (\hsc_ptr -> peekByteOff hsc_ptr 0)
{-# LINE 88 "src/Bindings/Lzma.hsc" #-}

peekAvailIn :: Ptr C'lzma_stream -> IO CSize
peekAvailIn = (\hsc_ptr -> peekByteOff hsc_ptr 8)
{-# LINE 91 "src/Bindings/Lzma.hsc" #-}

peekNextOut :: Ptr C'lzma_stream -> IO (Ptr a)
peekNextOut = (\hsc_ptr -> peekByteOff hsc_ptr 24)
{-# LINE 94 "src/Bindings/Lzma.hsc" #-}

peekAvailOut :: Ptr C'lzma_stream -> IO CSize
peekAvailOut = (\hsc_ptr -> peekByteOff hsc_ptr 32)
{-# LINE 97 "src/Bindings/Lzma.hsc" #-}