From f34019efb79b5e555b310d2533bd78b5153a0115 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 6 Jan 2024 13:44:50 +0100 Subject: [PATCH] Reorganization --- build.bat | 2 +- build.sh | 2 +- build_file.cpp | 2 +- arena.c => code/arena.c | 0 arena.h => code/arena.h | 0 array.hpp => code/array.hpp | 0 build_lib.cpp => code/build_lib.cpp | 2 +- build_main.cpp => code/build_main.cpp | 0 clexer.c => code/clexer.c | 0 clexer.h => code/clexer.h | 0 defer.hpp => code/defer.hpp | 0 filesystem.c => code/filesystem.c | 0 filesystem.h => code/filesystem.h | 0 hash.c => code/hash.c | 0 hash.h => code/hash.h | 0 io.c => code/io.c | 0 io.h => code/io.h | 0 linked_list.h => code/linked_list.h | 0 load_library.c => code/load_library.c | 0 load_library.h => code/load_library.h | 0 multimedia.c => code/multimedia.c | 0 multimedia.h => code/multimedia.h | 0 preproc_env.h => code/preproc_env.h | 0 regex.c => code/regex.c | 0 regex.h => code/regex.h | 0 stb_sprintf.h => code/stb_sprintf.h | 0 string.c => code/string.c | 0 string.h => code/string.h | 0 table.hpp => code/table.hpp | 0 unicode.c => code/unicode.c | 0 unicode.h => code/unicode.h | 0 core.c | 20 +++++++++--------- core.h | 30 +++++++++++++-------------- test/test_arena.cpp | 2 -- test/test_array.cpp | 3 --- test/test_filesystem.c | 2 -- test/test_table.cpp | 2 -- 37 files changed, 29 insertions(+), 38 deletions(-) rename arena.c => code/arena.c (100%) rename arena.h => code/arena.h (100%) rename array.hpp => code/array.hpp (100%) rename build_lib.cpp => code/build_lib.cpp (99%) rename build_main.cpp => code/build_main.cpp (100%) rename clexer.c => code/clexer.c (100%) rename clexer.h => code/clexer.h (100%) rename defer.hpp => code/defer.hpp (100%) rename filesystem.c => code/filesystem.c (100%) rename filesystem.h => code/filesystem.h (100%) rename hash.c => code/hash.c (100%) rename hash.h => code/hash.h (100%) rename io.c => code/io.c (100%) rename io.h => code/io.h (100%) rename linked_list.h => code/linked_list.h (100%) rename load_library.c => code/load_library.c (100%) rename load_library.h => code/load_library.h (100%) rename multimedia.c => code/multimedia.c (100%) rename multimedia.h => code/multimedia.h (100%) rename preproc_env.h => code/preproc_env.h (100%) rename regex.c => code/regex.c (100%) rename regex.h => code/regex.h (100%) rename stb_sprintf.h => code/stb_sprintf.h (100%) rename string.c => code/string.c (100%) rename string.h => code/string.h (100%) rename table.hpp => code/table.hpp (100%) rename unicode.c => code/unicode.c (100%) rename unicode.h => code/unicode.h (100%) diff --git a/build.bat b/build.bat index 74c0d38..edca8de 100644 --- a/build.bat +++ b/build.bat @@ -3,7 +3,7 @@ call ../misc/compile_setup.bat mkdir 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 .. build\bld.exe diff --git a/build.sh b/build.sh index 601f431..2949aac 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -clang -o bld build_main.cpp -g +gcc -o bld code/build_main.cpp -g ./bld diff --git a/build_file.cpp b/build_file.cpp index eac76c5..de2eeb2 100644 --- a/build_file.cpp +++ b/build_file.cpp @@ -1,4 +1,4 @@ -#include "build_lib.cpp" +#include "code/build_lib.cpp" Strs cc = ON_WINDOWS("cl") ON_MAC("clang") ON_LINUX("gcc"); diff --git a/arena.c b/code/arena.c similarity index 100% rename from arena.c rename to code/arena.c diff --git a/arena.h b/code/arena.h similarity index 100% rename from arena.h rename to code/arena.h diff --git a/array.hpp b/code/array.hpp similarity index 100% rename from array.hpp rename to code/array.hpp diff --git a/build_lib.cpp b/code/build_lib.cpp similarity index 99% rename from build_lib.cpp rename to code/build_lib.cpp index 9730e4b..97ded14 100644 --- a/build_lib.cpp +++ b/code/build_lib.cpp @@ -29,7 +29,7 @@ RELEASE_LINK = -opt:ref -opt:icf #define _CRT_SECURE_NO_WARNINGS #endif -#include "core.c" +#include "../core.c" #define CL_Arena MA_Arena #define CL_PushSize MA_PushSizeNonZeroed diff --git a/build_main.cpp b/code/build_main.cpp similarity index 100% rename from build_main.cpp rename to code/build_main.cpp diff --git a/clexer.c b/code/clexer.c similarity index 100% rename from clexer.c rename to code/clexer.c diff --git a/clexer.h b/code/clexer.h similarity index 100% rename from clexer.h rename to code/clexer.h diff --git a/defer.hpp b/code/defer.hpp similarity index 100% rename from defer.hpp rename to code/defer.hpp diff --git a/filesystem.c b/code/filesystem.c similarity index 100% rename from filesystem.c rename to code/filesystem.c diff --git a/filesystem.h b/code/filesystem.h similarity index 100% rename from filesystem.h rename to code/filesystem.h diff --git a/hash.c b/code/hash.c similarity index 100% rename from hash.c rename to code/hash.c diff --git a/hash.h b/code/hash.h similarity index 100% rename from hash.h rename to code/hash.h diff --git a/io.c b/code/io.c similarity index 100% rename from io.c rename to code/io.c diff --git a/io.h b/code/io.h similarity index 100% rename from io.h rename to code/io.h diff --git a/linked_list.h b/code/linked_list.h similarity index 100% rename from linked_list.h rename to code/linked_list.h diff --git a/load_library.c b/code/load_library.c similarity index 100% rename from load_library.c rename to code/load_library.c diff --git a/load_library.h b/code/load_library.h similarity index 100% rename from load_library.h rename to code/load_library.h diff --git a/multimedia.c b/code/multimedia.c similarity index 100% rename from multimedia.c rename to code/multimedia.c diff --git a/multimedia.h b/code/multimedia.h similarity index 100% rename from multimedia.h rename to code/multimedia.h diff --git a/preproc_env.h b/code/preproc_env.h similarity index 100% rename from preproc_env.h rename to code/preproc_env.h diff --git a/regex.c b/code/regex.c similarity index 100% rename from regex.c rename to code/regex.c diff --git a/regex.h b/code/regex.h similarity index 100% rename from regex.h rename to code/regex.h diff --git a/stb_sprintf.h b/code/stb_sprintf.h similarity index 100% rename from stb_sprintf.h rename to code/stb_sprintf.h diff --git a/string.c b/code/string.c similarity index 100% rename from string.c rename to code/string.c diff --git a/string.h b/code/string.h similarity index 100% rename from string.h rename to code/string.h diff --git a/table.hpp b/code/table.hpp similarity index 100% rename from table.hpp rename to code/table.hpp diff --git a/unicode.c b/code/unicode.c similarity index 100% rename from unicode.c rename to code/unicode.c diff --git a/unicode.h b/code/unicode.h similarity index 100% rename from unicode.h rename to code/unicode.h diff --git a/core.c b/core.c index db9d9de..65da400 100644 --- a/core.c +++ b/core.c @@ -1,22 +1,22 @@ #include "core.h" #define STB_SPRINTF_IMPLEMENTATION -#include "stb_sprintf.h" +#include "code/stb_sprintf.h" #define IO_VSNPRINTF stbsp_vsnprintf #define IO_SNPRINTF stbsp_snprintf -#include "io.c" +#include "code/io.c" #define MA_ASSERT(x) IO_Assert(x) -#include "arena.c" +#include "code/arena.c" #define RE_ASSERT(x) IO_Assert(x) -#include "regex.c" -#include "unicode.c" +#include "code/regex.c" +#include "code/unicode.c" #define S8_VSNPRINTF stbsp_vsnprintf #define S8_ALLOCATE(allocator, size) MA_PushSize(allocator, size) #define S8_ASSERT(x) IO_Assert(x) #define S8_MemoryCopy MA_MemoryCopy -#include "string.c" +#include "code/string.c" #define MU_ASSERT IO_Assert -#include "multimedia.h" -#include "hash.c" -#include "load_library.c" -#include "filesystem.c" +#include "code/multimedia.h" +#include "code/hash.c" +#include "code/load_library.c" +#include "code/filesystem.c" diff --git a/core.h b/core.h index c2cb245..77c92ff 100644 --- a/core.h +++ b/core.h @@ -1,31 +1,31 @@ #pragma once -#include "preproc_env.h" -#include "stb_sprintf.h" -#include "io.h" -#include "arena.h" -#include "string.h" -#include "unicode.h" -#include "hash.h" -#include "linked_list.h" -#include "regex.h" -#include "multimedia.h" -#include "load_library.h" -#include "filesystem.h" +#include "code/preproc_env.h" +#include "code/stb_sprintf.h" +#include "code/io.h" +#include "code/arena.h" +#include "code/string.h" +#include "code/unicode.h" +#include "code/hash.h" +#include "code/linked_list.h" +#include "code/regex.h" +#include "code/multimedia.h" +#include "code/load_library.h" +#include "code/filesystem.h" #ifdef __cplusplus - #include "defer.hpp" + #include "code/defer.hpp" #define TABLE_ASSERT IO_Assert #define TABLE_Allocator M_Allocator #define TABLE_ALLOCATE(allocator, size) M_Alloc(allocator, size) #define TABLE_DEALLOCATE(allocator, p) M_Dealloc(allocator, p) #define TABLE_SET_DEFAULT_ALLOCATOR \ if (!allocator.p) allocator = M_GetSystemAllocator(); - #include "table.hpp" + #include "code/table.hpp" #define ARRAY_ASSERT IO_Assert #define ARRAY_Allocator M_Allocator #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_SET_DEFAULT_ALLOCATOR \ if (!allocator.p) allocator = M_GetSystemAllocator(); - #include "array.hpp" + #include "code/array.hpp" #endif diff --git a/test/test_arena.cpp b/test/test_arena.cpp index 5e89c90..b061d13 100644 --- a/test/test_arena.cpp +++ b/test/test_arena.cpp @@ -71,11 +71,9 @@ void TestBootstrapExclusive() { } int main() { - IO_Printf("test_arena.cpp - "); TestScratch(); TestBuffer(); TestCreateAllocate(); TestBootstrap(); TestBootstrapExclusive(); - IO_Printf("DONE\n"); } \ No newline at end of file diff --git a/test/test_array.cpp b/test/test_array.cpp index d2cf480..7a66766 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -117,13 +117,10 @@ void TestCopy() { } int main() { - IO_Printf("test_array.cpp - "); TestExclusiveArenaBackedArray(); TestRemoveForLoop(); TestBasic(); TestReverseLoop(); TestCopy(); - IO_Printf("DONE\n"); - return 0; } \ No newline at end of file diff --git a/test/test_filesystem.c b/test/test_filesystem.c index ecf3363..a1384bd 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -1,7 +1,6 @@ #include "../core.c" int main() { - IO_Printf("test_filesystem.c - "); MA_Arena arena = {0}; S8_String read_file_path = S8_Lit("../test/data/read_file"); @@ -103,5 +102,4 @@ int main() { } } } - IO_Printf("DONE\n"); } \ No newline at end of file diff --git a/test/test_table.cpp b/test/test_table.cpp index 2b67cf5..9ae6d22 100644 --- a/test/test_table.cpp +++ b/test/test_table.cpp @@ -37,9 +37,7 @@ void TestStrings() { } int main() { - IO_Printf("test_table.cpp - "); TestSimpleInsertAndIntegrity(); TestStrings(); - IO_Printf("DONE\n"); return 0; } \ No newline at end of file