module Bindings.Libgit2.Oid 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
import Bindings.Libgit2.Common
import Bindings.Libgit2.Types
c'GIT_OID_RAWSZ = 20
c'GIT_OID_RAWSZ :: (Num a) => a
c'GIT_OID_HEXSZ = 40
c'GIT_OID_HEXSZ :: (Num a) => a
c'GIT_OID_MINPREFIXLEN = 4
c'GIT_OID_MINPREFIXLEN :: (Num a) => a
data C'git_oid = C'git_oid{
c'git_oid'id :: [CUChar]
} deriving (Eq,Show)
p'git_oid'id p = plusPtr p 0
p'git_oid'id :: Ptr (C'git_oid) -> Ptr (CUChar)
instance Storable C'git_oid where
sizeOf _ = 20
alignment _ = 1
peek p = do
v0 <- peekArray 20 (plusPtr p 0)
return $ C'git_oid v0
poke p (C'git_oid v0) = do
pokeArray (plusPtr p 0) (take 20 v0)
return ()
foreign import ccall "git_oid_fromstr" c'git_oid_fromstr
:: Ptr C'git_oid -> CString -> IO (CInt)
foreign import ccall "&git_oid_fromstr" p'git_oid_fromstr
:: FunPtr (Ptr C'git_oid -> CString -> IO (CInt))
foreign import ccall "git_oid_fromstrn" c'git_oid_fromstrn
:: Ptr C'git_oid -> CString -> CSize -> IO (CInt)
foreign import ccall "&git_oid_fromstrn" p'git_oid_fromstrn
:: FunPtr (Ptr C'git_oid -> CString -> CSize -> IO (CInt))
foreign import ccall "git_oid_fromraw" c'git_oid_fromraw
:: Ptr C'git_oid -> Ptr CUChar -> IO ()
foreign import ccall "&git_oid_fromraw" p'git_oid_fromraw
:: FunPtr (Ptr C'git_oid -> Ptr CUChar -> IO ())
foreign import ccall "git_oid_fmt" c'git_oid_fmt
:: CString -> Ptr C'git_oid -> IO ()
foreign import ccall "&git_oid_fmt" p'git_oid_fmt
:: FunPtr (CString -> Ptr C'git_oid -> IO ())
foreign import ccall "git_oid_pathfmt" c'git_oid_pathfmt
:: CString -> Ptr C'git_oid -> IO ()
foreign import ccall "&git_oid_pathfmt" p'git_oid_pathfmt
:: FunPtr (CString -> Ptr C'git_oid -> IO ())
foreign import ccall "git_oid_allocfmt" c'git_oid_allocfmt
:: Ptr C'git_oid -> IO (CString)
foreign import ccall "&git_oid_allocfmt" p'git_oid_allocfmt
:: FunPtr (Ptr C'git_oid -> IO (CString))
foreign import ccall "git_oid_tostr" c'git_oid_tostr
:: CString -> CSize -> Ptr C'git_oid -> IO (CString)
foreign import ccall "&git_oid_tostr" p'git_oid_tostr
:: FunPtr (CString -> CSize -> Ptr C'git_oid -> IO (CString))
foreign import ccall "git_oid_cpy" c'git_oid_cpy
:: Ptr C'git_oid -> Ptr C'git_oid -> IO ()
foreign import ccall "&git_oid_cpy" p'git_oid_cpy
:: FunPtr (Ptr C'git_oid -> Ptr C'git_oid -> IO ())
foreign import ccall "git_oid_cmp" c'git_oid_cmp
:: Ptr C'git_oid -> Ptr C'git_oid -> IO (CInt)
foreign import ccall "&git_oid_cmp" p'git_oid_cmp
:: FunPtr (Ptr C'git_oid -> Ptr C'git_oid -> IO (CInt))
foreign import ccall "git_oid_ncmp" c'git_oid_ncmp
:: Ptr C'git_oid -> Ptr C'git_oid -> CUInt -> IO (CInt)
foreign import ccall "&git_oid_ncmp" p'git_oid_ncmp
:: FunPtr (Ptr C'git_oid -> Ptr C'git_oid -> CUInt -> IO (CInt))
foreign import ccall "git_oid_streq" c'git_oid_streq
:: Ptr C'git_oid -> CString -> IO (CInt)
foreign import ccall "&git_oid_streq" p'git_oid_streq
:: FunPtr (Ptr C'git_oid -> CString -> IO (CInt))
foreign import ccall "git_oid_iszero" c'git_oid_iszero
:: Ptr C'git_oid -> IO (CInt)
foreign import ccall "&git_oid_iszero" p'git_oid_iszero
:: FunPtr (Ptr C'git_oid -> IO (CInt))
data C'git_oid_shorten = C'git_oid_shorten
foreign import ccall "git_oid_shorten_new" c'git_oid_shorten_new
:: CSize -> IO (Ptr C'git_oid_shorten)
foreign import ccall "&git_oid_shorten_new" p'git_oid_shorten_new
:: FunPtr (CSize -> IO (Ptr C'git_oid_shorten))
foreign import ccall "git_oid_shorten_add" c'git_oid_shorten_add
:: Ptr C'git_oid_shorten -> CString -> IO (CInt)
foreign import ccall "&git_oid_shorten_add" p'git_oid_shorten_add
:: FunPtr (Ptr C'git_oid_shorten -> CString -> IO (CInt))
foreign import ccall "git_oid_shorten_free" c'git_oid_shorten_free
:: Ptr C'git_oid_shorten -> IO ()
foreign import ccall "&git_oid_shorten_free" p'git_oid_shorten_free
:: FunPtr (Ptr C'git_oid_shorten -> IO ())