This commit is contained in:
Tijani Lawal 2024-08-06 14:23:56 -05:00
parent 59fcb5f297
commit cec5e6f938
6 changed files with 41 additions and 0 deletions

1
.gitignore vendored
View File

@ -86,3 +86,4 @@ dkms.conf
*.out
*.app
*.res

View File

@ -2,6 +2,8 @@
#define BASE_CORE_H
// Foreigns
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#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

View File

@ -1,5 +1,7 @@
// clang-format off
#include "base_core.c"
#include "base_arena.c"
#include "base_strings.c"
// clang-format on

View File

@ -7,6 +7,7 @@
#include "base_core.h"
#include "base_arena.h"
#include "base_strings.h"
// clang-format on

5
src/base/base_stirngs.c Normal file
View File

@ -0,0 +1,5 @@
// String Constructor
internal String8 str8(u8 *str, u64 size) {
String8 result = {str, size};
return (result);
}

26
src/base/base_strings.h Normal file
View File

@ -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