From dde2334f95127804a66837a6efdd4555d02c91ce Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Fri, 12 Jan 2024 10:10:09 +0100 Subject: [PATCH] Reorganization --- .github/workflows/run-tests.yml | 4 +-- build.bat | 2 +- build.sh | 2 +- build_file.cpp | 2 +- {tools => build_tool}/build_lib.cpp | 2 +- {tools => build_tool}/build_main.cpp | 0 core.c | 20 +++++++------- core.h | 30 ++++++++++----------- {code => filesystem}/filesystem.c | 0 {code => filesystem}/filesystem.h | 0 {code => standalone_modules}/arena.c | 0 {code => standalone_modules}/arena.h | 0 {code => standalone_modules}/array.hpp | 0 {code => standalone_modules}/clexer.c | 0 {code => standalone_modules}/clexer.h | 0 {code => standalone_modules}/defer.hpp | 0 {code => standalone_modules}/hash.c | 0 {code => standalone_modules}/hash.h | 0 {code => standalone_modules}/io.c | 0 {code => standalone_modules}/io.h | 0 {code => standalone_modules}/linked_list.h | 0 {code => standalone_modules}/load_library.c | 0 {code => standalone_modules}/load_library.h | 0 {code => standalone_modules}/multimedia.c | 0 {code => standalone_modules}/multimedia.h | 0 {code => standalone_modules}/preproc_env.h | 0 {code => standalone_modules}/regex.c | 0 {code => standalone_modules}/regex.h | 0 {code => standalone_modules}/stb_sprintf.h | 0 {code => standalone_modules}/string.c | 0 {code => standalone_modules}/string.h | 0 {code => standalone_modules}/table.hpp | 0 {code => standalone_modules}/unicode.c | 0 {code => standalone_modules}/unicode.h | 0 34 files changed, 31 insertions(+), 31 deletions(-) rename {tools => build_tool}/build_lib.cpp (99%) rename {tools => build_tool}/build_main.cpp (100%) rename {code => filesystem}/filesystem.c (100%) rename {code => filesystem}/filesystem.h (100%) rename {code => standalone_modules}/arena.c (100%) rename {code => standalone_modules}/arena.h (100%) rename {code => standalone_modules}/array.hpp (100%) rename {code => standalone_modules}/clexer.c (100%) rename {code => standalone_modules}/clexer.h (100%) rename {code => standalone_modules}/defer.hpp (100%) rename {code => standalone_modules}/hash.c (100%) rename {code => standalone_modules}/hash.h (100%) rename {code => standalone_modules}/io.c (100%) rename {code => standalone_modules}/io.h (100%) rename {code => standalone_modules}/linked_list.h (100%) rename {code => standalone_modules}/load_library.c (100%) rename {code => standalone_modules}/load_library.h (100%) rename {code => standalone_modules}/multimedia.c (100%) rename {code => standalone_modules}/multimedia.h (100%) rename {code => standalone_modules}/preproc_env.h (100%) rename {code => standalone_modules}/regex.c (100%) rename {code => standalone_modules}/regex.h (100%) rename {code => standalone_modules}/stb_sprintf.h (100%) rename {code => standalone_modules}/string.c (100%) rename {code => standalone_modules}/string.h (100%) rename {code => standalone_modules}/table.hpp (100%) rename {code => standalone_modules}/unicode.c (100%) rename {code => standalone_modules}/unicode.h (100%) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 45c0af2..fa7252e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -5,13 +5,13 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo apt install g++ - - run: g++ tools/build_main.cpp -o bld && ./bld + - run: g++ build_tool/build_main.cpp -o bld && ./bld run-and-compile-mac: runs-on: macos-latest steps: - uses: actions/checkout@v4 - run: brew install llvm - - run: clang++ tools/build_main.cpp -std=c++11 -o bld && ./bld + - run: clang++ build_tool/build_main.cpp -std=c++11 -o bld && ./bld run-and-compile-windows: runs-on: windows-latest steps: diff --git a/build.bat b/build.bat index 1f0eb17..308ef81 100644 --- a/build.bat +++ b/build.bat @@ -3,6 +3,6 @@ call ../misc/compile_setup.bat mkdir build cd build -cl -Fe:bld.exe ../tools/build_main.cpp -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS +cl -Fe:bld.exe ../build_tool/build_main.cpp -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS cd .. build\bld.exe diff --git a/build.sh b/build.sh index e73a0fc..f877c23 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -gcc -o bld tools/build_main.cpp -g +gcc -o bld build_tool/build_main.cpp -g ./bld diff --git a/build_file.cpp b/build_file.cpp index 2790bc0..f986ed8 100644 --- a/build_file.cpp +++ b/build_file.cpp @@ -1,4 +1,4 @@ -#include "tools/build_lib.cpp" +#include "build_tool/build_lib.cpp" void CompileFiles(Strs cc, Strs files); int ReturnValue = 0; diff --git a/tools/build_lib.cpp b/build_tool/build_lib.cpp similarity index 99% rename from tools/build_lib.cpp rename to build_tool/build_lib.cpp index d6a5d41..84c660d 100644 --- a/tools/build_lib.cpp +++ b/build_tool/build_lib.cpp @@ -41,7 +41,7 @@ DEBUG = -fsanitize=address #define CL_VSNPRINTF stbsp_vsnprintf #define CL_SNPRINTF stbsp_snprintf #define AND_CL_STRING_TERMINATE_ON_NEW_LINE -#include "../code/clexer.c" +#include "../standalone_modules/clexer.c" #define SRC_CACHE_ENTRY_COUNT 1024 struct SRC_CacheEntry { diff --git a/tools/build_main.cpp b/build_tool/build_main.cpp similarity index 100% rename from tools/build_main.cpp rename to build_tool/build_main.cpp diff --git a/core.c b/core.c index 65da400..536c5e2 100644 --- a/core.c +++ b/core.c @@ -1,22 +1,22 @@ #include "core.h" #define STB_SPRINTF_IMPLEMENTATION -#include "code/stb_sprintf.h" +#include "standalone_modules/stb_sprintf.h" #define IO_VSNPRINTF stbsp_vsnprintf #define IO_SNPRINTF stbsp_snprintf -#include "code/io.c" +#include "standalone_modules/io.c" #define MA_ASSERT(x) IO_Assert(x) -#include "code/arena.c" +#include "standalone_modules/arena.c" #define RE_ASSERT(x) IO_Assert(x) -#include "code/regex.c" -#include "code/unicode.c" +#include "standalone_modules/regex.c" +#include "standalone_modules/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 "code/string.c" +#include "standalone_modules/string.c" #define MU_ASSERT IO_Assert -#include "code/multimedia.h" -#include "code/hash.c" -#include "code/load_library.c" -#include "code/filesystem.c" +#include "standalone_modules/multimedia.h" +#include "standalone_modules/hash.c" +#include "standalone_modules/load_library.c" +#include "filesystem/filesystem.c" diff --git a/core.h b/core.h index 77c92ff..a7b9e13 100644 --- a/core.h +++ b/core.h @@ -1,31 +1,31 @@ #pragma once -#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" +#include "standalone_modules/preproc_env.h" +#include "standalone_modules/stb_sprintf.h" +#include "standalone_modules/io.h" +#include "standalone_modules/arena.h" +#include "standalone_modules/string.h" +#include "standalone_modules/unicode.h" +#include "standalone_modules/hash.h" +#include "standalone_modules/linked_list.h" +#include "standalone_modules/regex.h" +#include "standalone_modules/multimedia.h" +#include "standalone_modules/load_library.h" +#include "filesystem/filesystem.h" #ifdef __cplusplus - #include "code/defer.hpp" + #include "standalone_modules/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 "code/table.hpp" + #include "standalone_modules/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 "code/array.hpp" + #include "standalone_modules/array.hpp" #endif diff --git a/code/filesystem.c b/filesystem/filesystem.c similarity index 100% rename from code/filesystem.c rename to filesystem/filesystem.c diff --git a/code/filesystem.h b/filesystem/filesystem.h similarity index 100% rename from code/filesystem.h rename to filesystem/filesystem.h diff --git a/code/arena.c b/standalone_modules/arena.c similarity index 100% rename from code/arena.c rename to standalone_modules/arena.c diff --git a/code/arena.h b/standalone_modules/arena.h similarity index 100% rename from code/arena.h rename to standalone_modules/arena.h diff --git a/code/array.hpp b/standalone_modules/array.hpp similarity index 100% rename from code/array.hpp rename to standalone_modules/array.hpp diff --git a/code/clexer.c b/standalone_modules/clexer.c similarity index 100% rename from code/clexer.c rename to standalone_modules/clexer.c diff --git a/code/clexer.h b/standalone_modules/clexer.h similarity index 100% rename from code/clexer.h rename to standalone_modules/clexer.h diff --git a/code/defer.hpp b/standalone_modules/defer.hpp similarity index 100% rename from code/defer.hpp rename to standalone_modules/defer.hpp diff --git a/code/hash.c b/standalone_modules/hash.c similarity index 100% rename from code/hash.c rename to standalone_modules/hash.c diff --git a/code/hash.h b/standalone_modules/hash.h similarity index 100% rename from code/hash.h rename to standalone_modules/hash.h diff --git a/code/io.c b/standalone_modules/io.c similarity index 100% rename from code/io.c rename to standalone_modules/io.c diff --git a/code/io.h b/standalone_modules/io.h similarity index 100% rename from code/io.h rename to standalone_modules/io.h diff --git a/code/linked_list.h b/standalone_modules/linked_list.h similarity index 100% rename from code/linked_list.h rename to standalone_modules/linked_list.h diff --git a/code/load_library.c b/standalone_modules/load_library.c similarity index 100% rename from code/load_library.c rename to standalone_modules/load_library.c diff --git a/code/load_library.h b/standalone_modules/load_library.h similarity index 100% rename from code/load_library.h rename to standalone_modules/load_library.h diff --git a/code/multimedia.c b/standalone_modules/multimedia.c similarity index 100% rename from code/multimedia.c rename to standalone_modules/multimedia.c diff --git a/code/multimedia.h b/standalone_modules/multimedia.h similarity index 100% rename from code/multimedia.h rename to standalone_modules/multimedia.h diff --git a/code/preproc_env.h b/standalone_modules/preproc_env.h similarity index 100% rename from code/preproc_env.h rename to standalone_modules/preproc_env.h diff --git a/code/regex.c b/standalone_modules/regex.c similarity index 100% rename from code/regex.c rename to standalone_modules/regex.c diff --git a/code/regex.h b/standalone_modules/regex.h similarity index 100% rename from code/regex.h rename to standalone_modules/regex.h diff --git a/code/stb_sprintf.h b/standalone_modules/stb_sprintf.h similarity index 100% rename from code/stb_sprintf.h rename to standalone_modules/stb_sprintf.h diff --git a/code/string.c b/standalone_modules/string.c similarity index 100% rename from code/string.c rename to standalone_modules/string.c diff --git a/code/string.h b/standalone_modules/string.h similarity index 100% rename from code/string.h rename to standalone_modules/string.h diff --git a/code/table.hpp b/standalone_modules/table.hpp similarity index 100% rename from code/table.hpp rename to standalone_modules/table.hpp diff --git a/code/unicode.c b/standalone_modules/unicode.c similarity index 100% rename from code/unicode.c rename to standalone_modules/unicode.c diff --git a/code/unicode.h b/standalone_modules/unicode.h similarity index 100% rename from code/unicode.h rename to standalone_modules/unicode.h