#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Json.Callbacks
(
ArrayForeach ,
ArrayForeach_WithClosures ,
C_ArrayForeach ,
drop_closures_ArrayForeach ,
dynamic_ArrayForeach ,
genClosure_ArrayForeach ,
mk_ArrayForeach ,
noArrayForeach ,
noArrayForeach_WithClosures ,
wrap_ArrayForeach ,
BoxedDeserializeFunc ,
C_BoxedDeserializeFunc ,
dynamic_BoxedDeserializeFunc ,
genClosure_BoxedDeserializeFunc ,
mk_BoxedDeserializeFunc ,
noBoxedDeserializeFunc ,
wrap_BoxedDeserializeFunc ,
BoxedSerializeFunc ,
C_BoxedSerializeFunc ,
dynamic_BoxedSerializeFunc ,
genClosure_BoxedSerializeFunc ,
mk_BoxedSerializeFunc ,
noBoxedSerializeFunc ,
wrap_BoxedSerializeFunc ,
C_ObjectForeach ,
ObjectForeach ,
ObjectForeach_WithClosures ,
drop_closures_ObjectForeach ,
dynamic_ObjectForeach ,
genClosure_ObjectForeach ,
mk_ObjectForeach ,
noObjectForeach ,
noObjectForeach_WithClosures ,
wrap_ObjectForeach ,
) 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.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
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 GHC.Records as R
import {-# SOURCE #-} qualified GI.Json.Structs.Array as Json.Array
import {-# SOURCE #-} qualified GI.Json.Structs.Node as Json.Node
import {-# SOURCE #-} qualified GI.Json.Structs.Object as Json.Object
type C_ObjectForeach =
Ptr Json.Object.Object ->
CString ->
Ptr Json.Node.Node ->
Ptr () ->
IO ()
foreign import ccall "dynamic" __dynamic_C_ObjectForeach :: FunPtr C_ObjectForeach -> C_ObjectForeach
dynamic_ObjectForeach ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_ObjectForeach
-> Json.Object.Object
-> T.Text
-> Json.Node.Node
-> Ptr ()
-> m ()
dynamic_ObjectForeach :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_ObjectForeach -> Object -> Text -> Node -> Ptr () -> m ()
dynamic_ObjectForeach FunPtr C_ObjectForeach
__funPtr Object
object Text
memberName Node
memberNode Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Object
object' <- Object -> IO (Ptr Object)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Object
object
CString
memberName' <- Text -> IO CString
textToCString Text
memberName
Ptr Node
memberNode' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Node
memberNode
(FunPtr C_ObjectForeach -> C_ObjectForeach
__dynamic_C_ObjectForeach FunPtr C_ObjectForeach
__funPtr) Ptr Object
object' CString
memberName' Ptr Node
memberNode' Ptr ()
userData
Object -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Object
object
Node -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Node
memberNode
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
memberName'
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "wrapper"
mk_ObjectForeach :: C_ObjectForeach -> IO (FunPtr C_ObjectForeach)
type ObjectForeach =
Json.Object.Object
-> T.Text
-> Json.Node.Node
-> IO ()
noObjectForeach :: Maybe ObjectForeach
noObjectForeach :: Maybe ObjectForeach
noObjectForeach = Maybe ObjectForeach
forall a. Maybe a
Nothing
type ObjectForeach_WithClosures =
Json.Object.Object
-> T.Text
-> Json.Node.Node
-> Ptr ()
-> IO ()
noObjectForeach_WithClosures :: Maybe ObjectForeach_WithClosures
noObjectForeach_WithClosures :: Maybe ObjectForeach_WithClosures
noObjectForeach_WithClosures = Maybe ObjectForeach_WithClosures
forall a. Maybe a
Nothing
drop_closures_ObjectForeach :: ObjectForeach -> ObjectForeach_WithClosures
drop_closures_ObjectForeach :: ObjectForeach -> ObjectForeach_WithClosures
drop_closures_ObjectForeach ObjectForeach
_f Object
object Text
memberName Node
memberNode Ptr ()
_ = ObjectForeach
_f Object
object Text
memberName Node
memberNode
genClosure_ObjectForeach :: MonadIO m => ObjectForeach -> m (GClosure C_ObjectForeach)
genClosure_ObjectForeach :: forall (m :: * -> *).
MonadIO m =>
ObjectForeach -> m (GClosure C_ObjectForeach)
genClosure_ObjectForeach ObjectForeach
cb = IO (GClosure C_ObjectForeach) -> m (GClosure C_ObjectForeach)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ObjectForeach) -> m (GClosure C_ObjectForeach))
-> IO (GClosure C_ObjectForeach) -> m (GClosure C_ObjectForeach)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: ObjectForeach_WithClosures
cb' = ObjectForeach -> ObjectForeach_WithClosures
drop_closures_ObjectForeach ObjectForeach
cb
let cb'' :: C_ObjectForeach
cb'' = Maybe (Ptr (FunPtr C_ObjectForeach))
-> ObjectForeach_WithClosures -> C_ObjectForeach
wrap_ObjectForeach Maybe (Ptr (FunPtr C_ObjectForeach))
forall a. Maybe a
Nothing ObjectForeach_WithClosures
cb'
C_ObjectForeach -> IO (FunPtr C_ObjectForeach)
mk_ObjectForeach C_ObjectForeach
cb'' IO (FunPtr C_ObjectForeach)
-> (FunPtr C_ObjectForeach -> IO (GClosure C_ObjectForeach))
-> IO (GClosure C_ObjectForeach)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ObjectForeach -> IO (GClosure C_ObjectForeach)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_ObjectForeach ::
Maybe (Ptr (FunPtr C_ObjectForeach)) ->
ObjectForeach_WithClosures ->
C_ObjectForeach
wrap_ObjectForeach :: Maybe (Ptr (FunPtr C_ObjectForeach))
-> ObjectForeach_WithClosures -> C_ObjectForeach
wrap_ObjectForeach Maybe (Ptr (FunPtr C_ObjectForeach))
gi'funptrptr ObjectForeach_WithClosures
gi'cb Ptr Object
object CString
memberName Ptr Node
memberNode Ptr ()
userData = do
Ptr Object -> (Object -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Object
object ((Object -> IO ()) -> IO ()) -> (Object -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Object
object' -> do
Text
memberName' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
memberName
Ptr Node -> (Node -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Node
memberNode ((Node -> IO ()) -> IO ()) -> (Node -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Node
memberNode' -> do
ObjectForeach_WithClosures
gi'cb Object
object' Text
memberName' Node
memberNode' Ptr ()
userData
Maybe (Ptr (FunPtr C_ObjectForeach)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ObjectForeach))
gi'funptrptr
type C_BoxedSerializeFunc =
Ptr () ->
IO (Ptr Json.Node.Node)
foreign import ccall "dynamic" __dynamic_C_BoxedSerializeFunc :: FunPtr C_BoxedSerializeFunc -> C_BoxedSerializeFunc
dynamic_BoxedSerializeFunc ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_BoxedSerializeFunc
-> Ptr ()
-> m Json.Node.Node
dynamic_BoxedSerializeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_BoxedSerializeFunc -> Ptr () -> m Node
dynamic_BoxedSerializeFunc FunPtr C_BoxedSerializeFunc
__funPtr Ptr ()
boxed = IO Node -> m Node
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Node -> m Node) -> IO Node -> m Node
forall a b. (a -> b) -> a -> b
$ do
Ptr Node
result <- (FunPtr C_BoxedSerializeFunc -> C_BoxedSerializeFunc
__dynamic_C_BoxedSerializeFunc FunPtr C_BoxedSerializeFunc
__funPtr) Ptr ()
boxed
Text -> Ptr Node -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"boxedSerializeFunc" Ptr Node
result
Node
result' <- ((ManagedPtr Node -> Node) -> Ptr Node -> IO Node
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Node -> Node
Json.Node.Node) Ptr Node
result
Node -> IO Node
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Node
result'
foreign import ccall "wrapper"
mk_BoxedSerializeFunc :: C_BoxedSerializeFunc -> IO (FunPtr C_BoxedSerializeFunc)
type BoxedSerializeFunc =
Ptr ()
-> IO Json.Node.Node
noBoxedSerializeFunc :: Maybe BoxedSerializeFunc
noBoxedSerializeFunc :: Maybe BoxedSerializeFunc
noBoxedSerializeFunc = Maybe BoxedSerializeFunc
forall a. Maybe a
Nothing
genClosure_BoxedSerializeFunc :: MonadIO m => BoxedSerializeFunc -> m (GClosure C_BoxedSerializeFunc)
genClosure_BoxedSerializeFunc :: forall (m :: * -> *).
MonadIO m =>
BoxedSerializeFunc -> m (GClosure C_BoxedSerializeFunc)
genClosure_BoxedSerializeFunc BoxedSerializeFunc
cb = IO (GClosure C_BoxedSerializeFunc)
-> m (GClosure C_BoxedSerializeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BoxedSerializeFunc)
-> m (GClosure C_BoxedSerializeFunc))
-> IO (GClosure C_BoxedSerializeFunc)
-> m (GClosure C_BoxedSerializeFunc)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_BoxedSerializeFunc
cb' = Maybe (Ptr (FunPtr C_BoxedSerializeFunc))
-> BoxedSerializeFunc -> C_BoxedSerializeFunc
wrap_BoxedSerializeFunc Maybe (Ptr (FunPtr C_BoxedSerializeFunc))
forall a. Maybe a
Nothing BoxedSerializeFunc
cb
C_BoxedSerializeFunc -> IO (FunPtr C_BoxedSerializeFunc)
mk_BoxedSerializeFunc C_BoxedSerializeFunc
cb' IO (FunPtr C_BoxedSerializeFunc)
-> (FunPtr C_BoxedSerializeFunc
-> IO (GClosure C_BoxedSerializeFunc))
-> IO (GClosure C_BoxedSerializeFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BoxedSerializeFunc -> IO (GClosure C_BoxedSerializeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_BoxedSerializeFunc ::
Maybe (Ptr (FunPtr C_BoxedSerializeFunc)) ->
BoxedSerializeFunc ->
C_BoxedSerializeFunc
wrap_BoxedSerializeFunc :: Maybe (Ptr (FunPtr C_BoxedSerializeFunc))
-> BoxedSerializeFunc -> C_BoxedSerializeFunc
wrap_BoxedSerializeFunc Maybe (Ptr (FunPtr C_BoxedSerializeFunc))
gi'funptrptr BoxedSerializeFunc
gi'cb Ptr ()
boxed = do
Node
result <- BoxedSerializeFunc
gi'cb Ptr ()
boxed
Maybe (Ptr (FunPtr C_BoxedSerializeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BoxedSerializeFunc))
gi'funptrptr
Ptr Node
result' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Node
result
Ptr Node -> IO (Ptr Node)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Node
result'
type C_BoxedDeserializeFunc =
Ptr Json.Node.Node ->
IO (Ptr ())
foreign import ccall "dynamic" __dynamic_C_BoxedDeserializeFunc :: FunPtr C_BoxedDeserializeFunc -> C_BoxedDeserializeFunc
dynamic_BoxedDeserializeFunc ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_BoxedDeserializeFunc
-> Json.Node.Node
-> m (Ptr ())
dynamic_BoxedDeserializeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_BoxedDeserializeFunc -> Node -> m (Ptr ())
dynamic_BoxedDeserializeFunc FunPtr C_BoxedDeserializeFunc
__funPtr Node
node = IO (Ptr ()) -> m (Ptr ())
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
Ptr Node
node' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Node
node
Ptr ()
result <- (FunPtr C_BoxedDeserializeFunc -> C_BoxedDeserializeFunc
__dynamic_C_BoxedDeserializeFunc FunPtr C_BoxedDeserializeFunc
__funPtr) Ptr Node
node'
Node -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Node
node
Ptr () -> IO (Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
foreign import ccall "wrapper"
mk_BoxedDeserializeFunc :: C_BoxedDeserializeFunc -> IO (FunPtr C_BoxedDeserializeFunc)
type BoxedDeserializeFunc =
Json.Node.Node
-> IO (Ptr ())
noBoxedDeserializeFunc :: Maybe BoxedDeserializeFunc
noBoxedDeserializeFunc :: Maybe BoxedDeserializeFunc
noBoxedDeserializeFunc = Maybe BoxedDeserializeFunc
forall a. Maybe a
Nothing
genClosure_BoxedDeserializeFunc :: MonadIO m => BoxedDeserializeFunc -> m (GClosure C_BoxedDeserializeFunc)
genClosure_BoxedDeserializeFunc :: forall (m :: * -> *).
MonadIO m =>
BoxedDeserializeFunc -> m (GClosure C_BoxedDeserializeFunc)
genClosure_BoxedDeserializeFunc BoxedDeserializeFunc
cb = IO (GClosure C_BoxedDeserializeFunc)
-> m (GClosure C_BoxedDeserializeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_BoxedDeserializeFunc)
-> m (GClosure C_BoxedDeserializeFunc))
-> IO (GClosure C_BoxedDeserializeFunc)
-> m (GClosure C_BoxedDeserializeFunc)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_BoxedDeserializeFunc
cb' = Maybe (Ptr (FunPtr C_BoxedDeserializeFunc))
-> BoxedDeserializeFunc -> C_BoxedDeserializeFunc
wrap_BoxedDeserializeFunc Maybe (Ptr (FunPtr C_BoxedDeserializeFunc))
forall a. Maybe a
Nothing BoxedDeserializeFunc
cb
C_BoxedDeserializeFunc -> IO (FunPtr C_BoxedDeserializeFunc)
mk_BoxedDeserializeFunc C_BoxedDeserializeFunc
cb' IO (FunPtr C_BoxedDeserializeFunc)
-> (FunPtr C_BoxedDeserializeFunc
-> IO (GClosure C_BoxedDeserializeFunc))
-> IO (GClosure C_BoxedDeserializeFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_BoxedDeserializeFunc
-> IO (GClosure C_BoxedDeserializeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_BoxedDeserializeFunc ::
Maybe (Ptr (FunPtr C_BoxedDeserializeFunc)) ->
BoxedDeserializeFunc ->
C_BoxedDeserializeFunc
wrap_BoxedDeserializeFunc :: Maybe (Ptr (FunPtr C_BoxedDeserializeFunc))
-> BoxedDeserializeFunc -> C_BoxedDeserializeFunc
wrap_BoxedDeserializeFunc Maybe (Ptr (FunPtr C_BoxedDeserializeFunc))
gi'funptrptr BoxedDeserializeFunc
gi'cb Ptr Node
node = do
Ptr Node -> BoxedDeserializeFunc -> IO (Ptr ())
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Node
node (BoxedDeserializeFunc -> IO (Ptr ()))
-> BoxedDeserializeFunc -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Node
node' -> do
Ptr ()
result <- BoxedDeserializeFunc
gi'cb Node
node'
Maybe (Ptr (FunPtr C_BoxedDeserializeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_BoxedDeserializeFunc))
gi'funptrptr
Ptr () -> IO (Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result
type C_ArrayForeach =
Ptr Json.Array.Array ->
Word32 ->
Ptr Json.Node.Node ->
Ptr () ->
IO ()
foreign import ccall "dynamic" __dynamic_C_ArrayForeach :: FunPtr C_ArrayForeach -> C_ArrayForeach
dynamic_ArrayForeach ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_ArrayForeach
-> Json.Array.Array
-> Word32
-> Json.Node.Node
-> Ptr ()
-> m ()
dynamic_ArrayForeach :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_ArrayForeach -> Array -> Word32 -> Node -> Ptr () -> m ()
dynamic_ArrayForeach FunPtr C_ArrayForeach
__funPtr Array
array Word32
index_ Node
elementNode Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Array
array' <- Array -> IO (Ptr Array)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Array
array
Ptr Node
elementNode' <- Node -> IO (Ptr Node)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Node
elementNode
(FunPtr C_ArrayForeach -> C_ArrayForeach
__dynamic_C_ArrayForeach FunPtr C_ArrayForeach
__funPtr) Ptr Array
array' Word32
index_ Ptr Node
elementNode' Ptr ()
userData
Array -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Array
array
Node -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Node
elementNode
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "wrapper"
mk_ArrayForeach :: C_ArrayForeach -> IO (FunPtr C_ArrayForeach)
type ArrayForeach =
Json.Array.Array
-> Word32
-> Json.Node.Node
-> IO ()
noArrayForeach :: Maybe ArrayForeach
noArrayForeach :: Maybe ArrayForeach
noArrayForeach = Maybe ArrayForeach
forall a. Maybe a
Nothing
type ArrayForeach_WithClosures =
Json.Array.Array
-> Word32
-> Json.Node.Node
-> Ptr ()
-> IO ()
noArrayForeach_WithClosures :: Maybe ArrayForeach_WithClosures
noArrayForeach_WithClosures :: Maybe ArrayForeach_WithClosures
noArrayForeach_WithClosures = Maybe ArrayForeach_WithClosures
forall a. Maybe a
Nothing
drop_closures_ArrayForeach :: ArrayForeach -> ArrayForeach_WithClosures
drop_closures_ArrayForeach :: ArrayForeach -> ArrayForeach_WithClosures
drop_closures_ArrayForeach ArrayForeach
_f Array
array Word32
index_ Node
elementNode Ptr ()
_ = ArrayForeach
_f Array
array Word32
index_ Node
elementNode
genClosure_ArrayForeach :: MonadIO m => ArrayForeach -> m (GClosure C_ArrayForeach)
genClosure_ArrayForeach :: forall (m :: * -> *).
MonadIO m =>
ArrayForeach -> m (GClosure C_ArrayForeach)
genClosure_ArrayForeach ArrayForeach
cb = IO (GClosure C_ArrayForeach) -> m (GClosure C_ArrayForeach)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ArrayForeach) -> m (GClosure C_ArrayForeach))
-> IO (GClosure C_ArrayForeach) -> m (GClosure C_ArrayForeach)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: ArrayForeach_WithClosures
cb' = ArrayForeach -> ArrayForeach_WithClosures
drop_closures_ArrayForeach ArrayForeach
cb
let cb'' :: C_ArrayForeach
cb'' = Maybe (Ptr (FunPtr C_ArrayForeach))
-> ArrayForeach_WithClosures -> C_ArrayForeach
wrap_ArrayForeach Maybe (Ptr (FunPtr C_ArrayForeach))
forall a. Maybe a
Nothing ArrayForeach_WithClosures
cb'
C_ArrayForeach -> IO (FunPtr C_ArrayForeach)
mk_ArrayForeach C_ArrayForeach
cb'' IO (FunPtr C_ArrayForeach)
-> (FunPtr C_ArrayForeach -> IO (GClosure C_ArrayForeach))
-> IO (GClosure C_ArrayForeach)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ArrayForeach -> IO (GClosure C_ArrayForeach)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_ArrayForeach ::
Maybe (Ptr (FunPtr C_ArrayForeach)) ->
ArrayForeach_WithClosures ->
C_ArrayForeach
wrap_ArrayForeach :: Maybe (Ptr (FunPtr C_ArrayForeach))
-> ArrayForeach_WithClosures -> C_ArrayForeach
wrap_ArrayForeach Maybe (Ptr (FunPtr C_ArrayForeach))
gi'funptrptr ArrayForeach_WithClosures
gi'cb Ptr Array
array Word32
index_ Ptr Node
elementNode Ptr ()
userData = do
Ptr Array -> (Array -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Array
array ((Array -> IO ()) -> IO ()) -> (Array -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Array
array' -> do
Ptr Node -> (Node -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr Node
elementNode ((Node -> IO ()) -> IO ()) -> (Node -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Node
elementNode' -> do
ArrayForeach_WithClosures
gi'cb Array
array' Word32
index_ Node
elementNode' Ptr ()
userData
Maybe (Ptr (FunPtr C_ArrayForeach)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_ArrayForeach))
gi'funptrptr