From 4b95a681d4f6a56447f16f8fd2e3aaf4ca5cd099 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Tue, 16 Dec 2025 17:36:50 +0000 Subject: [PATCH] Restructure the library layers --- Makefile | 30 +++++++++---------- codegen/dbl_list/make_dbl_list.py | 2 +- src/{primitives => base}/array/array.c | 2 +- src/{primitives => base}/array/array.h | 2 +- src/{primitives => base}/dbl_list/dbl_list.c | 0 src/{primitives => base}/dbl_list/dbl_list.h | 0 .../mem/allocator}/mem_allocator.c | 4 +-- .../mem/allocator}/mem_allocator.h | 4 +-- src/{core => base}/mem/utils/mem_utils.c | 0 src/{core => base}/mem/utils/mem_utils.h | 0 src/{primitives => base}/strings/str8/str8.c | 2 +- src/{primitives => base}/strings/str8/str8.h | 6 ++-- src/base/wapp_base.c | 13 ++++++++ .../wapp_primitives.h => base/wapp_base.h} | 9 +++--- src/core/wapp_core.c | 23 -------------- src/core/wapp_core.h | 23 -------------- .../mem => os/allocators}/arena/mem_arena.c | 4 +-- .../mem => os/allocators}/arena/mem_arena.h | 2 +- .../allocators}/arena/mem_arena_allocator.c | 2 +- .../allocators}/arena/mem_arena_allocator.h | 4 +-- src/{core => }/os/cpath/cpath.c | 12 ++++---- src/{core => }/os/cpath/cpath.h | 8 ++--- src/{core => os}/file/file.c | 6 ++-- src/{core => os}/file/file.h | 2 +- src/{core => }/os/mem/mem_os.c | 4 +-- src/{core => }/os/mem/mem_os.h | 4 +-- src/{core => }/os/mem/mem_os_ops.h | 2 +- src/{core => }/os/mem/posix/mem_os_posix.c | 4 +-- src/{core => }/os/mem/posix/mem_os_posix.h | 2 +- src/{core => }/os/mem/win/mem_os_win.c | 4 +-- src/{core => }/os/mem/win/mem_os_win.h | 2 +- src/{core => }/os/shell/commander/commander.c | 12 ++++---- src/{core => }/os/shell/commander/commander.h | 6 ++-- .../os/shell/commander/commander_output.h | 4 +-- .../shell/commander/posix/commander_posix.c | 4 +-- .../os/shell/commander/win/commander_win.c | 4 +-- .../shell/termcolour/posix/termcolour_posix.c | 6 ++-- .../os/shell/termcolour/termcolour.c | 2 +- .../os/shell/termcolour/termcolour.h | 6 ++-- .../os/shell/termcolour/terminal_colours.h | 4 +-- .../os/shell/termcolour/win/termcolour_win.c | 6 ++-- src/{core => }/os/shell/utils/shell_utils.h | 4 +-- src/os/wapp_os.c | 22 ++++++++++++++ src/os/wapp_os.h | 22 ++++++++++++++ src/primitives/wapp_primitives.c | 12 -------- src/testing/tester/tester.c | 4 +-- src/testing/tester/tester.h | 2 +- src/testing/wapp_testing.c | 2 +- src/testing/wapp_testing.h | 2 +- src/uuid/uuid.c | 2 +- src/uuid/uuid.h | 2 +- src/uuid/wapp_uuid.c | 2 +- src/uuid/wapp_uuid.h | 2 +- src/wapp.c | 4 +-- src/wapp.h | 4 +-- 55 files changed, 161 insertions(+), 161 deletions(-) rename src/{primitives => base}/array/array.c (99%) rename src/{primitives => base}/array/array.h (99%) rename src/{primitives => base}/dbl_list/dbl_list.c (100%) rename src/{primitives => base}/dbl_list/dbl_list.h (100%) rename src/{primitives/mem_allocator => base/mem/allocator}/mem_allocator.c (94%) rename src/{primitives/mem_allocator => base/mem/allocator}/mem_allocator.h (95%) rename src/{core => base}/mem/utils/mem_utils.c (100%) rename src/{core => base}/mem/utils/mem_utils.h (100%) rename src/{primitives => base}/strings/str8/str8.c (99%) rename src/{primitives => base}/strings/str8/str8.h (97%) create mode 100644 src/base/wapp_base.c rename src/{primitives/wapp_primitives.h => base/wapp_base.h} (55%) delete mode 100644 src/core/wapp_core.c delete mode 100644 src/core/wapp_core.h rename src/{core/mem => os/allocators}/arena/mem_arena.c (98%) rename src/{core/mem => os/allocators}/arena/mem_arena.h (98%) rename src/{core/mem => os/allocators}/arena/mem_arena_allocator.c (98%) rename src/{core/mem => os/allocators}/arena/mem_arena_allocator.h (95%) rename src/{core => }/os/cpath/cpath.c (91%) rename src/{core => }/os/cpath/cpath.h (82%) rename src/{core => os}/file/file.c (96%) rename src/{core => os}/file/file.h (97%) rename src/{core => }/os/mem/mem_os.c (87%) rename src/{core => }/os/mem/mem_os.h (89%) rename src/{core => }/os/mem/mem_os_ops.h (92%) rename src/{core => }/os/mem/posix/mem_os_posix.c (91%) rename src/{core => }/os/mem/posix/mem_os_posix.h (94%) rename src/{core => }/os/mem/win/mem_os_win.c (91%) rename src/{core => }/os/mem/win/mem_os_win.h (91%) rename src/{core => }/os/shell/commander/commander.c (89%) rename src/{core => }/os/shell/commander/commander.h (79%) rename src/{core => }/os/shell/commander/commander_output.h (89%) rename src/{core => }/os/shell/commander/posix/commander_posix.c (81%) rename src/{core => }/os/shell/commander/win/commander_win.c (81%) rename src/{core => }/os/shell/termcolour/posix/termcolour_posix.c (91%) rename src/{core => }/os/shell/termcolour/termcolour.c (89%) rename src/{core => }/os/shell/termcolour/termcolour.h (76%) rename src/{core => }/os/shell/termcolour/terminal_colours.h (89%) rename src/{core => }/os/shell/termcolour/win/termcolour_win.c (94%) rename src/{core => }/os/shell/utils/shell_utils.h (84%) create mode 100644 src/os/wapp_os.c create mode 100644 src/os/wapp_os.h delete mode 100644 src/primitives/wapp_primitives.c diff --git a/Makefile b/Makefile index d7af691..306b40b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help full prng testing uuid core primitives all clean builddir build-test run-test codegen install build-lib ccodegen +.PHONY: help full base os prng testing uuid all clean builddir build-test run-test codegen install build-lib ccodegen # External variables CC = clang @@ -113,38 +113,38 @@ help: @$(ECHO_E) "$(BOLD)$(BLUE)Available targets:$(RESET)" @$(ECHO_E) " $(GREEN)make$(RESET) Build, install and test the full wapp library." @$(ECHO_E) " $(GREEN)make full$(RESET) Build and install the full wapp library." - @$(ECHO_E) " $(GREEN)make core$(RESET) Build and install only the $(CYAN)core$(RESET) component of the wapp library with all its dependencies." + @$(ECHO_E) " $(GREEN)make base$(RESET) Build and install only the $(CYAN)base$(RESET) component of the wapp library with all its dependencies." + @$(ECHO_E) " $(GREEN)make os$(RESET) Build and install only the $(CYAN)os$(RESET) component of the wapp library with all its dependencies." @$(ECHO_E) " $(GREEN)make prng$(RESET) Build and install only the $(CYAN)prng$(RESET) component of the wapp library with all its dependencies." @$(ECHO_E) " $(GREEN)make uuid$(RESET) Build and install only the $(CYAN)uuid$(RESET) component of the wapp library with all its dependencies." @$(ECHO_E) " $(GREEN)make testing$(RESET) Build and install only the $(CYAN)testing$(RESET) component of the wapp library with all its dependencies." - @$(ECHO_E) " $(GREEN)make primitives$(RESET) Build and install only the $(CYAN)primitives$(RESET) component of the wapp library with all its dependencies." @$(ECHO_E) " $(GREEN)make clean$(RESET) Clean the build directory." @$(ECHO_E) " $(GREEN)make help$(RESET) Print this help message and exit." full: LIB_SRC = src/wapp.c -full: INCLUDES = common core primitives prng testing uuid +full: INCLUDES = common os base prng testing uuid full: install +base: LIB_SRC = src/base/wapp_base.c +base: INCLUDES = common base +base: install + +os: LIB_SRC = src/os/wapp_os.c +os: INCLUDES = common os base +os: install + prng: LIB_SRC = src/prng/wapp_prng.c prng: INCLUDES = common prng prng: install testing: LIB_SRC = src/testing/wapp_testing.c -testing: INCLUDES = common core testing +testing: INCLUDES = common os testing testing: install uuid: LIB_SRC = src/uuid/wapp_uuid.c -uuid: INCLUDES = common primitives prng +uuid: INCLUDES = common base prng uuid: install -core: LIB_SRC = src/core/wapp_core.c -core: INCLUDES = common core primitives -core: install - -primitives: LIB_SRC = src/primitives/wapp_primitives.c -primitives: INCLUDES = common primitives -primitives: install - clean: @rm -rf "$(BUILD_DIR)" @@ -182,4 +182,4 @@ build-lib: builddir @rm "$(OBJ_OUT)" ccodegen: - $(CC) $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(LIBFLAGS) -Isrc/core src/core/wapp_core.c ccodegen/*.c -o ccgen + $(CC) $(CSTD) $(CFLAGS) $(BUILD_FLAGS) $(LIBFLAGS) -Isrc/os src/os/wapp_os.c ccodegen/*.c -o ccgen diff --git a/codegen/dbl_list/make_dbl_list.py b/codegen/dbl_list/make_dbl_list.py index 975cac7..775d313 100644 --- a/codegen/dbl_list/make_dbl_list.py +++ b/codegen/dbl_list/make_dbl_list.py @@ -53,7 +53,7 @@ def make_dbl_list(user_datatypes: Dict[CDataType, DblListData] = {}): Tlower=type_string_lower, ) - out_dir = WAPP_SRC_ROOT / "primitives" / "dbl_list" + out_dir = WAPP_SRC_ROOT / "base" / "dbl_list" out_dir.mkdir(parents=True, exist_ok=True) common_decl_types: List[CStruct] = [] diff --git a/src/primitives/array/array.c b/src/base/array/array.c similarity index 99% rename from src/primitives/array/array.c rename to src/base/array/array.c index 87e0124..445eff4 100644 --- a/src/primitives/array/array.c +++ b/src/base/array/array.c @@ -2,7 +2,7 @@ #include "./array.h" #include "../../common/assert/assert.h" -#include "../mem_allocator/mem_allocator.h" +#include "../mem/allocator/mem_allocator.h" #include "../../common/misc/misc_utils.h" #include "../../common/aliases/aliases.h" #include diff --git a/src/primitives/array/array.h b/src/base/array/array.h similarity index 99% rename from src/primitives/array/array.h rename to src/base/array/array.h index 7845bfd..115cfbf 100644 --- a/src/primitives/array/array.h +++ b/src/base/array/array.h @@ -3,7 +3,7 @@ #ifndef ARRAY_H #define ARRAY_H -#include "../mem_allocator/mem_allocator.h" +#include "../mem/allocator/mem_allocator.h" #include "../../common/misc/misc_utils.h" #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" diff --git a/src/primitives/dbl_list/dbl_list.c b/src/base/dbl_list/dbl_list.c similarity index 100% rename from src/primitives/dbl_list/dbl_list.c rename to src/base/dbl_list/dbl_list.c diff --git a/src/primitives/dbl_list/dbl_list.h b/src/base/dbl_list/dbl_list.h similarity index 100% rename from src/primitives/dbl_list/dbl_list.h rename to src/base/dbl_list/dbl_list.h diff --git a/src/primitives/mem_allocator/mem_allocator.c b/src/base/mem/allocator/mem_allocator.c similarity index 94% rename from src/primitives/mem_allocator/mem_allocator.c rename to src/base/mem/allocator/mem_allocator.c index c551576..89e14ec 100644 --- a/src/primitives/mem_allocator/mem_allocator.c +++ b/src/base/mem/allocator/mem_allocator.c @@ -1,8 +1,8 @@ // vim:fileencoding=utf-8:foldmethod=marker #include "mem_allocator.h" -#include "../../common/aliases/aliases.h" -#include "../../common/assert/assert.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/assert/assert.h" #include void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size) { diff --git a/src/primitives/mem_allocator/mem_allocator.h b/src/base/mem/allocator/mem_allocator.h similarity index 95% rename from src/primitives/mem_allocator/mem_allocator.h rename to src/base/mem/allocator/mem_allocator.h index 389e158..77d1f54 100644 --- a/src/primitives/mem_allocator/mem_allocator.h +++ b/src/base/mem/allocator/mem_allocator.h @@ -3,8 +3,8 @@ #ifndef MEM_ALLOCATOR_H #define MEM_ALLOCATOR_H -#include "../../common/aliases/aliases.h" -#include "../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #include #ifdef WAPP_PLATFORM_CPP diff --git a/src/core/mem/utils/mem_utils.c b/src/base/mem/utils/mem_utils.c similarity index 100% rename from src/core/mem/utils/mem_utils.c rename to src/base/mem/utils/mem_utils.c diff --git a/src/core/mem/utils/mem_utils.h b/src/base/mem/utils/mem_utils.h similarity index 100% rename from src/core/mem/utils/mem_utils.h rename to src/base/mem/utils/mem_utils.h diff --git a/src/primitives/strings/str8/str8.c b/src/base/strings/str8/str8.c similarity index 99% rename from src/primitives/strings/str8/str8.c rename to src/base/strings/str8/str8.c index 7dfc2f0..7fb97e6 100644 --- a/src/primitives/strings/str8/str8.c +++ b/src/base/strings/str8/str8.c @@ -2,9 +2,9 @@ #include "str8.h" #include "../../array/array.h" +#include "../../mem/allocator/mem_allocator.h" #include "../../../common/aliases/aliases.h" #include "../../../common/assert/assert.h" -#include "../../mem_allocator/mem_allocator.h" #include #include #include diff --git a/src/primitives/strings/str8/str8.h b/src/base/strings/str8/str8.h similarity index 97% rename from src/primitives/strings/str8/str8.h rename to src/base/strings/str8/str8.h index e13ffc4..22243b0 100644 --- a/src/primitives/strings/str8/str8.h +++ b/src/base/strings/str8/str8.h @@ -6,9 +6,9 @@ #include "../../../common/aliases/aliases.h" #include "../../../common/assert/assert.h" #include "../../../common/platform/platform.h" -#include "../../../primitives/array/array.h" -#include "../../../primitives/dbl_list/dbl_list.h" -#include "../../mem_allocator/mem_allocator.h" +#include "../../array/array.h" +#include "../../dbl_list/dbl_list.h" +#include "../../mem/allocator/mem_allocator.h" #include #ifdef WAPP_PLATFORM_CPP diff --git a/src/base/wapp_base.c b/src/base/wapp_base.c new file mode 100644 index 0000000..b0d1459 --- /dev/null +++ b/src/base/wapp_base.c @@ -0,0 +1,13 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#ifndef WAPP_BASE_C +#define WAPP_BASE_C + +#include "wapp_base.h" +#include "array/array.c" +#include "dbl_list/dbl_list.c" +#include "mem/allocator/mem_allocator.c" +#include "mem/utils/mem_utils.c" +#include "strings/str8/str8.c" + +#endif // !WAPP_BASE_C diff --git a/src/primitives/wapp_primitives.h b/src/base/wapp_base.h similarity index 55% rename from src/primitives/wapp_primitives.h rename to src/base/wapp_base.h index 7c72ee8..6a9274d 100644 --- a/src/primitives/wapp_primitives.h +++ b/src/base/wapp_base.h @@ -1,12 +1,13 @@ // vim:fileencoding=utf-8:foldmethod=marker -#ifndef WAPP_PRIMITIVES_H -#define WAPP_PRIMITIVES_H +#ifndef WAPP_BASE_H +#define WAPP_BASE_H #include "dbl_list/dbl_list.h" #include "array/array.h" -#include "mem_allocator/mem_allocator.h" +#include "mem/allocator/mem_allocator.h" +#include "mem/utils/mem_utils.h" #include "strings/str8/str8.h" #include "../common/wapp_common.h" -#endif // !WAPP_PRIMITIVES_H +#endif // !WAPP_BASE_H diff --git a/src/core/wapp_core.c b/src/core/wapp_core.c deleted file mode 100644 index eb11156..0000000 --- a/src/core/wapp_core.c +++ /dev/null @@ -1,23 +0,0 @@ -// vim:fileencoding=utf-8:foldmethod=marker - -#ifndef WAPP_CORE_C -#define WAPP_CORE_C - -#include "wapp_core.h" -#include "file/file.c" -#include "os/shell/termcolour/posix/termcolour_posix.c" -#include "os/shell/termcolour/win/termcolour_win.c" -#include "os/shell/termcolour/termcolour.c" -#include "os/shell/commander/posix/commander_posix.c" -#include "os/shell/commander/win/commander_win.c" -#include "os/shell/commander/commander.c" -#include "os/cpath/cpath.c" -#include "os/mem/posix/mem_os_posix.c" -#include "os/mem/win/mem_os_win.c" -#include "os/mem/mem_os.c" -#include "mem/utils/mem_utils.c" -#include "mem/arena/mem_arena.c" -#include "mem/arena/mem_arena_allocator.c" -#include "../primitives/wapp_primitives.c" - -#endif // !WAPP_CORE_C diff --git a/src/core/wapp_core.h b/src/core/wapp_core.h deleted file mode 100644 index 964508a..0000000 --- a/src/core/wapp_core.h +++ /dev/null @@ -1,23 +0,0 @@ -// vim:fileencoding=utf-8:foldmethod=marker - -#ifndef WAPP_CORE_H -#define WAPP_CORE_H - -#include "file/file.h" -#include "os/shell/termcolour/termcolour.h" -#include "os/shell/termcolour/terminal_colours.h" -#include "os/shell/commander/commander.h" -#include "os/shell/commander/commander_output.h" -#include "os/shell/utils/shell_utils.h" -#include "os/cpath/cpath.h" -#include "os/mem/posix/mem_os_posix.h" -#include "os/mem/win/mem_os_win.h" -#include "os/mem/mem_os_ops.h" -#include "os/mem/mem_os.h" -#include "mem/utils/mem_utils.h" -#include "mem/arena/mem_arena_allocator.h" -#include "mem/arena/mem_arena.h" -#include "../common/wapp_common.h" -#include "../primitives/wapp_primitives.h" - -#endif // !WAPP_CORE_H diff --git a/src/core/mem/arena/mem_arena.c b/src/os/allocators/arena/mem_arena.c similarity index 98% rename from src/core/mem/arena/mem_arena.c rename to src/os/allocators/arena/mem_arena.c index 479202b..df5cf92 100644 --- a/src/core/mem/arena/mem_arena.c +++ b/src/os/allocators/arena/mem_arena.c @@ -1,11 +1,11 @@ // vim:fileencoding=utf-8:foldmethod=marker #include "mem_arena.h" -#include "../utils/mem_utils.h" +#include "../../mem/mem_os.h" #include "../../../common/aliases/aliases.h" #include "../../../common/assert/assert.h" #include "../../../common/misc/misc_utils.h" -#include "../../os/mem/mem_os.h" +#include "../../../base/mem/utils/mem_utils.h" #include #include diff --git a/src/core/mem/arena/mem_arena.h b/src/os/allocators/arena/mem_arena.h similarity index 98% rename from src/core/mem/arena/mem_arena.h rename to src/os/allocators/arena/mem_arena.h index 1f53d7b..653487d 100644 --- a/src/core/mem/arena/mem_arena.h +++ b/src/os/allocators/arena/mem_arena.h @@ -3,9 +3,9 @@ #ifndef MEM_ARENA_H #define MEM_ARENA_H +#include "../../mem/mem_os.h" #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#include "../../os/mem/mem_os.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/mem/arena/mem_arena_allocator.c b/src/os/allocators/arena/mem_arena_allocator.c similarity index 98% rename from src/core/mem/arena/mem_arena_allocator.c rename to src/os/allocators/arena/mem_arena_allocator.c index 8b2bc75..d0aaa46 100644 --- a/src/core/mem/arena/mem_arena_allocator.c +++ b/src/os/allocators/arena/mem_arena_allocator.c @@ -2,8 +2,8 @@ #include "mem_arena_allocator.h" #include "mem_arena.h" +#include "../../mem/mem_os.h" #include "../../../common/aliases/aliases.h" -#include "../../os/mem/mem_os.h" wapp_intern inline void *mem_arena_alloc(u64 size, void *alloc_obj); wapp_intern inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj); diff --git a/src/core/mem/arena/mem_arena_allocator.h b/src/os/allocators/arena/mem_arena_allocator.h similarity index 95% rename from src/core/mem/arena/mem_arena_allocator.h rename to src/os/allocators/arena/mem_arena_allocator.h index ad82f48..87c3d8b 100644 --- a/src/core/mem/arena/mem_arena_allocator.h +++ b/src/os/allocators/arena/mem_arena_allocator.h @@ -3,10 +3,10 @@ #ifndef MEM_ARENA_ALLOCATOR_H #define MEM_ARENA_ALLOCATOR_H +#include "../../mem/mem_os.h" #include "../../../common/aliases/aliases.h" #include "../../../common/platform/platform.h" -#include "../../../primitives/mem_allocator/mem_allocator.h" -#include "../../os/mem/mem_os.h" +#include "../../../base/mem/allocator/mem_allocator.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/cpath/cpath.c b/src/os/cpath/cpath.c similarity index 91% rename from src/core/os/cpath/cpath.c rename to src/os/cpath/cpath.c index a9ef46e..c99c2ce 100644 --- a/src/core/os/cpath/cpath.c +++ b/src/os/cpath/cpath.c @@ -1,12 +1,12 @@ // vim:fileencoding=utf-8:foldmethod=marker #include "cpath.h" -#include "../../../common/aliases/aliases.h" -#include "../../../common/misc/misc_utils.h" -#include "../../mem/arena/mem_arena_allocator.h" -#include "../../../primitives/dbl_list/dbl_list.h" -#include "../../../primitives/mem_allocator/mem_allocator.h" -#include "../../../primitives/strings/str8/str8.h" +#include "../allocators/arena/mem_arena_allocator.h" +#include "../../common/aliases/aliases.h" +#include "../../common/misc/misc_utils.h" +#include "../../base/dbl_list/dbl_list.h" +#include "../../base/mem/allocator/mem_allocator.h" +#include "../../base/strings/str8/str8.h" #include #include #include diff --git a/src/core/os/cpath/cpath.h b/src/os/cpath/cpath.h similarity index 82% rename from src/core/os/cpath/cpath.h rename to src/os/cpath/cpath.h index bfb8f8d..823ef3c 100644 --- a/src/core/os/cpath/cpath.h +++ b/src/os/cpath/cpath.h @@ -3,10 +3,10 @@ #ifndef CPATH_H #define CPATH_H -#include "../../../common/aliases/aliases.h" -#include "../../../common/platform/platform.h" -#include "../../../primitives/mem_allocator/mem_allocator.h" -#include "../../../primitives/strings/str8/str8.h" +#include "../../common/aliases/aliases.h" +#include "../../common/platform/platform.h" +#include "../../base/mem/allocator/mem_allocator.h" +#include "../../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/file/file.c b/src/os/file/file.c similarity index 96% rename from src/core/file/file.c rename to src/os/file/file.c index 86a8bd5..9df8bf3 100644 --- a/src/core/file/file.c +++ b/src/os/file/file.c @@ -1,11 +1,11 @@ // vim:fileencoding=utf-8:foldmethod=marker #include "file.h" -#include "../os/cpath/cpath.h" +#include "../cpath/cpath.h" #include "../../common/assert/assert.h" #include "../../common/aliases/aliases.h" -#include "../../primitives/array/array.h" -#include "../../primitives/strings/str8/str8.h" +#include "../../base/array/array.h" +#include "../../base/strings/str8/str8.h" #include File *wapp_file_open(Str8RO *filepath, FileAccessMode mode) { diff --git a/src/core/file/file.h b/src/os/file/file.h similarity index 97% rename from src/core/file/file.h rename to src/os/file/file.h index 868e0f7..3b75925 100644 --- a/src/core/file/file.h +++ b/src/os/file/file.h @@ -4,7 +4,7 @@ #define FILE_H #include "../../common/aliases/aliases.h" -#include "../../primitives/strings/str8/str8.h" +#include "../../base/strings/str8/str8.h" #include #ifdef WAPP_PLATFORM_CPP diff --git a/src/core/os/mem/mem_os.c b/src/os/mem/mem_os.c similarity index 87% rename from src/core/os/mem/mem_os.c rename to src/os/mem/mem_os.c index 2679b2c..95484f5 100644 --- a/src/core/os/mem/mem_os.c +++ b/src/os/mem/mem_os.c @@ -2,8 +2,8 @@ #include "mem_os.h" #include "mem_os_ops.h" -#include "../../../common/aliases/aliases.h" -#include "../../../common/platform/platform.h" +#include "../../common/aliases/aliases.h" +#include "../../common/platform/platform.h" #include #include diff --git a/src/core/os/mem/mem_os.h b/src/os/mem/mem_os.h similarity index 89% rename from src/core/os/mem/mem_os.h rename to src/os/mem/mem_os.h index eb473c2..58ae008 100644 --- a/src/core/os/mem/mem_os.h +++ b/src/os/mem/mem_os.h @@ -3,8 +3,8 @@ #ifndef MEM_OS_H #define MEM_OS_H -#include "../../../common/aliases/aliases.h" -#include "../../../common/platform/platform.h" +#include "../../common/aliases/aliases.h" +#include "../../common/platform/platform.h" #include "mem_os_ops.h" diff --git a/src/core/os/mem/mem_os_ops.h b/src/os/mem/mem_os_ops.h similarity index 92% rename from src/core/os/mem/mem_os_ops.h rename to src/os/mem/mem_os_ops.h index 460c9a8..09ec63d 100644 --- a/src/core/os/mem/mem_os_ops.h +++ b/src/os/mem/mem_os_ops.h @@ -3,7 +3,7 @@ #ifndef MEM_OS_OPS_H #define MEM_OS_OPS_H -#include "../../../common/platform/platform.h" +#include "../../common/platform/platform.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/mem/posix/mem_os_posix.c b/src/os/mem/posix/mem_os_posix.c similarity index 91% rename from src/core/os/mem/posix/mem_os_posix.c rename to src/os/mem/posix/mem_os_posix.c index f7d1db3..e71729f 100644 --- a/src/core/os/mem/posix/mem_os_posix.c +++ b/src/os/mem/posix/mem_os_posix.c @@ -1,7 +1,7 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_POSIX diff --git a/src/core/os/mem/posix/mem_os_posix.h b/src/os/mem/posix/mem_os_posix.h similarity index 94% rename from src/core/os/mem/posix/mem_os_posix.h rename to src/os/mem/posix/mem_os_posix.h index 1d3c013..4f9aa9b 100644 --- a/src/core/os/mem/posix/mem_os_posix.h +++ b/src/os/mem/posix/mem_os_posix.h @@ -3,7 +3,7 @@ #ifndef MEM_OS_POSIX_H #define MEM_OS_POSIX_H -#include "../../../../common/platform/platform.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/mem/win/mem_os_win.c b/src/os/mem/win/mem_os_win.c similarity index 91% rename from src/core/os/mem/win/mem_os_win.c rename to src/os/mem/win/mem_os_win.c index 2f64a86..97c3469 100644 --- a/src/core/os/mem/win/mem_os_win.c +++ b/src/os/mem/win/mem_os_win.c @@ -1,7 +1,7 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_WINDOWS diff --git a/src/core/os/mem/win/mem_os_win.h b/src/os/mem/win/mem_os_win.h similarity index 91% rename from src/core/os/mem/win/mem_os_win.h rename to src/os/mem/win/mem_os_win.h index 31f826e..d6c405a 100644 --- a/src/core/os/mem/win/mem_os_win.h +++ b/src/os/mem/win/mem_os_win.h @@ -3,7 +3,7 @@ #ifndef MEM_OS_WIN_H #define MEM_OS_WIN_H -#include "../../../../common/platform/platform.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/shell/commander/commander.c b/src/os/shell/commander/commander.c similarity index 89% rename from src/core/os/shell/commander/commander.c rename to src/os/shell/commander/commander.c index 84fb3ea..22a0809 100644 --- a/src/core/os/shell/commander/commander.c +++ b/src/os/shell/commander/commander.c @@ -3,12 +3,12 @@ #include "commander.h" #include "commander_output.h" #include "../utils/shell_utils.h" -#include "../../../mem/arena/mem_arena_allocator.h" -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/misc/misc_utils.h" -#include "../../../../primitives/dbl_list/dbl_list.h" -#include "../../../../primitives/mem_allocator/mem_allocator.h" -#include "../../../../primitives/strings/str8/str8.h" +#include "../../allocators/arena/mem_arena_allocator.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/misc/misc_utils.h" +#include "../../../base/dbl_list/dbl_list.h" +#include "../../../base/mem/allocator/mem_allocator.h" +#include "../../../base/strings/str8/str8.h" #include #include #include diff --git a/src/core/os/shell/commander/commander.h b/src/os/shell/commander/commander.h similarity index 79% rename from src/core/os/shell/commander/commander.h rename to src/os/shell/commander/commander.h index 1e803a2..01d0385 100644 --- a/src/core/os/shell/commander/commander.h +++ b/src/os/shell/commander/commander.h @@ -4,9 +4,9 @@ #define COMMANDER_H #include "commander_output.h" -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" -#include "../../../../primitives/strings/str8/str8.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" +#include "../../../base/strings/str8/str8.h" #include #include diff --git a/src/core/os/shell/commander/commander_output.h b/src/os/shell/commander/commander_output.h similarity index 89% rename from src/core/os/shell/commander/commander_output.h rename to src/os/shell/commander/commander_output.h index 47968a8..1c914a3 100644 --- a/src/core/os/shell/commander/commander_output.h +++ b/src/os/shell/commander/commander_output.h @@ -3,8 +3,8 @@ #ifndef COMMANDER_OUTPUT_H #define COMMANDER_OUTPUT_H -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/shell/commander/posix/commander_posix.c b/src/os/shell/commander/posix/commander_posix.c similarity index 81% rename from src/core/os/shell/commander/posix/commander_posix.c rename to src/os/shell/commander/posix/commander_posix.c index 77452f8..06cd7c5 100644 --- a/src/core/os/shell/commander/posix/commander_posix.c +++ b/src/os/shell/commander/posix/commander_posix.c @@ -1,7 +1,7 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../../common/aliases/aliases.h" -#include "../../../../../common/platform/platform.h" +#include "../../../../common/aliases/aliases.h" +#include "../../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_POSIX diff --git a/src/core/os/shell/commander/win/commander_win.c b/src/os/shell/commander/win/commander_win.c similarity index 81% rename from src/core/os/shell/commander/win/commander_win.c rename to src/os/shell/commander/win/commander_win.c index 78ad793..d68611d 100644 --- a/src/core/os/shell/commander/win/commander_win.c +++ b/src/os/shell/commander/win/commander_win.c @@ -1,7 +1,7 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../../common/aliases/aliases.h" -#include "../../../../../common/platform/platform.h" +#include "../../../../common/aliases/aliases.h" +#include "../../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_WINDOWS diff --git a/src/core/os/shell/termcolour/posix/termcolour_posix.c b/src/os/shell/termcolour/posix/termcolour_posix.c similarity index 91% rename from src/core/os/shell/termcolour/posix/termcolour_posix.c rename to src/os/shell/termcolour/posix/termcolour_posix.c index 474793d..14af25e 100644 --- a/src/core/os/shell/termcolour/posix/termcolour_posix.c +++ b/src/os/shell/termcolour/posix/termcolour_posix.c @@ -1,8 +1,8 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../../common/aliases/aliases.h" -#include "../../../../../common/platform/platform.h" -#include "../../../../../primitives/strings/str8/str8.h" +#include "../../../../common/aliases/aliases.h" +#include "../../../../common/platform/platform.h" +#include "../../../../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_POSIX diff --git a/src/core/os/shell/termcolour/termcolour.c b/src/os/shell/termcolour/termcolour.c similarity index 89% rename from src/core/os/shell/termcolour/termcolour.c rename to src/os/shell/termcolour/termcolour.c index 846151f..56fcee0 100644 --- a/src/core/os/shell/termcolour/termcolour.c +++ b/src/os/shell/termcolour/termcolour.c @@ -2,7 +2,7 @@ #include "termcolour.h" #include "terminal_colours.h" -#include "../../../../primitives/strings/str8/str8.h" +#include "../../../base/strings/str8/str8.h" void wapp_shell_termcolour_print_text(Str8RO *text, TerminalColour colour) { if (colour < WAPP_TERM_COLOUR_FG_BLACK || colour > WAPP_TERM_COLOUR_FG_BR_WHITE) { diff --git a/src/core/os/shell/termcolour/termcolour.h b/src/os/shell/termcolour/termcolour.h similarity index 76% rename from src/core/os/shell/termcolour/termcolour.h rename to src/os/shell/termcolour/termcolour.h index 1ae233d..e89bbcb 100644 --- a/src/core/os/shell/termcolour/termcolour.h +++ b/src/os/shell/termcolour/termcolour.h @@ -4,9 +4,9 @@ #define TERM_COLOUR_H #include "terminal_colours.h" -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" -#include "../../../../primitives/strings/str8/str8.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" +#include "../../../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/shell/termcolour/terminal_colours.h b/src/os/shell/termcolour/terminal_colours.h similarity index 89% rename from src/core/os/shell/termcolour/terminal_colours.h rename to src/os/shell/termcolour/terminal_colours.h index c2c7ff2..1c0eaeb 100644 --- a/src/core/os/shell/termcolour/terminal_colours.h +++ b/src/os/shell/termcolour/terminal_colours.h @@ -3,8 +3,8 @@ #ifndef TERMINAL_COLOURS_H #define TERMINAL_COLOURS_H -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/core/os/shell/termcolour/win/termcolour_win.c b/src/os/shell/termcolour/win/termcolour_win.c similarity index 94% rename from src/core/os/shell/termcolour/win/termcolour_win.c rename to src/os/shell/termcolour/win/termcolour_win.c index bc87949..7fb7fce 100644 --- a/src/core/os/shell/termcolour/win/termcolour_win.c +++ b/src/os/shell/termcolour/win/termcolour_win.c @@ -1,8 +1,8 @@ // vim:fileencoding=utf-8:foldmethod=marker -#include "../../../../../common/aliases/aliases.h" -#include "../../../../../common/platform/platform.h" -#include "../../../../../primitives/strings/str8/str8.h" +#include "../../../../common/aliases/aliases.h" +#include "../../../../common/platform/platform.h" +#include "../../../../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_WINDOWS diff --git a/src/core/os/shell/utils/shell_utils.h b/src/os/shell/utils/shell_utils.h similarity index 84% rename from src/core/os/shell/utils/shell_utils.h rename to src/os/shell/utils/shell_utils.h index 7148ca7..7ee387f 100644 --- a/src/core/os/shell/utils/shell_utils.h +++ b/src/os/shell/utils/shell_utils.h @@ -3,8 +3,8 @@ #ifndef SHELL_UTILS_H #define SHELL_UTILS_H -#include "../../../../common/aliases/aliases.h" -#include "../../../../common/platform/platform.h" +#include "../../../common/aliases/aliases.h" +#include "../../../common/platform/platform.h" #include #ifdef WAPP_PLATFORM_CPP diff --git a/src/os/wapp_os.c b/src/os/wapp_os.c new file mode 100644 index 0000000..d0840ae --- /dev/null +++ b/src/os/wapp_os.c @@ -0,0 +1,22 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#ifndef WAPP_OS_C +#define WAPP_OS_C + +#include "wapp_os.h" +#include "file/file.c" +#include "shell/termcolour/posix/termcolour_posix.c" +#include "shell/termcolour/win/termcolour_win.c" +#include "shell/termcolour/termcolour.c" +#include "shell/commander/posix/commander_posix.c" +#include "shell/commander/win/commander_win.c" +#include "shell/commander/commander.c" +#include "cpath/cpath.c" +#include "allocators/arena/mem_arena.c" +#include "allocators/arena/mem_arena_allocator.c" +#include "mem/posix/mem_os_posix.c" +#include "mem/win/mem_os_win.c" +#include "mem/mem_os.c" +#include "../base/wapp_base.c" + +#endif // !WAPP_OS_C diff --git a/src/os/wapp_os.h b/src/os/wapp_os.h new file mode 100644 index 0000000..1a7e41c --- /dev/null +++ b/src/os/wapp_os.h @@ -0,0 +1,22 @@ +// vim:fileencoding=utf-8:foldmethod=marker + +#ifndef WAPP_CORE_H +#define WAPP_CORE_H + +#include "file/file.h" +#include "shell/termcolour/termcolour.h" +#include "shell/termcolour/terminal_colours.h" +#include "shell/commander/commander.h" +#include "shell/commander/commander_output.h" +#include "shell/utils/shell_utils.h" +#include "cpath/cpath.h" +#include "allocators/arena/mem_arena.h" +#include "allocators/arena/mem_arena_allocator.h" +#include "mem/posix/mem_os_posix.h" +#include "mem/win/mem_os_win.h" +#include "mem/mem_os_ops.h" +#include "mem/mem_os.h" +#include "../common/wapp_common.h" +#include "../base/wapp_base.h" + +#endif // !WAPP_CORE_H diff --git a/src/primitives/wapp_primitives.c b/src/primitives/wapp_primitives.c deleted file mode 100644 index 1e3e4a3..0000000 --- a/src/primitives/wapp_primitives.c +++ /dev/null @@ -1,12 +0,0 @@ -// vim:fileencoding=utf-8:foldmethod=marker - -#ifndef WAPP_PRIMITIVES_C -#define WAPP_PRIMITIVES_C - -#include "wapp_primitives.h" -#include "array/array.c" -#include "dbl_list/dbl_list.c" -#include "mem_allocator/mem_allocator.c" -#include "strings/str8/str8.c" - -#endif // !WAPP_PRIMITIVES_C diff --git a/src/testing/tester/tester.c b/src/testing/tester/tester.c index e82ba76..6886209 100644 --- a/src/testing/tester/tester.c +++ b/src/testing/tester/tester.c @@ -2,8 +2,8 @@ #include "tester.h" #include "../../common/aliases/aliases.h" -#include "../../core/os/shell/termcolour/termcolour.h" -#include "../../primitives/strings/str8/str8.h" +#include "../../os/shell/termcolour/termcolour.h" +#include "../../base/strings/str8/str8.h" #include #include #include diff --git a/src/testing/tester/tester.h b/src/testing/tester/tester.h index c9ab614..33db2cd 100644 --- a/src/testing/tester/tester.h +++ b/src/testing/tester/tester.h @@ -5,7 +5,7 @@ #include "../../common/misc/misc_utils.h" #include "../../common/platform/platform.h" -#include "../../primitives/strings/str8/str8.h" +#include "../../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/testing/wapp_testing.c b/src/testing/wapp_testing.c index 2bab834..2898eea 100644 --- a/src/testing/wapp_testing.c +++ b/src/testing/wapp_testing.c @@ -5,6 +5,6 @@ #include "wapp_testing.h" #include "tester/tester.c" -#include "../core/wapp_core.c" +#include "../os/wapp_os.c" #endif // !WAPP_TESTING_C diff --git a/src/testing/wapp_testing.h b/src/testing/wapp_testing.h index a9643ce..1c1877f 100644 --- a/src/testing/wapp_testing.h +++ b/src/testing/wapp_testing.h @@ -5,6 +5,6 @@ #include "tester/tester.h" #include "../common/wapp_common.h" -#include "../core/wapp_core.h" +#include "../os/wapp_os.h" #endif // !WAPP_TESTING_H diff --git a/src/uuid/uuid.c b/src/uuid/uuid.c index 4c1f0a5..65de857 100644 --- a/src/uuid/uuid.c +++ b/src/uuid/uuid.c @@ -3,7 +3,7 @@ #include "uuid.h" #include "../common/aliases/aliases.h" #include "../common/assert/assert.h" -#include "../primitives/strings/str8/str8.h" +#include "../base/strings/str8/str8.h" #include "../prng/xorshift/xorshift.h" #include diff --git a/src/uuid/uuid.h b/src/uuid/uuid.h index ef13cfc..0feedee 100644 --- a/src/uuid/uuid.h +++ b/src/uuid/uuid.h @@ -5,7 +5,7 @@ #include "../common/aliases/aliases.h" #include "../common/platform/platform.h" -#include "../primitives/strings/str8/str8.h" +#include "../base/strings/str8/str8.h" #ifdef WAPP_PLATFORM_CPP BEGIN_C_LINKAGE diff --git a/src/uuid/wapp_uuid.c b/src/uuid/wapp_uuid.c index 426132b..c2a9b00 100644 --- a/src/uuid/wapp_uuid.c +++ b/src/uuid/wapp_uuid.c @@ -4,7 +4,7 @@ #define WAPP_UUID_C #include "uuid.c" -#include "../primitives/wapp_primitives.c" +#include "../base/wapp_base.c" #include "../prng/wapp_prng.c" #endif // !WAPP_UUID_C diff --git a/src/uuid/wapp_uuid.h b/src/uuid/wapp_uuid.h index 83f29df..4878499 100644 --- a/src/uuid/wapp_uuid.h +++ b/src/uuid/wapp_uuid.h @@ -5,7 +5,7 @@ #include "uuid.h" #include "../common/wapp_common.h" -#include "../primitives/wapp_primitives.h" +#include "../base/wapp_base.h" #include "../prng/wapp_prng.h" #endif // !WAPP_UUID_H diff --git a/src/wapp.c b/src/wapp.c index 67f2482..44ac8a9 100644 --- a/src/wapp.c +++ b/src/wapp.c @@ -4,8 +4,8 @@ #define WAPP_C #include "wapp.h" -#include "primitives/wapp_primitives.c" -#include "core/wapp_core.c" +#include "base/wapp_base.c" +#include "os/wapp_os.c" #include "prng/wapp_prng.c" #include "uuid/uuid.c" #include "testing/wapp_testing.c" diff --git a/src/wapp.h b/src/wapp.h index e2c83f1..32f7ed0 100644 --- a/src/wapp.h +++ b/src/wapp.h @@ -4,8 +4,8 @@ #define WAPP_H #include "common/wapp_common.h" -#include "primitives/wapp_primitives.h" -#include "core/wapp_core.h" +#include "base/wapp_base.h" +#include "os/wapp_os.h" #include "prng/wapp_prng.h" #include "uuid/wapp_uuid.h" #include "testing/wapp_testing.h"