This commit is contained in:
Daniel Ledda
2025-01-10 13:51:38 +01:00
parent 49e379dd54
commit fb29608871
3 changed files with 14 additions and 24 deletions

7
core.h
View File

@@ -60,6 +60,7 @@ void *pushSize(Arena *arena, size_t bytes);
Arena *arenaAlloc(size_t capacity);
void arenaFree(Arena *arena);
void arenaFreeFrom(Arena *arena, size_t pos);
void arenaPopTo(Arena *arena, void *pos);
void initialiseCore();
@@ -150,7 +151,7 @@ struct string {
#define strlit(lit) (string{(char *)(lit), sizeof(lit) - 1})
#define PushString(arena, length) (string{ (char *)pushSize(arena, length), (length) })
string operator""_s(const char *cstrLiteral, unsigned long length);
string operator""_s(const char *cstrLiteral, size_t length);
// C Strings
const char *cstring(Arena *arena, list<char> buf);
@@ -209,8 +210,8 @@ void log(const char *fmt, ...);
void logError(const char *fmt, ...);
// ### Loops ###
#define EachIn(list, it) size_t it = 0; it < list.length; it++
#define EachInReversed(list, it) size_t it = list.length - 1; it >= 0 && it < list.length; it--
#define EachIn(list, it) size_t it = 0; it < (list).head; it++
#define EachInReversed(list, it) size_t it = (list).head - 1; it >= 0 && it < (list).head; it--
#define EachInArray(arr, it) size_t it = 0; it < ArrayCount(arr); ++it
// ### Misc ###