{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
-}

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

module GI.GLib.Functions
    (

 -- * Methods
-- ** access #method:access#

    access                                  ,


-- ** asciiDigitValue #method:asciiDigitValue#

    asciiDigitValue                         ,


-- ** asciiDtostr #method:asciiDtostr#

    asciiDtostr                             ,


-- ** asciiFormatd #method:asciiFormatd#

    asciiFormatd                            ,


-- ** asciiStrcasecmp #method:asciiStrcasecmp#

    asciiStrcasecmp                         ,


-- ** asciiStrdown #method:asciiStrdown#

    asciiStrdown                            ,


-- ** asciiStringToSigned #method:asciiStringToSigned#

    asciiStringToSigned                     ,


-- ** asciiStringToUnsigned #method:asciiStringToUnsigned#

    asciiStringToUnsigned                   ,


-- ** asciiStrncasecmp #method:asciiStrncasecmp#

    asciiStrncasecmp                        ,


-- ** asciiStrtod #method:asciiStrtod#

    asciiStrtod                             ,


-- ** asciiStrtoll #method:asciiStrtoll#

    asciiStrtoll                            ,


-- ** asciiStrtoull #method:asciiStrtoull#

    asciiStrtoull                           ,


-- ** asciiStrup #method:asciiStrup#

    asciiStrup                              ,


-- ** asciiTolower #method:asciiTolower#

    asciiTolower                            ,


-- ** asciiToupper #method:asciiToupper#

    asciiToupper                            ,


-- ** asciiXdigitValue #method:asciiXdigitValue#

    asciiXdigitValue                        ,


-- ** assertWarning #method:assertWarning#

    assertWarning                           ,


-- ** assertionMessage #method:assertionMessage#

    assertionMessage                        ,


-- ** assertionMessageCmpstr #method:assertionMessageCmpstr#

    assertionMessageCmpstr                  ,


-- ** assertionMessageError #method:assertionMessageError#

    assertionMessageError                   ,


-- ** atexit #method:atexit#

    atexit                                  ,


-- ** atomicIntAdd #method:atomicIntAdd#

    atomicIntAdd                            ,


-- ** atomicIntAnd #method:atomicIntAnd#

    atomicIntAnd                            ,


-- ** atomicIntCompareAndExchange #method:atomicIntCompareAndExchange#

    atomicIntCompareAndExchange             ,


-- ** atomicIntDecAndTest #method:atomicIntDecAndTest#

    atomicIntDecAndTest                     ,


-- ** atomicIntExchangeAndAdd #method:atomicIntExchangeAndAdd#

    atomicIntExchangeAndAdd                 ,


-- ** atomicIntGet #method:atomicIntGet#

    atomicIntGet                            ,


-- ** atomicIntInc #method:atomicIntInc#

    atomicIntInc                            ,


-- ** atomicIntOr #method:atomicIntOr#

    atomicIntOr                             ,


-- ** atomicIntSet #method:atomicIntSet#

    atomicIntSet                            ,


-- ** atomicIntXor #method:atomicIntXor#

    atomicIntXor                            ,


-- ** atomicPointerAdd #method:atomicPointerAdd#

    atomicPointerAdd                        ,


-- ** atomicPointerAnd #method:atomicPointerAnd#

    atomicPointerAnd                        ,


-- ** atomicPointerCompareAndExchange #method:atomicPointerCompareAndExchange#

    atomicPointerCompareAndExchange         ,


-- ** atomicPointerGet #method:atomicPointerGet#

    atomicPointerGet                        ,


-- ** atomicPointerOr #method:atomicPointerOr#

    atomicPointerOr                         ,


-- ** atomicPointerSet #method:atomicPointerSet#

    atomicPointerSet                        ,


-- ** atomicPointerXor #method:atomicPointerXor#

    atomicPointerXor                        ,


-- ** atomicRcBoxAcquire #method:atomicRcBoxAcquire#

    atomicRcBoxAcquire                      ,


-- ** atomicRcBoxAlloc #method:atomicRcBoxAlloc#

    atomicRcBoxAlloc                        ,


-- ** atomicRcBoxAlloc0 #method:atomicRcBoxAlloc0#

    atomicRcBoxAlloc0                       ,


-- ** atomicRcBoxDup #method:atomicRcBoxDup#

    atomicRcBoxDup                          ,


-- ** atomicRcBoxGetSize #method:atomicRcBoxGetSize#

    atomicRcBoxGetSize                      ,


-- ** atomicRcBoxRelease #method:atomicRcBoxRelease#

    atomicRcBoxRelease                      ,


-- ** atomicRcBoxReleaseFull #method:atomicRcBoxReleaseFull#

    atomicRcBoxReleaseFull                  ,


-- ** atomicRefCountCompare #method:atomicRefCountCompare#

    atomicRefCountCompare                   ,


-- ** atomicRefCountDec #method:atomicRefCountDec#

    atomicRefCountDec                       ,


-- ** atomicRefCountInc #method:atomicRefCountInc#

    atomicRefCountInc                       ,


-- ** atomicRefCountInit #method:atomicRefCountInit#

    atomicRefCountInit                      ,


-- ** base64Decode #method:base64Decode#

    base64Decode                            ,


-- ** base64DecodeInplace #method:base64DecodeInplace#

    base64DecodeInplace                     ,


-- ** base64Encode #method:base64Encode#

    base64Encode                            ,


-- ** basename #method:basename#

    basename                                ,


-- ** bitLock #method:bitLock#

    bitLock                                 ,


-- ** bitNthLsf #method:bitNthLsf#

    bitNthLsf                               ,


-- ** bitNthMsf #method:bitNthMsf#

    bitNthMsf                               ,


-- ** bitStorage #method:bitStorage#

    bitStorage                              ,


-- ** bitTrylock #method:bitTrylock#

    bitTrylock                              ,


-- ** bitUnlock #method:bitUnlock#

    bitUnlock                               ,


-- ** buildFilenamev #method:buildFilenamev#

    buildFilenamev                          ,


-- ** buildPathv #method:buildPathv#

    buildPathv                              ,


-- ** canonicalizeFilename #method:canonicalizeFilename#

    canonicalizeFilename                    ,


-- ** chdir #method:chdir#

    chdir                                   ,


-- ** checkVersion #method:checkVersion#

    checkVersion                            ,


-- ** childWatchAdd #method:childWatchAdd#

    childWatchAdd                           ,


-- ** childWatchSourceNew #method:childWatchSourceNew#

    childWatchSourceNew                     ,


-- ** clearError #method:clearError#

    clearError                              ,


-- ** close #method:close#

    close                                   ,


-- ** computeChecksumForBytes #method:computeChecksumForBytes#

    computeChecksumForBytes                 ,


-- ** computeChecksumForData #method:computeChecksumForData#

    computeChecksumForData                  ,


-- ** computeChecksumForString #method:computeChecksumForString#

    computeChecksumForString                ,


-- ** computeHmacForBytes #method:computeHmacForBytes#

    computeHmacForBytes                     ,


-- ** computeHmacForData #method:computeHmacForData#

    computeHmacForData                      ,


-- ** computeHmacForString #method:computeHmacForString#

    computeHmacForString                    ,


-- ** convert #method:convert#

    convert                                 ,


-- ** convertErrorQuark #method:convertErrorQuark#

    convertErrorQuark                       ,


-- ** convertWithFallback #method:convertWithFallback#

    convertWithFallback                     ,


-- ** datalistForeach #method:datalistForeach#

    datalistForeach                         ,


-- ** datalistGetData #method:datalistGetData#

    datalistGetData                         ,


-- ** datalistGetFlags #method:datalistGetFlags#

    datalistGetFlags                        ,


-- ** datalistIdGetData #method:datalistIdGetData#

    datalistIdGetData                       ,


-- ** datalistSetFlags #method:datalistSetFlags#

    datalistSetFlags                        ,


-- ** datalistUnsetFlags #method:datalistUnsetFlags#

    datalistUnsetFlags                      ,


-- ** datasetDestroy #method:datasetDestroy#

    datasetDestroy                          ,


-- ** datasetForeach #method:datasetForeach#

    datasetForeach                          ,


-- ** datasetIdGetData #method:datasetIdGetData#

    datasetIdGetData                        ,


-- ** dcgettext #method:dcgettext#

    dcgettext                               ,


-- ** dgettext #method:dgettext#

    dgettext                                ,


-- ** directEqual #method:directEqual#

    directEqual                             ,


-- ** directHash #method:directHash#

    directHash                              ,


-- ** dngettext #method:dngettext#

    dngettext                               ,


-- ** doubleEqual #method:doubleEqual#

    doubleEqual                             ,


-- ** doubleHash #method:doubleHash#

    doubleHash                              ,


-- ** dpgettext #method:dpgettext#

    dpgettext                               ,


-- ** dpgettext2 #method:dpgettext2#

    dpgettext2                              ,


-- ** environGetenv #method:environGetenv#

    environGetenv                           ,


-- ** environSetenv #method:environSetenv#

    environSetenv                           ,


-- ** environUnsetenv #method:environUnsetenv#

    environUnsetenv                         ,


-- ** fileErrorFromErrno #method:fileErrorFromErrno#

    fileErrorFromErrno                      ,


-- ** fileErrorQuark #method:fileErrorQuark#

    fileErrorQuark                          ,


-- ** fileGetContents #method:fileGetContents#

    fileGetContents                         ,


-- ** fileOpenTmp #method:fileOpenTmp#

    fileOpenTmp                             ,


-- ** fileReadLink #method:fileReadLink#

    fileReadLink                            ,


-- ** fileSetContents #method:fileSetContents#

    fileSetContents                         ,


-- ** fileTest #method:fileTest#

    fileTest                                ,


-- ** filenameDisplayBasename #method:filenameDisplayBasename#

    filenameDisplayBasename                 ,


-- ** filenameDisplayName #method:filenameDisplayName#

    filenameDisplayName                     ,


-- ** filenameFromUri #method:filenameFromUri#

    filenameFromUri                         ,


-- ** filenameFromUtf8 #method:filenameFromUtf8#

    filenameFromUtf8                        ,


-- ** filenameToUri #method:filenameToUri#

    filenameToUri                           ,


-- ** filenameToUtf8 #method:filenameToUtf8#

    filenameToUtf8                          ,


-- ** findProgramInPath #method:findProgramInPath#

    findProgramInPath                       ,


-- ** formatSize #method:formatSize#

    formatSize                              ,


-- ** formatSizeForDisplay #method:formatSizeForDisplay#

    formatSizeForDisplay                    ,


-- ** formatSizeFull #method:formatSizeFull#

    formatSizeFull                          ,


-- ** free #method:free#

    free                                    ,


-- ** getApplicationName #method:getApplicationName#

    getApplicationName                      ,


-- ** getCharset #method:getCharset#

    getCharset                              ,


-- ** getCodeset #method:getCodeset#

    getCodeset                              ,


-- ** getCurrentDir #method:getCurrentDir#

    getCurrentDir                           ,


-- ** getCurrentTime #method:getCurrentTime#

    getCurrentTime                          ,


-- ** getEnviron #method:getEnviron#

    getEnviron                              ,


-- ** getFilenameCharsets #method:getFilenameCharsets#

    getFilenameCharsets                     ,


-- ** getHomeDir #method:getHomeDir#

    getHomeDir                              ,


-- ** getHostName #method:getHostName#

    getHostName                             ,


-- ** getLanguageNames #method:getLanguageNames#

    getLanguageNames                        ,


-- ** getLanguageNamesWithCategory #method:getLanguageNamesWithCategory#

    getLanguageNamesWithCategory            ,


-- ** getLocaleVariants #method:getLocaleVariants#

    getLocaleVariants                       ,


-- ** getMonotonicTime #method:getMonotonicTime#

    getMonotonicTime                        ,


-- ** getNumProcessors #method:getNumProcessors#

    getNumProcessors                        ,


-- ** getPrgname #method:getPrgname#

    getPrgname                              ,


-- ** getRealName #method:getRealName#

    getRealName                             ,


-- ** getRealTime #method:getRealTime#

    getRealTime                             ,


-- ** getSystemConfigDirs #method:getSystemConfigDirs#

    getSystemConfigDirs                     ,


-- ** getSystemDataDirs #method:getSystemDataDirs#

    getSystemDataDirs                       ,


-- ** getTmpDir #method:getTmpDir#

    getTmpDir                               ,


-- ** getUserCacheDir #method:getUserCacheDir#

    getUserCacheDir                         ,


-- ** getUserConfigDir #method:getUserConfigDir#

    getUserConfigDir                        ,


-- ** getUserDataDir #method:getUserDataDir#

    getUserDataDir                          ,


-- ** getUserName #method:getUserName#

    getUserName                             ,


-- ** getUserRuntimeDir #method:getUserRuntimeDir#

    getUserRuntimeDir                       ,


-- ** getUserSpecialDir #method:getUserSpecialDir#

    getUserSpecialDir                       ,


-- ** getenv #method:getenv#

    getenv                                  ,


-- ** hostnameIsAsciiEncoded #method:hostnameIsAsciiEncoded#

    hostnameIsAsciiEncoded                  ,


-- ** hostnameIsIpAddress #method:hostnameIsIpAddress#

    hostnameIsIpAddress                     ,


-- ** hostnameIsNonAscii #method:hostnameIsNonAscii#

    hostnameIsNonAscii                      ,


-- ** hostnameToAscii #method:hostnameToAscii#

    hostnameToAscii                         ,


-- ** hostnameToUnicode #method:hostnameToUnicode#

    hostnameToUnicode                       ,


-- ** idleAdd #method:idleAdd#

    idleAdd                                 ,


-- ** idleRemoveByData #method:idleRemoveByData#

    idleRemoveByData                        ,


-- ** idleSourceNew #method:idleSourceNew#

    idleSourceNew                           ,


-- ** int64Equal #method:int64Equal#

    int64Equal                              ,


-- ** int64Hash #method:int64Hash#

    int64Hash                               ,


-- ** intEqual #method:intEqual#

    intEqual                                ,


-- ** intHash #method:intHash#

    intHash                                 ,


-- ** internStaticString #method:internStaticString#

    internStaticString                      ,


-- ** internString #method:internString#

    internString                            ,


-- ** ioAddWatch #method:ioAddWatch#

    ioAddWatch                              ,


-- ** ioCreateWatch #method:ioCreateWatch#

    ioCreateWatch                           ,


-- ** listenv #method:listenv#

    listenv                                 ,


-- ** localeFromUtf8 #method:localeFromUtf8#

    localeFromUtf8                          ,


-- ** localeToUtf8 #method:localeToUtf8#

    localeToUtf8                            ,


-- ** logDefaultHandler #method:logDefaultHandler#

    logDefaultHandler                       ,


-- ** logRemoveHandler #method:logRemoveHandler#

    logRemoveHandler                        ,


-- ** logSetAlwaysFatal #method:logSetAlwaysFatal#

    logSetAlwaysFatal                       ,


-- ** logSetFatalMask #method:logSetFatalMask#

    logSetFatalMask                         ,


-- ** logSetHandler #method:logSetHandler#

    logSetHandler                           ,


-- ** logStructuredArray #method:logStructuredArray#

    logStructuredArray                      ,


-- ** logVariant #method:logVariant#

    logVariant                              ,


-- ** logWriterDefault #method:logWriterDefault#

    logWriterDefault                        ,


-- ** logWriterFormatFields #method:logWriterFormatFields#

    logWriterFormatFields                   ,


-- ** logWriterIsJournald #method:logWriterIsJournald#

    logWriterIsJournald                     ,


-- ** logWriterJournald #method:logWriterJournald#

    logWriterJournald                       ,


-- ** logWriterStandardStreams #method:logWriterStandardStreams#

    logWriterStandardStreams                ,


-- ** logWriterSupportsColor #method:logWriterSupportsColor#

    logWriterSupportsColor                  ,


-- ** mainCurrentSource #method:mainCurrentSource#

    mainCurrentSource                       ,


-- ** mainDepth #method:mainDepth#

    mainDepth                               ,


-- ** malloc #method:malloc#

    malloc                                  ,


-- ** malloc0 #method:malloc0#

    malloc0                                 ,


-- ** malloc0N #method:malloc0N#

    malloc0N                                ,


-- ** mallocN #method:mallocN#

    mallocN                                 ,


-- ** markupErrorQuark #method:markupErrorQuark#

    markupErrorQuark                        ,


-- ** markupEscapeText #method:markupEscapeText#

    markupEscapeText                        ,


-- ** memIsSystemMalloc #method:memIsSystemMalloc#

    memIsSystemMalloc                       ,


-- ** memProfile #method:memProfile#

    memProfile                              ,


-- ** memSetVtable #method:memSetVtable#

    memSetVtable                            ,


-- ** memdup #method:memdup#

    memdup                                  ,


-- ** mkdirWithParents #method:mkdirWithParents#

    mkdirWithParents                        ,


-- ** nullifyPointer #method:nullifyPointer#

    nullifyPointer                          ,


-- ** numberParserErrorQuark #method:numberParserErrorQuark#

    numberParserErrorQuark                  ,


-- ** onErrorQuery #method:onErrorQuery#

    onErrorQuery                            ,


-- ** onErrorStackTrace #method:onErrorStackTrace#

    onErrorStackTrace                       ,


-- ** optionErrorQuark #method:optionErrorQuark#

    optionErrorQuark                        ,


-- ** parseDebugString #method:parseDebugString#

    parseDebugString                        ,


-- ** pathGetBasename #method:pathGetBasename#

    pathGetBasename                         ,


-- ** pathGetDirname #method:pathGetDirname#

    pathGetDirname                          ,


-- ** pathIsAbsolute #method:pathIsAbsolute#

    pathIsAbsolute                          ,


-- ** pathSkipRoot #method:pathSkipRoot#

    pathSkipRoot                            ,


-- ** patternMatch #method:patternMatch#

    patternMatch                            ,


-- ** patternMatchSimple #method:patternMatchSimple#

    patternMatchSimple                      ,


-- ** patternMatchString #method:patternMatchString#

    patternMatchString                      ,


-- ** pointerBitLock #method:pointerBitLock#

    pointerBitLock                          ,


-- ** pointerBitTrylock #method:pointerBitTrylock#

    pointerBitTrylock                       ,


-- ** pointerBitUnlock #method:pointerBitUnlock#

    pointerBitUnlock                        ,


-- ** poll #method:poll#

    poll                                    ,


-- ** propagateError #method:propagateError#

    propagateError                          ,


-- ** quarkFromStaticString #method:quarkFromStaticString#

    quarkFromStaticString                   ,


-- ** quarkFromString #method:quarkFromString#

    quarkFromString                         ,


-- ** quarkToString #method:quarkToString#

    quarkToString                           ,


-- ** quarkTryString #method:quarkTryString#

    quarkTryString                          ,


-- ** randomDouble #method:randomDouble#

    randomDouble                            ,


-- ** randomDoubleRange #method:randomDoubleRange#

    randomDoubleRange                       ,


-- ** randomInt #method:randomInt#

    randomInt                               ,


-- ** randomIntRange #method:randomIntRange#

    randomIntRange                          ,


-- ** randomSetSeed #method:randomSetSeed#

    randomSetSeed                           ,


-- ** rcBoxAcquire #method:rcBoxAcquire#

    rcBoxAcquire                            ,


-- ** rcBoxAlloc #method:rcBoxAlloc#

    rcBoxAlloc                              ,


-- ** rcBoxAlloc0 #method:rcBoxAlloc0#

    rcBoxAlloc0                             ,


-- ** rcBoxDup #method:rcBoxDup#

    rcBoxDup                                ,


-- ** rcBoxGetSize #method:rcBoxGetSize#

    rcBoxGetSize                            ,


-- ** rcBoxRelease #method:rcBoxRelease#

    rcBoxRelease                            ,


-- ** rcBoxReleaseFull #method:rcBoxReleaseFull#

    rcBoxReleaseFull                        ,


-- ** realloc #method:realloc#

    realloc                                 ,


-- ** reallocN #method:reallocN#

    reallocN                                ,


-- ** refCountCompare #method:refCountCompare#

    refCountCompare                         ,


-- ** refCountDec #method:refCountDec#

    refCountDec                             ,


-- ** refCountInc #method:refCountInc#

    refCountInc                             ,


-- ** refCountInit #method:refCountInit#

    refCountInit                            ,


-- ** refStringAcquire #method:refStringAcquire#

    refStringAcquire                        ,


-- ** refStringLength #method:refStringLength#

    refStringLength                         ,


-- ** refStringNew #method:refStringNew#

    refStringNew                            ,


-- ** refStringNewIntern #method:refStringNewIntern#

    refStringNewIntern                      ,


-- ** refStringNewLen #method:refStringNewLen#

    refStringNewLen                         ,


-- ** refStringRelease #method:refStringRelease#

    refStringRelease                        ,


-- ** reloadUserSpecialDirsCache #method:reloadUserSpecialDirsCache#

    reloadUserSpecialDirsCache              ,


-- ** rmdir #method:rmdir#

    rmdir                                   ,


-- ** setApplicationName #method:setApplicationName#

    setApplicationName                      ,


-- ** setErrorLiteral #method:setErrorLiteral#

    setErrorLiteral                         ,


-- ** setPrgname #method:setPrgname#

    setPrgname                              ,


-- ** setenv #method:setenv#

    setenv                                  ,


-- ** shellErrorQuark #method:shellErrorQuark#

    shellErrorQuark                         ,


-- ** shellParseArgv #method:shellParseArgv#

    shellParseArgv                          ,


-- ** shellQuote #method:shellQuote#

    shellQuote                              ,


-- ** shellUnquote #method:shellUnquote#

    shellUnquote                            ,


-- ** sliceAlloc #method:sliceAlloc#

    sliceAlloc                              ,


-- ** sliceAlloc0 #method:sliceAlloc0#

    sliceAlloc0                             ,


-- ** sliceCopy #method:sliceCopy#

    sliceCopy                               ,


-- ** sliceFree1 #method:sliceFree1#

    sliceFree1                              ,


-- ** sliceFreeChainWithOffset #method:sliceFreeChainWithOffset#

    sliceFreeChainWithOffset                ,


-- ** sliceGetConfig #method:sliceGetConfig#

    sliceGetConfig                          ,


-- ** sliceGetConfigState #method:sliceGetConfigState#

    sliceGetConfigState                     ,


-- ** sliceSetConfig #method:sliceSetConfig#

    sliceSetConfig                          ,


-- ** spacedPrimesClosest #method:spacedPrimesClosest#

    spacedPrimesClosest                     ,


-- ** spawnAsync #method:spawnAsync#

    spawnAsync                              ,


-- ** spawnAsyncWithFds #method:spawnAsyncWithFds#

    spawnAsyncWithFds                       ,


-- ** spawnAsyncWithPipes #method:spawnAsyncWithPipes#

    spawnAsyncWithPipes                     ,


-- ** spawnCheckExitStatus #method:spawnCheckExitStatus#

    spawnCheckExitStatus                    ,


-- ** spawnClosePid #method:spawnClosePid#

    spawnClosePid                           ,


-- ** spawnCommandLineAsync #method:spawnCommandLineAsync#

    spawnCommandLineAsync                   ,


-- ** spawnCommandLineSync #method:spawnCommandLineSync#

    spawnCommandLineSync                    ,


-- ** spawnErrorQuark #method:spawnErrorQuark#

    spawnErrorQuark                         ,


-- ** spawnExitErrorQuark #method:spawnExitErrorQuark#

    spawnExitErrorQuark                     ,


-- ** spawnSync #method:spawnSync#

    spawnSync                               ,


-- ** stpcpy #method:stpcpy#

    stpcpy                                  ,


-- ** strEqual #method:strEqual#

    strEqual                                ,


-- ** strHasPrefix #method:strHasPrefix#

    strHasPrefix                            ,


-- ** strHasSuffix #method:strHasSuffix#

    strHasSuffix                            ,


-- ** strHash #method:strHash#

    strHash                                 ,


-- ** strIsAscii #method:strIsAscii#

    strIsAscii                              ,


-- ** strMatchString #method:strMatchString#

    strMatchString                          ,


-- ** strToAscii #method:strToAscii#

    strToAscii                              ,


-- ** strTokenizeAndFold #method:strTokenizeAndFold#

    strTokenizeAndFold                      ,


-- ** strcanon #method:strcanon#

    strcanon                                ,


-- ** strcasecmp #method:strcasecmp#

    strcasecmp                              ,


-- ** strchomp #method:strchomp#

    strchomp                                ,


-- ** strchug #method:strchug#

    strchug                                 ,


-- ** strcmp0 #method:strcmp0#

    strcmp0                                 ,


-- ** strcompress #method:strcompress#

    strcompress                             ,


-- ** strdelimit #method:strdelimit#

    strdelimit                              ,


-- ** strdown #method:strdown#

    strdown                                 ,


-- ** strdup #method:strdup#

    strdup                                  ,


-- ** strerror #method:strerror#

    strerror                                ,


-- ** strescape #method:strescape#

    strescape                               ,


-- ** strfreev #method:strfreev#

    strfreev                                ,


-- ** stringNew #method:stringNew#

    stringNew                               ,


-- ** stringNewLen #method:stringNewLen#

    stringNewLen                            ,


-- ** stringSizedNew #method:stringSizedNew#

    stringSizedNew                          ,


-- ** stripContext #method:stripContext#

    stripContext                            ,


-- ** strjoinv #method:strjoinv#

    strjoinv                                ,


-- ** strlcat #method:strlcat#

    strlcat                                 ,


-- ** strlcpy #method:strlcpy#

    strlcpy                                 ,


-- ** strncasecmp #method:strncasecmp#

    strncasecmp                             ,


-- ** strndup #method:strndup#

    strndup                                 ,


-- ** strnfill #method:strnfill#

    strnfill                                ,


-- ** strreverse #method:strreverse#

    strreverse                              ,


-- ** strrstr #method:strrstr#

    strrstr                                 ,


-- ** strrstrLen #method:strrstrLen#

    strrstrLen                              ,


-- ** strsignal #method:strsignal#

    strsignal                               ,


-- ** strstrLen #method:strstrLen#

    strstrLen                               ,


-- ** strtod #method:strtod#

    strtod                                  ,


-- ** strup #method:strup#

    strup                                   ,


-- ** strvContains #method:strvContains#

    strvContains                            ,


-- ** strvEqual #method:strvEqual#

    strvEqual                               ,


-- ** strvGetType #method:strvGetType#

    strvGetType                             ,


-- ** strvLength #method:strvLength#

    strvLength                              ,


-- ** testAddDataFunc #method:testAddDataFunc#

    testAddDataFunc                         ,


-- ** testAddFunc #method:testAddFunc#

    testAddFunc                             ,


-- ** testAssertExpectedMessagesInternal #method:testAssertExpectedMessagesInternal#

    testAssertExpectedMessagesInternal      ,


-- ** testBug #method:testBug#

    testBug                                 ,


-- ** testBugBase #method:testBugBase#

    testBugBase                             ,


-- ** testExpectMessage #method:testExpectMessage#

    testExpectMessage                       ,


-- ** testFail #method:testFail#

    testFail                                ,


-- ** testFailed #method:testFailed#

    testFailed                              ,


-- ** testGetDir #method:testGetDir#

    testGetDir                              ,


-- ** testIncomplete #method:testIncomplete#

    testIncomplete                          ,


-- ** testLogTypeName #method:testLogTypeName#

    testLogTypeName                         ,


-- ** testQueueDestroy #method:testQueueDestroy#

    testQueueDestroy                        ,


-- ** testQueueFree #method:testQueueFree#

    testQueueFree                           ,


-- ** testRandDouble #method:testRandDouble#

    testRandDouble                          ,


-- ** testRandDoubleRange #method:testRandDoubleRange#

    testRandDoubleRange                     ,


-- ** testRandInt #method:testRandInt#

    testRandInt                             ,


-- ** testRandIntRange #method:testRandIntRange#

    testRandIntRange                        ,


-- ** testRun #method:testRun#

    testRun                                 ,


-- ** testRunSuite #method:testRunSuite#

    testRunSuite                            ,


-- ** testSetNonfatalAssertions #method:testSetNonfatalAssertions#

    testSetNonfatalAssertions               ,


-- ** testSkip #method:testSkip#

    testSkip                                ,


-- ** testSubprocess #method:testSubprocess#

    testSubprocess                          ,


-- ** testTimerElapsed #method:testTimerElapsed#

    testTimerElapsed                        ,


-- ** testTimerLast #method:testTimerLast#

    testTimerLast                           ,


-- ** testTimerStart #method:testTimerStart#

    testTimerStart                          ,


-- ** testTrapAssertions #method:testTrapAssertions#

    testTrapAssertions                      ,


-- ** testTrapFork #method:testTrapFork#

    testTrapFork                            ,


-- ** testTrapHasPassed #method:testTrapHasPassed#

    testTrapHasPassed                       ,


-- ** testTrapReachedTimeout #method:testTrapReachedTimeout#

    testTrapReachedTimeout                  ,


-- ** testTrapSubprocess #method:testTrapSubprocess#

    testTrapSubprocess                      ,


-- ** timeoutAdd #method:timeoutAdd#

    timeoutAdd                              ,


-- ** timeoutAddSeconds #method:timeoutAddSeconds#

    timeoutAddSeconds                       ,


-- ** timeoutSourceNew #method:timeoutSourceNew#

    timeoutSourceNew                        ,


-- ** timeoutSourceNewSeconds #method:timeoutSourceNewSeconds#

    timeoutSourceNewSeconds                 ,


-- ** tryMalloc #method:tryMalloc#

    tryMalloc                               ,


-- ** tryMalloc0 #method:tryMalloc0#

    tryMalloc0                              ,


-- ** tryMalloc0N #method:tryMalloc0N#

    tryMalloc0N                             ,


-- ** tryMallocN #method:tryMallocN#

    tryMallocN                              ,


-- ** tryRealloc #method:tryRealloc#

    tryRealloc                              ,


-- ** tryReallocN #method:tryReallocN#

    tryReallocN                             ,


-- ** unicharBreakType #method:unicharBreakType#

    unicharBreakType                        ,


-- ** unicharCombiningClass #method:unicharCombiningClass#

    unicharCombiningClass                   ,


-- ** unicharCompose #method:unicharCompose#

    unicharCompose                          ,


-- ** unicharDecompose #method:unicharDecompose#

    unicharDecompose                        ,


-- ** unicharDigitValue #method:unicharDigitValue#

    unicharDigitValue                       ,


-- ** unicharGetMirrorChar #method:unicharGetMirrorChar#

    unicharGetMirrorChar                    ,


-- ** unicharGetScript #method:unicharGetScript#

    unicharGetScript                        ,


-- ** unicharIsalnum #method:unicharIsalnum#

    unicharIsalnum                          ,


-- ** unicharIsalpha #method:unicharIsalpha#

    unicharIsalpha                          ,


-- ** unicharIscntrl #method:unicharIscntrl#

    unicharIscntrl                          ,


-- ** unicharIsdefined #method:unicharIsdefined#

    unicharIsdefined                        ,


-- ** unicharIsdigit #method:unicharIsdigit#

    unicharIsdigit                          ,


-- ** unicharIsgraph #method:unicharIsgraph#

    unicharIsgraph                          ,


-- ** unicharIslower #method:unicharIslower#

    unicharIslower                          ,


-- ** unicharIsmark #method:unicharIsmark#

    unicharIsmark                           ,


-- ** unicharIsprint #method:unicharIsprint#

    unicharIsprint                          ,


-- ** unicharIspunct #method:unicharIspunct#

    unicharIspunct                          ,


-- ** unicharIsspace #method:unicharIsspace#

    unicharIsspace                          ,


-- ** unicharIstitle #method:unicharIstitle#

    unicharIstitle                          ,


-- ** unicharIsupper #method:unicharIsupper#

    unicharIsupper                          ,


-- ** unicharIswide #method:unicharIswide#

    unicharIswide                           ,


-- ** unicharIswideCjk #method:unicharIswideCjk#

    unicharIswideCjk                        ,


-- ** unicharIsxdigit #method:unicharIsxdigit#

    unicharIsxdigit                         ,


-- ** unicharIszerowidth #method:unicharIszerowidth#

    unicharIszerowidth                      ,


-- ** unicharTolower #method:unicharTolower#

    unicharTolower                          ,


-- ** unicharTotitle #method:unicharTotitle#

    unicharTotitle                          ,


-- ** unicharToupper #method:unicharToupper#

    unicharToupper                          ,


-- ** unicharType #method:unicharType#

    unicharType                             ,


-- ** unicharValidate #method:unicharValidate#

    unicharValidate                         ,


-- ** unicharXdigitValue #method:unicharXdigitValue#

    unicharXdigitValue                      ,


-- ** unicodeCanonicalDecomposition #method:unicodeCanonicalDecomposition#

    unicodeCanonicalDecomposition           ,


-- ** unicodeCanonicalOrdering #method:unicodeCanonicalOrdering#

    unicodeCanonicalOrdering                ,


-- ** unicodeScriptFromIso15924 #method:unicodeScriptFromIso15924#

    unicodeScriptFromIso15924               ,


-- ** unicodeScriptToIso15924 #method:unicodeScriptToIso15924#

    unicodeScriptToIso15924                 ,


-- ** unixErrorQuark #method:unixErrorQuark#

    unixErrorQuark                          ,


-- ** unixFdAddFull #method:unixFdAddFull#

    unixFdAddFull                           ,


-- ** unixFdSourceNew #method:unixFdSourceNew#

    unixFdSourceNew                         ,


-- ** unixOpenPipe #method:unixOpenPipe#

    unixOpenPipe                            ,


-- ** unixSetFdNonblocking #method:unixSetFdNonblocking#

    unixSetFdNonblocking                    ,


-- ** unixSignalAdd #method:unixSignalAdd#

    unixSignalAdd                           ,


-- ** unixSignalSourceNew #method:unixSignalSourceNew#

    unixSignalSourceNew                     ,


-- ** unlink #method:unlink#

    unlink                                  ,


-- ** unsetenv #method:unsetenv#

    unsetenv                                ,


-- ** uriEscapeString #method:uriEscapeString#

    uriEscapeString                         ,


-- ** uriListExtractUris #method:uriListExtractUris#

    uriListExtractUris                      ,


-- ** uriParseScheme #method:uriParseScheme#

    uriParseScheme                          ,


-- ** uriUnescapeSegment #method:uriUnescapeSegment#

    uriUnescapeSegment                      ,


-- ** uriUnescapeString #method:uriUnescapeString#

    uriUnescapeString                       ,


-- ** usleep #method:usleep#

    usleep                                  ,


-- ** utf8Casefold #method:utf8Casefold#

    utf8Casefold                            ,


-- ** utf8Collate #method:utf8Collate#

    utf8Collate                             ,


-- ** utf8CollateKey #method:utf8CollateKey#

    utf8CollateKey                          ,


-- ** utf8CollateKeyForFilename #method:utf8CollateKeyForFilename#

    utf8CollateKeyForFilename               ,


-- ** utf8FindNextChar #method:utf8FindNextChar#

    utf8FindNextChar                        ,


-- ** utf8FindPrevChar #method:utf8FindPrevChar#

    utf8FindPrevChar                        ,


-- ** utf8GetChar #method:utf8GetChar#

    utf8GetChar                             ,


-- ** utf8GetCharValidated #method:utf8GetCharValidated#

    utf8GetCharValidated                    ,


-- ** utf8MakeValid #method:utf8MakeValid#

    utf8MakeValid                           ,


-- ** utf8Normalize #method:utf8Normalize#

    utf8Normalize                           ,


-- ** utf8OffsetToPointer #method:utf8OffsetToPointer#

    utf8OffsetToPointer                     ,


-- ** utf8PointerToOffset #method:utf8PointerToOffset#

    utf8PointerToOffset                     ,


-- ** utf8PrevChar #method:utf8PrevChar#

    utf8PrevChar                            ,


-- ** utf8Strchr #method:utf8Strchr#

    utf8Strchr                              ,


-- ** utf8Strdown #method:utf8Strdown#

    utf8Strdown                             ,


-- ** utf8Strlen #method:utf8Strlen#

    utf8Strlen                              ,


-- ** utf8Strncpy #method:utf8Strncpy#

    utf8Strncpy                             ,


-- ** utf8Strrchr #method:utf8Strrchr#

    utf8Strrchr                             ,


-- ** utf8Strreverse #method:utf8Strreverse#

    utf8Strreverse                          ,


-- ** utf8Strup #method:utf8Strup#

    utf8Strup                               ,


-- ** utf8Substring #method:utf8Substring#

    utf8Substring                           ,


-- ** utf8Validate #method:utf8Validate#

    utf8Validate                            ,


-- ** utf8ValidateLen #method:utf8ValidateLen#

    utf8ValidateLen                         ,


-- ** uuidStringIsValid #method:uuidStringIsValid#

    uuidStringIsValid                       ,


-- ** uuidStringRandom #method:uuidStringRandom#

    uuidStringRandom                        ,


-- ** variantGetGtype #method:variantGetGtype#

    variantGetGtype                         ,




    ) 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.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.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.Callbacks as GLib.Callbacks
import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
import {-# SOURCE #-} qualified GI.GLib.Flags as GLib.Flags
import {-# SOURCE #-} qualified GI.GLib.Structs.Bytes as GLib.Bytes
import {-# SOURCE #-} qualified GI.GLib.Structs.Data as GLib.Data
import {-# SOURCE #-} qualified GI.GLib.Structs.DebugKey as GLib.DebugKey
import {-# SOURCE #-} qualified GI.GLib.Structs.IOChannel as GLib.IOChannel
import {-# SOURCE #-} qualified GI.GLib.Structs.LogField as GLib.LogField
import {-# SOURCE #-} qualified GI.GLib.Structs.MemVTable as GLib.MemVTable
import {-# SOURCE #-} qualified GI.GLib.Structs.PatternSpec as GLib.PatternSpec
import {-# SOURCE #-} qualified GI.GLib.Structs.PollFD as GLib.PollFD
import {-# SOURCE #-} qualified GI.GLib.Structs.Source as GLib.Source
import {-# SOURCE #-} qualified GI.GLib.Structs.String as GLib.String
import {-# SOURCE #-} qualified GI.GLib.Structs.TestSuite as GLib.TestSuite
import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal

-- function g_variant_get_gtype
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_variant_get_gtype" g_variant_get_gtype ::
    IO CGType

{- |
/No description available in the introspection data./
-}
variantGetGtype ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
variantGetGtype  = liftIO $ do
    result <- g_variant_get_gtype
    let result' = GType result
    return result'


-- function g_uuid_string_random
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_uuid_string_random" g_uuid_string_random ::
    IO CString

{- |
Generates a random UUID (RFC 4122 version 4) as a string.

/Since: 2.52/
-}
uuidStringRandom ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    {- ^ __Returns:__ A string that should be freed with 'GI.GLib.Functions.free'. -}
uuidStringRandom  = liftIO $ do
    result <- g_uuid_string_random
    checkUnexpectedReturnNULL "uuidStringRandom" result
    result' <- cstringToText result
    freeMem result
    return result'


-- function g_uuid_string_is_valid
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string representing a UUID", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_uuid_string_is_valid" g_uuid_string_is_valid ::
    CString ->                              -- str : TBasicType TUTF8
    IO CInt

{- |
Parses the string /@str@/ and verify if it is a UUID.

The function accepts the following syntax:

* simple forms (e.g. @f81d4fae-7dec-11d0-a765-00a0c91e6bf6@)


Note that hyphens are required within the UUID string itself,
as per the aforementioned RFC.

/Since: 2.52/
-}
uuidStringIsValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a string representing a UUID -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@str@/ is a valid UUID, 'False' otherwise. -}
uuidStringIsValid str = liftIO $ do
    str' <- textToCString str
    result <- g_uuid_string_is_valid str'
    let result' = (/= 0) result
    freeMem str'
    return result'


-- function g_utf8_validate_len
-- Args : [Arg {argCName = "str", argType = TCArray False (-1) 1 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to character data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "max bytes to validate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of valid data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "max_len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "max bytes to validate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_validate_len" g_utf8_validate_len ::
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Word64 ->                               -- max_len : TBasicType TUInt64
    Ptr CString ->                          -- end : TBasicType TUTF8
    IO CInt

{- |
Validates UTF-8 encoded text.

As with 'GI.GLib.Functions.utf8Validate', but /@maxLen@/ must be set, and hence this function
will always return 'False' if any of the bytes of /@str@/ are nul.

/Since: 2.60/
-}
utf8ValidateLen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    {- ^ /@str@/: a pointer to character data -}
    -> m ((Bool, T.Text))
    {- ^ __Returns:__ 'True' if the text was valid UTF-8 -}
utf8ValidateLen str = liftIO $ do
    let maxLen = fromIntegral $ B.length str
    str' <- packByteString str
    end <- allocMem :: IO (Ptr CString)
    result <- g_utf8_validate_len str' maxLen end
    let result' = (/= 0) result
    end' <- peek end
    end'' <- cstringToText end'
    freeMem str'
    freeMem end
    return (result', end'')


-- function g_utf8_validate
-- Args : [Arg {argCName = "str", argType = TCArray False (-1) 1 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to character data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "max bytes to validate, or -1 to go until NUL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for end of valid data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "max_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "max bytes to validate, or -1 to go until NUL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_validate" g_utf8_validate ::
    Ptr Word8 ->                            -- str : TCArray False (-1) 1 (TBasicType TUInt8)
    Int64 ->                                -- max_len : TBasicType TInt64
    Ptr CString ->                          -- end : TBasicType TUTF8
    IO CInt

{- |
Validates UTF-8 encoded text. /@str@/ is the text to validate;
if /@str@/ is nul-terminated, then /@maxLen@/ can be -1, otherwise
/@maxLen@/ should be the number of bytes to validate.
If /@end@/ is non-'Nothing', then the end of the valid range
will be stored there (i.e. the start of the first invalid
character if some bytes were invalid, or the end of the text
being validated otherwise).

Note that 'GI.GLib.Functions.utf8Validate' returns 'False' if /@maxLen@/ is
positive and any of the /@maxLen@/ bytes are nul.

Returns 'True' if all of /@str@/ was valid. Many GLib and GTK+
routines require valid UTF-8 as input; so data read from a file
or the network should be checked with 'GI.GLib.Functions.utf8Validate' before
doing anything else with it.
-}
utf8Validate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    {- ^ /@str@/: a pointer to character data -}
    -> m ((Bool, T.Text))
    {- ^ __Returns:__ 'True' if the text was valid UTF-8 -}
utf8Validate str = liftIO $ do
    let maxLen = fromIntegral $ B.length str
    str' <- packByteString str
    end <- allocMem :: IO (Ptr CString)
    result <- g_utf8_validate str' maxLen end
    let result' = (/= 0) result
    end' <- peek end
    end'' <- cstringToText end'
    freeMem str'
    freeMem end
    return (result', end'')


-- function g_utf8_substring
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_pos", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a character offset within @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end_pos", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another character offset within @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_substring" g_utf8_substring ::
    CString ->                              -- str : TBasicType TUTF8
    CLong ->                                -- start_pos : TBasicType TLong
    CLong ->                                -- end_pos : TBasicType TLong
    IO CString

{- |
Copies a substring out of a UTF-8 encoded string.
The substring will contain /@endPos@/ - /@startPos@/ characters.

/Since: 2.30/
-}
utf8Substring ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> CLong
    {- ^ /@startPos@/: a character offset within /@str@/ -}
    -> CLong
    {- ^ /@endPos@/: another character offset within /@str@/ -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated copy of the requested
    substring. Free with 'GI.GLib.Functions.free' when no longer needed. -}
utf8Substring str startPos endPos = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_substring str' startPos endPos
    checkUnexpectedReturnNULL "utf8Substring" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_strup
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strup" g_utf8_strup ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Converts all Unicode characters in the string that have a case
to uppercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string increasing. (For instance, the
German ess-zet will be changed to SS.)
-}
utf8Strup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string, with all characters
   converted to uppercase. -}
utf8Strup str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_strup str' len
    checkUnexpectedReturnNULL "utf8Strup" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_strreverse
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @str to use, in bytes. If @len < 0,\n    then the string is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strreverse" g_utf8_strreverse ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Reverses a UTF-8 string. /@str@/ must be valid UTF-8 encoded text.
(Use 'GI.GLib.Functions.utf8Validate' on all text before trying to use UTF-8
utility functions with it.)

This function is intended for programmatic uses of reversed strings.
It pays no attention to decomposed characters, combining marks, byte
order marks, directional indicators (LRM, LRO, etc) and similar
characters which might need special handling when reversing a string
for display purposes.

Note that unlike 'GI.GLib.Functions.strreverse', this function returns
newly-allocated memory, which should be freed with 'GI.GLib.Functions.free' when
no longer needed.

/Since: 2.2/
-}
utf8Strreverse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: the maximum length of /@str@/ to use, in bytes. If /@len@/ \< 0,
    then the string is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly-allocated string which is the reverse of /@str@/ -}
utf8Strreverse str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_strreverse str' len
    checkUnexpectedReturnNULL "utf8Strreverse" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_strrchr
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a nul-terminated UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @p", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strrchr" g_utf8_strrchr ::
    CString ->                              -- p : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    CInt ->                                 -- c : TBasicType TUniChar
    IO CString

{- |
Find the rightmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to /@len@/ bytes.
If /@len@/ is -1, allow unbounded search.
-}
utf8Strrchr ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a nul-terminated UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: the maximum length of /@p@/ -}
    -> Char
    {- ^ /@c@/: a Unicode character -}
    -> m T.Text
    {- ^ __Returns:__ 'Nothing' if the string does not contain the character,
    otherwise, a pointer to the start of the rightmost occurrence
    of the character in the string. -}
utf8Strrchr p len c = liftIO $ do
    p' <- textToCString p
    let c' = (fromIntegral . ord) c
    result <- g_utf8_strrchr p' len c'
    checkUnexpectedReturnNULL "utf8Strrchr" result
    result' <- cstringToText result
    freeMem result
    freeMem p'
    return result'


-- function g_utf8_strncpy
-- Args : [Arg {argCName = "dest", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "buffer to fill with characters from @src", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "character count", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strncpy" g_utf8_strncpy ::
    CString ->                              -- dest : TBasicType TUTF8
    CString ->                              -- src : TBasicType TUTF8
    Word64 ->                               -- n : TBasicType TUInt64
    IO CString

{- |
Like the standard C @/strncpy()/@ function, but copies a given number
of characters instead of a given number of bytes. The /@src@/ string
must be valid UTF-8 encoded text. (Use 'GI.GLib.Functions.utf8Validate' on all
text before trying to use UTF-8 utility functions with it.)

Note you must ensure /@dest@/ is at least 4 * /@n@/ to fit the
largest possible UTF-8 characters
-}
utf8Strncpy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@dest@/: buffer to fill with characters from /@src@/ -}
    -> T.Text
    {- ^ /@src@/: UTF-8 encoded string -}
    -> Word64
    {- ^ /@n@/: character count -}
    -> m T.Text
    {- ^ __Returns:__ /@dest@/ -}
utf8Strncpy dest src n = liftIO $ do
    dest' <- textToCString dest
    src' <- textToCString src
    result <- g_utf8_strncpy dest' src' n
    checkUnexpectedReturnNULL "utf8Strncpy" result
    result' <- cstringToText result
    freeMem result
    freeMem dest'
    freeMem src'
    return result'


-- function g_utf8_strlen
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the start of a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum number of bytes to examine. If @max\n      is less than 0, then the string is assumed to be\n      nul-terminated. If @max is 0, @p will not be examined and\n      may be %NULL. If @max is greater than 0, up to @max\n      bytes are examined", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TLong)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strlen" g_utf8_strlen ::
    CString ->                              -- p : TBasicType TUTF8
    Int64 ->                                -- max : TBasicType TInt64
    IO CLong

{- |
Computes the length of the string in characters, not including
the terminating nul character. If the /@max@/\'th byte falls in the
middle of a character, the last (partial) character is not counted.
-}
utf8Strlen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: pointer to the start of a UTF-8 encoded string -}
    -> Int64
    {- ^ /@max@/: the maximum number of bytes to examine. If /@max@/
      is less than 0, then the string is assumed to be
      nul-terminated. If /@max@/ is 0, /@p@/ will not be examined and
      may be 'Nothing'. If /@max@/ is greater than 0, up to /@max@/
      bytes are examined -}
    -> m CLong
    {- ^ __Returns:__ the length of the string in characters -}
utf8Strlen p max = liftIO $ do
    p' <- textToCString p
    result <- g_utf8_strlen p' max
    freeMem p'
    return result


-- function g_utf8_strdown
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strdown" g_utf8_strdown ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Converts all Unicode characters in the string that have a case
to lowercase. The exact manner that this is done depends
on the current locale, and may result in the number of
characters in the string changing.
-}
utf8Strdown ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string, with all characters
   converted to lowercase. -}
utf8Strdown str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_strdown str' len
    checkUnexpectedReturnNULL "utf8Strdown" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_strchr
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a nul-terminated UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @p", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_strchr" g_utf8_strchr ::
    CString ->                              -- p : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    CInt ->                                 -- c : TBasicType TUniChar
    IO CString

{- |
Finds the leftmost occurrence of the given Unicode character
in a UTF-8 encoded string, while limiting the search to /@len@/ bytes.
If /@len@/ is -1, allow unbounded search.
-}
utf8Strchr ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a nul-terminated UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: the maximum length of /@p@/ -}
    -> Char
    {- ^ /@c@/: a Unicode character -}
    -> m T.Text
    {- ^ __Returns:__ 'Nothing' if the string does not contain the character,
    otherwise, a pointer to the start of the leftmost occurrence
    of the character in the string. -}
utf8Strchr p len c = liftIO $ do
    p' <- textToCString p
    let c' = (fromIntegral . ord) c
    result <- g_utf8_strchr p' len c'
    checkUnexpectedReturnNULL "utf8Strchr" result
    result' <- cstringToText result
    freeMem result
    freeMem p'
    return result'


-- function g_utf8_prev_char
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a position within a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_prev_char" g_utf8_prev_char ::
    CString ->                              -- p : TBasicType TUTF8
    IO CString

{- |
Finds the previous UTF-8 character in the string before /@p@/.

/@p@/ does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte. If /@p@/ might be the first
character of the string, you must use 'GI.GLib.Functions.utf8FindPrevChar' instead.
-}
utf8PrevChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a pointer to a position within a UTF-8 encoded string -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to the found character -}
utf8PrevChar p = liftIO $ do
    p' <- textToCString p
    result <- g_utf8_prev_char p'
    checkUnexpectedReturnNULL "utf8PrevChar" result
    result' <- cstringToText result
    freeMem result
    freeMem p'
    return result'


-- function g_utf8_pointer_to_offset
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pos", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a position within @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TLong)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_pointer_to_offset" g_utf8_pointer_to_offset ::
    CString ->                              -- str : TBasicType TUTF8
    CString ->                              -- pos : TBasicType TUTF8
    IO CLong

{- |
Converts from a pointer to position within a string to a integer
character offset.

Since 2.10, this function allows /@pos@/ to be before /@str@/, and returns
a negative offset in this case.
-}
utf8PointerToOffset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> T.Text
    {- ^ /@pos@/: a pointer to a position within /@str@/ -}
    -> m CLong
    {- ^ __Returns:__ the resulting character offset -}
utf8PointerToOffset str pos = liftIO $ do
    str' <- textToCString str
    pos' <- textToCString pos
    result <- g_utf8_pointer_to_offset str' pos'
    freeMem str'
    freeMem pos'
    return result


-- function g_utf8_offset_to_pointer
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "offset", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a character offset within @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_offset_to_pointer" g_utf8_offset_to_pointer ::
    CString ->                              -- str : TBasicType TUTF8
    CLong ->                                -- offset : TBasicType TLong
    IO CString

{- |
Converts from an integer character offset to a pointer to a position
within the string.

Since 2.10, this function allows to pass a negative /@offset@/ to
step backwards. It is usually worth stepping backwards from the end
instead of forwards if /@offset@/ is in the last fourth of the string,
since moving forward is about 3 times faster than moving backward.

Note that this function doesn\'t abort when reaching the end of /@str@/.
Therefore you should be sure that /@offset@/ is within string boundaries
before calling that function. Call 'GI.GLib.Functions.utf8Strlen' when unsure.
This limitation exists as this function is called frequently during
text rendering and therefore has to be as fast as possible.
-}
utf8OffsetToPointer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> CLong
    {- ^ /@offset@/: a character offset within /@str@/ -}
    -> m T.Text
    {- ^ __Returns:__ the resulting pointer -}
utf8OffsetToPointer str offset = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_offset_to_pointer str' offset
    checkUnexpectedReturnNULL "utf8OffsetToPointer" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_normalize
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "GLib", name = "NormalizeMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of normalization to perform.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_normalize" g_utf8_normalize ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    CUInt ->                                -- mode : TInterface (Name {namespace = "GLib", name = "NormalizeMode"})
    IO CString

{- |
Converts a string into canonical form, standardizing
such issues as whether a character with an accent
is represented as a base character and combining
accent or as a single precomposed character. The
string has to be valid UTF-8, otherwise 'Nothing' is
returned. You should generally call 'GI.GLib.Functions.utf8Normalize'
before comparing two Unicode strings.

The normalization mode 'GI.GLib.Enums.NormalizeModeDefault' only
standardizes differences that do not affect the
text content, such as the above-mentioned accent
representation. 'GI.GLib.Enums.NormalizeModeAll' also standardizes
the \"compatibility\" characters in Unicode, such
as SUPERSCRIPT THREE to the standard forms
(in this case DIGIT THREE). Formatting information
may be lost but for most text operations such
characters should be considered the same.

'GI.GLib.Enums.NormalizeModeDefaultCompose' and 'GI.GLib.Enums.NormalizeModeAllCompose'
are like 'GI.GLib.Enums.NormalizeModeDefault' and 'GI.GLib.Enums.NormalizeModeAll',
but returned a result with composed forms rather
than a maximally decomposed form. This is often
useful if you intend to convert the string to
a legacy encoding or pass it to a system with
less capable Unicode handling.
-}
utf8Normalize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string. -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> GLib.Enums.NormalizeMode
    {- ^ /@mode@/: the type of normalization to perform. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string, that is the
  normalized form of /@str@/, or 'Nothing' if /@str@/ is not
  valid UTF-8. -}
utf8Normalize str len mode = liftIO $ do
    str' <- textToCString str
    let mode' = (fromIntegral . fromEnum) mode
    result <- g_utf8_normalize str' len mode'
    checkUnexpectedReturnNULL "utf8Normalize" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_make_valid
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "string to coerce into UTF-8", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @str to use, in bytes. If @len < 0,\n    then the string is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_make_valid" g_utf8_make_valid ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
If the provided string is valid UTF-8, return a copy of it. If not,
return a copy in which bytes that could not be interpreted as valid Unicode
are replaced with the Unicode replacement character (U+FFFD).

For example, this is an appropriate function to use if you have received
a string that was incorrectly declared to be UTF-8, and you need a valid
UTF-8 version of it that can be logged or displayed to the user, with the
assumption that it is close enough to ASCII or UTF-8 to be mostly
readable as-is.

/Since: 2.52/
-}
utf8MakeValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: string to coerce into UTF-8 -}
    -> Int64
    {- ^ /@len@/: the maximum length of /@str@/ to use, in bytes. If /@len@/ \< 0,
    then the string is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a valid UTF-8 string whose content resembles /@str@/ -}
utf8MakeValid str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_make_valid str' len
    checkUnexpectedReturnNULL "utf8MakeValid" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_get_char_validated
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to Unicode character encoded as UTF-8", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum number of bytes to read, or -1 if @p is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_get_char_validated" g_utf8_get_char_validated ::
    CString ->                              -- p : TBasicType TUTF8
    Int64 ->                                -- max_len : TBasicType TInt64
    IO CInt

{- |
Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
This function checks for incomplete characters, for invalid characters
such as characters that are out of the range of Unicode, and for
overlong encodings of valid characters.

Note that 'GI.GLib.Functions.utf8GetCharValidated' returns (gunichar)-2 if
/@maxLen@/ is positive and any of the bytes in the first UTF-8 character
sequence are nul.
-}
utf8GetCharValidated ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a pointer to Unicode character encoded as UTF-8 -}
    -> Int64
    {- ^ /@maxLen@/: the maximum number of bytes to read, or -1 if /@p@/ is nul-terminated -}
    -> m Char
    {- ^ __Returns:__ the resulting character. If /@p@/ points to a partial
    sequence at the end of a string that could begin a valid
    character (or if /@maxLen@/ is zero), returns (gunichar)-2;
    otherwise, if /@p@/ does not point to a valid UTF-8 encoded
    Unicode character, returns (gunichar)-1. -}
utf8GetCharValidated p maxLen = liftIO $ do
    p' <- textToCString p
    result <- g_utf8_get_char_validated p' maxLen
    let result' = (chr . fromIntegral) result
    freeMem p'
    return result'


-- function g_utf8_get_char
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to Unicode character encoded as UTF-8", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_get_char" g_utf8_get_char ::
    CString ->                              -- p : TBasicType TUTF8
    IO CInt

{- |
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.

If /@p@/ does not point to a valid UTF-8 encoded character, results
are undefined. If you are not sure that the bytes are complete
valid Unicode characters, you should use 'GI.GLib.Functions.utf8GetCharValidated'
instead.
-}
utf8GetChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a pointer to Unicode character encoded as UTF-8 -}
    -> m Char
    {- ^ __Returns:__ the resulting character -}
utf8GetChar p = liftIO $ do
    p' <- textToCString p
    result <- g_utf8_get_char p'
    let result' = (chr . fromIntegral) result
    freeMem p'
    return result'


-- function g_utf8_find_prev_char
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the beginning of a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to some position within @str", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_find_prev_char" g_utf8_find_prev_char ::
    CString ->                              -- str : TBasicType TUTF8
    CString ->                              -- p : TBasicType TUTF8
    IO CString

{- |
Given a position /@p@/ with a UTF-8 encoded string /@str@/, find the start
of the previous UTF-8 character starting before /@p@/. Returns 'Nothing' if no
UTF-8 characters are present in /@str@/ before /@p@/.

/@p@/ does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.
-}
utf8FindPrevChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: pointer to the beginning of a UTF-8 encoded string -}
    -> T.Text
    {- ^ /@p@/: pointer to some position within /@str@/ -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to the found character or 'Nothing'. -}
utf8FindPrevChar str p = liftIO $ do
    str' <- textToCString str
    p' <- textToCString p
    result <- g_utf8_find_prev_char str' p'
    checkUnexpectedReturnNULL "utf8FindPrevChar" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    freeMem p'
    return result'


-- function g_utf8_find_next_char
-- Args : [Arg {argCName = "p", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to a position within a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a pointer to the byte following the end of the string,\n    or %NULL to indicate that the string is nul-terminated", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_find_next_char" g_utf8_find_next_char ::
    CString ->                              -- p : TBasicType TUTF8
    CString ->                              -- end : TBasicType TUTF8
    IO CString

{- |
Finds the start of the next UTF-8 character in the string after /@p@/.

/@p@/ does not have to be at the beginning of a UTF-8 character. No check
is made to see if the character found is actually valid other than
it starts with an appropriate byte.

If /@end@/ is 'Nothing', the return value will never be 'Nothing': if the end of the
string is reached, a pointer to the terminating nul byte is returned. If
/@end@/ is non-'Nothing', the return value will be 'Nothing' if the end of the string
is reached.
-}
utf8FindNextChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@p@/: a pointer to a position within a UTF-8 encoded string -}
    -> Maybe (T.Text)
    {- ^ /@end@/: a pointer to the byte following the end of the string,
    or 'Nothing' to indicate that the string is nul-terminated -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ a pointer to the found character or 'Nothing' if /@end@/ is
   set and is reached -}
utf8FindNextChar p end = liftIO $ do
    p' <- textToCString p
    maybeEnd <- case end of
        Nothing -> return nullPtr
        Just jEnd -> do
            jEnd' <- textToCString jEnd
            return jEnd'
    result <- g_utf8_find_next_char p' maybeEnd
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    freeMem p'
    freeMem maybeEnd
    return maybeResult


-- function g_utf8_collate_key_for_filename
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_collate_key_for_filename" g_utf8_collate_key_for_filename ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using @/strcmp()/@.

In order to sort filenames correctly, this function treats the dot \'.\'
as a special case. Most dictionary orderings seem to consider it
insignificant, thus producing the ordering \"event.c\" \"eventgenerator.c\"
\"event.h\" instead of \"event.c\" \"event.h\" \"eventgenerator.c\". Also, we
would like to treat numbers intelligently so that \"file1\" \"file10\" \"file5\"
is sorted as \"file1\" \"file5\" \"file10\".

Note that this function depends on the [current locale][setlocale].

/Since: 2.8/
-}
utf8CollateKeyForFilename ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string. -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string. This string should
  be freed with 'GI.GLib.Functions.free' when you are done with it. -}
utf8CollateKeyForFilename str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_collate_key_for_filename str' len
    checkUnexpectedReturnNULL "utf8CollateKeyForFilename" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_collate_key
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_collate_key" g_utf8_collate_key ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Converts a string into a collation key that can be compared
with other collation keys produced by the same function using
@/strcmp()/@.

The results of comparing the collation keys of two strings
with @/strcmp()/@ will always be the same as comparing the two
original keys with 'GI.GLib.Functions.utf8Collate'.

Note that this function depends on the [current locale][setlocale].
-}
utf8CollateKey ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string. -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string. This string should
  be freed with 'GI.GLib.Functions.free' when you are done with it. -}
utf8CollateKey str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_collate_key str' len
    checkUnexpectedReturnNULL "utf8CollateKey" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_utf8_collate
-- Args : [Arg {argCName = "str1", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "str2", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", 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 "g_utf8_collate" g_utf8_collate ::
    CString ->                              -- str1 : TBasicType TUTF8
    CString ->                              -- str2 : TBasicType TUTF8
    IO Int32

{- |
Compares two strings for ordering using the linguistically
correct rules for the [current locale][setlocale].
When sorting a large number of strings, it will be significantly
faster to obtain collation keys with 'GI.GLib.Functions.utf8CollateKey' and
compare the keys with @/strcmp()/@ when sorting instead of sorting
the original strings.
-}
utf8Collate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str1@/: a UTF-8 encoded string -}
    -> T.Text
    {- ^ /@str2@/: a UTF-8 encoded string -}
    -> m Int32
    {- ^ __Returns:__ \< 0 if /@str1@/ compares before /@str2@/,
  0 if they compare equal, > 0 if /@str1@/ compares after /@str2@/. -}
utf8Collate str1 str2 = liftIO $ do
    str1' <- textToCString str1
    str2' <- textToCString str2
    result <- g_utf8_collate str1' str2'
    freeMem str1'
    freeMem str2'
    return result


-- function g_utf8_casefold
-- Args : [Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UTF-8 encoded string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of @str, in bytes, or -1 if @str is nul-terminated.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_utf8_casefold" g_utf8_casefold ::
    CString ->                              -- str : TBasicType TUTF8
    Int64 ->                                -- len : TBasicType TInt64
    IO CString

{- |
Converts a string into a form that is independent of case. The
result will not correspond to any particular case, but can be
compared for equality or ordered with the results of calling
'GI.GLib.Functions.utf8Casefold' on other strings.

Note that calling 'GI.GLib.Functions.utf8Casefold' followed by 'GI.GLib.Functions.utf8Collate' is
only an approximation to the correct linguistic case insensitive
ordering, though it is a fairly good one. Getting this exactly
right would require a more sophisticated collation function that
takes case sensitivity into account. GLib does not currently
provide such a function.
-}
utf8Casefold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@str@/: a UTF-8 encoded string -}
    -> Int64
    {- ^ /@len@/: length of /@str@/, in bytes, or -1 if /@str@/ is nul-terminated. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string, that is a
  case independent form of /@str@/. -}
utf8Casefold str len = liftIO $ do
    str' <- textToCString str
    result <- g_utf8_casefold str' len
    checkUnexpectedReturnNULL "utf8Casefold" result
    result' <- cstringToText result
    freeMem result
    freeMem str'
    return result'


-- function g_usleep
-- Args : [Arg {argCName = "microseconds", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of microseconds to pause", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_usleep" g_usleep ::
    CULong ->                               -- microseconds : TBasicType TULong
    IO ()

{- |
Pauses the current thread for the given number of microseconds.

There are 1 million microseconds per second (represented by the
'GI.GLib.Constants.USEC_PER_SEC' macro). 'GI.GLib.Functions.usleep' may have limited precision,
depending on hardware and operating system; don\'t rely on the exact
length of the sleep.
-}
usleep ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CULong
    {- ^ /@microseconds@/: number of microseconds to pause -}
    -> m ()
usleep microseconds = liftIO $ do
    g_usleep microseconds
    return ()


-- function g_uri_unescape_string
-- Args : [Arg {argCName = "escaped_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an escaped string to be unescaped.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "illegal_characters", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string of illegal characters not to be\n     allowed, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_uri_unescape_string" g_uri_unescape_string ::
    CString ->                              -- escaped_string : TBasicType TUTF8
    CString ->                              -- illegal_characters : TBasicType TUTF8
    IO CString

{- |
Unescapes a whole escaped string.

If any of the characters in /@illegalCharacters@/ or the character zero appears
as an escaped character in /@escapedString@/ then that is an error and 'Nothing'
will be returned. This is useful it you want to avoid for instance having a
slash being expanded in an escaped path element, which might confuse pathname
handling.

/Since: 2.16/
-}
uriUnescapeString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@escapedString@/: an escaped string to be unescaped. -}
    -> Maybe (T.Text)
    {- ^ /@illegalCharacters@/: a string of illegal characters not to be
     allowed, or 'Nothing'. -}
    -> m T.Text
    {- ^ __Returns:__ an unescaped version of /@escapedString@/. The returned string
should be freed when no longer needed. -}
uriUnescapeString escapedString illegalCharacters = liftIO $ do
    escapedString' <- textToCString escapedString
    maybeIllegalCharacters <- case illegalCharacters of
        Nothing -> return nullPtr
        Just jIllegalCharacters -> do
            jIllegalCharacters' <- textToCString jIllegalCharacters
            return jIllegalCharacters'
    result <- g_uri_unescape_string escapedString' maybeIllegalCharacters
    checkUnexpectedReturnNULL "uriUnescapeString" result
    result' <- cstringToText result
    freeMem result
    freeMem escapedString'
    freeMem maybeIllegalCharacters
    return result'


-- function g_uri_unescape_segment
-- Args : [Arg {argCName = "escaped_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A string, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "escaped_string_end", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Pointer to end of @escaped_string, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "illegal_characters", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "An optional string of illegal characters not to be allowed, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_uri_unescape_segment" g_uri_unescape_segment ::
    CString ->                              -- escaped_string : TBasicType TUTF8
    CString ->                              -- escaped_string_end : TBasicType TUTF8
    CString ->                              -- illegal_characters : TBasicType TUTF8
    IO CString

{- |
Unescapes a segment of an escaped string.

If any of the characters in /@illegalCharacters@/ or the character zero appears
as an escaped character in /@escapedString@/ then that is an error and 'Nothing'
will be returned. This is useful it you want to avoid for instance having a
slash being expanded in an escaped path element, which might confuse pathname
handling.

/Since: 2.16/
-}
uriUnescapeSegment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@escapedString@/: A string, may be 'Nothing' -}
    -> Maybe (T.Text)
    {- ^ /@escapedStringEnd@/: Pointer to end of /@escapedString@/, may be 'Nothing' -}
    -> Maybe (T.Text)
    {- ^ /@illegalCharacters@/: An optional string of illegal characters not to be allowed, may be 'Nothing' -}
    -> m T.Text
    {- ^ __Returns:__ an unescaped version of /@escapedString@/ or 'Nothing' on error.
The returned string should be freed when no longer needed.  As a
special case if 'Nothing' is given for /@escapedString@/, this function
will return 'Nothing'. -}
uriUnescapeSegment escapedString escapedStringEnd illegalCharacters = liftIO $ do
    maybeEscapedString <- case escapedString of
        Nothing -> return nullPtr
        Just jEscapedString -> do
            jEscapedString' <- textToCString jEscapedString
            return jEscapedString'
    maybeEscapedStringEnd <- case escapedStringEnd of
        Nothing -> return nullPtr
        Just jEscapedStringEnd -> do
            jEscapedStringEnd' <- textToCString jEscapedStringEnd
            return jEscapedStringEnd'
    maybeIllegalCharacters <- case illegalCharacters of
        Nothing -> return nullPtr
        Just jIllegalCharacters -> do
            jIllegalCharacters' <- textToCString jIllegalCharacters
            return jIllegalCharacters'
    result <- g_uri_unescape_segment maybeEscapedString maybeEscapedStringEnd maybeIllegalCharacters
    checkUnexpectedReturnNULL "uriUnescapeSegment" result
    result' <- cstringToText result
    freeMem result
    freeMem maybeEscapedString
    freeMem maybeEscapedStringEnd
    freeMem maybeIllegalCharacters
    return result'


-- function g_uri_parse_scheme
-- Args : [Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid URI.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_uri_parse_scheme" g_uri_parse_scheme ::
    CString ->                              -- uri : TBasicType TUTF8
    IO CString

{- |
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
>
>URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include \"file\", \"http\", \"svn+ssh\", etc.

/Since: 2.16/
-}
uriParseScheme ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uri@/: a valid URI. -}
    -> m T.Text
    {- ^ __Returns:__ The \"Scheme\" component of the URI, or 'Nothing' on error.
The returned string should be freed when no longer needed. -}
uriParseScheme uri = liftIO $ do
    uri' <- textToCString uri
    result <- g_uri_parse_scheme uri'
    checkUnexpectedReturnNULL "uriParseScheme" result
    result' <- cstringToText result
    freeMem result
    freeMem uri'
    return result'


-- function g_uri_list_extract_uris
-- Args : [Arg {argCName = "uri_list", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an URI list", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_uri_list_extract_uris" g_uri_list_extract_uris ::
    CString ->                              -- uri_list : TBasicType TUTF8
    IO (Ptr CString)

{- |
Splits an URI list conforming to the text\/uri-list
mime type defined in RFC 2483 into individual URIs,
discarding any comments. The URIs are not validated.

/Since: 2.6/
-}
uriListExtractUris ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uriList@/: an URI list -}
    -> m [T.Text]
    {- ^ __Returns:__ a newly allocated 'Nothing'-terminated list
  of strings holding the individual URIs. The array should be freed
  with 'GI.GLib.Functions.strfreev'. -}
uriListExtractUris uriList = liftIO $ do
    uriList' <- textToCString uriList
    result <- g_uri_list_extract_uris uriList'
    checkUnexpectedReturnNULL "uriListExtractUris" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    freeMem uriList'
    return result'


-- function g_uri_escape_string
-- Args : [Arg {argCName = "unescaped", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the unescaped input string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "reserved_chars_allowed", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string of reserved characters that\n     are allowed to be used, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allow_utf8", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if the result can include UTF-8 characters.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_uri_escape_string" g_uri_escape_string ::
    CString ->                              -- unescaped : TBasicType TUTF8
    CString ->                              -- reserved_chars_allowed : TBasicType TUTF8
    CInt ->                                 -- allow_utf8 : TBasicType TBoolean
    IO CString

{- |
Escapes a string for use in a URI.

Normally all characters that are not \"unreserved\" (i.e. ASCII alphanumerical
characters plus dash, dot, underscore and tilde) are escaped.
But if you specify characters in /@reservedCharsAllowed@/ they are not
escaped. This is useful for the \"reserved\" characters in the URI
specification, since those are allowed unescaped in some portions of
a URI.

/Since: 2.16/
-}
uriEscapeString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@unescaped@/: the unescaped input string. -}
    -> Maybe (T.Text)
    {- ^ /@reservedCharsAllowed@/: a string of reserved characters that
     are allowed to be used, or 'Nothing'. -}
    -> Bool
    {- ^ /@allowUtf8@/: 'True' if the result can include UTF-8 characters. -}
    -> m T.Text
    {- ^ __Returns:__ an escaped version of /@unescaped@/. The returned string should be
freed when no longer needed. -}
uriEscapeString unescaped reservedCharsAllowed allowUtf8 = liftIO $ do
    unescaped' <- textToCString unescaped
    maybeReservedCharsAllowed <- case reservedCharsAllowed of
        Nothing -> return nullPtr
        Just jReservedCharsAllowed -> do
            jReservedCharsAllowed' <- textToCString jReservedCharsAllowed
            return jReservedCharsAllowed'
    let allowUtf8' = (fromIntegral . fromEnum) allowUtf8
    result <- g_uri_escape_string unescaped' maybeReservedCharsAllowed allowUtf8'
    checkUnexpectedReturnNULL "uriEscapeString" result
    result' <- cstringToText result
    freeMem result
    freeMem unescaped'
    freeMem maybeReservedCharsAllowed
    return result'


-- function g_unsetenv
-- Args : [Arg {argCName = "variable", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the environment variable to remove, must\n    not contain '='", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_unsetenv" g_unsetenv ::
    CString ->                              -- variable : TBasicType TFileName
    IO ()

{- |
Removes an environment variable from the environment.

Note that on some systems, when variables are overwritten, the
memory used for the previous variables and its value isn\'t reclaimed.

You should be mindful of the fact that environment variable handling
in UNIX is not thread-safe, and your program may crash if one thread
calls 'GI.GLib.Functions.unsetenv' while another thread is calling @/getenv()/@. (And note
that many functions, such as @/gettext()/@, call @/getenv()/@ internally.) This
function is only safe to use at the very start of your program, before
creating any other threads (or creating objects that create worker
threads of their own).

If you need to set up the environment for a child process, you can
use 'GI.GLib.Functions.getEnviron' to get an environment array, modify that with
'GI.GLib.Functions.environSetenv' and 'GI.GLib.Functions.environUnsetenv', and then pass that
array directly to @/execvpe()/@, 'GI.GLib.Functions.spawnAsync', or the like.

/Since: 2.4/
-}
unsetenv ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    {- ^ /@variable@/: the environment variable to remove, must
    not contain \'=\' -}
    -> m ()
unsetenv variable = liftIO $ do
    variable' <- stringToCString variable
    g_unsetenv variable'
    freeMem variable'
    return ()


-- function g_unlink
-- Args : [Arg {argCName = "filename", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pathname in the GLib file name encoding\n    (UTF-8 on Windows)", 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 "g_unlink" g_unlink ::
    CString ->                              -- filename : TBasicType TFileName
    IO Int32

{- |
A wrapper for the POSIX @/unlink()/@ function. The @/unlink()/@ function
deletes a name from the filesystem. If this was the last link to the
file and no processes have it opened, the diskspace occupied by the
file is freed.

See your C library manual for more details about @/unlink()/@. Note
that on Windows, it is in general not possible to delete files that
are open to some process, or mapped into memory.

/Since: 2.6/
-}
unlink ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    {- ^ /@filename@/: a pathname in the GLib file name encoding
    (UTF-8 on Windows) -}
    -> m Int32
    {- ^ __Returns:__ 0 if the name was successfully deleted, -1 if an error
   occurred -}
unlink filename = liftIO $ do
    filename' <- stringToCString filename
    result <- g_unlink filename'
    freeMem filename'
    return result


-- function g_unix_signal_source_new
-- Args : [Arg {argCName = "signum", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A signal number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Source"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_signal_source_new" g_unix_signal_source_new ::
    Int32 ->                                -- signum : TBasicType TInt
    IO (Ptr GLib.Source.Source)

{- |
Create a 'GI.GLib.Structs.Source.Source' that will be dispatched upon delivery of the UNIX
signal /@signum@/.  In GLib versions before 2.36, only @SIGHUP@, @SIGINT@,
@SIGTERM@ can be monitored.  In GLib 2.36, @SIGUSR1@ and @SIGUSR2@
were added. In GLib 2.54, @SIGWINCH@ was added.

Note that unlike the UNIX default, all sources which have created a
watch will be dispatched, regardless of which underlying thread
invoked 'GI.GLib.Functions.unixSignalSourceNew'.

For example, an effective use of this function is to handle @SIGTERM@
cleanly; flushing any outstanding files, and then calling
g_main_loop_quit ().  It is not safe to do any of this a regular
UNIX signal handler; your handler may be invoked while @/malloc()/@ or
another library function is running, causing reentrancy if you
attempt to use it from the handler.  None of the GLib\/GObject API
is safe against this kind of reentrancy.

The interaction of this source when combined with native UNIX
functions like @/sigprocmask()/@ is not defined.

The source will not initially be associated with any 'GI.GLib.Structs.MainContext.MainContext'
and must be added to one with 'GI.GLib.Structs.Source.sourceAttach' before it will be
executed.

/Since: 2.30/
-}
unixSignalSourceNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@signum@/: A signal number -}
    -> m GLib.Source.Source
    {- ^ __Returns:__ A newly created 'GI.GLib.Structs.Source.Source' -}
unixSignalSourceNew signum = liftIO $ do
    result <- g_unix_signal_source_new signum
    checkUnexpectedReturnNULL "unixSignalSourceNew" result
    result' <- (wrapBoxed GLib.Source.Source) result
    return result'


-- function g_unix_signal_add_full
-- Args : [Arg {argCName = "priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the priority of the signal source. Typically this will be in\n           the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signum", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Signal number", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "handler", argType = TInterface (Name {namespace = "GLib", name = "SourceFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Callback", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Data for @handler", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GDestroyNotify for @handler", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_signal_add_full" g_unix_signal_add_full ::
    Int32 ->                                -- priority : TBasicType TInt
    Int32 ->                                -- signum : TBasicType TInt
    FunPtr GLib.Callbacks.C_SourceFunc ->   -- handler : TInterface (Name {namespace = "GLib", name = "SourceFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO Word32

{- |
A convenience function for 'GI.GLib.Functions.unixSignalSourceNew', which
attaches to the default 'GI.GLib.Structs.MainContext.MainContext'.  You can remove the watch
using 'GI.GLib.Functions.sourceRemove'.

/Since: 2.30/
-}
unixSignalAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@priority@/: the priority of the signal source. Typically this will be in
           the range between 'GI.GLib.Constants.PRIORITY_DEFAULT' and 'GI.GLib.Constants.PRIORITY_HIGH'. -}
    -> Int32
    {- ^ /@signum@/: Signal number -}
    -> GLib.Callbacks.SourceFunc
    {- ^ /@handler@/: Callback -}
    -> m Word32
    {- ^ __Returns:__ An ID (greater than 0) for the event source -}
unixSignalAdd priority signum handler = liftIO $ do
    handler' <- GLib.Callbacks.mk_SourceFunc (GLib.Callbacks.wrap_SourceFunc Nothing (GLib.Callbacks.drop_closures_SourceFunc handler))
    let userData = castFunPtrToPtr handler'
    let notify = safeFreeFunPtrPtr
    result <- g_unix_signal_add_full priority signum handler' userData notify
    return result


-- function g_unix_set_fd_nonblocking
-- Args : [Arg {argCName = "fd", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A file descriptor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nonblock", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "If %TRUE, set the descriptor to be non-blocking", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_unix_set_fd_nonblocking" g_unix_set_fd_nonblocking ::
    Int32 ->                                -- fd : TBasicType TInt
    CInt ->                                 -- nonblock : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Control the non-blocking state of the given file descriptor,
according to /@nonblock@/. On most systems this uses @/O_NONBLOCK/@, but
on some older ones may use @/O_NDELAY/@.

/Since: 2.30/
-}
unixSetFdNonblocking ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@fd@/: A file descriptor -}
    -> Bool
    {- ^ /@nonblock@/: If 'True', set the descriptor to be non-blocking -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
unixSetFdNonblocking fd nonblock = liftIO $ do
    let nonblock' = (fromIntegral . fromEnum) nonblock
    onException (do
        _ <- propagateGError $ g_unix_set_fd_nonblocking fd nonblock'
        return ()
     ) (do
        return ()
     )


-- function g_unix_open_pipe
-- Args : [Arg {argCName = "fds", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Array of two integers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Bitfield of file descriptor flags, as for fcntl()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_unix_open_pipe" g_unix_open_pipe ::
    Int32 ->                                -- fds : TBasicType TInt
    Int32 ->                                -- flags : TBasicType TInt
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Similar to the UNIX @/pipe()/@ call, but on modern systems like Linux
uses the @/pipe2()/@ system call, which atomically creates a pipe with
the configured flags. The only supported flag currently is
@/FD_CLOEXEC/@. If for example you want to configure @/O_NONBLOCK/@, that
must still be done separately with @/fcntl()/@.

This function does not take @/O_CLOEXEC/@, it takes @/FD_CLOEXEC/@ as if
for @/fcntl()/@; these are different on Linux\/glibc.

/Since: 2.30/
-}
unixOpenPipe ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@fds@/: Array of two integers -}
    -> Int32
    {- ^ /@flags@/: Bitfield of file descriptor flags, as for @/fcntl()/@ -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
unixOpenPipe fds flags = liftIO $ do
    onException (do
        _ <- propagateGError $ g_unix_open_pipe fds flags
        return ()
     ) (do
        return ()
     )


-- function g_unix_fd_source_new
-- Args : [Arg {argCName = "fd", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a file descriptor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "condition", argType = TInterface (Name {namespace = "GLib", name = "IOCondition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "IO conditions to watch for on @fd", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Source"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_fd_source_new" g_unix_fd_source_new ::
    Int32 ->                                -- fd : TBasicType TInt
    CUInt ->                                -- condition : TInterface (Name {namespace = "GLib", name = "IOCondition"})
    IO (Ptr GLib.Source.Source)

{- |
Creates a 'GI.GLib.Structs.Source.Source' to watch for a particular IO condition on a file
descriptor.

The source will never close the fd -- you must do it yourself.

/Since: 2.36/
-}
unixFdSourceNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@fd@/: a file descriptor -}
    -> [GLib.Flags.IOCondition]
    {- ^ /@condition@/: IO conditions to watch for on /@fd@/ -}
    -> m GLib.Source.Source
    {- ^ __Returns:__ the newly created 'GI.GLib.Structs.Source.Source' -}
unixFdSourceNew fd condition = liftIO $ do
    let condition' = gflagsToWord condition
    result <- g_unix_fd_source_new fd condition'
    checkUnexpectedReturnNULL "unixFdSourceNew" result
    result' <- (wrapBoxed GLib.Source.Source) result
    return result'


-- function g_unix_fd_add_full
-- Args : [Arg {argCName = "priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the priority of the source", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "fd", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a file descriptor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "condition", argType = TInterface (Name {namespace = "GLib", name = "IOCondition"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "IO conditions to watch for on @fd", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TInterface (Name {namespace = "GLib", name = "UnixFDSourceFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GUnixFDSourceFunc", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 4, argDestroy = 5, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function to call when the idle is removed, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_fd_add_full" g_unix_fd_add_full ::
    Int32 ->                                -- priority : TBasicType TInt
    Int32 ->                                -- fd : TBasicType TInt
    CUInt ->                                -- condition : TInterface (Name {namespace = "GLib", name = "IOCondition"})
    FunPtr GLib.Callbacks.C_UnixFDSourceFunc -> -- function : TInterface (Name {namespace = "GLib", name = "UnixFDSourceFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO Word32

{- |
Sets a function to be called when the IO condition, as specified by
/@condition@/ becomes true for /@fd@/.

This is the same as @/g_unix_fd_add()/@, except that it allows you to
specify a non-default priority and a provide a 'GI.GLib.Callbacks.DestroyNotify' for
/@userData@/.

/Since: 2.36/
-}
unixFdAddFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@priority@/: the priority of the source -}
    -> Int32
    {- ^ /@fd@/: a file descriptor -}
    -> [GLib.Flags.IOCondition]
    {- ^ /@condition@/: IO conditions to watch for on /@fd@/ -}
    -> GLib.Callbacks.UnixFDSourceFunc
    {- ^ /@function@/: a 'GI.GLib.Callbacks.UnixFDSourceFunc' -}
    -> m Word32
    {- ^ __Returns:__ the ID (greater than 0) of the event source -}
unixFdAddFull priority fd condition function = liftIO $ do
    let condition' = gflagsToWord condition
    function' <- GLib.Callbacks.mk_UnixFDSourceFunc (GLib.Callbacks.wrap_UnixFDSourceFunc Nothing (GLib.Callbacks.drop_closures_UnixFDSourceFunc function))
    let userData = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- g_unix_fd_add_full priority fd condition' function' userData notify
    return result


-- function g_unix_error_quark
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_error_quark" g_unix_error_quark ::
    IO Word32

{- |
/No description available in the introspection data./
-}
unixErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
unixErrorQuark  = liftIO $ do
    result <- g_unix_error_quark
    return result


-- function g_unicode_script_to_iso15924
-- Args : [Arg {argCName = "script", argType = TInterface (Name {namespace = "GLib", name = "UnicodeScript"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode script", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_unicode_script_to_iso15924" g_unicode_script_to_iso15924 ::
    CInt ->                                 -- script : TInterface (Name {namespace = "GLib", name = "UnicodeScript"})
    IO Word32

{- |
Looks up the ISO 15924 code for /@script@/.  ISO 15924 assigns four-letter
codes to scripts.  For example, the code for Arabic is \'Arab\'.  The
four letter codes are encoded as a /@guint32@/ by this function in a
big-endian fashion.  That is, the code returned for Arabic is
0x41726162 (0x41 is ASCII code for \'A\', 0x72 is ASCII code for \'r\', etc).

See
<http://unicode.org/iso15924/codelists.html Codes for the representation of names of scripts>
for details.

/Since: 2.30/
-}
unicodeScriptToIso15924 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.UnicodeScript
    {- ^ /@script@/: a Unicode script -}
    -> m Word32
    {- ^ __Returns:__ the ISO 15924 code for /@script@/, encoded as an integer,
  of zero if /@script@/ is 'GI.GLib.Enums.UnicodeScriptInvalidCode' or
  ISO 15924 code \'Zzzz\' (script code for UNKNOWN) if /@script@/ is not understood. -}
unicodeScriptToIso15924 script = liftIO $ do
    let script' = (fromIntegral . fromEnum) script
    result <- g_unicode_script_to_iso15924 script'
    return result


-- function g_unicode_script_from_iso15924
-- Args : [Arg {argCName = "iso15924", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode script", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "UnicodeScript"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unicode_script_from_iso15924" g_unicode_script_from_iso15924 ::
    Word32 ->                               -- iso15924 : TBasicType TUInt32
    IO CInt

{- |
Looks up the Unicode script for /@iso15924@/.  ISO 15924 assigns four-letter
codes to scripts.  For example, the code for Arabic is \'Arab\'.
This function accepts four letter codes encoded as a /@guint32@/ in a
big-endian fashion.  That is, the code expected for Arabic is
0x41726162 (0x41 is ASCII code for \'A\', 0x72 is ASCII code for \'r\', etc).

See
<http://unicode.org/iso15924/codelists.html Codes for the representation of names of scripts>
for details.

/Since: 2.30/
-}
unicodeScriptFromIso15924 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@iso15924@/: a Unicode script -}
    -> m GLib.Enums.UnicodeScript
    {- ^ __Returns:__ the Unicode script for /@iso15924@/, or
  of 'GI.GLib.Enums.UnicodeScriptInvalidCode' if /@iso15924@/ is zero and
  'GI.GLib.Enums.UnicodeScriptUnknown' if /@iso15924@/ is unknown. -}
unicodeScriptFromIso15924 iso15924 = liftIO $ do
    result <- g_unicode_script_from_iso15924 iso15924
    let result' = (toEnum . fromIntegral) result
    return result'


-- function g_unicode_canonical_ordering
-- Args : [Arg {argCName = "string", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a UCS-4 encoded string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @string to use.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_unicode_canonical_ordering" g_unicode_canonical_ordering ::
    CInt ->                                 -- string : TBasicType TUniChar
    Word64 ->                               -- len : TBasicType TUInt64
    IO ()

{- |
Computes the canonical ordering of a string in-place.
This rearranges decomposed characters in the string
according to their combining classes.  See the Unicode
manual for more information.
-}
unicodeCanonicalOrdering ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@string@/: a UCS-4 encoded string. -}
    -> Word64
    {- ^ /@len@/: the maximum length of /@string@/ to use. -}
    -> m ()
unicodeCanonicalOrdering string len = liftIO $ do
    let string' = (fromIntegral . ord) string
    g_unicode_canonical_ordering string' len
    return ()


-- function g_unicode_canonical_decomposition
-- Args : [Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result_len", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the length of the return value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_unicode_canonical_decomposition" g_unicode_canonical_decomposition ::
    CInt ->                                 -- ch : TBasicType TUniChar
    Word64 ->                               -- result_len : TBasicType TUInt64
    IO CInt

{-# DEPRECATED unicodeCanonicalDecomposition ["(Since version 2.30)","Use the more flexible @/g_unichar_fully_decompose()/@","  instead."] #-}
{- |
Computes the canonical decomposition of a Unicode character.
-}
unicodeCanonicalDecomposition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@ch@/: a Unicode character. -}
    -> Word64
    {- ^ /@resultLen@/: location to store the length of the return value. -}
    -> m Char
    {- ^ __Returns:__ a newly allocated string of Unicode characters.
  /@resultLen@/ is set to the resulting length of the string. -}
unicodeCanonicalDecomposition ch resultLen = liftIO $ do
    let ch' = (fromIntegral . ord) ch
    result <- g_unicode_canonical_decomposition ch' resultLen
    let result' = (chr . fromIntegral) result
    return result'


-- function g_unichar_xdigit_value
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", 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 "g_unichar_xdigit_value" g_unichar_xdigit_value ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO Int32

{- |
Determines the numeric value of a character as a hexidecimal
digit.
-}
unicharXdigitValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Int32
    {- ^ __Returns:__ If /@c@/ is a hex digit (according to
'GI.GLib.Functions.unicharIsxdigit'), its numeric value. Otherwise, -1. -}
unicharXdigitValue c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_xdigit_value c'
    return result


-- function g_unichar_validate
-- Args : [Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_validate" g_unichar_validate ::
    CInt ->                                 -- ch : TBasicType TUniChar
    IO CInt

{- |
Checks whether /@ch@/ is a valid Unicode character. Some possible
integer values of /@ch@/ will not be valid. 0 is considered a valid
character, though it\'s normally a string terminator.
-}
unicharValidate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@ch@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@ch@/ is a valid Unicode character -}
unicharValidate ch = liftIO $ do
    let ch' = (fromIntegral . ord) ch
    result <- g_unichar_validate ch'
    let result' = (/= 0) result
    return result'


-- function g_unichar_type
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "UnicodeType"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_type" g_unichar_type ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CUInt

{- |
Classifies a Unicode character by type.
-}
unicharType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m GLib.Enums.UnicodeType
    {- ^ __Returns:__ the type of the character. -}
unicharType c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_type c'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function g_unichar_toupper
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_toupper" g_unichar_toupper ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Converts a character to uppercase.
-}
unicharToupper ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Char
    {- ^ __Returns:__ the result of converting /@c@/ to uppercase.
              If /@c@/ is not an lowercase or titlecase character,
              or has no upper case equivalent /@c@/ is returned unchanged. -}
unicharToupper c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_toupper c'
    let result' = (chr . fromIntegral) result
    return result'


-- function g_unichar_totitle
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_totitle" g_unichar_totitle ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Converts a character to the titlecase.
-}
unicharTotitle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Char
    {- ^ __Returns:__ the result of converting /@c@/ to titlecase.
              If /@c@/ is not an uppercase or lowercase character,
              /@c@/ is returned unchanged. -}
unicharTotitle c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_totitle c'
    let result' = (chr . fromIntegral) result
    return result'


-- function g_unichar_tolower
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUniChar)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_tolower" g_unichar_tolower ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Converts a character to lower case.
-}
unicharTolower ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character. -}
    -> m Char
    {- ^ __Returns:__ the result of converting /@c@/ to lower case.
              If /@c@/ is not an upperlower or titlecase character,
              or has no lowercase equivalent /@c@/ is returned unchanged. -}
unicharTolower c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_tolower c'
    let result' = (chr . fromIntegral) result
    return result'


-- function g_unichar_to_utf8
-- XXX Could not generate function g_unichar_to_utf8
-- Error was : Not implemented: "Don't know how to allocate \"outbuf\" of type TBasicType TUTF8"

-- function g_unichar_iszerowidth
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_iszerowidth" g_unichar_iszerowidth ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a given character typically takes zero width when rendered.
The return value is 'True' for all non-spacing and enclosing marks
(e.g., combining accents), format characters, zero-width
space, but not U+00AD SOFT HYPHEN.

A typical use of this function is with one of 'GI.GLib.Functions.unicharIswide' or
'GI.GLib.Functions.unicharIswideCjk' to determine the number of cells a string occupies
when displayed on a grid display (terminals).  However, note that not all
terminals support zero-width rendering of zero-width marks.

/Since: 2.14/
-}
unicharIszerowidth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character has zero width -}
unicharIszerowidth c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_iszerowidth c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isxdigit
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isxdigit" g_unichar_isxdigit ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a character is a hexidecimal digit.
-}
unicharIsxdigit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character is a hexadecimal digit -}
unicharIsxdigit c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isxdigit c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_iswide_cjk
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_iswide_cjk" g_unichar_iswide_cjk ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a character is typically rendered in a double-width
cell under legacy East Asian locales.  If a character is wide according to
'GI.GLib.Functions.unicharIswide', then it is also reported wide with this function, but
the converse is not necessarily true. See the
<http://www.unicode.org/reports/tr11/ Unicode Standard Annex #11>
for details.

If a character passes the 'GI.GLib.Functions.unicharIswide' test then it will also pass
this test, but not the other way around.  Note that some characters may
pass both this test and 'GI.GLib.Functions.unicharIszerowidth'.

/Since: 2.12/
-}
unicharIswideCjk ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character is wide in legacy East Asian locales -}
unicharIswideCjk c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_iswide_cjk c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_iswide
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_iswide" g_unichar_iswide ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a character is typically rendered in a double-width
cell.
-}
unicharIswide ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character is wide -}
unicharIswide c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_iswide c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isupper
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isupper" g_unichar_isupper ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a character is uppercase.
-}
unicharIsupper ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is an uppercase character -}
unicharIsupper c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isupper c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_istitle
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_istitle" g_unichar_istitle ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a character is titlecase. Some characters in
Unicode which are composites, such as the DZ digraph
have three case variants instead of just two. The titlecase
form is used at the beginning of a word where only the
first letter is capitalized. The titlecase form of the DZ
digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.
-}
unicharIstitle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character is titlecase -}
unicharIstitle c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_istitle c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isspace
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isspace" g_unichar_isspace ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is a space, tab, or line separator
(newline, carriage return, etc.).  Given some UTF-8 text, obtain a
character value with 'GI.GLib.Functions.utf8GetChar'.

(Note: don\'t use this to do word breaking; you have to use
Pango or equivalent to get word breaking right, the algorithm
is fairly complex.)
-}
unicharIsspace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a space character -}
unicharIsspace c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isspace c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_ispunct
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_ispunct" g_unichar_ispunct ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is punctuation or a symbol.
Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIspunct ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a punctuation or symbol character -}
unicharIspunct c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_ispunct c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isprint
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isprint" g_unichar_isprint ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is printable.
Unlike 'GI.GLib.Functions.unicharIsgraph', returns 'True' for spaces.
Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIsprint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is printable -}
unicharIsprint c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isprint c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_ismark
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_ismark" g_unichar_ismark ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is a mark (non-spacing mark,
combining mark, or enclosing mark in Unicode speak).
Given some UTF-8 text, obtain a character value
with 'GI.GLib.Functions.utf8GetChar'.

Note: in most cases where isalpha characters are allowed,
ismark characters should be allowed to as they are essential
for writing most European languages as well as many non-Latin
scripts.

/Since: 2.14/
-}
unicharIsmark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a mark character -}
unicharIsmark c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_ismark c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_islower
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_islower" g_unichar_islower ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is a lowercase letter.
Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIslower ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a lowercase letter -}
unicharIslower c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_islower c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isgraph
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isgraph" g_unichar_isgraph ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is printable and not a space
(returns 'False' for control characters, format characters, and
spaces). 'GI.GLib.Functions.unicharIsprint' is similar, but returns 'True' for
spaces. Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIsgraph ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is printable unless it\'s a space -}
unicharIsgraph c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isgraph c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isdigit
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isdigit" g_unichar_isdigit ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is numeric (i.e. a digit).  This
covers ASCII 0-9 and also digits in other languages\/scripts.  Given
some UTF-8 text, obtain a character value with 'GI.GLib.Functions.utf8GetChar'.
-}
unicharIsdigit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a digit -}
unicharIsdigit c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isdigit c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isdefined
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isdefined" g_unichar_isdefined ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines if a given character is assigned in the Unicode
standard.
-}
unicharIsdefined ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character has an assigned value -}
unicharIsdefined c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isdefined c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_iscntrl
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_iscntrl" g_unichar_iscntrl ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is a control character.
Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIscntrl ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is a control character -}
unicharIscntrl c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_iscntrl c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isalpha
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isalpha" g_unichar_isalpha ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is alphabetic (i.e. a letter).
Given some UTF-8 text, obtain a character value with
'GI.GLib.Functions.utf8GetChar'.
-}
unicharIsalpha ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is an alphabetic character -}
unicharIsalpha c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isalpha c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_isalnum
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_isalnum" g_unichar_isalnum ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CInt

{- |
Determines whether a character is alphanumeric.
Given some UTF-8 text, obtain a character value
with 'GI.GLib.Functions.utf8GetChar'.
-}
unicharIsalnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@c@/ is an alphanumeric character -}
unicharIsalnum c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_isalnum c'
    let result' = (/= 0) result
    return result'


-- function g_unichar_get_script
-- Args : [Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "UnicodeScript"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_get_script" g_unichar_get_script ::
    CInt ->                                 -- ch : TBasicType TUniChar
    IO CInt

{- |
Looks up the 'GI.GLib.Enums.UnicodeScript' for a particular character (as defined
by Unicode Standard Annex #24). No check is made for /@ch@/ being a
valid Unicode character; if you pass in invalid character, the
result is undefined.

This function is equivalent to @/pango_script_for_unichar()/@ and the
two are interchangeable.

/Since: 2.14/
-}
unicharGetScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@ch@/: a Unicode character -}
    -> m GLib.Enums.UnicodeScript
    {- ^ __Returns:__ the 'GI.GLib.Enums.UnicodeScript' for the character. -}
unicharGetScript ch = liftIO $ do
    let ch' = (fromIntegral . ord) ch
    result <- g_unichar_get_script ch'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function g_unichar_get_mirror_char
-- Args : [Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mirrored_ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the mirrored character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_get_mirror_char" g_unichar_get_mirror_char ::
    CInt ->                                 -- ch : TBasicType TUniChar
    CInt ->                                 -- mirrored_ch : TBasicType TUniChar
    IO CInt

{- |
In Unicode, some characters are \"mirrored\". This means that their
images are mirrored horizontally in text that is laid out from right
to left. For instance, \"(\" would become its mirror image, \")\", in
right-to-left text.

If /@ch@/ has the Unicode mirrored property and there is another unicode
character that typically has a glyph that is the mirror image of /@ch@/\'s
glyph and /@mirroredCh@/ is set, it puts that character in the address
pointed to by /@mirroredCh@/.  Otherwise the original character is put.

/Since: 2.4/
-}
unicharGetMirrorChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@ch@/: a Unicode character -}
    -> Char
    {- ^ /@mirroredCh@/: location to store the mirrored character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@ch@/ has a mirrored character, 'False' otherwise -}
unicharGetMirrorChar ch mirroredCh = liftIO $ do
    let ch' = (fromIntegral . ord) ch
    let mirroredCh' = (fromIntegral . ord) mirroredCh
    result <- g_unichar_get_mirror_char ch' mirroredCh'
    let result' = (/= 0) result
    return result'


-- function g_unichar_digit_value
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", 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 "g_unichar_digit_value" g_unichar_digit_value ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO Int32

{- |
Determines the numeric value of a character as a decimal
digit.
-}
unicharDigitValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m Int32
    {- ^ __Returns:__ If /@c@/ is a decimal digit (according to
'GI.GLib.Functions.unicharIsdigit'), its numeric value. Otherwise, -1. -}
unicharDigitValue c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_digit_value c'
    return result


-- function g_unichar_decompose
-- Args : [Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "a", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the first component of @ch", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the second component of @ch", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_decompose" g_unichar_decompose ::
    CInt ->                                 -- ch : TBasicType TUniChar
    CInt ->                                 -- a : TBasicType TUniChar
    CInt ->                                 -- b : TBasicType TUniChar
    IO CInt

{- |
Performs a single decomposition step of the
Unicode canonical decomposition algorithm.

This function does not include compatibility
decompositions. It does, however, include algorithmic
Hangul Jamo decomposition, as well as \'singleton\'
decompositions which replace a character by a single
other character. In the case of singletons */@b@/ will
be set to zero.

If /@ch@/ is not decomposable, */@a@/ is set to /@ch@/ and */@b@/
is set to zero.

Note that the way Unicode decomposition pairs are
defined, it is guaranteed that /@b@/ would not decompose
further, but /@a@/ may itself decompose.  To get the full
canonical decomposition for /@ch@/, one would need to
recursively call this function on /@a@/.  Or use
@/g_unichar_fully_decompose()/@.

See
<http://unicode.org/reports/tr15/ UAX#15>
for details.

/Since: 2.30/
-}
unicharDecompose ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@ch@/: a Unicode character -}
    -> Char
    {- ^ /@a@/: return location for the first component of /@ch@/ -}
    -> Char
    {- ^ /@b@/: return location for the second component of /@ch@/ -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the character could be decomposed -}
unicharDecompose ch a b = liftIO $ do
    let ch' = (fromIntegral . ord) ch
    let a' = (fromIntegral . ord) a
    let b' = (fromIntegral . ord) b
    result <- g_unichar_decompose ch' a' b'
    let result' = (/= 0) result
    return result'


-- function g_unichar_compose
-- Args : [Arg {argCName = "a", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ch", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the composed character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_compose" g_unichar_compose ::
    CInt ->                                 -- a : TBasicType TUniChar
    CInt ->                                 -- b : TBasicType TUniChar
    CInt ->                                 -- ch : TBasicType TUniChar
    IO CInt

{- |
Performs a single composition step of the
Unicode canonical composition algorithm.

This function includes algorithmic Hangul Jamo composition,
but it is not exactly the inverse of 'GI.GLib.Functions.unicharDecompose'.
No composition can have either of /@a@/ or /@b@/ equal to zero.
To be precise, this function composes if and only if
there exists a Primary Composite P which is canonically
equivalent to the sequence \</@a@/,/@b@/>.  See the Unicode
Standard for the definition of Primary Composite.

If /@a@/ and /@b@/ do not compose a new character, /@ch@/ is set to zero.

See
<http://unicode.org/reports/tr15/ UAX#15>
for details.

/Since: 2.30/
-}
unicharCompose ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@a@/: a Unicode character -}
    -> Char
    {- ^ /@b@/: a Unicode character -}
    -> Char
    {- ^ /@ch@/: return location for the composed character -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the characters could be composed -}
unicharCompose a b ch = liftIO $ do
    let a' = (fromIntegral . ord) a
    let b' = (fromIntegral . ord) b
    let ch' = (fromIntegral . ord) ch
    result <- g_unichar_compose a' b' ch'
    let result' = (/= 0) result
    return result'


-- function g_unichar_combining_class
-- Args : [Arg {argCName = "uc", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", 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 "g_unichar_combining_class" g_unichar_combining_class ::
    CInt ->                                 -- uc : TBasicType TUniChar
    IO Int32

{- |
Determines the canonical combining class of a Unicode character.

/Since: 2.14/
-}
unicharCombiningClass ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@uc@/: a Unicode character -}
    -> m Int32
    {- ^ __Returns:__ the combining class of the character -}
unicharCombiningClass uc = liftIO $ do
    let uc' = (fromIntegral . ord) uc
    result <- g_unichar_combining_class uc'
    return result


-- function g_unichar_break_type
-- Args : [Arg {argCName = "c", argType = TBasicType TUniChar, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Unicode character", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "UnicodeBreakType"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_unichar_break_type" g_unichar_break_type ::
    CInt ->                                 -- c : TBasicType TUniChar
    IO CUInt

{- |
Determines the break type of /@c@/. /@c@/ should be a Unicode character
(to derive a character from UTF-8 encoded text, use
'GI.GLib.Functions.utf8GetChar'). The break type is used to find word and line
breaks (\"text boundaries\"), Pango implements the Unicode boundary
resolution algorithms and normally you would use a function such
as @/pango_break()/@ instead of caring about break types yourself.
-}
unicharBreakType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    {- ^ /@c@/: a Unicode character -}
    -> m GLib.Enums.UnicodeBreakType
    {- ^ __Returns:__ the break type of /@c@/ -}
unicharBreakType c = liftIO $ do
    let c' = (fromIntegral . ord) c
    result <- g_unichar_break_type c'
    let result' = (toEnum . fromIntegral) result
    return result'


-- function g_try_realloc_n
-- Args : [Arg {argCName = "mem", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "previously-allocated memory, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_blocks", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of blocks to allocate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_block_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each block in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_realloc_n" g_try_realloc_n ::
    Ptr () ->                               -- mem : TBasicType TPtr
    Word64 ->                               -- n_blocks : TBasicType TUInt64
    Word64 ->                               -- n_block_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
This function is similar to 'GI.GLib.Functions.tryRealloc', allocating (/@nBlocks@/ * /@nBlockBytes@/) bytes,
but care is taken to detect possible overflow during multiplication.

/Since: 2.24/
-}
tryReallocN ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@mem@/: previously-allocated memory, or 'Nothing'. -}
    -> Word64
    {- ^ /@nBlocks@/: the number of blocks to allocate -}
    -> Word64
    {- ^ /@nBlockBytes@/: the size of each block in bytes -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing'. -}
tryReallocN mem nBlocks nBlockBytes = liftIO $ do
    result <- g_try_realloc_n mem nBlocks nBlockBytes
    return result


-- function g_try_realloc
-- Args : [Arg {argCName = "mem", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "previously-allocated memory, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of bytes to allocate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_realloc" g_try_realloc ::
    Ptr () ->                               -- mem : TBasicType TPtr
    Word64 ->                               -- n_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
Attempts to realloc /@mem@/ to a new size, /@nBytes@/, and returns 'Nothing'
on failure. Contrast with 'GI.GLib.Functions.realloc', which aborts the program
on failure.

If /@mem@/ is 'Nothing', behaves the same as 'GI.GLib.Functions.tryMalloc'.
-}
tryRealloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@mem@/: previously-allocated memory, or 'Nothing'. -}
    -> Word64
    {- ^ /@nBytes@/: number of bytes to allocate. -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing'. -}
tryRealloc mem nBytes = liftIO $ do
    result <- g_try_realloc mem nBytes
    return result


-- function g_try_malloc_n
-- Args : [Arg {argCName = "n_blocks", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of blocks to allocate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_block_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each block in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_malloc_n" g_try_malloc_n ::
    Word64 ->                               -- n_blocks : TBasicType TUInt64
    Word64 ->                               -- n_block_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
This function is similar to 'GI.GLib.Functions.tryMalloc', allocating (/@nBlocks@/ * /@nBlockBytes@/) bytes,
but care is taken to detect possible overflow during multiplication.

/Since: 2.24/
-}
tryMallocN ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@nBlocks@/: the number of blocks to allocate -}
    -> Word64
    {- ^ /@nBlockBytes@/: the size of each block in bytes -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing'. -}
tryMallocN nBlocks nBlockBytes = liftIO $ do
    result <- g_try_malloc_n nBlocks nBlockBytes
    return result


-- function g_try_malloc0_n
-- Args : [Arg {argCName = "n_blocks", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of blocks to allocate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_block_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each block in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_malloc0_n" g_try_malloc0_n ::
    Word64 ->                               -- n_blocks : TBasicType TUInt64
    Word64 ->                               -- n_block_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
This function is similar to 'GI.GLib.Functions.tryMalloc0', allocating (/@nBlocks@/ * /@nBlockBytes@/) bytes,
but care is taken to detect possible overflow during multiplication.

/Since: 2.24/
-}
tryMalloc0N ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@nBlocks@/: the number of blocks to allocate -}
    -> Word64
    {- ^ /@nBlockBytes@/: the size of each block in bytes -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing' -}
tryMalloc0N nBlocks nBlockBytes = liftIO $ do
    result <- g_try_malloc0_n nBlocks nBlockBytes
    return result


-- function g_try_malloc0
-- Args : [Arg {argCName = "n_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of bytes to allocate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_malloc0" g_try_malloc0 ::
    Word64 ->                               -- n_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
Attempts to allocate /@nBytes@/, initialized to 0\'s, and returns 'Nothing' on
failure. Contrast with 'GI.GLib.Functions.malloc0', which aborts the program on failure.

/Since: 2.8/
-}
tryMalloc0 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@nBytes@/: number of bytes to allocate -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing' -}
tryMalloc0 nBytes = liftIO $ do
    result <- g_try_malloc0 nBytes
    return result


-- function g_try_malloc
-- Args : [Arg {argCName = "n_bytes", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of bytes to allocate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "g_try_malloc" g_try_malloc ::
    Word64 ->                               -- n_bytes : TBasicType TUInt64
    IO (Ptr ())

{- |
Attempts to allocate /@nBytes@/, and returns 'Nothing' on failure.
Contrast with 'GI.GLib.Functions.malloc', which aborts the program on failure.
-}
tryMalloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@nBytes@/: number of bytes to allocate. -}
    -> m (Ptr ())
    {- ^ __Returns:__ the allocated memory, or 'Nothing'. -}
tryMalloc nBytes = liftIO $ do
    result <- g_try_malloc nBytes
    return result


-- function g_timeout_source_new_seconds
-- Args : [Arg {argCName = "interval", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the timeout interval in seconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Source"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_timeout_source_new_seconds" g_timeout_source_new_seconds ::
    Word32 ->                               -- interval : TBasicType TUInt
    IO (Ptr GLib.Source.Source)

{- |
Creates a new timeout source.

The source will not initially be associated with any 'GI.GLib.Structs.MainContext.MainContext'
and must be added to one with 'GI.GLib.Structs.Source.sourceAttach' before it will be
executed.

The scheduling granularity\/accuracy of this timeout source will be
in seconds.

The interval given is in terms of monotonic time, not wall clock time.
See 'GI.GLib.Functions.getMonotonicTime'.

/Since: 2.14/
-}
timeoutSourceNewSeconds ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@interval@/: the timeout interval in seconds -}
    -> m GLib.Source.Source
    {- ^ __Returns:__ the newly-created timeout source -}
timeoutSourceNewSeconds interval = liftIO $ do
    result <- g_timeout_source_new_seconds interval
    checkUnexpectedReturnNULL "timeoutSourceNewSeconds" result
    result' <- (wrapBoxed GLib.Source.Source) result
    return result'


-- function g_timeout_source_new
-- Args : [Arg {argCName = "interval", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the timeout interval in milliseconds.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Source"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_timeout_source_new" g_timeout_source_new ::
    Word32 ->                               -- interval : TBasicType TUInt
    IO (Ptr GLib.Source.Source)

{- |
Creates a new timeout source.

The source will not initially be associated with any 'GI.GLib.Structs.MainContext.MainContext'
and must be added to one with 'GI.GLib.Structs.Source.sourceAttach' before it will be
executed.

The interval given is in terms of monotonic time, not wall clock
time.  See 'GI.GLib.Functions.getMonotonicTime'.
-}
timeoutSourceNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@interval@/: the timeout interval in milliseconds. -}
    -> m GLib.Source.Source
    {- ^ __Returns:__ the newly-created timeout source -}
timeoutSourceNew interval = liftIO $ do
    result <- g_timeout_source_new interval
    checkUnexpectedReturnNULL "timeoutSourceNew" result
    result' <- (wrapBoxed GLib.Source.Source) result
    return result'


-- function g_timeout_add_seconds_full
-- Args : [Arg {argCName = "priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the priority of the timeout source. Typically this will be in\n           the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time between calls to the function, in seconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TInterface (Name {namespace = "GLib", name = "SourceFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function to call", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "function to call when the timeout is removed, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_timeout_add_seconds_full" g_timeout_add_seconds_full ::
    Int32 ->                                -- priority : TBasicType TInt
    Word32 ->                               -- interval : TBasicType TUInt
    FunPtr GLib.Callbacks.C_SourceFunc ->   -- function : TInterface (Name {namespace = "GLib", name = "SourceFunc"})
    Ptr () ->                               -- data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO Word32

{- |
Sets a function to be called at regular intervals, with /@priority@/.
The function is called repeatedly until it returns 'False', at which
point the timeout is automatically destroyed and the function will
not be called again.

Unlike @/g_timeout_add()/@, this function operates at whole second granularity.
The initial starting point of the timer is determined by the implementation
and the implementation is expected to group multiple timers together so that
they fire all at the same time.
To allow this grouping, the /@interval@/ to the first timer is rounded
and can deviate up to one second from the specified interval.
Subsequent timer iterations will generally run at the specified interval.

Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given /@interval@/

See [memory management of sources][mainloop-memory-management] for details
on how to handle the return value and memory management of /@data@/.

If you want timing more precise than whole seconds, use @/g_timeout_add()/@
instead.

The grouping of timers to fire at the same time results in a more power
and CPU efficient behavior so if your timer is in multiples of seconds
and you don\'t require the first timer exactly one second from now, the
use of @/g_timeout_add_seconds()/@ is preferred over @/g_timeout_add()/@.

This internally creates a main loop source using
'GI.GLib.Functions.timeoutSourceNewSeconds' and attaches it to the main loop context
using 'GI.GLib.Structs.Source.sourceAttach'. You can do these steps manually if you need
greater control.

The interval given is in terms of monotonic time, not wall clock
time.  See 'GI.GLib.Functions.getMonotonicTime'.

/Since: 2.14/
-}
timeoutAddSeconds ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@priority@/: the priority of the timeout source. Typically this will be in
           the range between 'GI.GLib.Constants.PRIORITY_DEFAULT' and 'GI.GLib.Constants.PRIORITY_HIGH'. -}
    -> Word32
    {- ^ /@interval@/: the time between calls to the function, in seconds -}
    -> GLib.Callbacks.SourceFunc
    {- ^ /@function@/: function to call -}
    -> m Word32
    {- ^ __Returns:__ the ID (greater than 0) of the event source. -}
timeoutAddSeconds priority interval function = liftIO $ do
    function' <- GLib.Callbacks.mk_SourceFunc (GLib.Callbacks.wrap_SourceFunc Nothing (GLib.Callbacks.drop_closures_SourceFunc function))
    let data_ = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- g_timeout_add_seconds_full priority interval function' data_ notify
    return result


-- function g_timeout_add_full
-- Args : [Arg {argCName = "priority", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the priority of the timeout source. Typically this will be in\n           the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the time between calls to the function, in milliseconds\n            (1/1000ths of a second)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TInterface (Name {namespace = "GLib", name = "SourceFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function to call", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "function to call when the timeout is removed, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_timeout_add_full" g_timeout_add_full ::
    Int32 ->                                -- priority : TBasicType TInt
    Word32 ->                               -- interval : TBasicType TUInt
    FunPtr GLib.Callbacks.C_SourceFunc ->   -- function : TInterface (Name {namespace = "GLib", name = "SourceFunc"})
    Ptr () ->                               -- data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO Word32

{- |
Sets a function to be called at regular intervals, with the given
priority.  The function is called repeatedly until it returns
'False', at which point the timeout is automatically destroyed and
the function will not be called again.  The /@notify@/ function is
called when the timeout is destroyed.  The first call to the
function will be at the end of the first /@interval@/.

Note that timeout functions may be delayed, due to the processing of other
event sources. Thus they should not be relied on for precise timing.
After each call to the timeout function, the time of the next
timeout is recalculated based on the current time and the given interval
(it does not try to \'catch up\' time lost in delays).

See [memory management of sources][mainloop-memory-management] for details
on how to handle the return value and memory management of /@data@/.

This internally creates a main loop source using 'GI.GLib.Functions.timeoutSourceNew'
and attaches it to the global 'GI.GLib.Structs.MainContext.MainContext' using 'GI.GLib.Structs.Source.sourceAttach', so
the callback will be invoked in whichever thread is running that main
context. You can do these steps manually if you need greater control or to
use a custom main context.

The interval given is in terms of monotonic time, not wall clock time.
See 'GI.GLib.Functions.getMonotonicTime'.
-}
timeoutAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@priority@/: the priority of the timeout source. Typically this will be in
           the range between 'GI.GLib.Constants.PRIORITY_DEFAULT' and 'GI.GLib.Constants.PRIORITY_HIGH'. -}
    -> Word32
    {- ^ /@interval@/: the time between calls to the function, in milliseconds
            (1\/1000ths of a second) -}
    -> GLib.Callbacks.SourceFunc
    {- ^ /@function@/: function to call -}
    -> m Word32
    {- ^ __Returns:__ the ID (greater than 0) of the event source. -}
timeoutAdd priority interval function = liftIO $ do
    function' <- GLib.Callbacks.mk_SourceFunc (GLib.Callbacks.wrap_SourceFunc Nothing (GLib.Callbacks.drop_closures_SourceFunc function))
    let data_ = castFunPtrToPtr function'
    let notify = safeFreeFunPtrPtr
    result <- g_timeout_add_full priority interval function' data_ notify
    return result


-- function g_test_trap_subprocess
-- Args : [Arg {argCName = "test_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Test to run in a subprocess", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "usec_timeout", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Timeout for the subprocess test in micro seconds.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "test_flags", argType = TInterface (Name {namespace = "GLib", name = "TestSubprocessFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags to modify subprocess behaviour.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_trap_subprocess" g_test_trap_subprocess ::
    CString ->                              -- test_path : TBasicType TUTF8
    Word64 ->                               -- usec_timeout : TBasicType TUInt64
    CUInt ->                                -- test_flags : TInterface (Name {namespace = "GLib", name = "TestSubprocessFlags"})
    IO ()

{- |
Respawns the test program to run only /@testPath@/ in a subprocess.
This can be used for a test case that might not return, or that
might abort.

If /@testPath@/ is 'Nothing' then the same test is re-run in a subprocess.
You can use 'GI.GLib.Functions.testSubprocess' to determine whether the test is in
a subprocess or not.

/@testPath@/ can also be the name of the parent test, followed by
\"@\/subprocess\/@\" and then a name for the specific subtest (or just
ending with \"@\/subprocess@\" if the test only has one child test);
tests with names of this form will automatically be skipped in the
parent process.

If /@usecTimeout@/ is non-0, the test subprocess is aborted and
considered failing if its run time exceeds it.

The subprocess behavior can be configured with the
'GI.GLib.Flags.TestSubprocessFlags' flags.

You can use methods such as @/g_test_trap_assert_passed()/@,
@/g_test_trap_assert_failed()/@, and @/g_test_trap_assert_stderr()/@ to
check the results of the subprocess. (But note that
@/g_test_trap_assert_stdout()/@ and @/g_test_trap_assert_stderr()/@
cannot be used if /@testFlags@/ specifies that the child should
inherit the parent stdout\/stderr.)

If your @main ()@ needs to behave differently in
the subprocess, you can call 'GI.GLib.Functions.testSubprocess' (after calling
@/g_test_init()/@) to see whether you are in a subprocess.

The following example tests that calling
@my_object_new(1000000)@ will abort with an error
message.


=== /C code/
>
>  static void
>  test_create_large_object (void)
>  {
>    if (g_test_subprocess ())
>      {
>        my_object_new (1000000);
>        return;
>      }
>
>    // Reruns this same test in a subprocess
>    g_test_trap_subprocess (NULL, 0, 0);
>    g_test_trap_assert_failed ();
>    g_test_trap_assert_stderr ("*ERROR*too large*");
>  }
>
>  int
>  main (int argc, char **argv)
>  {
>    g_test_init (&argc, &argv, NULL);
>
>    g_test_add_func ("/myobject/create_large_object",
>                     test_create_large_object);
>    return g_test_run ();
>  }


/Since: 2.38/
-}
testTrapSubprocess ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@testPath@/: Test to run in a subprocess -}
    -> Word64
    {- ^ /@usecTimeout@/: Timeout for the subprocess test in micro seconds. -}
    -> [GLib.Flags.TestSubprocessFlags]
    {- ^ /@testFlags@/: Flags to modify subprocess behaviour. -}
    -> m ()
testTrapSubprocess testPath usecTimeout testFlags = liftIO $ do
    maybeTestPath <- case testPath of
        Nothing -> return nullPtr
        Just jTestPath -> do
            jTestPath' <- textToCString jTestPath
            return jTestPath'
    let testFlags' = gflagsToWord testFlags
    g_test_trap_subprocess maybeTestPath usecTimeout testFlags'
    freeMem maybeTestPath
    return ()


-- function g_test_trap_reached_timeout
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_trap_reached_timeout" g_test_trap_reached_timeout ::
    IO CInt

{- |
Check the result of the last 'GI.GLib.Functions.testTrapSubprocess' call.

/Since: 2.16/
-}
testTrapReachedTimeout ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if the last test subprocess got killed due to a timeout. -}
testTrapReachedTimeout  = liftIO $ do
    result <- g_test_trap_reached_timeout
    let result' = (/= 0) result
    return result'


-- function g_test_trap_has_passed
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_trap_has_passed" g_test_trap_has_passed ::
    IO CInt

{- |
Check the result of the last 'GI.GLib.Functions.testTrapSubprocess' call.

/Since: 2.16/
-}
testTrapHasPassed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if the last test subprocess terminated successfully. -}
testTrapHasPassed  = liftIO $ do
    result <- g_test_trap_has_passed
    let result' = (/= 0) result
    return result'


-- function g_test_trap_fork
-- Args : [Arg {argCName = "usec_timeout", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Timeout for the forked test in micro seconds.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "test_trap_flags", argType = TInterface (Name {namespace = "GLib", name = "TestTrapFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Flags to modify forking behaviour.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_trap_fork" g_test_trap_fork ::
    Word64 ->                               -- usec_timeout : TBasicType TUInt64
    CUInt ->                                -- test_trap_flags : TInterface (Name {namespace = "GLib", name = "TestTrapFlags"})
    IO CInt

{-# DEPRECATED testTrapFork ["This function is implemented only on Unix platforms,","and is not always reliable due to problems inherent in","fork-without-exec. Use 'GI.GLib.Functions.testTrapSubprocess' instead."] #-}
{- |
Fork the current test program to execute a test case that might
not return or that might abort.

If /@usecTimeout@/ is non-0, the forked test case is aborted and
considered failing if its run time exceeds it.

The forking behavior can be configured with the 'GI.GLib.Flags.TestTrapFlags' flags.

In the following example, the test code forks, the forked child
process produces some sample output and exits successfully.
The forking parent process then asserts successful child program
termination and validates child program outputs.


=== /C code/
>
>  static void
>  test_fork_patterns (void)
>  {
>    if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
>      {
>        g_print ("some stdout text: somagic17\n");
>        g_printerr ("some stderr text: semagic43\n");
>        exit (0); // successful test run
>      }
>    g_test_trap_assert_passed ();
>    g_test_trap_assert_stdout ("*somagic17*");
>    g_test_trap_assert_stderr ("*semagic43*");
>  }


/Since: 2.16/
-}
testTrapFork ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@usecTimeout@/: Timeout for the forked test in micro seconds. -}
    -> [GLib.Flags.TestTrapFlags]
    {- ^ /@testTrapFlags@/: Flags to modify forking behaviour. -}
    -> m Bool
    {- ^ __Returns:__ 'True' for the forked child and 'False' for the executing parent process. -}
testTrapFork usecTimeout testTrapFlags = liftIO $ do
    let testTrapFlags' = gflagsToWord testTrapFlags
    result <- g_test_trap_fork usecTimeout testTrapFlags'
    let result' = (/= 0) result
    return result'


-- function g_test_trap_assertions
-- Args : [Arg {argCName = "domain", 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 = "file", 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 = "line", 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 = "func", 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 = "assertion_flags", 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 = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, 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 "g_test_trap_assertions" g_test_trap_assertions ::
    CString ->                              -- domain : TBasicType TUTF8
    CString ->                              -- file : TBasicType TUTF8
    Int32 ->                                -- line : TBasicType TInt
    CString ->                              -- func : TBasicType TUTF8
    Word64 ->                               -- assertion_flags : TBasicType TUInt64
    CString ->                              -- pattern : TBasicType TUTF8
    IO ()

{- |
/No description available in the introspection data./
-}
testTrapAssertions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> T.Text
    -> Int32
    -> T.Text
    -> Word64
    -> T.Text
    -> m ()
testTrapAssertions domain file line func assertionFlags pattern = liftIO $ do
    domain' <- textToCString domain
    file' <- textToCString file
    func' <- textToCString func
    pattern' <- textToCString pattern
    g_test_trap_assertions domain' file' line func' assertionFlags pattern'
    freeMem domain'
    freeMem file'
    freeMem func'
    freeMem pattern'
    return ()


-- function g_test_timer_start
-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_timer_start" g_test_timer_start ::
    IO ()

{- |
Start a timing test. Call 'GI.GLib.Functions.testTimerElapsed' when the task is supposed
to be done. Call this function again to restart the timer.

/Since: 2.16/
-}
testTimerStart ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
testTimerStart  = liftIO $ do
    g_test_timer_start
    return ()


-- function g_test_timer_last
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_timer_last" g_test_timer_last ::
    IO CDouble

{- |
Report the last result of 'GI.GLib.Functions.testTimerElapsed'.

/Since: 2.16/
-}
testTimerLast ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Double
    {- ^ __Returns:__ the last result of 'GI.GLib.Functions.testTimerElapsed', as a double -}
testTimerLast  = liftIO $ do
    result <- g_test_timer_last
    let result' = realToFrac result
    return result'


-- function g_test_timer_elapsed
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_timer_elapsed" g_test_timer_elapsed ::
    IO CDouble

{- |
Get the time since the last start of the timer with 'GI.GLib.Functions.testTimerStart'.

/Since: 2.16/
-}
testTimerElapsed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Double
    {- ^ __Returns:__ the time since the last start of the timer, as a double -}
testTimerElapsed  = liftIO $ do
    result <- g_test_timer_elapsed
    let result' = realToFrac result
    return result'


-- function g_test_subprocess
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_subprocess" g_test_subprocess ::
    IO CInt

{- |
Returns 'True' (after @/g_test_init()/@ has been called) if the test
program is running under 'GI.GLib.Functions.testTrapSubprocess'.

/Since: 2.38/
-}
testSubprocess ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if the test program is running under
'GI.GLib.Functions.testTrapSubprocess'. -}
testSubprocess  = liftIO $ do
    result <- g_test_subprocess
    let result' = (/= 0) result
    return result'


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

foreign import ccall "g_test_skip" g_test_skip ::
    CString ->                              -- msg : TBasicType TUTF8
    IO ()

{- |
Indicates that a test was skipped.

Calling this function will not stop the test from running, you
need to return from the test function yourself. So you can
produce additional diagnostic messages or even continue running
the test.

If not called from inside a test, this function does nothing.

/Since: 2.38/
-}
testSkip ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@msg@/: explanation -}
    -> m ()
testSkip msg = liftIO $ do
    maybeMsg <- case msg of
        Nothing -> return nullPtr
        Just jMsg -> do
            jMsg' <- textToCString jMsg
            return jMsg'
    g_test_skip maybeMsg
    freeMem maybeMsg
    return ()


-- function g_test_set_nonfatal_assertions
-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_set_nonfatal_assertions" g_test_set_nonfatal_assertions ::
    IO ()

{- |
Changes the behaviour of @/g_assert_cmpstr()/@, @/g_assert_cmpint()/@,
@/g_assert_cmpuint()/@, @/g_assert_cmphex()/@, @/g_assert_cmpfloat()/@,
@/g_assert_true()/@, @/g_assert_false()/@, @/g_assert_null()/@, @/g_assert_no_error()/@,
@/g_assert_error()/@, @/g_test_assert_expected_messages()/@ and the various
g_test_trap_assert_*() macros to not abort to program, but instead
call 'GI.GLib.Functions.testFail' and continue. (This also changes the behavior of
'GI.GLib.Functions.testFail' so that it will not cause the test program to abort
after completing the failed test.)

Note that the @/g_assert_not_reached()/@ and @/g_assert()/@ are not
affected by this.

This function can only be called after @/g_test_init()/@.

/Since: 2.38/
-}
testSetNonfatalAssertions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
testSetNonfatalAssertions  = liftIO $ do
    g_test_set_nonfatal_assertions
    return ()


-- function g_test_run_suite
-- Args : [Arg {argCName = "suite", argType = TInterface (Name {namespace = "GLib", name = "TestSuite"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GTestSuite", 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 "g_test_run_suite" g_test_run_suite ::
    Ptr GLib.TestSuite.TestSuite ->         -- suite : TInterface (Name {namespace = "GLib", name = "TestSuite"})
    IO Int32

{- |
Execute the tests within /@suite@/ and all nested @/GTestSuites/@.
The test suites to be executed are filtered according to
test path arguments (@-p testpath@ and @-s testpath@) as parsed by
@/g_test_init()/@. See the 'GI.GLib.Functions.testRun' documentation for more
information on the order that tests are run in.

'GI.GLib.Functions.testRunSuite' or 'GI.GLib.Functions.testRun' may only be called once
in a program.

/Since: 2.16/
-}
testRunSuite ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.TestSuite.TestSuite
    {- ^ /@suite@/: a 'GI.GLib.Structs.TestSuite.TestSuite' -}
    -> m Int32
    {- ^ __Returns:__ 0 on success -}
testRunSuite suite = liftIO $ do
    suite' <- unsafeManagedPtrGetPtr suite
    result <- g_test_run_suite suite'
    touchManagedPtr suite
    return result


-- function g_test_run
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_run" g_test_run ::
    IO Int32

{- |
Runs all tests under the toplevel suite which can be retrieved
with @/g_test_get_root()/@. Similar to 'GI.GLib.Functions.testRunSuite', the test
cases to be run are filtered according to test path arguments
(@-p testpath@ and @-s testpath@) as parsed by @/g_test_init()/@.
'GI.GLib.Functions.testRunSuite' or 'GI.GLib.Functions.testRun' may only be called once in a
program.

In general, the tests and sub-suites within each suite are run in
the order in which they are defined. However, note that prior to
GLib 2.36, there was a bug in the @g_test_add_*@
functions which caused them to create multiple suites with the same
name, meaning that if you created tests \"\/foo\/simple\",
\"\/bar\/simple\", and \"\/foo\/using-bar\" in that order, they would get
run in that order (since 'GI.GLib.Functions.testRun' would run the first \"\/foo\"
suite, then the \"\/bar\" suite, then the second \"\/foo\" suite). As of
2.36, this bug is fixed, and adding the tests in that order would
result in a running order of \"\/foo\/simple\", \"\/foo\/using-bar\",
\"\/bar\/simple\". If this new ordering is sub-optimal (because it puts
more-complicated tests before simpler ones, making it harder to
figure out exactly what has failed), you can fix it by changing the
test paths to group tests by suite in a way that will result in the
desired running order. Eg, \"\/simple\/foo\", \"\/simple\/bar\",
\"\/complex\/foo-using-bar\".

However, you should never make the actual result of a test depend
on the order that tests are run in. If you need to ensure that some
particular code runs before or after a given test case, use
@/g_test_add()/@, which lets you specify setup and teardown functions.

If all tests are skipped or marked as incomplete (expected failures),
this function will return 0 if producing TAP output, or 77 (treated
as \"skip test\" by Automake) otherwise.

/Since: 2.16/
-}
testRun ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    {- ^ __Returns:__ 0 on success, 1 on failure (assuming it returns at all),
  0 or 77 if all tests were skipped with 'GI.GLib.Functions.testSkip' and\/or
  'GI.GLib.Functions.testIncomplete' -}
testRun  = liftIO $ do
    result <- g_test_run
    return result


-- function g_test_rand_int_range
-- Args : [Arg {argCName = "begin", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum value returned by this function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the smallest value not to be returned by this function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_rand_int_range" g_test_rand_int_range ::
    Int32 ->                                -- begin : TBasicType TInt32
    Int32 ->                                -- end : TBasicType TInt32
    IO Int32

{- |
Get a reproducible random integer number out of a specified range,
see 'GI.GLib.Functions.testRandInt' for details on test case random numbers.

/Since: 2.16/
-}
testRandIntRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@begin@/: the minimum value returned by this function -}
    -> Int32
    {- ^ /@end@/: the smallest value not to be returned by this function -}
    -> m Int32
    {- ^ __Returns:__ a number with /@begin@/ \<= number \< /@end@/. -}
testRandIntRange begin end = liftIO $ do
    result <- g_test_rand_int_range begin end
    return result


-- function g_test_rand_int
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_rand_int" g_test_rand_int ::
    IO Int32

{- |
Get a reproducible random integer number.

The random numbers generated by the g_test_rand_*() family of functions
change with every new test program start, unless the --seed option is
given when starting test programs.

For individual test cases however, the random number generator is
reseeded, to avoid dependencies between tests and to make --seed
effective for all test cases.

/Since: 2.16/
-}
testRandInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    {- ^ __Returns:__ a random number from the seeded random number generator. -}
testRandInt  = liftIO $ do
    result <- g_test_rand_int
    return result


-- function g_test_rand_double_range
-- Args : [Arg {argCName = "range_start", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum value returned by this function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "range_end", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimum value not returned by this function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_rand_double_range" g_test_rand_double_range ::
    CDouble ->                              -- range_start : TBasicType TDouble
    CDouble ->                              -- range_end : TBasicType TDouble
    IO CDouble

{- |
Get a reproducible random floating pointer number out of a specified range,
see 'GI.GLib.Functions.testRandInt' for details on test case random numbers.

/Since: 2.16/
-}
testRandDoubleRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    {- ^ /@rangeStart@/: the minimum value returned by this function -}
    -> Double
    {- ^ /@rangeEnd@/: the minimum value not returned by this function -}
    -> m Double
    {- ^ __Returns:__ a number with /@rangeStart@/ \<= number \< /@rangeEnd@/. -}
testRandDoubleRange rangeStart rangeEnd = liftIO $ do
    let rangeStart' = realToFrac rangeStart
    let rangeEnd' = realToFrac rangeEnd
    result <- g_test_rand_double_range rangeStart' rangeEnd'
    let result' = realToFrac result
    return result'


-- function g_test_rand_double
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_rand_double" g_test_rand_double ::
    IO CDouble

{- |
Get a reproducible random floating point number,
see 'GI.GLib.Functions.testRandInt' for details on test case random numbers.

/Since: 2.16/
-}
testRandDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Double
    {- ^ __Returns:__ a random number from the seeded random number generator. -}
testRandDouble  = liftIO $ do
    result <- g_test_rand_double
    let result' = realToFrac result
    return result'


-- function g_test_queue_free
-- Args : [Arg {argCName = "gfree_pointer", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the pointer to be stored.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_queue_free" g_test_queue_free ::
    Ptr () ->                               -- gfree_pointer : TBasicType TPtr
    IO ()

{- |
Enqueue a pointer to be released with 'GI.GLib.Functions.free' during the next
teardown phase. This is equivalent to calling 'GI.GLib.Functions.testQueueDestroy'
with a destroy callback of 'GI.GLib.Functions.free'.

/Since: 2.16/
-}
testQueueFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@gfreePointer@/: the pointer to be stored. -}
    -> m ()
testQueueFree gfreePointer = liftIO $ do
    g_test_queue_free gfreePointer
    return ()


-- function g_test_queue_destroy
-- Args : [Arg {argCName = "destroy_func", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Destroy callback for teardown phase.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Destroy callback data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_queue_destroy" g_test_queue_destroy ::
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_func : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    Ptr () ->                               -- destroy_data : TBasicType TPtr
    IO ()

{- |
This function enqueus a callback /@destroyFunc@/ to be executed
during the next test case teardown phase. This is most useful
to auto destruct allocated test resources at the end of a test run.
Resources are released in reverse queue order, that means enqueueing
callback A before callback B will cause @/B()/@ to be called before
@/A()/@ during teardown.

/Since: 2.16/
-}
testQueueDestroy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Callbacks.DestroyNotify
    {- ^ /@destroyFunc@/: Destroy callback for teardown phase. -}
    -> Ptr ()
    {- ^ /@destroyData@/: Destroy callback data. -}
    -> m ()
testQueueDestroy destroyFunc destroyData = liftIO $ do
    ptrdestroyFunc <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_DestroyNotify))
    destroyFunc' <- GLib.Callbacks.mk_DestroyNotify (GLib.Callbacks.wrap_DestroyNotify (Just ptrdestroyFunc) destroyFunc)
    poke ptrdestroyFunc destroyFunc'
    g_test_queue_destroy destroyFunc' destroyData
    return ()


-- function g_test_log_type_name
-- Args : [Arg {argCName = "log_type", argType = TInterface (Name {namespace = "GLib", name = "TestLogType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_log_type_name" g_test_log_type_name ::
    CUInt ->                                -- log_type : TInterface (Name {namespace = "GLib", name = "TestLogType"})
    IO CString

{- |
/No description available in the introspection data./
-}
testLogTypeName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.TestLogType
    -> m T.Text
testLogTypeName logType = liftIO $ do
    let logType' = (fromIntegral . fromEnum) logType
    result <- g_test_log_type_name logType'
    checkUnexpectedReturnNULL "testLogTypeName" result
    result' <- cstringToText result
    return result'


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

foreign import ccall "g_test_incomplete" g_test_incomplete ::
    CString ->                              -- msg : TBasicType TUTF8
    IO ()

{- |
Indicates that a test failed because of some incomplete
functionality. This function can be called multiple times
from the same test.

Calling this function will not stop the test from running, you
need to return from the test function yourself. So you can
produce additional diagnostic messages or even continue running
the test.

If not called from inside a test, this function does nothing.

/Since: 2.38/
-}
testIncomplete ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@msg@/: explanation -}
    -> m ()
testIncomplete msg = liftIO $ do
    maybeMsg <- case msg of
        Nothing -> return nullPtr
        Just jMsg -> do
            jMsg' <- textToCString jMsg
            return jMsg'
    g_test_incomplete maybeMsg
    freeMem maybeMsg
    return ()


-- function g_test_get_dir
-- Args : [Arg {argCName = "file_type", argType = TInterface (Name {namespace = "GLib", name = "TestFileType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of file (built vs. distributed)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TFileName)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_get_dir" g_test_get_dir ::
    CUInt ->                                -- file_type : TInterface (Name {namespace = "GLib", name = "TestFileType"})
    IO CString

{- |
Gets the pathname of the directory containing test files of the type
specified by /@fileType@/.

This is approximately the same as calling g_test_build_filename(\".\"),
but you don\'t need to free the return value.

/Since: 2.38/
-}
testGetDir ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.TestFileType
    {- ^ /@fileType@/: the type of file (built vs. distributed) -}
    -> m [Char]
    {- ^ __Returns:__ the path of the directory, owned by GLib -}
testGetDir fileType = liftIO $ do
    let fileType' = (fromIntegral . fromEnum) fileType
    result <- g_test_get_dir fileType'
    checkUnexpectedReturnNULL "testGetDir" result
    result' <- cstringToString result
    return result'


-- function g_test_failed
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_test_failed" g_test_failed ::
    IO CInt

{- |
Returns whether a test has already failed. This will
be the case when 'GI.GLib.Functions.testFail', 'GI.GLib.Functions.testIncomplete'
or 'GI.GLib.Functions.testSkip' have been called, but also if an
assertion has failed.

This can be useful to return early from a test if
continuing after a failed assertion might be harmful.

The return value of this function is only meaningful
if it is called from inside a test function.

/Since: 2.38/
-}
testFailed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if the test has failed -}
testFailed  = liftIO $ do
    result <- g_test_failed
    let result' = (/= 0) result
    return result'


-- function g_test_fail
-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_fail" g_test_fail ::
    IO ()

{- |
Indicates that a test failed. This function can be called
multiple times from the same test. You can use this function
if your test failed in a recoverable way.

Do not use this function if the failure of a test could cause
other tests to malfunction.

Calling this function will not stop the test from running, you
need to return from the test function yourself. So you can
produce additional diagnostic messages or even continue running
the test.

If not called from inside a test, this function does nothing.

/Since: 2.30/
-}
testFail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
testFail  = liftIO $ do
    g_test_fail
    return ()


-- function g_test_expect_message
-- Args : [Arg {argCName = "log_domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the log domain of the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "log_level", argType = TInterface (Name {namespace = "GLib", name = "LogLevelFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the log level of the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a glob-style [pattern][glib-Glob-style-pattern-matching]", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_expect_message" g_test_expect_message ::
    CString ->                              -- log_domain : TBasicType TUTF8
    CInt ->                                 -- log_level : TInterface (Name {namespace = "GLib", name = "LogLevelFlags"})
    CString ->                              -- pattern : TBasicType TUTF8
    IO ()

{- |
Indicates that a message with the given /@logDomain@/ and /@logLevel@/,
with text matching /@pattern@/, is expected to be logged. When this
message is logged, it will not be printed, and the test case will
not abort.

This API may only be used with the old logging API (@/g_log()/@ without
@/G_LOG_USE_STRUCTURED/@ defined). It will not work with the structured logging
API. See [Testing for Messages][testing-for-messages].

Use @/g_test_assert_expected_messages()/@ to assert that all
previously-expected messages have been seen and suppressed.

You can call this multiple times in a row, if multiple messages are
expected as a result of a single call. (The messages must appear in
the same order as the calls to 'GI.GLib.Functions.testExpectMessage'.)

For example:


=== /C code/
>
>  // g_main_context_push_thread_default() should fail if the
>  // context is already owned by another thread.
>  g_test_expect_message (G_LOG_DOMAIN,
>                         G_LOG_LEVEL_CRITICAL,
>                         "assertion*acquired_context*failed");
>  g_main_context_push_thread_default (bad_context);
>  g_test_assert_expected_messages ();


Note that you cannot use this to test @/g_error()/@ messages, since
@/g_error()/@ intentionally never returns even if the program doesn\'t
abort; use 'GI.GLib.Functions.testTrapSubprocess' in this case.

If messages at 'GI.GLib.Flags.LogLevelFlagsLevelDebug' are emitted, but not explicitly
expected via 'GI.GLib.Functions.testExpectMessage' then they will be ignored.

/Since: 2.34/
-}
testExpectMessage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    {- ^ /@logDomain@/: the log domain of the message -}
    -> [GLib.Flags.LogLevelFlags]
    {- ^ /@logLevel@/: the log level of the message -}
    -> T.Text
    {- ^ /@pattern@/: a glob-style [pattern][glib-Glob-style-pattern-matching] -}
    -> m ()
testExpectMessage logDomain logLevel pattern = liftIO $ do
    maybeLogDomain <- case logDomain of
        Nothing -> return nullPtr
        Just jLogDomain -> do
            jLogDomain' <- textToCString jLogDomain
            return jLogDomain'
    let logLevel' = gflagsToWord logLevel
    pattern' <- textToCString pattern
    g_test_expect_message maybeLogDomain logLevel' pattern'
    freeMem maybeLogDomain
    freeMem pattern'
    return ()


-- function g_test_bug_base
-- Args : [Arg {argCName = "uri_pattern", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the base pattern for bug URIs", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_bug_base" g_test_bug_base ::
    CString ->                              -- uri_pattern : TBasicType TUTF8
    IO ()

{- |
Specify the base URI for bug reports.

The base URI is used to construct bug report messages for
@/g_test_message()/@ when 'GI.GLib.Functions.testBug' is called.
Calling this function outside of a test case sets the
default base URI for all test cases. Calling it from within
a test case changes the base URI for the scope of the test
case only.
Bug URIs are constructed by appending a bug specific URI
portion to /@uriPattern@/, or by replacing the special string
\'%s\' within /@uriPattern@/ if that is present.

/Since: 2.16/
-}
testBugBase ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@uriPattern@/: the base pattern for bug URIs -}
    -> m ()
testBugBase uriPattern = liftIO $ do
    uriPattern' <- textToCString uriPattern
    g_test_bug_base uriPattern'
    freeMem uriPattern'
    return ()


-- function g_test_bug
-- Args : [Arg {argCName = "bug_uri_snippet", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Bug specific bug tracker URI portion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_bug" g_test_bug ::
    CString ->                              -- bug_uri_snippet : TBasicType TUTF8
    IO ()

{- |
This function adds a message to test reports that
associates a bug URI with a test case.
Bug URIs are constructed from a base URI set with 'GI.GLib.Functions.testBugBase'
and /@bugUriSnippet@/.

/Since: 2.16/
-}
testBug ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@bugUriSnippet@/: Bug specific bug tracker URI portion. -}
    -> m ()
testBug bugUriSnippet = liftIO $ do
    bugUriSnippet' <- textToCString bugUriSnippet
    g_test_bug bugUriSnippet'
    freeMem bugUriSnippet'
    return ()


-- function g_test_assert_expected_messages_internal
-- Args : [Arg {argCName = "domain", 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 = "file", 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 = "line", 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 = "func", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, 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 "g_test_assert_expected_messages_internal" g_test_assert_expected_messages_internal ::
    CString ->                              -- domain : TBasicType TUTF8
    CString ->                              -- file : TBasicType TUTF8
    Int32 ->                                -- line : TBasicType TInt
    CString ->                              -- func : TBasicType TUTF8
    IO ()

{- |
/No description available in the introspection data./
-}
testAssertExpectedMessagesInternal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> T.Text
    -> Int32
    -> T.Text
    -> m ()
testAssertExpectedMessagesInternal domain file line func = liftIO $ do
    domain' <- textToCString domain
    file' <- textToCString file
    func' <- textToCString func
    g_test_assert_expected_messages_internal domain' file' line func'
    freeMem domain'
    freeMem file'
    freeMem func'
    return ()


-- function g_test_add_func
-- Args : [Arg {argCName = "testpath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "/-separated test case path name for the test.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "test_func", argType = TInterface (Name {namespace = "GLib", name = "TestFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The test function to invoke for this test.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_add_func" g_test_add_func ::
    CString ->                              -- testpath : TBasicType TUTF8
    FunPtr GLib.Callbacks.C_TestFunc ->     -- test_func : TInterface (Name {namespace = "GLib", name = "TestFunc"})
    IO ()

{- |
Create a new test case, similar to @/g_test_create_case()/@. However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of /@testpath@/.

If /@testpath@/ includes the component \"subprocess\" anywhere in it,
the test will be skipped by default, and only run if explicitly
required via the @-p@ command-line option or 'GI.GLib.Functions.testTrapSubprocess'.

No component of /@testpath@/ may start with a dot (@.@) if the
'GI.GLib.Constants.TEST_OPTION_ISOLATE_DIRS' option is being used; and it is recommended to
do so even if it isn’t.

/Since: 2.16/
-}
testAddFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@testpath@/: \/-separated test case path name for the test. -}
    -> GLib.Callbacks.TestFunc
    {- ^ /@testFunc@/: The test function to invoke for this test. -}
    -> m ()
testAddFunc testpath testFunc = liftIO $ do
    testpath' <- textToCString testpath
    ptrtestFunc <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_TestFunc))
    testFunc' <- GLib.Callbacks.mk_TestFunc (GLib.Callbacks.wrap_TestFunc (Just ptrtestFunc) testFunc)
    poke ptrtestFunc testFunc'
    g_test_add_func testpath' testFunc'
    freeMem testpath'
    return ()


-- function g_test_add_data_func
-- Args : [Arg {argCName = "testpath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "/-separated test case path name for the test.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "test_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "Test data argument for the test function.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "test_func", argType = TInterface (Name {namespace = "GLib", name = "TestDataFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The test function to invoke for this test.", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_add_data_func" g_test_add_data_func ::
    CString ->                              -- testpath : TBasicType TUTF8
    Ptr () ->                               -- test_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_TestDataFunc -> -- test_func : TInterface (Name {namespace = "GLib", name = "TestDataFunc"})
    IO ()

{- |
Create a new test case, similar to @/g_test_create_case()/@. However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of /@testpath@/. The /@testData@/ argument
will be passed as first argument to /@testFunc@/.

If /@testpath@/ includes the component \"subprocess\" anywhere in it,
the test will be skipped by default, and only run if explicitly
required via the @-p@ command-line option or 'GI.GLib.Functions.testTrapSubprocess'.

No component of /@testpath@/ may start with a dot (@.@) if the
'GI.GLib.Constants.TEST_OPTION_ISOLATE_DIRS' option is being used; and it is recommended to
do so even if it isn’t.

/Since: 2.16/
-}
testAddDataFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@testpath@/: \/-separated test case path name for the test. -}
    -> Ptr ()
    {- ^ /@testData@/: Test data argument for the test function. -}
    -> GLib.Callbacks.TestDataFunc
    {- ^ /@testFunc@/: The test function to invoke for this test. -}
    -> m ()
testAddDataFunc testpath testData testFunc = liftIO $ do
    testpath' <- textToCString testpath
    ptrtestFunc <- callocMem :: IO (Ptr (FunPtr GLib.Callbacks.C_TestDataFunc))
    testFunc' <- GLib.Callbacks.mk_TestDataFunc (GLib.Callbacks.wrap_TestDataFunc (Just ptrtestFunc) (GLib.Callbacks.drop_closures_TestDataFunc testFunc))
    poke ptrtestFunc testFunc'
    g_test_add_data_func testpath' testData testFunc'
    freeMem testpath'
    return ()


-- function g_strv_length
-- Args : [Arg {argCName = "str_array", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a %NULL-terminated array of strings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_strv_length" g_strv_length ::
    CString ->                              -- str_array : TBasicType TUTF8
    IO Word32

{- |
Returns the length of the given 'Nothing'-terminated
string array /@strArray@/. /@strArray@/ must not be 'Nothing'.

/Since: 2.6/
-}
strvLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@strArray@/: a 'Nothing'-terminated array of strings -}
    -> m Word32
    {- ^ __Returns:__ length of /@strArray@/. -}
strvLength strArray = liftIO $ do
    strArray' <- textToCString strArray
    result <- g_strv_length strArray'
    freeMem strArray'
    return result


-- function g_strv_get_type
-- Args : []
-- Lengths : []
-- returnType : Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "g_strv_get_type" g_strv_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
strvGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
strvGetType  = liftIO $ do
    result <- g_strv_get_type
    let result' = GType result
    return result'


-- function g_strv_equal
-- Args : [Arg {argCName = "strv1", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a %NULL-terminated array of strings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "strv2", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another %NULL-terminated array of strings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_strv_equal" g_strv_equal ::
    CString ->                              -- strv1 : TBasicType TUTF8
    CString ->                              -- strv2 : TBasicType TUTF8
    IO CInt

{- |
Checks if /@strv1@/ and /@strv2@/ contain exactly the same elements in exactly the
same order. Elements are compared using 'GI.GLib.Functions.strEqual'. To match independently
of order, sort the arrays first (using @/g_qsort_with_data()/@ or similar).

Two empty arrays are considered equal. Neither /@strv1@/ not /@strv2@/ may be
'Nothing'.

/Since: 2.60/
-}
strvEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@strv1@/: a 'Nothing'-terminated array of strings -}
    -> T.Text
    {- ^ /@strv2@/: another 'Nothing'-terminated array of strings -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@strv1@/ and /@strv2@/ are equal -}
strvEqual strv1 strv2 = liftIO $ do
    strv1' <- textToCString strv1
    strv2' <- textToCString strv2
    result <- g_strv_equal strv1' strv2'
    let result' = (/= 0) result
    freeMem strv1'
    freeMem strv2'
    return result'


-- function g_strv_contains
-- Args : [Arg {argCName = "strv", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a %NULL-terminated array of strings", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_strv_contains" g_strv_contains ::
    CString ->                              -- strv : TBasicType TUTF8
    CString ->                              -- str : TBasicType TUTF8
    IO CInt

{- |
Checks if /@strv@/ contains /@str@/. /@strv@/ must not be 'Nothing'.

/Since: 2.44/
-}
strvContains ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@strv@/: a 'Nothing'-terminated array of strings -}
    -> T.Text
    {- ^ /@str@/: a string -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@str@/ is an element of /@strv@/, according to 'GI.GLib.Functions.strEqual'. -}
strvContains strv str = liftIO $ do
    strv' <- textToCString strv
    str' <- textToCString str
    result <- g_strv_contains strv' str'
    let result' = (/= 0) result
    freeMem strv'
    freeMem str'
    return result'


-- function g_strup
-- Args : [Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to convert", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strup" g_strup ::
    CString ->                              -- string : TBasicType TUTF8
    IO CString

{-# DEPRECATED strup ["(Since version 2.2)","This function is totally broken for the reasons","    discussed in the 'GI.GLib.Functions.strncasecmp' docs - use 'GI.GLib.Functions.asciiStrup'","    or 'GI.GLib.Functions.utf8Strup' instead."] #-}
{- |
Converts a string to upper case.
-}
strup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@string@/: the string to convert -}
    -> m T.Text
    {- ^ __Returns:__ the string -}
strup string = liftIO $ do
    string' <- textToCString string
    result <- g_strup string'
    checkUnexpectedReturnNULL "strup" result
    result' <- cstringToText result
    freeMem result
    freeMem string'
    return result'


-- function g_strtod
-- Args : [Arg {argCName = "nptr", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to convert to a numeric value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "endptr", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if non-%NULL, it returns the\n          character after the last character used in the conversion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "g_strtod" g_strtod ::
    CString ->                              -- nptr : TBasicType TUTF8
    Ptr CString ->                          -- endptr : TBasicType TUTF8
    IO CDouble

{- |
Converts a string to a @/gdouble/@ value.
It calls the standard @/strtod()/@ function to handle the conversion, but
if the string is not completely converted it attempts the conversion
again with 'GI.GLib.Functions.asciiStrtod', and returns the best match.

This function should seldom be used. The normal situation when reading
numbers not for human consumption is to use 'GI.GLib.Functions.asciiStrtod'. Only when
you know that you must expect both locale formatted and C formatted numbers
should you use this. Make sure that you don\'t pass strings such as comma
separated lists of values, since the commas may be interpreted as a decimal
point in some locales, causing unexpected results.
-}
strtod ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@nptr@/: the string to convert to a numeric value. -}
    -> m ((Double, T.Text))
    {- ^ __Returns:__ the @/gdouble/@ value. -}
strtod nptr = liftIO $ do
    nptr' <- textToCString nptr
    endptr <- allocMem :: IO (Ptr CString)
    result <- g_strtod nptr' endptr
    let result' = realToFrac result
    endptr' <- peek endptr
    endptr'' <- cstringToText endptr'
    freeMem nptr'
    freeMem endptr
    return (result', endptr'')


-- function g_strstr_len
-- Args : [Arg {argCName = "haystack", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "haystack_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @haystack. Note that -1 is\n    a valid length, if @haystack is nul-terminated, meaning it will\n    search through the whole string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "needle", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strstr_len" g_strstr_len ::
    CString ->                              -- haystack : TBasicType TUTF8
    Int64 ->                                -- haystack_len : TBasicType TInt64
    CString ->                              -- needle : TBasicType TUTF8
    IO CString

{- |
Searches the string /@haystack@/ for the first occurrence
of the string /@needle@/, limiting the length of the search
to /@haystackLen@/.
-}
strstrLen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@haystack@/: a string -}
    -> Int64
    {- ^ /@haystackLen@/: the maximum length of /@haystack@/. Note that -1 is
    a valid length, if /@haystack@/ is nul-terminated, meaning it will
    search through the whole string. -}
    -> T.Text
    {- ^ /@needle@/: the string to search for -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to the found occurrence, or
   'Nothing' if not found. -}
strstrLen haystack haystackLen needle = liftIO $ do
    haystack' <- textToCString haystack
    needle' <- textToCString needle
    result <- g_strstr_len haystack' haystackLen needle'
    checkUnexpectedReturnNULL "strstrLen" result
    result' <- cstringToText result
    freeMem result
    freeMem haystack'
    freeMem needle'
    return result'


-- function g_strsignal
-- Args : [Arg {argCName = "signum", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the signal number. See the `signal` documentation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strsignal" g_strsignal ::
    Int32 ->                                -- signum : TBasicType TInt
    IO CString

{- |
Returns a string describing the given signal, e.g. \"Segmentation fault\".
You should use this function in preference to @/strsignal()/@, because it
returns a string in UTF-8 encoding, and since not all platforms support
the @/strsignal()/@ function.
-}
strsignal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@signum@/: the signal number. See the @signal@ documentation -}
    -> m T.Text
    {- ^ __Returns:__ a UTF-8 string describing the signal. If the signal is unknown,
    it returns \"unknown signal (\<signum>)\". -}
strsignal signum = liftIO $ do
    result <- g_strsignal signum
    checkUnexpectedReturnNULL "strsignal" result
    result' <- cstringToText result
    return result'


-- function g_strrstr_len
-- Args : [Arg {argCName = "haystack", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a nul-terminated string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "haystack_len", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum length of @haystack", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "needle", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the nul-terminated string to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strrstr_len" g_strrstr_len ::
    CString ->                              -- haystack : TBasicType TUTF8
    Int64 ->                                -- haystack_len : TBasicType TInt64
    CString ->                              -- needle : TBasicType TUTF8
    IO CString

{- |
Searches the string /@haystack@/ for the last occurrence
of the string /@needle@/, limiting the length of the search
to /@haystackLen@/.
-}
strrstrLen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@haystack@/: a nul-terminated string -}
    -> Int64
    {- ^ /@haystackLen@/: the maximum length of /@haystack@/ -}
    -> T.Text
    {- ^ /@needle@/: the nul-terminated string to search for -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to the found occurrence, or
   'Nothing' if not found. -}
strrstrLen haystack haystackLen needle = liftIO $ do
    haystack' <- textToCString haystack
    needle' <- textToCString needle
    result <- g_strrstr_len haystack' haystackLen needle'
    checkUnexpectedReturnNULL "strrstrLen" result
    result' <- cstringToText result
    freeMem result
    freeMem haystack'
    freeMem needle'
    return result'


-- function g_strrstr
-- Args : [Arg {argCName = "haystack", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a nul-terminated string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "needle", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the nul-terminated string to search for", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strrstr" g_strrstr ::
    CString ->                              -- haystack : TBasicType TUTF8
    CString ->                              -- needle : TBasicType TUTF8
    IO CString

{- |
Searches the string /@haystack@/ for the last occurrence
of the string /@needle@/.
-}
strrstr ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@haystack@/: a nul-terminated string -}
    -> T.Text
    {- ^ /@needle@/: the nul-terminated string to search for -}
    -> m T.Text
    {- ^ __Returns:__ a pointer to the found occurrence, or
   'Nothing' if not found. -}
strrstr haystack needle = liftIO $ do
    haystack' <- textToCString haystack
    needle' <- textToCString needle
    result <- g_strrstr haystack' needle'
    checkUnexpectedReturnNULL "strrstr" result
    result' <- cstringToText result
    freeMem result
    freeMem haystack'
    freeMem needle'
    return result'


-- function g_strreverse
-- Args : [Arg {argCName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to reverse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_strreverse" g_strreverse ::
    CString ->                              -- string : TBasicType TUTF8