module Bindings.Libgit2.Errors 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
c'GIT_OK = 0
c'GIT_OK :: (Num a) => a
c'GIT_ERROR = 1
c'GIT_ERROR :: (Num a) => a
c'GIT_ENOTFOUND = 3
c'GIT_ENOTFOUND :: (Num a) => a
c'GIT_EEXISTS = 4
c'GIT_EEXISTS :: (Num a) => a
c'GIT_EAMBIGUOUS = 5
c'GIT_EAMBIGUOUS :: (Num a) => a
c'GIT_EBUFS = 6
c'GIT_EBUFS :: (Num a) => a
c'GIT_EUSER = 7
c'GIT_EUSER :: (Num a) => a
c'GIT_EBAREREPO = 8
c'GIT_EBAREREPO :: (Num a) => a
c'GIT_EORPHANEDHEAD = 9
c'GIT_EORPHANEDHEAD :: (Num a) => a
c'GIT_EUNMERGED = 10
c'GIT_EUNMERGED :: (Num a) => a
c'GIT_ENONFASTFORWARD = 11
c'GIT_ENONFASTFORWARD :: (Num a) => a
c'GIT_EINVALIDSPEC = 12
c'GIT_EINVALIDSPEC :: (Num a) => a
c'GIT_EMERGECONFLICT = 13
c'GIT_EMERGECONFLICT :: (Num a) => a
c'GIT_PASSTHROUGH = 30
c'GIT_PASSTHROUGH :: (Num a) => a
c'GIT_ITEROVER = 31
c'GIT_ITEROVER :: (Num a) => a
data C'git_error = C'git_error{
c'git_error'message :: CString,
c'git_error'klass :: CInt
} deriving (Eq,Show)
p'git_error'message p = plusPtr p 0
p'git_error'message :: Ptr (C'git_error) -> Ptr (CString)
p'git_error'klass p = plusPtr p 8
p'git_error'klass :: Ptr (C'git_error) -> Ptr (CInt)
instance Storable C'git_error where
sizeOf _ = 16
alignment _ = 8
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 8
return $ C'git_error v0 v1
poke p (C'git_error v0 v1) = do
pokeByteOff p 0 v0
pokeByteOff p 8 v1
return ()
type C'git_error_t = CUInt
c'GITERR_NOMEMORY = 0
c'GITERR_NOMEMORY :: (Num a) => a
c'GITERR_OS = 1
c'GITERR_OS :: (Num a) => a
c'GITERR_INVALID = 2
c'GITERR_INVALID :: (Num a) => a
c'GITERR_REFERENCE = 3
c'GITERR_REFERENCE :: (Num a) => a
c'GITERR_ZLIB = 4
c'GITERR_ZLIB :: (Num a) => a
c'GITERR_REPOSITORY = 5
c'GITERR_REPOSITORY :: (Num a) => a
c'GITERR_CONFIG = 6
c'GITERR_CONFIG :: (Num a) => a
c'GITERR_REGEX = 7
c'GITERR_REGEX :: (Num a) => a
c'GITERR_ODB = 8
c'GITERR_ODB :: (Num a) => a
c'GITERR_INDEX = 9
c'GITERR_INDEX :: (Num a) => a
c'GITERR_OBJECT = 10
c'GITERR_OBJECT :: (Num a) => a
c'GITERR_NET = 11
c'GITERR_NET :: (Num a) => a
c'GITERR_TAG = 12
c'GITERR_TAG :: (Num a) => a
c'GITERR_TREE = 13
c'GITERR_TREE :: (Num a) => a
c'GITERR_INDEXER = 14
c'GITERR_INDEXER :: (Num a) => a
c'GITERR_SSL = 15
c'GITERR_SSL :: (Num a) => a
c'GITERR_SUBMODULE = 16
c'GITERR_SUBMODULE :: (Num a) => a
c'GITERR_THREAD = 17
c'GITERR_THREAD :: (Num a) => a
c'GITERR_STASH = 18
c'GITERR_STASH :: (Num a) => a
c'GITERR_CHECKOUT = 19
c'GITERR_CHECKOUT :: (Num a) => a
c'GITERR_FETCHHEAD = 20
c'GITERR_FETCHHEAD :: (Num a) => a
c'GITERR_MERGE = 21
c'GITERR_MERGE :: (Num a) => a
foreign import ccall "giterr_last" c'giterr_last
:: IO (Ptr C'git_error)
foreign import ccall "&giterr_last" p'giterr_last
:: FunPtr (IO (Ptr C'git_error))
foreign import ccall "giterr_clear" c'giterr_clear
:: IO ()
foreign import ccall "&giterr_clear" p'giterr_clear
:: FunPtr (IO ())
foreign import ccall "giterr_set_str" c'giterr_set_str
:: CInt -> CString -> IO ()
foreign import ccall "&giterr_set_str" p'giterr_set_str
:: FunPtr (CInt -> CString -> IO ())
foreign import ccall "giterr_set_oom" c'giterr_set_oom
:: IO ()
foreign import ccall "&giterr_set_oom" p'giterr_set_oom
:: FunPtr (IO ())