diff options
| author | Trace Andreason <tandreason@gmail.com> | 2024-05-13 21:23:18 -0700 |
|---|---|---|
| committer | Trace Andreason <tandreason@gmail.com> | 2024-05-13 21:23:18 -0700 |
| commit | 57d10ef03fabf65d5059aba0adef0e979f949937 (patch) | |
| tree | 9def0b8710d99c853a53ca969023e0687a851d86 | |
| parent | f70cc07f0fcd763ab6ff0171a6b8fe1dca3ed367 (diff) | |
sokol fetch
| -rw-r--r-- | bindgen/gen_all.py | 1 | ||||
| -rw-r--r-- | bindgen/gen_zig.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/bindgen/gen_all.py b/bindgen/gen_all.py index e2471bbc..307213c2 100644 --- a/bindgen/gen_all.py +++ b/bindgen/gen_all.py @@ -7,6 +7,7 @@ tasks = [ [ '../sokol_glue.h', 'sglue_', ['sg_'] ], [ '../sokol_time.h', 'stm_', [] ], [ '../sokol_audio.h', 'saudio_', [] ], + [ '../sokol_fetch.h', 'sfetch_', [] ], [ '../util/sokol_gl.h', 'sgl_', ['sg_'] ], [ '../util/sokol_debugtext.h', 'sdtx_', ['sg_'] ], [ '../util/sokol_shape.h', 'sshape_', ['sg_'] ], diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py index bf7db050..1f0f1ca3 100644 --- a/bindgen/gen_zig.py +++ b/bindgen/gen_zig.py @@ -21,6 +21,7 @@ module_names = { 'sdtx_': 'debugtext', 'sshape_': 'shape', 'sglue_': 'glue', + 'sfetch_': 'sfetch', } c_source_paths = { @@ -33,6 +34,7 @@ c_source_paths = { 'sdtx_': 'sokol-zig/src/sokol/c/sokol_debugtext.c', 'sshape_': 'sokol-zig/src/sokol/c/sokol_shape.c', 'sglue_': 'sokol-zig/src/sokol/c/sokol_glue.c', + 'sfetch_': 'sokol-zig/src/sokol/c/sokol_fetch.c' } ignores = [ @@ -60,6 +62,8 @@ overrides = { 'sshape_element_range_t.num_elements': 'uint32_t', 'sdtx_font.font_index': 'uint32_t', 'SGL_NO_ERROR': 'SGL_ERROR_NO_ERROR', + 'sfetch_continue': 'fetch_continue', # 'fetch' is reserved in Zig + 'sfetch_desc': 'description' # 'desc' shadowed by earlier definiton } prim_types = { @@ -373,6 +377,8 @@ def gen_struct(decl, prefix): sys.exit(f"ERROR gen_struct is_2d_array_type: {array_type}") t0 = f"[{array_sizes[0]}][{array_sizes[1]}]{zig_type}" l(f" {field_name}: {t0} = [_][{array_sizes[1]}]{zig_type}{{[_]{zig_type}{{{def_val}}} ** {array_sizes[1]}}} ** {array_sizes[0]},") + elif field_name == "callback": + l(f" {field_name}: fn (*Response) void,") else: sys.exit(f"ERROR gen_struct: {field_name}: {field_type};") l("};") |