{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Vte.Objects.Pty
(
#if defined(ENABLE_OVERLOADING)
PtySpawnAsyncMethodInfo ,
#endif
Pty(..) ,
IsPty ,
toPty ,
#if defined(ENABLE_OVERLOADING)
ResolvePtyMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
PtyChildSetupMethodInfo ,
#endif
ptyChildSetup ,
#if defined(ENABLE_OVERLOADING)
PtyCloseMethodInfo ,
#endif
ptyClose ,
#if defined(ENABLE_OVERLOADING)
PtyGetFdMethodInfo ,
#endif
ptyGetFd ,
#if defined(ENABLE_OVERLOADING)
PtyGetSizeMethodInfo ,
#endif
ptyGetSize ,
ptyNewForeignSync ,
ptyNewSync ,
#if defined(ENABLE_OVERLOADING)
PtySetSizeMethodInfo ,
#endif
ptySetSize ,
#if defined(ENABLE_OVERLOADING)
PtySetUtf8MethodInfo ,
#endif
ptySetUtf8 ,
#if defined(ENABLE_OVERLOADING)
PtySpawnFinishMethodInfo ,
#endif
ptySpawnFinish ,
#if defined(ENABLE_OVERLOADING)
PtyFdPropertyInfo ,
#endif
constructPtyFd ,
getPtyFd ,
#if defined(ENABLE_OVERLOADING)
ptyFd ,
#endif
#if defined(ENABLE_OVERLOADING)
PtyFlagsPropertyInfo ,
#endif
constructPtyFlags ,
getPtyFlags ,
#if defined(ENABLE_OVERLOADING)
ptyFlags ,
#endif
) 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.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Vte.Flags as Vte.Flags
newtype Pty = Pty (SP.ManagedPtr Pty)
deriving (Pty -> Pty -> Bool
(Pty -> Pty -> Bool) -> (Pty -> Pty -> Bool) -> Eq Pty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pty -> Pty -> Bool
$c/= :: Pty -> Pty -> Bool
== :: Pty -> Pty -> Bool
$c== :: Pty -> Pty -> Bool
Eq)
instance SP.ManagedPtrNewtype Pty where
toManagedPtr :: Pty -> ManagedPtr Pty
toManagedPtr (Pty ManagedPtr Pty
p) = ManagedPtr Pty
p
foreign import ccall "vte_pty_get_type"
c_vte_pty_get_type :: IO B.Types.GType
instance B.Types.TypedObject Pty where
glibType :: IO GType
glibType = IO GType
c_vte_pty_get_type
instance B.Types.GObject Pty
instance B.GValue.IsGValue Pty where
toGValue :: Pty -> IO GValue
toGValue Pty
o = do
GType
gtype <- IO GType
c_vte_pty_get_type
Pty -> (Ptr Pty -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Pty
o (GType -> (GValue -> Ptr Pty -> IO ()) -> Ptr Pty -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Pty -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Pty
fromGValue GValue
gv = do
Ptr Pty
ptr <- GValue -> IO (Ptr Pty)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Pty)
(ManagedPtr Pty -> Pty) -> Ptr Pty -> IO Pty
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Pty -> Pty
Pty Ptr Pty
ptr
class (SP.GObject o, O.IsDescendantOf Pty o) => IsPty o
instance (SP.GObject o, O.IsDescendantOf Pty o) => IsPty o
instance O.HasParentTypes Pty
type instance O.ParentTypes Pty = '[GObject.Object.Object, Gio.Initable.Initable]
toPty :: (MonadIO m, IsPty o) => o -> m Pty
toPty :: o -> m Pty
toPty = IO Pty -> m Pty
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Pty -> m Pty) -> (o -> IO Pty) -> o -> m Pty
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Pty -> Pty) -> o -> IO Pty
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Pty -> Pty
Pty
#if defined(ENABLE_OVERLOADING)
type family ResolvePtyMethod (t :: Symbol) (o :: *) :: * where
ResolvePtyMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolvePtyMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolvePtyMethod "childSetup" o = PtyChildSetupMethodInfo
ResolvePtyMethod "close" o = PtyCloseMethodInfo
ResolvePtyMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolvePtyMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolvePtyMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolvePtyMethod "init" o = Gio.Initable.InitableInitMethodInfo
ResolvePtyMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolvePtyMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolvePtyMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolvePtyMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolvePtyMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolvePtyMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolvePtyMethod "spawnAsync" o = PtySpawnAsyncMethodInfo
ResolvePtyMethod "spawnFinish" o = PtySpawnFinishMethodInfo
ResolvePtyMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolvePtyMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolvePtyMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolvePtyMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolvePtyMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolvePtyMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolvePtyMethod "getFd" o = PtyGetFdMethodInfo
ResolvePtyMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolvePtyMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolvePtyMethod "getSize" o = PtyGetSizeMethodInfo
ResolvePtyMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolvePtyMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolvePtyMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolvePtyMethod "setSize" o = PtySetSizeMethodInfo
ResolvePtyMethod "setUtf8" o = PtySetUtf8MethodInfo
ResolvePtyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePtyMethod t Pty, O.MethodInfo info Pty p) => OL.IsLabel t (Pty -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
getPtyFd :: (MonadIO m, IsPty o) => o -> m Int32
getPtyFd :: o -> m Int32
getPtyFd o
obj = 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
$ o -> String -> IO Int32
forall a. GObject a => a -> String -> IO Int32
B.Properties.getObjectPropertyInt32 o
obj String
"fd"
constructPtyFd :: (IsPty o, MIO.MonadIO m) => Int32 -> m (GValueConstruct o)
constructPtyFd :: Int32 -> m (GValueConstruct o)
constructPtyFd Int32
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Int32 -> IO (GValueConstruct o)
forall o. String -> Int32 -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyInt32 String
"fd" Int32
val
#if defined(ENABLE_OVERLOADING)
data PtyFdPropertyInfo
instance AttrInfo PtyFdPropertyInfo where
type AttrAllowedOps PtyFdPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint PtyFdPropertyInfo = IsPty
type AttrSetTypeConstraint PtyFdPropertyInfo = (~) Int32
type AttrTransferTypeConstraint PtyFdPropertyInfo = (~) Int32
type AttrTransferType PtyFdPropertyInfo = Int32
type AttrGetType PtyFdPropertyInfo = Int32
type AttrLabel PtyFdPropertyInfo = "fd"
type AttrOrigin PtyFdPropertyInfo = Pty
attrGet = getPtyFd
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructPtyFd
attrClear = undefined
#endif
getPtyFlags :: (MonadIO m, IsPty o) => o -> m [Vte.Flags.PtyFlags]
getPtyFlags :: o -> m [PtyFlags]
getPtyFlags o
obj = IO [PtyFlags] -> m [PtyFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [PtyFlags] -> m [PtyFlags]) -> IO [PtyFlags] -> m [PtyFlags]
forall a b. (a -> b) -> a -> b
$ o -> String -> IO [PtyFlags]
forall a b.
(GObject a, IsGFlag b, BoxedFlags b) =>
a -> String -> IO [b]
B.Properties.getObjectPropertyFlags o
obj String
"flags"
constructPtyFlags :: (IsPty o, MIO.MonadIO m) => [Vte.Flags.PtyFlags] -> m (GValueConstruct o)
constructPtyFlags :: [PtyFlags] -> m (GValueConstruct o)
constructPtyFlags [PtyFlags]
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> [PtyFlags] -> IO (GValueConstruct o)
forall a o.
(IsGFlag a, BoxedFlags a) =>
String -> [a] -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyFlags String
"flags" [PtyFlags]
val
#if defined(ENABLE_OVERLOADING)
data PtyFlagsPropertyInfo
instance AttrInfo PtyFlagsPropertyInfo where
type AttrAllowedOps PtyFlagsPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint PtyFlagsPropertyInfo = IsPty
type AttrSetTypeConstraint PtyFlagsPropertyInfo = (~) [Vte.Flags.PtyFlags]
type AttrTransferTypeConstraint PtyFlagsPropertyInfo = (~) [Vte.Flags.PtyFlags]
type AttrTransferType PtyFlagsPropertyInfo = [Vte.Flags.PtyFlags]
type AttrGetType PtyFlagsPropertyInfo = [Vte.Flags.PtyFlags]
type AttrLabel PtyFlagsPropertyInfo = "flags"
type AttrOrigin PtyFlagsPropertyInfo = Pty
attrGet = getPtyFlags
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructPtyFlags
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Pty
type instance O.AttributeList Pty = PtyAttributeList
type PtyAttributeList = ('[ '("fd", PtyFdPropertyInfo), '("flags", PtyFlagsPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
ptyFd :: AttrLabelProxy "fd"
ptyFd = AttrLabelProxy
ptyFlags :: AttrLabelProxy "flags"
ptyFlags = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Pty = PtySignalList
type PtySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "vte_pty_new_foreign_sync" vte_pty_new_foreign_sync ::
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Pty)
ptyNewForeignSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Int32
-> Maybe (a)
-> m Pty
ptyNewForeignSync :: Int32 -> Maybe a -> m Pty
ptyNewForeignSync Int32
fd Maybe a
cancellable = IO Pty -> m Pty
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Pty -> m Pty) -> IO Pty -> m Pty
forall a b. (a -> b) -> a -> b
$ do
Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just a
jCancellable -> do
Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Pty -> IO () -> IO Pty
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Pty
result <- (Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty))
-> (Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty)
forall a b. (a -> b) -> a -> b
$ Int32 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Pty)
vte_pty_new_foreign_sync Int32
fd Ptr Cancellable
maybeCancellable
Text -> Ptr Pty -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"ptyNewForeignSync" Ptr Pty
result
Pty
result' <- ((ManagedPtr Pty -> Pty) -> Ptr Pty -> IO Pty
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Pty -> Pty
Pty) Ptr Pty
result
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Pty -> IO Pty
forall (m :: * -> *) a. Monad m => a -> m a
return Pty
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "vte_pty_new_sync" vte_pty_new_sync ::
CUInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Pty)
ptyNewSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
[Vte.Flags.PtyFlags]
-> Maybe (a)
-> m Pty
ptyNewSync :: [PtyFlags] -> Maybe a -> m Pty
ptyNewSync [PtyFlags]
flags Maybe a
cancellable = IO Pty -> m Pty
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Pty -> m Pty) -> IO Pty -> m Pty
forall a b. (a -> b) -> a -> b
$ do
let flags' :: CUInt
flags' = [PtyFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [PtyFlags]
flags
Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just a
jCancellable -> do
Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Pty -> IO () -> IO Pty
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Pty
result <- (Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty))
-> (Ptr (Ptr GError) -> IO (Ptr Pty)) -> IO (Ptr Pty)
forall a b. (a -> b) -> a -> b
$ CUInt -> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Pty)
vte_pty_new_sync CUInt
flags' Ptr Cancellable
maybeCancellable
Text -> Ptr Pty -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"ptyNewSync" Ptr Pty
result
Pty
result' <- ((ManagedPtr Pty -> Pty) -> Ptr Pty -> IO Pty
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Pty -> Pty
Pty) Ptr Pty
result
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Pty -> IO Pty
forall (m :: * -> *) a. Monad m => a -> m a
return Pty
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "vte_pty_child_setup" vte_pty_child_setup ::
Ptr Pty ->
IO ()
ptyChildSetup ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> m ()
ptyChildSetup :: a -> m ()
ptyChildSetup a
pty = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
Ptr Pty -> IO ()
vte_pty_child_setup Ptr Pty
pty'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PtyChildSetupMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPty a) => O.MethodInfo PtyChildSetupMethodInfo a signature where
overloadedMethod = ptyChildSetup
#endif
foreign import ccall "vte_pty_close" vte_pty_close ::
Ptr Pty ->
IO ()
{-# DEPRECATED ptyClose ["(Since version 0.42)"] #-}
ptyClose ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> m ()
ptyClose :: a -> m ()
ptyClose a
pty = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
Ptr Pty -> IO ()
vte_pty_close Ptr Pty
pty'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PtyCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPty a) => O.MethodInfo PtyCloseMethodInfo a signature where
overloadedMethod = ptyClose
#endif
foreign import ccall "vte_pty_get_fd" vte_pty_get_fd ::
Ptr Pty ->
IO Int32
ptyGetFd ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> m Int32
ptyGetFd :: a -> m Int32
ptyGetFd a
pty = 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 Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
Int32
result <- Ptr Pty -> IO Int32
vte_pty_get_fd Ptr Pty
pty'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data PtyGetFdMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsPty a) => O.MethodInfo PtyGetFdMethodInfo a signature where
overloadedMethod = ptyGetFd
#endif
foreign import ccall "vte_pty_get_size" vte_pty_get_size ::
Ptr Pty ->
Ptr Int32 ->
Ptr Int32 ->
Ptr (Ptr GError) ->
IO CInt
ptyGetSize ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> m ((Int32, Int32))
ptyGetSize :: a -> m (Int32, Int32)
ptyGetSize a
pty = IO (Int32, Int32) -> m (Int32, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32) -> m (Int32, Int32))
-> IO (Int32, Int32) -> m (Int32, Int32)
forall a b. (a -> b) -> a -> b
$ do
Ptr Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
Ptr Int32
rows <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Int32
columns <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
IO (Int32, Int32) -> IO () -> IO (Int32, Int32)
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Pty -> Ptr Int32 -> Ptr Int32 -> Ptr (Ptr GError) -> IO CInt
vte_pty_get_size Ptr Pty
pty' Ptr Int32
rows Ptr Int32
columns
Int32
rows' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
rows
Int32
columns' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
columns
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
rows
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
columns
(Int32, Int32) -> IO (Int32, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
rows', Int32
columns')
) (do
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
rows
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
columns
)
#if defined(ENABLE_OVERLOADING)
data PtyGetSizeMethodInfo
instance (signature ~ (m ((Int32, Int32))), MonadIO m, IsPty a) => O.MethodInfo PtyGetSizeMethodInfo a signature where
overloadedMethod = ptyGetSize
#endif
foreign import ccall "vte_pty_set_size" vte_pty_set_size ::
Ptr Pty ->
Int32 ->
Int32 ->
Ptr (Ptr GError) ->
IO CInt
ptySetSize ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> Int32
-> Int32
-> m ()
ptySetSize :: a -> Int32 -> Int32 -> m ()
ptySetSize a
pty Int32
rows Int32
columns = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Pty -> Int32 -> Int32 -> Ptr (Ptr GError) -> IO CInt
vte_pty_set_size Ptr Pty
pty' Int32
rows Int32
columns
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data PtySetSizeMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsPty a) => O.MethodInfo PtySetSizeMethodInfo a signature where
overloadedMethod = ptySetSize
#endif
foreign import ccall "vte_pty_set_utf8" vte_pty_set_utf8 ::
Ptr Pty ->
CInt ->
Ptr (Ptr GError) ->
IO CInt
ptySetUtf8 ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a) =>
a
-> Bool
-> m ()
ptySetUtf8 :: a -> Bool -> m ()
ptySetUtf8 a
pty Bool
utf8 = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
let utf8' :: CInt
utf8' = (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
utf8
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Pty -> CInt -> Ptr (Ptr GError) -> IO CInt
vte_pty_set_utf8 Ptr Pty
pty' CInt
utf8'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data PtySetUtf8MethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsPty a) => O.MethodInfo PtySetUtf8MethodInfo a signature where
overloadedMethod = ptySetUtf8
#endif
#if defined(ENABLE_OVERLOADING)
data PtySpawnAsyncMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "spawnAsync" Pty) => O.MethodInfo PtySpawnAsyncMethodInfo o p where
overloadedMethod = undefined
#endif
foreign import ccall "vte_pty_spawn_finish" vte_pty_spawn_finish ::
Ptr Pty ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr Int32 ->
Ptr (Ptr GError) ->
IO CInt
ptySpawnFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsPty a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m (Int32)
ptySpawnFinish :: a -> b -> m Int32
ptySpawnFinish a
pty b
result_ = 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 Pty
pty' <- a -> IO (Ptr Pty)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pty
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
Ptr Int32
childPid <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Pty
-> Ptr AsyncResult -> Ptr Int32 -> Ptr (Ptr GError) -> IO CInt
vte_pty_spawn_finish Ptr Pty
pty' Ptr AsyncResult
result_' Ptr Int32
childPid
Int32
childPid' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
childPid
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pty
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
childPid
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
childPid'
) (do
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
childPid
)
#if defined(ENABLE_OVERLOADING)
data PtySpawnFinishMethodInfo
instance (signature ~ (b -> m (Int32)), MonadIO m, IsPty a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo PtySpawnFinishMethodInfo a signature where
overloadedMethod = ptySpawnFinish
#endif