Rename aliases
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
#define _array_header(ARRAY) (ArrayHeader *)(wapp_pointer_offset(ARRAY, (i64)sizeof(ArrayHeader) * -1))
|
||||
|
||||
wapp_persist inline void _array_validate(const GenericArray array, u64 item_size);
|
||||
wp_persist inline void _array_validate(const GenericArray array, u64 item_size);
|
||||
|
||||
u64 _array_count(GenericArray array) {
|
||||
wapp_debug_assert(array != NULL, "`array` should not be NULL");
|
||||
@@ -259,7 +259,7 @@ GenericArray _array_from_preallocated_buffer(void *buffer, u64 buffer_size, Arra
|
||||
return output;
|
||||
}
|
||||
|
||||
wapp_persist inline void _array_validate(const GenericArray array, u64 item_size) {
|
||||
wp_persist inline void _array_validate(const GenericArray array, u64 item_size) {
|
||||
ArrayHeader *header = _array_header(array);
|
||||
wapp_runtime_assert(WAPP_ARRAY_MAGIC == header->magic, "`array` is not a valid wapp array");
|
||||
wapp_runtime_assert(item_size == header->item_size, "Invalid item type provided");
|
||||
|
||||
@@ -52,7 +52,7 @@ typedef enum {
|
||||
\
|
||||
TYPE items[_calc_array_capacity(TYPE, __VA_ARGS__)] = {__VA_ARGS__}; \
|
||||
\
|
||||
wapp_persist u8 array[ \
|
||||
wp_persist u8 array[ \
|
||||
sizeof(ArrayHeader) + _calc_array_capacity(TYPE, __VA_ARGS__) * sizeof(TYPE) \
|
||||
] = {0}; \
|
||||
ArrayHeader *header = (ArrayHeader *)array; \
|
||||
@@ -66,7 +66,7 @@ typedef enum {
|
||||
return (TYPE *)buf; \
|
||||
}())
|
||||
#define wapp_array_with_capacity(TYPE, CAPACITY, FLAGS) ([&]() { \
|
||||
wapp_persist u8 array[ \
|
||||
wp_persist u8 array[ \
|
||||
sizeof(ArrayHeader) + CAPACITY * sizeof(TYPE) \
|
||||
] = {0}; \
|
||||
ArrayHeader *header = (ArrayHeader *)array; \
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "../../common/platform/platform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
wapp_intern GenericList _node_to_list(GenericNode *node, u64 item_size);
|
||||
wapp_intern inline void _dbl_list_validate(const GenericList *list, u64 item_size);
|
||||
wapp_intern inline void _dbl_list_node_validate(const GenericList *list, const GenericNode *node, u64 item_size);
|
||||
wp_intern GenericList _node_to_list(GenericNode *node, u64 item_size);
|
||||
wp_intern inline void _dbl_list_validate(const GenericList *list, u64 item_size);
|
||||
wp_intern inline void _dbl_list_node_validate(const GenericList *list, const GenericNode *node, u64 item_size);
|
||||
|
||||
GenericList *_dbl_list_alloc(const Allocator *allocator, u64 item_size) {
|
||||
wapp_debug_assert(allocator != NULL, "`allocator` should not be NULL");
|
||||
@@ -225,7 +225,7 @@ void _dbl_list_empty(GenericList *list, u64 item_size) {
|
||||
}
|
||||
}
|
||||
|
||||
wapp_intern GenericList _node_to_list(GenericNode *node, u64 item_size) {
|
||||
wp_intern GenericList _node_to_list(GenericNode *node, u64 item_size) {
|
||||
GenericList output = {
|
||||
.magic = WAPP_DBL_LIST_MAGIC,
|
||||
.first = node,
|
||||
@@ -247,12 +247,12 @@ wapp_intern GenericList _node_to_list(GenericNode *node, u64 item_size) {
|
||||
return output;
|
||||
}
|
||||
|
||||
wapp_intern inline void _dbl_list_validate(const GenericList *list, u64 item_size) {
|
||||
wp_intern inline void _dbl_list_validate(const GenericList *list, u64 item_size) {
|
||||
wapp_runtime_assert(list->magic == WAPP_DBL_LIST_MAGIC, "`list` isn't a valid wapp list type");
|
||||
wapp_runtime_assert(list->item_size == item_size, "Invalid item provided");
|
||||
}
|
||||
|
||||
wapp_intern inline void _dbl_list_node_validate(const GenericList *list, const GenericNode *node, u64 item_size) {
|
||||
wp_intern inline void _dbl_list_node_validate(const GenericList *list, const GenericNode *node, u64 item_size) {
|
||||
wapp_runtime_assert(node->header.magic == WAPP_DBL_NODE_MAGIC, "`node` isn't a valid wapp node type");
|
||||
wapp_runtime_assert(list->item_size == node->header.item_size, "Mismatched `list` and `node` types");
|
||||
wapp_runtime_assert(node->header.item_size == item_size, "Invalid item provided");
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef GenericNode Str8Node;
|
||||
#define wapp_dbl_list(TYPE) \
|
||||
GenericList{WAPP_DBL_LIST_MAGIC, 0, sizeof(TYPE), nullptr, nullptr}
|
||||
#define _dbl_list_node(TYPE, ITEM_PTR) ([&]() { \
|
||||
wapp_persist GenericNode node = { \
|
||||
wp_persist GenericNode node = { \
|
||||
NodeHeader{WAPP_DBL_NODE_MAGIC, sizeof(TYPE), nullptr, nullptr}, \
|
||||
ITEM_PTR, \
|
||||
}; \
|
||||
|
||||
@@ -42,8 +42,8 @@ typedef GenericQueue Str8Queue;
|
||||
|
||||
#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 = { \
|
||||
wp_persist GenericArray arr = wapp_array_with_capacity(TYPE, CAPACITY, ARRAY_INIT_FILLED); \
|
||||
wp_persist GenericQueue queue = { \
|
||||
arr, \
|
||||
0, \
|
||||
0, \
|
||||
@@ -53,7 +53,7 @@ typedef GenericQueue Str8Queue;
|
||||
return queue; \
|
||||
}())
|
||||
#define wapp_queue_alloc(TYPE, ALLOCATOR_PTR, CAPACITY) ([&]() { \
|
||||
wapp_persist GenericQueue queue = { \
|
||||
wp_persist GenericQueue queue = { \
|
||||
wapp_array_alloc_capacity(TYPE, ALLOCATOR_PTR, CAPACITY, ARRAY_INIT_FILLED), \
|
||||
0, \
|
||||
0, \
|
||||
|
||||
@@ -37,14 +37,14 @@ typedef const Str8 Str8RO;
|
||||
#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] = {}; \
|
||||
wp_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) ([&]() { \
|
||||
wapp_persist c8 buf[sizeof(STRING) * 2] = {}; \
|
||||
wp_persist c8 buf[sizeof(STRING) * 2] = {}; \
|
||||
memcpy(buf, STRING, sizeof(STRING)); \
|
||||
return Str8{(sizeof(STRING) - 1) * 2, sizeof(STRING) - 1, buf}; \
|
||||
}())
|
||||
|
||||
@@ -54,13 +54,13 @@ typedef long double f128;
|
||||
typedef uintptr_t uptr;
|
||||
typedef intptr_t iptr;
|
||||
|
||||
#define wapp_extern extern
|
||||
#define wapp_intern static
|
||||
#define wapp_persist static
|
||||
#define wp_extern extern
|
||||
#define wp_intern static
|
||||
#define wp_persist static
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wapp_class_mem static
|
||||
#define BEGIN_C_LINKAGE wapp_extern "C" {
|
||||
#define wp_class_mem static
|
||||
#define BEGIN_C_LINKAGE wp_extern "C" {
|
||||
#define END_C_LINKAGE }
|
||||
#endif // WP_PLATFORM_CPP
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define wapp_static_assert(EXPR, MSG) wapp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
|
||||
#define wapp_static_assert(EXPR, MSG) wp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
|
||||
|
||||
#ifndef WAPP_NO_RUNTIME_ASSERT
|
||||
#define wapp_runtime_assert(EXPR, MSG) __wapp_runtime_assert(EXPR, MSG)
|
||||
|
||||
+9
-9
@@ -11,9 +11,9 @@
|
||||
#define MIN_LOG_MSG_LENGTH 32
|
||||
#define TIME_BUF_CAPACITY 70
|
||||
|
||||
wapp_intern Str8RO L_BRACKET = wapp_str8_lit_ro("[");
|
||||
wapp_intern Str8RO R_BRACKET_SPACE = wapp_str8_lit_ro("] ");
|
||||
wapp_intern Str8RO R_BRACKET_NEWLINE = wapp_str8_lit_ro("]\n");
|
||||
wp_intern Str8RO L_BRACKET = wapp_str8_lit_ro("[");
|
||||
wp_intern Str8RO R_BRACKET_SPACE = wapp_str8_lit_ro("] ");
|
||||
wp_intern Str8RO R_BRACKET_NEWLINE = wapp_str8_lit_ro("]\n");
|
||||
|
||||
typedef struct {
|
||||
WFile *outlog;
|
||||
@@ -23,10 +23,10 @@ typedef struct {
|
||||
wapp_misc_utils_reserve_padding(2 * sizeof(WFile *) + sizeof(LogLevel));
|
||||
} LogConfig;
|
||||
|
||||
wapp_intern LogConfig LOG_CONFIG = {
|
||||
wp_intern LogConfig LOG_CONFIG = {
|
||||
.level = WAPP_LOG_DEBUG,
|
||||
};
|
||||
wapp_intern Str8RO LOG_LEVEL_STRINGS[COUNT_LOG_LEVEL] = {
|
||||
wp_intern Str8RO LOG_LEVEL_STRINGS[COUNT_LOG_LEVEL] = {
|
||||
[WAPP_LOG_FATAL] = wapp_str8_lit_ro_initialiser_list("fatal "),
|
||||
[WAPP_LOG_CRITICAL] = wapp_str8_lit_ro_initialiser_list("critical "),
|
||||
[WAPP_LOG_ERROR] = wapp_str8_lit_ro_initialiser_list("error "),
|
||||
@@ -35,8 +35,8 @@ wapp_intern Str8RO LOG_LEVEL_STRINGS[COUNT_LOG_LEVEL] = {
|
||||
[WAPP_LOG_DEBUG] = wapp_str8_lit_ro_initialiser_list("debug "),
|
||||
};
|
||||
|
||||
wapp_intern void _get_current_time_string(Str8 *dst);
|
||||
wapp_intern void _write_log_line(WFile *fp, const Logger *logger, Str8 msg, LogLevel level);
|
||||
wp_intern void _get_current_time_string(Str8 *dst);
|
||||
wp_intern void _write_log_line(WFile *fp, const Logger *logger, Str8 msg, LogLevel level);
|
||||
|
||||
void wapp_log_set_level(LogLevel level) {
|
||||
LOG_CONFIG.level = level;
|
||||
@@ -100,7 +100,7 @@ void wapp_log_fatal(const Logger *logger, Str8 msg) {
|
||||
_write_log_line(fp, logger, msg, WAPP_LOG_FATAL);
|
||||
}
|
||||
|
||||
wapp_intern void _get_current_time_string(Str8 *dst) {
|
||||
wp_intern void _get_current_time_string(Str8 *dst) {
|
||||
// TODO (Abdelrahman): Replace with proper date/time utilities
|
||||
char buf[TIME_BUF_CAPACITY];
|
||||
time_t now = time(NULL);
|
||||
@@ -110,7 +110,7 @@ wapp_intern void _get_current_time_string(Str8 *dst) {
|
||||
wapp_str8_copy_cstr_capped(dst, buf);
|
||||
}
|
||||
|
||||
wapp_intern void _write_log_line(WFile *fp, const Logger *logger, Str8 msg, LogLevel level) {
|
||||
wp_intern void _write_log_line(WFile *fp, const Logger *logger, Str8 msg, LogLevel level) {
|
||||
Str8 padding = wapp_str8_buf(MIN_LOG_MSG_LENGTH);
|
||||
u32 padding_size = msg.size < MIN_LOG_MSG_LENGTH ? MIN_LOG_MSG_LENGTH - msg.size + 1 : 0;
|
||||
wapp_str8_format(&padding, "%-*s", padding_size, " ");
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/assert/assert.h"
|
||||
|
||||
wapp_intern void initialise_arena_allocator(Allocator *allocator);
|
||||
wapp_intern void *mem_arena_alloc(u64 size, void *alloc_obj);
|
||||
wapp_intern void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj);
|
||||
wapp_intern void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj);
|
||||
wapp_intern void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment,
|
||||
wp_intern void initialise_arena_allocator(Allocator *allocator);
|
||||
wp_intern void *mem_arena_alloc(u64 size, void *alloc_obj);
|
||||
wp_intern void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj);
|
||||
wp_intern void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj);
|
||||
wp_intern void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment,
|
||||
void *alloc_obj);
|
||||
|
||||
Allocator wapp_mem_arena_allocator_init_with_buffer(u8 *buffer, u64 buffer_size) {
|
||||
@@ -58,29 +58,29 @@ void wapp_mem_arena_allocator_destroy(Allocator *allocator) {
|
||||
*allocator = (Allocator){0};
|
||||
}
|
||||
|
||||
wapp_intern void initialise_arena_allocator(Allocator *allocator) {
|
||||
wp_intern void initialise_arena_allocator(Allocator *allocator) {
|
||||
allocator->alloc = mem_arena_alloc;
|
||||
allocator->alloc_aligned = mem_arena_alloc_aligned;
|
||||
allocator->realloc = mem_arena_realloc;
|
||||
allocator->realloc_aligned = mem_arena_realloc_aligned;
|
||||
}
|
||||
|
||||
wapp_intern void *mem_arena_alloc(u64 size, void *alloc_obj) {
|
||||
wp_intern void *mem_arena_alloc(u64 size, void *alloc_obj) {
|
||||
Arena *arena = (Arena *)alloc_obj;
|
||||
return wapp_mem_arena_alloc(arena, size);
|
||||
}
|
||||
|
||||
wapp_intern void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj) {
|
||||
wp_intern 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);
|
||||
}
|
||||
|
||||
wapp_intern void *mem_arena_realloc(void *ptr, u64 old_size, u64 new_size, void *alloc_obj) {
|
||||
wp_intern 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);
|
||||
}
|
||||
|
||||
wapp_intern void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new_size, u64 alignment,
|
||||
wp_intern 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);
|
||||
|
||||
+11
-11
@@ -36,15 +36,15 @@ typedef enum {
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stdin to get the standard input stream
|
||||
wapp_extern WFile *wapp_file_stdin(void);
|
||||
wp_extern WFile *wapp_file_stdin(void);
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stdout to get the standard output stream
|
||||
wapp_extern WFile *wapp_file_stdout(void);
|
||||
wp_extern WFile *wapp_file_stdout(void);
|
||||
|
||||
// Return value should not be cached as it's not guaranteed to remain the same. Always call
|
||||
// wapp_file_stderr to get the standard error stream
|
||||
wapp_extern WFile *wapp_file_stderr(void);
|
||||
wp_extern WFile *wapp_file_stderr(void);
|
||||
|
||||
WFile *wapp_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
i64 wapp_file_get_current_position(WFile *file);
|
||||
@@ -61,14 +61,14 @@ i32 wapp_file_close(WFile *file);
|
||||
i32 wapp_file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
i32 wapp_file_remove(Str8RO *filepath);
|
||||
|
||||
wapp_extern WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
wapp_extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
|
||||
wapp_extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
|
||||
wapp_extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
|
||||
wapp_extern i32 _file_flush(WFile *file);
|
||||
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);
|
||||
wp_extern WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode);
|
||||
wp_extern i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin);
|
||||
wp_extern u64 _file_read(void *dst_buf, u64 byte_count, WFile *file, u64 file_length);
|
||||
wp_extern i64 _file_write(const void *src_buf, WFile *file, u64 byte_count);
|
||||
wp_extern i32 _file_flush(WFile *file);
|
||||
wp_extern i32 _file_close(WFile *file);
|
||||
wp_extern i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath);
|
||||
wp_extern i32 _file_remove(Str8RO *filepath);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
wapp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = O_RDONLY,
|
||||
[WAPP_ACCESS_WRITE] = O_WRONLY | O_CREAT,
|
||||
[WAPP_ACCESS_APPEND] = O_WRONLY | O_APPEND | O_CREAT,
|
||||
@@ -32,7 +32,7 @@ wapp_intern i32 file_flags[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = O_RDWR | O_CREAT | O_EXCL,
|
||||
};
|
||||
|
||||
wapp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = 0,
|
||||
[WAPP_ACCESS_WRITE] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
[WAPP_ACCESS_APPEND] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
@@ -43,29 +43,29 @@ wapp_intern mode_t file_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
|
||||
};
|
||||
|
||||
wapp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
wp_intern i32 file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
[WAPP_SEEK_START] = SEEK_SET,
|
||||
[WAPP_SEEK_CURRENT] = SEEK_CUR,
|
||||
[WAPP_SEEK_END] = SEEK_END,
|
||||
};
|
||||
|
||||
WFile *wapp_file_stdin(void) {
|
||||
wapp_persist WFile _stdin = { .fd = STDIN_FILENO };
|
||||
wp_persist WFile _stdin = { .fd = STDIN_FILENO };
|
||||
return &_stdin;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stdout(void) {
|
||||
wapp_persist WFile _stdout = { .fd = STDOUT_FILENO };
|
||||
wp_persist WFile _stdout = { .fd = STDOUT_FILENO };
|
||||
return &_stdout;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stderr(void) {
|
||||
wapp_persist WFile _stderr = { .fd = STDERR_FILENO };
|
||||
wp_persist WFile _stderr = { .fd = STDERR_FILENO };
|
||||
return &_stderr;
|
||||
}
|
||||
|
||||
WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
@@ -108,8 +108,8 @@ i32 _file_close(WFile *file) {
|
||||
}
|
||||
|
||||
i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
wapp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wapp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(old_tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(old_tmp, old_filepath->buf, old_filepath->size);
|
||||
memset(new_tmp, 0, WAPP_PATH_MAX);
|
||||
@@ -124,7 +124,7 @@ i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
}
|
||||
|
||||
i32 _file_remove(Str8RO *filepath) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
|
||||
+11
-11
@@ -15,7 +15,7 @@
|
||||
#include <fileapi.h>
|
||||
#include <intsafe.h>
|
||||
|
||||
wapp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = FILE_READ_DATA,
|
||||
[WAPP_ACCESS_WRITE] = FILE_WRITE_DATA,
|
||||
[WAPP_ACCESS_APPEND] = FILE_APPEND_DATA,
|
||||
@@ -26,7 +26,7 @@ wapp_intern DWORD file_accesses[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = FILE_READ_DATA | FILE_WRITE_DATA,
|
||||
};
|
||||
|
||||
wapp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = OPEN_EXISTING,
|
||||
[WAPP_ACCESS_WRITE] = CREATE_ALWAYS,
|
||||
[WAPP_ACCESS_APPEND] = OPEN_ALWAYS,
|
||||
@@ -37,7 +37,7 @@ wapp_intern DWORD creation_dispositions[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = CREATE_NEW,
|
||||
};
|
||||
|
||||
wapp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
wp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_READ] = FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
[WAPP_ACCESS_WRITE] = FILE_SHARE_READ,
|
||||
[WAPP_ACCESS_APPEND] = FILE_SHARE_READ,
|
||||
@@ -48,32 +48,32 @@ wapp_intern DWORD sharing_modes[FILE_ACCESS_MODE_COUNT] = {
|
||||
[WAPP_ACCESS_WRITE_FAIL_ON_EXIST_EX] = FILE_SHARE_READ,
|
||||
};
|
||||
|
||||
wapp_intern DWORD file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
wp_intern DWORD file_seek_origins[FILE_SEEK_ORIGIN_COUNT] = {
|
||||
[WAPP_SEEK_START] = FILE_BEGIN,
|
||||
[WAPP_SEEK_CURRENT] = FILE_CURRENT,
|
||||
[WAPP_SEEK_END] = FILE_END,
|
||||
};
|
||||
|
||||
WFile *wapp_file_stdin(void) {
|
||||
wapp_persist WFile _stdin = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stdin = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stdin.fh = GetStdHandle(STD_INPUT_HANDLE);
|
||||
return &_stdin;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stdout(void) {
|
||||
wapp_persist WFile _stdout = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stdout = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stdout.fh = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
return &_stdout;
|
||||
}
|
||||
|
||||
WFile *wapp_file_stderr(void) {
|
||||
wapp_persist WFile _stderr = { .fh = INVALID_HANDLE_VALUE };
|
||||
wp_persist WFile _stderr = { .fh = INVALID_HANDLE_VALUE };
|
||||
_stderr.fh = GetStdHandle(STD_ERROR_HANDLE);
|
||||
return &_stderr;
|
||||
}
|
||||
|
||||
WFile *_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
@@ -148,8 +148,8 @@ i32 _file_close(WFile *file) {
|
||||
}
|
||||
|
||||
i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
wapp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wapp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 old_tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 new_tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(old_tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(old_tmp, old_filepath->buf, old_filepath->size);
|
||||
memset(new_tmp, 0, WAPP_PATH_MAX);
|
||||
@@ -163,7 +163,7 @@ i32 _file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
|
||||
}
|
||||
|
||||
i32 _file_remove(Str8RO *filepath) {
|
||||
wapp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
wp_persist c8 tmp[WAPP_PATH_MAX] = {0};
|
||||
memset(tmp, 0, WAPP_PATH_MAX);
|
||||
memcpy(tmp, filepath->buf, filepath->size);
|
||||
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ BEGIN_C_LINKAGE
|
||||
void *wapp_os_mem_alloc(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type);
|
||||
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);
|
||||
wp_extern void *os_mem_allocate(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type);
|
||||
wp_extern void os_mem_free(void *ptr, u64 size);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../mem_os_ops.h"
|
||||
#include <sys/mman.h>
|
||||
|
||||
wapp_intern const i32 access_types[] = {
|
||||
wp_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,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <Windows.h>
|
||||
#include <memoryapi.h>
|
||||
|
||||
wapp_intern const i32 access_types[] = {
|
||||
wp_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,
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#define CMD_BUF_LEN 8192
|
||||
#define OUT_BUF_LEN 4096
|
||||
|
||||
wapp_intern CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf);
|
||||
wapp_intern CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf);
|
||||
wp_intern CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf);
|
||||
wp_intern 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;
|
||||
}
|
||||
|
||||
wapp_intern CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf) {
|
||||
wp_intern 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;
|
||||
}
|
||||
|
||||
wapp_intern CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) {
|
||||
wp_intern 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(c8), out.capacity, fp);
|
||||
|
||||
@@ -20,7 +20,7 @@ BEGIN_C_LINKAGE
|
||||
|
||||
CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd);
|
||||
|
||||
wapp_extern CMDError get_output_status(FILE *fp, i32 *status_out);
|
||||
wp_extern CMDError get_output_status(FILE *fp, i32 *status_out);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../terminal_colours.h"
|
||||
#include <stdio.h>
|
||||
|
||||
wapp_intern Str8RO colours[COUNT_TERM_COLOUR] = {
|
||||
wp_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"),
|
||||
|
||||
@@ -17,7 +17,7 @@ BEGIN_C_LINKAGE
|
||||
void wapp_shell_termcolour_print_text(Str8RO *text, TerminalColour colour);
|
||||
void wapp_shell_termcolour_clear_colour(void);
|
||||
|
||||
wapp_extern void print_coloured_text(Str8RO *text, TerminalColour colour);
|
||||
wp_extern void print_coloured_text(Str8RO *text, TerminalColour colour);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -22,9 +22,9 @@ struct TermcolourData {
|
||||
wapp_misc_utils_reserve_padding(sizeof(HANDLE) + sizeof(WORD) + sizeof(WORD));
|
||||
};
|
||||
|
||||
wapp_intern void init_data(TermcolourData *data);
|
||||
wp_intern void init_data(TermcolourData *data);
|
||||
|
||||
wapp_intern WORD colours[COUNT_TERM_COLOUR] = {
|
||||
wp_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 @@ wapp_intern WORD colours[COUNT_TERM_COLOUR] = {
|
||||
};
|
||||
|
||||
void print_coloured_text(Str8RO *text, TerminalColour colour) {
|
||||
wapp_persist TermcolourData data = {0};
|
||||
wp_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)));
|
||||
}
|
||||
|
||||
wapp_intern void init_data(TermcolourData *data) {
|
||||
wp_intern void init_data(TermcolourData *data) {
|
||||
// create handle
|
||||
data->handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ struct SplitMix64State {
|
||||
u64 seed;
|
||||
};
|
||||
|
||||
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);
|
||||
wp_intern u64 rol64(u64 x, u64 bits);
|
||||
wp_intern u64 split_mix_64(SplitMix64State *state);
|
||||
wp_intern void seed_os_generator(void);
|
||||
wp_intern u64 generate_random_number(void);
|
||||
|
||||
XOR256State wapp_prng_xorshift_init_state(void) {
|
||||
wapp_persist b8 seeded = false;
|
||||
wp_persist b8 seeded = false;
|
||||
if (!seeded) {
|
||||
seeded = true;
|
||||
seed_os_generator();
|
||||
@@ -75,11 +75,11 @@ u64 wapp_prng_xorshift_256p(XOR256State *state) {
|
||||
return result;
|
||||
}
|
||||
|
||||
wapp_intern u64 rol64(u64 x, u64 bits) {
|
||||
wp_intern u64 rol64(u64 x, u64 bits) {
|
||||
return (x << bits) | (x >> (64 - bits));
|
||||
}
|
||||
|
||||
wapp_intern u64 split_mix_64(SplitMix64State *state) {
|
||||
wp_intern u64 split_mix_64(SplitMix64State *state) {
|
||||
state->seed += 0x9E3779B97f4A7C15;
|
||||
|
||||
u64 result = state->seed;
|
||||
@@ -91,7 +91,7 @@ wapp_intern u64 split_mix_64(SplitMix64State *state) {
|
||||
|
||||
#if defined(WP_PLATFORM_C) && WP_PLATFORM_C_VERSION >= WP_PLATFORM_C11_VERSION
|
||||
#ifdef WP_PLATFORM_POSIX
|
||||
wapp_intern void seed_os_generator(void) {
|
||||
wp_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 @@ wapp_intern void seed_os_generator(void) {
|
||||
srand48(ts.tv_nsec);
|
||||
}
|
||||
|
||||
wapp_intern u64 generate_random_number(void) {
|
||||
wp_intern u64 generate_random_number(void) {
|
||||
return lrand48();
|
||||
}
|
||||
#else
|
||||
wapp_intern void seed_os_generator(void) {
|
||||
wp_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 @@ wapp_intern void seed_os_generator(void) {
|
||||
srand(ts.tv_nsec);
|
||||
}
|
||||
|
||||
wapp_intern u64 generate_random_number(void) {
|
||||
wp_intern u64 generate_random_number(void) {
|
||||
i32 n1 = rand();
|
||||
i32 n2 = rand();
|
||||
|
||||
@@ -119,14 +119,14 @@ wapp_intern u64 generate_random_number(void) {
|
||||
}
|
||||
#endif // !WP_PLATFORM_POSIX
|
||||
#else
|
||||
wapp_intern void seed_os_generator(void) {
|
||||
wp_intern void seed_os_generator(void) {
|
||||
time_t result = time(NULL);
|
||||
wapp_runtime_assert(result != (time_t)(-1), "Invalid seed value");
|
||||
|
||||
srand(result);
|
||||
}
|
||||
|
||||
wapp_intern u64 generate_random_number(void) {
|
||||
wp_intern u64 generate_random_number(void) {
|
||||
i32 n1 = rand();
|
||||
i32 n2 = rand();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
wapp_intern void handle_test_result(TestFuncResult result);
|
||||
wp_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");
|
||||
}
|
||||
|
||||
wapp_intern void handle_test_result(TestFuncResult result) {
|
||||
wp_intern void handle_test_result(TestFuncResult result) {
|
||||
TerminalColour colour;
|
||||
Str8 result_text = wapp_str8_buf(64);
|
||||
|
||||
|
||||
+6
-6
@@ -15,8 +15,8 @@ struct UUID4 {
|
||||
u64 low;
|
||||
};
|
||||
|
||||
wapp_intern UUID4 generate_uuid4(void);
|
||||
wapp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid);
|
||||
wp_intern UUID4 generate_uuid4(void);
|
||||
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid);
|
||||
|
||||
WUUID *wapp_uuid_init_uuid4(WUUID *uuid) {
|
||||
wapp_debug_assert(uuid != NULL, "`uuid` should not be NULL");
|
||||
@@ -27,9 +27,9 @@ WUUID *wapp_uuid_init_uuid4(WUUID *uuid) {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
wapp_intern UUID4 generate_uuid4(void) {
|
||||
wapp_persist XOR256State state = {0};
|
||||
wapp_persist b8 initialised = false;
|
||||
wp_intern UUID4 generate_uuid4(void) {
|
||||
wp_persist XOR256State state = {0};
|
||||
wp_persist b8 initialised = false;
|
||||
|
||||
if (!initialised) {
|
||||
initialised = true;
|
||||
@@ -47,7 +47,7 @@ wapp_intern UUID4 generate_uuid4(void) {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
wapp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid) {
|
||||
wp_intern void uuid4_to_uuid(const UUID4* uuid4, WUUID *uuid) {
|
||||
u64 group1 = uuid4->high >> 32;
|
||||
u64 group2 = (uuid4->high << 32) >> 48;
|
||||
u64 group3 = (uuid4->high << 48) >> 48;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ struct WUUID {
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wapp_uuid_gen_uuid4() ([&](){ \
|
||||
wapp_persist WUUID uuid = wapp_uuid_create(); \
|
||||
wp_persist WUUID uuid = wapp_uuid_create(); \
|
||||
return *(wapp_uuid_init_uuid4(&uuid)); \
|
||||
}())
|
||||
#else
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// allocation are aligned to power of 2 boundaries, the number of i32 values needed is hardcoded.
|
||||
#define TEMP_BUF_SIZE (40 + sizeof(i32) * 8)
|
||||
|
||||
wapp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
|
||||
wapp_intern Allocator temp_allocator = {0};
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
|
||||
wp_intern Allocator temp_allocator = {0};
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// allocation are aligned to power of 2 boundaries, the number of i32 values needed is hardcoded.
|
||||
#define TEMP_BUF_SIZE (40 + sizeof(i32) * 8)
|
||||
|
||||
wapp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
|
||||
wapp_intern Allocator temp_allocator = {};
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
|
||||
wp_intern Allocator temp_allocator = {};
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// allocation are aligned to power of 2 boundaries, the number of i32 values needed is hardcoded.
|
||||
#define TEMP_BUF_SIZE (40 + sizeof(i32) * 8)
|
||||
|
||||
wapp_intern Arena *arena = NULL;
|
||||
wapp_intern i32 count = 20;
|
||||
wapp_intern i32 *array = NULL;
|
||||
wapp_intern Arena *buf_arena = NULL;
|
||||
wapp_intern u8 buf[ARENA_BUF_SIZE] = {0};
|
||||
wapp_intern Arena *temp_arena = NULL;
|
||||
wapp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
|
||||
wp_intern Arena *arena = NULL;
|
||||
wp_intern i32 count = 20;
|
||||
wp_intern i32 *array = NULL;
|
||||
wp_intern Arena *buf_arena = NULL;
|
||||
wp_intern u8 buf[ARENA_BUF_SIZE] = {0};
|
||||
wp_intern Arena *temp_arena = NULL;
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
|
||||
|
||||
TestFuncResult test_arena_init_buffer(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&buf_arena, buf, ARENA_BUF_SIZE);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// allocation are aligned to power of 2 boundaries, the number of i32 values needed is hardcoded.
|
||||
#define TEMP_BUF_SIZE (40 + sizeof(i32) * 8)
|
||||
|
||||
wapp_intern Arena *arena = NULL;
|
||||
wapp_intern i32 count = 20;
|
||||
wapp_intern i32 *array = NULL;
|
||||
wapp_intern Arena *buf_arena = NULL;
|
||||
wapp_intern u8 buf[ARENA_BUF_SIZE] = {};
|
||||
wapp_intern Arena *temp_arena = NULL;
|
||||
wapp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
|
||||
wp_intern Arena *arena = NULL;
|
||||
wp_intern i32 count = 20;
|
||||
wp_intern i32 *array = NULL;
|
||||
wp_intern Arena *buf_arena = NULL;
|
||||
wp_intern u8 buf[ARENA_BUF_SIZE] = {};
|
||||
wp_intern Arena *temp_arena = NULL;
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
|
||||
|
||||
TestFuncResult test_arena_init_buffer(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&buf_arena, buf, ARENA_BUF_SIZE);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#include "test_file.h"
|
||||
|
||||
#define DST_CAPACITY 5
|
||||
wapp_intern Allocator arena = {0};
|
||||
wapp_intern Str8RO test_filename = wapp_str8_lit_ro_initialiser_list("wapptest.bin");
|
||||
wapp_intern Str8RO new_filename = wapp_str8_lit_ro_initialiser_list("wapptest2.bin");
|
||||
wapp_intern WFile *test_fp = NULL;
|
||||
wapp_intern I32Array src_array1 = wapp_array(i32, 0, 1, 2, 3, 4);
|
||||
wapp_intern I32Array src_array2 = wapp_array(i32, 5, 6, 7, 8, 9);
|
||||
wapp_intern I32Array src_array3 = wapp_array(i32, 10, 11, 12, 13, 14);
|
||||
wapp_intern I32Array dst_array = wapp_array_with_capacity(i32, DST_CAPACITY, false);
|
||||
wapp_intern i32 dst_buf[DST_CAPACITY] = {0};
|
||||
wp_intern Allocator arena = {0};
|
||||
wp_intern Str8RO test_filename = wapp_str8_lit_ro_initialiser_list("wapptest.bin");
|
||||
wp_intern Str8RO new_filename = wapp_str8_lit_ro_initialiser_list("wapptest2.bin");
|
||||
wp_intern WFile *test_fp = NULL;
|
||||
wp_intern I32Array src_array1 = wapp_array(i32, 0, 1, 2, 3, 4);
|
||||
wp_intern I32Array src_array2 = wapp_array(i32, 5, 6, 7, 8, 9);
|
||||
wp_intern I32Array src_array3 = wapp_array(i32, 10, 11, 12, 13, 14);
|
||||
wp_intern I32Array dst_array = wapp_array_with_capacity(i32, DST_CAPACITY, false);
|
||||
wp_intern i32 dst_buf[DST_CAPACITY] = {0};
|
||||
|
||||
TestFuncResult test_wapp_file_open(void) {
|
||||
arena = wapp_mem_arena_allocator_init(KiB(16));
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
#include "test_file.h"
|
||||
|
||||
#define DST_CAPACITY 5
|
||||
wapp_intern Allocator arena = {};
|
||||
wapp_intern Str8RO test_filename = wapp_str8_lit_ro_initialiser_list("wapptest.bin");
|
||||
wapp_intern Str8RO new_filename = wapp_str8_lit_ro_initialiser_list("wapptest2.bin");
|
||||
wapp_intern WFile *test_fp = NULL;
|
||||
wapp_intern i32 dst_buf[DST_CAPACITY] = {0};
|
||||
wapp_intern I32Array src_array1;
|
||||
wapp_intern I32Array src_array2;
|
||||
wapp_intern I32Array src_array3;
|
||||
wapp_intern I32Array dst_array ;
|
||||
wp_intern Allocator arena = {};
|
||||
wp_intern Str8RO test_filename = wapp_str8_lit_ro_initialiser_list("wapptest.bin");
|
||||
wp_intern Str8RO new_filename = wapp_str8_lit_ro_initialiser_list("wapptest2.bin");
|
||||
wp_intern WFile *test_fp = NULL;
|
||||
wp_intern i32 dst_buf[DST_CAPACITY] = {0};
|
||||
wp_intern I32Array src_array1;
|
||||
wp_intern I32Array src_array2;
|
||||
wp_intern I32Array src_array3;
|
||||
wp_intern I32Array dst_array ;
|
||||
|
||||
TestFuncResult test_wapp_file_open(void) {
|
||||
arena = wapp_mem_arena_allocator_init(KiB(16));
|
||||
|
||||
Reference in New Issue
Block a user