// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT package glib import ( "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" ) var xGetCharset func(*string) bool // Obtains the character set for the [current locale](running.html#locale); // you might use this character set as an argument to g_convert(), to convert // from the current locale's encoding to some other encoding. (Frequently // g_locale_to_utf8() and g_locale_from_utf8() are nice shortcuts, though.) // // On Windows the character set returned by this function is the // so-called system default ANSI code-page. That is the character set // used by the "narrow" versions of C library and Win32 functions that // handle file names. It might be different from the character set // used by the C library's current locale. // // On Linux, the character set is found by consulting nl_langinfo() if // available. If not, the environment variables `LC_ALL`, `LC_CTYPE`, `LANG` // and `CHARSET` are queried in order. nl_langinfo() returns the C locale if // no locale has been loaded by setlocale(). // // The return value is %TRUE if the locale's encoding is UTF-8, in that // case you can perhaps avoid calling g_convert(). // // The string returned in @charset is not allocated, and should not be // freed. func GetCharset(CharsetVar *string) bool { cret := xGetCharset(CharsetVar) return cret } var xGetCodeset func() string // Gets the character set for the current locale. func GetCodeset() string { cret := xGetCodeset() return cret } var xGetConsoleCharset func(*string) bool // Obtains the character set used by the console attached to the process, // which is suitable for printing output to the terminal. // // Usually this matches the result returned by g_get_charset(), but in // environments where the locale's character set does not match the encoding // of the console this function tries to guess a more suitable value instead. // // On Windows the character set returned by this function is the // output code page used by the console associated with the calling process. // If the codepage can't be determined (for example because there is no // console attached) UTF-8 is assumed. // // The return value is %TRUE if the locale's encoding is UTF-8, in that // case you can perhaps avoid calling g_convert(). // // The string returned in @charset is not allocated, and should not be // freed. func GetConsoleCharset(CharsetVar *string) bool { cret := xGetConsoleCharset(CharsetVar) return cret } var xGetLanguageNames func() []string // Computes a list of applicable locale names, which can be used to // e.g. construct locale-dependent filenames or search paths. The returned // list is sorted from most desirable to least desirable and always contains // the default locale "C". // // For example, if LANGUAGE=de:en_US, then the returned list is // "de", "en_US", "en", "C". // // This function consults the environment variables `LANGUAGE`, `LC_ALL`, // `LC_MESSAGES` and `LANG` to find the list of locales specified by the // user. func GetLanguageNames() []string { cret := xGetLanguageNames() return cret } var xGetLanguageNamesWithCategory func(string) []string // Computes a list of applicable locale names with a locale category name, // which can be used to construct the fallback locale-dependent filenames // or search paths. The returned list is sorted from most desirable to // least desirable and always contains the default locale "C". // // This function consults the environment variables `LANGUAGE`, `LC_ALL`, // @category_name, and `LANG` to find the list of locales specified by the // user. // // g_get_language_names() returns g_get_language_names_with_category("LC_MESSAGES"). func GetLanguageNamesWithCategory(CategoryNameVar string) []string { cret := xGetLanguageNamesWithCategory(CategoryNameVar) return cret } var xGetLocaleVariants func(string) []string // Returns a list of derived variants of @locale, which can be used to // e.g. construct locale-dependent filenames or search paths. The returned // list is sorted from most desirable to least desirable. // This function handles territory, charset and extra locale modifiers. See // [`setlocale(3)`](man:setlocale) for information about locales and their format. // // @locale itself is guaranteed to be returned in the output. // // For example, if @locale is `fr_BE`, then the returned list // is `fr_BE`, `fr`. If @locale is `en_GB.UTF-8@euro`, then the returned list // is `en_GB.UTF-8@euro`, `en_GB.UTF-8`, `en_GB@euro`, `en_GB`, `en.UTF-8@euro`, // `en.UTF-8`, `en@euro`, `en`. // // If you need the list of variants for the current locale, // use g_get_language_names(). func GetLocaleVariants(LocaleVar string) []string { cret := xGetLocaleVariants(LocaleVar) return cret } func init() { core.SetPackageName("GLIB", "glib-2.0") core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GLIB") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xGetCharset, libs, "g_get_charset") core.PuregoSafeRegister(&xGetCodeset, libs, "g_get_codeset") core.PuregoSafeRegister(&xGetConsoleCharset, libs, "g_get_console_charset") core.PuregoSafeRegister(&xGetLanguageNames, libs, "g_get_language_names") core.PuregoSafeRegister(&xGetLanguageNamesWithCategory, libs, "g_get_language_names_with_category") core.PuregoSafeRegister(&xGetLocaleVariants, libs, "g_get_locale_variants") }