diff --git a/arena.h b/arena.h index a4d59e3..737a7a9 100644 --- a/arena.h +++ b/arena.h @@ -9,6 +9,11 @@ #define MA_GIB(x) (MA_MIB(x) * 1024ull) #define MA_TIB(x) (MA_GIB(x) * 1024ull) +typedef struct MV_Memory MV_Memory; +typedef struct MA_Checkpoint MA_Checkpoint; +typedef struct MA_Arena MA_Arena; +typedef struct M_Allocator M_Allocator; + #ifndef MA_DEFAULT_RESERVE_SIZE #define MA_DEFAULT_RESERVE_SIZE MA_GIB(1) #endif @@ -69,12 +74,7 @@ typedef enum M_AllocatorOp { M_AllocatorOp_Deallocate, } M_AllocatorOp; -typedef struct MV_Memory MV_Memory; -typedef struct MA_Checkpoint MA_Checkpoint; -typedef struct MA_Arena MA_Arena; -typedef struct M_Allocator M_Allocator; typedef void *M_AllocatorProc(void *allocator, M_AllocatorOp kind, void *p, size_t size); - struct M_Allocator { void *obj; void *(*p)(void *allocator, M_AllocatorOp kind, void *p, size_t size); diff --git a/array.hpp b/array.hpp index 8e34edb..3c86613 100644 --- a/array.hpp +++ b/array.hpp @@ -1,4 +1,4 @@ -// #define ARRAY_ALLOCATOR_TYPE Allocator +#pragma once #ifndef ARRAY_PRIVATE_FUNCTION #if defined(__GNUC__) || defined(__clang__) diff --git a/clexer.h b/clexer.h index 71c3bc7..718a232 100644 --- a/clexer.h +++ b/clexer.h @@ -1,5 +1,4 @@ -#ifndef CL_HEADER -#define CL_HEADER +#pragma once #include #include #include @@ -494,5 +493,3 @@ CL_INLINE CL_Token *CL_MatchIdentifier(CL_Tokens *tokens, char *str) { } return 0; } - -#endif // CL_HEADER diff --git a/filesystem.h b/filesystem.h index f07726e..a0d0193 100644 --- a/filesystem.h +++ b/filesystem.h @@ -1,5 +1,4 @@ -#ifndef OS_FS_HEADER -#define OS_FS_HEADER +#pragma once #ifndef OS_API #ifdef __cplusplus @@ -63,4 +62,3 @@ OS_API S8_String OS_ListDirRegexAsString(MA_Arena *arena, S8_String path, unsign OS_API bool OS_ExpandIncludesList(MA_Arena *arena, S8_List *out, S8_String filepath); OS_API S8_String OS_ExpandIncludes(MA_Arena *arena, S8_String filepath); OS_API bool WIN_EnableTerminalColors(void); -#endif // OS_FS_HEADER diff --git a/hash.h b/hash.h index 35d06fd..faaeac6 100644 --- a/hash.h +++ b/hash.h @@ -1,5 +1,4 @@ -#ifndef HASH_HEADER -#define HASH_HEADER +#pragma once #include #ifndef HASH_API_FUNCTION @@ -19,15 +18,14 @@ struct RandomSeed { }; //@begin gen_api_funcs -HASH_API_FUNCTION uint64_t HashBytes(void *data, uint64_t size); -HASH_API_FUNCTION RandomSeed MakeRandomSeed(uint64_t value); -HASH_API_FUNCTION uint64_t GetRandomU64(RandomSeed *state); -HASH_API_FUNCTION int GetRandomRangeI(RandomSeed *seed, int first, int last_included); -HASH_API_FUNCTION double GetRandomNormal(RandomSeed *series); -HASH_API_FUNCTION double GetRandomNormalRange(RandomSeed *seed, double min, double max); -HASH_API_FUNCTION uint64_t HashMix(uint64_t x, uint64_t y); +HASH_API_FUNCTION uint64_t HashBytes(void *data, uint64_t size); +HASH_API_FUNCTION RandomSeed MakeRandomSeed(uint64_t value); +HASH_API_FUNCTION uint64_t GetRandomU64(RandomSeed *state); +HASH_API_FUNCTION int GetRandomRangeI(RandomSeed *seed, int first, int last_included); +HASH_API_FUNCTION double GetRandomNormal(RandomSeed *series); +HASH_API_FUNCTION double GetRandomNormalRange(RandomSeed *seed, double min, double max); +HASH_API_FUNCTION uint64_t HashMix(uint64_t x, uint64_t y); //@end gen_api_funcs #define WRAP_AROUND_POWER_OF_2(x, pow2) (((x) & ((pow2)-1llu))) static inline float GetRandomNormalF(RandomSeed *series) { return (float)GetRandomNormal(series); } -#endif diff --git a/io.h b/io.h index 30e2a9d..678ca90 100644 --- a/io.h +++ b/io.h @@ -1,5 +1,4 @@ -#ifndef IO_HEADER -#define IO_HEADER +#pragma once #include #ifndef IO_API @@ -72,4 +71,3 @@ IO_API void IO_OutputMessage(char *str, int len); IO_API IO_ErrorResult IO_OutputError(char *str, int len); IO_API void IO_Exit(int error_code); IO_API bool IO_IsDebuggerPresent(void); -#endif diff --git a/linked_list.h b/linked_list.h index dc4f748..693ff98 100644 --- a/linked_list.h +++ b/linked_list.h @@ -1,6 +1,4 @@ -#ifndef LINKED_LIST_HEADER -#define LINKED_LIST_HEADER - +#pragma once #define SLL_QUEUE_ADD_MOD(f, l, n, next) \ do { \ (n)->next = 0; \ @@ -125,5 +123,3 @@ } while (0) #define DLL_INSERT_NEXT(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev) #define DLL_INSERT_PREV(base, new) DLL_INSERT_NEXT_MOD(base, new, next, prev) - -#endif \ No newline at end of file diff --git a/load_library.h b/load_library.h index cd7782c..327d4f8 100644 --- a/load_library.h +++ b/load_library.h @@ -1,6 +1,4 @@ -#ifndef LIB_LOAD_HEADER -#define LIB_LOAD_HEADER - +#pragma once typedef void *LIB_Library; LIB_Library LIB_LoadLibrary(char *str); @@ -10,5 +8,3 @@ bool LIB_UnloadLibrary(LIB_Library lib); #ifndef LIB_EXPORT #define LIB_EXPORT __declspec(dllexport) #endif - -#endif \ No newline at end of file diff --git a/multimedia.h b/multimedia.h index 9d07fe6..ad69d95 100644 --- a/multimedia.h +++ b/multimedia.h @@ -1,5 +1,4 @@ -#ifndef MU_HEADER -#define MU_HEADER +#pragma once #include #include #include @@ -367,5 +366,3 @@ typedef struct MU_Event { */ - -#endif // MU_HEADER diff --git a/preproc_env.h b/preproc_env.h index 96ccbbe..5253ba0 100644 --- a/preproc_env.h +++ b/preproc_env.h @@ -1,6 +1,4 @@ -#ifndef PREPROC_ENV_HEADER -#define PREPROC_ENV_HEADER - +#pragma once #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif @@ -86,5 +84,3 @@ // #pragma clang diagnostic push // #pragma clang diagnostic ignored "-Wmicrosoft-enum-forward-reference" // #endif - -#endif // PREPROC_ENV_HEADER \ No newline at end of file diff --git a/regex.h b/regex.h index 903443e..5223523 100644 --- a/regex.h +++ b/regex.h @@ -1,5 +1,4 @@ -#ifndef RE_HEADER -#define RE_HEADER +#pragma once #include #include @@ -92,5 +91,3 @@ RE_API RE_Match RE3_FindAgain(RE_Regex *regex, char *string, RE_Int len, RE_Matc RE_API RE_Int RE3_MatchFront(RE_Regex *regex, char *string, RE_Int len, char *string_front); RE_API RE_Regex *RE1_Parse(char *buff, RE_Int buffsize, char *string); RE_API RE_Regex *RE2_Parse(char *buff, RE_Int buffsize, char *string, RE_Int len); - -#endif // RE_HEADER diff --git a/string.h b/string.h index 3be747f..ffa23bf 100644 --- a/string.h +++ b/string.h @@ -1,5 +1,4 @@ -#ifndef S8_HEADER -#define S8_HEADER +#pragma once #include #include @@ -115,5 +114,3 @@ S8_API S8_List S8_CopyList(S8_Allocator allocator, S8_List a); S8_API S8_List S8_ConcatLists(S8_Allocator allocator, S8_List a, S8_List b); S8_API S8_Node *S8_AddNode(S8_Allocator allocator, S8_List *list, S8_String string); S8_API S8_String S8_AddF(S8_Allocator allocator, S8_List *list, const char *str, ...); - -#endif // S8_HEADER diff --git a/table.hpp b/table.hpp index cee9ba1..f3f9851 100644 --- a/table.hpp +++ b/table.hpp @@ -1,3 +1,4 @@ +#pragma once #include /* Hash table implementation: diff --git a/unicode.h b/unicode.h index 65887bd..9b360dd 100644 --- a/unicode.h +++ b/unicode.h @@ -1,5 +1,4 @@ -#ifndef UTF_HEADER -#define UTF_HEADER +#pragma once #include typedef struct UTF32_Result UTF32_Result; typedef struct UTF8_Result UTF8_Result; @@ -51,4 +50,3 @@ UTF_API UTF8_Iter UTF8_IterateEx(char *str, int len); UTF_API UTF8_Iter UTF8_Iterate(char *str); #define UTF8_For(name, str, len) for (UTF8_Iter name = UTF8_IterateEx(str, (int)len); name.item; UTF8_Advance(&name)) -#endif // UTF_HEADER