// 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" ) type SliceConfig int const ( GSliceConfigAlwaysMallocValue SliceConfig = 1 GSliceConfigBypassMagazinesValue SliceConfig = 2 GSliceConfigWorkingSetMsecsValue SliceConfig = 3 GSliceConfigColorIncrementValue SliceConfig = 4 GSliceConfigChunkSizesValue SliceConfig = 5 GSliceConfigContentionCounterValue SliceConfig = 6 ) var xSliceAlloc func(uint) uintptr // Allocates a block of memory from the libc allocator. // // The block address handed out can be expected to be aligned // to at least `1 * sizeof (void*)`. // // Since GLib 2.76 this always uses the system malloc() implementation // internally. func SliceAlloc(BlockSizeVar uint) uintptr { cret := xSliceAlloc(BlockSizeVar) return cret } var xSliceAlloc0 func(uint) uintptr // Allocates a block of memory via g_slice_alloc() and initializes // the returned memory to 0. // // Since GLib 2.76 this always uses the system malloc() implementation // internally. func SliceAlloc0(BlockSizeVar uint) uintptr { cret := xSliceAlloc0(BlockSizeVar) return cret } var xSliceCopy func(uint, uintptr) uintptr // Allocates a block of memory from the slice allocator // and copies @block_size bytes into it from @mem_block. // // @mem_block must be non-%NULL if @block_size is non-zero. // // Since GLib 2.76 this always uses the system malloc() implementation // internally. func SliceCopy(BlockSizeVar uint, MemBlockVar uintptr) uintptr { cret := xSliceCopy(BlockSizeVar, MemBlockVar) return cret } var xSliceFree1 func(uint, uintptr) // Frees a block of memory. // // The memory must have been allocated via g_slice_alloc() or // g_slice_alloc0() and the @block_size has to match the size // specified upon allocation. Note that the exact release behaviour // can be changed with the [`G_DEBUG=gc-friendly`](running.html#environment-variables) environment // variable. // // If @mem_block is %NULL, this function does nothing. // // Since GLib 2.76 this always uses the system free_sized() implementation // internally. func SliceFree1(BlockSizeVar uint, MemBlockVar uintptr) { xSliceFree1(BlockSizeVar, MemBlockVar) } var xSliceFreeChainWithOffset func(uint, uintptr, uint) // Frees a linked list of memory blocks of structure type @type. // // The memory blocks must be equal-sized, allocated via // g_slice_alloc() or g_slice_alloc0() and linked together by a // @next pointer (similar to #GSList). The offset of the @next // field in each block is passed as third argument. // Note that the exact release behaviour can be changed with the // [`G_DEBUG=gc-friendly`](running.html#environment-variables) environment variable. // // If @mem_chain is %NULL, this function does nothing. // // Since GLib 2.76 this always uses the system free_sized() implementation // internally. func SliceFreeChainWithOffset(BlockSizeVar uint, MemChainVar uintptr, NextOffsetVar uint) { xSliceFreeChainWithOffset(BlockSizeVar, MemChainVar, NextOffsetVar) } var xSliceGetConfig func(SliceConfig) int64 func SliceGetConfig(CkeyVar SliceConfig) int64 { cret := xSliceGetConfig(CkeyVar) return cret } var xSliceGetConfigState func(SliceConfig, int64, uint) int64 func SliceGetConfigState(CkeyVar SliceConfig, AddressVar int64, NValuesVar uint) int64 { cret := xSliceGetConfigState(CkeyVar, AddressVar, NValuesVar) return cret } var xSliceSetConfig func(SliceConfig, int64) func SliceSetConfig(CkeyVar SliceConfig, ValueVar int64) { xSliceSetConfig(CkeyVar, ValueVar) } 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(&xSliceAlloc, libs, "g_slice_alloc") core.PuregoSafeRegister(&xSliceAlloc0, libs, "g_slice_alloc0") core.PuregoSafeRegister(&xSliceCopy, libs, "g_slice_copy") core.PuregoSafeRegister(&xSliceFree1, libs, "g_slice_free1") core.PuregoSafeRegister(&xSliceFreeChainWithOffset, libs, "g_slice_free_chain_with_offset") core.PuregoSafeRegister(&xSliceGetConfig, libs, "g_slice_get_config") core.PuregoSafeRegister(&xSliceGetConfigState, libs, "g_slice_get_config_state") core.PuregoSafeRegister(&xSliceSetConfig, libs, "g_slice_set_config") }