Add Var and VarThrows

This commit is contained in:
bʰedoh₂ swé 2025-07-28 20:04:15 +05:00
parent 7a40d07642
commit 6b6d715653
2 changed files with 15 additions and 1 deletions

View File

@ -14,7 +14,7 @@
#endif
#define WITH99_MAJOR 3
#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))))

View File

@ -15,6 +15,20 @@
ML99_just(v((deinit)))\
)
#define WITH99_resource_Var_IMPL(type, var, init, deinit) \
ML99_tuple(\
ML99_just(v(type var)),\
ML99_just(v(((var = init), 1))),\
ML99_just(v((deinit)))\
)
#define WITH99_resource_VarThrows_IMPL(type, var, init, deinit, errorvalue) \
ML99_tuple(\
ML99_just(v(type var)),\
ML99_just(v( ((var = init), var != errorvalue) )),\
ML99_just(v((deinit)))\
)
#define WITH99_resource_Call_IMPL(init, deinit) \
ML99_tuple(\
ML99_nothing(),\