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 xAtomicIntAdd func(uintptr, int) int
11
12// Atomically adds @val to the value of @atomic.
13//
14// Think of this operation as an atomic version of
15// `{ tmp = *atomic; *atomic += val; return tmp; }`.
16//
17// This call acts as a full compiler and hardware memory barrier.
18//
19// Before version 2.30, this function did not return a value
20// (but g_atomic_int_exchange_and_add() did, and had the same meaning).
21//
22// While @atomic has a `volatile` qualifier, this is a historical artifact and
23// the pointer passed to it should not be `volatile`.
24func AtomicIntAdd(AtomicVar uintptr, ValVar int) int {
25
26 cret := xAtomicIntAdd(AtomicVar, ValVar)
27
28 return cret
29}
30
31var xAtomicIntAnd func(uintptr, uint) uint
32
33// Performs an atomic bitwise 'and' of the value of @atomic and @val,
34// storing the result back in @atomic.
35//
36// This call acts as a full compiler and hardware memory barrier.
37//
38// Think of this operation as an atomic version of
39// `{ tmp = *atomic; *atomic &= val; return tmp; }`.
40//
41// While @atomic has a `volatile` qualifier, this is a historical artifact and
42// the pointer passed to it should not be `volatile`.
43func AtomicIntAnd(AtomicVar uintptr, ValVar uint) uint {
44
45 cret := xAtomicIntAnd(AtomicVar, ValVar)
46
47 return cret
48}
49
50var xAtomicIntCompareAndExchange func(uintptr, int, int) bool
51
52// Compares @atomic to @oldval and, if equal, sets it to @newval.
53// If @atomic was not equal to @oldval then no change occurs.
54//
55// This compare and exchange is done atomically.
56//
57// Think of this operation as an atomic version of
58// `{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }`.
59//
60// This call acts as a full compiler and hardware memory barrier.
61//
62// While @atomic has a `volatile` qualifier, this is a historical artifact and
63// the pointer passed to it should not be `volatile`.
64func AtomicIntCompareAndExchange(AtomicVar uintptr, OldvalVar int, NewvalVar int) bool {
65
66 cret := xAtomicIntCompareAndExchange(AtomicVar, OldvalVar, NewvalVar)
67
68 return cret
69}
70
71var xAtomicIntCompareAndExchangeFull func(uintptr, int, int, *int) bool
72
73// Compares @atomic to @oldval and, if equal, sets it to @newval.
74// If @atomic was not equal to @oldval then no change occurs.
75// In any case the value of @atomic before this operation is stored in @preval.
76//
77// This compare and exchange is done atomically.
78//
79// Think of this operation as an atomic version of
80// `{ *preval = *atomic; if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }`.
81//
82// This call acts as a full compiler and hardware memory barrier.
83//
84// See also g_atomic_int_compare_and_exchange()
85func AtomicIntCompareAndExchangeFull(AtomicVar uintptr, OldvalVar int, NewvalVar int, PrevalVar *int) bool {
86
87 cret := xAtomicIntCompareAndExchangeFull(AtomicVar, OldvalVar, NewvalVar, PrevalVar)
88
89 return cret
90}
91
92var xAtomicIntDecAndTest func(uintptr) bool
93
94// Decrements the value of @atomic by 1.
95//
96// Think of this operation as an atomic version of
97// `{ *atomic -= 1; return (*atomic == 0); }`.
98//
99// This call acts as a full compiler and hardware memory barrier.
100//
101// While @atomic has a `volatile` qualifier, this is a historical artifact and
102// the pointer passed to it should not be `volatile`.
103func AtomicIntDecAndTest(AtomicVar uintptr) bool {
104
105 cret := xAtomicIntDecAndTest(AtomicVar)
106
107 return cret
108}
109
110var xAtomicIntExchange func(uintptr, int) int
111
112// Sets the @atomic to @newval and returns the old value from @atomic.
113//
114// This exchange is done atomically.
115//
116// Think of this operation as an atomic version of
117// `{ tmp = *atomic; *atomic = val; return tmp; }`.
118//
119// This call acts as a full compiler and hardware memory barrier.
120func AtomicIntExchange(AtomicVar uintptr, NewvalVar int) int {
121
122 cret := xAtomicIntExchange(AtomicVar, NewvalVar)
123
124 return cret
125}
126
127var xAtomicIntExchangeAndAdd func(uintptr, int) int
128
129// This function existed before g_atomic_int_add() returned the prior
130// value of the integer (which it now does). It is retained only for
131// compatibility reasons. Don't use this function in new code.
132func AtomicIntExchangeAndAdd(AtomicVar uintptr, ValVar int) int {
133
134 cret := xAtomicIntExchangeAndAdd(AtomicVar, ValVar)
135
136 return cret
137}
138
139var xAtomicIntGet func(uintptr) int
140
141// Gets the current value of @atomic.
142//
143// This call acts as a full compiler and hardware
144// memory barrier (before the get).
145//
146// While @atomic has a `volatile` qualifier, this is a historical artifact and
147// the pointer passed to it should not be `volatile`.
148func AtomicIntGet(AtomicVar uintptr) int {
149
150 cret := xAtomicIntGet(AtomicVar)
151
152 return cret
153}
154
155var xAtomicIntInc func(uintptr)
156
157// Increments the value of @atomic by 1.
158//
159// Think of this operation as an atomic version of `{ *atomic += 1; }`.
160//
161// This call acts as a full compiler and hardware memory barrier.
162//
163// While @atomic has a `volatile` qualifier, this is a historical artifact and
164// the pointer passed to it should not be `volatile`.
165func AtomicIntInc(AtomicVar uintptr) {
166
167 xAtomicIntInc(AtomicVar)
168
169}
170
171var xAtomicIntOr func(uintptr, uint) uint
172
173// Performs an atomic bitwise 'or' of the value of @atomic and @val,
174// storing the result back in @atomic.
175//
176// Think of this operation as an atomic version of
177// `{ tmp = *atomic; *atomic |= val; return tmp; }`.
178//
179// This call acts as a full compiler and hardware memory barrier.
180//
181// While @atomic has a `volatile` qualifier, this is a historical artifact and
182// the pointer passed to it should not be `volatile`.
183func AtomicIntOr(AtomicVar uintptr, ValVar uint) uint {
184
185 cret := xAtomicIntOr(AtomicVar, ValVar)
186
187 return cret
188}
189
190var xAtomicIntSet func(uintptr, int)
191
192// Sets the value of @atomic to @newval.
193//
194// This call acts as a full compiler and hardware
195// memory barrier (after the set).
196//
197// While @atomic has a `volatile` qualifier, this is a historical artifact and
198// the pointer passed to it should not be `volatile`.
199func AtomicIntSet(AtomicVar uintptr, NewvalVar int) {
200
201 xAtomicIntSet(AtomicVar, NewvalVar)
202
203}
204
205var xAtomicIntXor func(uintptr, uint) uint
206
207// Performs an atomic bitwise 'xor' of the value of @atomic and @val,
208// storing the result back in @atomic.
209//
210// Think of this operation as an atomic version of
211// `{ tmp = *atomic; *atomic ^= val; return tmp; }`.
212//
213// This call acts as a full compiler and hardware memory barrier.
214//
215// While @atomic has a `volatile` qualifier, this is a historical artifact and
216// the pointer passed to it should not be `volatile`.
217func AtomicIntXor(AtomicVar uintptr, ValVar uint) uint {
218
219 cret := xAtomicIntXor(AtomicVar, ValVar)
220
221 return cret
222}
223
224var xAtomicPointerAdd func(uintptr, int) int
225
226// Atomically adds @val to the value of @atomic.
227//
228// Think of this operation as an atomic version of
229// `{ tmp = *atomic; *atomic += val; return tmp; }`.
230//
231// This call acts as a full compiler and hardware memory barrier.
232//
233// While @atomic has a `volatile` qualifier, this is a historical artifact and
234// the pointer passed to it should not be `volatile`.
235//
236// In GLib 2.80, the return type was changed from #gssize to #gintptr to add
237// support for platforms with 128-bit pointers. This should not affect existing
238// code.
239func AtomicPointerAdd(AtomicVar uintptr, ValVar int) int {
240
241 cret := xAtomicPointerAdd(AtomicVar, ValVar)
242
243 return cret
244}
245
246var xAtomicPointerAnd func(uintptr, uint) uintptr
247
248// Performs an atomic bitwise 'and' of the value of @atomic and @val,
249// storing the result back in @atomic.
250//
251// Think of this operation as an atomic version of
252// `{ tmp = *atomic; *atomic &= val; return tmp; }`.
253//
254// This call acts as a full compiler and hardware memory barrier.
255//
256// While @atomic has a `volatile` qualifier, this is a historical artifact and
257// the pointer passed to it should not be `volatile`.
258//
259// In GLib 2.80, the return type was changed from #gsize to #guintptr to add
260// support for platforms with 128-bit pointers. This should not affect existing
261// code.
262func AtomicPointerAnd(AtomicVar uintptr, ValVar uint) uintptr {
263
264 cret := xAtomicPointerAnd(AtomicVar, ValVar)
265
266 return cret
267}
268
269var xAtomicPointerCompareAndExchange func(uintptr, uintptr, uintptr) bool
270
271// Compares @atomic to @oldval and, if equal, sets it to @newval.
272// If @atomic was not equal to @oldval then no change occurs.
273//
274// This compare and exchange is done atomically.
275//
276// Think of this operation as an atomic version of
277// `{ if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }`.
278//
279// This call acts as a full compiler and hardware memory barrier.
280//
281// While @atomic has a `volatile` qualifier, this is a historical artifact and
282// the pointer passed to it should not be `volatile`.
283func AtomicPointerCompareAndExchange(AtomicVar uintptr, OldvalVar uintptr, NewvalVar uintptr) bool {
284
285 cret := xAtomicPointerCompareAndExchange(AtomicVar, OldvalVar, NewvalVar)
286
287 return cret
288}
289
290var xAtomicPointerCompareAndExchangeFull func(uintptr, uintptr, uintptr, *uintptr) bool
291
292// Compares @atomic to @oldval and, if equal, sets it to @newval.
293// If @atomic was not equal to @oldval then no change occurs.
294// In any case the value of @atomic before this operation is stored in @preval.
295//
296// This compare and exchange is done atomically.
297//
298// Think of this operation as an atomic version of
299// `{ *preval = *atomic; if (*atomic == oldval) { *atomic = newval; return TRUE; } else return FALSE; }`.
300//
301// This call acts as a full compiler and hardware memory barrier.
302//
303// See also g_atomic_pointer_compare_and_exchange()
304func AtomicPointerCompareAndExchangeFull(AtomicVar uintptr, OldvalVar uintptr, NewvalVar uintptr, PrevalVar *uintptr) bool {
305
306 cret := xAtomicPointerCompareAndExchangeFull(AtomicVar, OldvalVar, NewvalVar, PrevalVar)
307
308 return cret
309}
310
311var xAtomicPointerExchange func(uintptr, uintptr) uintptr
312
313// Sets the @atomic to @newval and returns the old value from @atomic.
314//
315// This exchange is done atomically.
316//
317// Think of this operation as an atomic version of
318// `{ tmp = *atomic; *atomic = val; return tmp; }`.
319//
320// This call acts as a full compiler and hardware memory barrier.
321func AtomicPointerExchange(AtomicVar uintptr, NewvalVar uintptr) uintptr {
322
323 cret := xAtomicPointerExchange(AtomicVar, NewvalVar)
324
325 return cret
326}
327
328var xAtomicPointerGet func(uintptr) uintptr
329
330// Gets the current value of @atomic.
331//
332// This call acts as a full compiler and hardware
333// memory barrier (before the get).
334//
335// While @atomic has a `volatile` qualifier, this is a historical artifact and
336// the pointer passed to it should not be `volatile`.
337func AtomicPointerGet(AtomicVar uintptr) uintptr {
338
339 cret := xAtomicPointerGet(AtomicVar)
340
341 return cret
342}
343
344var xAtomicPointerOr func(uintptr, uint) uintptr
345
346// Performs an atomic bitwise 'or' of the value of @atomic and @val,
347// storing the result back in @atomic.
348//
349// Think of this operation as an atomic version of
350// `{ tmp = *atomic; *atomic |= val; return tmp; }`.
351//
352// This call acts as a full compiler and hardware memory barrier.
353//
354// While @atomic has a `volatile` qualifier, this is a historical artifact and
355// the pointer passed to it should not be `volatile`.
356//
357// In GLib 2.80, the return type was changed from #gsize to #guintptr to add
358// support for platforms with 128-bit pointers. This should not affect existing
359// code.
360func AtomicPointerOr(AtomicVar uintptr, ValVar uint) uintptr {
361
362 cret := xAtomicPointerOr(AtomicVar, ValVar)
363
364 return cret
365}
366
367var xAtomicPointerSet func(uintptr, uintptr)
368
369// Sets the value of @atomic to @newval.
370//
371// This call acts as a full compiler and hardware
372// memory barrier (after the set).
373//
374// While @atomic has a `volatile` qualifier, this is a historical artifact and
375// the pointer passed to it should not be `volatile`.
376func AtomicPointerSet(AtomicVar uintptr, NewvalVar uintptr) {
377
378 xAtomicPointerSet(AtomicVar, NewvalVar)
379
380}
381
382var xAtomicPointerXor func(uintptr, uint) uintptr
383
384// Performs an atomic bitwise 'xor' of the value of @atomic and @val,
385// storing the result back in @atomic.
386//
387// Think of this operation as an atomic version of
388// `{ tmp = *atomic; *atomic ^= val; return tmp; }`.
389//
390// This call acts as a full compiler and hardware memory barrier.
391//
392// While @atomic has a `volatile` qualifier, this is a historical artifact and
393// the pointer passed to it should not be `volatile`.
394//
395// In GLib 2.80, the return type was changed from #gsize to #guintptr to add
396// support for platforms with 128-bit pointers. This should not affect existing
397// code.
398func AtomicPointerXor(AtomicVar uintptr, ValVar uint) uintptr {
399
400 cret := xAtomicPointerXor(AtomicVar, ValVar)
401
402 return cret
403}
404
405func init() {
406 core.SetPackageName("GLIB", "glib-2.0")
407 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
408 var libs []uintptr
409 for _, libPath := range core.GetPaths("GLIB") {
410 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
411 if err != nil {
412 panic(err)
413 }
414 libs = append(libs, lib)
415 }
416
417 core.PuregoSafeRegister(&xAtomicIntAdd, libs, "g_atomic_int_add")
418 core.PuregoSafeRegister(&xAtomicIntAnd, libs, "g_atomic_int_and")
419 core.PuregoSafeRegister(&xAtomicIntCompareAndExchange, libs, "g_atomic_int_compare_and_exchange")
420 core.PuregoSafeRegister(&xAtomicIntCompareAndExchangeFull, libs, "g_atomic_int_compare_and_exchange_full")
421 core.PuregoSafeRegister(&xAtomicIntDecAndTest, libs, "g_atomic_int_dec_and_test")
422 core.PuregoSafeRegister(&xAtomicIntExchange, libs, "g_atomic_int_exchange")
423 core.PuregoSafeRegister(&xAtomicIntExchangeAndAdd, libs, "g_atomic_int_exchange_and_add")
424 core.PuregoSafeRegister(&xAtomicIntGet, libs, "g_atomic_int_get")
425 core.PuregoSafeRegister(&xAtomicIntInc, libs, "g_atomic_int_inc")
426 core.PuregoSafeRegister(&xAtomicIntOr, libs, "g_atomic_int_or")
427 core.PuregoSafeRegister(&xAtomicIntSet, libs, "g_atomic_int_set")
428 core.PuregoSafeRegister(&xAtomicIntXor, libs, "g_atomic_int_xor")
429 core.PuregoSafeRegister(&xAtomicPointerAdd, libs, "g_atomic_pointer_add")
430 core.PuregoSafeRegister(&xAtomicPointerAnd, libs, "g_atomic_pointer_and")
431 core.PuregoSafeRegister(&xAtomicPointerCompareAndExchange, libs, "g_atomic_pointer_compare_and_exchange")
432 core.PuregoSafeRegister(&xAtomicPointerCompareAndExchangeFull, libs, "g_atomic_pointer_compare_and_exchange_full")
433 core.PuregoSafeRegister(&xAtomicPointerExchange, libs, "g_atomic_pointer_exchange")
434 core.PuregoSafeRegister(&xAtomicPointerGet, libs, "g_atomic_pointer_get")
435 core.PuregoSafeRegister(&xAtomicPointerOr, libs, "g_atomic_pointer_or")
436 core.PuregoSafeRegister(&xAtomicPointerSet, libs, "g_atomic_pointer_set")
437 core.PuregoSafeRegister(&xAtomicPointerXor, libs, "g_atomic_pointer_xor")
438
439}