strings.
This commit is contained in:
parent
59fcb5f297
commit
cec5e6f938
1
.gitignore
vendored
1
.gitignore
vendored
@ -86,3 +86,4 @@ dkms.conf
|
|||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
*.res
|
@ -2,6 +2,8 @@
|
|||||||
#define BASE_CORE_H
|
#define BASE_CORE_H
|
||||||
|
|
||||||
// Foreigns
|
// Foreigns
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define global static
|
#define global static
|
||||||
@ -50,4 +52,8 @@ typedef double f64;
|
|||||||
#error Align_Of not defined for this compiler.
|
#error Align_Of not defined for this compiler.
|
||||||
#endif
|
#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
|
#endif // BASE_CORE_H
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
#include "base_core.c"
|
#include "base_core.c"
|
||||||
#include "base_arena.c"
|
#include "base_arena.c"
|
||||||
|
#include "base_strings.c"
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "base_core.h"
|
#include "base_core.h"
|
||||||
|
|
||||||
#include "base_arena.h"
|
#include "base_arena.h"
|
||||||
|
#include "base_strings.h"
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
5
src/base/base_stirngs.c
Normal file
5
src/base/base_stirngs.c
Normal 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
26
src/base/base_strings.h
Normal 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
|
Loading…
Reference in New Issue
Block a user