1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8)
9
10var xFprintf func(uintptr, string, ...interface{}) int
11
12// An implementation of the standard `fprintf()` function which supports
13// positional parameters, as specified in the Single Unix Specification.
14//
15// `glib/gprintf.h` must be explicitly included in order to use this function.
16func Fprintf(FileVar uintptr, FormatVar string, varArgs ...interface{}) int {
17
18 cret := xFprintf(FileVar, FormatVar, varArgs...)
19
20 return cret
21}
22
23var xPrintf func(string, ...interface{}) int
24
25// An implementation of the standard `printf()` function which supports
26// positional parameters, as specified in the Single Unix Specification.
27//
28// As with the standard `printf()`, this does not automatically append a trailing
29// new-line character to the message, so typically @format should end with its
30// own new-line character.
31//
32// `glib/gprintf.h` must be explicitly included in order to use this function.
33func Printf(FormatVar string, varArgs ...interface{}) int {
34
35 cret := xPrintf(FormatVar, varArgs...)
36
37 return cret
38}
39
40var xSprintf func(string, string, ...interface{}) int
41
42// An implementation of the standard `sprintf()` function which supports
43// positional parameters, as specified in the Single Unix Specification.
44//
45// Note that it is usually better to use [func@GLib.snprintf], to avoid the
46// risk of buffer overflow.
47//
48// `glib/gprintf.h` must be explicitly included in order to use this function.
49//
50// See also [func@GLib.strdup_printf].
51func Sprintf(StringVar string, FormatVar string, varArgs ...interface{}) int {
52
53 cret := xSprintf(StringVar, FormatVar, varArgs...)
54
55 return cret
56}
57
58var xVasprintf func(*string, string, []interface{}) int
59
60// An implementation of the GNU `vasprintf()` function which supports
61// positional parameters, as specified in the Single Unix Specification.
62// This function is similar to [func@GLib.vsprintf], except that it allocates a
63// string to hold the output, instead of putting the output in a buffer
64// you allocate in advance.
65//
66// The returned value in @string is guaranteed to be non-`NULL`, unless
67// @format contains `%lc` or `%ls` conversions, which can fail if no
68// multibyte representation is available for the given character.
69//
70// `glib/gprintf.h` must be explicitly included in order to use this function.
71func Vasprintf(StringVar *string, FormatVar string, ArgsVar []interface{}) int {
72
73 cret := xVasprintf(StringVar, FormatVar, ArgsVar)
74
75 return cret
76}
77
78var xVfprintf func(uintptr, string, []interface{}) int
79
80// An implementation of the standard `fprintf()` function which supports
81// positional parameters, as specified in the Single Unix Specification.
82//
83// `glib/gprintf.h` must be explicitly included in order to use this function.
84func Vfprintf(FileVar uintptr, FormatVar string, ArgsVar []interface{}) int {
85
86 cret := xVfprintf(FileVar, FormatVar, ArgsVar)
87
88 return cret
89}
90
91var xVprintf func(string, []interface{}) int
92
93// An implementation of the standard `vprintf()` function which supports
94// positional parameters, as specified in the Single Unix Specification.
95//
96// `glib/gprintf.h` must be explicitly included in order to use this function.
97func Vprintf(FormatVar string, ArgsVar []interface{}) int {
98
99 cret := xVprintf(FormatVar, ArgsVar)
100
101 return cret
102}
103
104var xVsprintf func(string, string, []interface{}) int
105
106// An implementation of the standard `vsprintf()` function which supports
107// positional parameters, as specified in the Single Unix Specification.
108//
109// `glib/gprintf.h` must be explicitly included in order to use this function.
110func Vsprintf(StringVar string, FormatVar string, ArgsVar []interface{}) int {
111
112 cret := xVsprintf(StringVar, FormatVar, ArgsVar)
113
114 return cret
115}
116
117func init() {
118 core.SetPackageName("GLIB", "glib-2.0")
119 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
120 var libs []uintptr
121 for _, libPath := range core.GetPaths("GLIB") {
122 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
123 if err != nil {
124 panic(err)
125 }
126 libs = append(libs, lib)
127 }
128
129 core.PuregoSafeRegister(&xFprintf, libs, "g_fprintf")
130 core.PuregoSafeRegister(&xPrintf, libs, "g_printf")
131 core.PuregoSafeRegister(&xSprintf, libs, "g_sprintf")
132 core.PuregoSafeRegister(&xVasprintf, libs, "g_vasprintf")
133 core.PuregoSafeRegister(&xVfprintf, libs, "g_vfprintf")
134 core.PuregoSafeRegister(&xVprintf, libs, "g_vprintf")
135 core.PuregoSafeRegister(&xVsprintf, libs, "g_vsprintf")
136
137}