// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT package glib import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject/types" ) // The type of function to be passed as callback for %G_OPTION_ARG_CALLBACK // options. type OptionArgFunc func(string, string, uintptr, **Error) bool // The type of function to be used as callback when a parse error occurs. type OptionErrorFunc func(*OptionContext, *OptionGroup, uintptr, **Error) // The type of function that can be called before and after parsing. type OptionParseFunc func(*OptionContext, *OptionGroup, uintptr, **Error) bool // A `GOptionContext` struct defines which options // are accepted by the commandline option parser. The struct has only private // fields and should not be directly accessed. type OptionContext struct { _ structs.HostLayout } func (x *OptionContext) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xOptionContextAddGroup func(uintptr, *OptionGroup) // Adds a #GOptionGroup to the @context, so that parsing with @context // will recognize the options in the group. Note that this will take // ownership of the @group and thus the @group should not be freed. func (x *OptionContext) AddGroup(GroupVar *OptionGroup) { xOptionContextAddGroup(x.GoPointer(), GroupVar) } var xOptionContextAddMainEntries func(uintptr, []OptionEntry, uintptr) // A convenience function which creates a main group if it doesn't // exist, adds the @entries to it and sets the translation domain. func (x *OptionContext) AddMainEntries(EntriesVar []OptionEntry, TranslationDomainVar *string) { TranslationDomainVarPtr := core.GStrdupNullable(TranslationDomainVar) defer core.GFreeNullable(TranslationDomainVarPtr) xOptionContextAddMainEntries(x.GoPointer(), EntriesVar, TranslationDomainVarPtr) } var xOptionContextFree func(uintptr) // Frees context and all the groups which have been // added to it. // // Please note that parsed arguments need to be freed separately (see // #GOptionEntry). func (x *OptionContext) Free() { xOptionContextFree(x.GoPointer()) } var xOptionContextGetDescription func(uintptr) string // Returns the description. See g_option_context_set_description(). func (x *OptionContext) GetDescription() string { cret := xOptionContextGetDescription(x.GoPointer()) return cret } var xOptionContextGetHelp func(uintptr, bool, *OptionGroup) string // Returns a formatted, translated help text for the given context. // To obtain the text produced by `--help`, call // `g_option_context_get_help (context, TRUE, NULL)`. // To obtain the text produced by `--help-all`, call // `g_option_context_get_help (context, FALSE, NULL)`. // To obtain the help text for an option group, call // `g_option_context_get_help (context, FALSE, group)`. func (x *OptionContext) GetHelp(MainHelpVar bool, GroupVar *OptionGroup) string { cret := xOptionContextGetHelp(x.GoPointer(), MainHelpVar, GroupVar) return cret } var xOptionContextGetHelpEnabled func(uintptr) bool // Returns whether automatic `--help` generation // is turned on for @context. See g_option_context_set_help_enabled(). func (x *OptionContext) GetHelpEnabled() bool { cret := xOptionContextGetHelpEnabled(x.GoPointer()) return cret } var xOptionContextGetIgnoreUnknownOptions func(uintptr) bool // Returns whether unknown options are ignored or not. See // g_option_context_set_ignore_unknown_options(). func (x *OptionContext) GetIgnoreUnknownOptions() bool { cret := xOptionContextGetIgnoreUnknownOptions(x.GoPointer()) return cret } var xOptionContextGetMainGroup func(uintptr) *OptionGroup // Returns a pointer to the main group of @context. func (x *OptionContext) GetMainGroup() *OptionGroup { cret := xOptionContextGetMainGroup(x.GoPointer()) return cret } var xOptionContextGetStrictPosix func(uintptr) bool // Returns whether strict POSIX code is enabled. // // See g_option_context_set_strict_posix() for more information. func (x *OptionContext) GetStrictPosix() bool { cret := xOptionContextGetStrictPosix(x.GoPointer()) return cret } var xOptionContextGetSummary func(uintptr) string // Returns the summary. See g_option_context_set_summary(). func (x *OptionContext) GetSummary() string { cret := xOptionContextGetSummary(x.GoPointer()) return cret } var xOptionContextParse func(uintptr, int, []string, **Error) bool // Parses the command line arguments, recognizing options // which have been added to @context. A side-effect of // calling this function is that g_set_prgname() will be // called. // // If the parsing is successful, any parsed arguments are // removed from the array and @argc and @argv are updated // accordingly. A '--' option is stripped from @argv // unless there are unparsed options before and after it, // or some of the options after it start with '-'. In case // of an error, @argc and @argv are left unmodified. // // If automatic `--help` support is enabled // (see g_option_context_set_help_enabled()), and the // @argv array contains one of the recognized help options, // this function will produce help output to stdout and // call `exit (0)`. // // Note that function depends on the // [current locale](running.html#locale) for automatic // character set conversion of string and filename arguments. func (x *OptionContext) Parse(ArgcVar int, ArgvVar []string) (bool, error) { var cerr *Error cret := xOptionContextParse(x.GoPointer(), ArgcVar, ArgvVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xOptionContextParseStrv func(uintptr, []string, **Error) bool // Parses the command line arguments. // // This function is similar to g_option_context_parse() except that it // respects the normal memory rules when dealing with a strv instead of // assuming that the passed-in array is the argv of the main function. // // In particular, strings that are removed from the arguments list will // be freed using g_free(). // // On Windows, the strings are expected to be in UTF-8. This is in // contrast to g_option_context_parse() which expects them to be in the // system codepage, which is how they are passed as @argv to main(). // See g_win32_get_command_line() for a solution. // // This function is useful if you are trying to use #GOptionContext with // #GApplication. func (x *OptionContext) ParseStrv(ArgumentsVar []string) (bool, error) { var cerr *Error cret := xOptionContextParseStrv(x.GoPointer(), ArgumentsVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xOptionContextSetDescription func(uintptr, uintptr) // Adds a string to be displayed in `--help` output after the list // of options. This text often includes a bug reporting address. // // Note that the summary is translated (see // g_option_context_set_translate_func()). func (x *OptionContext) SetDescription(DescriptionVar *string) { DescriptionVarPtr := core.GStrdupNullable(DescriptionVar) defer core.GFreeNullable(DescriptionVarPtr) xOptionContextSetDescription(x.GoPointer(), DescriptionVarPtr) } var xOptionContextSetHelpEnabled func(uintptr, bool) // Enables or disables automatic generation of `--help` output. // By default, g_option_context_parse() recognizes `--help`, `-h`, // `-?`, `--help-all` and `--help-groupname` and creates suitable // output to stdout. func (x *OptionContext) SetHelpEnabled(HelpEnabledVar bool) { xOptionContextSetHelpEnabled(x.GoPointer(), HelpEnabledVar) } var xOptionContextSetIgnoreUnknownOptions func(uintptr, bool) // Sets whether to ignore unknown options or not. If an argument is // ignored, it is left in the @argv array after parsing. By default, // g_option_context_parse() treats unknown options as error. // // This setting does not affect non-option arguments (i.e. arguments // which don't start with a dash). But note that GOption cannot reliably // determine whether a non-option belongs to a preceding unknown option. func (x *OptionContext) SetIgnoreUnknownOptions(IgnoreUnknownVar bool) { xOptionContextSetIgnoreUnknownOptions(x.GoPointer(), IgnoreUnknownVar) } var xOptionContextSetMainGroup func(uintptr, *OptionGroup) // Sets a #GOptionGroup as main group of the @context. // This has the same effect as calling g_option_context_add_group(), // the only difference is that the options in the main group are // treated differently when generating `--help` output. func (x *OptionContext) SetMainGroup(GroupVar *OptionGroup) { xOptionContextSetMainGroup(x.GoPointer(), GroupVar) } var xOptionContextSetStrictPosix func(uintptr, bool) // Sets strict POSIX mode. // // By default, this mode is disabled. // // In strict POSIX mode, the first non-argument parameter encountered // (eg: filename) terminates argument processing. Remaining arguments // are treated as non-options and are not attempted to be parsed. // // If strict POSIX mode is disabled then parsing is done in the GNU way // where option arguments can be freely mixed with non-options. // // As an example, consider "ls foo -l". With GNU style parsing, this // will list "foo" in long mode. In strict POSIX style, this will list // the files named "foo" and "-l". // // It may be useful to force strict POSIX mode when creating "verb // style" command line tools. For example, the "gsettings" command line // tool supports the global option "--schemadir" as well as many // subcommands ("get", "set", etc.) which each have their own set of // arguments. Using strict POSIX mode will allow parsing the global // options up to the verb name while leaving the remaining options to be // parsed by the relevant subcommand (which can be determined by // examining the verb name, which should be present in argv[1] after // parsing). func (x *OptionContext) SetStrictPosix(StrictPosixVar bool) { xOptionContextSetStrictPosix(x.GoPointer(), StrictPosixVar) } var xOptionContextSetSummary func(uintptr, uintptr) // Adds a string to be displayed in `--help` output before the list // of options. This is typically a summary of the program functionality. // // Note that the summary is translated (see // g_option_context_set_translate_func() and // g_option_context_set_translation_domain()). func (x *OptionContext) SetSummary(SummaryVar *string) { SummaryVarPtr := core.GStrdupNullable(SummaryVar) defer core.GFreeNullable(SummaryVarPtr) xOptionContextSetSummary(x.GoPointer(), SummaryVarPtr) } var xOptionContextSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr) // Sets the function which is used to translate the contexts // user-visible strings, for `--help` output. If @func is %NULL, // strings are not translated. // // Note that option groups have their own translation functions, // this function only affects the @parameter_string (see g_option_context_new()), // the summary (see g_option_context_set_summary()) and the description // (see g_option_context_set_description()). // // If you are using gettext(), you only need to set the translation // domain, see g_option_context_set_translation_domain(). func (x *OptionContext) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr) string { cbFn := *FuncVar return cbFn(core.GoString(arg0), arg1) } FuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } var DestroyNotifyVarRef uintptr if DestroyNotifyVar != nil { DestroyNotifyVarPtr := uintptr(unsafe.Pointer(DestroyNotifyVar)) if cbRefPtr, ok := GetCallback(DestroyNotifyVarPtr); ok { DestroyNotifyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *DestroyNotifyVar cbFn(arg0) } DestroyNotifyVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(DestroyNotifyVarPtr, DestroyNotifyVarRef, DestroyNotifyVar) } } xOptionContextSetTranslateFunc(x.GoPointer(), FuncVarRef, DataVar, DestroyNotifyVarRef) } var xOptionContextSetTranslationDomain func(uintptr, string) // A convenience function to use gettext() for translating // user-visible strings. func (x *OptionContext) SetTranslationDomain(DomainVar string) { xOptionContextSetTranslationDomain(x.GoPointer(), DomainVar) } // - %G_OPTION_ARG_NONE: %gboolean // // - %G_OPTION_ARG_STRING: %gchar* // // - %G_OPTION_ARG_INT: %gint // // - %G_OPTION_ARG_FILENAME: %gchar* // // - %G_OPTION_ARG_STRING_ARRAY: %gchar** // // - %G_OPTION_ARG_FILENAME_ARRAY: %gchar** // // - %G_OPTION_ARG_DOUBLE: %gdouble // // If @arg type is %G_OPTION_ARG_STRING or %G_OPTION_ARG_FILENAME, // the location will contain a newly allocated string if the option // was given. That string needs to be freed by the callee using g_free(). // Likewise if @arg type is %G_OPTION_ARG_STRING_ARRAY or // %G_OPTION_ARG_FILENAME_ARRAY, the data should be freed using g_strfreev(). // // A GOptionEntry struct defines a single option. To have an effect, they // must be added to a #GOptionGroup with g_option_context_add_main_entries() // or g_option_group_add_entries(). type OptionEntry struct { _ structs.HostLayout LongName uintptr ShortName byte Flags int32 Arg OptionArg ArgData uintptr Description uintptr ArgDescription uintptr } func (x *OptionEntry) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A `GOptionGroup` struct defines the options in a single // group. The struct has only private fields and should not be directly accessed. // // All options in a group share the same translation function. Libraries which // need to parse commandline options are expected to provide a function for // getting a `GOptionGroup` holding their options, which // the application can then add to its #GOptionContext. type OptionGroup struct { _ structs.HostLayout } var xOptionGroupGLibType func() types.GType func OptionGroupGLibType() types.GType { return xOptionGroupGLibType() } func (x *OptionGroup) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xNewOptionGroup func(string, string, string, uintptr, uintptr) *OptionGroup // Creates a new #GOptionGroup. // // @description is typically used to provide a title for the group. If so, it // is recommended that it’s written in title case, and has a trailing colon so // that it matches the style of built-in GLib group titles such as // ‘Application Options:’. func NewOptionGroup(NameVar string, DescriptionVar string, HelpDescriptionVar string, UserDataVar uintptr, DestroyVar *DestroyNotify) *OptionGroup { var DestroyVarRef uintptr if DestroyVar != nil { DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar)) if cbRefPtr, ok := GetCallback(DestroyVarPtr); ok { DestroyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *DestroyVar cbFn(arg0) } DestroyVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar) } } cret := xNewOptionGroup(NameVar, DescriptionVar, HelpDescriptionVar, UserDataVar, DestroyVarRef) return cret } var xOptionGroupAddEntries func(uintptr, []OptionEntry) // Adds the options specified in @entries to @group. func (x *OptionGroup) AddEntries(EntriesVar []OptionEntry) { xOptionGroupAddEntries(x.GoPointer(), EntriesVar) } var xOptionGroupFree func(uintptr) // Frees a #GOptionGroup. Note that you must not free groups // which have been added to a #GOptionContext. func (x *OptionGroup) Free() { xOptionGroupFree(x.GoPointer()) } var xOptionGroupRef func(uintptr) *OptionGroup // Increments the reference count of @group by one. func (x *OptionGroup) Ref() *OptionGroup { cret := xOptionGroupRef(x.GoPointer()) return cret } var xOptionGroupSetErrorHook func(uintptr, uintptr) // Associates a function with @group which will be called // from g_option_context_parse() when an error occurs. // // Note that the user data to be passed to @error_func can be // specified when constructing the group with g_option_group_new(). func (x *OptionGroup) SetErrorHook(ErrorFuncVar *OptionErrorFunc) { var ErrorFuncVarRef uintptr if ErrorFuncVar != nil { ErrorFuncVarPtr := uintptr(unsafe.Pointer(ErrorFuncVar)) if cbRefPtr, ok := GetCallback(ErrorFuncVarPtr); ok { ErrorFuncVarRef = cbRefPtr } else { fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) { cbFn := *ErrorFuncVar cbFn(arg0, arg1, arg2, arg3) } ErrorFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(ErrorFuncVarPtr, ErrorFuncVarRef, ErrorFuncVar) } } xOptionGroupSetErrorHook(x.GoPointer(), ErrorFuncVarRef) } var xOptionGroupSetParseHooks func(uintptr, uintptr, uintptr) // Associates two functions with @group which will be called // from g_option_context_parse() before the first option is parsed // and after the last option has been parsed, respectively. // // Note that the user data to be passed to @pre_parse_func and // @post_parse_func can be specified when constructing the group // with g_option_group_new(). func (x *OptionGroup) SetParseHooks(PreParseFuncVar *OptionParseFunc, PostParseFuncVar *OptionParseFunc) { var PreParseFuncVarRef uintptr if PreParseFuncVar != nil { PreParseFuncVarPtr := uintptr(unsafe.Pointer(PreParseFuncVar)) if cbRefPtr, ok := GetCallback(PreParseFuncVarPtr); ok { PreParseFuncVarRef = cbRefPtr } else { fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) bool { cbFn := *PreParseFuncVar return cbFn(arg0, arg1, arg2, arg3) } PreParseFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(PreParseFuncVarPtr, PreParseFuncVarRef, PreParseFuncVar) } } var PostParseFuncVarRef uintptr if PostParseFuncVar != nil { PostParseFuncVarPtr := uintptr(unsafe.Pointer(PostParseFuncVar)) if cbRefPtr, ok := GetCallback(PostParseFuncVarPtr); ok { PostParseFuncVarRef = cbRefPtr } else { fcb := func(arg0 *OptionContext, arg1 *OptionGroup, arg2 uintptr, arg3 **Error) bool { cbFn := *PostParseFuncVar return cbFn(arg0, arg1, arg2, arg3) } PostParseFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(PostParseFuncVarPtr, PostParseFuncVarRef, PostParseFuncVar) } } xOptionGroupSetParseHooks(x.GoPointer(), PreParseFuncVarRef, PostParseFuncVarRef) } var xOptionGroupSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr) // Sets the function which is used to translate user-visible strings, // for `--help` output. Different groups can use different // #GTranslateFuncs. If @func is %NULL, strings are not translated. // // If you are using gettext(), you only need to set the translation // domain, see g_option_group_set_translation_domain(). func (x *OptionGroup) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr) string { cbFn := *FuncVar return cbFn(core.GoString(arg0), arg1) } FuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } var DestroyNotifyVarRef uintptr if DestroyNotifyVar != nil { DestroyNotifyVarPtr := uintptr(unsafe.Pointer(DestroyNotifyVar)) if cbRefPtr, ok := GetCallback(DestroyNotifyVarPtr); ok { DestroyNotifyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *DestroyNotifyVar cbFn(arg0) } DestroyNotifyVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(DestroyNotifyVarPtr, DestroyNotifyVarRef, DestroyNotifyVar) } } xOptionGroupSetTranslateFunc(x.GoPointer(), FuncVarRef, DataVar, DestroyNotifyVarRef) } var xOptionGroupSetTranslationDomain func(uintptr, string) // A convenience function to use gettext() for translating // user-visible strings. func (x *OptionGroup) SetTranslationDomain(DomainVar string) { xOptionGroupSetTranslationDomain(x.GoPointer(), DomainVar) } var xOptionGroupUnref func(uintptr) // Decrements the reference count of @group by one. // If the reference count drops to 0, the @group will be freed. // and all memory allocated by the @group is released. func (x *OptionGroup) Unref() { xOptionGroupUnref(x.GoPointer()) } const ( // If a long option in the main group has this name, it is not treated as a // regular option. Instead it collects all non-option arguments which would // otherwise be left in `argv`. The option must be of type // %G_OPTION_ARG_CALLBACK, %G_OPTION_ARG_STRING_ARRAY // or %G_OPTION_ARG_FILENAME_ARRAY. // // // Using %G_OPTION_REMAINING instead of simply scanning `argv` // for leftover arguments has the advantage that GOption takes care of // necessary encoding conversions for strings or filenames. OPTION_REMAINING string = "" ) // Flags which modify individual options. type OptionFlags int const ( // No flags. GOptionFlagNoneValue OptionFlags = 0 // The option doesn't appear in `--help` output. GOptionFlagHiddenValue OptionFlags = 1 // The option appears in the main section of the // `--help` output, even if it is defined in a group. GOptionFlagInMainValue OptionFlags = 2 // For options of the %G_OPTION_ARG_NONE kind, this // flag indicates that the sense of the option is reversed. i.e. %FALSE will // be stored into the argument rather than %TRUE. GOptionFlagReverseValue OptionFlags = 4 // For options of the %G_OPTION_ARG_CALLBACK kind, // this flag indicates that the callback does not take any argument // (like a %G_OPTION_ARG_NONE option). Since 2.8 GOptionFlagNoArgValue OptionFlags = 8 // For options of the %G_OPTION_ARG_CALLBACK // kind, this flag indicates that the argument should be passed to the // callback in the GLib filename encoding rather than UTF-8. Since 2.8 GOptionFlagFilenameValue OptionFlags = 16 // For options of the %G_OPTION_ARG_CALLBACK // kind, this flag indicates that the argument supply is optional. // If no argument is given then data of %GOptionParseFunc will be // set to NULL. Since 2.8 GOptionFlagOptionalArgValue OptionFlags = 32 // This flag turns off the automatic conflict // resolution which prefixes long option names with `groupname-` if // there is a conflict. This option should only be used in situations // where aliasing is necessary to model some legacy commandline interface. // It is not safe to use this option, unless all option groups are under // your direct control. Since 2.8. GOptionFlagNoaliasValue OptionFlags = 64 // This flag marks the option as deprecated in the `--help`. // // You should update the description of the option to describe what // the user should do in response to the deprecation, for instance: // remove the option, or replace it with another one. GOptionFlagDeprecatedValue OptionFlags = 128 ) // The #GOptionArg enum values determine which type of extra argument the // options expect to find. If an option expects an extra argument, it can // be specified in several ways; with a short option: `-x arg`, with a long // option: `--name arg` or combined in a single argument: `--name=arg`. type OptionArg int const ( // No extra argument. This is useful for simple flags or booleans. GOptionArgNoneValue OptionArg = 0 // The option takes a UTF-8 string argument. GOptionArgStringValue OptionArg = 1 // The option takes an integer argument. GOptionArgIntValue OptionArg = 2 // The option provides a callback (of type #GOptionArgFunc) // to parse the extra argument. GOptionArgCallbackValue OptionArg = 3 // The option takes a filename as argument, which will // be in the GLib filename encoding rather than UTF-8. GOptionArgFilenameValue OptionArg = 4 // The option takes a string argument, multiple // uses of the option are collected into an array of strings. GOptionArgStringArrayValue OptionArg = 5 // The option takes a filename as argument, // multiple uses of the option are collected into an array of strings. GOptionArgFilenameArrayValue OptionArg = 6 // The option takes a double argument. The argument // can be formatted either for the user's locale or for the "C" locale. // Since 2.12 GOptionArgDoubleValue OptionArg = 7 // The option takes a 64-bit integer. Like // %G_OPTION_ARG_INT but for larger numbers. The number can be in // decimal base, or in hexadecimal (when prefixed with `0x`, for // example, `0xffffffff`). Since 2.12 GOptionArgInt64Value OptionArg = 8 ) // Error codes returned by option parsing. type OptionError int const ( // An option was not known to the parser. // This error will only be reported, if the parser hasn't been instructed // to ignore unknown options, see g_option_context_set_ignore_unknown_options(). GOptionErrorUnknownOptionValue OptionError = 0 // A value couldn't be parsed. GOptionErrorBadValueValue OptionError = 1 // A #GOptionArgFunc callback failed. GOptionErrorFailedValue OptionError = 2 ) 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(&xOptionContextAddGroup, libs, "g_option_context_add_group") core.PuregoSafeRegister(&xOptionContextAddMainEntries, libs, "g_option_context_add_main_entries") core.PuregoSafeRegister(&xOptionContextFree, libs, "g_option_context_free") core.PuregoSafeRegister(&xOptionContextGetDescription, libs, "g_option_context_get_description") core.PuregoSafeRegister(&xOptionContextGetHelp, libs, "g_option_context_get_help") core.PuregoSafeRegister(&xOptionContextGetHelpEnabled, libs, "g_option_context_get_help_enabled") core.PuregoSafeRegister(&xOptionContextGetIgnoreUnknownOptions, libs, "g_option_context_get_ignore_unknown_options") core.PuregoSafeRegister(&xOptionContextGetMainGroup, libs, "g_option_context_get_main_group") core.PuregoSafeRegister(&xOptionContextGetStrictPosix, libs, "g_option_context_get_strict_posix") core.PuregoSafeRegister(&xOptionContextGetSummary, libs, "g_option_context_get_summary") core.PuregoSafeRegister(&xOptionContextParse, libs, "g_option_context_parse") core.PuregoSafeRegister(&xOptionContextParseStrv, libs, "g_option_context_parse_strv") core.PuregoSafeRegister(&xOptionContextSetDescription, libs, "g_option_context_set_description") core.PuregoSafeRegister(&xOptionContextSetHelpEnabled, libs, "g_option_context_set_help_enabled") core.PuregoSafeRegister(&xOptionContextSetIgnoreUnknownOptions, libs, "g_option_context_set_ignore_unknown_options") core.PuregoSafeRegister(&xOptionContextSetMainGroup, libs, "g_option_context_set_main_group") core.PuregoSafeRegister(&xOptionContextSetStrictPosix, libs, "g_option_context_set_strict_posix") core.PuregoSafeRegister(&xOptionContextSetSummary, libs, "g_option_context_set_summary") core.PuregoSafeRegister(&xOptionContextSetTranslateFunc, libs, "g_option_context_set_translate_func") core.PuregoSafeRegister(&xOptionContextSetTranslationDomain, libs, "g_option_context_set_translation_domain") core.PuregoSafeRegister(&xOptionGroupGLibType, libs, "g_option_group_get_type") core.PuregoSafeRegister(&xNewOptionGroup, libs, "g_option_group_new") core.PuregoSafeRegister(&xOptionGroupAddEntries, libs, "g_option_group_add_entries") core.PuregoSafeRegister(&xOptionGroupFree, libs, "g_option_group_free") core.PuregoSafeRegister(&xOptionGroupRef, libs, "g_option_group_ref") core.PuregoSafeRegister(&xOptionGroupSetErrorHook, libs, "g_option_group_set_error_hook") core.PuregoSafeRegister(&xOptionGroupSetParseHooks, libs, "g_option_group_set_parse_hooks") core.PuregoSafeRegister(&xOptionGroupSetTranslateFunc, libs, "g_option_group_set_translate_func") core.PuregoSafeRegister(&xOptionGroupSetTranslationDomain, libs, "g_option_group_set_translation_domain") core.PuregoSafeRegister(&xOptionGroupUnref, libs, "g_option_group_unref") }