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
10const (
11 // Evaluates to the initial reference count for `gatomicrefcount`.
12 //
13 // This macro is useful for initializing `gatomicrefcount` fields inside
14 // structures, for instance:
15 //
16 // |[<!-- language="C" -->
17 // typedef struct {
18 // gatomicrefcount ref_count;
19 // char *name;
20 // char *address;
21 // } Person;
22 //
23 // static const Person default_person = {
24 // .ref_count = G_ATOMIC_REF_COUNT_INIT,
25 // .name = "Default name",
26 // .address = "Default address",
27 // };
28 // ]|
29 ATOMIC_REF_COUNT_INIT int = 1
30 // Evaluates to the initial reference count for `grefcount`.
31 //
32 // This macro is useful for initializing `grefcount` fields inside
33 // structures, for instance:
34 //
35 // |[<!-- language="C" -->
36 // typedef struct {
37 // grefcount ref_count;
38 // char *name;
39 // char *address;
40 // } Person;
41 //
42 // static const Person default_person = {
43 // .ref_count = G_REF_COUNT_INIT,
44 // .name = "Default name",
45 // .address = "Default address",
46 // };
47 // ]|
48 REF_COUNT_INIT int = -1
49)
50
51var xAtomicRefCountCompare func(int, int) bool
52
53// Atomically compares the current value of @arc with @val.
54func AtomicRefCountCompare(ArcVar int, ValVar int) bool {
55
56 cret := xAtomicRefCountCompare(ArcVar, ValVar)
57
58 return cret
59}
60
61var xAtomicRefCountDec func(int) bool
62
63// Atomically decreases the reference count.
64//
65// If %TRUE is returned, the reference count reached 0. After this point, @arc
66// is an undefined state and must be reinitialized with
67// g_atomic_ref_count_init() to be used again.
68func AtomicRefCountDec(ArcVar int) bool {
69
70 cret := xAtomicRefCountDec(ArcVar)
71
72 return cret
73}
74
75var xAtomicRefCountInc func(int)
76
77// Atomically increases the reference count.
78func AtomicRefCountInc(ArcVar int) {
79
80 xAtomicRefCountInc(ArcVar)
81
82}
83
84var xAtomicRefCountInit func(*int)
85
86// Initializes a reference count variable to 1.
87func AtomicRefCountInit(ArcVar *int) {
88
89 xAtomicRefCountInit(ArcVar)
90
91}
92
93var xRefCountCompare func(int, int) bool
94
95// Compares the current value of @rc with @val.
96func RefCountCompare(RcVar int, ValVar int) bool {
97
98 cret := xRefCountCompare(RcVar, ValVar)
99
100 return cret
101}
102
103var xRefCountDec func(int) bool
104
105// Decreases the reference count.
106//
107// If %TRUE is returned, the reference count reached 0. After this point, @rc
108// is an undefined state and must be reinitialized with
109// g_ref_count_init() to be used again.
110func RefCountDec(RcVar int) bool {
111
112 cret := xRefCountDec(RcVar)
113
114 return cret
115}
116
117var xRefCountInc func(int)
118
119// Increases the reference count.
120func RefCountInc(RcVar int) {
121
122 xRefCountInc(RcVar)
123
124}
125
126var xRefCountInit func(*int)
127
128// Initializes a reference count variable to 1.
129func RefCountInit(RcVar *int) {
130
131 xRefCountInit(RcVar)
132
133}
134
135func init() {
136 core.SetPackageName("GLIB", "glib-2.0")
137 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
138 var libs []uintptr
139 for _, libPath := range core.GetPaths("GLIB") {
140 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
141 if err != nil {
142 panic(err)
143 }
144 libs = append(libs, lib)
145 }
146
147 core.PuregoSafeRegister(&xAtomicRefCountCompare, libs, "g_atomic_ref_count_compare")
148 core.PuregoSafeRegister(&xAtomicRefCountDec, libs, "g_atomic_ref_count_dec")
149 core.PuregoSafeRegister(&xAtomicRefCountInc, libs, "g_atomic_ref_count_inc")
150 core.PuregoSafeRegister(&xAtomicRefCountInit, libs, "g_atomic_ref_count_init")
151 core.PuregoSafeRegister(&xRefCountCompare, libs, "g_ref_count_compare")
152 core.PuregoSafeRegister(&xRefCountDec, libs, "g_ref_count_dec")
153 core.PuregoSafeRegister(&xRefCountInc, libs, "g_ref_count_inc")
154 core.PuregoSafeRegister(&xRefCountInit, libs, "g_ref_count_init")
155
156}