From 1fdb80e633cb7b519f85f8fa3f6ea55b79b288e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Sun, 27 Jul 2025 22:51:39 +0500 Subject: [PATCH] Introduce a better syntax for single resource allocation --- include/with99.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/with99.h b/include/with99.h index 3166452..1573f96 100644 --- a/include/with99.h +++ b/include/with99.h @@ -14,7 +14,7 @@ #endif #define WITH99_MAJOR 2 -#define WITH99_MINOR 0 +#define WITH99_MINOR 1 #define WITH99_PATCH 0 #define WITH99_VERSION_COMPATIBLE(x, y, z) (WITH99_MAJOR == (x) && ((WITH99_MINOR == (y) && WITH99_PATCH >= (z)) || (WITH99_MINOR > (y)))) @@ -55,7 +55,19 @@ #define WITH99_With(...) ML99_EVAL(WITH99_with(v(__VA_ARGS__))) +#define WITH99_priv_multiple(...) ML99_variadicsForEach(v(WITH99_priv_create_stmt), v(__VA_ARGS__)) + #define WITH99_with(...) ML99_call(WITH99_with, __VA_ARGS__) -#define WITH99_with_IMPL(...) ML99_variadicsForEach(v(WITH99_priv_create_stmt), v(__VA_ARGS__)) +#define WITH99_with_IMPL(...) \ + ML99_appl(\ + ML99_if(\ + ML99_isTuple(ML99_variadicsGet(0)(v(__VA_ARGS__))),\ + ML99_compose(ML99_appl(v(ML99_variadicsForEach), v(WITH99_priv_create_stmt)), v(ML99_untuple)),\ + v(WITH99_priv_create_stmt)\ + ),\ + ML99_tuple(v(__VA_ARGS__))\ + ) + + #endif