module Bindings.Libgit2.OdbBackend where
import Foreign.Ptr
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
import Bindings.Libgit2.Common
import Bindings.Libgit2.Types
import Bindings.Libgit2.Oid
import Bindings.Libgit2.Indexer
type C'git_odb_foreach_cb = FunPtr (Ptr (C'git_oid) -> Ptr () -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_foreach_cb
:: (Ptr (C'git_oid) -> Ptr () -> IO CInt) -> IO C'git_odb_foreach_cb
foreign import ccall "dynamic" mK'git_odb_foreach_cb
:: C'git_odb_foreach_cb -> (Ptr (C'git_oid) -> Ptr () -> IO CInt)
type C'git_odb_backend_read_callback = FunPtr (Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_read_callback
:: (Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt) -> IO C'git_odb_backend_read_callback
foreign import ccall "dynamic" mK'git_odb_backend_read_callback
:: C'git_odb_backend_read_callback -> (Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
type C'git_odb_backend_read_prefix_callback = FunPtr (Ptr C'git_oid -> Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> CSize -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_read_prefix_callback
:: (Ptr C'git_oid -> Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> CSize -> IO CInt) -> IO C'git_odb_backend_read_prefix_callback
foreign import ccall "dynamic" mK'git_odb_backend_read_prefix_callback
:: C'git_odb_backend_read_prefix_callback -> (Ptr C'git_oid -> Ptr (Ptr ()) -> Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> CSize -> IO CInt)
type C'git_odb_backend_read_header_callback = FunPtr (Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_read_header_callback
:: (Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt) -> IO C'git_odb_backend_read_header_callback
foreign import ccall "dynamic" mK'git_odb_backend_read_header_callback
:: C'git_odb_backend_read_header_callback -> (Ptr CSize -> Ptr C'git_otype -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
type C'git_odb_backend_write_callback = FunPtr (Ptr C'git_oid -> Ptr C'git_odb_backend -> Ptr () -> CSize -> C'git_otype -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_write_callback
:: (Ptr C'git_oid -> Ptr C'git_odb_backend -> Ptr () -> CSize -> C'git_otype -> IO CInt) -> IO C'git_odb_backend_write_callback
foreign import ccall "dynamic" mK'git_odb_backend_write_callback
:: C'git_odb_backend_write_callback -> (Ptr C'git_oid -> Ptr C'git_odb_backend -> Ptr () -> CSize -> C'git_otype -> IO CInt)
type C'git_odb_backend_writestream_callback = FunPtr (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> CSize -> C'git_otype -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_writestream_callback
:: (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> CSize -> C'git_otype -> IO CInt) -> IO C'git_odb_backend_writestream_callback
foreign import ccall "dynamic" mK'git_odb_backend_writestream_callback
:: C'git_odb_backend_writestream_callback -> (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> CSize -> C'git_otype -> IO CInt)
type C'git_odb_backend_readstream_callback = FunPtr (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_readstream_callback
:: (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt) -> IO C'git_odb_backend_readstream_callback
foreign import ccall "dynamic" mK'git_odb_backend_readstream_callback
:: C'git_odb_backend_readstream_callback -> (Ptr (Ptr C'git_odb_stream) -> Ptr C'git_odb_backend -> Ptr C'git_oid -> IO CInt)
type C'git_odb_backend_exists_callback = FunPtr (Ptr C'git_odb_backend -> Ptr C'git_oid -> CInt -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_exists_callback
:: (Ptr C'git_odb_backend -> Ptr C'git_oid -> CInt -> IO CInt) -> IO C'git_odb_backend_exists_callback
foreign import ccall "dynamic" mK'git_odb_backend_exists_callback
:: C'git_odb_backend_exists_callback -> (Ptr C'git_odb_backend -> Ptr C'git_oid -> CInt -> IO CInt)
type C'git_odb_backend_refresh_callback = FunPtr (Ptr C'git_odb_backend -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_refresh_callback
:: (Ptr C'git_odb_backend -> IO CInt) -> IO C'git_odb_backend_refresh_callback
foreign import ccall "dynamic" mK'git_odb_backend_refresh_callback
:: C'git_odb_backend_refresh_callback -> (Ptr C'git_odb_backend -> IO CInt)
type C'git_odb_backend_foreach_callback = FunPtr (Ptr C'git_odb_backend -> C'git_odb_foreach_cb -> Ptr () -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_foreach_callback
:: (Ptr C'git_odb_backend -> C'git_odb_foreach_cb -> Ptr () -> IO CInt) -> IO C'git_odb_backend_foreach_callback
foreign import ccall "dynamic" mK'git_odb_backend_foreach_callback
:: C'git_odb_backend_foreach_callback -> (Ptr C'git_odb_backend -> C'git_odb_foreach_cb -> Ptr () -> IO CInt)
type C'git_odb_backend_writepack_callback = FunPtr (Ptr (Ptr C'git_odb_writepack) -> Ptr C'git_odb_backend -> C'git_transfer_progress_callback -> Ptr () -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_backend_writepack_callback
:: (Ptr (Ptr C'git_odb_writepack) -> Ptr C'git_odb_backend -> C'git_transfer_progress_callback -> Ptr () -> IO CInt) -> IO C'git_odb_backend_writepack_callback
foreign import ccall "dynamic" mK'git_odb_backend_writepack_callback
:: C'git_odb_backend_writepack_callback -> (Ptr (Ptr C'git_odb_writepack) -> Ptr C'git_odb_backend -> C'git_transfer_progress_callback -> Ptr () -> IO CInt)
type C'git_odb_backend_free_callback = FunPtr (Ptr C'git_odb_backend -> IO ())
foreign import ccall "wrapper" mk'git_odb_backend_free_callback
:: (Ptr C'git_odb_backend -> IO ()) -> IO C'git_odb_backend_free_callback
foreign import ccall "dynamic" mK'git_odb_backend_free_callback
:: C'git_odb_backend_free_callback -> (Ptr C'git_odb_backend -> IO ())
data C'git_odb_backend = C'git_odb_backend{
c'git_odb_backend'version :: CUInt,
c'git_odb_backend'odb :: Ptr C'git_odb,
c'git_odb_backend'read :: C'git_odb_backend_read_callback,
c'git_odb_backend'read_prefix :: C'git_odb_backend_read_prefix_callback,
c'git_odb_backend'read_header :: C'git_odb_backend_read_header_callback,
c'git_odb_backend'write :: C'git_odb_backend_write_callback,
c'git_odb_backend'writestream :: C'git_odb_backend_writestream_callback,
c'git_odb_backend'readstream :: C'git_odb_backend_readstream_callback,
c'git_odb_backend'exists :: C'git_odb_backend_exists_callback,
c'git_odb_backend'refresh :: C'git_odb_backend_refresh_callback,
c'git_odb_backend'foreach :: C'git_odb_backend_foreach_callback,
c'git_odb_backend'writepack :: C'git_odb_backend_writepack_callback,
c'git_odb_backend'free :: C'git_odb_backend_free_callback
} deriving (Eq,Show)
p'git_odb_backend'version p = plusPtr p 0
p'git_odb_backend'version :: Ptr (C'git_odb_backend) -> Ptr (CUInt)
p'git_odb_backend'odb p = plusPtr p 8
p'git_odb_backend'odb :: Ptr (C'git_odb_backend) -> Ptr (Ptr C'git_odb)
p'git_odb_backend'read p = plusPtr p 16
p'git_odb_backend'read :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_read_callback)
p'git_odb_backend'read_prefix p = plusPtr p 24
p'git_odb_backend'read_prefix :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_read_prefix_callback)
p'git_odb_backend'read_header p = plusPtr p 32
p'git_odb_backend'read_header :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_read_header_callback)
p'git_odb_backend'write p = plusPtr p 40
p'git_odb_backend'write :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_write_callback)
p'git_odb_backend'writestream p = plusPtr p 48
p'git_odb_backend'writestream :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_writestream_callback)
p'git_odb_backend'readstream p = plusPtr p 56
p'git_odb_backend'readstream :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_readstream_callback)
p'git_odb_backend'exists p = plusPtr p 64
p'git_odb_backend'exists :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_exists_callback)
p'git_odb_backend'refresh p = plusPtr p 72
p'git_odb_backend'refresh :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_refresh_callback)
p'git_odb_backend'foreach p = plusPtr p 80
p'git_odb_backend'foreach :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_foreach_callback)
p'git_odb_backend'writepack p = plusPtr p 88
p'git_odb_backend'writepack :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_writepack_callback)
p'git_odb_backend'free p = plusPtr p 96
p'git_odb_backend'free :: Ptr (C'git_odb_backend) -> Ptr (C'git_odb_backend_free_callback)
instance Storable C'git_odb_backend where
sizeOf _ = 104
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
v6 <- peekByteOff p 48
v7 <- peekByteOff p 56
v8 <- peekByteOff p 64
v9 <- peekByteOff p 72
v10 <- peekByteOff p 80
v11 <- peekByteOff p 88
v12 <- peekByteOff p 96
return $ C'git_odb_backend v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12
poke p (C'git_odb_backend v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12) = 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
pokeByteOff p 48 v6
pokeByteOff p 56 v7
pokeByteOff p 64 v8
pokeByteOff p 72 v9
pokeByteOff p 80 v10
pokeByteOff p 88 v11
pokeByteOff p 96 v12
return ()
c'GIT_STREAM_RDONLY = 2
c'GIT_STREAM_RDONLY :: (Num a) => a
c'GIT_STREAM_WRONLY = 4
c'GIT_STREAM_WRONLY :: (Num a) => a
c'GIT_STREAM_RW = 6
c'GIT_STREAM_RW :: (Num a) => a
type C'git_odb_stream_read_callback = FunPtr (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_stream_read_callback
:: (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt) -> IO C'git_odb_stream_read_callback
foreign import ccall "dynamic" mK'git_odb_stream_read_callback
:: C'git_odb_stream_read_callback -> (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt)
type C'git_odb_stream_write_callback = FunPtr (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_stream_write_callback
:: (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt) -> IO C'git_odb_stream_write_callback
foreign import ccall "dynamic" mK'git_odb_stream_write_callback
:: C'git_odb_stream_write_callback -> (Ptr C'git_odb_stream -> CString -> CSize -> IO CInt)
type C'git_odb_stream_finalize_write_callback = FunPtr (Ptr C'git_oid -> Ptr C'git_odb_stream -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_stream_finalize_write_callback
:: (Ptr C'git_oid -> Ptr C'git_odb_stream -> IO CInt) -> IO C'git_odb_stream_finalize_write_callback
foreign import ccall "dynamic" mK'git_odb_stream_finalize_write_callback
:: C'git_odb_stream_finalize_write_callback -> (Ptr C'git_oid -> Ptr C'git_odb_stream -> IO CInt)
type C'git_odb_stream_free_callback = FunPtr (Ptr C'git_odb_stream -> IO ())
foreign import ccall "wrapper" mk'git_odb_stream_free_callback
:: (Ptr C'git_odb_stream -> IO ()) -> IO C'git_odb_stream_free_callback
foreign import ccall "dynamic" mK'git_odb_stream_free_callback
:: C'git_odb_stream_free_callback -> (Ptr C'git_odb_stream -> IO ())
data C'git_odb_stream = C'git_odb_stream{
c'git_odb_stream'backend :: Ptr C'git_odb_backend,
c'git_odb_stream'mode :: CUInt,
c'git_odb_stream'read :: C'git_odb_stream_read_callback,
c'git_odb_stream'write :: C'git_odb_stream_write_callback,
c'git_odb_stream'finalize_write :: C'git_odb_stream_finalize_write_callback,
c'git_odb_stream'free :: C'git_odb_stream_free_callback
} deriving (Eq,Show)
p'git_odb_stream'backend p = plusPtr p 0
p'git_odb_stream'backend :: Ptr (C'git_odb_stream) -> Ptr (Ptr C'git_odb_backend)
p'git_odb_stream'mode p = plusPtr p 8
p'git_odb_stream'mode :: Ptr (C'git_odb_stream) -> Ptr (CUInt)
p'git_odb_stream'read p = plusPtr p 16
p'git_odb_stream'read :: Ptr (C'git_odb_stream) -> Ptr (C'git_odb_stream_read_callback)
p'git_odb_stream'write p = plusPtr p 24
p'git_odb_stream'write :: Ptr (C'git_odb_stream) -> Ptr (C'git_odb_stream_write_callback)
p'git_odb_stream'finalize_write p = plusPtr p 32
p'git_odb_stream'finalize_write :: Ptr (C'git_odb_stream) -> Ptr (C'git_odb_stream_finalize_write_callback)
p'git_odb_stream'free p = plusPtr p 40
p'git_odb_stream'free :: Ptr (C'git_odb_stream) -> Ptr (C'git_odb_stream_free_callback)
instance Storable C'git_odb_stream where
sizeOf _ = 48
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'git_odb_stream v0 v1 v2 v3 v4 v5
poke p (C'git_odb_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 ()
type C'git_odb_writepack_add_callback = FunPtr (Ptr C'git_odb_writepack -> Ptr () -> CSize -> Ptr C'git_transfer_progress -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_writepack_add_callback
:: (Ptr C'git_odb_writepack -> Ptr () -> CSize -> Ptr C'git_transfer_progress -> IO CInt) -> IO C'git_odb_writepack_add_callback
foreign import ccall "dynamic" mK'git_odb_writepack_add_callback
:: C'git_odb_writepack_add_callback -> (Ptr C'git_odb_writepack -> Ptr () -> CSize -> Ptr C'git_transfer_progress -> IO CInt)
type C'git_odb_writepack_commit_callback = FunPtr (Ptr C'git_odb_writepack -> Ptr C'git_transfer_progress -> IO CInt)
foreign import ccall "wrapper" mk'git_odb_writepack_commit_callback
:: (Ptr C'git_odb_writepack -> Ptr C'git_transfer_progress -> IO CInt) -> IO C'git_odb_writepack_commit_callback
foreign import ccall "dynamic" mK'git_odb_writepack_commit_callback
:: C'git_odb_writepack_commit_callback -> (Ptr C'git_odb_writepack -> Ptr C'git_transfer_progress -> IO CInt)
type C'git_odb_writepack_free_callback = FunPtr (Ptr C'git_odb_writepack -> IO ())
foreign import ccall "wrapper" mk'git_odb_writepack_free_callback
:: (Ptr C'git_odb_writepack -> IO ()) -> IO C'git_odb_writepack_free_callback
foreign import ccall "dynamic" mK'git_odb_writepack_free_callback
:: C'git_odb_writepack_free_callback -> (Ptr C'git_odb_writepack -> IO ())
data C'git_odb_writepack = C'git_odb_writepack{
c'git_odb_writepack'backend :: Ptr C'git_odb_backend,
c'git_odb_writepack'add :: C'git_odb_writepack_add_callback,
c'git_odb_writepack'commit :: C'git_odb_writepack_commit_callback,
c'git_odb_writepack'free :: C'git_odb_writepack_free_callback
} deriving (Eq,Show)
p'git_odb_writepack'backend p = plusPtr p 0
p'git_odb_writepack'backend :: Ptr (C'git_odb_writepack) -> Ptr (Ptr C'git_odb_backend)
p'git_odb_writepack'add p = plusPtr p 8
p'git_odb_writepack'add :: Ptr (C'git_odb_writepack) -> Ptr (C'git_odb_writepack_add_callback)
p'git_odb_writepack'commit p = plusPtr p 16
p'git_odb_writepack'commit :: Ptr (C'git_odb_writepack) -> Ptr (C'git_odb_writepack_commit_callback)
p'git_odb_writepack'free p = plusPtr p 24
p'git_odb_writepack'free :: Ptr (C'git_odb_writepack) -> Ptr (C'git_odb_writepack_free_callback)
instance Storable C'git_odb_writepack where
sizeOf _ = 32
alignment _ = 8
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 8
v2 <- peekByteOff p 16
v3 <- peekByteOff p 24
return $ C'git_odb_writepack v0 v1 v2 v3
poke p (C'git_odb_writepack v0 v1 v2 v3) = do
pokeByteOff p 0 v0
pokeByteOff p 8 v1
pokeByteOff p 16 v2
pokeByteOff p 24 v3
return ()
foreign import ccall "git_odb_backend_malloc" c'git_odb_backend_malloc
:: Ptr C'git_odb_backend -> CSize -> IO (Ptr ())
foreign import ccall "&git_odb_backend_malloc" p'git_odb_backend_malloc
:: FunPtr (Ptr C'git_odb_backend -> CSize -> IO (Ptr ()))
foreign import ccall "git_odb_backend_pack" c'git_odb_backend_pack
:: Ptr (Ptr C'git_odb_backend) -> CString -> IO (CInt)
foreign import ccall "&git_odb_backend_pack" p'git_odb_backend_pack
:: FunPtr (Ptr (Ptr C'git_odb_backend) -> CString -> IO (CInt))
foreign import ccall "git_odb_backend_loose" c'git_odb_backend_loose
:: Ptr (Ptr C'git_odb_backend) -> CString -> CInt -> CInt -> IO (CInt)
foreign import ccall "&git_odb_backend_loose" p'git_odb_backend_loose
:: FunPtr (Ptr (Ptr C'git_odb_backend) -> CString -> CInt -> CInt -> IO (CInt))
foreign import ccall "git_odb_backend_one_pack" c'git_odb_backend_one_pack
:: Ptr (Ptr C'git_odb_backend) -> CString -> IO (CInt)
foreign import ccall "&git_odb_backend_one_pack" p'git_odb_backend_one_pack
:: FunPtr (Ptr (Ptr C'git_odb_backend) -> CString -> IO (CInt))