ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 8bec7c3e173b637423b2d06c0251cf90fc1536c6
Parent: 5fbdcb75d46cba74354b8cdf7b7e27450edd3ff2
Author: Randy Palamar
Date:   Mon,  2 Jun 2025 08:31:24 -0600

util: add arg_list() macro

Diffstat:
Mbuild.c | 11++++-------
Mutil.c | 3+--
Mutil.h | 2++
3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/build.c b/build.c @@ -440,8 +440,7 @@ git_submodule_update(Arena a, char *name) { Stream sb = arena_stream(a); stream_append_s8s(&sb, c_str_to_s8(name), s8(OS_PATH_SEPARATOR), s8(".git")); - stream_append_byte(&sb, 0); - arena_commit(&a, sb.widx); + arena_stream_commit_zero(&a, &sb); CommandList git = {0}; /* NOTE(rnp): cryptic bs needed to get a simple exit code if name is dirty */ @@ -454,8 +453,9 @@ git_submodule_update(Arena a, char *name) } } +#define build_shared_library(a, cc, name, ...) build_shared_library_(a, cc, name, arg_list(char *, ##__VA_ARGS__)) function b32 -build_shared_library(Arena a, CommandList cc, char *name, char **deps, iz deps_count) +build_shared_library_(Arena a, CommandList cc, char *name, char **deps, iz deps_count) { b32 result = 0; cmd_append(&a, &cc, "-fPIC", "-shared"); @@ -600,11 +600,8 @@ main(i32 argc, char *argv[]) if (options.debug) { iz c_count = c.count; if (is_w32) cmd_append_ldflags(&arena, &c, 1); - if (!build_shared_library(arena, c, OS_SHARED_LIB("beamformer"), - (char *[]){"beamformer.c"}, 1)) - { + if (!build_shared_library(arena, c, OS_SHARED_LIB("beamformer"), "beamformer.c")) die("failed to build: " OS_SHARED_LIB("beamfomer") "\n"); - } c.count = c_count; } diff --git a/util.c b/util.c @@ -249,8 +249,7 @@ stream_append_s8(Stream *s, s8 str) stream_append(s, str.data, str.len); } -#define stream_append_s8s(s, ...) stream_append_s8s_(s, (s8 []){__VA_ARGS__}, \ - sizeof((s8 []){__VA_ARGS__}) / sizeof(s8)) +#define stream_append_s8s(s, ...) stream_append_s8s_(s, arg_list(s8, ##__VA_ARGS__)) function void stream_append_s8s_(Stream *s, s8 *strs, iz count) { diff --git a/util.h b/util.h @@ -40,6 +40,8 @@ #define INVALID_DEFAULT_CASE default: ASSERT(0); break #define InvalidDefaultCase default: assert(0); break +#define arg_list(type, ...) (type []){__VA_ARGS__}, sizeof((type []){__VA_ARGS__}) / sizeof(type) + #define function static #define global static #define local_persist static