Require @(init) and @(fini) to be proc "contextless" ()

This commit is contained in:
gingerBill
2025-08-08 12:10:01 +01:00
parent 3194fda8f3
commit 7642e0a0e0
47 changed files with 170 additions and 102 deletions
+1 -1
View File
@@ -741,6 +741,6 @@ destroy :: proc(img: ^Image) {
}
@(init, private)
_register :: proc() {
_register :: proc "contextless" () {
image.register(.BMP, load_from_bytes, destroy)
}
+5 -5
View File
@@ -10,13 +10,13 @@ Destroy_Proc :: #type proc(img: ^Image)
_internal_loaders: [Which_File_Type]Loader_Proc
_internal_destroyers: [Which_File_Type]Destroy_Proc
register :: proc(kind: Which_File_Type, loader: Loader_Proc, destroyer: Destroy_Proc) {
assert(loader != nil)
assert(destroyer != nil)
assert(_internal_loaders[kind] == nil)
register :: proc "contextless" (kind: Which_File_Type, loader: Loader_Proc, destroyer: Destroy_Proc) {
assert_contextless(loader != nil)
assert_contextless(destroyer != nil)
assert_contextless(_internal_loaders[kind] == nil)
_internal_loaders[kind] = loader
assert(_internal_destroyers[kind] == nil)
assert_contextless(_internal_destroyers[kind] == nil)
_internal_destroyers[kind] = destroyer
}
+1 -1
View File
@@ -720,7 +720,7 @@ autoselect_pbm_format_from_image :: proc(img: ^Image, prefer_binary := true, for
}
@(init, private)
_register :: proc() {
_register :: proc "contextless" () {
loader :: proc(data: []byte, options: image.Options, allocator: mem.Allocator) -> (img: ^Image, err: Error) {
return load_from_bytes(data, allocator)
}
+1 -1
View File
@@ -1611,6 +1611,6 @@ defilter :: proc(img: ^Image, filter_bytes: ^bytes.Buffer, header: ^image.PNG_IH
}
@(init, private)
_register :: proc() {
_register :: proc "contextless" () {
image.register(.PNG, load_from_bytes, destroy)
}
+1 -1
View File
@@ -371,6 +371,6 @@ qoi_hash :: #force_inline proc(pixel: RGBA_Pixel) -> (index: u8) {
}
@(init, private)
_register :: proc() {
_register :: proc "contextless" () {
image.register(.QOI, load_from_bytes, destroy)
}
+1 -1
View File
@@ -406,6 +406,6 @@ IMAGE_DESCRIPTOR_RIGHT_MASK :: 1<<4
IMAGE_DESCRIPTOR_TOP_MASK :: 1<<5
@(init, private)
_register :: proc() {
_register :: proc "contextless" () {
image.register(.TGA, load_from_bytes, destroy)
}