sdl3-bindgen-sys-0.0.0.1: src/SDL3/Sys/Bindgen/Guid/Safe.hs
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# OPTIONS_HADDOCK prune #-}
module SDL3.Sys.Bindgen.Guid.Safe (
SDL3.Sys.Bindgen.Guid.Safe.sDL_GUIDToString,
SDL3.Sys.Bindgen.Guid.Safe.sDL_StringToGUID,
)
where
import HsBindgen.Runtime.PtrConst qualified as PtrConst
import HsBindgen.Runtime.Support qualified as BG
import HsBindgen.Runtime.Support.CAPI qualified
import SDL3.Sys.Bindgen.Guid
$( HsBindgen.Runtime.Support.CAPI.addCSource
( HsBindgen.Runtime.Support.CAPI.unlines
[ "#include <SDL3/SDL_guid.h>"
, "void hs_bindgen_33e8afba591e5cdf ("
, " SDL_GUID *arg1,"
, " char *arg2,"
, " signed int arg3"
, ")"
, "{"
, " (SDL_GUIDToString)(*arg1, arg2, arg3);"
, "}"
, "void hs_bindgen_260d7fbde1a12e5d ("
, " char const *arg1,"
, " SDL_GUID *arg2"
, ")"
, "{"
, " *arg2 = (SDL_StringToGUID)(arg1);"
, "}"
]
)
)
-- __unique:__ @sdl3bindgensys_SDL3.Sys.Bindgen.Guid_Safe_SDL_GUIDToString@
foreign import ccall safe "hs_bindgen_33e8afba591e5cdf"
hs_bindgen_33e8afba591e5cdf_base
:: BG.Ptr BG.Void
-> BG.Ptr BG.Void
-> BG.Int32
-> IO ()
-- __unique:__ @sdl3bindgensys_SDL3.Sys.Bindgen.Guid_Safe_SDL_GUIDToString@
hs_bindgen_33e8afba591e5cdf
:: BG.Ptr SDL_GUID
-> BG.Ptr BG.CChar
-> BG.CInt
-> IO ()
hs_bindgen_33e8afba591e5cdf =
BG.fromFFIType hs_bindgen_33e8afba591e5cdf_base
-- | Get an ASCII string representation for a given 'SDL_GUID'.
--
-- [Thread safety]: It is safe to call this function from any thread.
--
-- @since 3.2.0
--
-- [See also]: 'sDL_StringToGUID'
--
-- [C declaration]: @SDL_GUIDToString@, defined at @SDL3\/SDL_guid.h 80:34@
sDL_GUIDToString
:: SDL_GUID
-- ^
--
-- [@guid@]: the 'SDL_GUID' you wish to convert to string.
-> BG.Ptr BG.CChar
-- ^
--
-- [@pszGUID@]: buffer in which to write the ASCII string.
-> BG.CInt
-- ^
--
-- [@cbGUID@]: the size of pszGUID, should be at least 33 bytes.
-> IO ()
sDL_GUIDToString =
\guid0 ->
\pszGUID1 ->
\cbGUID2 ->
BG.with
guid0
( \guid3 ->
hs_bindgen_33e8afba591e5cdf guid3 pszGUID1 cbGUID2
)
-- __unique:__ @sdl3bindgensys_SDL3.Sys.Bindgen.Guid_Safe_SDL_StringToGUID@
foreign import ccall safe "hs_bindgen_260d7fbde1a12e5d"
hs_bindgen_260d7fbde1a12e5d_base
:: BG.Ptr BG.Void
-> BG.Ptr BG.Void
-> IO ()
-- __unique:__ @sdl3bindgensys_SDL3.Sys.Bindgen.Guid_Safe_SDL_StringToGUID@
hs_bindgen_260d7fbde1a12e5d
:: PtrConst.PtrConst BG.CChar
-> BG.Ptr SDL_GUID
-> IO ()
hs_bindgen_260d7fbde1a12e5d =
BG.fromFFIType hs_bindgen_260d7fbde1a12e5d_base
-- | Convert a GUID string into a 'SDL_GUID' structure.
--
-- Performs no error checking. If this function is given a string containing an invalid GUID, the function will silently succeed, but the GUID generated will not be useful.
--
-- [Returns]: a 'SDL_GUID' structure.
--
-- [Thread safety]: It is safe to call this function from any thread.
--
-- @since 3.2.0
--
-- [See also]: 'sDL_GUIDToString'
--
-- [C declaration]: @SDL_StringToGUID@, defined at @SDL3\/SDL_guid.h 98:38@
sDL_StringToGUID
:: PtrConst.PtrConst BG.CChar
-- ^
--
-- [@pchGUID@]: string containing an ASCII representation of a GUID.
-> IO SDL_GUID
sDL_StringToGUID =
\pchGUID0 ->
BG.allocaAndPeek
( \res1 ->
hs_bindgen_260d7fbde1a12e5d pchGUID0 res1
)