-- | Copyright : Will Thompson and Iñaki García Etxebarria -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria #if !defined(__HADDOCK_VERSION__) #define ENABLE_OVERLOADING #endif module GI.GLib.Functions ( -- * Methods -- ** access #method:access# access , -- ** alignedAlloc #method:alignedAlloc# alignedAlloc , -- ** alignedAlloc0 #method:alignedAlloc0# alignedAlloc0 , -- ** alignedFree #method:alignedFree# alignedFree , -- ** alignedFreeSized #method:alignedFreeSized# alignedFreeSized , -- ** 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 , -- ** assertionMessageCmpint #method:assertionMessageCmpint# assertionMessageCmpint , -- ** assertionMessageCmpstr #method:assertionMessageCmpstr# assertionMessageCmpstr , -- ** assertionMessageCmpstrv #method:assertionMessageCmpstrv# assertionMessageCmpstrv , -- ** assertionMessageError #method:assertionMessageError# assertionMessageError , -- ** atexit #method:atexit# atexit , -- ** atomicIntAdd #method:atomicIntAdd# atomicIntAdd , -- ** atomicIntAnd #method:atomicIntAnd# atomicIntAnd , -- ** atomicIntCompareAndExchange #method:atomicIntCompareAndExchange# atomicIntCompareAndExchange , -- ** atomicIntCompareAndExchangeFull #method:atomicIntCompareAndExchangeFull# atomicIntCompareAndExchangeFull , -- ** atomicIntDecAndTest #method:atomicIntDecAndTest# atomicIntDecAndTest , -- ** atomicIntExchange #method:atomicIntExchange# atomicIntExchange , -- ** 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 , -- ** atomicPointerCompareAndExchangeFull #method:atomicPointerCompareAndExchangeFull# atomicPointerCompareAndExchangeFull , -- ** atomicPointerExchange #method:atomicPointerExchange# atomicPointerExchange , -- ** 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 , -- ** blowChunks #method:blowChunks# blowChunks , -- ** 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 , -- ** chmod #method:chmod# chmod , -- ** clearError #method:clearError# clearError , -- ** close #method:close# close , -- ** closefrom #method:closefrom# closefrom , -- ** 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 , -- ** creat #method:creat# creat , -- ** datalistForeach #method:datalistForeach# datalistForeach , -- ** datalistGetData #method:datalistGetData# datalistGetData , -- ** datalistGetFlags #method:datalistGetFlags# datalistGetFlags , -- ** datalistIdGetData #method:datalistIdGetData# datalistIdGetData , -- ** datalistIdRemoveMultiple #method:datalistIdRemoveMultiple# datalistIdRemoveMultiple , -- ** 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 , -- ** fdwalkSetCloexec #method:fdwalkSetCloexec# fdwalkSetCloexec , -- ** fileErrorFromErrno #method:fileErrorFromErrno# fileErrorFromErrno , -- ** fileErrorQuark #method:fileErrorQuark# fileErrorQuark , -- ** fileGetContents #method:fileGetContents# fileGetContents , -- ** fileOpenTmp #method:fileOpenTmp# fileOpenTmp , -- ** fileReadLink #method:fileReadLink# fileReadLink , -- ** fileSetContents #method:fileSetContents# fileSetContents , -- ** fileSetContentsFull #method:fileSetContentsFull# fileSetContentsFull , -- ** 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 , -- ** fopen #method:fopen# fopen , -- ** formatSize #method:formatSize# formatSize , -- ** formatSizeForDisplay #method:formatSizeForDisplay# formatSizeForDisplay , -- ** formatSizeFull #method:formatSizeFull# formatSizeFull , -- ** free #method:free# free , -- ** freeSized #method:freeSized# freeSized , -- ** freopen #method:freopen# freopen , -- ** fsync #method:fsync# fsync , -- ** getApplicationName #method:getApplicationName# getApplicationName , -- ** getCharset #method:getCharset# getCharset , -- ** getCodeset #method:getCodeset# getCodeset , -- ** getConsoleCharset #method:getConsoleCharset# getConsoleCharset , -- ** 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 , -- ** getOsInfo #method:getOsInfo# getOsInfo , -- ** 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 , -- ** getUserStateDir #method:getUserStateDir# getUserStateDir , -- ** 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 , -- ** logGetDebugEnabled #method:logGetDebugEnabled# logGetDebugEnabled , -- ** logRemoveHandler #method:logRemoveHandler# logRemoveHandler , -- ** logSetAlwaysFatal #method:logSetAlwaysFatal# logSetAlwaysFatal , -- ** logSetDebugEnabled #method:logSetDebugEnabled# logSetDebugEnabled , -- ** logSetFatalMask #method:logSetFatalMask# logSetFatalMask , -- ** logSetHandler #method:logSetHandler# logSetHandler , -- ** logSetWriterFunc #method:logSetWriterFunc# logSetWriterFunc , -- ** logStructuredArray #method:logStructuredArray# logStructuredArray , -- ** logVariant #method:logVariant# logVariant , -- ** logWriterDefault #method:logWriterDefault# logWriterDefault , -- ** logWriterDefaultSetDebugDomains #method:logWriterDefaultSetDebugDomains# logWriterDefaultSetDebugDomains , -- ** logWriterDefaultSetUseStderr #method:logWriterDefaultSetUseStderr# logWriterDefaultSetUseStderr , -- ** logWriterDefaultWouldDrop #method:logWriterDefaultWouldDrop# logWriterDefaultWouldDrop , -- ** logWriterFormatFields #method:logWriterFormatFields# logWriterFormatFields , -- ** logWriterIsJournald #method:logWriterIsJournald# logWriterIsJournald , -- ** logWriterJournald #method:logWriterJournald# logWriterJournald , -- ** logWriterStandardStreams #method:logWriterStandardStreams# logWriterStandardStreams , -- ** logWriterSupportsColor #method:logWriterSupportsColor# logWriterSupportsColor , -- ** logWriterSyslog #method:logWriterSyslog# logWriterSyslog , -- ** lstat #method:lstat# lstat , -- ** 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 , -- ** memdup2 #method:memdup2# memdup2 , -- ** mkdir #method:mkdir# mkdir , -- ** mkdirWithParents #method:mkdirWithParents# mkdirWithParents , -- ** nullifyPointer #method:nullifyPointer# nullifyPointer , -- ** numberParserErrorQuark #method:numberParserErrorQuark# numberParserErrorQuark , -- ** onErrorQuery #method:onErrorQuery# onErrorQuery , -- ** onErrorStackTrace #method:onErrorStackTrace# onErrorStackTrace , -- ** open #method:open# open , -- ** optionErrorQuark #method:optionErrorQuark# optionErrorQuark , -- ** parseDebugString #method:parseDebugString# parseDebugString , -- ** pathGetBasename #method:pathGetBasename# pathGetBasename , -- ** pathGetDirname #method:pathGetDirname# pathGetDirname , -- ** pathIsAbsolute #method:pathIsAbsolute# pathIsAbsolute , -- ** pathSkipRoot #method:pathSkipRoot# pathSkipRoot , -- ** patternMatchSimple #method:patternMatchSimple# patternMatchSimple , -- ** pointerBitLock #method:pointerBitLock# pointerBitLock , -- ** pointerBitLockAndGet #method:pointerBitLockAndGet# pointerBitLockAndGet , -- ** pointerBitLockMaskPtr #method:pointerBitLockMaskPtr# pointerBitLockMaskPtr , -- ** pointerBitTrylock #method:pointerBitTrylock# pointerBitTrylock , -- ** pointerBitUnlock #method:pointerBitUnlock# pointerBitUnlock , -- ** pointerBitUnlockAndSet #method:pointerBitUnlockAndSet# pointerBitUnlockAndSet , -- ** poll #method:poll# poll , -- ** prefixErrorLiteral #method:prefixErrorLiteral# prefixErrorLiteral , -- ** propagateError #method:propagateError# propagateError , -- ** qsortWithData #method:qsortWithData# qsortWithData , -- ** 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 , -- ** remove #method:remove# remove , -- ** rename #method:rename# rename , -- ** 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 , -- ** spawnAsyncWithPipesAndFds #method:spawnAsyncWithPipesAndFds# spawnAsyncWithPipesAndFds , -- ** spawnCheckExitStatus #method:spawnCheckExitStatus# spawnCheckExitStatus , -- ** spawnCheckWaitStatus #method:spawnCheckWaitStatus# spawnCheckWaitStatus , -- ** spawnClosePid #method:spawnClosePid# spawnClosePid , -- ** spawnCommandLineAsync #method:spawnCommandLineAsync# spawnCommandLineAsync , -- ** spawnCommandLineSync #method:spawnCommandLineSync# spawnCommandLineSync , -- ** spawnErrorQuark #method:spawnErrorQuark# spawnErrorQuark , -- ** spawnExitErrorQuark #method:spawnExitErrorQuark# spawnExitErrorQuark , -- ** spawnSync #method:spawnSync# spawnSync , -- ** stat #method:stat# stat , -- ** 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 , -- ** strdupv #method:strdupv# strdupv , -- ** strerror #method:strerror# strerror , -- ** strescape #method:strescape# strescape , -- ** strfreev #method:strfreev# strfreev , -- ** 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 , -- ** strsplit #method:strsplit# strsplit , -- ** strsplitSet #method:strsplitSet# strsplitSet , -- ** 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 , -- ** testDisableCrashReporting #method:testDisableCrashReporting# testDisableCrashReporting , -- ** testExpectMessage #method:testExpectMessage# testExpectMessage , -- ** testFail #method:testFail# testFail , -- ** testFailed #method:testFailed# testFailed , -- ** testGetDir #method:testGetDir# testGetDir , -- ** testGetPath #method:testGetPath# testGetPath , -- ** 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 , -- ** testSummary #method:testSummary# testSummary , -- ** 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 , -- ** testTrapSubprocessWithEnvp #method:testTrapSubprocessWithEnvp# testTrapSubprocessWithEnvp , -- ** 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 , -- ** ucs4ToUtf16 #method:ucs4ToUtf16# ucs4ToUtf16 , -- ** ucs4ToUtf8 #method:ucs4ToUtf8# ucs4ToUtf8 , -- ** 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 , -- ** unixErrorQuark #method:unixErrorQuark# unixErrorQuark , -- ** unixFdAddFull #method:unixFdAddFull# unixFdAddFull , -- ** unixFdSourceNew #method:unixFdSourceNew# unixFdSourceNew , -- ** unixGetPasswdEntry #method:unixGetPasswdEntry# unixGetPasswdEntry , -- ** unixOpenPipe #method:unixOpenPipe# unixOpenPipe , -- ** unixSetFdNonblocking #method:unixSetFdNonblocking# unixSetFdNonblocking , -- ** unixSignalAdd #method:unixSignalAdd# unixSignalAdd , -- ** unixSignalSourceNew #method:unixSignalSourceNew# unixSignalSourceNew , -- ** unlink #method:unlink# unlink , -- ** unsetenv #method:unsetenv# unsetenv , -- ** usleep #method:usleep# usleep , -- ** utf16ToUcs4 #method:utf16ToUcs4# utf16ToUcs4 , -- ** utf16ToUtf8 #method:utf16ToUtf8# utf16ToUtf8 , -- ** 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 , -- ** utf8ToUcs4 #method:utf8ToUcs4# utf8ToUcs4 , -- ** utf8ToUcs4Fast #method:utf8ToUcs4Fast# utf8ToUcs4Fast , -- ** utf8ToUtf16 #method:utf8ToUtf16# utf8ToUtf16 , -- ** utf8TruncateMiddle #method:utf8TruncateMiddle# utf8TruncateMiddle , -- ** utf8Validate #method:utf8Validate# utf8Validate , -- ** utf8ValidateLen #method:utf8ValidateLen# utf8ValidateLen , -- ** utime #method:utime# utime , -- ** 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.BasicTypes as B.Types import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GArray as B.GArray import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GHashTable as B.GHT import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.GI.Base.Signals as B.Signals import qualified Control.Monad.IO.Class as MIO import qualified Data.Coerce as Coerce import qualified Data.Text as T import qualified Data.Kind as DK import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GHC.Records as R import qualified Data.Word as DW import qualified Data.Int as DI import qualified System.Posix.Types as SPT import qualified Foreign.C.Types as FCT -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392 #if MIN_VERSION_base(4,18,0) 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.Cond as GLib.Cond 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.MainContext as GLib.MainContext import {-# SOURCE #-} qualified GI.GLib.Structs.MemVTable as GLib.MemVTable 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.SourceCallbackFuncs as GLib.SourceCallbackFuncs import {-# SOURCE #-} qualified GI.GLib.Structs.SourceFuncs as GLib.SourceFuncs import {-# SOURCE #-} qualified GI.GLib.Structs.StatBuf as GLib.StatBuf import {-# SOURCE #-} qualified GI.GLib.Structs.TestCase as GLib.TestCase import {-# SOURCE #-} qualified GI.GLib.Structs.TestSuite as GLib.TestSuite import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal import {-# SOURCE #-} qualified GI.GLib.Unions.Mutex as GLib.Mutex #else 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.PollFD as GLib.PollFD import {-# SOURCE #-} qualified GI.GLib.Structs.Source as GLib.Source import {-# SOURCE #-} qualified GI.GLib.Structs.StatBuf as GLib.StatBuf import {-# SOURCE #-} qualified GI.GLib.Structs.TestSuite as GLib.TestSuite import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal #endif -- function 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m GType variantGetGtype = IO GType -> m GType forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO GType -> m GType) -> IO GType -> m GType forall a b. (a -> b) -> a -> b $ do CGType result <- IO CGType g_variant_get_gtype let result' :: GType result' = CGType -> GType GType CGType result GType -> IO GType forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return GType result' -- function 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. It has the same -- randomness guarantees as t'GI.GLib.Structs.Rand.Rand', so must not be used for cryptographic -- purposes such as key generation, nonces, salts or one-time pads. -- -- /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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text uuidStringRandom = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString result <- IO CString g_uuid_string_random Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "uuidStringRandom" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@str@/ is a valid UUID, 'P.False' otherwise. uuidStringIsValid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool uuidStringIsValid Text str = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CInt result <- CString -> IO CInt g_uuid_string_is_valid CString str' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function utime -- 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "utb" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a pointer to a struct utimbuf." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_utime" g_utime :: CString -> -- filename : TBasicType TFileName Ptr () -> -- utb : TBasicType TPtr IO Int32 -- | A wrapper for the POSIX @/utime()/@ function. The @/utime()/@ function -- sets the access and modification timestamps of a file. -- -- See your C library manual for more details about how @/utime()/@ works -- on your system. -- -- /Since: 2.18/ utime :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@filename@/: a pathname in the GLib file name encoding -- (UTF-8 on Windows) -> Ptr () -- ^ /@utb@/: a pointer to a struct utimbuf. -> m Int32 -- ^ __Returns:__ 0 if the operation was successful, -1 if an error occurred utime :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> Ptr () -> m Int32 utime [Char] filename Ptr () utb = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do CString filename' <- [Char] -> IO CString stringToCString [Char] filename Int32 result <- CString -> Ptr () -> IO Int32 g_utime CString filename' Ptr () utb CString -> IO () forall a. Ptr a -> IO () freeMem CString filename' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "max_len" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "max bytes to validate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "max_len" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "max bytes to validate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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) FCT.CSize -> -- max_len : TBasicType TSize 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 'P.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:__ 'P.True' if the text was valid UTF-8 utf8ValidateLen :: forall (m :: * -> *). (HasCallStack, MonadIO m) => ByteString -> m (Bool, Text) utf8ValidateLen ByteString str = IO (Bool, Text) -> m (Bool, Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Text) -> m (Bool, Text)) -> IO (Bool, Text) -> m (Bool, Text) forall a b. (a -> b) -> a -> b $ do let maxLen :: CSize maxLen = Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString str Ptr Word8 str' <- ByteString -> IO (Ptr Word8) packByteString ByteString str Ptr CString end <- IO (Ptr CString) forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) CInt result <- Ptr Word8 -> CSize -> Ptr CString -> IO CInt g_utf8_validate_len Ptr Word8 str' CSize maxLen Ptr CString end let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CString end' <- Ptr CString -> IO CString forall a. Storable a => Ptr a -> IO a peek Ptr CString end Text end'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString end' Ptr Word8 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word8 str' Ptr CString -> IO () forall a. Ptr a -> IO () freeMem Ptr CString end (Bool, Text) -> IO (Bool, Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Text end'') -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "max_len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "max_len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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) DI.Int64 -> -- max_len : TBasicType TSSize 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-'P.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 'P.False' if /@maxLen@/ is -- positive and any of the /@maxLen@/ bytes are nul. -- -- Returns 'P.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:__ 'P.True' if the text was valid UTF-8 utf8Validate :: forall (m :: * -> *). (HasCallStack, MonadIO m) => ByteString -> m (Bool, Text) utf8Validate ByteString str = IO (Bool, Text) -> m (Bool, Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Text) -> m (Bool, Text)) -> IO (Bool, Text) -> m (Bool, Text) forall a b. (a -> b) -> a -> b $ do let maxLen :: Int64 maxLen = Int -> Int64 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int64) -> Int -> Int64 forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString str Ptr Word8 str' <- ByteString -> IO (Ptr Word8) packByteString ByteString str Ptr CString end <- IO (Ptr CString) forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr CString) CInt result <- Ptr Word8 -> Int64 -> Ptr CString -> IO CInt g_utf8_validate Ptr Word8 str' Int64 maxLen Ptr CString end let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CString end' <- Ptr CString -> IO CString forall a. Storable a => Ptr a -> IO a peek Ptr CString end Text end'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString end' Ptr Word8 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word8 str' Ptr CString -> IO () forall a. Ptr a -> IO () freeMem Ptr CString end (Bool, Text) -> IO (Bool, Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Text end'') -- function utf8_truncate_middle -- Args: [ Arg -- { argCName = "string" -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "truncate_length" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the new size of @string, in characters, including the ellipsis character" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_utf8_truncate_middle" g_utf8_truncate_middle :: CString -> -- string : TBasicType TUTF8 FCT.CSize -> -- truncate_length : TBasicType TSize IO CString -- | Cuts off the middle of the string, preserving half of /@truncateLength@/ -- characters at the beginning and half at the end. -- -- If /@string@/ is already short enough, this returns a copy of /@string@/. -- If /@truncateLength@/ is @0@, an empty string is returned. -- -- /Since: 2.78/ utf8TruncateMiddle :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: a nul-terminated UTF-8 encoded string -> FCT.CSize -- ^ /@truncateLength@/: the new size of /@string@/, in characters, including the ellipsis character -> m T.Text -- ^ __Returns:__ a newly-allocated copy of /@string@/ ellipsized in the middle utf8TruncateMiddle :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CSize -> m Text utf8TruncateMiddle Text string CSize truncateLength = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString string' <- Text -> IO CString textToCString Text string CString result <- CString -> CSize -> IO CString g_utf8_truncate_middle CString string' CSize truncateLength Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8TruncateMiddle" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString string' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function utf8_to_utf16 -- 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of bytes) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number of\n bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will\n be returned in case @str contains a trailing partial character. If\n an error occurs then the index of the invalid input is stored here." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of #gunichar2 written, or %NULL. The value stored here does not include\n the trailing 0." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt16) -- throws : True -- Skip return : False foreign import ccall "g_utf8_to_utf16" g_utf8_to_utf16 :: CString -> -- str : TBasicType TUTF8 FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO Word16 -- | Convert a string from UTF-8 to UTF-16. A 0 character will be -- added to the result after the converted text. utf8ToUtf16 :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@str@/: a UTF-8 encoded string -> FCT.CLong -- ^ /@len@/: the maximum length (number of bytes) of /@str@/ to use. -- If /@len@/ \< 0, then the string is nul-terminated. -> m ((Word16, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UTF-16 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ utf8ToUtf16 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CLong -> m (Word16, CLong, CLong) utf8ToUtf16 Text str CLong len = IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong)) -> IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong) forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Word16, CLong, CLong) -> IO () -> IO (Word16, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do Word16 result <- (Ptr (Ptr GError) -> IO Word16) -> IO Word16 forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO Word16) -> IO Word16) -> (Ptr (Ptr GError) -> IO Word16) -> IO Word16 forall a b. (a -> b) -> a -> b $ CString -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO Word16 g_utf8_to_utf16 CString str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Word16, CLong, CLong) -> IO (Word16, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Word16 result, CLong itemsRead', CLong itemsWritten') ) (do CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function utf8_to_ucs4_fast -- 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store the\n number of characters in the result, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUniChar) -- throws : False -- Skip return : False foreign import ccall "g_utf8_to_ucs4_fast" g_utf8_to_ucs4_fast :: CString -> -- str : TBasicType TUTF8 FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong IO CInt -- | Convert a string from UTF-8 to a 32-bit fixed width -- representation as UCS-4, assuming valid UTF-8 input. -- This function is roughly twice as fast as 'GI.GLib.Functions.utf8ToUcs4' -- but does no error checking on the input. A trailing 0 character -- will be added to the string after the converted text. utf8ToUcs4Fast :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@str@/: a UTF-8 encoded string -> FCT.CLong -- ^ /@len@/: the maximum length of /@str@/ to use, in bytes. If /@len@/ \< 0, -- then the string is nul-terminated. -> m ((Char, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UCS-4 string. -- This value must be freed with 'GI.GLib.Functions.free'. utf8ToUcs4Fast :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CLong -> m (Char, CLong) utf8ToUcs4Fast Text str CLong len = IO (Char, CLong) -> m (Char, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Char, CLong) -> m (Char, CLong)) -> IO (Char, CLong) -> m (Char, CLong) forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) CInt result <- CString -> CLong -> Ptr CLong -> IO CInt g_utf8_to_ucs4_fast CString str' CLong len Ptr CLong itemsWritten let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Char, CLong) -> IO (Char, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Char result', CLong itemsWritten') -- function utf8_to_ucs4 -- 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number of\n bytes read, or %NULL.\n If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be\n returned in case @str contains a trailing partial\n character. If an error occurs then the index of the\n invalid input is stored here." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of characters written or %NULL. The value here stored does not include\n the trailing 0 character." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUniChar) -- throws : True -- Skip return : False foreign import ccall "g_utf8_to_ucs4" g_utf8_to_ucs4 :: CString -> -- str : TBasicType TUTF8 FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO CInt -- | Convert a string from UTF-8 to a 32-bit fixed width -- representation as UCS-4. A trailing 0 character will be added to the -- string after the converted text. utf8ToUcs4 :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@str@/: a UTF-8 encoded string -> FCT.CLong -- ^ /@len@/: the maximum length of /@str@/ to use, in bytes. If /@len@/ \< 0, -- then the string is nul-terminated. -> m ((Char, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UCS-4 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ utf8ToUcs4 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CLong -> m (Char, CLong, CLong) utf8ToUcs4 Text str CLong len = IO (Char, CLong, CLong) -> m (Char, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Char, CLong, CLong) -> m (Char, CLong, CLong)) -> IO (Char, CLong, CLong) -> m (Char, CLong, CLong) forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Char, CLong, CLong) -> IO () -> IO (Char, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do CInt result <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt) -> (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a b. (a -> b) -> a -> b $ CString -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO CInt g_utf8_to_ucs4 CString str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Char, CLong, CLong) -> IO (Char, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Char result', CLong itemsRead', CLong itemsWritten') ) (do CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "end_pos" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "another character offset within @str,\n or `-1` to indicate the end of the string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 FCT.CLong -> -- start_pos : TBasicType TLong FCT.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 GLib 2.72, @-1@ can be passed to /@endPos@/ to indicate the -- end of the string. -- -- /Since: 2.30/ utf8Substring :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@str@/: a UTF-8 encoded string -> FCT.CLong -- ^ /@startPos@/: a character offset within /@str@/ -> FCT.CLong -- ^ /@endPos@/: another character offset within /@str@/, -- or @-1@ to indicate the end of the string -> m T.Text -- ^ __Returns:__ a newly allocated copy of the requested -- substring. Free with 'GI.GLib.Functions.free' when no longer needed. utf8Substring :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CLong -> CLong -> m Text utf8Substring Text str CLong startPos CLong endPos = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> CLong -> CLong -> IO CString g_utf8_substring CString str' CLong startPos CLong endPos Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Substring" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8Strup Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_strup CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Strup" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8Strreverse Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_strreverse CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Strreverse" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the maximum length of @p" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.Int64 -- ^ /@len@/: the maximum length of /@p@/ -> Char -- ^ /@c@/: a Unicode character -> m (Maybe T.Text) -- ^ __Returns:__ 'P.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> Char -> m (Maybe Text) utf8Strrchr Text p Int64 len Char c = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe Text) -> m (Maybe Text)) -> IO (Maybe Text) -> m (Maybe Text) forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CString result <- CString -> Int64 -> CInt -> IO CString g_utf8_strrchr CString p' Int64 len CInt c' Maybe Text maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text) forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result ((CString -> IO Text) -> IO (Maybe Text)) -> (CString -> IO Text) -> IO (Maybe Text) forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result'' CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Maybe Text -> IO (Maybe Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "character count" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 FCT.CSize -> -- n : TBasicType TSize 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@/ + 1 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 -> FCT.CSize -- ^ /@n@/: character count -> m T.Text -- ^ __Returns:__ /@dest@/ utf8Strncpy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> CSize -> m Text utf8Strncpy Text dest Text src CSize n = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString dest' <- Text -> IO CString textToCString Text dest CString src' <- Text -> IO CString textToCString Text src CString result <- CString -> CString -> CSize -> IO CString g_utf8_strncpy CString dest' CString src' CSize n Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Strncpy" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString dest' CString -> IO () forall a. Ptr a -> IO () freeMem CString src' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "max" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- max : TBasicType TSSize IO FCT.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 -> DI.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 'P.Nothing'. If /@max@/ is greater than 0, up to /@max@/ -- bytes are examined -> m FCT.CLong -- ^ __Returns:__ the length of the string in characters utf8Strlen :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m CLong utf8Strlen Text p Int64 max = IO CLong -> m CLong forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO CLong -> m CLong) -> IO CLong -> m CLong forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p CLong result <- CString -> Int64 -> IO CLong g_utf8_strlen CString p' Int64 max CString -> IO () forall a. Ptr a -> IO () freeMem CString p' CLong -> IO CLong forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CLong result -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8Strdown Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_strdown CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Strdown" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the maximum length of @p" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.Int64 -- ^ /@len@/: the maximum length of /@p@/ -> Char -- ^ /@c@/: a Unicode character -> m (Maybe T.Text) -- ^ __Returns:__ 'P.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> Char -> m (Maybe Text) utf8Strchr Text p Int64 len Char c = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe Text) -> m (Maybe Text)) -> IO (Maybe Text) -> m (Maybe Text) forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CString result <- CString -> Int64 -> CInt -> IO CString g_utf8_strchr CString p' Int64 len CInt c' Maybe Text maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text) forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result ((CString -> IO Text) -> IO (Maybe Text)) -> (CString -> IO Text) -> IO (Maybe Text) forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result'' CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Maybe Text -> IO (Maybe Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text utf8PrevChar Text p = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p CString result <- CString -> IO CString g_utf8_prev_char CString p' Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8PrevChar" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 FCT.CLong -- | Converts from a pointer to position within a string to an 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 FCT.CLong -- ^ __Returns:__ the resulting character offset utf8PointerToOffset :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m CLong utf8PointerToOffset Text str Text pos = IO CLong -> m CLong forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO CLong -> m CLong) -> IO CLong -> m CLong forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString pos' <- Text -> IO CString textToCString Text pos CLong result <- CString -> CString -> IO CLong g_utf8_pointer_to_offset CString str' CString pos' CString -> IO () forall a. Ptr a -> IO () freeMem CString str' CString -> IO () forall a. Ptr a -> IO () freeMem CString pos' CLong -> IO CLong forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CLong result -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 FCT.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 -> FCT.CLong -- ^ /@offset@/: a character offset within /@str@/ -> m T.Text -- ^ __Returns:__ the resulting pointer utf8OffsetToPointer :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> CLong -> m Text utf8OffsetToPointer Text str CLong offset = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> CLong -> IO CString g_utf8_offset_to_pointer CString str' CLong offset Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8OffsetToPointer" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 'P.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. -> DI.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 (Maybe T.Text) -- ^ __Returns:__ a newly allocated string, that -- is the normalized form of /@str@/, or 'P.Nothing' if /@str@/ -- is not valid UTF-8. utf8Normalize :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> NormalizeMode -> m (Maybe Text) utf8Normalize Text str Int64 len NormalizeMode mode = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe Text) -> m (Maybe Text)) -> IO (Maybe Text) -> m (Maybe Text) forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str let mode' :: CUInt mode' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (NormalizeMode -> Int) -> NormalizeMode -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . NormalizeMode -> Int forall a. Enum a => a -> Int fromEnum) NormalizeMode mode CString result <- CString -> Int64 -> CUInt -> IO CString g_utf8_normalize CString str' Int64 len CUInt mode' Maybe Text maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text) forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result ((CString -> IO Text) -> IO (Maybe Text)) -> (CString -> IO Text) -> IO (Maybe Text) forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' CString -> IO () forall a. Ptr a -> IO () freeMem CString result' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result'' CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Maybe Text -> IO (Maybe Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8MakeValid Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_make_valid CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8MakeValid" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "max_len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- max_len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Char utf8GetCharValidated Text p Int64 maxLen = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p CInt result <- CString -> Int64 -> IO CInt g_utf8_get_char_validated CString p' Int64 maxLen let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Char utf8GetChar Text p = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p CInt result <- CString -> IO CInt g_utf8_get_char CString p' let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 'P.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 (Maybe T.Text) -- ^ __Returns:__ a pointer to the found character or 'P.Nothing'. utf8FindPrevChar :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m (Maybe Text) utf8FindPrevChar Text str Text p = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe Text) -> m (Maybe Text)) -> IO (Maybe Text) -> m (Maybe Text) forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString p' <- Text -> IO CString textToCString Text p CString result <- CString -> CString -> IO CString g_utf8_find_prev_char CString str' CString p' Maybe Text maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text) forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result ((CString -> IO Text) -> IO (Maybe Text)) -> (CString -> IO Text) -> IO (Maybe Text) forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result'' CString -> IO () forall a. Ptr a -> IO () freeMem CString str' CString -> IO () forall a. Ptr a -> IO () freeMem CString p' Maybe Text -> IO (Maybe Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 'P.Nothing', the return value will never be 'P.Nothing': if the end of the -- string is reached, a pointer to the terminating nul byte is returned. If -- /@end@/ is non-'P.Nothing', the return value will be 'P.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 'P.Nothing' to indicate that the string is nul-terminated -> m (Maybe T.Text) -- ^ __Returns:__ a pointer to the found character or 'P.Nothing' if /@end@/ is -- set and is reached utf8FindNextChar :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Maybe Text -> m (Maybe Text) utf8FindNextChar Text p Maybe Text end = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe Text) -> m (Maybe Text)) -> IO (Maybe Text) -> m (Maybe Text) forall a b. (a -> b) -> a -> b $ do CString p' <- Text -> IO CString textToCString Text p CString maybeEnd <- case Maybe Text end of Maybe Text Nothing -> CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString forall a. Ptr a FP.nullPtr Just Text jEnd -> do CString jEnd' <- Text -> IO CString textToCString Text jEnd CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString jEnd' CString result <- CString -> CString -> IO CString g_utf8_find_next_char CString p' CString maybeEnd Maybe Text maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text) forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) convertIfNonNull CString result ((CString -> IO Text) -> IO (Maybe Text)) -> (CString -> IO Text) -> IO (Maybe Text) forall a b. (a -> b) -> a -> b $ \CString result' -> do Text result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result'' CString -> IO () forall a. Ptr a -> IO () freeMem CString p' CString -> IO () forall a. Ptr a -> IO () freeMem CString maybeEnd Maybe Text -> IO (Maybe Text) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Maybe Text maybeResult -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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. -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8CollateKeyForFilename Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_collate_key_for_filename CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8CollateKeyForFilename" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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. -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8CollateKey Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_collate_key CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8CollateKey" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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. -- -- If the two strings are not comparable due to being in different collation -- sequences, the result is undefined. This can happen if the strings are in -- different language scripts, for example. 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m Int32 utf8Collate Text str1 Text str2 = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do CString str1' <- Text -> IO CString textToCString Text str1 CString str2' <- Text -> IO CString textToCString Text str2 Int32 result <- CString -> CString -> IO Int32 g_utf8_collate CString str1' CString str2' CString -> IO () forall a. Ptr a -> IO () freeMem CString str1' CString -> IO () forall a. Ptr a -> IO () freeMem CString str2' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSSize -- , 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 -- , argCallbackUserData = 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 DI.Int64 -> -- len : TBasicType TSSize 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 -> DI.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Int64 -> m Text utf8Casefold Text str Int64 len = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do CString str' <- Text -> IO CString textToCString Text str CString result <- CString -> Int64 -> IO CString g_utf8_casefold CString str' Int64 len Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf8Casefold" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString str' Text -> IO Text forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function utf16_to_utf8 -- Args: [ Arg -- { argCName = "str" -- , argType = TCArray False (-1) 1 (TBasicType TUInt16) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a UTF-16 encoded string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of #gunichar2) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number of\n words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will\n be returned in case @str contains a trailing partial character. If\n an error occurs then the index of the invalid input is stored here.\n It\8217s guaranteed to be non-negative." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of bytes written, or %NULL. The value stored here does not include the\n trailing 0 byte. It\8217s guaranteed to be non-negative." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of #gunichar2) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "g_utf16_to_utf8" g_utf16_to_utf8 :: Ptr Word16 -> -- str : TCArray False (-1) 1 (TBasicType TUInt16) FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO CString -- | Convert a string from UTF-16 to UTF-8. The result will be -- terminated with a 0 byte. -- -- Note that the input is expected to be already in native endianness, -- an initial byte-order-mark character is not handled specially. -- 'GI.GLib.Functions.convert' can be used to convert a byte buffer of UTF-16 data of -- ambiguous endianness. -- -- Further note that this function does not validate the result -- string; it may e.g. include embedded NUL characters. The only -- validation done by this function is to ensure that the input can -- be correctly interpreted as UTF-16, i.e. it doesn\'t contain -- unpaired surrogates or partial character sequences. utf16ToUtf8 :: (B.CallStack.HasCallStack, MonadIO m) => [Word16] -- ^ /@str@/: a UTF-16 encoded string -> m ((T.Text, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UTF-8 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ utf16ToUtf8 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Word16] -> m (Text, CLong, CLong) utf16ToUtf8 [Word16] str = IO (Text, CLong, CLong) -> m (Text, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Text, CLong, CLong) -> m (Text, CLong, CLong)) -> IO (Text, CLong, CLong) -> m (Text, CLong, CLong) forall a b. (a -> b) -> a -> b $ do let len :: CLong len = Int -> CLong forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CLong) -> Int -> CLong forall a b. (a -> b) -> a -> b $ [Word16] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int P.length [Word16] str Ptr Word16 str' <- [Word16] -> IO (Ptr Word16) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [Word16] str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Text, CLong, CLong) -> IO () -> IO (Text, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do CString result <- (Ptr (Ptr GError) -> IO CString) -> IO CString forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CString) -> IO CString) -> (Ptr (Ptr GError) -> IO CString) -> IO CString forall a b. (a -> b) -> a -> b $ Ptr Word16 -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO CString g_utf16_to_utf8 Ptr Word16 str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "utf16ToUtf8" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten Ptr Word16 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word16 str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Text, CLong, CLong) -> IO (Text, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Text result', CLong itemsRead', CLong itemsWritten') ) (do Ptr Word16 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word16 str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function utf16_to_ucs4 -- Args: [ Arg -- { argCName = "str" -- , argType = TCArray False (-1) 1 (TBasicType TUInt16) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a UTF-16 encoded string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of #gunichar2) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number of\n words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will\n be returned in case @str contains a trailing partial character. If\n an error occurs then the index of the invalid input is stored here." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of characters written, or %NULL. The value stored here does not include\n the trailing 0 character." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of #gunichar2) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUniChar) -- throws : True -- Skip return : False foreign import ccall "g_utf16_to_ucs4" g_utf16_to_ucs4 :: Ptr Word16 -> -- str : TCArray False (-1) 1 (TBasicType TUInt16) FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO CInt -- | Convert a string from UTF-16 to UCS-4. The result will be -- nul-terminated. utf16ToUcs4 :: (B.CallStack.HasCallStack, MonadIO m) => [Word16] -- ^ /@str@/: a UTF-16 encoded string -> m ((Char, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UCS-4 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ utf16ToUcs4 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Word16] -> m (Char, CLong, CLong) utf16ToUcs4 [Word16] str = IO (Char, CLong, CLong) -> m (Char, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Char, CLong, CLong) -> m (Char, CLong, CLong)) -> IO (Char, CLong, CLong) -> m (Char, CLong, CLong) forall a b. (a -> b) -> a -> b $ do let len :: CLong len = Int -> CLong forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CLong) -> Int -> CLong forall a b. (a -> b) -> a -> b $ [Word16] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int P.length [Word16] str Ptr Word16 str' <- [Word16] -> IO (Ptr Word16) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [Word16] str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Char, CLong, CLong) -> IO () -> IO (Char, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do CInt result <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt) -> (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a b. (a -> b) -> a -> b $ Ptr Word16 -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO CInt g_utf16_to_ucs4 Ptr Word16 str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten Ptr Word16 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word16 str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Char, CLong, CLong) -> IO (Char, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Char result', CLong itemsRead', CLong itemsWritten') ) (do Ptr Word16 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word16 str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_usleep" g_usleep :: FCT.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) => FCT.CULong -- ^ /@microseconds@/: number of microseconds to pause -> m () usleep :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CULong -> m () usleep CULong microseconds = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do CULong -> IO () g_usleep CULong microseconds () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m () unsetenv [Char] variable = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do CString variable' <- [Char] -> IO CString stringToCString [Char] variable CString -> IO () g_unsetenv CString variable' CString -> IO () forall a. Ptr a -> IO () freeMem CString variable' () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m Int32 unlink [Char] filename = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do CString filename' <- [Char] -> IO CString stringToCString [Char] filename Int32 result <- CString -> IO Int32 g_unlink CString filename' CString -> IO () forall a. Ptr a -> IO () freeMem CString filename' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = 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 t'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 -- 'GI.GLib.Structs.MainLoop.mainLoopQuit'. It is not safe to do any of this from a regular -- UNIX signal handler; such a handler may be invoked while @/malloc()/@ or -- another library function is running, causing reentrancy issues if the -- handler attempts to use those functions. 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 t'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 t'GI.GLib.Structs.Source.Source' unixSignalSourceNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m Source unixSignalSourceNew Int32 signum = IO Source -> m Source forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Source -> m Source) -> IO Source -> m Source forall a b. (a -> b) -> a -> b $ do Ptr Source result <- Int32 -> IO (Ptr Source) g_unix_signal_source_new Int32 signum Text -> Ptr Source -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "unixSignalSourceNew" Ptr Source result Source result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Source -> Source GLib.Source.Source) Ptr Source result Source -> IO Source forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Source result' -- function unix_signal_add -- 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 t'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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> Int32 -> IO Bool -> m Word32 unixSignalAdd Int32 priority Int32 signum IO Bool handler = IO Word32 -> m Word32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do FunPtr C_SourceFunc handler' <- C_SourceFunc -> IO (FunPtr C_SourceFunc) GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc)) -> SourceFunc_WithClosures -> C_SourceFunc GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc)) forall a. Maybe a Nothing (IO Bool -> SourceFunc_WithClosures GLib.Callbacks.drop_closures_SourceFunc IO Bool handler)) let userData :: Ptr () userData = FunPtr C_SourceFunc -> Ptr () forall a b. FunPtr a -> Ptr b castFunPtrToPtr FunPtr C_SourceFunc handler' let notify :: FunPtr (Ptr a -> IO ()) notify = FunPtr (Ptr a -> IO ()) forall a. FunPtr (Ptr a -> IO ()) SP.safeFreeFunPtrPtr Word32 result <- Int32 -> Int32 -> FunPtr C_SourceFunc -> Ptr () -> FunPtr C_DestroyNotify -> IO Word32 g_unix_signal_add_full Int32 priority Int32 signum FunPtr C_SourceFunc handler' Ptr () userData FunPtr C_DestroyNotify forall a. FunPtr (Ptr a -> IO ()) notify Word32 -> IO Word32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 'P.True', set the descriptor to be non-blocking -> m () -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ unixSetFdNonblocking :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> Bool -> m () unixSetFdNonblocking Int32 fd Bool nonblock = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do let nonblock' :: CInt nonblock' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Bool -> Int forall a. Enum a => a -> Int P.fromEnum) Bool nonblock IO () -> IO () -> IO () forall a b. IO a -> IO b -> IO a onException (do CInt _ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt) -> (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a b. (a -> b) -> a -> b $ Int32 -> CInt -> Ptr (Ptr GError) -> IO CInt g_unix_set_fd_nonblocking Int32 fd CInt nonblock' () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () ) (do () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () ) -- function unix_open_pipe -- Args: [ Arg -- { argCName = "fds" -- , argType = TCArray False 2 (-1) (TBasicType TInt) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Array of two integers" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "g_unix_open_pipe" g_unix_open_pipe :: Ptr Int32 -> -- fds : TCArray False 2 (-1) (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. -- -- As of GLib 2.78, the supported flags are @O_CLOEXEC@\/@FD_CLOEXEC@ (see below) -- and @O_NONBLOCK@. Prior to GLib 2.78, only @FD_CLOEXEC@ was supported — if -- you wanted to configure @O_NONBLOCK@ then that had to be done separately with -- @fcntl()@. -- -- Since GLib 2.80, the constants 'GI.GLib.Enums.UnixPipeEndRead' and -- 'GI.GLib.Enums.UnixPipeEndWrite' can be used as mnemonic indexes in /@fds@/. -- -- It is a programmer error to call this function with unsupported flags, and a -- critical warning will be raised. -- -- As of GLib 2.78, it is preferred to pass @O_CLOEXEC@ in, rather than -- @FD_CLOEXEC@, as that matches the underlying @pipe()@ API more closely. Prior -- to 2.78, only @FD_CLOEXEC@ was supported. Support for @FD_CLOEXEC@ may be -- deprecated and removed in future. -- -- /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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Int32] -> Int32 -> m () unixOpenPipe [Int32] fds Int32 flags = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do Ptr Int32 fds' <- [Int32] -> IO (Ptr Int32) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [Int32] fds IO () -> IO () -> IO () forall a b. IO a -> IO b -> IO a onException (do CInt _ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt) -> (Ptr (Ptr GError) -> IO CInt) -> IO CInt forall a b. (a -> b) -> a -> b $ Ptr Int32 -> Int32 -> Ptr (Ptr GError) -> IO CInt g_unix_open_pipe Ptr Int32 fds' Int32 flags Ptr Int32 -> IO () forall a. Ptr a -> IO () freeMem Ptr Int32 fds' () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () ) (do Ptr Int32 -> IO () forall a. Ptr a -> IO () freeMem Ptr Int32 fds' ) -- function unix_get_passwd_entry -- Args: [ Arg -- { argCName = "user_name" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the username to get the passwd file entry for" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : True -- Skip return : False foreign import ccall "g_unix_get_passwd_entry" g_unix_get_passwd_entry :: CString -> -- user_name : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr ()) -- | Get the @passwd@ file entry for the given /@userName@/ using @getpwnam_r()@. -- This can fail if the given /@userName@/ doesn’t exist. -- -- The returned @struct passwd@ has been allocated using 'GI.GLib.Functions.malloc' and should -- be freed using 'GI.GLib.Functions.free'. The strings referenced by the returned struct are -- included in the same allocation, so are valid until the @struct passwd@ is -- freed. -- -- This function is safe to call from multiple threads concurrently. -- -- You will need to include @pwd.h@ to get the definition of @struct passwd@. -- -- /Since: 2.64/ unixGetPasswdEntry :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@userName@/: the username to get the passwd file entry for -> m (Ptr ()) -- ^ __Returns:__ passwd entry, or 'P.Nothing' on error; free the returned -- value with 'GI.GLib.Functions.free' /(Can throw 'Data.GI.Base.GError.GError')/ unixGetPasswdEntry :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Ptr ()) unixGetPasswdEntry Text userName = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do CString userName' <- Text -> IO CString textToCString Text userName IO (Ptr ()) -> IO () -> IO (Ptr ()) forall a b. IO a -> IO b -> IO a onException (do Ptr () result <- (Ptr (Ptr GError) -> IO (Ptr ())) -> IO (Ptr ()) forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO (Ptr ())) -> IO (Ptr ())) -> (Ptr (Ptr GError) -> IO (Ptr ())) -> IO (Ptr ()) forall a b. (a -> b) -> a -> b $ CString -> Ptr (Ptr GError) -> IO (Ptr ()) g_unix_get_passwd_entry CString userName' CString -> IO () forall a. Ptr a -> IO () freeMem CString userName' Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result ) (do CString -> IO () forall a. Ptr a -> IO () freeMem CString userName' ) -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "condition" -- , argType = -- TInterface Name { namespace = "GLib" , name = "IOCondition" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "I/O conditions to watch for on @fd" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 t'GI.GLib.Structs.Source.Source' to watch for a particular I\/O condition on a file -- descriptor. -- -- The source will never close the /@fd@/ — you must do it yourself. -- -- Any callback attached to the returned t'GI.GLib.Structs.Source.Source' must have type -- t'GI.GLib.Callbacks.UnixFDSourceFunc'. -- -- /Since: 2.36/ unixFdSourceNew :: (B.CallStack.HasCallStack, MonadIO m) => Int32 -- ^ /@fd@/: a file descriptor -> [GLib.Flags.IOCondition] -- ^ /@condition@/: I\/O conditions to watch for on /@fd@/ -> m GLib.Source.Source -- ^ __Returns:__ the newly created t'GI.GLib.Structs.Source.Source' unixFdSourceNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> [IOCondition] -> m Source unixFdSourceNew Int32 fd [IOCondition] condition = IO Source -> m Source forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Source -> m Source) -> IO Source -> m Source forall a b. (a -> b) -> a -> b $ do let condition' :: CUInt condition' = [IOCondition] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [IOCondition] condition Ptr Source result <- Int32 -> CUInt -> IO (Ptr Source) g_unix_fd_source_new Int32 fd CUInt condition' Text -> Ptr Source -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "unixFdSourceNew" Ptr Source result Source result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Source -> Source GLib.Source.Source) Ptr Source result Source -> IO Source forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Source result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 t'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 t'GI.GLib.Callbacks.UnixFDSourceFunc' -> m Word32 -- ^ __Returns:__ the ID (greater than 0) of the event source unixFdAddFull :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> Int32 -> [IOCondition] -> UnixFDSourceFunc -> m Word32 unixFdAddFull Int32 priority Int32 fd [IOCondition] condition UnixFDSourceFunc function = IO Word32 -> m Word32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do let condition' :: CUInt condition' = [IOCondition] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [IOCondition] condition FunPtr C_UnixFDSourceFunc function' <- C_UnixFDSourceFunc -> IO (FunPtr C_UnixFDSourceFunc) GLib.Callbacks.mk_UnixFDSourceFunc (Maybe (Ptr (FunPtr C_UnixFDSourceFunc)) -> UnixFDSourceFunc_WithClosures -> C_UnixFDSourceFunc GLib.Callbacks.wrap_UnixFDSourceFunc Maybe (Ptr (FunPtr C_UnixFDSourceFunc)) forall a. Maybe a Nothing (UnixFDSourceFunc -> UnixFDSourceFunc_WithClosures GLib.Callbacks.drop_closures_UnixFDSourceFunc UnixFDSourceFunc function)) let userData :: Ptr () userData = FunPtr C_UnixFDSourceFunc -> Ptr () forall a b. FunPtr a -> Ptr b castFunPtrToPtr FunPtr C_UnixFDSourceFunc function' let notify :: FunPtr (Ptr a -> IO ()) notify = FunPtr (Ptr a -> IO ()) forall a. FunPtr (Ptr a -> IO ()) SP.safeFreeFunPtrPtr Word32 result <- Int32 -> Int32 -> CUInt -> FunPtr C_UnixFDSourceFunc -> Ptr () -> FunPtr C_DestroyNotify -> IO Word32 g_unix_fd_add_full Int32 priority Int32 fd CUInt condition' FunPtr C_UnixFDSourceFunc function' Ptr () userData FunPtr C_DestroyNotify forall a. FunPtr (Ptr a -> IO ()) notify Word32 -> IO Word32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32 unixErrorQuark = IO Word32 -> m Word32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do Word32 result <- IO Word32 g_unix_error_quark Word32 -> IO Word32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function unicode_canonical_ordering -- Args: [ Arg -- { argCName = "string" -- , argType = TCArray False (-1) 1 (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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "len" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_unicode_canonical_ordering" g_unicode_canonical_ordering :: Ptr CInt -> -- string : TCArray False (-1) 1 (TBasicType TUniChar) FCT.CSize -> -- len : TBasicType TSize 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. -> m () unicodeCanonicalOrdering :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m () unicodeCanonicalOrdering [Char] string = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do let len :: CSize len = Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ [Char] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int P.length [Char] string Ptr CInt string' <- ((Char -> CInt) -> [Char] -> IO (Ptr CInt) forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b) packMapStorableArray (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord)) [Char] string Ptr CInt -> CSize -> IO () g_unicode_canonical_ordering Ptr CInt string' CSize len Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt string' () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "result_len" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = 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 FCT.CSize -> -- result_len : TBasicType TSize 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. -> FCT.CSize -- ^ /@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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> CSize -> m Char unicodeCanonicalDecomposition Char ch CSize resultLen = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do let ch' :: CInt ch' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char ch CInt result <- CInt -> CSize -> IO CInt g_unicode_canonical_decomposition CInt ch' CSize resultLen let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function 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 -- , argCallbackUserData = 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 hexadecimal -- 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Int32 unicharXdigitValue Char c = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c Int32 result <- CInt -> IO Int32 g_unichar_xdigit_value CInt c' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@ch@/ is a valid Unicode character unicharValidate :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharValidate Char ch = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let ch' :: CInt ch' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char ch CInt result <- CInt -> IO CInt g_unichar_validate CInt ch' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m UnicodeType unicharType Char c = IO UnicodeType -> m UnicodeType forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO UnicodeType -> m UnicodeType) -> IO UnicodeType -> m UnicodeType forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CUInt result <- CInt -> IO CUInt g_unichar_type CInt c' let result' :: UnicodeType result' = (Int -> UnicodeType forall a. Enum a => Int -> a toEnum (Int -> UnicodeType) -> (CUInt -> Int) -> CUInt -> UnicodeType forall b c a. (b -> c) -> (a -> b) -> a -> c . CUInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CUInt result UnicodeType -> IO UnicodeType forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return UnicodeType result' -- function 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 -- , argCallbackUserData = 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 a lowercase or titlecase character, -- or has no upper case equivalent /@c@/ is returned unchanged. unicharToupper :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Char unicharToupper Char c = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_toupper CInt c' let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Char unicharTotitle Char c = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_totitle CInt c' let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Char unicharTolower Char c = IO Char -> m Char forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Char -> m Char) -> IO Char -> m Char forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_tolower CInt c' let result' :: Char result' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result Char -> IO Char forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Char result' -- function unichar_to_utf8 -- XXX Could not generate function unichar_to_utf8 -- Not implemented: Don't know how to allocate "outbuf" of type TBasicType TUTF8 -- function 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 -- , argCallbackUserData = 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 'P.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:__ 'P.True' if the character has zero width unicharIszerowidth :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIszerowidth Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_iszerowidth CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 hexadecimal digit. unicharIsxdigit :: (B.CallStack.HasCallStack, MonadIO m) => Char -- ^ /@c@/: a Unicode character. -> m Bool -- ^ __Returns:__ 'P.True' if the character is a hexadecimal digit unicharIsxdigit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsxdigit Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isxdigit CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if the character is wide in legacy East Asian locales unicharIswideCjk :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIswideCjk Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_iswide_cjk CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if the character is wide unicharIswide :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIswide Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_iswide CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is an uppercase character unicharIsupper :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsupper Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isupper CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if the character is titlecase unicharIstitle :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIstitle Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_istitle CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a space character unicharIsspace :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsspace Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isspace CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a punctuation or symbol character unicharIspunct :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIspunct Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_ispunct CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 'P.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:__ 'P.True' if /@c@/ is printable unicharIsprint :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsprint Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isprint CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a mark character unicharIsmark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsmark Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_ismark CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a lowercase letter unicharIslower :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIslower Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_islower CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 'P.False' for control characters, format characters, and -- spaces). 'GI.GLib.Functions.unicharIsprint' is similar, but returns 'P.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:__ 'P.True' if /@c@/ is printable unless it\'s a space unicharIsgraph :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsgraph Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isgraph CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a digit unicharIsdigit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsdigit Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isdigit CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if the character has an assigned value unicharIsdefined :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsdefined Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isdefined CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is a control character unicharIscntrl :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIscntrl Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_iscntrl CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is an alphabetic character unicharIsalpha :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsalpha Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isalpha CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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:__ 'P.True' if /@c@/ is an alphanumeric character unicharIsalnum :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Bool unicharIsalnum Char c = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CInt result <- CInt -> IO CInt g_unichar_isalnum CInt c' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 t'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 t'GI.GLib.Enums.UnicodeScript' for the character. unicharGetScript :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m UnicodeScript unicharGetScript Char ch = IO UnicodeScript -> m UnicodeScript forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO UnicodeScript -> m UnicodeScript) -> IO UnicodeScript -> m UnicodeScript forall a b. (a -> b) -> a -> b $ do let ch' :: CInt ch' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char ch CInt result <- CInt -> IO CInt g_unichar_get_script CInt ch' let result' :: UnicodeScript result' = (Int -> UnicodeScript forall a. Enum a => Int -> a toEnum (Int -> UnicodeScript) -> (CInt -> Int) -> CInt -> UnicodeScript forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt result UnicodeScript -> IO UnicodeScript forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return UnicodeScript result' -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "mirrored_ch" -- , argType = TBasicType TUniChar -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "location to store the mirrored character" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- 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 Ptr 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 -> m ((Bool, Char)) -- ^ __Returns:__ 'P.True' if /@ch@/ has a mirrored character, 'P.False' otherwise unicharGetMirrorChar :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m (Bool, Char) unicharGetMirrorChar Char ch = IO (Bool, Char) -> m (Bool, Char) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Char) -> m (Bool, Char)) -> IO (Bool, Char) -> m (Bool, Char) forall a b. (a -> b) -> a -> b $ do let ch' :: CInt ch' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char ch Ptr CInt mirroredCh <- IO (Ptr CInt) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr CInt) CInt result <- CInt -> Ptr CInt -> IO CInt g_unichar_get_mirror_char CInt ch' Ptr CInt mirroredCh let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CInt mirroredCh' <- Ptr CInt -> IO CInt forall a. Storable a => Ptr a -> IO a peek Ptr CInt mirroredCh let mirroredCh'' :: Char mirroredCh'' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt mirroredCh' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt mirroredCh (Bool, Char) -> IO (Bool, Char) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Char mirroredCh'') -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Int32 unicharDigitValue Char c = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c Int32 result <- CInt -> IO Int32 g_unichar_digit_value CInt c' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "a" -- , argType = TBasicType TUniChar -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "return location for the first component of @ch" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "b" -- , argType = TBasicType TUniChar -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "return location for the second component of @ch" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unichar_decompose" g_unichar_decompose :: CInt -> -- ch : TBasicType TUniChar Ptr CInt -> -- a : TBasicType TUniChar Ptr 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 -> m ((Bool, Char, Char)) -- ^ __Returns:__ 'P.True' if the character could be decomposed unicharDecompose :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m (Bool, Char, Char) unicharDecompose Char ch = IO (Bool, Char, Char) -> m (Bool, Char, Char) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Char, Char) -> m (Bool, Char, Char)) -> IO (Bool, Char, Char) -> m (Bool, Char, Char) forall a b. (a -> b) -> a -> b $ do let ch' :: CInt ch' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char ch Ptr CInt a <- IO (Ptr CInt) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr CInt) Ptr CInt b <- IO (Ptr CInt) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr CInt) CInt result <- CInt -> Ptr CInt -> Ptr CInt -> IO CInt g_unichar_decompose CInt ch' Ptr CInt a Ptr CInt b let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CInt a' <- Ptr CInt -> IO CInt forall a. Storable a => Ptr a -> IO a peek Ptr CInt a let a'' :: Char a'' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt a' CInt b' <- Ptr CInt -> IO CInt forall a. Storable a => Ptr a -> IO a peek Ptr CInt b let b'' :: Char b'' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt b' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt a Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt b (Bool, Char, Char) -> IO (Bool, Char, Char) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Char a'', Char b'') -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "ch" -- , argType = TBasicType TUniChar -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "return location for the composed character" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- 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 Ptr 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 -> m ((Bool, Char)) -- ^ __Returns:__ 'P.True' if the characters could be composed unicharCompose :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> Char -> m (Bool, Char) unicharCompose Char a Char b = IO (Bool, Char) -> m (Bool, Char) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Char) -> m (Bool, Char)) -> IO (Bool, Char) -> m (Bool, Char) forall a b. (a -> b) -> a -> b $ do let a' :: CInt a' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char a let b' :: CInt b' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char b Ptr CInt ch <- IO (Ptr CInt) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr CInt) CInt result <- CInt -> CInt -> Ptr CInt -> IO CInt g_unichar_compose CInt a' CInt b' Ptr CInt ch let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result CInt ch' <- Ptr CInt -> IO CInt forall a. Storable a => Ptr a -> IO a peek Ptr CInt ch let ch'' :: Char ch'' = (Int -> Char chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char forall b c a. (b -> c) -> (a -> b) -> a -> c . CInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CInt ch' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt ch (Bool, Char) -> IO (Bool, Char) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Char ch'') -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m Int32 unicharCombiningClass Char uc = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do let uc' :: CInt uc' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char uc Int32 result <- CInt -> IO Int32 g_unichar_combining_class CInt uc' Int32 -> IO Int32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Int32 result -- function 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 -- , argCallbackUserData = 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Char -> m UnicodeBreakType unicharBreakType Char c = IO UnicodeBreakType -> m UnicodeBreakType forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO UnicodeBreakType -> m UnicodeBreakType) -> IO UnicodeBreakType -> m UnicodeBreakType forall a b. (a -> b) -> a -> b $ do let c' :: CInt c' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord) Char c CUInt result <- CInt -> IO CUInt g_unichar_break_type CInt c' let result' :: UnicodeBreakType result' = (Int -> UnicodeBreakType forall a. Enum a => Int -> a toEnum (Int -> UnicodeBreakType) -> (CUInt -> Int) -> CUInt -> UnicodeBreakType forall b c a. (b -> c) -> (a -> b) -> a -> c . CUInt -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral) CUInt result UnicodeBreakType -> IO UnicodeBreakType forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return UnicodeBreakType result' -- function ucs4_to_utf8 -- Args: [ Arg -- { argCName = "str" -- , argType = TCArray False (-1) 1 (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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of characters) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "location to store number of\n characters read, or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of bytes written or %NULL. The value here stored does not include the\n trailing 0 byte." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of characters) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "g_ucs4_to_utf8" g_ucs4_to_utf8 :: Ptr CInt -> -- str : TCArray False (-1) 1 (TBasicType TUniChar) FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO CString -- | Convert a string from a 32-bit fixed width representation as UCS-4. -- to UTF-8. The result will be terminated with a 0 byte. ucs4ToUtf8 :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@str@/: a UCS-4 encoded string -> m ((T.Text, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UTF-8 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. In that case, /@itemsRead@/ -- will be set to the position of the first invalid input character. /(Can throw 'Data.GI.Base.GError.GError')/ ucs4ToUtf8 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m (Text, CLong, CLong) ucs4ToUtf8 [Char] str = IO (Text, CLong, CLong) -> m (Text, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Text, CLong, CLong) -> m (Text, CLong, CLong)) -> IO (Text, CLong, CLong) -> m (Text, CLong, CLong) forall a b. (a -> b) -> a -> b $ do let len :: CLong len = Int -> CLong forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CLong) -> Int -> CLong forall a b. (a -> b) -> a -> b $ [Char] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int P.length [Char] str Ptr CInt str' <- ((Char -> CInt) -> [Char] -> IO (Ptr CInt) forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b) packMapStorableArray (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord)) [Char] str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Text, CLong, CLong) -> IO () -> IO (Text, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do CString result <- (Ptr (Ptr GError) -> IO CString) -> IO CString forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO CString) -> IO CString) -> (Ptr (Ptr GError) -> IO CString) -> IO CString forall a b. (a -> b) -> a -> b $ Ptr CInt -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO CString g_ucs4_to_utf8 Ptr CInt str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "ucs4ToUtf8" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Text, CLong, CLong) -> IO (Text, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Text result', CLong itemsRead', CLong itemsWritten') ) (do Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function ucs4_to_utf16 -- Args: [ Arg -- { argCName = "str" -- , argType = TCArray False (-1) 1 (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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of characters) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "items_read" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number of\n bytes read, or %NULL. If an error occurs then the index of the invalid\n input is stored here." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "items_written" -- , argType = TBasicType TLong -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store number\n of #gunichar2 written, or %NULL. The value stored here does not include\n the trailing 0." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "len" -- , argType = TBasicType TLong -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the maximum length (number of characters) of @str to use.\n If @len < 0, then the string is nul-terminated." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUInt16) -- throws : True -- Skip return : False foreign import ccall "g_ucs4_to_utf16" g_ucs4_to_utf16 :: Ptr CInt -> -- str : TCArray False (-1) 1 (TBasicType TUniChar) FCT.CLong -> -- len : TBasicType TLong Ptr FCT.CLong -> -- items_read : TBasicType TLong Ptr FCT.CLong -> -- items_written : TBasicType TLong Ptr (Ptr GError) -> -- error IO Word16 -- | Convert a string from UCS-4 to UTF-16. A 0 character will be -- added to the result after the converted text. ucs4ToUtf16 :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@str@/: a UCS-4 encoded string -> m ((Word16, FCT.CLong, FCT.CLong)) -- ^ __Returns:__ a pointer to a newly allocated UTF-16 string. -- This value must be freed with 'GI.GLib.Functions.free'. If an error occurs, -- 'P.Nothing' will be returned and /@error@/ set. /(Can throw 'Data.GI.Base.GError.GError')/ ucs4ToUtf16 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m (Word16, CLong, CLong) ucs4ToUtf16 [Char] str = IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong)) -> IO (Word16, CLong, CLong) -> m (Word16, CLong, CLong) forall a b. (a -> b) -> a -> b $ do let len :: CLong len = Int -> CLong forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CLong) -> Int -> CLong forall a b. (a -> b) -> a -> b $ [Char] -> Int forall a. [a] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int P.length [Char] str Ptr CInt str' <- ((Char -> CInt) -> [Char] -> IO (Ptr CInt) forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b) packMapStorableArray (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Char -> Int SP.ord)) [Char] str Ptr CLong itemsRead <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) Ptr CLong itemsWritten <- IO (Ptr CLong) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr FCT.CLong) IO (Word16, CLong, CLong) -> IO () -> IO (Word16, CLong, CLong) forall a b. IO a -> IO b -> IO a onException (do Word16 result <- (Ptr (Ptr GError) -> IO Word16) -> IO Word16 forall a. (Ptr (Ptr GError) -> IO a) -> IO a propagateGError ((Ptr (Ptr GError) -> IO Word16) -> IO Word16) -> (Ptr (Ptr GError) -> IO Word16) -> IO Word16 forall a b. (a -> b) -> a -> b $ Ptr CInt -> CLong -> Ptr CLong -> Ptr CLong -> Ptr (Ptr GError) -> IO Word16 g_ucs4_to_utf16 Ptr CInt str' CLong len Ptr CLong itemsRead Ptr CLong itemsWritten CLong itemsRead' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsRead CLong itemsWritten' <- Ptr CLong -> IO CLong forall a. Storable a => Ptr a -> IO a peek Ptr CLong itemsWritten Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten (Word16, CLong, CLong) -> IO (Word16, CLong, CLong) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return (Word16 result, CLong itemsRead', CLong itemsWritten') ) (do Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt str' Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsRead Ptr CLong -> IO () forall a. Ptr a -> IO () freeMem Ptr CLong itemsWritten ) -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n_blocks" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of blocks to allocate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n_block_bytes" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = 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 FCT.CSize -> -- n_blocks : TBasicType TSize FCT.CSize -> -- n_block_bytes : TBasicType TSize 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 'P.Nothing'. -> FCT.CSize -- ^ /@nBlocks@/: the number of blocks to allocate -> FCT.CSize -- ^ /@nBlockBytes@/: the size of each block in bytes -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing'. tryReallocN :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> CSize -> CSize -> m (Ptr ()) tryReallocN Ptr () mem CSize nBlocks CSize nBlockBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- Ptr () -> CSize -> CSize -> IO (Ptr ()) g_try_realloc_n Ptr () mem CSize nBlocks CSize nBlockBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n_bytes" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "number of bytes to allocate." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 FCT.CSize -> -- n_bytes : TBasicType TSize IO (Ptr ()) -- | Attempts to realloc /@mem@/ to a new size, /@nBytes@/, and returns 'P.Nothing' -- on failure. Contrast with 'GI.GLib.Functions.realloc', which aborts the program -- on failure. -- -- If /@mem@/ is 'P.Nothing', behaves the same as 'GI.GLib.Functions.tryMalloc'. tryRealloc :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () -- ^ /@mem@/: previously-allocated memory, or 'P.Nothing'. -> FCT.CSize -- ^ /@nBytes@/: number of bytes to allocate. -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing'. tryRealloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> CSize -> m (Ptr ()) tryRealloc Ptr () mem CSize nBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- Ptr () -> CSize -> IO (Ptr ()) g_try_realloc Ptr () mem CSize nBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function try_malloc_n -- Args: [ Arg -- { argCName = "n_blocks" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of blocks to allocate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n_block_bytes" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_try_malloc_n" g_try_malloc_n :: FCT.CSize -> -- n_blocks : TBasicType TSize FCT.CSize -> -- n_block_bytes : TBasicType TSize 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) => FCT.CSize -- ^ /@nBlocks@/: the number of blocks to allocate -> FCT.CSize -- ^ /@nBlockBytes@/: the size of each block in bytes -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing'. tryMallocN :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CSize -> CSize -> m (Ptr ()) tryMallocN CSize nBlocks CSize nBlockBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- CSize -> CSize -> IO (Ptr ()) g_try_malloc_n CSize nBlocks CSize nBlockBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function try_malloc0_n -- Args: [ Arg -- { argCName = "n_blocks" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of blocks to allocate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "n_block_bytes" -- , argType = TBasicType TSize -- , 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_try_malloc0_n" g_try_malloc0_n :: FCT.CSize -> -- n_blocks : TBasicType TSize FCT.CSize -> -- n_block_bytes : TBasicType TSize 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) => FCT.CSize -- ^ /@nBlocks@/: the number of blocks to allocate -> FCT.CSize -- ^ /@nBlockBytes@/: the size of each block in bytes -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing' tryMalloc0N :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CSize -> CSize -> m (Ptr ()) tryMalloc0N CSize nBlocks CSize nBlockBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- CSize -> CSize -> IO (Ptr ()) g_try_malloc0_n CSize nBlocks CSize nBlockBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function try_malloc0 -- Args: [ Arg -- { argCName = "n_bytes" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "number of bytes to allocate" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_try_malloc0" g_try_malloc0 :: FCT.CSize -> -- n_bytes : TBasicType TSize IO (Ptr ()) -- | Attempts to allocate /@nBytes@/, initialized to 0\'s, and returns 'P.Nothing' on -- failure. Contrast with 'GI.GLib.Functions.malloc0', which aborts the program on failure. -- -- /Since: 2.8/ tryMalloc0 :: (B.CallStack.HasCallStack, MonadIO m) => FCT.CSize -- ^ /@nBytes@/: number of bytes to allocate -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing' tryMalloc0 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CSize -> m (Ptr ()) tryMalloc0 CSize nBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- CSize -> IO (Ptr ()) g_try_malloc0 CSize nBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function try_malloc -- Args: [ Arg -- { argCName = "n_bytes" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "number of bytes to allocate." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "g_try_malloc" g_try_malloc :: FCT.CSize -> -- n_bytes : TBasicType TSize IO (Ptr ()) -- | Attempts to allocate /@nBytes@/, and returns 'P.Nothing' on failure. -- Contrast with 'GI.GLib.Functions.malloc', which aborts the program on failure. tryMalloc :: (B.CallStack.HasCallStack, MonadIO m) => FCT.CSize -- ^ /@nBytes@/: number of bytes to allocate. -> m (Ptr ()) -- ^ __Returns:__ the allocated memory, or 'P.Nothing'. tryMalloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CSize -> m (Ptr ()) tryMalloc CSize nBytes = IO (Ptr ()) -> m (Ptr ()) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ()) forall a b. (a -> b) -> a -> b $ do Ptr () result <- CSize -> IO (Ptr ()) g_try_malloc CSize nBytes Ptr () -> IO (Ptr ()) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr () result -- function 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 -- , argCallbackUserData = 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 -- [struct/@gLib@/.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m Source timeoutSourceNewSeconds Word32 interval = IO Source -> m Source forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Source -> m Source) -> IO Source -> m Source forall a b. (a -> b) -> a -> b $ do Ptr Source result <- Word32 -> IO (Ptr Source) g_timeout_source_new_seconds Word32 interval Text -> Ptr Source -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "timeoutSourceNewSeconds" Ptr Source result Source result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Source -> Source GLib.Source.Source) Ptr Source result Source -> IO Source forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Source result' -- function 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 -- , argCallbackUserData = 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 [struct/@gLib@/.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m Source timeoutSourceNew Word32 interval = IO Source -> m Source forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Source -> m Source) -> IO Source -> m Source forall a b. (a -> b) -> a -> b $ do Ptr Source result <- Word32 -> IO (Ptr Source) g_timeout_source_new Word32 interval Text -> Ptr Source -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL Text "timeoutSourceNew" Ptr Source result Source result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr Source -> Source GLib.Source.Source) Ptr Source result Source -> IO Source forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Source result' -- function timeout_add_seconds -- 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 [const@GLib.PRIORITY_DEFAULT] and\n [const@GLib.PRIORITY_HIGH]." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 [const/@gLib@/.SOURCE_REMOVE] -- or 'P.False', at which point the timeout is automatically destroyed and -- the function will not be called again. -- -- Unlike 'GI.GLib.Functions.timeoutAdd', 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 <http://developer.gnome.org/glib/stable/main-loop.html#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 -- 'GI.GLib.Functions.timeoutAdd' 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 'GI.GLib.Functions.timeoutAddSeconds' is preferred over -- 'GI.GLib.Functions.timeoutAdd'. -- -- 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. -- -- It is safe to call this function from any thread. -- -- 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 [const/@gLib@/.PRIORITY_DEFAULT] and -- [const/@gLib@/.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> Word32 -> IO Bool -> m Word32 timeoutAddSeconds Int32 priority Word32 interval IO Bool function = IO Word32 -> m Word32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do FunPtr C_SourceFunc function' <- C_SourceFunc -> IO (FunPtr C_SourceFunc) GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc)) -> SourceFunc_WithClosures -> C_SourceFunc GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc)) forall a. Maybe a Nothing (IO Bool -> SourceFunc_WithClosures GLib.Callbacks.drop_closures_SourceFunc IO Bool function)) let data_ :: Ptr () data_ = FunPtr C_SourceFunc -> Ptr () forall a b. FunPtr a -> Ptr b castFunPtrToPtr FunPtr C_SourceFunc function' let notify :: FunPtr (Ptr a -> IO ()) notify = FunPtr (Ptr a -> IO ()) forall a. FunPtr (Ptr a -> IO ()) SP.safeFreeFunPtrPtr Word32 result <- Int32 -> Word32 -> FunPtr C_SourceFunc -> Ptr () -> FunPtr C_DestroyNotify -> IO Word32 g_timeout_add_seconds_full Int32 priority Word32 interval FunPtr C_SourceFunc function' Ptr () data_ FunPtr C_DestroyNotify forall a. FunPtr (Ptr a -> IO ()) notify Word32 -> IO Word32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function timeout_add -- 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 [const@GLib.PRIORITY_DEFAULT] and\n [const@GLib.PRIORITY_HIGH]." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- 'P.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 <http://developer.gnome.org/glib/stable/main-loop.html#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 -- [struct/@gLib@/.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 [const/@gLib@/.PRIORITY_DEFAULT] and -- [const/@gLib@/.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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> Word32 -> IO Bool -> m Word32 timeoutAdd Int32 priority Word32 interval IO Bool function = IO Word32 -> m Word32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do FunPtr C_SourceFunc function' <- C_SourceFunc -> IO (FunPtr C_SourceFunc) GLib.Callbacks.mk_SourceFunc (Maybe (Ptr (FunPtr C_SourceFunc)) -> SourceFunc_WithClosures -> C_SourceFunc GLib.Callbacks.wrap_SourceFunc Maybe (Ptr (FunPtr C_SourceFunc)) forall a. Maybe a Nothing (IO Bool -> SourceFunc_WithClosures GLib.Callbacks.drop_closures_SourceFunc IO Bool function)) let data_ :: Ptr () data_ = FunPtr C_SourceFunc -> Ptr () forall a b. FunPtr a -> Ptr b castFunPtrToPtr FunPtr C_SourceFunc function' let notify :: FunPtr (Ptr a -> IO ()) notify = FunPtr (Ptr a -> IO ()) forall a. FunPtr (Ptr a -> IO ()) SP.safeFreeFunPtrPtr Word32 result <- Int32 -> Word32 -> FunPtr C_SourceFunc -> Ptr () -> FunPtr C_DestroyNotify -> IO Word32 g_timeout_add_full Int32 priority Word32 interval FunPtr C_SourceFunc function' Ptr () data_ FunPtr C_DestroyNotify forall a. FunPtr (Ptr a -> IO ()) notify Word32 -> IO Word32 forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function test_trap_subprocess_with_envp -- 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "envp" -- , argType = TCArray True (-1) (-1) (TBasicType TFileName) -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "Environment\n to run the test in, or %NULL to inherit the parent\8217s environment. This must\n be in the GLib filename encoding." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_test_trap_subprocess_with_envp" g_test_trap_subprocess_with_envp :: CString -> -- test_path : TBasicType TUTF8 Ptr CString -> -- envp : TCArray True (-1) (-1) (TBasicType TFileName) 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 with the -- given /@envp@/ environment. -- -- This can be used for a test case that might not return, or that -- might abort. -- -- If /@testPath@/ is 'P.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 /@envp@/ is 'P.Nothing', the parent process’ environment will be inherited. -- -- 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 -- t'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. -- -- Internally, this function tracks the child process using -- 'GI.GLib.Functions.childWatchSourceNew', so your process must not ignore @SIGCHLD@, and -- must not attempt to watch or wait for the child process via another -- mechanism. -- -- 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, G_TEST_SUBPROCESS_DEFAULT); -- > g_test_trap_assert_failed (); -- > g_test_trap_assert_stderr ("*ERROR*too large*"); -- > } -- > -- > static void -- > test_different_username (void) -- > { -- > if (g_test_subprocess ()) -- > { -- > // Code under test goes here -- > g_message ("Username is now simulated as %s", g_getenv ("USER")); -- > return; -- > } -- > -- > // Reruns this same test in a subprocess -- > g_autoptr(GStrv) envp = g_get_environ (); -- > envp = g_environ_setenv (g_steal_pointer (&envp), "USER", "charlie", TRUE); -- > g_test_trap_subprocess_with_envp (NULL, envp, 0, G_TEST_SUBPROCESS_DEFAULT); -- > g_test_trap_assert_passed (); -- > g_test_trap_assert_stdout ("Username is now simulated as charlie"); -- > } -- > -- > int -- > main (int argc, char **argv) -- > { -- > g_test_init (&argc, &argv, NULL); -- > -- > g_test_add_func ("/myobject/create-large-object", -- > test_create_large_object); -- > g_test_add_func ("/myobject/different-username", -- > test_different_username); -- > return g_test_run (); -- > } -- -- -- /Since: 2.80/ testTrapSubprocessWithEnvp :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) -- ^ /@testPath@/: Test to run in a subprocess -> Maybe ([[Char]]) -- ^ /@envp@/: Environment -- to run the test in, or 'P.Nothing' to inherit the parent’s environment. This must -- be in the GLib filename encoding. -> Word64 -- ^ /@usecTimeout@/: Timeout for the subprocess test in micro seconds. -> [GLib.Flags.TestSubprocessFlags] -- ^ /@testFlags@/: Flags to modify subprocess behaviour. -> m () testTrapSubprocessWithEnvp :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> Maybe [[Char]] -> CGType -> [TestSubprocessFlags] -> m () testTrapSubprocessWithEnvp Maybe Text testPath Maybe [[Char]] envp CGType usecTimeout [TestSubprocessFlags] testFlags = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do CString maybeTestPath <- case Maybe Text testPath of Maybe Text Nothing -> CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString forall a. Ptr a FP.nullPtr Just Text jTestPath -> do CString jTestPath' <- Text -> IO CString textToCString Text jTestPath CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString jTestPath' Ptr CString maybeEnvp <- case Maybe [[Char]] envp of Maybe [[Char]] Nothing -> Ptr CString -> IO (Ptr CString) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr CString forall a. Ptr a FP.nullPtr Just [[Char]] jEnvp -> do Ptr CString jEnvp' <- [[Char]] -> IO (Ptr CString) packZeroTerminatedFileNameArray [[Char]] jEnvp Ptr CString -> IO (Ptr CString) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr CString jEnvp' let testFlags' :: CUInt testFlags' = [TestSubprocessFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [TestSubprocessFlags] testFlags CString -> Ptr CString -> CGType -> CUInt -> IO () g_test_trap_subprocess_with_envp CString maybeTestPath Ptr CString maybeEnvp CGType usecTimeout CUInt testFlags' CString -> IO () forall a. Ptr a -> IO () freeMem CString maybeTestPath (CString -> IO ()) -> Ptr CString -> IO () forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO () mapZeroTerminatedCArray CString -> IO () forall a. Ptr a -> IO () freeMem Ptr CString maybeEnvp Ptr CString -> IO () forall a. Ptr a -> IO () freeMem Ptr CString maybeEnvp () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 is equivalent to calling 'GI.GLib.Functions.testTrapSubprocessWithEnvp' with @envp@ -- set to 'P.Nothing'. See the documentation for that function for full details. -- -- /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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> CGType -> [TestSubprocessFlags] -> m () testTrapSubprocess Maybe Text testPath CGType usecTimeout [TestSubprocessFlags] testFlags = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do CString maybeTestPath <- case Maybe Text testPath of Maybe Text Nothing -> CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString forall a. Ptr a FP.nullPtr Just Text jTestPath -> do CString jTestPath' <- Text -> IO CString textToCString Text jTestPath CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString jTestPath' let testFlags' :: CUInt testFlags' = [TestSubprocessFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [TestSubprocessFlags] testFlags CString -> CGType -> CUInt -> IO () g_test_trap_subprocess CString maybeTestPath CGType usecTimeout CUInt testFlags' CString -> IO () forall a. Ptr a -> IO () freeMem CString maybeTestPath () -> IO () forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function 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:__ 'P.True' if the last test subprocess got killed due to a timeout. testTrapReachedTimeout :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool testTrapReachedTimeout = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do CInt result <- IO CInt g_test_trap_reached_timeout let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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:__ 'P.True' if the last test subprocess terminated successfully. testTrapHasPassed :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool testTrapHasPassed = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do CInt result <- IO CInt g_test_trap_has_passed let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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,","is not always reliable due to problems inherent in fork-without-exec","and doesn\\'t set close-on-exec flag on its file descriptors.","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 t'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:__ 'P.True' for the forked child and 'P.False' for the executing parent process. testTrapFork :: forall (m :: * -> *). (HasCallStack, MonadIO m) => CGType -> [TestTrapFlags] -> m Bool testTrapFork CGType usecTimeout [TestTrapFlags] testTrapFlags = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let testTrapFlags' :: CUInt testTrapFlags' = [TestTrapFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [TestTrapFlags] testTrapFlags CInt result <- CGType -> CUInt -> IO CInt g_test_trap_fork CGType usecTimeout CUInt testTrapFlags' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result Bool -> IO Bool forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 -- , argCallbackUserData = 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 --