diff --git a/ccodegen/datatypes.c b/ccodegen/datatypes.c index 454bc80..39b6010 100644 --- a/ccodegen/datatypes.c +++ b/ccodegen/datatypes.c @@ -472,7 +472,7 @@ void csource_to_string(Str8 *dst, const CSource *csource) { wapp_str8_alloc_concat(&arena, output, &tmp); } - Str8RO _internal = wapp_str8_lit_ro("internal "); + Str8RO _wapp_intern = wapp_str8_lit_ro("wapp_intern "); for (u64 i = 0; i < csource->internal_funcs.node_count; ++i) { declare_cfunc(&tmp, wapp_cfunc_list_get(&(csource->internal_funcs), i)->item); wapp_str8_alloc_concat(&arena, output, &_internal); diff --git a/ccodegen/dbl_list.c b/ccodegen/dbl_list.c index d479933..16c19ed 100644 --- a/ccodegen/dbl_list.c +++ b/ccodegen/dbl_list.c @@ -4,14 +4,14 @@ #include "wapp_core.h" #include -internal CEnumValList cenumval_node_to_list(CEnumValNode *node); -internal CArgList carg_node_to_list(CArgNode *node); -internal CQualifierList cqualifier_node_to_list(CQualifierNode *node); -internal CIncludeList cinclude_node_to_list(CIncludeNode *node); -internal CUserTypeList cusertype_node_to_list(CUserTypeNode *node); -internal CFuncList cfunc_node_to_list(CFuncNode *node); -internal CStructList cstruct_node_to_list(CStructNode *node); -internal CMacroList cmacro_node_to_list(CMacroNode *node); +wapp_intern CEnumValList cenumval_node_to_list(CEnumValNode *node); +wapp_intern CArgList carg_node_to_list(CArgNode *node); +wapp_intern CQualifierList cqualifier_node_to_list(CQualifierNode *node); +wapp_intern CIncludeList cinclude_node_to_list(CIncludeNode *node); +wapp_intern CUserTypeList cusertype_node_to_list(CUserTypeNode *node); +wapp_intern CFuncList cfunc_node_to_list(CFuncNode *node); +wapp_intern CStructList cstruct_node_to_list(CStructNode *node); +wapp_intern CMacroList cmacro_node_to_list(CMacroNode *node); CEnumValNode *wapp_cenumval_list_get(const CEnumValList *list, u64 index) { wapp_runtime_assert(index < list->node_count, "`index` is out of bounds"); @@ -1397,7 +1397,7 @@ void wapp_cmacro_list_empty(CMacroList *list) { } } -internal CEnumValList cenumval_node_to_list(CEnumValNode *node) { +wapp_intern CEnumValList cenumval_node_to_list(CEnumValNode *node) { CEnumValList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1413,7 +1413,7 @@ internal CEnumValList cenumval_node_to_list(CEnumValNode *node) { return output; } -internal CArgList carg_node_to_list(CArgNode *node) { +wapp_intern CArgList carg_node_to_list(CArgNode *node) { CArgList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1429,7 +1429,7 @@ internal CArgList carg_node_to_list(CArgNode *node) { return output; } -internal CQualifierList cqualifier_node_to_list(CQualifierNode *node) { +wapp_intern CQualifierList cqualifier_node_to_list(CQualifierNode *node) { CQualifierList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1445,7 +1445,7 @@ internal CQualifierList cqualifier_node_to_list(CQualifierNode *node) { return output; } -internal CIncludeList cinclude_node_to_list(CIncludeNode *node) { +wapp_intern CIncludeList cinclude_node_to_list(CIncludeNode *node) { CIncludeList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1461,7 +1461,7 @@ internal CIncludeList cinclude_node_to_list(CIncludeNode *node) { return output; } -internal CUserTypeList cusertype_node_to_list(CUserTypeNode *node) { +wapp_intern CUserTypeList cusertype_node_to_list(CUserTypeNode *node) { CUserTypeList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1477,7 +1477,7 @@ internal CUserTypeList cusertype_node_to_list(CUserTypeNode *node) { return output; } -internal CFuncList cfunc_node_to_list(CFuncNode *node) { +wapp_intern CFuncList cfunc_node_to_list(CFuncNode *node) { CFuncList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1493,7 +1493,7 @@ internal CFuncList cfunc_node_to_list(CFuncNode *node) { return output; } -internal CStructList cstruct_node_to_list(CStructNode *node) { +wapp_intern CStructList cstruct_node_to_list(CStructNode *node) { CStructList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { @@ -1509,7 +1509,7 @@ internal CStructList cstruct_node_to_list(CStructNode *node) { return output; } -internal CMacroList cmacro_node_to_list(CMacroNode *node) { +wapp_intern CMacroList cmacro_node_to_list(CMacroNode *node) { CMacroList output = {.first = node, .last = node, .node_count = 1}; while (output.first->prev != NULL) { diff --git a/ccodegen/type_enums.h b/ccodegen/type_enums.h index 2c5f4d2..6fcddb8 100644 --- a/ccodegen/type_enums.h +++ b/ccodegen/type_enums.h @@ -28,7 +28,7 @@ typedef enum { COUNT_CTYPE, } CType; -internal Str8RO ctypes[COUNT_CTYPE] = { +wapp_intern Str8RO ctypes[COUNT_CTYPE] = { [CTYPE_VOID] = wapp_str8_lit_ro("void"), [CTYPE_B32] = wapp_str8_lit_ro("b32"), [CTYPE_CHAR] = wapp_str8_lit_ro("char"), @@ -59,12 +59,12 @@ typedef enum { COUNT_CQUALIFIER, } CQualifier; -internal Str8RO cqualifiers[COUNT_CQUALIFIER] = { +wapp_intern Str8RO cqualifiers[COUNT_CQUALIFIER] = { [CQUALIFIER_NONE] = wapp_str8_lit_ro(""), [CQUALIFIER_CONST] = wapp_str8_lit_ro("const "), - [CQUALIFIER_EXTERNAL] = wapp_str8_lit_ro("external "), - [CQUALIFIER_INTERNAL] = wapp_str8_lit_ro("internal "), - [CQUALIFIER_PERSISTENT] = wapp_str8_lit_ro("persistent "), + [CQUALIFIER_EXTERNAL] = wapp_str8_lit_ro("wapp_extern "), + [CQUALIFIER_INTERNAL] = wapp_str8_lit_ro("wapp_intern "), + [CQUALIFIER_PERSISTENT] = wapp_str8_lit_ro("wapp_persist "), }; @@ -75,7 +75,7 @@ typedef enum { COUNT_CPOINTERTYPE, } CPointerType; -internal Str8RO cpointertypes[COUNT_CPOINTERTYPE] = { +wapp_intern Str8RO cpointertypes[COUNT_CPOINTERTYPE] = { [CPOINTERTYPE_NONE] = wapp_str8_lit_ro(""), [CPOINTERTYPE_SINGLE] = wapp_str8_lit_ro("*"), [CPOINTERTYPE_DOUBLE] = wapp_str8_lit_ro("**"), diff --git a/codegen/array/snippets/stack_array_cpp b/codegen/array/snippets/stack_array_cpp index fb9272d..262c034 100644 --- a/codegen/array/snippets/stack_array_cpp +++ b/codegen/array/snippets/stack_array_cpp @@ -1,5 +1,5 @@ ([&]() {{ \ - persistent {T} buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count({T}, __VA_ARGS__) * 2)] = {{__VA_ARGS__}}; \ + wapp_persist {T} buf[wapp_misc_utils_u64_round_up_pow2(wapp_misc_utils_va_args_count({T}, __VA_ARGS__) * 2)] = {{__VA_ARGS__}}; \ return {ArrayType}{{ \ buf, \ wapp_misc_utils_va_args_count({T}, __VA_ARGS__), \ diff --git a/codegen/array/snippets/stack_capacity_array_cpp b/codegen/array/snippets/stack_capacity_array_cpp index 8d76812..2b69acd 100644 --- a/codegen/array/snippets/stack_capacity_array_cpp +++ b/codegen/array/snippets/stack_capacity_array_cpp @@ -1,4 +1,4 @@ ([&]() {{ \ - persistent {T} buf[CAPACITY] = {{}}; \ + wapp_persist {T} buf[CAPACITY] = {{}}; \ return {ArrayType}{{buf, 0, CAPACITY, sizeof({T})}}; \ }}()) diff --git a/codegen/datatypes.py b/codegen/datatypes.py index 32b53a2..d2fc19b 100644 --- a/codegen/datatypes.py +++ b/codegen/datatypes.py @@ -93,9 +93,9 @@ class CType(Enum): class CQualifier(Enum): NONE = "" CONST = "const " - EXTERNAL = "external " - INTERNAL = "internal " - PERSISTENT = "persistent " + EXTERNAL = "wapp_extern " + INTERNAL = "wapp_intern " + PERSISTENT = "wapp_persist " def __str__(self) -> str: return self.value diff --git a/src/common/aliases/aliases.h b/src/common/aliases/aliases.h index 0534834..1a60b9c 100644 --- a/src/common/aliases/aliases.h +++ b/src/common/aliases/aliases.h @@ -54,12 +54,12 @@ #define uptr uintptr_t #define iptr intptr_t -#define external extern -#define internal static -#define persistent static +#define wapp_extern extern +#define wapp_intern static +#define wapp_persist static #ifdef WAPP_PLATFORM_CPP -#define class_mem static +#define wapp_class_mem static #define BEGIN_C_LINKAGE extern "C" { #define END_C_LINKAGE } #endif // WAPP_PLATFORM_CPP diff --git a/src/core/file/file.c b/src/core/file/file.c index cd69fba..c5fbfa2 100644 --- a/src/core/file/file.c +++ b/src/core/file/file.c @@ -9,7 +9,7 @@ #include File *wapp_file_open(Str8RO *filepath, FileAccessMode mode) { - persistent const char *modes[FILE_ACCESS_MODE_COUNT] = { + wapp_persist const char *modes[FILE_ACCESS_MODE_COUNT] = { [WAPP_FA_MODE_R] = "r", [WAPP_FA_MODE_W] = "w", [WAPP_FA_MODE_A] = "a", @@ -27,7 +27,7 @@ File *wapp_file_open(Str8RO *filepath, FileAccessMode mode) { [WAPP_FA_MODE_WBX] = "wbx", [WAPP_FA_MODE_WBX_EX] = "wbx+", }; - persistent c8 tmp[WAPP_PATH_MAX] = {0}; + wapp_persist c8 tmp[WAPP_PATH_MAX] = {0}; wapp_debug_assert(filepath->size < WAPP_PATH_MAX, "`filepath` exceeds max path limit."); memset(tmp, 0, WAPP_PATH_MAX); diff --git a/src/core/mem/arena/mem_arena_allocator.c b/src/core/mem/arena/mem_arena_allocator.c index efa538b..06f08c6 100644 --- a/src/core/mem/arena/mem_arena_allocator.c +++ b/src/core/mem/arena/mem_arena_allocator.c @@ -5,10 +5,10 @@ #include "../../../common/aliases/aliases.h" #include "../../os/mem/mem_os.h" -internal inline void *mem_arena_alloc(u64 size, void *alloc_obj); -internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj); -internal inline void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj); -internal inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment, +wapp_intern inline void *mem_arena_alloc(u64 size, void *alloc_obj); +wapp_intern inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj); +wapp_intern inline void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj); +wapp_intern inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment, void *alloc_obj); @@ -37,22 +37,22 @@ void wapp_mem_arena_allocator_destroy(Allocator *allocator) { } -internal inline void *mem_arena_alloc(u64 size, void *alloc_obj) { +wapp_intern inline void *mem_arena_alloc(u64 size, void *alloc_obj) { Arena *arena = (Arena *)alloc_obj; return wapp_mem_arena_alloc(arena, size); } -internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj) { +wapp_intern inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj) { Arena *arena = (Arena *)alloc_obj; return wapp_mem_arena_alloc_aligned(arena, size, alignment); } -internal inline void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj) { +wapp_intern inline void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj) { Arena *arena = (Arena *)alloc_obj; return wapp_mem_arena_realloc(arena, ptr, old_size, new_size); } -internal inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment, +wapp_intern inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment, void *alloc_obj) { Arena *arena = (Arena *)alloc_obj; return wapp_mem_arena_realloc_aligned(arena, ptr, old_size, new_size, alignment); diff --git a/src/core/mem/utils/mem_utils.c b/src/core/mem/utils/mem_utils.c index 1ff94a4..6a44586 100644 --- a/src/core/mem/utils/mem_utils.c +++ b/src/core/mem/utils/mem_utils.c @@ -5,7 +5,7 @@ #include "../../../common/assert/assert.h" #include -internal b32 is_power_of_two(u64 num) { return (num & (num - 1)) == 0; } +wapp_intern b32 is_power_of_two(u64 num) { return (num & (num - 1)) == 0; } void *wapp_mem_util_align_forward(void *ptr, u64 alignment) { wapp_debug_assert(ptr != NULL, "`ptr` should not be NULL"); diff --git a/src/core/os/mem/mem_os.h b/src/core/os/mem/mem_os.h index 451485c..eb473c2 100644 --- a/src/core/os/mem/mem_os.h +++ b/src/core/os/mem/mem_os.h @@ -23,8 +23,8 @@ BEGIN_C_LINKAGE void *wapp_mem_util_alloc(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type); void wapp_mem_util_free(void *ptr, u64 size); -external void *mem_util_allocate(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type); -external void mem_util_free(void *ptr, u64 size); +wapp_extern void *mem_util_allocate(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type); +wapp_extern void mem_util_free(void *ptr, u64 size); #ifdef WAPP_PLATFORM_CPP END_C_LINKAGE diff --git a/src/core/os/mem/posix/mem_os_posix.c b/src/core/os/mem/posix/mem_os_posix.c index ad51372..f7d1db3 100644 --- a/src/core/os/mem/posix/mem_os_posix.c +++ b/src/core/os/mem/posix/mem_os_posix.c @@ -9,7 +9,7 @@ #include "../mem_os_ops.h" #include -internal const i32 access_types[] = { +wapp_intern const i32 access_types[] = { [WAPP_MEM_ACCESS_NONE] = PROT_NONE, [WAPP_MEM_ACCESS_READ_ONLY] = PROT_READ, [WAPP_MEM_ACCESS_EXEC_ONLY] = PROT_EXEC, diff --git a/src/core/os/mem/win/mem_os_win.c b/src/core/os/mem/win/mem_os_win.c index 78ce0c9..2f64a86 100644 --- a/src/core/os/mem/win/mem_os_win.c +++ b/src/core/os/mem/win/mem_os_win.c @@ -12,7 +12,7 @@ #include #include -internal const i32 access_types[] = { +wapp_intern const i32 access_types[] = { [WAPP_MEM_ACCESS_NONE] = PAGE_NOACCESS, [WAPP_MEM_ACCESS_READ_ONLY] = PAGE_READONLY, [WAPP_MEM_ACCESS_EXEC_ONLY] = PAGE_EXECUTE, diff --git a/src/core/os/shell/commander/commander.c b/src/core/os/shell/commander/commander.c index 52da856..84fb3ea 100644 --- a/src/core/os/shell/commander/commander.c +++ b/src/core/os/shell/commander/commander.c @@ -17,8 +17,8 @@ #define CMD_BUF_LEN 8192 #define OUT_BUF_LEN 4096 -internal inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf); -internal inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf); +wapp_intern inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf); +wapp_intern inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf); CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd) { if (!cmd) { @@ -43,7 +43,7 @@ CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_bu return output; } -internal inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf) { +wapp_intern inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf) { char cmd_buf[CMD_BUF_LEN] = {0}; wapp_str8_copy_to_cstr(cmd_buf, cmd, CMD_BUF_LEN); @@ -83,7 +83,7 @@ EXECUTE_COMMAND_CLOSE: return output; } -internal inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) { +wapp_intern inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) { Str8 out = wapp_str8_buf(OUT_BUF_LEN); out.size = fread((void *)out.buf, sizeof(u8), out.capacity, fp); diff --git a/src/core/os/shell/commander/commander.h b/src/core/os/shell/commander/commander.h index 7fca6ee..1e803a2 100644 --- a/src/core/os/shell/commander/commander.h +++ b/src/core/os/shell/commander/commander.h @@ -18,7 +18,7 @@ BEGIN_C_LINKAGE CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd); -external CMDError get_output_status(FILE *fp, i32 *status_out); +wapp_extern CMDError get_output_status(FILE *fp, i32 *status_out); #ifdef WAPP_PLATFORM_CPP END_C_LINKAGE diff --git a/src/core/os/shell/termcolour/posix/termcolour_posix.c b/src/core/os/shell/termcolour/posix/termcolour_posix.c index 349cfd3..474793d 100644 --- a/src/core/os/shell/termcolour/posix/termcolour_posix.c +++ b/src/core/os/shell/termcolour/posix/termcolour_posix.c @@ -9,7 +9,7 @@ #include "../terminal_colours.h" #include -internal Str8RO colours[COUNT_TERM_COLOUR] = { +wapp_intern Str8RO colours[COUNT_TERM_COLOUR] = { [WAPP_TERM_COLOUR_FG_BLACK] = wapp_str8_lit_ro_initialiser_list("\033[30m"), [WAPP_TERM_COLOUR_FG_RED] = wapp_str8_lit_ro_initialiser_list("\033[31m"), [WAPP_TERM_COLOUR_FG_GREEN] = wapp_str8_lit_ro_initialiser_list("\033[32m"), diff --git a/src/core/os/shell/termcolour/termcolour.h b/src/core/os/shell/termcolour/termcolour.h index e720092..1ae233d 100644 --- a/src/core/os/shell/termcolour/termcolour.h +++ b/src/core/os/shell/termcolour/termcolour.h @@ -15,7 +15,7 @@ BEGIN_C_LINKAGE void wapp_shell_termcolour_print_text(Str8RO *text, TerminalColour colour); void wapp_shell_termcolour_clear_colour(void); -external void print_coloured_text(Str8RO *text, TerminalColour colour); +wapp_extern void print_coloured_text(Str8RO *text, TerminalColour colour); #ifdef WAPP_PLATFORM_CPP END_C_LINKAGE diff --git a/src/core/os/shell/termcolour/win/termcolour_win.c b/src/core/os/shell/termcolour/win/termcolour_win.c index 7b2ee97..bc87949 100644 --- a/src/core/os/shell/termcolour/win/termcolour_win.c +++ b/src/core/os/shell/termcolour/win/termcolour_win.c @@ -22,9 +22,9 @@ struct termcolour_data { wapp_misc_utils_padding_size(sizeof(HANDLE) + sizeof(WORD) + sizeof(WORD)); }; -internal void init_data(TermcolourData *data); +wapp_intern void init_data(TermcolourData *data); -internal WORD colours[COUNT_TERM_COLOUR] = { +wapp_intern WORD colours[COUNT_TERM_COLOUR] = { [WAPP_TERM_COLOUR_FG_BLACK] = 0, [WAPP_TERM_COLOUR_FG_RED] = FOREGROUND_RED, [WAPP_TERM_COLOUR_FG_GREEN] = FOREGROUND_GREEN, @@ -44,7 +44,7 @@ internal WORD colours[COUNT_TERM_COLOUR] = { }; void print_coloured_text(Str8RO *text, TerminalColour colour) { - persistent TermcolourData data = {0}; + wapp_persist TermcolourData data = {0}; if (data.handle == 0) { init_data(&data); } @@ -59,7 +59,7 @@ void print_coloured_text(Str8RO *text, TerminalColour colour) { printf(WAPP_STR8_SPEC, wapp_str8_varg((*text))); } -internal void init_data(TermcolourData *data) { +wapp_intern void init_data(TermcolourData *data) { // create handle data->handle = GetStdHandle(STD_OUTPUT_HANDLE); diff --git a/src/primitives/array/array.h b/src/primitives/array/array.h index c0eb503..90dfa79 100644 --- a/src/primitives/array/array.h +++ b/src/primitives/array/array.h @@ -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 ? \ diff --git a/src/primitives/dbl_list/dbl_list.c b/src/primitives/dbl_list/dbl_list.c index 3cb9d5c..efe6791 100644 --- a/src/primitives/dbl_list/dbl_list.c +++ b/src/primitives/dbl_list/dbl_list.c @@ -8,26 +8,26 @@ #include "../../common/platform/platform.h" #include -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) { diff --git a/src/primitives/strings/str8/str8.h b/src/primitives/strings/str8/str8.h index 1d48e93..f8d04a2 100644 --- a/src/primitives/strings/str8/str8.h +++ b/src/primitives/strings/str8/str8.h @@ -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 diff --git a/src/prng/xorshift/xorshift.c b/src/prng/xorshift/xorshift.c index 1f2193c..a5a852e 100644 --- a/src/prng/xorshift/xorshift.c +++ b/src/prng/xorshift/xorshift.c @@ -12,13 +12,13 @@ struct split_mix_64_state { u64 seed; }; -internal u64 rol64(u64 x, u64 bits); -internal u64 split_mix_64(SplitMix64State *state); -internal void seed_os_generator(void); -internal u64 generate_random_number(void); +wapp_intern u64 rol64(u64 x, u64 bits); +wapp_intern u64 split_mix_64(SplitMix64State *state); +wapp_intern void seed_os_generator(void); +wapp_intern u64 generate_random_number(void); XOR256State wapp_prng_xorshift_init_state(void) { - persistent b32 seeded = false; + wapp_persist b32 seeded = false; if (!seeded) { seeded = true; seed_os_generator(); @@ -75,11 +75,11 @@ u64 wapp_prng_xorshift_256p(XOR256State *state) { return result; } -internal u64 rol64(u64 x, u64 bits) { +wapp_intern u64 rol64(u64 x, u64 bits) { return (x << bits) | (x >> (64 - bits)); } -internal u64 split_mix_64(SplitMix64State *state) { +wapp_intern u64 split_mix_64(SplitMix64State *state) { state->seed += 0x9E3779B97f4A7C15; u64 result = state->seed; @@ -91,7 +91,7 @@ internal u64 split_mix_64(SplitMix64State *state) { #if defined(WAPP_PLATFORM_C) && WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C11_VERSION #ifdef WAPP_PLATFORM_POSIX -internal void seed_os_generator(void) { +wapp_intern void seed_os_generator(void) { struct timespec ts = {0}; int result = clock_gettime(CLOCK_MONOTONIC_RAW, &ts); wapp_runtime_assert(result == 0, "Invalid seed value"); @@ -99,11 +99,11 @@ internal void seed_os_generator(void) { srand48(ts.tv_nsec); } -internal u64 generate_random_number(void) { +wapp_intern u64 generate_random_number(void) { return lrand48(); } #else -internal void seed_os_generator(void) { +wapp_intern void seed_os_generator(void) { struct timespec ts = {0}; int result = timespec_get(&ts, TIME_UTC); wapp_runtime_assert(result != 0, "Invalid seed value"); @@ -111,7 +111,7 @@ internal void seed_os_generator(void) { srand(ts.tv_nsec); } -internal u64 generate_random_number(void) { +wapp_intern u64 generate_random_number(void) { i32 n1 = rand(); i32 n2 = rand(); @@ -119,14 +119,14 @@ internal u64 generate_random_number(void) { } #endif // !WAPP_PLATFORM_POSIX #else -internal void seed_os_generator(void) { +wapp_intern void seed_os_generator(void) { time_t result = time(NULL); wapp_runtime_assert(result != (time_t)(-1), "Invalid seed value"); srand(result); } -internal u64 generate_random_number(void) { +wapp_intern u64 generate_random_number(void) { i32 n1 = rand(); i32 n2 = rand(); diff --git a/src/testing/tester/tester.c b/src/testing/tester/tester.c index 48b38f7..e82ba76 100644 --- a/src/testing/tester/tester.c +++ b/src/testing/tester/tester.c @@ -8,7 +8,7 @@ #include #include -internal void handle_test_result(TestFuncResult result); +wapp_intern void handle_test_result(TestFuncResult result); void run_tests(TestFunc *func1, ...) { printf("\n"); @@ -32,7 +32,7 @@ void run_tests(TestFunc *func1, ...) { printf("\n"); } -internal void handle_test_result(TestFuncResult result) { +wapp_intern void handle_test_result(TestFuncResult result) { TerminalColour colour; Str8 result_text = wapp_str8_buf(64); diff --git a/src/uuid/uuid.c b/src/uuid/uuid.c index c20bd6a..ebea1a8 100644 --- a/src/uuid/uuid.c +++ b/src/uuid/uuid.c @@ -15,8 +15,8 @@ struct uuid4 { u64 low; }; -internal UUID4 generate_uuid4(void); -internal void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid); +wapp_intern UUID4 generate_uuid4(void); +wapp_intern void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid); UUID *wapp_uuid_init_uuid4(UUID *uuid) { wapp_debug_assert(uuid != NULL, "`uuid` should not be NULL"); @@ -27,9 +27,9 @@ UUID *wapp_uuid_init_uuid4(UUID *uuid) { return uuid; } -internal UUID4 generate_uuid4(void) { - persistent XOR256State state = {0}; - persistent b32 initialised = false; +wapp_intern UUID4 generate_uuid4(void) { + wapp_persist XOR256State state = {0}; + wapp_persist b32 initialised = false; if (!initialised) { initialised = true; @@ -47,7 +47,7 @@ internal UUID4 generate_uuid4(void) { return uuid; } -internal void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid) { +wapp_intern void uuid4_to_uuid(const UUID4* uuid4, UUID *uuid) { u64 grp1 = uuid4->high >> 32; u64 grp2 = (uuid4->high << 32) >> 48; u64 grp3 = (uuid4->high << 48) >> 48; diff --git a/tests/arena/test_arena.c b/tests/arena/test_arena.c index 55b792e..1618ba3 100644 --- a/tests/arena/test_arena.c +++ b/tests/arena/test_arena.c @@ -4,9 +4,9 @@ #define ARENA_CAPACITY KB(16) -internal Arena *arena = NULL; -internal i32 count = 20; -internal i32 *array = NULL; +wapp_intern Arena *arena = NULL; +wapp_intern i32 count = 20; +wapp_intern i32 *array = NULL; TestFuncResult test_arena_init(void) { b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY); diff --git a/tests/arena/test_arena.cc b/tests/arena/test_arena.cc index b0da436..5937726 100644 --- a/tests/arena/test_arena.cc +++ b/tests/arena/test_arena.cc @@ -4,9 +4,9 @@ #define ARENA_CAPACITY KB(16) -internal Arena *arena = nullptr; -internal i32 count = 20; -internal i32 *array = nullptr; +wapp_intern Arena *arena = nullptr; +wapp_intern i32 count = 20; +wapp_intern i32 *array = nullptr; TestFuncResult test_arena_init(void) { b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);