diff --git a/src/base/array/array.h b/src/base/array/array.h index f996a23..0bfc5f4 100644 --- a/src/base/array/array.h +++ b/src/base/array/array.h @@ -8,9 +8,9 @@ #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define WAPP_ARRAY_MAGIC (u64)0x57415f415252 @@ -46,7 +46,7 @@ typedef enum { ARRAY_INIT_FILLED = 1 << 1, } ArrayInitFlags; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_array(TYPE, ...) ([&]() { \ u64 capacity = _calc_array_capacity(TYPE, __VA_ARGS__); \ \ @@ -119,7 +119,7 @@ typedef enum { (TYPE){0} : \ *((TYPE *)_array_pop((GenericArray)ARRAY, sizeof(TYPE))) \ ) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_array_count(ARRAY) \ (_array_count((GenericArray)ARRAY)) @@ -209,8 +209,8 @@ GenericArray _array_alloc_capacity(const Allocator *allocator, u64 capacity, Arr GenericArray _array_from_preallocated_buffer(void *buffer, u64 buffer_size, ArrayInitFlags flags, u64 item_size); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !ARRAY_H diff --git a/src/base/dbl_list/dbl_list.h b/src/base/dbl_list/dbl_list.h index eb9c68f..e220ce1 100644 --- a/src/base/dbl_list/dbl_list.h +++ b/src/base/dbl_list/dbl_list.h @@ -7,9 +7,9 @@ #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define WAPP_DBL_LIST_MAGIC (u64)0x57415f444c5354 #define WAPP_DBL_NODE_MAGIC (u64)0x57415f444e44 @@ -78,7 +78,7 @@ typedef GenericNode UptrNode; typedef GenericNode IptrNode; typedef GenericNode Str8Node; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_dbl_list(TYPE) \ GenericList{WAPP_DBL_LIST_MAGIC, 0, sizeof(TYPE), nullptr, nullptr} #define _dbl_list_node(TYPE, ITEM_PTR) ([&]() { \ @@ -97,7 +97,7 @@ typedef GenericNode Str8Node; &((GenericNode){.header = {.magic = WAPP_DBL_NODE_MAGIC, .item_size = sizeof(TYPE)}, \ .item = ITEM_PTR}) \ ) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_dbl_list_alloc(TYPE, ALLOCATOR) \ (_dbl_list_alloc(ALLOCATOR, sizeof(TYPE))) @@ -177,8 +177,8 @@ GenericNode *_dbl_list_pop_back(GenericList *list, u64 item_size); GenericNode *_dbl_list_remove(GenericList *list, u64 index, u64 item_size); void _dbl_list_empty(GenericList *list, u64 item_size); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !DBL_LIST_H diff --git a/src/base/mem/allocator/mem_allocator.h b/src/base/mem/allocator/mem_allocator.h index add3ca4..da624f9 100644 --- a/src/base/mem/allocator/mem_allocator.h +++ b/src/base/mem/allocator/mem_allocator.h @@ -7,9 +7,9 @@ #include "../../../common/platform/platform.h" #include -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef void *(MemAllocFunc)(u64 size, void *alloc_obj); typedef void *(MemAllocAlignedFunc)(u64 size, u64 alignment, void *alloc_obj); @@ -27,14 +27,14 @@ struct Allocator { MemFreeFunc *free; }; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_mem_allocator_invalid(ALLOCATOR) ([&]() { \ Allocator alloc{}; \ return memcmp(ALLOCATOR, &alloc, sizeof(Allocator)) == 0; \ }()) #else #define wapp_mem_allocator_invalid(ALLOCATOR) (memcmp(ALLOCATOR, &((Allocator){0}), sizeof(Allocator)) == 0) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size); void *wapp_mem_allocator_alloc_aligned(const Allocator *allocator, u64 size, u64 alignment); @@ -43,8 +43,8 @@ void *wapp_mem_allocator_realloc_aligned(const Allocator *allocator, void *ptr, u64 new_size, u64 alignment); void wapp_mem_allocator_free(const Allocator *allocator, void **ptr, u64 size); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_ALLOCATOR_H diff --git a/src/base/mem/utils/mem_utils.h b/src/base/mem/utils/mem_utils.h index ca7f781..6d4d58c 100644 --- a/src/base/mem/utils/mem_utils.h +++ b/src/base/mem/utils/mem_utils.h @@ -6,14 +6,14 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP void *wapp_mem_util_align_forward(void *ptr, u64 alignment); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_UTILS_H diff --git a/src/base/queue/queue.h b/src/base/queue/queue.h index 6e84ef2..7d71fc5 100644 --- a/src/base/queue/queue.h +++ b/src/base/queue/queue.h @@ -8,9 +8,9 @@ #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef struct { GenericArray items; @@ -40,7 +40,7 @@ typedef GenericQueue UptrQueue; typedef GenericQueue IptrQueue; typedef GenericQueue Str8Queue; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_queue(TYPE, CAPACITY) ([&]() { \ wapp_persist GenericArray arr = wapp_array_with_capacity(TYPE, CAPACITY, ARRAY_INIT_FILLED); \ wapp_persist GenericQueue queue = { \ @@ -75,7 +75,7 @@ typedef GenericQueue Str8Queue; .back = 0, \ .count = 0, \ }) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_queue_capacity(QUEUE_PTR) (wapp_array_capacity((QUEUE_PTR)->items)) #define wapp_queue_item_size(QUEUE_PTR) (wapp_array_item_size((QUEUE_PTR)->items)) @@ -93,8 +93,8 @@ void _queue_push(GenericQueue *queue, void *item, u64 item_size); GenericQueue *_queue_push_alloc(const Allocator *allocator, GenericQueue *queue, void *item, u64 item_size); void *_queue_pop(GenericQueue *queue, u64 item_size); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !QUEUE_H diff --git a/src/base/strings/str8/str8.h b/src/base/strings/str8/str8.h index 1ae83e6..3b23fc9 100644 --- a/src/base/strings/str8/str8.h +++ b/src/base/strings/str8/str8.h @@ -11,9 +11,9 @@ #include "../../mem/allocator/mem_allocator.h" #include -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef struct Str8 Str8; struct Str8 { @@ -34,7 +34,7 @@ typedef const Str8 Str8RO; * Str8 stack buffers */ -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP // Uses a lambda to achieve the same behaviour achieved by the C macro #define wapp_str8_buf(CAPACITY) ([&](){ \ wapp_persist c8 buf[CAPACITY] = {}; \ @@ -70,7 +70,7 @@ typedef const Str8 Str8RO; #define wapp_str8_lit_ro_initialiser_list(STRING) {.capacity = sizeof(STRING) - 1, \ .size = sizeof(STRING) - 1, \ .buf = (c8 *)STRING} -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP /** * Str8 allocated buffers @@ -123,8 +123,8 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8R */ u64 wapp_str8_list_total_size(const Str8List *list); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !STR8_H diff --git a/src/common/aliases/aliases.h b/src/common/aliases/aliases.h index b51b135..825ff3a 100644 --- a/src/common/aliases/aliases.h +++ b/src/common/aliases/aliases.h @@ -6,14 +6,14 @@ #include "../platform/platform.h" #include -#if defined(WAPP_PLATFORM_C) && WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C11_VERSION && !defined(WAPP_PLATFORM_APPLE) +#if defined(WP_PLATFORM_C) && WP_PLATFORM_C_VERSION >= WP_PLATFORM_C11_VERSION && !defined(WP_PLATFORM_APPLE) #include - #if WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C23_VERSION + #if WP_PLATFORM_C_VERSION >= WP_PLATFORM_C23_VERSION typedef char8_t c8; #else typedef uint8_t c8; - #endif // !WAPP_PLATFORM_C23_VERSION + #endif // !WP_PLATFORM_C23_VERSION typedef char16_t c16; typedef char32_t c32; @@ -21,7 +21,7 @@ typedef uint8_t c8; typedef uint16_t c16; typedef uint32_t c32; -#endif // !WAPP_PLATFORM_C +#endif // !WP_PLATFORM_C typedef uint8_t u8; typedef uint16_t u16; @@ -30,7 +30,7 @@ typedef uint64_t u64; typedef uint8_t b8; -#ifndef WAPP_PLATFORM_CPP +#ifndef WP_PLATFORM_CPP #ifndef false #define false (b8)0 @@ -40,7 +40,7 @@ typedef uint8_t b8; #define true (b8)1 #endif // !true -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef int8_t i8; typedef int16_t i16; @@ -58,10 +58,10 @@ typedef intptr_t iptr; #define wapp_intern static #define wapp_persist static -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_class_mem static #define BEGIN_C_LINKAGE wapp_extern "C" { #define END_C_LINKAGE } -#endif // WAPP_PLATFORM_CPP +#endif // WP_PLATFORM_CPP #endif // !ALIASES_H diff --git a/src/common/assert/assert.h b/src/common/assert/assert.h index e7ffb3c..6ec9109 100644 --- a/src/common/assert/assert.h +++ b/src/common/assert/assert.h @@ -9,9 +9,9 @@ #include #include -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_static_assert(EXPR, MSG) wapp_extern char ASSERTION_FAILED[EXPR ? 1 : -1] @@ -27,7 +27,7 @@ BEGIN_C_LINKAGE #define wapp_debug_assert(EXPR, MSG) #endif -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #define __wapp_runtime_assert(EXPR, MSG) do { \ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ @@ -42,7 +42,7 @@ BEGIN_C_LINKAGE __runtime_assert_failed(EXPR, MSG); \ } \ } while(false) -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS #define __runtime_assert_failed(EXPR, MSG) do { \ fprintf( \ @@ -54,8 +54,8 @@ BEGIN_C_LINKAGE abort(); \ } while(false) -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !WAPP_ASSERT_H diff --git a/src/common/misc/misc_utils.h b/src/common/misc/misc_utils.h index 6608fe8..170e534 100644 --- a/src/common/misc/misc_utils.h +++ b/src/common/misc/misc_utils.h @@ -5,9 +5,9 @@ #include "../aliases/aliases.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define KiB(SIZE) (((u64)SIZE) << 10) #define MiB(SIZE) (((u64)SIZE) << 20) @@ -50,7 +50,7 @@ BEGIN_C_LINKAGE #define wapp_is_power_of_two(NUM) ((NUM & (NUM - 1)) == 0) #define wapp_pointer_offset(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET))) -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE #include @@ -58,6 +58,6 @@ END_C_LINKAGE #define wapp_misc_utils_va_args_count(T, ...) (std::tuple_size::value) #else #define wapp_misc_utils_va_args_count(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T)) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MISC_UTILS_H diff --git a/src/common/platform/platform.h b/src/common/platform/platform.h index 907b696..a73fd8f 100644 --- a/src/common/platform/platform.h +++ b/src/common/platform/platform.h @@ -4,110 +4,110 @@ #define PLATFORM_H #if defined(__ANDROID__) - #define WAPP_PLATFORM_ANDROID - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_ANDROID + #define WP_PLATFORM_POSIX #elif defined(__FreeBSD__) - #define WAPP_PLATFORM_FREE_BSD - #define WAPP_PLATFORM_BSD - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_FREE_BSD + #define WP_PLATFORM_BSD + #define WP_PLATFORM_POSIX #elif defined(__NetBSD__) - #define WAPP_PLATFORM_NET_BSD - #define WAPP_PLATFORM_BSD - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_NET_BSD + #define WP_PLATFORM_BSD + #define WP_PLATFORM_POSIX #elif defined(__OpenBSD__) - #define WAPP_PLATFORM_OPEN_BSD - #define WAPP_PLATFORM_BSD - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_OPEN_BSD + #define WP_PLATFORM_BSD + #define WP_PLATFORM_POSIX #elif defined(__DragonFly__) - #define WAPP_PLATFORM_DRAGON_FLY - #define WAPP_PLATFORM_BSD - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_DRAGON_FLY + #define WP_PLATFORM_BSD + #define WP_PLATFORM_POSIX #elif defined(__bsdi__) - #define WAPP_PLATFORM_BSD - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_BSD + #define WP_PLATFORM_POSIX #elif defined(__linux__) || defined(linux) || defined(__linux) || defined(__gnu_linux__) - #define WAPP_PLATFORM_LINUX - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_LINUX + #define WP_PLATFORM_POSIX #elif defined(__GNU__) || defined(__gnu_hurd__) - #define WAPP_PLATFORM_GNU - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_GNU + #define WP_PLATFORM_POSIX #elif defined(__APPLE__) || defined(__MACH__) #include #if TARGET_OS_IPHONE - #define WAPP_PLATFORM_IOS - #define WAPP_PLATFORM_APPLE - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_IOS + #define WP_PLATFORM_APPLE + #define WP_PLATFORM_POSIX #elif TARGET_OS_MAC - #define WAPP_PLATFORM_MACOS - #define WAPP_PLATFORM_APPLE - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_MACOS + #define WP_PLATFORM_APPLE + #define WP_PLATFORM_POSIX #else #error "Unrecognised Apple platform" #endif #elif defined(_WIN64) - #define WAPP_PLATFORM_WINDOWS64 - #define WAPP_PLATFORM_WINDOWS + #define WP_PLATFORM_WINDOWS64 + #define WP_PLATFORM_WINDOWS #elif defined(_WIN32) - #define WAPP_PLATFORM_WINDOWS32 - #define WAPP_PLATFORM_WINDOWS + #define WP_PLATFORM_WINDOWS32 + #define WP_PLATFORM_WINDOWS #elif defined(__CYGWIN__) - #define WAPP_PLATFORM_CYGWIN - #define WAPP_PLATFORM_WINDOWS + #define WP_PLATFORM_CYGWIN + #define WP_PLATFORM_WINDOWS #elif defined(__unix__) || defined(__unix) - #define WAPP_PLATFORM_UNIX - #define WAPP_PLATFORM_POSIX + #define WP_PLATFORM_UNIX + #define WP_PLATFORM_POSIX #else #error "Unrecognised platform" #endif #ifdef __cplusplus - #define WAPP_PLATFORM_CPP - #define WAPP_PLATFORM_CPP_VERSION __cplusplus - #define WAPP_PLATFORM_CPP98_VERSION 199711L - #define WAPP_PLATFORM_CPP11_VERSION 201103L - #define WAPP_PLATFORM_CPP14_VERSION 201402L - #define WAPP_PLATFORM_CPP17_VERSION 201703L - #define WAPP_PLATFORM_CPP20_VERSION 202002L - #define WAPP_PLATFORM_CPP23_VERSION 202302L + #define WP_PLATFORM_CPP + #define WP_PLATFORM_CPP_VERSION __cplusplus + #define WP_PLATFORM_CPP98_VERSION 199711L + #define WP_PLATFORM_CPP11_VERSION 201103L + #define WP_PLATFORM_CPP14_VERSION 201402L + #define WP_PLATFORM_CPP17_VERSION 201703L + #define WP_PLATFORM_CPP20_VERSION 202002L + #define WP_PLATFORM_CPP23_VERSION 202302L - #if WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP98_VERSION - #define WAPP_PLATFORM_CPP98 - #elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP11_VERSION - #define WAPP_PLATFORM_CPP11 - #elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP14_VERSION - #define WAPP_PLATFORM_CPP14 - #elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP17_VERSION - #define WAPP_PLATFORM_CPP17 - #elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP20_VERSION - #define WAPP_PLATFORM_CPP20 - #elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP23_VERSION - #define WAPP_PLATFORM_CPP23 + #if WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP98_VERSION + #define WP_PLATFORM_CPP98 + #elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP11_VERSION + #define WP_PLATFORM_CPP11 + #elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP14_VERSION + #define WP_PLATFORM_CPP14 + #elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP17_VERSION + #define WP_PLATFORM_CPP17 + #elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP20_VERSION + #define WP_PLATFORM_CPP20 + #elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP23_VERSION + #define WP_PLATFORM_CPP23 #else #error "Unrecognised C++ version" #endif #else - #define WAPP_PLATFORM_C + #define WP_PLATFORM_C #if defined(__STDC_VERSION__) - #define WAPP_PLATFORM_C_VERSION __STDC_VERSION__ - #define WAPP_PLATFORM_C99_VERSION 199901L - #define WAPP_PLATFORM_C11_VERSION 201112L - #define WAPP_PLATFORM_C17_VERSION 201710L - #define WAPP_PLATFORM_C23_VERSION 202311L + #define WP_PLATFORM_C_VERSION __STDC_VERSION__ + #define WP_PLATFORM_C99_VERSION 199901L + #define WP_PLATFORM_C11_VERSION 201112L + #define WP_PLATFORM_C17_VERSION 201710L + #define WP_PLATFORM_C23_VERSION 202311L - #if WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C99_VERSION - #define WAPP_PLATFORM_C99 - #elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C11_VERSION - #define WAPP_PLATFORM_C11 - #elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C17_VERSION - #define WAPP_PLATFORM_C17 - #elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C23_VERSION - #define WAPP_PLATFORM_C23 + #if WP_PLATFORM_C_VERSION == WP_PLATFORM_C99_VERSION + #define WP_PLATFORM_C99 + #elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C11_VERSION + #define WP_PLATFORM_C11 + #elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C17_VERSION + #define WP_PLATFORM_C17 + #elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C23_VERSION + #define WP_PLATFORM_C23 #else #error "Unrecognised C version" #endif #else - #define WAPP_PLATFORM_C89 + #define WP_PLATFORM_C89 #endif #endif // !__cplusplus diff --git a/src/os/allocators/arena/mem_arena.c b/src/os/allocators/arena/mem_arena.c index 314dcb0..5f3a0b7 100644 --- a/src/os/allocators/arena/mem_arena.c +++ b/src/os/allocators/arena/mem_arena.c @@ -65,12 +65,12 @@ b8 wapp_mem_arena_init_allocated_custom(Arena **arena, u64 base_capacity, MemAll b8 committed = (flags & WAPP_MEM_ALLOC_COMMIT) == WAPP_MEM_ALLOC_COMMIT; -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS if (!committed) { wapp_os_mem_alloc(allocated, sizeof(Arena), WAPP_MEM_ACCESS_READ_WRITE, WAPP_MEM_ALLOC_COMMIT, WAPP_MEM_INIT_INITIALISED); } -#endif // ifdef WAPP_PLATFORM_WINDOWS +#endif // ifdef WP_PLATFORM_WINDOWS if (!wapp_mem_arena_init_buffer(arena, allocated, alloc_size)) { wapp_mem_arena_destroy(arena); @@ -100,13 +100,13 @@ void *wapp_mem_arena_alloc_aligned(Arena *arena, u64 size, u64 alignment) { arena->offset = output + size; -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS if (arena->type == ARENA_STORAGE_TYPE_ALLOCATED && !(arena->committed)) { wapp_os_mem_alloc(alloc_start, (uptr)(arena->offset) - (uptr)(alloc_start), WAPP_MEM_ACCESS_READ_WRITE, WAPP_MEM_ALLOC_COMMIT, WAPP_MEM_INIT_UNINITIALISED); } -#endif // ifdef WAPP_PLATFORM_WINDOWS +#endif // ifdef WP_PLATFORM_WINDOWS memset(output, 0, size); diff --git a/src/os/allocators/arena/mem_arena.h b/src/os/allocators/arena/mem_arena.h index 3859f39..ae473df 100644 --- a/src/os/allocators/arena/mem_arena.h +++ b/src/os/allocators/arena/mem_arena.h @@ -7,9 +7,9 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef struct Arena Arena; @@ -38,8 +38,8 @@ void wapp_mem_arena_temp_end(Arena *arena); void wapp_mem_arena_clear(Arena *arena); void wapp_mem_arena_destroy(Arena **arena); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_ARENA_H diff --git a/src/os/allocators/arena/mem_arena_allocator.h b/src/os/allocators/arena/mem_arena_allocator.h index bd88379..bab85e4 100644 --- a/src/os/allocators/arena/mem_arena_allocator.h +++ b/src/os/allocators/arena/mem_arena_allocator.h @@ -8,9 +8,9 @@ #include "../../../common/platform/platform.h" #include "../../../base/mem/allocator/mem_allocator.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_mem_arena_allocator_init(base_capacity) \ (wapp_mem_arena_allocator_init_custom(base_capacity, WAPP_MEM_ALLOC_RESERVE, false)) @@ -39,8 +39,8 @@ void wapp_mem_arena_allocator_temp_end(const Allocator *allocator); void wapp_mem_arena_allocator_clear(Allocator *allocator); void wapp_mem_arena_allocator_destroy(Allocator *allocator); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_ARENA_ALLOCATOR_H diff --git a/src/os/cpath/cpath.h b/src/os/cpath/cpath.h index d481822..1702fc6 100644 --- a/src/os/cpath/cpath.h +++ b/src/os/cpath/cpath.h @@ -8,15 +8,15 @@ #include "../../base/mem/allocator/mem_allocator.h" #include "../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include #define WAPP_PATH_SEP '/' #define WAPP_PATH_MAX PATH_MAX -#elif defined(WAPP_PLATFORM_WINDOWS) +#elif defined(WP_PLATFORM_WINDOWS) #define WIN32_LEAN_AND_MEAN #include #define WAPP_PATH_SEP '\\' @@ -38,8 +38,8 @@ enum { u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts); Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !CPATH_H diff --git a/src/os/file/file.h b/src/os/file/file.h index 888ab99..875ac5a 100644 --- a/src/os/file/file.h +++ b/src/os/file/file.h @@ -7,9 +7,9 @@ #include "../../common/aliases/aliases.h" #include "../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef struct WFile WFile; @@ -70,8 +70,8 @@ wapp_extern i32 _file_close(WFile *file); wapp_extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath); wapp_extern i32 _file_remove(Str8RO *filepath); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !FILE_H diff --git a/src/os/file/posix/file_posix.c b/src/os/file/posix/file_posix.c index 345c144..ce71f3f 100644 --- a/src/os/file/posix/file_posix.c +++ b/src/os/file/posix/file_posix.c @@ -3,7 +3,7 @@ #include "file_posix.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include "../file.h" #include "../../cpath/cpath.h" @@ -11,10 +11,10 @@ #include "../../../base/array/array.h" #include "../../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_APPLE +#ifdef WP_PLATFORM_APPLE #define _FILE_OFFSET_BITS 64 #define lseek64 lseek -#endif // !WAPP_PLATFORM_APPLE +#endif // !WP_PLATFORM_APPLE #define __USE_LARGEFILE64 #include @@ -131,4 +131,4 @@ i32 _file_remove(Str8RO *filepath) { return unlink((const char *)tmp); } -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX diff --git a/src/os/file/posix/file_posix.h b/src/os/file/posix/file_posix.h index 46a38ed..dbd7eb8 100644 --- a/src/os/file/posix/file_posix.h +++ b/src/os/file/posix/file_posix.h @@ -6,11 +6,11 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #define END_OF_LINE "\n" @@ -18,10 +18,10 @@ struct WFile { i32 fd; }; -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !FILE_POSIX_H diff --git a/src/os/file/win/file_win.c b/src/os/file/win/file_win.c index 8f40778..293e8d5 100644 --- a/src/os/file/win/file_win.c +++ b/src/os/file/win/file_win.c @@ -3,7 +3,7 @@ #include "file_win.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #include "../file.h" #include "../../cpath/cpath.h" @@ -174,4 +174,4 @@ i32 _file_remove(Str8RO *filepath) { return 0; } -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS diff --git a/src/os/file/win/file_win.h b/src/os/file/win/file_win.h index 69d579a..569d06a 100644 --- a/src/os/file/win/file_win.h +++ b/src/os/file/win/file_win.h @@ -6,11 +6,11 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #define END_OF_LINE "\r\n" @@ -22,10 +22,10 @@ struct WFile { HANDLE fh; }; -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !FILE_WIN_H diff --git a/src/os/mem/mem_os.c b/src/os/mem/mem_os.c index f8ddab5..30fb872 100644 --- a/src/os/mem/mem_os.c +++ b/src/os/mem/mem_os.c @@ -7,9 +7,9 @@ #include #include -#if defined(WAPP_PLATFORM_WINDOWS) +#if defined(WP_PLATFORM_WINDOWS) #include "win/mem_os_win.h" -#elif defined(WAPP_PLATFORM_POSIX) +#elif defined(WP_PLATFORM_POSIX) #include "posix/mem_os_posix.h" #else #error "Unrecognised platform" diff --git a/src/os/mem/mem_os.h b/src/os/mem/mem_os.h index 5681ef7..937f96a 100644 --- a/src/os/mem/mem_os.h +++ b/src/os/mem/mem_os.h @@ -8,13 +8,13 @@ #include "mem_os_ops.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#if defined(WAPP_PLATFORM_WINDOWS) +#if defined(WP_PLATFORM_WINDOWS) #include "win/mem_os_win.h" -#elif defined(WAPP_PLATFORM_POSIX) +#elif defined(WP_PLATFORM_POSIX) #include "posix/mem_os_posix.h" #else #error "Unrecognised platform" @@ -26,8 +26,8 @@ void wapp_os_mem_free(void *ptr, u64 size); wapp_extern void *os_mem_allocate(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type); wapp_extern void os_mem_free(void *ptr, u64 size); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_OS_H diff --git a/src/os/mem/mem_os_ops.h b/src/os/mem/mem_os_ops.h index 357a1af..2c3c16f 100644 --- a/src/os/mem/mem_os_ops.h +++ b/src/os/mem/mem_os_ops.h @@ -5,9 +5,9 @@ #include "../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef enum mem_access { WAPP_MEM_ACCESS_NONE, @@ -23,8 +23,8 @@ typedef enum mem_init_type { WAPP_MEM_INIT_INITIALISED, } MemInitType; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_OS_OPS_H diff --git a/src/os/mem/posix/mem_os_posix.c b/src/os/mem/posix/mem_os_posix.c index 8143af2..f08db86 100644 --- a/src/os/mem/posix/mem_os_posix.c +++ b/src/os/mem/posix/mem_os_posix.c @@ -3,7 +3,7 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include "mem_os_posix.h" #include "../mem_os_ops.h" @@ -22,7 +22,7 @@ void *os_mem_allocate(void *addr, u64 size, MemAccess access, MemAllocFlags flag (void)type; i32 alloc_flags = flags | MAP_ANON | MAP_PRIVATE; -#if defined(WAPP_PLATFORM_LINUX) || defined(WAPP_PLATFORM_GNU) || defined(WAPP_PLATFORM_NET_BSD) +#if defined(WP_PLATFORM_LINUX) || defined(WP_PLATFORM_GNU) || defined(WP_PLATFORM_NET_BSD) alloc_flags |= MAP_NORESERVE; #endif @@ -33,4 +33,4 @@ void os_mem_free(void *ptr, u64 size) { munmap(ptr, size); } -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX diff --git a/src/os/mem/posix/mem_os_posix.h b/src/os/mem/posix/mem_os_posix.h index 967cc78..c797b93 100644 --- a/src/os/mem/posix/mem_os_posix.h +++ b/src/os/mem/posix/mem_os_posix.h @@ -5,31 +5,31 @@ #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include typedef enum mem_alloc_flags { -#if defined(WAPP_PLATFORM_LINUX) || defined(WAPP_PLATFORM_GNU) +#if defined(WP_PLATFORM_LINUX) || defined(WP_PLATFORM_GNU) WAPP_MEM_ALLOC_RESERVE = 0, WAPP_MEM_ALLOC_COMMIT = MAP_POPULATE, -#elif defined(WAPP_PLATFORM_FREE_BSD) +#elif defined(WP_PLATFORM_FREE_BSD) WAPP_MEM_ALLOC_RESERVE = 0, WAPP_MEM_ALLOC_COMMIT = MAP_PREFAULT_READ, -#elif defined(WAPP_PLATFORM_BSD) || defined(WAPP_PLATFORM_UNIX) || defined(WAPP_PLATFORM_APPLE) +#elif defined(WP_PLATFORM_BSD) || defined(WP_PLATFORM_UNIX) || defined(WP_PLATFORM_APPLE) WAPP_MEM_ALLOC_RESERVE = 0, WAPP_MEM_ALLOC_COMMIT = 0, #endif } MemAllocFlags; -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_OS_POSIX_H diff --git a/src/os/mem/win/mem_os_win.c b/src/os/mem/win/mem_os_win.c index abfbe3b..55dc742 100644 --- a/src/os/mem/win/mem_os_win.c +++ b/src/os/mem/win/mem_os_win.c @@ -3,7 +3,7 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #include "mem_os_win.h" #include "../mem_os_ops.h" @@ -34,4 +34,4 @@ void os_mem_free(void *ptr, u64 size) { VirtualFree(ptr, size, MEM_RELEASE); } -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS diff --git a/src/os/mem/win/mem_os_win.h b/src/os/mem/win/mem_os_win.h index e0a63eb..911eae3 100644 --- a/src/os/mem/win/mem_os_win.h +++ b/src/os/mem/win/mem_os_win.h @@ -5,11 +5,11 @@ #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #define WIN32_LEAN_AND_MEAN #include @@ -20,10 +20,10 @@ typedef enum mem_alloc_flags { WAPP_MEM_ALLOC_COMMIT = MEM_COMMIT, } MemAllocFlags; -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !MEM_OS_WIN_H diff --git a/src/os/shell/commander/commander.h b/src/os/shell/commander/commander.h index b4c6f6f..2afa0b1 100644 --- a/src/os/shell/commander/commander.h +++ b/src/os/shell/commander/commander.h @@ -12,9 +12,9 @@ // TODO (Abdelrahman): This module needs rethinking -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define CMD_NO_EXIT(ERR) ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE, .error = ERR}) @@ -22,8 +22,8 @@ CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_bu wapp_extern CMDError get_output_status(FILE *fp, i32 *status_out); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !COMMANDER_H diff --git a/src/os/shell/commander/commander_output.h b/src/os/shell/commander/commander_output.h index fe45993..089101d 100644 --- a/src/os/shell/commander/commander_output.h +++ b/src/os/shell/commander/commander_output.h @@ -7,9 +7,9 @@ #include "../../../common/platform/platform.h" #include "../../../common/misc/misc_utils.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef enum { SHELL_OUTPUT_DISCARD, @@ -35,8 +35,8 @@ struct CMDResult { wapp_misc_utils_reserve_padding(sizeof(b8) + sizeof(i32) + sizeof(CMDError)); }; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !COMMANDER_OUTPUT_H diff --git a/src/os/shell/commander/posix/commander_posix.c b/src/os/shell/commander/posix/commander_posix.c index a25afb0..7409f94 100644 --- a/src/os/shell/commander/posix/commander_posix.c +++ b/src/os/shell/commander/posix/commander_posix.c @@ -3,7 +3,7 @@ #include "../../../../common/aliases/aliases.h" #include "../../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include "../commander_output.h" #include "../../utils/shell_utils.h" @@ -22,4 +22,4 @@ CMDError get_output_status(FILE *fp, i32 *status_out) { return SHELL_ERR_NO_ERROR; } -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX diff --git a/src/os/shell/commander/win/commander_win.c b/src/os/shell/commander/win/commander_win.c index 8be5df8..7375ed8 100644 --- a/src/os/shell/commander/win/commander_win.c +++ b/src/os/shell/commander/win/commander_win.c @@ -3,7 +3,7 @@ #include "../../../../common/aliases/aliases.h" #include "../../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #include "../commander_output.h" #include "../../utils/shell_utils.h" @@ -21,4 +21,4 @@ CMDError get_output_status(FILE *fp, i32 *status_out) { return SHELL_ERR_NO_ERROR; } -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS diff --git a/src/os/shell/termcolour/posix/termcolour_posix.c b/src/os/shell/termcolour/posix/termcolour_posix.c index 48f7964..7a1b837 100644 --- a/src/os/shell/termcolour/posix/termcolour_posix.c +++ b/src/os/shell/termcolour/posix/termcolour_posix.c @@ -4,7 +4,7 @@ #include "../../../../common/platform/platform.h" #include "../../../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_POSIX +#ifdef WP_PLATFORM_POSIX #include "../terminal_colours.h" #include @@ -33,4 +33,4 @@ void print_coloured_text(Str8RO *text, TerminalColour colour) { printf(WAPP_STR8_SPEC WAPP_STR8_SPEC, wapp_str8_varg(colours[colour]), wapp_str8_varg((*text))); } -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX diff --git a/src/os/shell/termcolour/termcolour.h b/src/os/shell/termcolour/termcolour.h index 24076b1..b07563b 100644 --- a/src/os/shell/termcolour/termcolour.h +++ b/src/os/shell/termcolour/termcolour.h @@ -8,9 +8,9 @@ #include "../../../common/platform/platform.h" #include "../../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP // TODO (Abdelrahman): Look into moving away from stdio in the implementation @@ -19,8 +19,8 @@ void wapp_shell_termcolour_clear_colour(void); wapp_extern void print_coloured_text(Str8RO *text, TerminalColour colour); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !TERM_COLOUR_H diff --git a/src/os/shell/termcolour/terminal_colours.h b/src/os/shell/termcolour/terminal_colours.h index 8e864e6..20a78f9 100644 --- a/src/os/shell/termcolour/terminal_colours.h +++ b/src/os/shell/termcolour/terminal_colours.h @@ -6,9 +6,9 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef enum { WAPP_TERM_COLOUR_FG_BLACK, @@ -32,8 +32,8 @@ typedef enum { COUNT_TERM_COLOUR, } TerminalColour; -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !TERMINAL_COLOURS_H diff --git a/src/os/shell/termcolour/win/termcolour_win.c b/src/os/shell/termcolour/win/termcolour_win.c index f3c5609..ba05d3e 100644 --- a/src/os/shell/termcolour/win/termcolour_win.c +++ b/src/os/shell/termcolour/win/termcolour_win.c @@ -4,7 +4,7 @@ #include "../../../../common/platform/platform.h" #include "../../../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #include "../terminal_colours.h" #include "../../../../common/misc/misc_utils.h" @@ -70,4 +70,4 @@ wapp_intern void init_data(TermcolourData *data) { data->current_colour = data->default_colour; } -#endif // !WAPP_PLATFORM_WINDOWS +#endif // !WP_PLATFORM_WINDOWS diff --git a/src/os/shell/utils/shell_utils.h b/src/os/shell/utils/shell_utils.h index a9d8195..b767a59 100644 --- a/src/os/shell/utils/shell_utils.h +++ b/src/os/shell/utils/shell_utils.h @@ -7,20 +7,20 @@ #include "../../../common/platform/platform.h" #include -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP -#ifdef WAPP_PLATFORM_WINDOWS +#ifdef WP_PLATFORM_WINDOWS #define wapp_shell_utils_popen _popen #define wapp_shell_utils_pclose _pclose #else #define wapp_shell_utils_popen popen #define wapp_shell_utils_pclose pclose -#endif /* ifdef WAPP_PLATFORM_WINDOWS */ +#endif /* ifdef WP_PLATFORM_WINDOWS */ -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !SHELL_UTILS_H diff --git a/src/prng/xorshift/xorshift.c b/src/prng/xorshift/xorshift.c index d681924..fdfa134 100644 --- a/src/prng/xorshift/xorshift.c +++ b/src/prng/xorshift/xorshift.c @@ -89,8 +89,8 @@ wapp_intern u64 split_mix_64(SplitMix64State *state) { return result ^ (result >> 31); } -#if defined(WAPP_PLATFORM_C) && WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C11_VERSION -#ifdef WAPP_PLATFORM_POSIX +#if defined(WP_PLATFORM_C) && WP_PLATFORM_C_VERSION >= WP_PLATFORM_C11_VERSION +#ifdef WP_PLATFORM_POSIX wapp_intern void seed_os_generator(void) { struct timespec ts = {0}; int result = clock_gettime(CLOCK_MONOTONIC_RAW, &ts); @@ -117,7 +117,7 @@ wapp_intern u64 generate_random_number(void) { return (((u64)n1) << 32 | (u64)n2); } -#endif // !WAPP_PLATFORM_POSIX +#endif // !WP_PLATFORM_POSIX #else wapp_intern void seed_os_generator(void) { time_t result = time(NULL); @@ -132,4 +132,4 @@ wapp_intern u64 generate_random_number(void) { return (((u64)n1) << 32 | (u64)n2); } -#endif // !WAPP_PLATFORM_C +#endif // !WP_PLATFORM_C diff --git a/src/prng/xorshift/xorshift.h b/src/prng/xorshift/xorshift.h index 7a66d05..5df94f4 100644 --- a/src/prng/xorshift/xorshift.h +++ b/src/prng/xorshift/xorshift.h @@ -6,9 +6,9 @@ #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP typedef struct XOR256State XOR256State; struct XOR256State { @@ -23,8 +23,8 @@ u64 wapp_prng_xorshift_256(XOR256State *state); u64 wapp_prng_xorshift_256ss(XOR256State *state); u64 wapp_prng_xorshift_256p(XOR256State *state); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !XORSHIFT_H diff --git a/src/testing/tester/tester.h b/src/testing/tester/tester.h index 74b592c..24533a5 100644 --- a/src/testing/tester/tester.h +++ b/src/testing/tester/tester.h @@ -7,13 +7,13 @@ #include "../../common/platform/platform.h" #include "../../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE #define wapp_tester_result(PASSED) (TestFuncResult{wapp_str8_lit_ro(__func__), PASSED, {}}) #else #define wapp_tester_result(PASSED) ((TestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED}) -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define wapp_tester_run_tests(...) run_tests(__VA_ARGS__, NULL) @@ -29,8 +29,8 @@ typedef TestFuncResult(TestFunc)(void); void run_tests(TestFunc *func1, ...); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !TESTER_H diff --git a/src/uuid/uuid.h b/src/uuid/uuid.h index 09fdcab..3f4fa10 100644 --- a/src/uuid/uuid.h +++ b/src/uuid/uuid.h @@ -7,9 +7,9 @@ #include "../common/platform/platform.h" #include "../base/strings/str8/str8.h" -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #define UUID_BUF_LENGTH 48 #define WAPP_UUID_SPEC WAPP_STR8_SPEC @@ -22,7 +22,7 @@ struct WUUID { // TODO (Abdelrahman): Update UUID implementation to work properly with C++ and tests for validation -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_uuid_gen_uuid4() ([&](){ \ wapp_persist WUUID uuid = wapp_uuid_create(); \ return *(wapp_uuid_init_uuid4(&uuid)); \ @@ -33,7 +33,7 @@ struct WUUID { /* Low level UUID API */ -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP #define wapp_uuid_create() ([&](){ return WUUID{wapp_str8_buf(UUID_BUF_LENGTH)}; }()) #else #define wapp_uuid_create() ((WUUID){.uuid = wapp_str8_buf(UUID_BUF_LENGTH)}) @@ -43,8 +43,8 @@ struct WUUID { // Fails when passed a NULL pointer. WUUID *wapp_uuid_init_uuid4(WUUID *uuid); -#ifdef WAPP_PLATFORM_CPP +#ifdef WP_PLATFORM_CPP END_C_LINKAGE -#endif // !WAPP_PLATFORM_CPP +#endif // !WP_PLATFORM_CPP #endif // !UUID_H