aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2025-03-21 19:29:10 +0100
committerGitHub <noreply@github.com>2025-03-21 19:29:10 +0100
commitbcdf25ae58c4fe82cd444ea1ce3f1b8f2532c7ed (patch)
tree4aa3020d1be6badfd5aa63ad40d0e702bfee58f8
parent5c97c9ad38210b87581ac333ba060ab51d17c35e (diff)
parent13fbd38bd3a91b5b7a332ae013a3d3e60793d7a9 (diff)
Merge pull request #1229 from floooh/zig-0.14.0-cleanup
zig 0.14.0 cleanup
-rw-r--r--.github/workflows/gen_bindings.yml2
-rw-r--r--bindgen/gen_zig.py47
2 files changed, 15 insertions, 34 deletions
diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml
index 5666bff4..25c4b909 100644
--- a/.github/workflows/gen_bindings.yml
+++ b/.github/workflows/gen_bindings.yml
@@ -142,7 +142,7 @@ jobs:
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev
- name: build
- run: zig build
+ run: zig build examples
test-nim:
needs: gen-bindings
diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py
index 52f617e5..0281e9b8 100644
--- a/bindgen/gen_zig.py
+++ b/bindgen/gen_zig.py
@@ -489,39 +489,20 @@ def gen_helpers(inp):
l('// helper function to convert "anything" to a Range struct')
l('pub fn asRange(val: anytype) Range {')
l(' const type_info = @typeInfo(@TypeOf(val));')
- l(' // FIXME: naming convention change between 0.13 and 0.14-dev')
- l(' if (@hasField(@TypeOf(type_info), "Pointer")) {')
- l(' switch (type_info) {')
- l(' .Pointer => {')
- l(' switch (type_info.Pointer.size) {')
- l(' .One => return .{ .ptr = val, .size = @sizeOf(type_info.Pointer.child) },')
- l(' .Slice => return .{ .ptr = val.ptr, .size = @sizeOf(type_info.Pointer.child) * val.len },')
- l(' else => @compileError("FIXME: Pointer type!"),')
- l(' }')
- l(' },')
- l(' .Struct, .Array => {')
- l(' @compileError("Structs and arrays must be passed as pointers to asRange");')
- l(' },')
- l(' else => {')
- l(' @compileError("Cannot convert to range!");')
- l(' },')
- l(' }')
- l(' } else {')
- l(' switch (type_info) {')
- l(' .pointer => {')
- l(' switch (type_info.pointer.size) {')
- l(' .one => return .{ .ptr = val, .size = @sizeOf(type_info.pointer.child) },')
- l(' .slice => return .{ .ptr = val.ptr, .size = @sizeOf(type_info.pointer.child) * val.len },')
- l(' else => @compileError("FIXME: Pointer type!"),')
- l(' }')
- l(' },')
- l(' .@"struct", .array => {')
- l(' @compileError("Structs and arrays must be passed as pointers to asRange");')
- l(' },')
- l(' else => {')
- l(' @compileError("Cannot convert to range!");')
- l(' },')
- l(' }')
+ l(' switch (type_info) {')
+ l(' .pointer => {')
+ l(' switch (type_info.pointer.size) {')
+ l(' .one => return .{ .ptr = val, .size = @sizeOf(type_info.pointer.child) },')
+ l(' .slice => return .{ .ptr = val.ptr, .size = @sizeOf(type_info.pointer.child) * val.len },')
+ l(' else => @compileError("FIXME: Pointer type!"),')
+ l(' }')
+ l(' },')
+ l(' .@"struct", .array => {')
+ l(' @compileError("Structs and arrays must be passed as pointers to asRange");')
+ l(' },')
+ l(' else => {')
+ l(' @compileError("Cannot convert to range!");')
+ l(' },')
l(' }')
l('}')
l('')