diff --git a/.gitignore b/.gitignore index acf5dd9..021460c 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ dkms.conf *.out *.app +*.res \ No newline at end of file diff --git a/src/base/base_core.h b/src/base/base_core.h index 5aec235..1711155 100644 --- a/src/base/base_core.h +++ b/src/base/base_core.h @@ -2,6 +2,8 @@ #define BASE_CORE_H // Foreigns +#include +#include #include #define global static @@ -50,4 +52,8 @@ typedef double f64; #error Align_Of not defined for this compiler. #endif +// Helpers +// ??(tijani): the calculation of how this works breaks my brain, need to bust out the pen and paper to figure it out. +#define AlignPow2(x, b) (((x) + (b) - 1) & (~((b) - 1))) + #endif // BASE_CORE_H diff --git a/src/base/base_inc.c b/src/base/base_inc.c index 5333492..832b462 100644 --- a/src/base/base_inc.c +++ b/src/base/base_inc.c @@ -1,5 +1,7 @@ // clang-format off + #include "base_core.c" #include "base_arena.c" +#include "base_strings.c" // clang-format on diff --git a/src/base/base_inc.h b/src/base/base_inc.h index f8b54b9..d5ec4dc 100644 --- a/src/base/base_inc.h +++ b/src/base/base_inc.h @@ -7,6 +7,7 @@ #include "base_core.h" #include "base_arena.h" +#include "base_strings.h" // clang-format on diff --git a/src/base/base_stirngs.c b/src/base/base_stirngs.c new file mode 100644 index 0000000..45253b6 --- /dev/null +++ b/src/base/base_stirngs.c @@ -0,0 +1,5 @@ +// String Constructor +internal String8 str8(u8 *str, u64 size) { + String8 result = {str, size}; + return (result); +} diff --git a/src/base/base_strings.h b/src/base/base_strings.h new file mode 100644 index 0000000..29cc290 --- /dev/null +++ b/src/base/base_strings.h @@ -0,0 +1,26 @@ +#ifndef BASE_STRINGS_H +#define BASE_STRINGS_H + +typedef struct String8 String8; +struct String8 { + u8 *str; + u64 size; +}; + +// String list & Array types + +typedef struct String8Node String8Node; +struct String8Node { + String8Node *next; + String8 string; +}; + +typedef struct String8List String8List; +struct String8List { + String8Node *first; + String8Node *last; + u64 node_count; + u64 total_size; +}; + +#endif // BASE_STRINGS_H