Reorganization

This commit is contained in:
Krzosa Karol
2024-01-06 13:44:50 +01:00
parent 3ed4893ccb
commit f34019efb7
37 changed files with 29 additions and 38 deletions

View File

@@ -3,7 +3,7 @@ call ../misc/compile_setup.bat
mkdir build mkdir build
cd build cd build
cl -Fe:bld.exe ../build_main.cpp -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS /MD cl -Fe:bld.exe ../code/build_main.cpp -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS /MD
cd .. cd ..
build\bld.exe build\bld.exe

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
clang -o bld build_main.cpp -g gcc -o bld code/build_main.cpp -g
./bld ./bld

View File

@@ -1,4 +1,4 @@
#include "build_lib.cpp" #include "code/build_lib.cpp"
Strs cc = ON_WINDOWS("cl") ON_MAC("clang") ON_LINUX("gcc"); Strs cc = ON_WINDOWS("cl") ON_MAC("clang") ON_LINUX("gcc");

View File

@@ -29,7 +29,7 @@ RELEASE_LINK = -opt:ref -opt:icf
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "core.c" #include "../core.c"
#define CL_Arena MA_Arena #define CL_Arena MA_Arena
#define CL_PushSize MA_PushSizeNonZeroed #define CL_PushSize MA_PushSizeNonZeroed

View File

View File

View File

View File

20
core.c
View File

@@ -1,22 +1,22 @@
#include "core.h" #include "core.h"
#define STB_SPRINTF_IMPLEMENTATION #define STB_SPRINTF_IMPLEMENTATION
#include "stb_sprintf.h" #include "code/stb_sprintf.h"
#define IO_VSNPRINTF stbsp_vsnprintf #define IO_VSNPRINTF stbsp_vsnprintf
#define IO_SNPRINTF stbsp_snprintf #define IO_SNPRINTF stbsp_snprintf
#include "io.c" #include "code/io.c"
#define MA_ASSERT(x) IO_Assert(x) #define MA_ASSERT(x) IO_Assert(x)
#include "arena.c" #include "code/arena.c"
#define RE_ASSERT(x) IO_Assert(x) #define RE_ASSERT(x) IO_Assert(x)
#include "regex.c" #include "code/regex.c"
#include "unicode.c" #include "code/unicode.c"
#define S8_VSNPRINTF stbsp_vsnprintf #define S8_VSNPRINTF stbsp_vsnprintf
#define S8_ALLOCATE(allocator, size) MA_PushSize(allocator, size) #define S8_ALLOCATE(allocator, size) MA_PushSize(allocator, size)
#define S8_ASSERT(x) IO_Assert(x) #define S8_ASSERT(x) IO_Assert(x)
#define S8_MemoryCopy MA_MemoryCopy #define S8_MemoryCopy MA_MemoryCopy
#include "string.c" #include "code/string.c"
#define MU_ASSERT IO_Assert #define MU_ASSERT IO_Assert
#include "multimedia.h" #include "code/multimedia.h"
#include "hash.c" #include "code/hash.c"
#include "load_library.c" #include "code/load_library.c"
#include "filesystem.c" #include "code/filesystem.c"

30
core.h
View File

@@ -1,31 +1,31 @@
#pragma once #pragma once
#include "preproc_env.h" #include "code/preproc_env.h"
#include "stb_sprintf.h" #include "code/stb_sprintf.h"
#include "io.h" #include "code/io.h"
#include "arena.h" #include "code/arena.h"
#include "string.h" #include "code/string.h"
#include "unicode.h" #include "code/unicode.h"
#include "hash.h" #include "code/hash.h"
#include "linked_list.h" #include "code/linked_list.h"
#include "regex.h" #include "code/regex.h"
#include "multimedia.h" #include "code/multimedia.h"
#include "load_library.h" #include "code/load_library.h"
#include "filesystem.h" #include "code/filesystem.h"
#ifdef __cplusplus #ifdef __cplusplus
#include "defer.hpp" #include "code/defer.hpp"
#define TABLE_ASSERT IO_Assert #define TABLE_ASSERT IO_Assert
#define TABLE_Allocator M_Allocator #define TABLE_Allocator M_Allocator
#define TABLE_ALLOCATE(allocator, size) M_Alloc(allocator, size) #define TABLE_ALLOCATE(allocator, size) M_Alloc(allocator, size)
#define TABLE_DEALLOCATE(allocator, p) M_Dealloc(allocator, p) #define TABLE_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
#define TABLE_SET_DEFAULT_ALLOCATOR \ #define TABLE_SET_DEFAULT_ALLOCATOR \
if (!allocator.p) allocator = M_GetSystemAllocator(); if (!allocator.p) allocator = M_GetSystemAllocator();
#include "table.hpp" #include "code/table.hpp"
#define ARRAY_ASSERT IO_Assert #define ARRAY_ASSERT IO_Assert
#define ARRAY_Allocator M_Allocator #define ARRAY_Allocator M_Allocator
#define ARRAY_REALLOCATE(allocator, p, size, old_size) M_ReallocNonZeroed(allocator, p, size, old_size) #define ARRAY_REALLOCATE(allocator, p, size, old_size) M_ReallocNonZeroed(allocator, p, size, old_size)
#define ARRAY_DEALLOCATE(allocator, p) M_Dealloc(allocator, p) #define ARRAY_DEALLOCATE(allocator, p) M_Dealloc(allocator, p)
#define ARRAY_SET_DEFAULT_ALLOCATOR \ #define ARRAY_SET_DEFAULT_ALLOCATOR \
if (!allocator.p) allocator = M_GetSystemAllocator(); if (!allocator.p) allocator = M_GetSystemAllocator();
#include "array.hpp" #include "code/array.hpp"
#endif #endif

View File

@@ -71,11 +71,9 @@ void TestBootstrapExclusive() {
} }
int main() { int main() {
IO_Printf("test_arena.cpp - ");
TestScratch(); TestScratch();
TestBuffer(); TestBuffer();
TestCreateAllocate(); TestCreateAllocate();
TestBootstrap(); TestBootstrap();
TestBootstrapExclusive(); TestBootstrapExclusive();
IO_Printf("DONE\n");
} }

View File

@@ -117,13 +117,10 @@ void TestCopy() {
} }
int main() { int main() {
IO_Printf("test_array.cpp - ");
TestExclusiveArenaBackedArray(); TestExclusiveArenaBackedArray();
TestRemoveForLoop(); TestRemoveForLoop();
TestBasic(); TestBasic();
TestReverseLoop(); TestReverseLoop();
TestCopy(); TestCopy();
IO_Printf("DONE\n");
return 0; return 0;
} }

View File

@@ -1,7 +1,6 @@
#include "../core.c" #include "../core.c"
int main() { int main() {
IO_Printf("test_filesystem.c - ");
MA_Arena arena = {0}; MA_Arena arena = {0};
S8_String read_file_path = S8_Lit("../test/data/read_file"); S8_String read_file_path = S8_Lit("../test/data/read_file");
@@ -103,5 +102,4 @@ int main() {
} }
} }
} }
IO_Printf("DONE\n");
} }

View File

@@ -37,9 +37,7 @@ void TestStrings() {
} }
int main() { int main() {
IO_Printf("test_table.cpp - ");
TestSimpleInsertAndIntegrity(); TestSimpleInsertAndIntegrity();
TestStrings(); TestStrings();
IO_Printf("DONE\n");
return 0; return 0;
} }