Prefix static macros
This commit is contained in:
@@ -37,7 +37,7 @@ BEGIN_C_LINKAGE
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#define wapp_void_ptr_array(...) ([&]() { \
|
||||
persistent void * buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(void *, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist void * buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(void *, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return VoidPArray{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(void *, __VA_ARGS__), \
|
||||
@@ -46,7 +46,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_void_ptr_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent void * buf[CAPACITY] = {}; \
|
||||
wapp_persist void * buf[CAPACITY] = {}; \
|
||||
return VoidPArray{buf, 0, CAPACITY, sizeof(void *)}; \
|
||||
}())
|
||||
#define wapp_void_ptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -54,7 +54,7 @@ BEGIN_C_LINKAGE
|
||||
void *{} \
|
||||
)
|
||||
#define wapp_str8_array(...) ([&]() { \
|
||||
persistent Str8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist Str8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(Str8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return Str8Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(Str8, __VA_ARGS__), \
|
||||
@@ -63,7 +63,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_str8_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent Str8 buf[CAPACITY] = {}; \
|
||||
wapp_persist Str8 buf[CAPACITY] = {}; \
|
||||
return Str8Array{buf, 0, CAPACITY, sizeof(Str8)}; \
|
||||
}())
|
||||
#define wapp_str8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -71,7 +71,7 @@ BEGIN_C_LINKAGE
|
||||
Str8{} \
|
||||
)
|
||||
#define wapp_b32_array(...) ([&]() { \
|
||||
persistent b32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist b32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(b32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return B32Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(b32, __VA_ARGS__), \
|
||||
@@ -80,7 +80,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_b32_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent b32 buf[CAPACITY] = {}; \
|
||||
wapp_persist b32 buf[CAPACITY] = {}; \
|
||||
return B32Array{buf, 0, CAPACITY, sizeof(b32)}; \
|
||||
}())
|
||||
#define wapp_b32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -88,7 +88,7 @@ BEGIN_C_LINKAGE
|
||||
b32{} \
|
||||
)
|
||||
#define wapp_char_array(...) ([&]() { \
|
||||
persistent char buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(char, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist char buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(char, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return CharArray{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(char, __VA_ARGS__), \
|
||||
@@ -97,7 +97,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_char_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent char buf[CAPACITY] = {}; \
|
||||
wapp_persist char buf[CAPACITY] = {}; \
|
||||
return CharArray{buf, 0, CAPACITY, sizeof(char)}; \
|
||||
}())
|
||||
#define wapp_char_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -105,7 +105,7 @@ BEGIN_C_LINKAGE
|
||||
char{} \
|
||||
)
|
||||
#define wapp_c8_array(...) ([&]() { \
|
||||
persistent c8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist c8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return C8Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(c8, __VA_ARGS__), \
|
||||
@@ -114,7 +114,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_c8_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent c8 buf[CAPACITY] = {}; \
|
||||
wapp_persist c8 buf[CAPACITY] = {}; \
|
||||
return C8Array{buf, 0, CAPACITY, sizeof(c8)}; \
|
||||
}())
|
||||
#define wapp_c8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -122,7 +122,7 @@ BEGIN_C_LINKAGE
|
||||
c8{} \
|
||||
)
|
||||
#define wapp_c16_array(...) ([&]() { \
|
||||
persistent c16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist c16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return C16Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(c16, __VA_ARGS__), \
|
||||
@@ -131,7 +131,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_c16_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent c16 buf[CAPACITY] = {}; \
|
||||
wapp_persist c16 buf[CAPACITY] = {}; \
|
||||
return C16Array{buf, 0, CAPACITY, sizeof(c16)}; \
|
||||
}())
|
||||
#define wapp_c16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -139,7 +139,7 @@ BEGIN_C_LINKAGE
|
||||
c16{} \
|
||||
)
|
||||
#define wapp_c32_array(...) ([&]() { \
|
||||
persistent c32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist c32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(c32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return C32Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(c32, __VA_ARGS__), \
|
||||
@@ -148,7 +148,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_c32_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent c32 buf[CAPACITY] = {}; \
|
||||
wapp_persist c32 buf[CAPACITY] = {}; \
|
||||
return C32Array{buf, 0, CAPACITY, sizeof(c32)}; \
|
||||
}())
|
||||
#define wapp_c32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -156,7 +156,7 @@ BEGIN_C_LINKAGE
|
||||
c32{} \
|
||||
)
|
||||
#define wapp_i8_array(...) ([&]() { \
|
||||
persistent i8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist i8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return I8Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(i8, __VA_ARGS__), \
|
||||
@@ -165,7 +165,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_i8_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent i8 buf[CAPACITY] = {}; \
|
||||
wapp_persist i8 buf[CAPACITY] = {}; \
|
||||
return I8Array{buf, 0, CAPACITY, sizeof(i8)}; \
|
||||
}())
|
||||
#define wapp_i8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -173,7 +173,7 @@ BEGIN_C_LINKAGE
|
||||
i8{} \
|
||||
)
|
||||
#define wapp_i16_array(...) ([&]() { \
|
||||
persistent i16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist i16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return I16Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(i16, __VA_ARGS__), \
|
||||
@@ -182,7 +182,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_i16_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent i16 buf[CAPACITY] = {}; \
|
||||
wapp_persist i16 buf[CAPACITY] = {}; \
|
||||
return I16Array{buf, 0, CAPACITY, sizeof(i16)}; \
|
||||
}())
|
||||
#define wapp_i16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -190,7 +190,7 @@ BEGIN_C_LINKAGE
|
||||
i16{} \
|
||||
)
|
||||
#define wapp_i32_array(...) ([&]() { \
|
||||
persistent i32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist i32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return I32Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(i32, __VA_ARGS__), \
|
||||
@@ -199,7 +199,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_i32_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent i32 buf[CAPACITY] = {}; \
|
||||
wapp_persist i32 buf[CAPACITY] = {}; \
|
||||
return I32Array{buf, 0, CAPACITY, sizeof(i32)}; \
|
||||
}())
|
||||
#define wapp_i32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -207,7 +207,7 @@ BEGIN_C_LINKAGE
|
||||
i32{} \
|
||||
)
|
||||
#define wapp_i64_array(...) ([&]() { \
|
||||
persistent i64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist i64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(i64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return I64Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(i64, __VA_ARGS__), \
|
||||
@@ -216,7 +216,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_i64_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent i64 buf[CAPACITY] = {}; \
|
||||
wapp_persist i64 buf[CAPACITY] = {}; \
|
||||
return I64Array{buf, 0, CAPACITY, sizeof(i64)}; \
|
||||
}())
|
||||
#define wapp_i64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -224,7 +224,7 @@ BEGIN_C_LINKAGE
|
||||
i64{} \
|
||||
)
|
||||
#define wapp_u8_array(...) ([&]() { \
|
||||
persistent u8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist u8 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u8, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return U8Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(u8, __VA_ARGS__), \
|
||||
@@ -233,7 +233,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_u8_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent u8 buf[CAPACITY] = {}; \
|
||||
wapp_persist u8 buf[CAPACITY] = {}; \
|
||||
return U8Array{buf, 0, CAPACITY, sizeof(u8)}; \
|
||||
}())
|
||||
#define wapp_u8_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -241,7 +241,7 @@ BEGIN_C_LINKAGE
|
||||
u8{} \
|
||||
)
|
||||
#define wapp_u16_array(...) ([&]() { \
|
||||
persistent u16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist u16 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u16, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return U16Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(u16, __VA_ARGS__), \
|
||||
@@ -250,7 +250,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_u16_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent u16 buf[CAPACITY] = {}; \
|
||||
wapp_persist u16 buf[CAPACITY] = {}; \
|
||||
return U16Array{buf, 0, CAPACITY, sizeof(u16)}; \
|
||||
}())
|
||||
#define wapp_u16_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -258,7 +258,7 @@ BEGIN_C_LINKAGE
|
||||
u16{} \
|
||||
)
|
||||
#define wapp_u32_array(...) ([&]() { \
|
||||
persistent u32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist u32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return U32Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(u32, __VA_ARGS__), \
|
||||
@@ -267,7 +267,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_u32_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent u32 buf[CAPACITY] = {}; \
|
||||
wapp_persist u32 buf[CAPACITY] = {}; \
|
||||
return U32Array{buf, 0, CAPACITY, sizeof(u32)}; \
|
||||
}())
|
||||
#define wapp_u32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -275,7 +275,7 @@ BEGIN_C_LINKAGE
|
||||
u32{} \
|
||||
)
|
||||
#define wapp_u64_array(...) ([&]() { \
|
||||
persistent u64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist u64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(u64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return U64Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(u64, __VA_ARGS__), \
|
||||
@@ -284,7 +284,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_u64_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent u64 buf[CAPACITY] = {}; \
|
||||
wapp_persist u64 buf[CAPACITY] = {}; \
|
||||
return U64Array{buf, 0, CAPACITY, sizeof(u64)}; \
|
||||
}())
|
||||
#define wapp_u64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -292,7 +292,7 @@ BEGIN_C_LINKAGE
|
||||
u64{} \
|
||||
)
|
||||
#define wapp_f32_array(...) ([&]() { \
|
||||
persistent f32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist f32 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f32, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return F32Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(f32, __VA_ARGS__), \
|
||||
@@ -301,7 +301,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_f32_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent f32 buf[CAPACITY] = {}; \
|
||||
wapp_persist f32 buf[CAPACITY] = {}; \
|
||||
return F32Array{buf, 0, CAPACITY, sizeof(f32)}; \
|
||||
}())
|
||||
#define wapp_f32_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -309,7 +309,7 @@ BEGIN_C_LINKAGE
|
||||
f32{} \
|
||||
)
|
||||
#define wapp_f64_array(...) ([&]() { \
|
||||
persistent f64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist f64 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f64, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return F64Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(f64, __VA_ARGS__), \
|
||||
@@ -318,7 +318,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_f64_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent f64 buf[CAPACITY] = {}; \
|
||||
wapp_persist f64 buf[CAPACITY] = {}; \
|
||||
return F64Array{buf, 0, CAPACITY, sizeof(f64)}; \
|
||||
}())
|
||||
#define wapp_f64_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -326,7 +326,7 @@ BEGIN_C_LINKAGE
|
||||
f64{} \
|
||||
)
|
||||
#define wapp_f128_array(...) ([&]() { \
|
||||
persistent f128 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f128, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist f128 buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(f128, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return F128Array{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(f128, __VA_ARGS__), \
|
||||
@@ -335,7 +335,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_f128_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent f128 buf[CAPACITY] = {}; \
|
||||
wapp_persist f128 buf[CAPACITY] = {}; \
|
||||
return F128Array{buf, 0, CAPACITY, sizeof(f128)}; \
|
||||
}())
|
||||
#define wapp_f128_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -343,7 +343,7 @@ BEGIN_C_LINKAGE
|
||||
f128{} \
|
||||
)
|
||||
#define wapp_iptr_array(...) ([&]() { \
|
||||
persistent iptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(iptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist iptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(iptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return IptrArray{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(iptr, __VA_ARGS__), \
|
||||
@@ -352,7 +352,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_iptr_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent iptr buf[CAPACITY] = {}; \
|
||||
wapp_persist iptr buf[CAPACITY] = {}; \
|
||||
return IptrArray{buf, 0, CAPACITY, sizeof(iptr)}; \
|
||||
}())
|
||||
#define wapp_iptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
@@ -360,7 +360,7 @@ BEGIN_C_LINKAGE
|
||||
iptr{} \
|
||||
)
|
||||
#define wapp_uptr_array(...) ([&]() { \
|
||||
persistent uptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(uptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
wapp_persist uptr buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count(uptr, __VA_ARGS__) * 2)] = {__VA_ARGS__}; \
|
||||
return UptrArray{ \
|
||||
buf, \
|
||||
wapp_misc_utils_va_args_count(uptr, __VA_ARGS__), \
|
||||
@@ -369,7 +369,7 @@ BEGIN_C_LINKAGE
|
||||
}; \
|
||||
}())
|
||||
#define wapp_uptr_array_with_capacity(CAPACITY) ([&]() { \
|
||||
persistent uptr buf[CAPACITY] = {}; \
|
||||
wapp_persist uptr buf[CAPACITY] = {}; \
|
||||
return UptrArray{buf, 0, CAPACITY, sizeof(uptr)}; \
|
||||
}())
|
||||
#define wapp_uptr_array_pop(ARRAY_PTR) (ARRAY_PTR != NULL && (ARRAY_PTR)->count > 0 ? \
|
||||
|
||||
@@ -8,26 +8,26 @@
|
||||
#include "../../common/platform/platform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
internal VoidPList void_ptr_node_to_list(VoidPNode *node);
|
||||
internal Str8List str8_node_to_list(Str8Node *node);
|
||||
internal B32List b32_node_to_list(B32Node *node);
|
||||
internal CharList char_node_to_list(CharNode *node);
|
||||
internal C8List c8_node_to_list(C8Node *node);
|
||||
internal C16List c16_node_to_list(C16Node *node);
|
||||
internal C32List c32_node_to_list(C32Node *node);
|
||||
internal I8List i8_node_to_list(I8Node *node);
|
||||
internal I16List i16_node_to_list(I16Node *node);
|
||||
internal I32List i32_node_to_list(I32Node *node);
|
||||
internal I64List i64_node_to_list(I64Node *node);
|
||||
internal U8List u8_node_to_list(U8Node *node);
|
||||
internal U16List u16_node_to_list(U16Node *node);
|
||||
internal U32List u32_node_to_list(U32Node *node);
|
||||
internal U64List u64_node_to_list(U64Node *node);
|
||||
internal F32List f32_node_to_list(F32Node *node);
|
||||
internal F64List f64_node_to_list(F64Node *node);
|
||||
internal F128List f128_node_to_list(F128Node *node);
|
||||
internal IptrList iptr_node_to_list(IptrNode *node);
|
||||
internal UptrList uptr_node_to_list(UptrNode *node);
|
||||
wapp_intern VoidPList void_ptr_node_to_list(VoidPNode *node);
|
||||
wapp_intern Str8List str8_node_to_list(Str8Node *node);
|
||||
wapp_intern B32List b32_node_to_list(B32Node *node);
|
||||
wapp_intern CharList char_node_to_list(CharNode *node);
|
||||
wapp_intern C8List c8_node_to_list(C8Node *node);
|
||||
wapp_intern C16List c16_node_to_list(C16Node *node);
|
||||
wapp_intern C32List c32_node_to_list(C32Node *node);
|
||||
wapp_intern I8List i8_node_to_list(I8Node *node);
|
||||
wapp_intern I16List i16_node_to_list(I16Node *node);
|
||||
wapp_intern I32List i32_node_to_list(I32Node *node);
|
||||
wapp_intern I64List i64_node_to_list(I64Node *node);
|
||||
wapp_intern U8List u8_node_to_list(U8Node *node);
|
||||
wapp_intern U16List u16_node_to_list(U16Node *node);
|
||||
wapp_intern U32List u32_node_to_list(U32Node *node);
|
||||
wapp_intern U64List u64_node_to_list(U64Node *node);
|
||||
wapp_intern F32List f32_node_to_list(F32Node *node);
|
||||
wapp_intern F64List f64_node_to_list(F64Node *node);
|
||||
wapp_intern F128List f128_node_to_list(F128Node *node);
|
||||
wapp_intern IptrList iptr_node_to_list(IptrNode *node);
|
||||
wapp_intern UptrList uptr_node_to_list(UptrNode *node);
|
||||
|
||||
VoidPNode *wapp_void_ptr_list_get(const VoidPList *list, u64 index) {
|
||||
wapp_runtime_assert(index < list->node_count, "`index` is out of bounds");
|
||||
@@ -3489,7 +3489,7 @@ void wapp_uptr_list_empty(UptrList *list) {
|
||||
}
|
||||
}
|
||||
|
||||
internal VoidPList void_ptr_node_to_list(VoidPNode *node) {
|
||||
wapp_intern VoidPList void_ptr_node_to_list(VoidPNode *node) {
|
||||
VoidPList output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3505,7 +3505,7 @@ internal VoidPList void_ptr_node_to_list(VoidPNode *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal Str8List str8_node_to_list(Str8Node *node) {
|
||||
wapp_intern Str8List str8_node_to_list(Str8Node *node) {
|
||||
Str8List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3521,7 +3521,7 @@ internal Str8List str8_node_to_list(Str8Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal B32List b32_node_to_list(B32Node *node) {
|
||||
wapp_intern B32List b32_node_to_list(B32Node *node) {
|
||||
B32List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3537,7 +3537,7 @@ internal B32List b32_node_to_list(B32Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal CharList char_node_to_list(CharNode *node) {
|
||||
wapp_intern CharList char_node_to_list(CharNode *node) {
|
||||
CharList output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3553,7 +3553,7 @@ internal CharList char_node_to_list(CharNode *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal C8List c8_node_to_list(C8Node *node) {
|
||||
wapp_intern C8List c8_node_to_list(C8Node *node) {
|
||||
C8List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3569,7 +3569,7 @@ internal C8List c8_node_to_list(C8Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal C16List c16_node_to_list(C16Node *node) {
|
||||
wapp_intern C16List c16_node_to_list(C16Node *node) {
|
||||
C16List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3585,7 +3585,7 @@ internal C16List c16_node_to_list(C16Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal C32List c32_node_to_list(C32Node *node) {
|
||||
wapp_intern C32List c32_node_to_list(C32Node *node) {
|
||||
C32List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3601,7 +3601,7 @@ internal C32List c32_node_to_list(C32Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal I8List i8_node_to_list(I8Node *node) {
|
||||
wapp_intern I8List i8_node_to_list(I8Node *node) {
|
||||
I8List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3617,7 +3617,7 @@ internal I8List i8_node_to_list(I8Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal I16List i16_node_to_list(I16Node *node) {
|
||||
wapp_intern I16List i16_node_to_list(I16Node *node) {
|
||||
I16List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3633,7 +3633,7 @@ internal I16List i16_node_to_list(I16Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal I32List i32_node_to_list(I32Node *node) {
|
||||
wapp_intern I32List i32_node_to_list(I32Node *node) {
|
||||
I32List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3649,7 +3649,7 @@ internal I32List i32_node_to_list(I32Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal I64List i64_node_to_list(I64Node *node) {
|
||||
wapp_intern I64List i64_node_to_list(I64Node *node) {
|
||||
I64List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3665,7 +3665,7 @@ internal I64List i64_node_to_list(I64Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal U8List u8_node_to_list(U8Node *node) {
|
||||
wapp_intern U8List u8_node_to_list(U8Node *node) {
|
||||
U8List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3681,7 +3681,7 @@ internal U8List u8_node_to_list(U8Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal U16List u16_node_to_list(U16Node *node) {
|
||||
wapp_intern U16List u16_node_to_list(U16Node *node) {
|
||||
U16List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3697,7 +3697,7 @@ internal U16List u16_node_to_list(U16Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal U32List u32_node_to_list(U32Node *node) {
|
||||
wapp_intern U32List u32_node_to_list(U32Node *node) {
|
||||
U32List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3713,7 +3713,7 @@ internal U32List u32_node_to_list(U32Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal U64List u64_node_to_list(U64Node *node) {
|
||||
wapp_intern U64List u64_node_to_list(U64Node *node) {
|
||||
U64List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3729,7 +3729,7 @@ internal U64List u64_node_to_list(U64Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal F32List f32_node_to_list(F32Node *node) {
|
||||
wapp_intern F32List f32_node_to_list(F32Node *node) {
|
||||
F32List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3745,7 +3745,7 @@ internal F32List f32_node_to_list(F32Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal F64List f64_node_to_list(F64Node *node) {
|
||||
wapp_intern F64List f64_node_to_list(F64Node *node) {
|
||||
F64List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3761,7 +3761,7 @@ internal F64List f64_node_to_list(F64Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal F128List f128_node_to_list(F128Node *node) {
|
||||
wapp_intern F128List f128_node_to_list(F128Node *node) {
|
||||
F128List output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3777,7 +3777,7 @@ internal F128List f128_node_to_list(F128Node *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal IptrList iptr_node_to_list(IptrNode *node) {
|
||||
wapp_intern IptrList iptr_node_to_list(IptrNode *node) {
|
||||
IptrList output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
@@ -3793,7 +3793,7 @@ internal IptrList iptr_node_to_list(IptrNode *node) {
|
||||
return output;
|
||||
}
|
||||
|
||||
internal UptrList uptr_node_to_list(UptrNode *node) {
|
||||
wapp_intern UptrList uptr_node_to_list(UptrNode *node) {
|
||||
UptrList output = {.first = node, .last = node, .node_count = 1};
|
||||
|
||||
while (output.first->prev != NULL) {
|
||||
|
||||
@@ -37,14 +37,14 @@ typedef const Str8 Str8RO;
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
// Uses a lambda to achieve the same behaviour achieved by the C macro
|
||||
#define wapp_str8_buf(CAPACITY) ([&](){ \
|
||||
persistent c8 buf[CAPACITY] = {}; \
|
||||
wapp_persist c8 buf[CAPACITY] = {}; \
|
||||
memset(buf, 0, CAPACITY); \
|
||||
return Str8{CAPACITY, 0, buf}; \
|
||||
}())
|
||||
|
||||
// Uses a lambda to achieve the same behaviour achieved by the C macro
|
||||
#define wapp_str8_lit(STRING) ([&]() { \
|
||||
persistent c8 buf[sizeof(STRING) * 2] = {}; \
|
||||
wapp_persist c8 buf[sizeof(STRING) * 2] = {}; \
|
||||
memcpy(buf, STRING, sizeof(STRING)); \
|
||||
return Str8{(sizeof(STRING) - 1) * 2, sizeof(STRING) - 1, buf}; \
|
||||
}())
|
||||
@@ -121,11 +121,11 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8R
|
||||
*/
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#define wapp_str8_node_from_cstr(STRING) wapp_str8_list_node([&]() { \
|
||||
persistent Str8 str = wapp_str8_lit(STRING); \
|
||||
wapp_persist Str8 str = wapp_str8_lit(STRING); \
|
||||
return &str; \
|
||||
}())
|
||||
#define wapp_str8_node_from_str8(STRING) wapp_str8_list_node([&]() { \
|
||||
persistent Str8 str = STRING; \
|
||||
wapp_persist Str8 str = STRING; \
|
||||
return &str; \
|
||||
}())
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user