{-# language CPP #-}
module OpenXR.Core10.SemanticPaths ( stringToPath
, pathToString
, Path(..)
) where
import OpenXR.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import GHC.Show (showParen)
import Numeric (showHex)
import Data.ByteString (packCString)
import Data.ByteString (useAsCString)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Foreign.C.Types (CChar(..))
import OpenXR.Zero (Zero)
import Control.Monad.IO.Class (MonadIO)
import Foreign.C.Types (CChar)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.ByteString (ByteString)
import Control.Monad.Trans.Cont (ContT(..))
import OpenXR.NamedType ((:::))
import OpenXR.Core10.Handles (Instance)
import OpenXR.Core10.Handles (Instance(..))
import OpenXR.Dynamic (InstanceCmds(pXrPathToString))
import OpenXR.Dynamic (InstanceCmds(pXrStringToPath))
import OpenXR.Core10.Handles (Instance_T)
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrStringToPath
:: FunPtr (Ptr Instance_T -> Ptr CChar -> Ptr Path -> IO Result) -> Ptr Instance_T -> Ptr CChar -> Ptr Path -> IO Result
stringToPath :: forall io
. (MonadIO io)
=>
Instance
->
("pathString" ::: ByteString)
-> io (Path)
stringToPath :: Instance -> ("pathString" ::: ByteString) -> io Path
stringToPath instance' :: Instance
instance' pathString :: "pathString" ::: ByteString
pathString = IO Path -> io Path
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Path -> io Path)
-> (ContT Path IO Path -> IO Path) -> ContT Path IO Path -> io Path
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT Path IO Path -> IO Path
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT Path IO Path -> io Path) -> ContT Path IO Path -> io Path
forall a b. (a -> b) -> a -> b
$ do
let xrStringToPathPtr :: FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
xrStringToPathPtr = InstanceCmds
-> FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
pXrStringToPath (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
IO () -> ContT Path IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Path IO ()) -> IO () -> ContT Path IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
xrStringToPathPtr FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
-> FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrStringToPath is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrStringToPath' :: Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result
xrStringToPath' = FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
-> Ptr Instance_T
-> ("pathString" ::: Ptr CChar)
-> Ptr Path
-> IO Result
mkXrStringToPath FunPtr
(Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result)
xrStringToPathPtr
"pathString" ::: Ptr CChar
pathString' <- ((("pathString" ::: Ptr CChar) -> IO Path) -> IO Path)
-> ContT Path IO ("pathString" ::: Ptr CChar)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pathString" ::: Ptr CChar) -> IO Path) -> IO Path)
-> ContT Path IO ("pathString" ::: Ptr CChar))
-> ((("pathString" ::: Ptr CChar) -> IO Path) -> IO Path)
-> ContT Path IO ("pathString" ::: Ptr CChar)
forall a b. (a -> b) -> a -> b
$ ("pathString" ::: ByteString)
-> (("pathString" ::: Ptr CChar) -> IO Path) -> IO Path
forall a.
("pathString" ::: ByteString)
-> (("pathString" ::: Ptr CChar) -> IO a) -> IO a
useAsCString ("pathString" ::: ByteString
pathString)
Ptr Path
pPath <- ((Ptr Path -> IO Path) -> IO Path) -> ContT Path IO (Ptr Path)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr Path -> IO Path) -> IO Path) -> ContT Path IO (Ptr Path))
-> ((Ptr Path -> IO Path) -> IO Path) -> ContT Path IO (Ptr Path)
forall a b. (a -> b) -> a -> b
$ IO (Ptr Path)
-> (Ptr Path -> IO ()) -> (Ptr Path -> IO Path) -> IO Path
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO (Ptr Path)
forall a. Int -> IO (Ptr a)
callocBytes @Path 8) Ptr Path -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT Path IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT Path IO Result)
-> IO Result -> ContT Path IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrStringToPath" (Ptr Instance_T
-> ("pathString" ::: Ptr CChar) -> Ptr Path -> IO Result
xrStringToPath' (Instance -> Ptr Instance_T
instanceHandle (Instance
instance')) "pathString" ::: Ptr CChar
pathString' (Ptr Path
pPath))
IO () -> ContT Path IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT Path IO ()) -> IO () -> ContT Path IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
Path
path <- IO Path -> ContT Path IO Path
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Path -> ContT Path IO Path) -> IO Path -> ContT Path IO Path
forall a b. (a -> b) -> a -> b
$ Ptr Path -> IO Path
forall a. Storable a => Ptr a -> IO a
peek @Path Ptr Path
pPath
Path -> ContT Path IO Path
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Path -> ContT Path IO Path) -> Path -> ContT Path IO Path
forall a b. (a -> b) -> a -> b
$ (Path
path)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkXrPathToString
:: FunPtr (Ptr Instance_T -> Path -> Word32 -> Ptr Word32 -> Ptr CChar -> IO Result) -> Ptr Instance_T -> Path -> Word32 -> Ptr Word32 -> Ptr CChar -> IO Result
pathToString :: forall io
. (MonadIO io)
=>
Instance
->
Path
-> io (("buffer" ::: ByteString))
pathToString :: Instance -> Path -> io ("pathString" ::: ByteString)
pathToString instance' :: Instance
instance' path :: Path
path = IO ("pathString" ::: ByteString)
-> io ("pathString" ::: ByteString)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ("pathString" ::: ByteString)
-> io ("pathString" ::: ByteString))
-> (ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
-> io ("pathString" ::: ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
-> IO ("pathString" ::: ByteString)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
-> io ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
-> io ("pathString" ::: ByteString)
forall a b. (a -> b) -> a -> b
$ do
let xrPathToStringPtr :: FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
xrPathToStringPtr = InstanceCmds
-> FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
pXrPathToString (Instance -> InstanceCmds
instanceCmds (Instance
instance' :: Instance))
IO () -> ContT ("pathString" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("pathString" ::: ByteString) IO ())
-> IO () -> ContT ("pathString" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
xrPathToStringPtr FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
-> FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrPathToString is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let xrPathToString' :: Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result
xrPathToString' = FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
-> Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result
mkXrPathToString FunPtr
(Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result)
xrPathToStringPtr
let instance'' :: Ptr Instance_T
instance'' = Instance -> Ptr Instance_T
instanceHandle (Instance
instance')
"bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput <- ((("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString)
IO
("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString)
IO
("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)))
-> ((("bufferCountOutput"
::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString)
IO
("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall a b. (a -> b) -> a -> b
$ IO ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> (("bufferCountOutput"
::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ())
-> (("bufferCountOutput"
::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT ("pathString" ::: ByteString) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("pathString" ::: ByteString) IO Result)
-> IO Result -> ContT ("pathString" ::: ByteString) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrPathToString" (Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result
xrPathToString' Ptr Instance_T
instance'' (Path
path) (0) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput) ("pathString" ::: Ptr CChar
forall a. Ptr a
nullPtr))
IO () -> ContT ("pathString" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("pathString" ::: ByteString) IO ())
-> IO () -> ContT ("pathString" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
"bufferCapacityInput" ::: Word32
bufferCountOutput <- IO ("bufferCapacityInput" ::: Word32)
-> ContT
("pathString" ::: ByteString) IO ("bufferCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("bufferCapacityInput" ::: Word32)
-> ContT
("pathString" ::: ByteString)
IO
("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
-> ContT
("pathString" ::: ByteString) IO ("bufferCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> IO ("bufferCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput
"pathString" ::: Ptr CChar
pBuffer <- ((("pathString" ::: Ptr CChar) -> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: Ptr CChar)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pathString" ::: Ptr CChar)
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: Ptr CChar))
-> ((("pathString" ::: Ptr CChar)
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString))
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: Ptr CChar)
forall a b. (a -> b) -> a -> b
$ IO ("pathString" ::: Ptr CChar)
-> (("pathString" ::: Ptr CChar) -> IO ())
-> (("pathString" ::: Ptr CChar)
-> IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pathString" ::: Ptr CChar)
forall a. Int -> IO (Ptr a)
callocBytes @CChar (("bufferCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("bufferCapacityInput" ::: Word32
bufferCountOutput))) ("pathString" ::: Ptr CChar) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r' <- IO Result -> ContT ("pathString" ::: ByteString) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT ("pathString" ::: ByteString) IO Result)
-> IO Result -> ContT ("pathString" ::: ByteString) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrPathToString" (Ptr Instance_T
-> Path
-> ("bufferCapacityInput" ::: Word32)
-> ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32))
-> ("pathString" ::: Ptr CChar)
-> IO Result
xrPathToString' Ptr Instance_T
instance'' (Path
path) (("bufferCapacityInput" ::: Word32
bufferCountOutput)) ("bufferCountOutput" ::: Ptr ("bufferCapacityInput" ::: Word32)
pBufferCountOutput) ("pathString" ::: Ptr CChar
pBuffer))
IO () -> ContT ("pathString" ::: ByteString) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT ("pathString" ::: ByteString) IO ())
-> IO () -> ContT ("pathString" ::: ByteString) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r'))
"pathString" ::: ByteString
buffer' <- IO ("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString))
-> IO ("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
forall a b. (a -> b) -> a -> b
$ ("pathString" ::: Ptr CChar) -> IO ("pathString" ::: ByteString)
packCString "pathString" ::: Ptr CChar
pBuffer
("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString))
-> ("pathString" ::: ByteString)
-> ContT
("pathString" ::: ByteString) IO ("pathString" ::: ByteString)
forall a b. (a -> b) -> a -> b
$ ("pathString" ::: ByteString
buffer')
newtype Path = Path Word64
deriving newtype (Path -> Path -> Bool
(Path -> Path -> Bool) -> (Path -> Path -> Bool) -> Eq Path
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Path -> Path -> Bool
$c/= :: Path -> Path -> Bool
== :: Path -> Path -> Bool
$c== :: Path -> Path -> Bool
Eq, Eq Path
Eq Path =>
(Path -> Path -> Ordering)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Bool)
-> (Path -> Path -> Path)
-> (Path -> Path -> Path)
-> Ord Path
Path -> Path -> Bool
Path -> Path -> Ordering
Path -> Path -> Path
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Path -> Path -> Path
$cmin :: Path -> Path -> Path
max :: Path -> Path -> Path
$cmax :: Path -> Path -> Path
>= :: Path -> Path -> Bool
$c>= :: Path -> Path -> Bool
> :: Path -> Path -> Bool
$c> :: Path -> Path -> Bool
<= :: Path -> Path -> Bool
$c<= :: Path -> Path -> Bool
< :: Path -> Path -> Bool
$c< :: Path -> Path -> Bool
compare :: Path -> Path -> Ordering
$ccompare :: Path -> Path -> Ordering
$cp1Ord :: Eq Path
Ord, Ptr b -> Int -> IO Path
Ptr b -> Int -> Path -> IO ()
Ptr Path -> IO Path
Ptr Path -> Int -> IO Path
Ptr Path -> Int -> Path -> IO ()
Ptr Path -> Path -> IO ()
Path -> Int
(Path -> Int)
-> (Path -> Int)
-> (Ptr Path -> Int -> IO Path)
-> (Ptr Path -> Int -> Path -> IO ())
-> (forall b. Ptr b -> Int -> IO Path)
-> (forall b. Ptr b -> Int -> Path -> IO ())
-> (Ptr Path -> IO Path)
-> (Ptr Path -> Path -> IO ())
-> Storable Path
forall b. Ptr b -> Int -> IO Path
forall b. Ptr b -> Int -> Path -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr Path -> Path -> IO ()
$cpoke :: Ptr Path -> Path -> IO ()
peek :: Ptr Path -> IO Path
$cpeek :: Ptr Path -> IO Path
pokeByteOff :: Ptr b -> Int -> Path -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> Path -> IO ()
peekByteOff :: Ptr b -> Int -> IO Path
$cpeekByteOff :: forall b. Ptr b -> Int -> IO Path
pokeElemOff :: Ptr Path -> Int -> Path -> IO ()
$cpokeElemOff :: Ptr Path -> Int -> Path -> IO ()
peekElemOff :: Ptr Path -> Int -> IO Path
$cpeekElemOff :: Ptr Path -> Int -> IO Path
alignment :: Path -> Int
$calignment :: Path -> Int
sizeOf :: Path -> Int
$csizeOf :: Path -> Int
Storable, Path
Path -> Zero Path
forall a. a -> Zero a
zero :: Path
$czero :: Path
Zero)
instance Show Path where
showsPrec :: Int -> Path -> ShowS
showsPrec p :: Int
p (Path x :: Word64
x) = Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 11) (String -> ShowS
showString "Path 0x" ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> ShowS
forall a. (Integral a, Show a) => a -> ShowS
showHex Word64
x)