-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Ggit.Callbacks
    ( 

 -- * Signals
-- ** ConfigCallback #signal:ConfigCallback#

    C_ConfigCallback                        ,
    ConfigCallback                          ,
    ConfigCallback_WithClosures             ,
    drop_closures_ConfigCallback            ,
    dynamic_ConfigCallback                  ,
    genClosure_ConfigCallback               ,
    mk_ConfigCallback                       ,
    noConfigCallback                        ,
    noConfigCallback_WithClosures           ,
    wrap_ConfigCallback                     ,


-- ** ConfigMatchCallback #signal:ConfigMatchCallback#

    C_ConfigMatchCallback                   ,
    ConfigMatchCallback                     ,
    ConfigMatchCallback_WithClosures        ,
    drop_closures_ConfigMatchCallback       ,
    dynamic_ConfigMatchCallback             ,
    genClosure_ConfigMatchCallback          ,
    mk_ConfigMatchCallback                  ,
    noConfigMatchCallback                   ,
    noConfigMatchCallback_WithClosures      ,
    wrap_ConfigMatchCallback                ,


-- ** CredAcquireCallback #signal:CredAcquireCallback#

    C_CredAcquireCallback                   ,
    CredAcquireCallback                     ,
    CredAcquireCallback_WithClosures        ,
    drop_closures_CredAcquireCallback       ,
    dynamic_CredAcquireCallback             ,
    genClosure_CredAcquireCallback          ,
    mk_CredAcquireCallback                  ,
    noCredAcquireCallback                   ,
    noCredAcquireCallback_WithClosures      ,
    wrap_CredAcquireCallback                ,


-- ** DiffBinaryCallback #signal:DiffBinaryCallback#

    C_DiffBinaryCallback                    ,
    DiffBinaryCallback                      ,
    DiffBinaryCallback_WithClosures         ,
    drop_closures_DiffBinaryCallback        ,
    dynamic_DiffBinaryCallback              ,
    genClosure_DiffBinaryCallback           ,
    mk_DiffBinaryCallback                   ,
    noDiffBinaryCallback                    ,
    noDiffBinaryCallback_WithClosures       ,
    wrap_DiffBinaryCallback                 ,


-- ** DiffFileCallback #signal:DiffFileCallback#

    C_DiffFileCallback                      ,
    DiffFileCallback                        ,
    DiffFileCallback_WithClosures           ,
    drop_closures_DiffFileCallback          ,
    dynamic_DiffFileCallback                ,
    genClosure_DiffFileCallback             ,
    mk_DiffFileCallback                     ,
    noDiffFileCallback                      ,
    noDiffFileCallback_WithClosures         ,
    wrap_DiffFileCallback                   ,


-- ** DiffHunkCallback #signal:DiffHunkCallback#

    C_DiffHunkCallback                      ,
    DiffHunkCallback                        ,
    DiffHunkCallback_WithClosures           ,
    drop_closures_DiffHunkCallback          ,
    dynamic_DiffHunkCallback                ,
    genClosure_DiffHunkCallback             ,
    mk_DiffHunkCallback                     ,
    noDiffHunkCallback                      ,
    noDiffHunkCallback_WithClosures         ,
    wrap_DiffHunkCallback                   ,


-- ** DiffLineCallback #signal:DiffLineCallback#

    C_DiffLineCallback                      ,
    DiffLineCallback                        ,
    DiffLineCallback_WithClosures           ,
    drop_closures_DiffLineCallback          ,
    dynamic_DiffLineCallback                ,
    genClosure_DiffLineCallback             ,
    mk_DiffLineCallback                     ,
    noDiffLineCallback                      ,
    noDiffLineCallback_WithClosures         ,
    wrap_DiffLineCallback                   ,


-- ** DiffSimilarityMetricBufferSignatureCallback #signal:DiffSimilarityMetricBufferSignatureCallback#

    C_DiffSimilarityMetricBufferSignatureCallback,
    DiffSimilarityMetricBufferSignatureCallback,
    DiffSimilarityMetricBufferSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricBufferSignatureCallback,
    dynamic_DiffSimilarityMetricBufferSignatureCallback,
    genClosure_DiffSimilarityMetricBufferSignatureCallback,
    mk_DiffSimilarityMetricBufferSignatureCallback,
    noDiffSimilarityMetricBufferSignatureCallback,
    noDiffSimilarityMetricBufferSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricBufferSignatureCallback,


-- ** DiffSimilarityMetricFileSignatureCallback #signal:DiffSimilarityMetricFileSignatureCallback#

    C_DiffSimilarityMetricFileSignatureCallback,
    DiffSimilarityMetricFileSignatureCallback,
    DiffSimilarityMetricFileSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricFileSignatureCallback,
    dynamic_DiffSimilarityMetricFileSignatureCallback,
    genClosure_DiffSimilarityMetricFileSignatureCallback,
    mk_DiffSimilarityMetricFileSignatureCallback,
    noDiffSimilarityMetricFileSignatureCallback,
    noDiffSimilarityMetricFileSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricFileSignatureCallback,


-- ** DiffSimilarityMetricFreeSignatureCallback #signal:DiffSimilarityMetricFreeSignatureCallback#

    C_DiffSimilarityMetricFreeSignatureCallback,
    DiffSimilarityMetricFreeSignatureCallback,
    DiffSimilarityMetricFreeSignatureCallback_WithClosures,
    drop_closures_DiffSimilarityMetricFreeSignatureCallback,
    dynamic_DiffSimilarityMetricFreeSignatureCallback,
    genClosure_DiffSimilarityMetricFreeSignatureCallback,
    mk_DiffSimilarityMetricFreeSignatureCallback,
    noDiffSimilarityMetricFreeSignatureCallback,
    noDiffSimilarityMetricFreeSignatureCallback_WithClosures,
    wrap_DiffSimilarityMetricFreeSignatureCallback,


-- ** DiffSimilarityMetricSimilarityCallback #signal:DiffSimilarityMetricSimilarityCallback#

    C_DiffSimilarityMetricSimilarityCallback,
    DiffSimilarityMetricSimilarityCallback  ,
    DiffSimilarityMetricSimilarityCallback_WithClosures,
    drop_closures_DiffSimilarityMetricSimilarityCallback,
    dynamic_DiffSimilarityMetricSimilarityCallback,
    genClosure_DiffSimilarityMetricSimilarityCallback,
    mk_DiffSimilarityMetricSimilarityCallback,
    noDiffSimilarityMetricSimilarityCallback,
    noDiffSimilarityMetricSimilarityCallback_WithClosures,
    wrap_DiffSimilarityMetricSimilarityCallback,


-- ** NoteCallback #signal:NoteCallback#

    C_NoteCallback                          ,
    NoteCallback                            ,
    NoteCallback_WithClosures               ,
    drop_closures_NoteCallback              ,
    dynamic_NoteCallback                    ,
    genClosure_NoteCallback                 ,
    mk_NoteCallback                         ,
    noNoteCallback                          ,
    noNoteCallback_WithClosures             ,
    wrap_NoteCallback                       ,


-- ** ReferencesCallback #signal:ReferencesCallback#

    C_ReferencesCallback                    ,
    ReferencesCallback                      ,
    ReferencesCallback_WithClosures         ,
    drop_closures_ReferencesCallback        ,
    dynamic_ReferencesCallback              ,
    genClosure_ReferencesCallback           ,
    mk_ReferencesCallback                   ,
    noReferencesCallback                    ,
    noReferencesCallback_WithClosures       ,
    wrap_ReferencesCallback                 ,


-- ** ReferencesNameCallback #signal:ReferencesNameCallback#

    C_ReferencesNameCallback                ,
    ReferencesNameCallback                  ,
    ReferencesNameCallback_WithClosures     ,
    drop_closures_ReferencesNameCallback    ,
    dynamic_ReferencesNameCallback          ,
    genClosure_ReferencesNameCallback       ,
    mk_ReferencesNameCallback               ,
    noReferencesNameCallback                ,
    noReferencesNameCallback_WithClosures   ,
    wrap_ReferencesNameCallback             ,


-- ** RemoteListCallback #signal:RemoteListCallback#

    C_RemoteListCallback                    ,
    RemoteListCallback                      ,
    RemoteListCallback_WithClosures         ,
    drop_closures_RemoteListCallback        ,
    dynamic_RemoteListCallback              ,
    genClosure_RemoteListCallback           ,
    mk_RemoteListCallback                   ,
    noRemoteListCallback                    ,
    noRemoteListCallback_WithClosures       ,
    wrap_RemoteListCallback                 ,


-- ** StashCallback #signal:StashCallback#

    C_StashCallback                         ,
    StashCallback                           ,
    StashCallback_WithClosures              ,
    drop_closures_StashCallback             ,
    dynamic_StashCallback                   ,
    genClosure_StashCallback                ,
    mk_StashCallback                        ,
    noStashCallback                         ,
    noStashCallback_WithClosures            ,
    wrap_StashCallback                      ,


-- ** StatusCallback #signal:StatusCallback#

    C_StatusCallback                        ,
    StatusCallback                          ,
    StatusCallback_WithClosures             ,
    drop_closures_StatusCallback            ,
    dynamic_StatusCallback                  ,
    genClosure_StatusCallback               ,
    mk_StatusCallback                       ,
    noStatusCallback                        ,
    noStatusCallback_WithClosures           ,
    wrap_StatusCallback                     ,


-- ** SubmoduleCallback #signal:SubmoduleCallback#

    C_SubmoduleCallback                     ,
    SubmoduleCallback                       ,
    SubmoduleCallback_WithClosures          ,
    drop_closures_SubmoduleCallback         ,
    dynamic_SubmoduleCallback               ,
    genClosure_SubmoduleCallback            ,
    mk_SubmoduleCallback                    ,
    noSubmoduleCallback                     ,
    noSubmoduleCallback_WithClosures        ,
    wrap_SubmoduleCallback                  ,


-- ** TagCallback #signal:TagCallback#

    C_TagCallback                           ,
    TagCallback                             ,
    TagCallback_WithClosures                ,
    drop_closures_TagCallback               ,
    dynamic_TagCallback                     ,
    genClosure_TagCallback                  ,
    mk_TagCallback                          ,
    noTagCallback                           ,
    noTagCallback_WithClosures              ,
    wrap_TagCallback                        ,


-- ** TransferProgressCallback #signal:TransferProgressCallback#

    C_TransferProgressCallback              ,
    TransferProgressCallback                ,
    TransferProgressCallback_WithClosures   ,
    drop_closures_TransferProgressCallback  ,
    dynamic_TransferProgressCallback        ,
    genClosure_TransferProgressCallback     ,
    mk_TransferProgressCallback             ,
    noTransferProgressCallback              ,
    noTransferProgressCallback_WithClosures ,
    wrap_TransferProgressCallback           ,


-- ** TreeWalkCallback #signal:TreeWalkCallback#

    C_TreeWalkCallback                      ,
    TreeWalkCallback                        ,
    TreeWalkCallback_WithClosures           ,
    drop_closures_TreeWalkCallback          ,
    dynamic_TreeWalkCallback                ,
    genClosure_TreeWalkCallback             ,
    mk_TreeWalkCallback                     ,
    noTreeWalkCallback                      ,
    noTreeWalkCallback_WithClosures         ,
    wrap_TreeWalkCallback                   ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GLib.Structs.MatchInfo as GLib.MatchInfo
import {-# SOURCE #-} qualified GI.Ggit.Flags as Ggit.Flags
import {-# SOURCE #-} qualified GI.Ggit.Objects.Cred as Ggit.Cred
import {-# SOURCE #-} qualified GI.Ggit.Objects.Ref as Ggit.Ref
import {-# SOURCE #-} qualified GI.Ggit.Structs.ConfigEntry as Ggit.ConfigEntry
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffBinary as Ggit.DiffBinary
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffDelta as Ggit.DiffDelta
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffFile as Ggit.DiffFile
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffHunk as Ggit.DiffHunk
import {-# SOURCE #-} qualified GI.Ggit.Structs.DiffLine as Ggit.DiffLine
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId
import {-# SOURCE #-} qualified GI.Ggit.Structs.Submodule as Ggit.Submodule
import {-# SOURCE #-} qualified GI.Ggit.Structs.TransferProgress as Ggit.TransferProgress
import {-# SOURCE #-} qualified GI.Ggit.Structs.TreeEntry as Ggit.TreeEntry

-- callback TreeWalkCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next entry or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "root"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the current (relative) root of the entry"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "entry"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "TreeEntry" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the tree entry" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for walking a tree.\nSee ggit_tree_walk()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_TreeWalkCallback =
    CString ->
    Ptr Ggit.TreeEntry.TreeEntry ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "root"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the current (relative) root of the entry"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "entry"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "TreeEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the tree entry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TreeWalkCallback :: FunPtr C_TreeWalkCallback -> C_TreeWalkCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TreeWalkCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TreeWalkCallback
    -> T.Text
    -- ^ /@root@/: the current (relative) root of the entry
    -> Ggit.TreeEntry.TreeEntry
    -- ^ /@entry@/: the tree entry
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next entry or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_TreeWalkCallback :: FunPtr C_TreeWalkCallback -> Text -> TreeEntry -> Ptr () -> m Int32
dynamic_TreeWalkCallback FunPtr C_TreeWalkCallback
__funPtr Text
root TreeEntry
entry Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
root' <- Text -> IO CString
textToCString Text
root
    Ptr TreeEntry
entry' <- TreeEntry -> IO (Ptr TreeEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TreeEntry
entry
    Int32
result <- (FunPtr C_TreeWalkCallback -> C_TreeWalkCallback
__dynamic_C_TreeWalkCallback FunPtr C_TreeWalkCallback
__funPtr) CString
root' Ptr TreeEntry
entry' Ptr ()
userData
    TreeEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TreeEntry
entry
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
root'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_TreeWalkCallback`.
foreign import ccall "wrapper"
    mk_TreeWalkCallback :: C_TreeWalkCallback -> IO (FunPtr C_TreeWalkCallback)

-- | The type of the callback functions for walking a tree.
-- See 'GI.Ggit.Objects.Tree.treeWalk'.
type TreeWalkCallback =
    T.Text
    -- ^ /@root@/: the current (relative) root of the entry
    -> Ggit.TreeEntry.TreeEntry
    -- ^ /@entry@/: the tree entry
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next entry or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TreeWalkCallback`@.
noTreeWalkCallback :: Maybe TreeWalkCallback
noTreeWalkCallback :: Maybe TreeWalkCallback
noTreeWalkCallback = Maybe TreeWalkCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for walking a tree.
-- See 'GI.Ggit.Objects.Tree.treeWalk'.
type TreeWalkCallback_WithClosures =
    T.Text
    -- ^ /@root@/: the current (relative) root of the entry
    -> Ggit.TreeEntry.TreeEntry
    -- ^ /@entry@/: the tree entry
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next entry or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TreeWalkCallback_WithClosures`@.
noTreeWalkCallback_WithClosures :: Maybe TreeWalkCallback_WithClosures
noTreeWalkCallback_WithClosures :: Maybe TreeWalkCallback_WithClosures
noTreeWalkCallback_WithClosures = Maybe TreeWalkCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TreeWalkCallback :: TreeWalkCallback -> TreeWalkCallback_WithClosures
drop_closures_TreeWalkCallback :: TreeWalkCallback -> TreeWalkCallback_WithClosures
drop_closures_TreeWalkCallback TreeWalkCallback
_f Text
root TreeEntry
entry Ptr ()
_ = TreeWalkCallback
_f Text
root TreeEntry
entry

-- | Wrap the callback into a `GClosure`.
genClosure_TreeWalkCallback :: MonadIO m => TreeWalkCallback -> m (GClosure C_TreeWalkCallback)
genClosure_TreeWalkCallback :: TreeWalkCallback -> m (GClosure C_TreeWalkCallback)
genClosure_TreeWalkCallback TreeWalkCallback
cb = IO (GClosure C_TreeWalkCallback) -> m (GClosure C_TreeWalkCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_TreeWalkCallback)
 -> m (GClosure C_TreeWalkCallback))
-> IO (GClosure C_TreeWalkCallback)
-> m (GClosure C_TreeWalkCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: TreeWalkCallback_WithClosures
cb' = TreeWalkCallback -> TreeWalkCallback_WithClosures
drop_closures_TreeWalkCallback TreeWalkCallback
cb
    let cb'' :: C_TreeWalkCallback
cb'' = Maybe (Ptr (FunPtr C_TreeWalkCallback))
-> TreeWalkCallback_WithClosures -> C_TreeWalkCallback
wrap_TreeWalkCallback Maybe (Ptr (FunPtr C_TreeWalkCallback))
forall a. Maybe a
Nothing TreeWalkCallback_WithClosures
cb'
    C_TreeWalkCallback -> IO (FunPtr C_TreeWalkCallback)
mk_TreeWalkCallback C_TreeWalkCallback
cb'' IO (FunPtr C_TreeWalkCallback)
-> (FunPtr C_TreeWalkCallback -> IO (GClosure C_TreeWalkCallback))
-> IO (GClosure C_TreeWalkCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_TreeWalkCallback -> IO (GClosure C_TreeWalkCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `TreeWalkCallback` into a `C_TreeWalkCallback`.
wrap_TreeWalkCallback ::
    Maybe (Ptr (FunPtr C_TreeWalkCallback)) ->
    TreeWalkCallback_WithClosures ->
    C_TreeWalkCallback
wrap_TreeWalkCallback :: Maybe (Ptr (FunPtr C_TreeWalkCallback))
-> TreeWalkCallback_WithClosures -> C_TreeWalkCallback
wrap_TreeWalkCallback Maybe (Ptr (FunPtr C_TreeWalkCallback))
funptrptr TreeWalkCallback_WithClosures
_cb CString
root Ptr TreeEntry
entry Ptr ()
userData = do
    Text
root' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
root
    (ManagedPtr TreeEntry -> TreeEntry)
-> Ptr TreeEntry -> (TreeEntry -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr TreeEntry -> TreeEntry
Ggit.TreeEntry.TreeEntry Ptr TreeEntry
entry ((TreeEntry -> IO Int32) -> IO Int32)
-> (TreeEntry -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \TreeEntry
entry' -> do
        Int32
result <- TreeWalkCallback_WithClosures
_cb  Text
root' TreeEntry
entry' Ptr ()
userData
        Maybe (Ptr (FunPtr C_TreeWalkCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_TreeWalkCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback TransferProgressCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "a value less than zero to cancel the transfer."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "stats"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "TransferProgress" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitTransferProgress."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Progress callbacks during indexing."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_TransferProgressCallback =
    Ptr Ggit.TransferProgress.TransferProgress ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "stats"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "TransferProgress" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitTransferProgress."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TransferProgressCallback :: FunPtr C_TransferProgressCallback -> C_TransferProgressCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TransferProgressCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TransferProgressCallback
    -> Ggit.TransferProgress.TransferProgress
    -- ^ /@stats@/: a t'GI.Ggit.Structs.TransferProgress.TransferProgress'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ a value less than zero to cancel the transfer.
dynamic_TransferProgressCallback :: FunPtr C_TransferProgressCallback
-> TransferProgress -> Ptr () -> m Int32
dynamic_TransferProgressCallback FunPtr C_TransferProgressCallback
__funPtr TransferProgress
stats Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr TransferProgress
stats' <- TransferProgress -> IO (Ptr TransferProgress)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TransferProgress
stats
    Int32
result <- (FunPtr C_TransferProgressCallback -> C_TransferProgressCallback
__dynamic_C_TransferProgressCallback FunPtr C_TransferProgressCallback
__funPtr) Ptr TransferProgress
stats' Ptr ()
userData
    TransferProgress -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TransferProgress
stats
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_TransferProgressCallback`.
foreign import ccall "wrapper"
    mk_TransferProgressCallback :: C_TransferProgressCallback -> IO (FunPtr C_TransferProgressCallback)

-- | Progress callbacks during indexing.
type TransferProgressCallback =
    Ggit.TransferProgress.TransferProgress
    -- ^ /@stats@/: a t'GI.Ggit.Structs.TransferProgress.TransferProgress'.
    -> IO Int32
    -- ^ __Returns:__ a value less than zero to cancel the transfer.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TransferProgressCallback`@.
noTransferProgressCallback :: Maybe TransferProgressCallback
noTransferProgressCallback :: Maybe TransferProgressCallback
noTransferProgressCallback = Maybe TransferProgressCallback
forall a. Maybe a
Nothing

-- | Progress callbacks during indexing.
type TransferProgressCallback_WithClosures =
    Ggit.TransferProgress.TransferProgress
    -- ^ /@stats@/: a t'GI.Ggit.Structs.TransferProgress.TransferProgress'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ a value less than zero to cancel the transfer.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TransferProgressCallback_WithClosures`@.
noTransferProgressCallback_WithClosures :: Maybe TransferProgressCallback_WithClosures
noTransferProgressCallback_WithClosures :: Maybe TransferProgressCallback_WithClosures
noTransferProgressCallback_WithClosures = Maybe TransferProgressCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TransferProgressCallback :: TransferProgressCallback -> TransferProgressCallback_WithClosures
drop_closures_TransferProgressCallback :: TransferProgressCallback -> TransferProgressCallback_WithClosures
drop_closures_TransferProgressCallback TransferProgressCallback
_f TransferProgress
stats Ptr ()
_ = TransferProgressCallback
_f TransferProgress
stats

-- | Wrap the callback into a `GClosure`.
genClosure_TransferProgressCallback :: MonadIO m => TransferProgressCallback -> m (GClosure C_TransferProgressCallback)
genClosure_TransferProgressCallback :: TransferProgressCallback -> m (GClosure C_TransferProgressCallback)
genClosure_TransferProgressCallback TransferProgressCallback
cb = IO (GClosure C_TransferProgressCallback)
-> m (GClosure C_TransferProgressCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_TransferProgressCallback)
 -> m (GClosure C_TransferProgressCallback))
-> IO (GClosure C_TransferProgressCallback)
-> m (GClosure C_TransferProgressCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: TransferProgressCallback_WithClosures
cb' = TransferProgressCallback -> TransferProgressCallback_WithClosures
drop_closures_TransferProgressCallback TransferProgressCallback
cb
    let cb'' :: C_TransferProgressCallback
cb'' = Maybe (Ptr (FunPtr C_TransferProgressCallback))
-> TransferProgressCallback_WithClosures
-> C_TransferProgressCallback
wrap_TransferProgressCallback Maybe (Ptr (FunPtr C_TransferProgressCallback))
forall a. Maybe a
Nothing TransferProgressCallback_WithClosures
cb'
    C_TransferProgressCallback
-> IO (FunPtr C_TransferProgressCallback)
mk_TransferProgressCallback C_TransferProgressCallback
cb'' IO (FunPtr C_TransferProgressCallback)
-> (FunPtr C_TransferProgressCallback
    -> IO (GClosure C_TransferProgressCallback))
-> IO (GClosure C_TransferProgressCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_TransferProgressCallback
-> IO (GClosure C_TransferProgressCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `TransferProgressCallback` into a `C_TransferProgressCallback`.
wrap_TransferProgressCallback ::
    Maybe (Ptr (FunPtr C_TransferProgressCallback)) ->
    TransferProgressCallback_WithClosures ->
    C_TransferProgressCallback
wrap_TransferProgressCallback :: Maybe (Ptr (FunPtr C_TransferProgressCallback))
-> TransferProgressCallback_WithClosures
-> C_TransferProgressCallback
wrap_TransferProgressCallback Maybe (Ptr (FunPtr C_TransferProgressCallback))
funptrptr TransferProgressCallback_WithClosures
_cb Ptr TransferProgress
stats Ptr ()
userData = do
    (ManagedPtr TransferProgress -> TransferProgress)
-> Ptr TransferProgress -> TransferProgressCallback -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr TransferProgress -> TransferProgress
Ggit.TransferProgress.TransferProgress Ptr TransferProgress
stats (TransferProgressCallback -> IO Int32)
-> TransferProgressCallback -> IO Int32
forall a b. (a -> b) -> a -> b
$ \TransferProgress
stats' -> do
        Int32
result <- TransferProgressCallback_WithClosures
_cb  TransferProgress
stats' Ptr ()
userData
        Maybe (Ptr (FunPtr C_TransferProgressCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_TransferProgressCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback TagCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the tag name." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "tag_oid"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the tag oid." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "When iterating over all the tags, callback that will be\nissued per entry. See ggit_repository_tag_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_TagCallback =
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the tag name." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag_oid"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the tag oid." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_TagCallback :: FunPtr C_TagCallback -> C_TagCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_TagCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_TagCallback
    -> T.Text
    -- ^ /@name@/: the tag name.
    -> Ggit.OId.OId
    -- ^ /@tagOid@/: the tag oid.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_TagCallback :: FunPtr C_TagCallback -> Text -> OId -> Ptr () -> m Int32
dynamic_TagCallback FunPtr C_TagCallback
__funPtr Text
name OId
tagOid Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr OId
tagOid' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
tagOid
    Int32
result <- (FunPtr C_TagCallback -> C_TagCallback
__dynamic_C_TagCallback FunPtr C_TagCallback
__funPtr) CString
name' Ptr OId
tagOid' Ptr ()
userData
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
tagOid
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_TagCallback`.
foreign import ccall "wrapper"
    mk_TagCallback :: C_TagCallback -> IO (FunPtr C_TagCallback)

-- | When iterating over all the tags, callback that will be
-- issued per entry. See 'GI.Ggit.Objects.Repository.repositoryTagForeach'.
type TagCallback =
    T.Text
    -- ^ /@name@/: the tag name.
    -> Ggit.OId.OId
    -- ^ /@tagOid@/: the tag oid.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TagCallback`@.
noTagCallback :: Maybe TagCallback
noTagCallback :: Maybe TagCallback
noTagCallback = Maybe TagCallback
forall a. Maybe a
Nothing

-- | When iterating over all the tags, callback that will be
-- issued per entry. See 'GI.Ggit.Objects.Repository.repositoryTagForeach'.
type TagCallback_WithClosures =
    T.Text
    -- ^ /@name@/: the tag name.
    -> Ggit.OId.OId
    -- ^ /@tagOid@/: the tag oid.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `TagCallback_WithClosures`@.
noTagCallback_WithClosures :: Maybe TagCallback_WithClosures
noTagCallback_WithClosures :: Maybe TagCallback_WithClosures
noTagCallback_WithClosures = Maybe TagCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_TagCallback :: TagCallback -> TagCallback_WithClosures
drop_closures_TagCallback :: TagCallback -> TagCallback_WithClosures
drop_closures_TagCallback TagCallback
_f Text
name OId
tagOid Ptr ()
_ = TagCallback
_f Text
name OId
tagOid

-- | Wrap the callback into a `GClosure`.
genClosure_TagCallback :: MonadIO m => TagCallback -> m (GClosure C_TagCallback)
genClosure_TagCallback :: TagCallback -> m (GClosure C_TagCallback)
genClosure_TagCallback TagCallback
cb = IO (GClosure C_TagCallback) -> m (GClosure C_TagCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_TagCallback) -> m (GClosure C_TagCallback))
-> IO (GClosure C_TagCallback) -> m (GClosure C_TagCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: TagCallback_WithClosures
cb' = TagCallback -> TagCallback_WithClosures
drop_closures_TagCallback TagCallback
cb
    let cb'' :: C_TagCallback
cb'' = Maybe (Ptr (FunPtr C_TagCallback))
-> TagCallback_WithClosures -> C_TagCallback
wrap_TagCallback Maybe (Ptr (FunPtr C_TagCallback))
forall a. Maybe a
Nothing TagCallback_WithClosures
cb'
    C_TagCallback -> IO (FunPtr C_TagCallback)
mk_TagCallback C_TagCallback
cb'' IO (FunPtr C_TagCallback)
-> (FunPtr C_TagCallback -> IO (GClosure C_TagCallback))
-> IO (GClosure C_TagCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_TagCallback -> IO (GClosure C_TagCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `TagCallback` into a `C_TagCallback`.
wrap_TagCallback ::
    Maybe (Ptr (FunPtr C_TagCallback)) ->
    TagCallback_WithClosures ->
    C_TagCallback
wrap_TagCallback :: Maybe (Ptr (FunPtr C_TagCallback))
-> TagCallback_WithClosures -> C_TagCallback
wrap_TagCallback Maybe (Ptr (FunPtr C_TagCallback))
funptrptr TagCallback_WithClosures
_cb CString
name Ptr OId
tagOid Ptr ()
userData = do
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
tagOid ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
tagOid' -> do
        Int32
result <- TagCallback_WithClosures
_cb  Text
name' OId
tagOid' Ptr ()
userData
        Maybe (Ptr (FunPtr C_TagCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_TagCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback SubmoduleCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next submodule or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "submodule"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "Submodule" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitSubmodule." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the name of the submodule."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving the submodules\nin a #GgitRepository. See ggit_repository_submodule_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SubmoduleCallback =
    Ptr Ggit.Submodule.Submodule ->
    CString ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "submodule"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "Submodule" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitSubmodule." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the submodule."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SubmoduleCallback :: FunPtr C_SubmoduleCallback -> C_SubmoduleCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SubmoduleCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_SubmoduleCallback
    -> Ggit.Submodule.Submodule
    -- ^ /@submodule@/: a t'GI.Ggit.Structs.Submodule.Submodule'.
    -> T.Text
    -- ^ /@name@/: the name of the submodule.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next submodule or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_SubmoduleCallback :: FunPtr C_SubmoduleCallback
-> Submodule -> Text -> Ptr () -> m Int32
dynamic_SubmoduleCallback FunPtr C_SubmoduleCallback
__funPtr Submodule
submodule Text
name Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Submodule
submodule' <- Submodule -> IO (Ptr Submodule)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Submodule
submodule
    CString
name' <- Text -> IO CString
textToCString Text
name
    Int32
result <- (FunPtr C_SubmoduleCallback -> C_SubmoduleCallback
__dynamic_C_SubmoduleCallback FunPtr C_SubmoduleCallback
__funPtr) Ptr Submodule
submodule' CString
name' Ptr ()
userData
    Submodule -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Submodule
submodule
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_SubmoduleCallback`.
foreign import ccall "wrapper"
    mk_SubmoduleCallback :: C_SubmoduleCallback -> IO (FunPtr C_SubmoduleCallback)

-- | The type of the callback functions for retrieving the submodules
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositorySubmoduleForeach'.
type SubmoduleCallback =
    Ggit.Submodule.Submodule
    -- ^ /@submodule@/: a t'GI.Ggit.Structs.Submodule.Submodule'.
    -> T.Text
    -- ^ /@name@/: the name of the submodule.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next submodule or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SubmoduleCallback`@.
noSubmoduleCallback :: Maybe SubmoduleCallback
noSubmoduleCallback :: Maybe SubmoduleCallback
noSubmoduleCallback = Maybe SubmoduleCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving the submodules
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositorySubmoduleForeach'.
type SubmoduleCallback_WithClosures =
    Ggit.Submodule.Submodule
    -- ^ /@submodule@/: a t'GI.Ggit.Structs.Submodule.Submodule'.
    -> T.Text
    -- ^ /@name@/: the name of the submodule.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next submodule or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `SubmoduleCallback_WithClosures`@.
noSubmoduleCallback_WithClosures :: Maybe SubmoduleCallback_WithClosures
noSubmoduleCallback_WithClosures :: Maybe SubmoduleCallback_WithClosures
noSubmoduleCallback_WithClosures = Maybe SubmoduleCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SubmoduleCallback :: SubmoduleCallback -> SubmoduleCallback_WithClosures
drop_closures_SubmoduleCallback :: SubmoduleCallback -> SubmoduleCallback_WithClosures
drop_closures_SubmoduleCallback SubmoduleCallback
_f Submodule
submodule Text
name Ptr ()
_ = SubmoduleCallback
_f Submodule
submodule Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_SubmoduleCallback :: MonadIO m => SubmoduleCallback -> m (GClosure C_SubmoduleCallback)
genClosure_SubmoduleCallback :: SubmoduleCallback -> m (GClosure C_SubmoduleCallback)
genClosure_SubmoduleCallback SubmoduleCallback
cb = IO (GClosure C_SubmoduleCallback)
-> m (GClosure C_SubmoduleCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SubmoduleCallback)
 -> m (GClosure C_SubmoduleCallback))
-> IO (GClosure C_SubmoduleCallback)
-> m (GClosure C_SubmoduleCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: SubmoduleCallback_WithClosures
cb' = SubmoduleCallback -> SubmoduleCallback_WithClosures
drop_closures_SubmoduleCallback SubmoduleCallback
cb
    let cb'' :: C_SubmoduleCallback
cb'' = Maybe (Ptr (FunPtr C_SubmoduleCallback))
-> SubmoduleCallback_WithClosures -> C_SubmoduleCallback
wrap_SubmoduleCallback Maybe (Ptr (FunPtr C_SubmoduleCallback))
forall a. Maybe a
Nothing SubmoduleCallback_WithClosures
cb'
    C_SubmoduleCallback -> IO (FunPtr C_SubmoduleCallback)
mk_SubmoduleCallback C_SubmoduleCallback
cb'' IO (FunPtr C_SubmoduleCallback)
-> (FunPtr C_SubmoduleCallback
    -> IO (GClosure C_SubmoduleCallback))
-> IO (GClosure C_SubmoduleCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_SubmoduleCallback -> IO (GClosure C_SubmoduleCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `SubmoduleCallback` into a `C_SubmoduleCallback`.
wrap_SubmoduleCallback ::
    Maybe (Ptr (FunPtr C_SubmoduleCallback)) ->
    SubmoduleCallback_WithClosures ->
    C_SubmoduleCallback
wrap_SubmoduleCallback :: Maybe (Ptr (FunPtr C_SubmoduleCallback))
-> SubmoduleCallback_WithClosures -> C_SubmoduleCallback
wrap_SubmoduleCallback Maybe (Ptr (FunPtr C_SubmoduleCallback))
funptrptr SubmoduleCallback_WithClosures
_cb Ptr Submodule
submodule CString
name Ptr ()
userData = do
    (ManagedPtr Submodule -> Submodule)
-> Ptr Submodule -> (Submodule -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr Submodule -> Submodule
Ggit.Submodule.Submodule Ptr Submodule
submodule ((Submodule -> IO Int32) -> IO Int32)
-> (Submodule -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Submodule
submodule' -> do
        Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
        Int32
result <- SubmoduleCallback_WithClosures
_cb  Submodule
submodule' Text
name' Ptr ()
userData
        Maybe (Ptr (FunPtr C_SubmoduleCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SubmoduleCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback StatusCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next file or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "path"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the file to retrieve status for, rooted at the repository working dir."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "status_flags"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "StatusFlags" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the status value." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving the status of the files\nin a #GgitRepository. See ggit_repository_file_status_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_StatusCallback =
    CString ->
    CUInt ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the file to retrieve status for, rooted at the repository working dir."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "status_flags"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "StatusFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the status value." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StatusCallback :: FunPtr C_StatusCallback -> C_StatusCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_StatusCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StatusCallback
    -> T.Text
    -- ^ /@path@/: the file to retrieve status for, rooted at the repository working dir.
    -> [Ggit.Flags.StatusFlags]
    -- ^ /@statusFlags@/: the status value.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next file or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_StatusCallback :: FunPtr C_StatusCallback
-> Text -> [StatusFlags] -> Ptr () -> m Int32
dynamic_StatusCallback FunPtr C_StatusCallback
__funPtr Text
path [StatusFlags]
statusFlags Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let statusFlags' :: CUInt
statusFlags' = [StatusFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [StatusFlags]
statusFlags
    Int32
result <- (FunPtr C_StatusCallback -> C_StatusCallback
__dynamic_C_StatusCallback FunPtr C_StatusCallback
__funPtr) CString
path' CUInt
statusFlags' Ptr ()
userData
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_StatusCallback`.
foreign import ccall "wrapper"
    mk_StatusCallback :: C_StatusCallback -> IO (FunPtr C_StatusCallback)

-- | The type of the callback functions for retrieving the status of the files
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryFileStatusForeach'.
type StatusCallback =
    T.Text
    -- ^ /@path@/: the file to retrieve status for, rooted at the repository working dir.
    -> [Ggit.Flags.StatusFlags]
    -- ^ /@statusFlags@/: the status value.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next file or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `StatusCallback`@.
noStatusCallback :: Maybe StatusCallback
noStatusCallback :: Maybe StatusCallback
noStatusCallback = Maybe StatusCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving the status of the files
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryFileStatusForeach'.
type StatusCallback_WithClosures =
    T.Text
    -- ^ /@path@/: the file to retrieve status for, rooted at the repository working dir.
    -> [Ggit.Flags.StatusFlags]
    -- ^ /@statusFlags@/: the status value.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next file or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `StatusCallback_WithClosures`@.
noStatusCallback_WithClosures :: Maybe StatusCallback_WithClosures
noStatusCallback_WithClosures :: Maybe StatusCallback_WithClosures
noStatusCallback_WithClosures = Maybe StatusCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_StatusCallback :: StatusCallback -> StatusCallback_WithClosures
drop_closures_StatusCallback :: StatusCallback -> StatusCallback_WithClosures
drop_closures_StatusCallback StatusCallback
_f Text
path [StatusFlags]
statusFlags Ptr ()
_ = StatusCallback
_f Text
path [StatusFlags]
statusFlags

-- | Wrap the callback into a `GClosure`.
genClosure_StatusCallback :: MonadIO m => StatusCallback -> m (GClosure C_StatusCallback)
genClosure_StatusCallback :: StatusCallback -> m (GClosure C_StatusCallback)
genClosure_StatusCallback StatusCallback
cb = IO (GClosure C_StatusCallback) -> m (GClosure C_StatusCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_StatusCallback) -> m (GClosure C_StatusCallback))
-> IO (GClosure C_StatusCallback) -> m (GClosure C_StatusCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: StatusCallback_WithClosures
cb' = StatusCallback -> StatusCallback_WithClosures
drop_closures_StatusCallback StatusCallback
cb
    let cb'' :: C_StatusCallback
cb'' = Maybe (Ptr (FunPtr C_StatusCallback))
-> StatusCallback_WithClosures -> C_StatusCallback
wrap_StatusCallback Maybe (Ptr (FunPtr C_StatusCallback))
forall a. Maybe a
Nothing StatusCallback_WithClosures
cb'
    C_StatusCallback -> IO (FunPtr C_StatusCallback)
mk_StatusCallback C_StatusCallback
cb'' IO (FunPtr C_StatusCallback)
-> (FunPtr C_StatusCallback -> IO (GClosure C_StatusCallback))
-> IO (GClosure C_StatusCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_StatusCallback -> IO (GClosure C_StatusCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `StatusCallback` into a `C_StatusCallback`.
wrap_StatusCallback ::
    Maybe (Ptr (FunPtr C_StatusCallback)) ->
    StatusCallback_WithClosures ->
    C_StatusCallback
wrap_StatusCallback :: Maybe (Ptr (FunPtr C_StatusCallback))
-> StatusCallback_WithClosures -> C_StatusCallback
wrap_StatusCallback Maybe (Ptr (FunPtr C_StatusCallback))
funptrptr StatusCallback_WithClosures
_cb CString
path CUInt
statusFlags Ptr ()
userData = do
    Text
path' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
path
    let statusFlags' :: [StatusFlags]
statusFlags' = CUInt -> [StatusFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
statusFlags
    Int32
result <- StatusCallback_WithClosures
_cb  Text
path' [StatusFlags]
statusFlags' Ptr ()
userData
    Maybe (Ptr (FunPtr C_StatusCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_StatusCallback))
funptrptr
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback StashCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "index"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "the position within the stash list. 0 points to the\nmost recent stashed state."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "message"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the stash message." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "stash_oid"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the commit oid of the stashed state."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "When iterating over all the stashed states, callback that will be\nissued per entry. See ggit_repository_stash_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_StashCallback =
    Word64 ->
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "index"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the position within the stash list. 0 points to the\nmost recent stashed state."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "message"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the stash message." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stash_oid"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the commit oid of the stashed state."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_StashCallback :: FunPtr C_StashCallback -> C_StashCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_StashCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_StashCallback
    -> Word64
    -- ^ /@index@/: the position within the stash list. 0 points to the
    -- most recent stashed state.
    -> T.Text
    -- ^ /@message@/: the stash message.
    -> Ggit.OId.OId
    -- ^ /@stashOid@/: the commit oid of the stashed state.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_StashCallback :: FunPtr C_StashCallback
-> Word64 -> Text -> OId -> Ptr () -> m Int32
dynamic_StashCallback FunPtr C_StashCallback
__funPtr Word64
index Text
message OId
stashOid Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
message' <- Text -> IO CString
textToCString Text
message
    Ptr OId
stashOid' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
stashOid
    Int32
result <- (FunPtr C_StashCallback -> C_StashCallback
__dynamic_C_StashCallback FunPtr C_StashCallback
__funPtr) Word64
index CString
message' Ptr OId
stashOid' Ptr ()
userData
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
stashOid
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
message'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_StashCallback`.
foreign import ccall "wrapper"
    mk_StashCallback :: C_StashCallback -> IO (FunPtr C_StashCallback)

-- | When iterating over all the stashed states, callback that will be
-- issued per entry. See 'GI.Ggit.Objects.Repository.repositoryStashForeach'.
type StashCallback =
    Word64
    -- ^ /@index@/: the position within the stash list. 0 points to the
    -- most recent stashed state.
    -> T.Text
    -- ^ /@message@/: the stash message.
    -> Ggit.OId.OId
    -- ^ /@stashOid@/: the commit oid of the stashed state.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `StashCallback`@.
noStashCallback :: Maybe StashCallback
noStashCallback :: Maybe StashCallback
noStashCallback = Maybe StashCallback
forall a. Maybe a
Nothing

-- | When iterating over all the stashed states, callback that will be
-- issued per entry. See 'GI.Ggit.Objects.Repository.repositoryStashForeach'.
type StashCallback_WithClosures =
    Word64
    -- ^ /@index@/: the position within the stash list. 0 points to the
    -- most recent stashed state.
    -> T.Text
    -- ^ /@message@/: the stash message.
    -> Ggit.OId.OId
    -- ^ /@stashOid@/: the commit oid of the stashed state.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `StashCallback_WithClosures`@.
noStashCallback_WithClosures :: Maybe StashCallback_WithClosures
noStashCallback_WithClosures :: Maybe StashCallback_WithClosures
noStashCallback_WithClosures = Maybe StashCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_StashCallback :: StashCallback -> StashCallback_WithClosures
drop_closures_StashCallback :: StashCallback -> StashCallback_WithClosures
drop_closures_StashCallback StashCallback
_f Word64
index Text
message OId
stashOid Ptr ()
_ = StashCallback
_f Word64
index Text
message OId
stashOid

-- | Wrap the callback into a `GClosure`.
genClosure_StashCallback :: MonadIO m => StashCallback -> m (GClosure C_StashCallback)
genClosure_StashCallback :: StashCallback -> m (GClosure C_StashCallback)
genClosure_StashCallback StashCallback
cb = IO (GClosure C_StashCallback) -> m (GClosure C_StashCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_StashCallback) -> m (GClosure C_StashCallback))
-> IO (GClosure C_StashCallback) -> m (GClosure C_StashCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: StashCallback_WithClosures
cb' = StashCallback -> StashCallback_WithClosures
drop_closures_StashCallback StashCallback
cb
    let cb'' :: C_StashCallback
cb'' = Maybe (Ptr (FunPtr C_StashCallback))
-> StashCallback_WithClosures -> C_StashCallback
wrap_StashCallback Maybe (Ptr (FunPtr C_StashCallback))
forall a. Maybe a
Nothing StashCallback_WithClosures
cb'
    C_StashCallback -> IO (FunPtr C_StashCallback)
mk_StashCallback C_StashCallback
cb'' IO (FunPtr C_StashCallback)
-> (FunPtr C_StashCallback -> IO (GClosure C_StashCallback))
-> IO (GClosure C_StashCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_StashCallback -> IO (GClosure C_StashCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `StashCallback` into a `C_StashCallback`.
wrap_StashCallback ::
    Maybe (Ptr (FunPtr C_StashCallback)) ->
    StashCallback_WithClosures ->
    C_StashCallback
wrap_StashCallback :: Maybe (Ptr (FunPtr C_StashCallback))
-> StashCallback_WithClosures -> C_StashCallback
wrap_StashCallback Maybe (Ptr (FunPtr C_StashCallback))
funptrptr StashCallback_WithClosures
_cb Word64
index CString
message Ptr OId
stashOid Ptr ()
userData = do
    Text
message' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
message
    (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
stashOid ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
stashOid' -> do
        Int32
result <- StashCallback_WithClosures
_cb  Word64
index Text
message' OId
stashOid' Ptr ()
userData
        Maybe (Ptr (FunPtr C_StashCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_StashCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback RemoteListCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the name of the reference."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "oid"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the reference's oid."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "loid"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the reference's loid."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "local"
          , argType = TBasicType TBoolean
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "if available locally."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for listing the references of a\n#GgitRemote. See ggit_remote_list()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RemoteListCallback =
    CString ->
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    CInt ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the reference."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "oid"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the reference's oid."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "loid"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the reference's loid."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "local"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if available locally."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RemoteListCallback :: FunPtr C_RemoteListCallback -> C_RemoteListCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RemoteListCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_RemoteListCallback
    -> T.Text
    -- ^ /@name@/: the name of the reference.
    -> Ggit.OId.OId
    -- ^ /@oid@/: the reference\'s oid.
    -> Ggit.OId.OId
    -- ^ /@loid@/: the reference\'s loid.
    -> Bool
    -- ^ /@local@/: if available locally.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_RemoteListCallback :: FunPtr C_RemoteListCallback
-> Text -> OId -> OId -> Bool -> Ptr () -> m Int32
dynamic_RemoteListCallback FunPtr C_RemoteListCallback
__funPtr Text
name OId
oid OId
loid Bool
local Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Ptr OId
oid' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
oid
    Ptr OId
loid' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
loid
    let local' :: CInt
local' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
local
    Int32
result <- (FunPtr C_RemoteListCallback -> C_RemoteListCallback
__dynamic_C_RemoteListCallback FunPtr C_RemoteListCallback
__funPtr) CString
name' Ptr OId
oid' Ptr OId
loid' CInt
local' Ptr ()
userData
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
oid
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
loid
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_RemoteListCallback`.
foreign import ccall "wrapper"
    mk_RemoteListCallback :: C_RemoteListCallback -> IO (FunPtr C_RemoteListCallback)

-- | The type of the callback functions for listing the references of a
-- t'GI.Ggit.Objects.Remote.Remote'. See 'GI.Ggit.Objects.Remote.remoteList'.
type RemoteListCallback =
    T.Text
    -- ^ /@name@/: the name of the reference.
    -> Ggit.OId.OId
    -- ^ /@oid@/: the reference\'s oid.
    -> Ggit.OId.OId
    -- ^ /@loid@/: the reference\'s loid.
    -> Bool
    -- ^ /@local@/: if available locally.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `RemoteListCallback`@.
noRemoteListCallback :: Maybe RemoteListCallback
noRemoteListCallback :: Maybe RemoteListCallback
noRemoteListCallback = Maybe RemoteListCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for listing the references of a
-- t'GI.Ggit.Objects.Remote.Remote'. See 'GI.Ggit.Objects.Remote.remoteList'.
type RemoteListCallback_WithClosures =
    T.Text
    -- ^ /@name@/: the name of the reference.
    -> Ggit.OId.OId
    -- ^ /@oid@/: the reference\'s oid.
    -> Ggit.OId.OId
    -- ^ /@loid@/: the reference\'s loid.
    -> Bool
    -- ^ /@local@/: if available locally.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `RemoteListCallback_WithClosures`@.
noRemoteListCallback_WithClosures :: Maybe RemoteListCallback_WithClosures
noRemoteListCallback_WithClosures :: Maybe RemoteListCallback_WithClosures
noRemoteListCallback_WithClosures = Maybe RemoteListCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_RemoteListCallback :: RemoteListCallback -> RemoteListCallback_WithClosures
drop_closures_RemoteListCallback :: RemoteListCallback -> RemoteListCallback_WithClosures
drop_closures_RemoteListCallback RemoteListCallback
_f Text
name OId
oid OId
loid Bool
local Ptr ()
_ = RemoteListCallback
_f Text
name OId
oid OId
loid Bool
local

-- | Wrap the callback into a `GClosure`.
genClosure_RemoteListCallback :: MonadIO m => RemoteListCallback -> m (GClosure C_RemoteListCallback)
genClosure_RemoteListCallback :: RemoteListCallback -> m (GClosure C_RemoteListCallback)
genClosure_RemoteListCallback RemoteListCallback
cb = IO (GClosure C_RemoteListCallback)
-> m (GClosure C_RemoteListCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_RemoteListCallback)
 -> m (GClosure C_RemoteListCallback))
-> IO (GClosure C_RemoteListCallback)
-> m (GClosure C_RemoteListCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: RemoteListCallback_WithClosures
cb' = RemoteListCallback -> RemoteListCallback_WithClosures
drop_closures_RemoteListCallback RemoteListCallback
cb
    let cb'' :: C_RemoteListCallback
cb'' = Maybe (Ptr (FunPtr C_RemoteListCallback))
-> RemoteListCallback_WithClosures -> C_RemoteListCallback
wrap_RemoteListCallback Maybe (Ptr (FunPtr C_RemoteListCallback))
forall a. Maybe a
Nothing RemoteListCallback_WithClosures
cb'
    C_RemoteListCallback -> IO (FunPtr C_RemoteListCallback)
mk_RemoteListCallback C_RemoteListCallback
cb'' IO (FunPtr C_RemoteListCallback)
-> (FunPtr C_RemoteListCallback
    -> IO (GClosure C_RemoteListCallback))
-> IO (GClosure C_RemoteListCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_RemoteListCallback -> IO (GClosure C_RemoteListCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `RemoteListCallback` into a `C_RemoteListCallback`.
wrap_RemoteListCallback ::
    Maybe (Ptr (FunPtr C_RemoteListCallback)) ->
    RemoteListCallback_WithClosures ->
    C_RemoteListCallback
wrap_RemoteListCallback :: Maybe (Ptr (FunPtr C_RemoteListCallback))
-> RemoteListCallback_WithClosures -> C_RemoteListCallback
wrap_RemoteListCallback Maybe (Ptr (FunPtr C_RemoteListCallback))
funptrptr RemoteListCallback_WithClosures
_cb CString
name Ptr OId
oid Ptr OId
loid CInt
local Ptr ()
userData = do
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
oid ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
oid' -> do
        (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
loid ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
loid' -> do
            let local' :: Bool
local' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
local
            Int32
result <- RemoteListCallback_WithClosures
_cb  Text
name' OId
oid' OId
loid' Bool
local' Ptr ()
userData
            Maybe (Ptr (FunPtr C_RemoteListCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_RemoteListCallback))
funptrptr
            Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback ReferencesNameCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next references or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "name"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the name of the reference"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving the references\nin a #GgitRepository. See ggit_repository_references_foreach_name()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ReferencesNameCallback =
    CString ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the reference"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ReferencesNameCallback :: FunPtr C_ReferencesNameCallback -> C_ReferencesNameCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ReferencesNameCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ReferencesNameCallback
    -> T.Text
    -- ^ /@name@/: the name of the reference
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_ReferencesNameCallback :: FunPtr C_ReferencesNameCallback -> Text -> Ptr () -> m Int32
dynamic_ReferencesNameCallback FunPtr C_ReferencesNameCallback
__funPtr Text
name Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    Int32
result <- (FunPtr C_ReferencesNameCallback -> C_ReferencesNameCallback
__dynamic_C_ReferencesNameCallback FunPtr C_ReferencesNameCallback
__funPtr) CString
name' Ptr ()
userData
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_ReferencesNameCallback`.
foreign import ccall "wrapper"
    mk_ReferencesNameCallback :: C_ReferencesNameCallback -> IO (FunPtr C_ReferencesNameCallback)

-- | The type of the callback functions for retrieving the references
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryReferencesForeachName'.
type ReferencesNameCallback =
    T.Text
    -- ^ /@name@/: the name of the reference
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ReferencesNameCallback`@.
noReferencesNameCallback :: Maybe ReferencesNameCallback
noReferencesNameCallback :: Maybe ReferencesNameCallback
noReferencesNameCallback = Maybe ReferencesNameCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving the references
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryReferencesForeachName'.
type ReferencesNameCallback_WithClosures =
    T.Text
    -- ^ /@name@/: the name of the reference
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ReferencesNameCallback_WithClosures`@.
noReferencesNameCallback_WithClosures :: Maybe ReferencesNameCallback_WithClosures
noReferencesNameCallback_WithClosures :: Maybe ReferencesNameCallback_WithClosures
noReferencesNameCallback_WithClosures = Maybe ReferencesNameCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ReferencesNameCallback :: ReferencesNameCallback -> ReferencesNameCallback_WithClosures
drop_closures_ReferencesNameCallback :: ReferencesNameCallback -> ReferencesNameCallback_WithClosures
drop_closures_ReferencesNameCallback ReferencesNameCallback
_f Text
name Ptr ()
_ = ReferencesNameCallback
_f Text
name

-- | Wrap the callback into a `GClosure`.
genClosure_ReferencesNameCallback :: MonadIO m => ReferencesNameCallback -> m (GClosure C_ReferencesNameCallback)
genClosure_ReferencesNameCallback :: ReferencesNameCallback -> m (GClosure C_ReferencesNameCallback)
genClosure_ReferencesNameCallback ReferencesNameCallback
cb = IO (GClosure C_ReferencesNameCallback)
-> m (GClosure C_ReferencesNameCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ReferencesNameCallback)
 -> m (GClosure C_ReferencesNameCallback))
-> IO (GClosure C_ReferencesNameCallback)
-> m (GClosure C_ReferencesNameCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ReferencesNameCallback_WithClosures
cb' = ReferencesNameCallback -> ReferencesNameCallback_WithClosures
drop_closures_ReferencesNameCallback ReferencesNameCallback
cb
    let cb'' :: C_ReferencesNameCallback
cb'' = Maybe (Ptr (FunPtr C_ReferencesNameCallback))
-> ReferencesNameCallback_WithClosures -> C_ReferencesNameCallback
wrap_ReferencesNameCallback Maybe (Ptr (FunPtr C_ReferencesNameCallback))
forall a. Maybe a
Nothing ReferencesNameCallback_WithClosures
cb'
    C_ReferencesNameCallback -> IO (FunPtr C_ReferencesNameCallback)
mk_ReferencesNameCallback C_ReferencesNameCallback
cb'' IO (FunPtr C_ReferencesNameCallback)
-> (FunPtr C_ReferencesNameCallback
    -> IO (GClosure C_ReferencesNameCallback))
-> IO (GClosure C_ReferencesNameCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ReferencesNameCallback
-> IO (GClosure C_ReferencesNameCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ReferencesNameCallback` into a `C_ReferencesNameCallback`.
wrap_ReferencesNameCallback ::
    Maybe (Ptr (FunPtr C_ReferencesNameCallback)) ->
    ReferencesNameCallback_WithClosures ->
    C_ReferencesNameCallback
wrap_ReferencesNameCallback :: Maybe (Ptr (FunPtr C_ReferencesNameCallback))
-> ReferencesNameCallback_WithClosures -> C_ReferencesNameCallback
wrap_ReferencesNameCallback Maybe (Ptr (FunPtr C_ReferencesNameCallback))
funptrptr ReferencesNameCallback_WithClosures
_cb CString
name Ptr ()
userData = do
    Text
name' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
name
    Int32
result <- ReferencesNameCallback_WithClosures
_cb  Text
name' Ptr ()
userData
    Maybe (Ptr (FunPtr C_ReferencesNameCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ReferencesNameCallback))
funptrptr
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback ReferencesCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next references or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "reference"
          , argType = TInterface Name { namespace = "Ggit" , name = "Ref" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the reference." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving the references\nin a #GgitRepository. See ggit_repository_references_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ReferencesCallback =
    Ptr Ggit.Ref.Ref ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "reference"
--           , argType = TInterface Name { namespace = "Ggit" , name = "Ref" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the reference." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ReferencesCallback :: FunPtr C_ReferencesCallback -> C_ReferencesCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ReferencesCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Ggit.Ref.IsRef a) =>
    FunPtr C_ReferencesCallback
    -> a
    -- ^ /@reference@/: the reference.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_ReferencesCallback :: FunPtr C_ReferencesCallback -> a -> Ptr () -> m Int32
dynamic_ReferencesCallback FunPtr C_ReferencesCallback
__funPtr a
reference Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Ref
reference' <- a -> IO (Ptr Ref)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject a
reference
    Int32
result <- (FunPtr C_ReferencesCallback -> C_ReferencesCallback
__dynamic_C_ReferencesCallback FunPtr C_ReferencesCallback
__funPtr) Ptr Ref
reference' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
reference
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_ReferencesCallback`.
foreign import ccall "wrapper"
    mk_ReferencesCallback :: C_ReferencesCallback -> IO (FunPtr C_ReferencesCallback)

-- | The type of the callback functions for retrieving the references
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryReferencesForeach'.
type ReferencesCallback =
    Ggit.Ref.Ref
    -- ^ /@reference@/: the reference.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ReferencesCallback`@.
noReferencesCallback :: Maybe ReferencesCallback
noReferencesCallback :: Maybe ReferencesCallback
noReferencesCallback = Maybe ReferencesCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving the references
-- in a t'GI.Ggit.Objects.Repository.Repository'. See 'GI.Ggit.Objects.Repository.repositoryReferencesForeach'.
type ReferencesCallback_WithClosures =
    Ggit.Ref.Ref
    -- ^ /@reference@/: the reference.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next references or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ReferencesCallback_WithClosures`@.
noReferencesCallback_WithClosures :: Maybe ReferencesCallback_WithClosures
noReferencesCallback_WithClosures :: Maybe ReferencesCallback_WithClosures
noReferencesCallback_WithClosures = Maybe ReferencesCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ReferencesCallback :: ReferencesCallback -> ReferencesCallback_WithClosures
drop_closures_ReferencesCallback :: ReferencesCallback -> ReferencesCallback_WithClosures
drop_closures_ReferencesCallback ReferencesCallback
_f Ref
reference Ptr ()
_ = ReferencesCallback
_f Ref
reference

-- | Wrap the callback into a `GClosure`.
genClosure_ReferencesCallback :: MonadIO m => ReferencesCallback -> m (GClosure C_ReferencesCallback)
genClosure_ReferencesCallback :: ReferencesCallback -> m (GClosure C_ReferencesCallback)
genClosure_ReferencesCallback ReferencesCallback
cb = IO (GClosure C_ReferencesCallback)
-> m (GClosure C_ReferencesCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ReferencesCallback)
 -> m (GClosure C_ReferencesCallback))
-> IO (GClosure C_ReferencesCallback)
-> m (GClosure C_ReferencesCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ReferencesCallback_WithClosures
cb' = ReferencesCallback -> ReferencesCallback_WithClosures
drop_closures_ReferencesCallback ReferencesCallback
cb
    let cb'' :: C_ReferencesCallback
cb'' = Maybe (Ptr (FunPtr C_ReferencesCallback))
-> ReferencesCallback_WithClosures -> C_ReferencesCallback
wrap_ReferencesCallback Maybe (Ptr (FunPtr C_ReferencesCallback))
forall a. Maybe a
Nothing ReferencesCallback_WithClosures
cb'
    C_ReferencesCallback -> IO (FunPtr C_ReferencesCallback)
mk_ReferencesCallback C_ReferencesCallback
cb'' IO (FunPtr C_ReferencesCallback)
-> (FunPtr C_ReferencesCallback
    -> IO (GClosure C_ReferencesCallback))
-> IO (GClosure C_ReferencesCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ReferencesCallback -> IO (GClosure C_ReferencesCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ReferencesCallback` into a `C_ReferencesCallback`.
wrap_ReferencesCallback ::
    Maybe (Ptr (FunPtr C_ReferencesCallback)) ->
    ReferencesCallback_WithClosures ->
    C_ReferencesCallback
wrap_ReferencesCallback :: Maybe (Ptr (FunPtr C_ReferencesCallback))
-> ReferencesCallback_WithClosures -> C_ReferencesCallback
wrap_ReferencesCallback Maybe (Ptr (FunPtr C_ReferencesCallback))
funptrptr ReferencesCallback_WithClosures
_cb Ptr Ref
reference Ptr ()
userData = do
    Ref
reference' <- ((ManagedPtr Ref -> Ref) -> Ptr Ref -> IO Ref
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Ref -> Ref
Ggit.Ref.Ref) Ptr Ref
reference
    Int32
result <- ReferencesCallback_WithClosures
_cb  Ref
reference' Ptr ()
userData
    Maybe (Ptr (FunPtr C_ReferencesCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ReferencesCallback))
funptrptr
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback NoteCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "blob_id"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "id of the blob containing the message."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "annotated_object_id"
          , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "id of the git object being annotated."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "When iterating over all the notes, callback that will be\nissued per note. See ggit_repository_note_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_NoteCallback =
    Ptr Ggit.OId.OId ->
    Ptr Ggit.OId.OId ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "blob_id"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "id of the blob containing the message."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "annotated_object_id"
--           , argType = TInterface Name { namespace = "Ggit" , name = "OId" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "id of the git object being annotated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-suplied data." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_NoteCallback :: FunPtr C_NoteCallback -> C_NoteCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_NoteCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_NoteCallback
    -> Ggit.OId.OId
    -- ^ /@blobId@/: id of the blob containing the message.
    -> Ggit.OId.OId
    -- ^ /@annotatedObjectId@/: id of the git object being annotated.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_NoteCallback :: FunPtr C_NoteCallback -> OId -> OId -> Ptr () -> m Int32
dynamic_NoteCallback FunPtr C_NoteCallback
__funPtr OId
blobId OId
annotatedObjectId Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr OId
blobId' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
blobId
    Ptr OId
annotatedObjectId' <- OId -> IO (Ptr OId)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OId
annotatedObjectId
    Int32
result <- (FunPtr C_NoteCallback -> C_NoteCallback
__dynamic_C_NoteCallback FunPtr C_NoteCallback
__funPtr) Ptr OId
blobId' Ptr OId
annotatedObjectId' Ptr ()
userData
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
blobId
    OId -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OId
annotatedObjectId
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_NoteCallback`.
foreign import ccall "wrapper"
    mk_NoteCallback :: C_NoteCallback -> IO (FunPtr C_NoteCallback)

-- | When iterating over all the notes, callback that will be
-- issued per note. See 'GI.Ggit.Objects.Repository.repositoryNoteForeach'.
type NoteCallback =
    Ggit.OId.OId
    -- ^ /@blobId@/: id of the blob containing the message.
    -> Ggit.OId.OId
    -- ^ /@annotatedObjectId@/: id of the git object being annotated.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `NoteCallback`@.
noNoteCallback :: Maybe NoteCallback
noNoteCallback :: Maybe NoteCallback
noNoteCallback = Maybe NoteCallback
forall a. Maybe a
Nothing

-- | When iterating over all the notes, callback that will be
-- issued per note. See 'GI.Ggit.Objects.Repository.repositoryNoteForeach'.
type NoteCallback_WithClosures =
    Ggit.OId.OId
    -- ^ /@blobId@/: id of the blob containing the message.
    -> Ggit.OId.OId
    -- ^ /@annotatedObjectId@/: id of the git object being annotated.
    -> Ptr ()
    -- ^ /@userData@/: user-suplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `NoteCallback_WithClosures`@.
noNoteCallback_WithClosures :: Maybe NoteCallback_WithClosures
noNoteCallback_WithClosures :: Maybe NoteCallback_WithClosures
noNoteCallback_WithClosures = Maybe NoteCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_NoteCallback :: NoteCallback -> NoteCallback_WithClosures
drop_closures_NoteCallback :: NoteCallback -> NoteCallback_WithClosures
drop_closures_NoteCallback NoteCallback
_f OId
blobId OId
annotatedObjectId Ptr ()
_ = NoteCallback
_f OId
blobId OId
annotatedObjectId

-- | Wrap the callback into a `GClosure`.
genClosure_NoteCallback :: MonadIO m => NoteCallback -> m (GClosure C_NoteCallback)
genClosure_NoteCallback :: NoteCallback -> m (GClosure C_NoteCallback)
genClosure_NoteCallback NoteCallback
cb = IO (GClosure C_NoteCallback) -> m (GClosure C_NoteCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_NoteCallback) -> m (GClosure C_NoteCallback))
-> IO (GClosure C_NoteCallback) -> m (GClosure C_NoteCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: NoteCallback_WithClosures
cb' = NoteCallback -> NoteCallback_WithClosures
drop_closures_NoteCallback NoteCallback
cb
    let cb'' :: C_NoteCallback
cb'' = Maybe (Ptr (FunPtr C_NoteCallback))
-> NoteCallback_WithClosures -> C_NoteCallback
wrap_NoteCallback Maybe (Ptr (FunPtr C_NoteCallback))
forall a. Maybe a
Nothing NoteCallback_WithClosures
cb'
    C_NoteCallback -> IO (FunPtr C_NoteCallback)
mk_NoteCallback C_NoteCallback
cb'' IO (FunPtr C_NoteCallback)
-> (FunPtr C_NoteCallback -> IO (GClosure C_NoteCallback))
-> IO (GClosure C_NoteCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_NoteCallback -> IO (GClosure C_NoteCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `NoteCallback` into a `C_NoteCallback`.
wrap_NoteCallback ::
    Maybe (Ptr (FunPtr C_NoteCallback)) ->
    NoteCallback_WithClosures ->
    C_NoteCallback
wrap_NoteCallback :: Maybe (Ptr (FunPtr C_NoteCallback))
-> NoteCallback_WithClosures -> C_NoteCallback
wrap_NoteCallback Maybe (Ptr (FunPtr C_NoteCallback))
funptrptr NoteCallback_WithClosures
_cb Ptr OId
blobId Ptr OId
annotatedObjectId Ptr ()
userData = do
    (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
blobId ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
blobId' -> do
        (ManagedPtr OId -> OId) -> Ptr OId -> (OId -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr OId -> OId
Ggit.OId.OId Ptr OId
annotatedObjectId ((OId -> IO Int32) -> IO Int32) -> (OId -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \OId
annotatedObjectId' -> do
            Int32
result <- NoteCallback_WithClosures
_cb  OId
blobId' OId
annotatedObjectId' Ptr ()
userData
            Maybe (Ptr (FunPtr C_NoteCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_NoteCallback))
funptrptr
            Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffSimilarityMetricSimilarityCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "score"
          , argType = TBasicType TInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "signature_a"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "signature_b"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffSimilarityMetricSimilarityCallback =
    Int32 ->
    Ptr () ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "score"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signature_a"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signature_b"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricSimilarityCallback :: FunPtr C_DiffSimilarityMetricSimilarityCallback -> C_DiffSimilarityMetricSimilarityCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffSimilarityMetricSimilarityCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricSimilarityCallback
    -> Int32
    -> Ptr ()
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricSimilarityCallback :: FunPtr C_DiffSimilarityMetricSimilarityCallback
-> Int32 -> Ptr () -> Ptr () -> Ptr () -> m Int32
dynamic_DiffSimilarityMetricSimilarityCallback FunPtr C_DiffSimilarityMetricSimilarityCallback
__funPtr Int32
score Ptr ()
signatureA Ptr ()
signatureB Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- (FunPtr C_DiffSimilarityMetricSimilarityCallback
-> C_DiffSimilarityMetricSimilarityCallback
__dynamic_C_DiffSimilarityMetricSimilarityCallback FunPtr C_DiffSimilarityMetricSimilarityCallback
__funPtr) Int32
score Ptr ()
signatureA Ptr ()
signatureB Ptr ()
userData
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffSimilarityMetricSimilarityCallback`.
foreign import ccall "wrapper"
    mk_DiffSimilarityMetricSimilarityCallback :: C_DiffSimilarityMetricSimilarityCallback -> IO (FunPtr C_DiffSimilarityMetricSimilarityCallback)

-- | /No description available in the introspection data./
type DiffSimilarityMetricSimilarityCallback =
    Int32
    -> Ptr ()
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricSimilarityCallback`@.
noDiffSimilarityMetricSimilarityCallback :: Maybe DiffSimilarityMetricSimilarityCallback
noDiffSimilarityMetricSimilarityCallback :: Maybe DiffSimilarityMetricSimilarityCallback
noDiffSimilarityMetricSimilarityCallback = Maybe DiffSimilarityMetricSimilarityCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type DiffSimilarityMetricSimilarityCallback_WithClosures =
    Int32
    -> Ptr ()
    -> Ptr ()
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricSimilarityCallback_WithClosures`@.
noDiffSimilarityMetricSimilarityCallback_WithClosures :: Maybe DiffSimilarityMetricSimilarityCallback_WithClosures
noDiffSimilarityMetricSimilarityCallback_WithClosures :: Maybe C_DiffSimilarityMetricSimilarityCallback
noDiffSimilarityMetricSimilarityCallback_WithClosures = Maybe C_DiffSimilarityMetricSimilarityCallback
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffSimilarityMetricSimilarityCallback :: DiffSimilarityMetricSimilarityCallback -> DiffSimilarityMetricSimilarityCallback_WithClosures
drop_closures_DiffSimilarityMetricSimilarityCallback :: DiffSimilarityMetricSimilarityCallback
-> C_DiffSimilarityMetricSimilarityCallback
drop_closures_DiffSimilarityMetricSimilarityCallback DiffSimilarityMetricSimilarityCallback
_f Int32
score Ptr ()
signatureA Ptr ()
signatureB Ptr ()
_ = DiffSimilarityMetricSimilarityCallback
_f Int32
score Ptr ()
signatureA Ptr ()
signatureB

-- | Wrap the callback into a `GClosure`.
genClosure_DiffSimilarityMetricSimilarityCallback :: MonadIO m => DiffSimilarityMetricSimilarityCallback -> m (GClosure C_DiffSimilarityMetricSimilarityCallback)
genClosure_DiffSimilarityMetricSimilarityCallback :: DiffSimilarityMetricSimilarityCallback
-> m (GClosure C_DiffSimilarityMetricSimilarityCallback)
genClosure_DiffSimilarityMetricSimilarityCallback DiffSimilarityMetricSimilarityCallback
cb = IO (GClosure C_DiffSimilarityMetricSimilarityCallback)
-> m (GClosure C_DiffSimilarityMetricSimilarityCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffSimilarityMetricSimilarityCallback)
 -> m (GClosure C_DiffSimilarityMetricSimilarityCallback))
-> IO (GClosure C_DiffSimilarityMetricSimilarityCallback)
-> m (GClosure C_DiffSimilarityMetricSimilarityCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DiffSimilarityMetricSimilarityCallback
cb' = DiffSimilarityMetricSimilarityCallback
-> C_DiffSimilarityMetricSimilarityCallback
drop_closures_DiffSimilarityMetricSimilarityCallback DiffSimilarityMetricSimilarityCallback
cb
    let cb'' :: C_DiffSimilarityMetricSimilarityCallback
cb'' = Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
-> C_DiffSimilarityMetricSimilarityCallback
-> C_DiffSimilarityMetricSimilarityCallback
wrap_DiffSimilarityMetricSimilarityCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
forall a. Maybe a
Nothing C_DiffSimilarityMetricSimilarityCallback
cb'
    C_DiffSimilarityMetricSimilarityCallback
-> IO (FunPtr C_DiffSimilarityMetricSimilarityCallback)
mk_DiffSimilarityMetricSimilarityCallback C_DiffSimilarityMetricSimilarityCallback
cb'' IO (FunPtr C_DiffSimilarityMetricSimilarityCallback)
-> (FunPtr C_DiffSimilarityMetricSimilarityCallback
    -> IO (GClosure C_DiffSimilarityMetricSimilarityCallback))
-> IO (GClosure C_DiffSimilarityMetricSimilarityCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffSimilarityMetricSimilarityCallback
-> IO (GClosure C_DiffSimilarityMetricSimilarityCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffSimilarityMetricSimilarityCallback` into a `C_DiffSimilarityMetricSimilarityCallback`.
wrap_DiffSimilarityMetricSimilarityCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback)) ->
    DiffSimilarityMetricSimilarityCallback_WithClosures ->
    C_DiffSimilarityMetricSimilarityCallback
wrap_DiffSimilarityMetricSimilarityCallback :: Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
-> C_DiffSimilarityMetricSimilarityCallback
-> C_DiffSimilarityMetricSimilarityCallback
wrap_DiffSimilarityMetricSimilarityCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
funptrptr C_DiffSimilarityMetricSimilarityCallback
_cb Int32
score Ptr ()
signatureA Ptr ()
signatureB Ptr ()
userData = do
    Int32
result <- C_DiffSimilarityMetricSimilarityCallback
_cb  Int32
score Ptr ()
signatureA Ptr ()
signatureB Ptr ()
userData
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
-> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffSimilarityMetricSimilarityCallback))
funptrptr
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffSimilarityMetricFreeSignatureCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "signature"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffSimilarityMetricFreeSignatureCallback =
    Ptr () ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "signature"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricFreeSignatureCallback :: FunPtr C_DiffSimilarityMetricFreeSignatureCallback -> C_DiffSimilarityMetricFreeSignatureCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffSimilarityMetricFreeSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricFreeSignatureCallback
    -> Ptr ()
    -> Ptr ()
    -> m ()
dynamic_DiffSimilarityMetricFreeSignatureCallback :: FunPtr C_DiffSimilarityMetricFreeSignatureCallback
-> Ptr () -> Ptr () -> m ()
dynamic_DiffSimilarityMetricFreeSignatureCallback FunPtr C_DiffSimilarityMetricFreeSignatureCallback
__funPtr Ptr ()
signature Ptr ()
userData = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    (FunPtr C_DiffSimilarityMetricFreeSignatureCallback
-> C_DiffSimilarityMetricFreeSignatureCallback
__dynamic_C_DiffSimilarityMetricFreeSignatureCallback FunPtr C_DiffSimilarityMetricFreeSignatureCallback
__funPtr) Ptr ()
signature Ptr ()
userData
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- | Generate a function pointer callable from C code, from a `C_DiffSimilarityMetricFreeSignatureCallback`.
foreign import ccall "wrapper"
    mk_DiffSimilarityMetricFreeSignatureCallback :: C_DiffSimilarityMetricFreeSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)

-- | /No description available in the introspection data./
type DiffSimilarityMetricFreeSignatureCallback =
    Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricFreeSignatureCallback`@.
noDiffSimilarityMetricFreeSignatureCallback :: Maybe DiffSimilarityMetricFreeSignatureCallback
noDiffSimilarityMetricFreeSignatureCallback :: Maybe DiffSimilarityMetricFreeSignatureCallback
noDiffSimilarityMetricFreeSignatureCallback = Maybe DiffSimilarityMetricFreeSignatureCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type DiffSimilarityMetricFreeSignatureCallback_WithClosures =
    Ptr ()
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricFreeSignatureCallback_WithClosures`@.
noDiffSimilarityMetricFreeSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricFreeSignatureCallback_WithClosures
noDiffSimilarityMetricFreeSignatureCallback_WithClosures :: Maybe C_DiffSimilarityMetricFreeSignatureCallback
noDiffSimilarityMetricFreeSignatureCallback_WithClosures = Maybe C_DiffSimilarityMetricFreeSignatureCallback
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffSimilarityMetricFreeSignatureCallback :: DiffSimilarityMetricFreeSignatureCallback -> DiffSimilarityMetricFreeSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFreeSignatureCallback :: DiffSimilarityMetricFreeSignatureCallback
-> C_DiffSimilarityMetricFreeSignatureCallback
drop_closures_DiffSimilarityMetricFreeSignatureCallback DiffSimilarityMetricFreeSignatureCallback
_f Ptr ()
signature Ptr ()
_ = DiffSimilarityMetricFreeSignatureCallback
_f Ptr ()
signature

-- | Wrap the callback into a `GClosure`.
genClosure_DiffSimilarityMetricFreeSignatureCallback :: MonadIO m => DiffSimilarityMetricFreeSignatureCallback -> m (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
genClosure_DiffSimilarityMetricFreeSignatureCallback :: DiffSimilarityMetricFreeSignatureCallback
-> m (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
genClosure_DiffSimilarityMetricFreeSignatureCallback DiffSimilarityMetricFreeSignatureCallback
cb = IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
 -> m (GClosure C_DiffSimilarityMetricFreeSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DiffSimilarityMetricFreeSignatureCallback
cb' = DiffSimilarityMetricFreeSignatureCallback
-> C_DiffSimilarityMetricFreeSignatureCallback
drop_closures_DiffSimilarityMetricFreeSignatureCallback DiffSimilarityMetricFreeSignatureCallback
cb
    let cb'' :: C_DiffSimilarityMetricFreeSignatureCallback
cb'' = Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
-> C_DiffSimilarityMetricFreeSignatureCallback
-> C_DiffSimilarityMetricFreeSignatureCallback
wrap_DiffSimilarityMetricFreeSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
forall a. Maybe a
Nothing C_DiffSimilarityMetricFreeSignatureCallback
cb'
    C_DiffSimilarityMetricFreeSignatureCallback
-> IO (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)
mk_DiffSimilarityMetricFreeSignatureCallback C_DiffSimilarityMetricFreeSignatureCallback
cb'' IO (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)
-> (FunPtr C_DiffSimilarityMetricFreeSignatureCallback
    -> IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffSimilarityMetricFreeSignatureCallback
-> IO (GClosure C_DiffSimilarityMetricFreeSignatureCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffSimilarityMetricFreeSignatureCallback` into a `C_DiffSimilarityMetricFreeSignatureCallback`.
wrap_DiffSimilarityMetricFreeSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback)) ->
    DiffSimilarityMetricFreeSignatureCallback_WithClosures ->
    C_DiffSimilarityMetricFreeSignatureCallback
wrap_DiffSimilarityMetricFreeSignatureCallback :: Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
-> C_DiffSimilarityMetricFreeSignatureCallback
-> C_DiffSimilarityMetricFreeSignatureCallback
wrap_DiffSimilarityMetricFreeSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
funptrptr C_DiffSimilarityMetricFreeSignatureCallback
_cb Ptr ()
signature Ptr ()
userData = do
    C_DiffSimilarityMetricFreeSignatureCallback
_cb  Ptr ()
signature Ptr ()
userData
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
-> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffSimilarityMetricFreeSignatureCallback))
funptrptr


-- callback DiffSimilarityMetricFileSignatureCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "file"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffFile" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "fullpath"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "out"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffSimilarityMetricFileSignatureCallback =
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "file"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffFile" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "fullpath"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricFileSignatureCallback :: FunPtr C_DiffSimilarityMetricFileSignatureCallback -> C_DiffSimilarityMetricFileSignatureCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffSimilarityMetricFileSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricFileSignatureCallback
    -> Ggit.DiffFile.DiffFile
    -> T.Text
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricFileSignatureCallback :: FunPtr C_DiffSimilarityMetricFileSignatureCallback
-> DiffFile -> Text -> Ptr () -> Ptr () -> m Int32
dynamic_DiffSimilarityMetricFileSignatureCallback FunPtr C_DiffSimilarityMetricFileSignatureCallback
__funPtr DiffFile
file Text
fullpath Ptr ()
out Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffFile
file' <- DiffFile -> IO (Ptr DiffFile)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffFile
file
    CString
fullpath' <- Text -> IO CString
textToCString Text
fullpath
    Int32
result <- (FunPtr C_DiffSimilarityMetricFileSignatureCallback
-> C_DiffSimilarityMetricFileSignatureCallback
__dynamic_C_DiffSimilarityMetricFileSignatureCallback FunPtr C_DiffSimilarityMetricFileSignatureCallback
__funPtr) Ptr DiffFile
file' CString
fullpath' Ptr ()
out Ptr ()
userData
    DiffFile -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffFile
file
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fullpath'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffSimilarityMetricFileSignatureCallback`.
foreign import ccall "wrapper"
    mk_DiffSimilarityMetricFileSignatureCallback :: C_DiffSimilarityMetricFileSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricFileSignatureCallback)

-- | /No description available in the introspection data./
type DiffSimilarityMetricFileSignatureCallback =
    Ggit.DiffFile.DiffFile
    -> T.Text
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricFileSignatureCallback`@.
noDiffSimilarityMetricFileSignatureCallback :: Maybe DiffSimilarityMetricFileSignatureCallback
noDiffSimilarityMetricFileSignatureCallback :: Maybe DiffSimilarityMetricFileSignatureCallback
noDiffSimilarityMetricFileSignatureCallback = Maybe DiffSimilarityMetricFileSignatureCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type DiffSimilarityMetricFileSignatureCallback_WithClosures =
    Ggit.DiffFile.DiffFile
    -> T.Text
    -> Ptr ()
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricFileSignatureCallback_WithClosures`@.
noDiffSimilarityMetricFileSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricFileSignatureCallback_WithClosures
noDiffSimilarityMetricFileSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricFileSignatureCallback_WithClosures
noDiffSimilarityMetricFileSignatureCallback_WithClosures = Maybe DiffSimilarityMetricFileSignatureCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffSimilarityMetricFileSignatureCallback :: DiffSimilarityMetricFileSignatureCallback -> DiffSimilarityMetricFileSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFileSignatureCallback :: DiffSimilarityMetricFileSignatureCallback
-> DiffSimilarityMetricFileSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFileSignatureCallback DiffSimilarityMetricFileSignatureCallback
_f DiffFile
file Text
fullpath Ptr ()
out Ptr ()
_ = DiffSimilarityMetricFileSignatureCallback
_f DiffFile
file Text
fullpath Ptr ()
out

-- | Wrap the callback into a `GClosure`.
genClosure_DiffSimilarityMetricFileSignatureCallback :: MonadIO m => DiffSimilarityMetricFileSignatureCallback -> m (GClosure C_DiffSimilarityMetricFileSignatureCallback)
genClosure_DiffSimilarityMetricFileSignatureCallback :: DiffSimilarityMetricFileSignatureCallback
-> m (GClosure C_DiffSimilarityMetricFileSignatureCallback)
genClosure_DiffSimilarityMetricFileSignatureCallback DiffSimilarityMetricFileSignatureCallback
cb = IO (GClosure C_DiffSimilarityMetricFileSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricFileSignatureCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffSimilarityMetricFileSignatureCallback)
 -> m (GClosure C_DiffSimilarityMetricFileSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricFileSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricFileSignatureCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffSimilarityMetricFileSignatureCallback_WithClosures
cb' = DiffSimilarityMetricFileSignatureCallback
-> DiffSimilarityMetricFileSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricFileSignatureCallback DiffSimilarityMetricFileSignatureCallback
cb
    let cb'' :: C_DiffSimilarityMetricFileSignatureCallback
cb'' = Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
-> DiffSimilarityMetricFileSignatureCallback_WithClosures
-> C_DiffSimilarityMetricFileSignatureCallback
wrap_DiffSimilarityMetricFileSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
forall a. Maybe a
Nothing DiffSimilarityMetricFileSignatureCallback_WithClosures
cb'
    C_DiffSimilarityMetricFileSignatureCallback
-> IO (FunPtr C_DiffSimilarityMetricFileSignatureCallback)
mk_DiffSimilarityMetricFileSignatureCallback C_DiffSimilarityMetricFileSignatureCallback
cb'' IO (FunPtr C_DiffSimilarityMetricFileSignatureCallback)
-> (FunPtr C_DiffSimilarityMetricFileSignatureCallback
    -> IO (GClosure C_DiffSimilarityMetricFileSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricFileSignatureCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffSimilarityMetricFileSignatureCallback
-> IO (GClosure C_DiffSimilarityMetricFileSignatureCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffSimilarityMetricFileSignatureCallback` into a `C_DiffSimilarityMetricFileSignatureCallback`.
wrap_DiffSimilarityMetricFileSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback)) ->
    DiffSimilarityMetricFileSignatureCallback_WithClosures ->
    C_DiffSimilarityMetricFileSignatureCallback
wrap_DiffSimilarityMetricFileSignatureCallback :: Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
-> DiffSimilarityMetricFileSignatureCallback_WithClosures
-> C_DiffSimilarityMetricFileSignatureCallback
wrap_DiffSimilarityMetricFileSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
funptrptr DiffSimilarityMetricFileSignatureCallback_WithClosures
_cb Ptr DiffFile
file CString
fullpath Ptr ()
out Ptr ()
userData = do
    (ManagedPtr DiffFile -> DiffFile)
-> Ptr DiffFile -> (DiffFile -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffFile -> DiffFile
Ggit.DiffFile.DiffFile Ptr DiffFile
file ((DiffFile -> IO Int32) -> IO Int32)
-> (DiffFile -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffFile
file' -> do
        Text
fullpath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
fullpath
        Int32
result <- DiffSimilarityMetricFileSignatureCallback_WithClosures
_cb  DiffFile
file' Text
fullpath' Ptr ()
out Ptr ()
userData
        Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
-> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffSimilarityMetricFileSignatureCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffSimilarityMetricBufferSignatureCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "file"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffFile" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "buf"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "buflen"
          , argType = TBasicType TUInt64
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "out"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffSimilarityMetricBufferSignatureCallback =
    Ptr Ggit.DiffFile.DiffFile ->
    CString ->
    Word64 ->
    Ptr () ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "file"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffFile" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buflen"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffSimilarityMetricBufferSignatureCallback :: FunPtr C_DiffSimilarityMetricBufferSignatureCallback -> C_DiffSimilarityMetricBufferSignatureCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffSimilarityMetricBufferSignatureCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffSimilarityMetricBufferSignatureCallback
    -> Ggit.DiffFile.DiffFile
    -> T.Text
    -> Word64
    -> Ptr ()
    -> Ptr ()
    -> m Int32
dynamic_DiffSimilarityMetricBufferSignatureCallback :: FunPtr C_DiffSimilarityMetricBufferSignatureCallback
-> DiffFile -> Text -> Word64 -> Ptr () -> Ptr () -> m Int32
dynamic_DiffSimilarityMetricBufferSignatureCallback FunPtr C_DiffSimilarityMetricBufferSignatureCallback
__funPtr DiffFile
file Text
buf Word64
buflen Ptr ()
out Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffFile
file' <- DiffFile -> IO (Ptr DiffFile)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffFile
file
    CString
buf' <- Text -> IO CString
textToCString Text
buf
    Int32
result <- (FunPtr C_DiffSimilarityMetricBufferSignatureCallback
-> C_DiffSimilarityMetricBufferSignatureCallback
__dynamic_C_DiffSimilarityMetricBufferSignatureCallback FunPtr C_DiffSimilarityMetricBufferSignatureCallback
__funPtr) Ptr DiffFile
file' CString
buf' Word64
buflen Ptr ()
out Ptr ()
userData
    DiffFile -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffFile
file
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
buf'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffSimilarityMetricBufferSignatureCallback`.
foreign import ccall "wrapper"
    mk_DiffSimilarityMetricBufferSignatureCallback :: C_DiffSimilarityMetricBufferSignatureCallback -> IO (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)

-- | /No description available in the introspection data./
type DiffSimilarityMetricBufferSignatureCallback =
    Ggit.DiffFile.DiffFile
    -> T.Text
    -> Word64
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricBufferSignatureCallback`@.
noDiffSimilarityMetricBufferSignatureCallback :: Maybe DiffSimilarityMetricBufferSignatureCallback
noDiffSimilarityMetricBufferSignatureCallback :: Maybe DiffSimilarityMetricBufferSignatureCallback
noDiffSimilarityMetricBufferSignatureCallback = Maybe DiffSimilarityMetricBufferSignatureCallback
forall a. Maybe a
Nothing

-- | /No description available in the introspection data./
type DiffSimilarityMetricBufferSignatureCallback_WithClosures =
    Ggit.DiffFile.DiffFile
    -> T.Text
    -> Word64
    -> Ptr ()
    -> Ptr ()
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffSimilarityMetricBufferSignatureCallback_WithClosures`@.
noDiffSimilarityMetricBufferSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricBufferSignatureCallback_WithClosures
noDiffSimilarityMetricBufferSignatureCallback_WithClosures :: Maybe DiffSimilarityMetricBufferSignatureCallback_WithClosures
noDiffSimilarityMetricBufferSignatureCallback_WithClosures = Maybe DiffSimilarityMetricBufferSignatureCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffSimilarityMetricBufferSignatureCallback :: DiffSimilarityMetricBufferSignatureCallback -> DiffSimilarityMetricBufferSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricBufferSignatureCallback :: DiffSimilarityMetricBufferSignatureCallback
-> DiffSimilarityMetricBufferSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricBufferSignatureCallback DiffSimilarityMetricBufferSignatureCallback
_f DiffFile
file Text
buf Word64
buflen Ptr ()
out Ptr ()
_ = DiffSimilarityMetricBufferSignatureCallback
_f DiffFile
file Text
buf Word64
buflen Ptr ()
out

-- | Wrap the callback into a `GClosure`.
genClosure_DiffSimilarityMetricBufferSignatureCallback :: MonadIO m => DiffSimilarityMetricBufferSignatureCallback -> m (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
genClosure_DiffSimilarityMetricBufferSignatureCallback :: DiffSimilarityMetricBufferSignatureCallback
-> m (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
genClosure_DiffSimilarityMetricBufferSignatureCallback DiffSimilarityMetricBufferSignatureCallback
cb = IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
 -> m (GClosure C_DiffSimilarityMetricBufferSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
-> m (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffSimilarityMetricBufferSignatureCallback_WithClosures
cb' = DiffSimilarityMetricBufferSignatureCallback
-> DiffSimilarityMetricBufferSignatureCallback_WithClosures
drop_closures_DiffSimilarityMetricBufferSignatureCallback DiffSimilarityMetricBufferSignatureCallback
cb
    let cb'' :: C_DiffSimilarityMetricBufferSignatureCallback
cb'' = Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
-> DiffSimilarityMetricBufferSignatureCallback_WithClosures
-> C_DiffSimilarityMetricBufferSignatureCallback
wrap_DiffSimilarityMetricBufferSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
forall a. Maybe a
Nothing DiffSimilarityMetricBufferSignatureCallback_WithClosures
cb'
    C_DiffSimilarityMetricBufferSignatureCallback
-> IO (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)
mk_DiffSimilarityMetricBufferSignatureCallback C_DiffSimilarityMetricBufferSignatureCallback
cb'' IO (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)
-> (FunPtr C_DiffSimilarityMetricBufferSignatureCallback
    -> IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback))
-> IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffSimilarityMetricBufferSignatureCallback
-> IO (GClosure C_DiffSimilarityMetricBufferSignatureCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffSimilarityMetricBufferSignatureCallback` into a `C_DiffSimilarityMetricBufferSignatureCallback`.
wrap_DiffSimilarityMetricBufferSignatureCallback ::
    Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback)) ->
    DiffSimilarityMetricBufferSignatureCallback_WithClosures ->
    C_DiffSimilarityMetricBufferSignatureCallback
wrap_DiffSimilarityMetricBufferSignatureCallback :: Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
-> DiffSimilarityMetricBufferSignatureCallback_WithClosures
-> C_DiffSimilarityMetricBufferSignatureCallback
wrap_DiffSimilarityMetricBufferSignatureCallback Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
funptrptr DiffSimilarityMetricBufferSignatureCallback_WithClosures
_cb Ptr DiffFile
file CString
buf Word64
buflen Ptr ()
out Ptr ()
userData = do
    (ManagedPtr DiffFile -> DiffFile)
-> Ptr DiffFile -> (DiffFile -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffFile -> DiffFile
Ggit.DiffFile.DiffFile Ptr DiffFile
file ((DiffFile -> IO Int32) -> IO Int32)
-> (DiffFile -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffFile
file' -> do
        Text
buf' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
buf
        Int32
result <- DiffSimilarityMetricBufferSignatureCallback_WithClosures
_cb  DiffFile
file' Text
buf' Word64
buflen Ptr ()
out Ptr ()
userData
        Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
-> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffSimilarityMetricBufferSignatureCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffLineCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "delta"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "hunk"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffHunk" }
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffHunk." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "line"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffLine" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffLine." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 3
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Called for each line."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffLineCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr Ggit.DiffLine.DiffLine ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "delta"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffHunk" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "line"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffLine" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffLine." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffLineCallback :: FunPtr C_DiffLineCallback -> C_DiffLineCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffLineCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffLineCallback
    -> Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Maybe (Ggit.DiffHunk.DiffHunk)
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> Ggit.DiffLine.DiffLine
    -- ^ /@line@/: a t'GI.Ggit.Structs.DiffLine.DiffLine'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_DiffLineCallback :: FunPtr C_DiffLineCallback
-> DiffDelta -> Maybe DiffHunk -> DiffLine -> Ptr () -> m Int32
dynamic_DiffLineCallback FunPtr C_DiffLineCallback
__funPtr DiffDelta
delta Maybe DiffHunk
hunk DiffLine
line Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffDelta
delta' <- DiffDelta -> IO (Ptr DiffDelta)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffDelta
delta
    Ptr DiffHunk
maybeHunk <- case Maybe DiffHunk
hunk of
        Maybe DiffHunk
Nothing -> Ptr DiffHunk -> IO (Ptr DiffHunk)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DiffHunk
forall a. Ptr a
nullPtr
        Just DiffHunk
jHunk -> do
            Ptr DiffHunk
jHunk' <- DiffHunk -> IO (Ptr DiffHunk)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffHunk
jHunk
            Ptr DiffHunk -> IO (Ptr DiffHunk)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr DiffHunk
jHunk'
    Ptr DiffLine
line' <- DiffLine -> IO (Ptr DiffLine)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffLine
line
    Int32
result <- (FunPtr C_DiffLineCallback -> C_DiffLineCallback
__dynamic_C_DiffLineCallback FunPtr C_DiffLineCallback
__funPtr) Ptr DiffDelta
delta' Ptr DiffHunk
maybeHunk Ptr DiffLine
line' Ptr ()
userData
    DiffDelta -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffDelta
delta
    Maybe DiffHunk -> (DiffHunk -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe DiffHunk
hunk DiffHunk -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    DiffLine -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffLine
line
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffLineCallback`.
foreign import ccall "wrapper"
    mk_DiffLineCallback :: C_DiffLineCallback -> IO (FunPtr C_DiffLineCallback)

-- | Called for each line.
type DiffLineCallback =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Maybe Ggit.DiffHunk.DiffHunk
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> Ggit.DiffLine.DiffLine
    -- ^ /@line@/: a t'GI.Ggit.Structs.DiffLine.DiffLine'.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffLineCallback`@.
noDiffLineCallback :: Maybe DiffLineCallback
noDiffLineCallback :: Maybe DiffLineCallback
noDiffLineCallback = Maybe DiffLineCallback
forall a. Maybe a
Nothing

-- | Called for each line.
type DiffLineCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Maybe Ggit.DiffHunk.DiffHunk
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> Ggit.DiffLine.DiffLine
    -- ^ /@line@/: a t'GI.Ggit.Structs.DiffLine.DiffLine'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffLineCallback_WithClosures`@.
noDiffLineCallback_WithClosures :: Maybe DiffLineCallback_WithClosures
noDiffLineCallback_WithClosures :: Maybe DiffLineCallback_WithClosures
noDiffLineCallback_WithClosures = Maybe DiffLineCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffLineCallback :: DiffLineCallback -> DiffLineCallback_WithClosures
drop_closures_DiffLineCallback :: DiffLineCallback -> DiffLineCallback_WithClosures
drop_closures_DiffLineCallback DiffLineCallback
_f DiffDelta
delta Maybe DiffHunk
hunk DiffLine
line Ptr ()
_ = DiffLineCallback
_f DiffDelta
delta Maybe DiffHunk
hunk DiffLine
line

-- | Wrap the callback into a `GClosure`.
genClosure_DiffLineCallback :: MonadIO m => DiffLineCallback -> m (GClosure C_DiffLineCallback)
genClosure_DiffLineCallback :: DiffLineCallback -> m (GClosure C_DiffLineCallback)
genClosure_DiffLineCallback DiffLineCallback
cb = IO (GClosure C_DiffLineCallback) -> m (GClosure C_DiffLineCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffLineCallback)
 -> m (GClosure C_DiffLineCallback))
-> IO (GClosure C_DiffLineCallback)
-> m (GClosure C_DiffLineCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffLineCallback_WithClosures
cb' = DiffLineCallback -> DiffLineCallback_WithClosures
drop_closures_DiffLineCallback DiffLineCallback
cb
    let cb'' :: C_DiffLineCallback
cb'' = Maybe (Ptr (FunPtr C_DiffLineCallback))
-> DiffLineCallback_WithClosures -> C_DiffLineCallback
wrap_DiffLineCallback Maybe (Ptr (FunPtr C_DiffLineCallback))
forall a. Maybe a
Nothing DiffLineCallback_WithClosures
cb'
    C_DiffLineCallback -> IO (FunPtr C_DiffLineCallback)
mk_DiffLineCallback C_DiffLineCallback
cb'' IO (FunPtr C_DiffLineCallback)
-> (FunPtr C_DiffLineCallback -> IO (GClosure C_DiffLineCallback))
-> IO (GClosure C_DiffLineCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffLineCallback -> IO (GClosure C_DiffLineCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffLineCallback` into a `C_DiffLineCallback`.
wrap_DiffLineCallback ::
    Maybe (Ptr (FunPtr C_DiffLineCallback)) ->
    DiffLineCallback_WithClosures ->
    C_DiffLineCallback
wrap_DiffLineCallback :: Maybe (Ptr (FunPtr C_DiffLineCallback))
-> DiffLineCallback_WithClosures -> C_DiffLineCallback
wrap_DiffLineCallback Maybe (Ptr (FunPtr C_DiffLineCallback))
funptrptr DiffLineCallback_WithClosures
_cb Ptr DiffDelta
delta Ptr DiffHunk
hunk Ptr DiffLine
line Ptr ()
userData = do
    (ManagedPtr DiffDelta -> DiffDelta)
-> Ptr DiffDelta -> (DiffDelta -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffDelta -> DiffDelta
Ggit.DiffDelta.DiffDelta Ptr DiffDelta
delta ((DiffDelta -> IO Int32) -> IO Int32)
-> (DiffDelta -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffDelta
delta' -> do
        Maybe DiffHunk
maybeHunk <-
            if Ptr DiffHunk
hunk Ptr DiffHunk -> Ptr DiffHunk -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr DiffHunk
forall a. Ptr a
nullPtr
            then Maybe DiffHunk -> IO (Maybe DiffHunk)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe DiffHunk
forall a. Maybe a
Nothing
            else do
                (ManagedPtr DiffHunk -> DiffHunk)
-> Ptr DiffHunk
-> (DiffHunk -> IO (Maybe DiffHunk))
-> IO (Maybe DiffHunk)
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffHunk -> DiffHunk
Ggit.DiffHunk.DiffHunk Ptr DiffHunk
hunk ((DiffHunk -> IO (Maybe DiffHunk)) -> IO (Maybe DiffHunk))
-> (DiffHunk -> IO (Maybe DiffHunk)) -> IO (Maybe DiffHunk)
forall a b. (a -> b) -> a -> b
$ \DiffHunk
hunk' -> do
                    Maybe DiffHunk -> IO (Maybe DiffHunk)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe DiffHunk -> IO (Maybe DiffHunk))
-> Maybe DiffHunk -> IO (Maybe DiffHunk)
forall a b. (a -> b) -> a -> b
$ DiffHunk -> Maybe DiffHunk
forall a. a -> Maybe a
Just DiffHunk
hunk'
        (ManagedPtr DiffLine -> DiffLine)
-> Ptr DiffLine -> (DiffLine -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffLine -> DiffLine
Ggit.DiffLine.DiffLine Ptr DiffLine
line ((DiffLine -> IO Int32) -> IO Int32)
-> (DiffLine -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffLine
line' -> do
            Int32
result <- DiffLineCallback_WithClosures
_cb  DiffDelta
delta' Maybe DiffHunk
maybeHunk DiffLine
line' Ptr ()
userData
            Maybe (Ptr (FunPtr C_DiffLineCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffLineCallback))
funptrptr
            Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffHunkCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "delta"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "hunk"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffHunk" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffHunk." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Called for each hunk."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffHunkCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffHunk.DiffHunk ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "delta"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hunk"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffHunk" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffHunk." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffHunkCallback :: FunPtr C_DiffHunkCallback -> C_DiffHunkCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffHunkCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffHunkCallback
    -> Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffHunk.DiffHunk
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_DiffHunkCallback :: FunPtr C_DiffHunkCallback
-> DiffDelta -> DiffHunk -> Ptr () -> m Int32
dynamic_DiffHunkCallback FunPtr C_DiffHunkCallback
__funPtr DiffDelta
delta DiffHunk
hunk Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffDelta
delta' <- DiffDelta -> IO (Ptr DiffDelta)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffDelta
delta
    Ptr DiffHunk
hunk' <- DiffHunk -> IO (Ptr DiffHunk)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffHunk
hunk
    Int32
result <- (FunPtr C_DiffHunkCallback -> C_DiffHunkCallback
__dynamic_C_DiffHunkCallback FunPtr C_DiffHunkCallback
__funPtr) Ptr DiffDelta
delta' Ptr DiffHunk
hunk' Ptr ()
userData
    DiffDelta -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffDelta
delta
    DiffHunk -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffHunk
hunk
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffHunkCallback`.
foreign import ccall "wrapper"
    mk_DiffHunkCallback :: C_DiffHunkCallback -> IO (FunPtr C_DiffHunkCallback)

-- | Called for each hunk.
type DiffHunkCallback =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffHunk.DiffHunk
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffHunkCallback`@.
noDiffHunkCallback :: Maybe DiffHunkCallback
noDiffHunkCallback :: Maybe DiffHunkCallback
noDiffHunkCallback = Maybe DiffHunkCallback
forall a. Maybe a
Nothing

-- | Called for each hunk.
type DiffHunkCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffHunk.DiffHunk
    -- ^ /@hunk@/: a t'GI.Ggit.Structs.DiffHunk.DiffHunk'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffHunkCallback_WithClosures`@.
noDiffHunkCallback_WithClosures :: Maybe DiffHunkCallback_WithClosures
noDiffHunkCallback_WithClosures :: Maybe DiffHunkCallback_WithClosures
noDiffHunkCallback_WithClosures = Maybe DiffHunkCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffHunkCallback :: DiffHunkCallback -> DiffHunkCallback_WithClosures
drop_closures_DiffHunkCallback :: DiffHunkCallback -> DiffHunkCallback_WithClosures
drop_closures_DiffHunkCallback DiffHunkCallback
_f DiffDelta
delta DiffHunk
hunk Ptr ()
_ = DiffHunkCallback
_f DiffDelta
delta DiffHunk
hunk

-- | Wrap the callback into a `GClosure`.
genClosure_DiffHunkCallback :: MonadIO m => DiffHunkCallback -> m (GClosure C_DiffHunkCallback)
genClosure_DiffHunkCallback :: DiffHunkCallback -> m (GClosure C_DiffHunkCallback)
genClosure_DiffHunkCallback DiffHunkCallback
cb = IO (GClosure C_DiffHunkCallback) -> m (GClosure C_DiffHunkCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffHunkCallback)
 -> m (GClosure C_DiffHunkCallback))
-> IO (GClosure C_DiffHunkCallback)
-> m (GClosure C_DiffHunkCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffHunkCallback_WithClosures
cb' = DiffHunkCallback -> DiffHunkCallback_WithClosures
drop_closures_DiffHunkCallback DiffHunkCallback
cb
    let cb'' :: C_DiffHunkCallback
cb'' = Maybe (Ptr (FunPtr C_DiffHunkCallback))
-> DiffHunkCallback_WithClosures -> C_DiffHunkCallback
wrap_DiffHunkCallback Maybe (Ptr (FunPtr C_DiffHunkCallback))
forall a. Maybe a
Nothing DiffHunkCallback_WithClosures
cb'
    C_DiffHunkCallback -> IO (FunPtr C_DiffHunkCallback)
mk_DiffHunkCallback C_DiffHunkCallback
cb'' IO (FunPtr C_DiffHunkCallback)
-> (FunPtr C_DiffHunkCallback -> IO (GClosure C_DiffHunkCallback))
-> IO (GClosure C_DiffHunkCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffHunkCallback -> IO (GClosure C_DiffHunkCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffHunkCallback` into a `C_DiffHunkCallback`.
wrap_DiffHunkCallback ::
    Maybe (Ptr (FunPtr C_DiffHunkCallback)) ->
    DiffHunkCallback_WithClosures ->
    C_DiffHunkCallback
wrap_DiffHunkCallback :: Maybe (Ptr (FunPtr C_DiffHunkCallback))
-> DiffHunkCallback_WithClosures -> C_DiffHunkCallback
wrap_DiffHunkCallback Maybe (Ptr (FunPtr C_DiffHunkCallback))
funptrptr DiffHunkCallback_WithClosures
_cb Ptr DiffDelta
delta Ptr DiffHunk
hunk Ptr ()
userData = do
    (ManagedPtr DiffDelta -> DiffDelta)
-> Ptr DiffDelta -> (DiffDelta -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffDelta -> DiffDelta
Ggit.DiffDelta.DiffDelta Ptr DiffDelta
delta ((DiffDelta -> IO Int32) -> IO Int32)
-> (DiffDelta -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffDelta
delta' -> do
        (ManagedPtr DiffHunk -> DiffHunk)
-> Ptr DiffHunk -> (DiffHunk -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffHunk -> DiffHunk
Ggit.DiffHunk.DiffHunk Ptr DiffHunk
hunk ((DiffHunk -> IO Int32) -> IO Int32)
-> (DiffHunk -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffHunk
hunk' -> do
            Int32
result <- DiffHunkCallback_WithClosures
_cb  DiffDelta
delta' DiffHunk
hunk' Ptr ()
userData
            Maybe (Ptr (FunPtr C_DiffHunkCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffHunkCallback))
funptrptr
            Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffFileCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "delta"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "progress"
          , argType = TBasicType TFloat
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the progress." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Called for each file."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffFileCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    CFloat ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "delta"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "progress"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the progress." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffFileCallback :: FunPtr C_DiffFileCallback -> C_DiffFileCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffFileCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffFileCallback
    -> Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Float
    -- ^ /@progress@/: the progress.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_DiffFileCallback :: FunPtr C_DiffFileCallback
-> DiffDelta -> Float -> Ptr () -> m Int32
dynamic_DiffFileCallback FunPtr C_DiffFileCallback
__funPtr DiffDelta
delta Float
progress Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffDelta
delta' <- DiffDelta -> IO (Ptr DiffDelta)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffDelta
delta
    let progress' :: CFloat
progress' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
progress
    Int32
result <- (FunPtr C_DiffFileCallback -> C_DiffFileCallback
__dynamic_C_DiffFileCallback FunPtr C_DiffFileCallback
__funPtr) Ptr DiffDelta
delta' CFloat
progress' Ptr ()
userData
    DiffDelta -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffDelta
delta
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffFileCallback`.
foreign import ccall "wrapper"
    mk_DiffFileCallback :: C_DiffFileCallback -> IO (FunPtr C_DiffFileCallback)

-- | Called for each file.
type DiffFileCallback =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Float
    -- ^ /@progress@/: the progress.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffFileCallback`@.
noDiffFileCallback :: Maybe DiffFileCallback
noDiffFileCallback :: Maybe DiffFileCallback
noDiffFileCallback = Maybe DiffFileCallback
forall a. Maybe a
Nothing

-- | Called for each file.
type DiffFileCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Float
    -- ^ /@progress@/: the progress.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffFileCallback_WithClosures`@.
noDiffFileCallback_WithClosures :: Maybe DiffFileCallback_WithClosures
noDiffFileCallback_WithClosures :: Maybe DiffFileCallback_WithClosures
noDiffFileCallback_WithClosures = Maybe DiffFileCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffFileCallback :: DiffFileCallback -> DiffFileCallback_WithClosures
drop_closures_DiffFileCallback :: DiffFileCallback -> DiffFileCallback_WithClosures
drop_closures_DiffFileCallback DiffFileCallback
_f DiffDelta
delta Float
progress Ptr ()
_ = DiffFileCallback
_f DiffDelta
delta Float
progress

-- | Wrap the callback into a `GClosure`.
genClosure_DiffFileCallback :: MonadIO m => DiffFileCallback -> m (GClosure C_DiffFileCallback)
genClosure_DiffFileCallback :: DiffFileCallback -> m (GClosure C_DiffFileCallback)
genClosure_DiffFileCallback DiffFileCallback
cb = IO (GClosure C_DiffFileCallback) -> m (GClosure C_DiffFileCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffFileCallback)
 -> m (GClosure C_DiffFileCallback))
-> IO (GClosure C_DiffFileCallback)
-> m (GClosure C_DiffFileCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffFileCallback_WithClosures
cb' = DiffFileCallback -> DiffFileCallback_WithClosures
drop_closures_DiffFileCallback DiffFileCallback
cb
    let cb'' :: C_DiffFileCallback
cb'' = Maybe (Ptr (FunPtr C_DiffFileCallback))
-> DiffFileCallback_WithClosures -> C_DiffFileCallback
wrap_DiffFileCallback Maybe (Ptr (FunPtr C_DiffFileCallback))
forall a. Maybe a
Nothing DiffFileCallback_WithClosures
cb'
    C_DiffFileCallback -> IO (FunPtr C_DiffFileCallback)
mk_DiffFileCallback C_DiffFileCallback
cb'' IO (FunPtr C_DiffFileCallback)
-> (FunPtr C_DiffFileCallback -> IO (GClosure C_DiffFileCallback))
-> IO (GClosure C_DiffFileCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffFileCallback -> IO (GClosure C_DiffFileCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffFileCallback` into a `C_DiffFileCallback`.
wrap_DiffFileCallback ::
    Maybe (Ptr (FunPtr C_DiffFileCallback)) ->
    DiffFileCallback_WithClosures ->
    C_DiffFileCallback
wrap_DiffFileCallback :: Maybe (Ptr (FunPtr C_DiffFileCallback))
-> DiffFileCallback_WithClosures -> C_DiffFileCallback
wrap_DiffFileCallback Maybe (Ptr (FunPtr C_DiffFileCallback))
funptrptr DiffFileCallback_WithClosures
_cb Ptr DiffDelta
delta CFloat
progress Ptr ()
userData = do
    (ManagedPtr DiffDelta -> DiffDelta)
-> Ptr DiffDelta -> (DiffDelta -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffDelta -> DiffDelta
Ggit.DiffDelta.DiffDelta Ptr DiffDelta
delta ((DiffDelta -> IO Int32) -> IO Int32)
-> (DiffDelta -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffDelta
delta' -> do
        let progress' :: Float
progress' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
progress
        Int32
result <- DiffFileCallback_WithClosures
_cb  DiffDelta
delta' Float
progress' Ptr ()
userData
        Maybe (Ptr (FunPtr C_DiffFileCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffFileCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback DiffBinaryCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just "0 to go continue or a #GgitError in case there was an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "delta"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "binary"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "DiffBinary" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitDiffBinary." , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText = Just "Called for each file."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DiffBinaryCallback =
    Ptr Ggit.DiffDelta.DiffDelta ->
    Ptr Ggit.DiffBinary.DiffBinary ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "delta"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffDelta" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffDelta." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "binary"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "DiffBinary" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitDiffBinary." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DiffBinaryCallback :: FunPtr C_DiffBinaryCallback -> C_DiffBinaryCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DiffBinaryCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_DiffBinaryCallback
    -> Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffBinary.DiffBinary
    -- ^ /@binary@/: a t'GI.Ggit.Structs.DiffBinary.DiffBinary'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.
dynamic_DiffBinaryCallback :: FunPtr C_DiffBinaryCallback
-> DiffDelta -> DiffBinary -> Ptr () -> m Int32
dynamic_DiffBinaryCallback FunPtr C_DiffBinaryCallback
__funPtr DiffDelta
delta DiffBinary
binary Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DiffDelta
delta' <- DiffDelta -> IO (Ptr DiffDelta)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffDelta
delta
    Ptr DiffBinary
binary' <- DiffBinary -> IO (Ptr DiffBinary)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr DiffBinary
binary
    Int32
result <- (FunPtr C_DiffBinaryCallback -> C_DiffBinaryCallback
__dynamic_C_DiffBinaryCallback FunPtr C_DiffBinaryCallback
__funPtr) Ptr DiffDelta
delta' Ptr DiffBinary
binary' Ptr ()
userData
    DiffDelta -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffDelta
delta
    DiffBinary -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr DiffBinary
binary
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_DiffBinaryCallback`.
foreign import ccall "wrapper"
    mk_DiffBinaryCallback :: C_DiffBinaryCallback -> IO (FunPtr C_DiffBinaryCallback)

-- | Called for each file.
type DiffBinaryCallback =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffBinary.DiffBinary
    -- ^ /@binary@/: a t'GI.Ggit.Structs.DiffBinary.DiffBinary'.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffBinaryCallback`@.
noDiffBinaryCallback :: Maybe DiffBinaryCallback
noDiffBinaryCallback :: Maybe DiffBinaryCallback
noDiffBinaryCallback = Maybe DiffBinaryCallback
forall a. Maybe a
Nothing

-- | Called for each file.
type DiffBinaryCallback_WithClosures =
    Ggit.DiffDelta.DiffDelta
    -- ^ /@delta@/: a t'GI.Ggit.Structs.DiffDelta.DiffDelta'.
    -> Ggit.DiffBinary.DiffBinary
    -- ^ /@binary@/: a t'GI.Ggit.Structs.DiffBinary.DiffBinary'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go continue or a t'GI.Ggit.Enums.Error' in case there was an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `DiffBinaryCallback_WithClosures`@.
noDiffBinaryCallback_WithClosures :: Maybe DiffBinaryCallback_WithClosures
noDiffBinaryCallback_WithClosures :: Maybe DiffBinaryCallback_WithClosures
noDiffBinaryCallback_WithClosures = Maybe DiffBinaryCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DiffBinaryCallback :: DiffBinaryCallback -> DiffBinaryCallback_WithClosures
drop_closures_DiffBinaryCallback :: DiffBinaryCallback -> DiffBinaryCallback_WithClosures
drop_closures_DiffBinaryCallback DiffBinaryCallback
_f DiffDelta
delta DiffBinary
binary Ptr ()
_ = DiffBinaryCallback
_f DiffDelta
delta DiffBinary
binary

-- | Wrap the callback into a `GClosure`.
genClosure_DiffBinaryCallback :: MonadIO m => DiffBinaryCallback -> m (GClosure C_DiffBinaryCallback)
genClosure_DiffBinaryCallback :: DiffBinaryCallback -> m (GClosure C_DiffBinaryCallback)
genClosure_DiffBinaryCallback DiffBinaryCallback
cb = IO (GClosure C_DiffBinaryCallback)
-> m (GClosure C_DiffBinaryCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DiffBinaryCallback)
 -> m (GClosure C_DiffBinaryCallback))
-> IO (GClosure C_DiffBinaryCallback)
-> m (GClosure C_DiffBinaryCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: DiffBinaryCallback_WithClosures
cb' = DiffBinaryCallback -> DiffBinaryCallback_WithClosures
drop_closures_DiffBinaryCallback DiffBinaryCallback
cb
    let cb'' :: C_DiffBinaryCallback
cb'' = Maybe (Ptr (FunPtr C_DiffBinaryCallback))
-> DiffBinaryCallback_WithClosures -> C_DiffBinaryCallback
wrap_DiffBinaryCallback Maybe (Ptr (FunPtr C_DiffBinaryCallback))
forall a. Maybe a
Nothing DiffBinaryCallback_WithClosures
cb'
    C_DiffBinaryCallback -> IO (FunPtr C_DiffBinaryCallback)
mk_DiffBinaryCallback C_DiffBinaryCallback
cb'' IO (FunPtr C_DiffBinaryCallback)
-> (FunPtr C_DiffBinaryCallback
    -> IO (GClosure C_DiffBinaryCallback))
-> IO (GClosure C_DiffBinaryCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DiffBinaryCallback -> IO (GClosure C_DiffBinaryCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DiffBinaryCallback` into a `C_DiffBinaryCallback`.
wrap_DiffBinaryCallback ::
    Maybe (Ptr (FunPtr C_DiffBinaryCallback)) ->
    DiffBinaryCallback_WithClosures ->
    C_DiffBinaryCallback
wrap_DiffBinaryCallback :: Maybe (Ptr (FunPtr C_DiffBinaryCallback))
-> DiffBinaryCallback_WithClosures -> C_DiffBinaryCallback
wrap_DiffBinaryCallback Maybe (Ptr (FunPtr C_DiffBinaryCallback))
funptrptr DiffBinaryCallback_WithClosures
_cb Ptr DiffDelta
delta Ptr DiffBinary
binary Ptr ()
userData = do
    (ManagedPtr DiffDelta -> DiffDelta)
-> Ptr DiffDelta -> (DiffDelta -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffDelta -> DiffDelta
Ggit.DiffDelta.DiffDelta Ptr DiffDelta
delta ((DiffDelta -> IO Int32) -> IO Int32)
-> (DiffDelta -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffDelta
delta' -> do
        (ManagedPtr DiffBinary -> DiffBinary)
-> Ptr DiffBinary -> (DiffBinary -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr DiffBinary -> DiffBinary
Ggit.DiffBinary.DiffBinary Ptr DiffBinary
binary ((DiffBinary -> IO Int32) -> IO Int32)
-> (DiffBinary -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \DiffBinary
binary' -> do
            Int32
result <- DiffBinaryCallback_WithClosures
_cb  DiffDelta
delta' DiffBinary
binary' Ptr ()
userData
            Maybe (Ptr (FunPtr C_DiffBinaryCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_DiffBinaryCallback))
funptrptr
            Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback CredAcquireCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "url"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "the resource for which we are demanding a credential."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "username_from_url"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText =
                    Just
                      "The username that was embedded in a \"user@host\"\n                                  remote url, or NULL if not included."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "allowed_types"
          , argType = TBasicType TUInt
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "a bitmask stating which cred types are OK to return."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "cred"
          , argType = TInterface Name { namespace = "Ggit" , name = "Cred" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "newly created credential object."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferEverything
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 4
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just "Signature of a function which acquires a credential object."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_CredAcquireCallback =
    CString ->
    CString ->
    Word32 ->
    Ptr Ggit.Cred.Cred ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "url"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the resource for which we are demanding a credential."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "username_from_url"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The username that was embedded in a \"user@host\"\n                                  remote url, or NULL if not included."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "allowed_types"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a bitmask stating which cred types are OK to return."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cred"
--           , argType = TInterface Name { namespace = "Ggit" , name = "Cred" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "newly created credential object."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_CredAcquireCallback :: FunPtr C_CredAcquireCallback -> C_CredAcquireCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_CredAcquireCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Ggit.Cred.IsCred a) =>
    FunPtr C_CredAcquireCallback
    -> T.Text
    -- ^ /@url@/: the resource for which we are demanding a credential.
    -> Maybe (T.Text)
    -- ^ /@usernameFromUrl@/: The username that was embedded in a \"user/@host@/\"
    --                                   remote url, or NULL if not included.
    -> Word32
    -- ^ /@allowedTypes@/: a bitmask stating which cred types are OK to return.
    -> a
    -- ^ /@cred@/: newly created credential object.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
dynamic_CredAcquireCallback :: FunPtr C_CredAcquireCallback
-> Text -> Maybe Text -> Word32 -> a -> Ptr () -> m Int32
dynamic_CredAcquireCallback FunPtr C_CredAcquireCallback
__funPtr Text
url Maybe Text
usernameFromUrl Word32
allowedTypes a
cred Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
url' <- Text -> IO CString
textToCString Text
url
    CString
maybeUsernameFromUrl <- case Maybe Text
usernameFromUrl of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jUsernameFromUrl -> do
            CString
jUsernameFromUrl' <- Text -> IO CString
textToCString Text
jUsernameFromUrl
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jUsernameFromUrl'
    Ptr Cred
cred' <- a -> IO (Ptr Cred)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject a
cred
    Int32
result <- (FunPtr C_CredAcquireCallback -> C_CredAcquireCallback
__dynamic_C_CredAcquireCallback FunPtr C_CredAcquireCallback
__funPtr) CString
url' CString
maybeUsernameFromUrl Word32
allowedTypes Ptr Cred
cred' Ptr ()
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
cred
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
url'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeUsernameFromUrl
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_CredAcquireCallback`.
foreign import ccall "wrapper"
    mk_CredAcquireCallback :: C_CredAcquireCallback -> IO (FunPtr C_CredAcquireCallback)

-- | Signature of a function which acquires a credential object.
type CredAcquireCallback =
    T.Text
    -- ^ /@url@/: the resource for which we are demanding a credential.
    -> Maybe T.Text
    -- ^ /@usernameFromUrl@/: The username that was embedded in a \"user/@host@/\"
    --                                   remote url, or NULL if not included.
    -> Word32
    -- ^ /@allowedTypes@/: a bitmask stating which cred types are OK to return.
    -> Ggit.Cred.Cred
    -- ^ /@cred@/: newly created credential object.
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `CredAcquireCallback`@.
noCredAcquireCallback :: Maybe CredAcquireCallback
noCredAcquireCallback :: Maybe CredAcquireCallback
noCredAcquireCallback = Maybe CredAcquireCallback
forall a. Maybe a
Nothing

-- | Signature of a function which acquires a credential object.
type CredAcquireCallback_WithClosures =
    T.Text
    -- ^ /@url@/: the resource for which we are demanding a credential.
    -> Maybe T.Text
    -- ^ /@usernameFromUrl@/: The username that was embedded in a \"user/@host@/\"
    --                                   remote url, or NULL if not included.
    -> Word32
    -- ^ /@allowedTypes@/: a bitmask stating which cred types are OK to return.
    -> Ggit.Cred.Cred
    -- ^ /@cred@/: newly created credential object.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32

-- | A convenience synonym for @`Nothing` :: `Maybe` `CredAcquireCallback_WithClosures`@.
noCredAcquireCallback_WithClosures :: Maybe CredAcquireCallback_WithClosures
noCredAcquireCallback_WithClosures :: Maybe CredAcquireCallback_WithClosures
noCredAcquireCallback_WithClosures = Maybe CredAcquireCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_CredAcquireCallback :: CredAcquireCallback -> CredAcquireCallback_WithClosures
drop_closures_CredAcquireCallback :: CredAcquireCallback -> CredAcquireCallback_WithClosures
drop_closures_CredAcquireCallback CredAcquireCallback
_f Text
url Maybe Text
usernameFromUrl Word32
allowedTypes Cred
cred Ptr ()
_ = CredAcquireCallback
_f Text
url Maybe Text
usernameFromUrl Word32
allowedTypes Cred
cred

-- | Wrap the callback into a `GClosure`.
genClosure_CredAcquireCallback :: MonadIO m => CredAcquireCallback -> m (GClosure C_CredAcquireCallback)
genClosure_CredAcquireCallback :: CredAcquireCallback -> m (GClosure C_CredAcquireCallback)
genClosure_CredAcquireCallback CredAcquireCallback
cb = IO (GClosure C_CredAcquireCallback)
-> m (GClosure C_CredAcquireCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_CredAcquireCallback)
 -> m (GClosure C_CredAcquireCallback))
-> IO (GClosure C_CredAcquireCallback)
-> m (GClosure C_CredAcquireCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: CredAcquireCallback_WithClosures
cb' = CredAcquireCallback -> CredAcquireCallback_WithClosures
drop_closures_CredAcquireCallback CredAcquireCallback
cb
    let cb'' :: C_CredAcquireCallback
cb'' = Maybe (Ptr (FunPtr C_CredAcquireCallback))
-> CredAcquireCallback_WithClosures -> C_CredAcquireCallback
wrap_CredAcquireCallback Maybe (Ptr (FunPtr C_CredAcquireCallback))
forall a. Maybe a
Nothing CredAcquireCallback_WithClosures
cb'
    C_CredAcquireCallback -> IO (FunPtr C_CredAcquireCallback)
mk_CredAcquireCallback C_CredAcquireCallback
cb'' IO (FunPtr C_CredAcquireCallback)
-> (FunPtr C_CredAcquireCallback
    -> IO (GClosure C_CredAcquireCallback))
-> IO (GClosure C_CredAcquireCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_CredAcquireCallback -> IO (GClosure C_CredAcquireCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `CredAcquireCallback` into a `C_CredAcquireCallback`.
wrap_CredAcquireCallback ::
    Maybe (Ptr (FunPtr C_CredAcquireCallback)) ->
    CredAcquireCallback_WithClosures ->
    C_CredAcquireCallback
wrap_CredAcquireCallback :: Maybe (Ptr (FunPtr C_CredAcquireCallback))
-> CredAcquireCallback_WithClosures -> C_CredAcquireCallback
wrap_CredAcquireCallback Maybe (Ptr (FunPtr C_CredAcquireCallback))
funptrptr CredAcquireCallback_WithClosures
_cb CString
url CString
usernameFromUrl Word32
allowedTypes Ptr Cred
cred Ptr ()
userData = do
    Text
url' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
url
    Maybe Text
maybeUsernameFromUrl <-
        if CString
usernameFromUrl CString -> CString -> Bool
forall a. Eq a => a -> a -> Bool
== CString
forall a. Ptr a
nullPtr
        then Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
forall a. Maybe a
Nothing
        else do
            Text
usernameFromUrl' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
usernameFromUrl
            Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text -> IO (Maybe Text)) -> Maybe Text -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Text
forall a. a -> Maybe a
Just Text
usernameFromUrl'
    Cred
cred' <- ((ManagedPtr Cred -> Cred) -> Ptr Cred -> IO Cred
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Cred -> Cred
Ggit.Cred.Cred) Ptr Cred
cred
    Int32
result <- CredAcquireCallback_WithClosures
_cb  Text
url' Maybe Text
maybeUsernameFromUrl Word32
allowedTypes Cred
cred' Ptr ()
userData
    Maybe (Ptr (FunPtr C_CredAcquireCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_CredAcquireCallback))
funptrptr
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback ConfigMatchCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next config value or a #GgitError in case there was\n         an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "match_info"
          , argType =
              TInterface Name { namespace = "GLib" , name = "MatchInfo" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the match" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TBasicType TUTF8
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the value" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 2
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving values from a #GgitConfig\nusing a regular expression. See ggit_config_match_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ConfigMatchCallback =
    Ptr GLib.MatchInfo.MatchInfo ->
    CString ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "match_info"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "MatchInfo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the match" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ConfigMatchCallback :: FunPtr C_ConfigMatchCallback -> C_ConfigMatchCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ConfigMatchCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ConfigMatchCallback
    -> GLib.MatchInfo.MatchInfo
    -- ^ /@matchInfo@/: the match
    -> T.Text
    -- ^ /@value@/: the value
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.
dynamic_ConfigMatchCallback :: FunPtr C_ConfigMatchCallback
-> MatchInfo -> Text -> Ptr () -> m Int32
dynamic_ConfigMatchCallback FunPtr C_ConfigMatchCallback
__funPtr MatchInfo
matchInfo Text
value Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr MatchInfo
matchInfo' <- MatchInfo -> IO (Ptr MatchInfo)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MatchInfo
matchInfo
    CString
value' <- Text -> IO CString
textToCString Text
value
    Int32
result <- (FunPtr C_ConfigMatchCallback -> C_ConfigMatchCallback
__dynamic_C_ConfigMatchCallback FunPtr C_ConfigMatchCallback
__funPtr) Ptr MatchInfo
matchInfo' CString
value' Ptr ()
userData
    MatchInfo -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MatchInfo
matchInfo
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_ConfigMatchCallback`.
foreign import ccall "wrapper"
    mk_ConfigMatchCallback :: C_ConfigMatchCallback -> IO (FunPtr C_ConfigMatchCallback)

-- | The type of the callback functions for retrieving values from a t'GI.Ggit.Objects.Config.Config'
-- using a regular expression. See 'GI.Ggit.Objects.Config.configMatchForeach'.
type ConfigMatchCallback =
    GLib.MatchInfo.MatchInfo
    -- ^ /@matchInfo@/: the match
    -> T.Text
    -- ^ /@value@/: the value
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ConfigMatchCallback`@.
noConfigMatchCallback :: Maybe ConfigMatchCallback
noConfigMatchCallback :: Maybe ConfigMatchCallback
noConfigMatchCallback = Maybe ConfigMatchCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving values from a t'GI.Ggit.Objects.Config.Config'
-- using a regular expression. See 'GI.Ggit.Objects.Config.configMatchForeach'.
type ConfigMatchCallback_WithClosures =
    GLib.MatchInfo.MatchInfo
    -- ^ /@matchInfo@/: the match
    -> T.Text
    -- ^ /@value@/: the value
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ConfigMatchCallback_WithClosures`@.
noConfigMatchCallback_WithClosures :: Maybe ConfigMatchCallback_WithClosures
noConfigMatchCallback_WithClosures :: Maybe ConfigMatchCallback_WithClosures
noConfigMatchCallback_WithClosures = Maybe ConfigMatchCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ConfigMatchCallback :: ConfigMatchCallback -> ConfigMatchCallback_WithClosures
drop_closures_ConfigMatchCallback :: ConfigMatchCallback -> ConfigMatchCallback_WithClosures
drop_closures_ConfigMatchCallback ConfigMatchCallback
_f MatchInfo
matchInfo Text
value Ptr ()
_ = ConfigMatchCallback
_f MatchInfo
matchInfo Text
value

-- | Wrap the callback into a `GClosure`.
genClosure_ConfigMatchCallback :: MonadIO m => ConfigMatchCallback -> m (GClosure C_ConfigMatchCallback)
genClosure_ConfigMatchCallback :: ConfigMatchCallback -> m (GClosure C_ConfigMatchCallback)
genClosure_ConfigMatchCallback ConfigMatchCallback
cb = IO (GClosure C_ConfigMatchCallback)
-> m (GClosure C_ConfigMatchCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ConfigMatchCallback)
 -> m (GClosure C_ConfigMatchCallback))
-> IO (GClosure C_ConfigMatchCallback)
-> m (GClosure C_ConfigMatchCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ConfigMatchCallback_WithClosures
cb' = ConfigMatchCallback -> ConfigMatchCallback_WithClosures
drop_closures_ConfigMatchCallback ConfigMatchCallback
cb
    let cb'' :: C_ConfigMatchCallback
cb'' = Maybe (Ptr (FunPtr C_ConfigMatchCallback))
-> ConfigMatchCallback_WithClosures -> C_ConfigMatchCallback
wrap_ConfigMatchCallback Maybe (Ptr (FunPtr C_ConfigMatchCallback))
forall a. Maybe a
Nothing ConfigMatchCallback_WithClosures
cb'
    C_ConfigMatchCallback -> IO (FunPtr C_ConfigMatchCallback)
mk_ConfigMatchCallback C_ConfigMatchCallback
cb'' IO (FunPtr C_ConfigMatchCallback)
-> (FunPtr C_ConfigMatchCallback
    -> IO (GClosure C_ConfigMatchCallback))
-> IO (GClosure C_ConfigMatchCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ConfigMatchCallback -> IO (GClosure C_ConfigMatchCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ConfigMatchCallback` into a `C_ConfigMatchCallback`.
wrap_ConfigMatchCallback ::
    Maybe (Ptr (FunPtr C_ConfigMatchCallback)) ->
    ConfigMatchCallback_WithClosures ->
    C_ConfigMatchCallback
wrap_ConfigMatchCallback :: Maybe (Ptr (FunPtr C_ConfigMatchCallback))
-> ConfigMatchCallback_WithClosures -> C_ConfigMatchCallback
wrap_ConfigMatchCallback Maybe (Ptr (FunPtr C_ConfigMatchCallback))
funptrptr ConfigMatchCallback_WithClosures
_cb Ptr MatchInfo
matchInfo CString
value Ptr ()
userData = do
    (ManagedPtr MatchInfo -> MatchInfo)
-> Ptr MatchInfo -> (MatchInfo -> IO Int32) -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr MatchInfo -> MatchInfo
GLib.MatchInfo.MatchInfo Ptr MatchInfo
matchInfo ((MatchInfo -> IO Int32) -> IO Int32)
-> (MatchInfo -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \MatchInfo
matchInfo' -> do
        Text
value' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
value
        Int32
result <- ConfigMatchCallback_WithClosures
_cb  MatchInfo
matchInfo' Text
value' Ptr ()
userData
        Maybe (Ptr (FunPtr C_ConfigMatchCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ConfigMatchCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- callback ConfigCallback
{- Callable
  { returnType = Just (TBasicType TInt)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "0 to go for the next config value or a #GgitError in case there was\n         an error."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "entry"
          , argType =
              TInterface Name { namespace = "Ggit" , name = "ConfigEntry" }
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "a #GgitConfigEntry."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user-supplied data."
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = 1
          , argDestroy = -1
          , argCallerAllocates = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "The type of the callback functions for retrieving values from a #GgitConfig.\nSee ggit_config_foreach()."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ConfigCallback =
    Ptr Ggit.ConfigEntry.ConfigEntry ->
    Ptr () ->
    IO Int32

-- Args: [ Arg
--           { argCName = "entry"
--           , argType =
--               TInterface Name { namespace = "Ggit" , name = "ConfigEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GgitConfigEntry."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user-supplied data."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = 1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ConfigCallback :: FunPtr C_ConfigCallback -> C_ConfigCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ConfigCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ConfigCallback
    -> Ggit.ConfigEntry.ConfigEntry
    -- ^ /@entry@/: a t'GI.Ggit.Structs.ConfigEntry.ConfigEntry'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> m Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.
dynamic_ConfigCallback :: FunPtr C_ConfigCallback -> ConfigEntry -> Ptr () -> m Int32
dynamic_ConfigCallback FunPtr C_ConfigCallback
__funPtr ConfigEntry
entry Ptr ()
userData = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr ConfigEntry
entry' <- ConfigEntry -> IO (Ptr ConfigEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ConfigEntry
entry
    Int32
result <- (FunPtr C_ConfigCallback -> C_ConfigCallback
__dynamic_C_ConfigCallback FunPtr C_ConfigCallback
__funPtr) Ptr ConfigEntry
entry' Ptr ()
userData
    ConfigEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ConfigEntry
entry
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

-- | Generate a function pointer callable from C code, from a `C_ConfigCallback`.
foreign import ccall "wrapper"
    mk_ConfigCallback :: C_ConfigCallback -> IO (FunPtr C_ConfigCallback)

-- | The type of the callback functions for retrieving values from a t'GI.Ggit.Objects.Config.Config'.
-- See 'GI.Ggit.Objects.Config.configForeach'.
type ConfigCallback =
    Ggit.ConfigEntry.ConfigEntry
    -- ^ /@entry@/: a t'GI.Ggit.Structs.ConfigEntry.ConfigEntry'.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ConfigCallback`@.
noConfigCallback :: Maybe ConfigCallback
noConfigCallback :: Maybe ConfigCallback
noConfigCallback = Maybe ConfigCallback
forall a. Maybe a
Nothing

-- | The type of the callback functions for retrieving values from a t'GI.Ggit.Objects.Config.Config'.
-- See 'GI.Ggit.Objects.Config.configForeach'.
type ConfigCallback_WithClosures =
    Ggit.ConfigEntry.ConfigEntry
    -- ^ /@entry@/: a t'GI.Ggit.Structs.ConfigEntry.ConfigEntry'.
    -> Ptr ()
    -- ^ /@userData@/: user-supplied data.
    -> IO Int32
    -- ^ __Returns:__ 0 to go for the next config value or a t'GI.Ggit.Enums.Error' in case there was
    --          an error.

-- | A convenience synonym for @`Nothing` :: `Maybe` `ConfigCallback_WithClosures`@.
noConfigCallback_WithClosures :: Maybe ConfigCallback_WithClosures
noConfigCallback_WithClosures :: Maybe ConfigCallback_WithClosures
noConfigCallback_WithClosures = Maybe ConfigCallback_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ConfigCallback :: ConfigCallback -> ConfigCallback_WithClosures
drop_closures_ConfigCallback :: ConfigCallback -> ConfigCallback_WithClosures
drop_closures_ConfigCallback ConfigCallback
_f ConfigEntry
entry Ptr ()
_ = ConfigCallback
_f ConfigEntry
entry

-- | Wrap the callback into a `GClosure`.
genClosure_ConfigCallback :: MonadIO m => ConfigCallback -> m (GClosure C_ConfigCallback)
genClosure_ConfigCallback :: ConfigCallback -> m (GClosure C_ConfigCallback)
genClosure_ConfigCallback ConfigCallback
cb = IO (GClosure C_ConfigCallback) -> m (GClosure C_ConfigCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ConfigCallback) -> m (GClosure C_ConfigCallback))
-> IO (GClosure C_ConfigCallback) -> m (GClosure C_ConfigCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ConfigCallback_WithClosures
cb' = ConfigCallback -> ConfigCallback_WithClosures
drop_closures_ConfigCallback ConfigCallback
cb
    let cb'' :: C_ConfigCallback
cb'' = Maybe (Ptr (FunPtr C_ConfigCallback))
-> ConfigCallback_WithClosures -> C_ConfigCallback
wrap_ConfigCallback Maybe (Ptr (FunPtr C_ConfigCallback))
forall a. Maybe a
Nothing ConfigCallback_WithClosures
cb'
    C_ConfigCallback -> IO (FunPtr C_ConfigCallback)
mk_ConfigCallback C_ConfigCallback
cb'' IO (FunPtr C_ConfigCallback)
-> (FunPtr C_ConfigCallback -> IO (GClosure C_ConfigCallback))
-> IO (GClosure C_ConfigCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ConfigCallback -> IO (GClosure C_ConfigCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ConfigCallback` into a `C_ConfigCallback`.
wrap_ConfigCallback ::
    Maybe (Ptr (FunPtr C_ConfigCallback)) ->
    ConfigCallback_WithClosures ->
    C_ConfigCallback
wrap_ConfigCallback :: Maybe (Ptr (FunPtr C_ConfigCallback))
-> ConfigCallback_WithClosures -> C_ConfigCallback
wrap_ConfigCallback Maybe (Ptr (FunPtr C_ConfigCallback))
funptrptr ConfigCallback_WithClosures
_cb Ptr ConfigEntry
entry Ptr ()
userData = do
    (ManagedPtr ConfigEntry -> ConfigEntry)
-> Ptr ConfigEntry -> ConfigCallback -> IO Int32
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
(ManagedPtr a -> a) -> Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient ManagedPtr ConfigEntry -> ConfigEntry
Ggit.ConfigEntry.ConfigEntry Ptr ConfigEntry
entry (ConfigCallback -> IO Int32) -> ConfigCallback -> IO Int32
forall a b. (a -> b) -> a -> b
$ \ConfigEntry
entry' -> do
        Int32
result <- ConfigCallback_WithClosures
_cb  ConfigEntry
entry' Ptr ()
userData
        Maybe (Ptr (FunPtr C_ConfigCallback)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ConfigCallback))
funptrptr
        Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result