Compare commits

...

5 Commits

Author SHA1 Message Date
Abdelrahman Said
9403193f09 Update build scripts 2025-02-24 07:58:42 +00:00
Abdelrahman Said
fa1d9eec0d Fix files not using relative includes 2025-02-24 07:58:22 +00:00
Abdelrahman Said
4c14588d92 Update core headers and sources to use relative includes 2025-02-24 07:51:08 +00:00
Abdelrahman Said
9e66bd60bd Update testing headers to user relative includes 2025-02-24 07:24:26 +00:00
Abdelrahman Said
ce4957d0a0 Update common headers to user relative includes 2025-02-24 07:21:28 +00:00
40 changed files with 129 additions and 127 deletions

View File

@ -59,4 +59,4 @@ If ($Status -ne 0) {
}
# Build library
Invoke-Expression "$Compiler $GeneralFlags $LibraryFlags $IncludeDirs $SrcFiles $Objects $Outputs"
Invoke-Expression "$Compiler $GeneralFlags $LibraryFlags $SrcFiles $Objects $Outputs"

View File

@ -44,8 +44,6 @@ if [[ $CC == "gcc" ]]; then
export ASAN_OPTIONS=verify_asan_link_order=0
fi
INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ")"
case $COMPONENTS in
all)
SRC="src/wapp.c"
@ -63,7 +61,7 @@ case $COMPONENTS in
;;
esac
TEST_INCLUDE="$(find tests -type d | xargs -I{} echo -n "-I{} ")"
TEST_INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ") $(find tests -type d | xargs -I{} echo -n "-I{} ")"
TEST_SRC="$(find tests -type f -name "*.c" | xargs -I{} echo -n "{} ")"
BUILD_DIR="libwapp-build/$PLATFORM-$BUILD_TYPE"
@ -83,7 +81,7 @@ TEST_OUT="$BUILD_DIR/wapptest"
# Compile tests
if [[ $(echo $TEST_SRC | xargs) != "" ]]; then
(set -x ; $CC $CFLAGS $INCLUDE $TEST_INCLUDE $SRC $TEST_SRC -o $TEST_OUT)
(set -x ; $CC $CFLAGS $TEST_INCLUDE $SRC $TEST_SRC -o $TEST_OUT)
fi
# Run tests and exit on failure
@ -99,4 +97,4 @@ if [[ -f $TEST_OUT ]]; then
fi
# Compile library
(set -x ; $CC $CFLAGS $LIBFLAGS $INCLUDE $SRC -o $OUT)
(set -x ; $CC $CFLAGS $LIBFLAGS $SRC -o $OUT)

View File

@ -1,7 +1,7 @@
#ifndef MISC_UTILS_H
#define MISC_UTILS_H
#include "aliases.h"
#include "../aliases/aliases.h"
#define KB(SIZE) (SIZE * 1024ull)
#define MB(SIZE) (KB(SIZE) * 1024)

View File

@ -1,8 +1,8 @@
#ifndef WAPP_COMMON_H
#define WAPP_COMMON_H
#include "aliases.h"
#include "misc_utils.h"
#include "platform.h"
#include "aliases/aliases.h"
#include "misc/misc_utils.h"
#include "platform/platform.h"
#endif // !WAPP_COMMON_H

View File

@ -1,4 +1,5 @@
#include "mem_allocator.h"
#include "../../../common/aliases/aliases.h"
#include <stdlib.h>
void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size) {

View File

@ -1,7 +1,7 @@
#ifndef MEM_ALLOCATOR_H
#define MEM_ALLOCATOR_H
#include "aliases.h"
#include "../../../common/aliases/aliases.h"
#include <string.h>
#ifdef __cplusplus

View File

@ -1,7 +1,7 @@
#include "mem_arena.h"
#include "aliases.h"
#include "misc_utils.h"
#include "mem_os.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/misc/misc_utils.h"
#include "../../os/mem/mem_os.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,8 +1,8 @@
#ifndef MEM_ARENA_H
#define MEM_ARENA_H
#include "aliases.h"
#include "mem_os.h"
#include "../../../common/aliases/aliases.h"
#include "../../os/mem/mem_os.h"
#include <stdbool.h>
#ifdef __cplusplus

View File

@ -1,5 +1,7 @@
#include "mem_arena_allocator.h"
#include "mem_arena.h"
#include "../../../common/aliases/aliases.h"
#include "../../os/mem/mem_os.h"
internal inline void *mem_arena_alloc(u64 size, void *alloc_obj);
internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj);

View File

@ -1,9 +1,9 @@
#ifndef MEM_ARENA_ALLOCATOR_H
#define MEM_ARENA_ALLOCATOR_H
#include "aliases.h"
#include "mem_os.h"
#include "mem_allocator.h"
#include "../../../common/aliases/aliases.h"
#include "../allocator/mem_allocator.h"
#include "../../os/mem/mem_os.h"
#include <stdbool.h>
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
#include "aliases.h"
#include "mem_utils.h"
#include "../../../common/aliases/aliases.h"
#include <stdbool.h>
#include <stddef.h>
#include <assert.h>

View File

@ -1,7 +1,7 @@
#ifndef MEM_UTILS_H
#define MEM_UTILS_H
#include "aliases.h"
#include "../../../common/aliases/aliases.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE

View File

@ -1,9 +1,9 @@
#include "cpath.h"
#include "aliases.h"
#include "mem_allocator.h"
#include "mem_arena_allocator.h"
#include "misc_utils.h"
#include "str8.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/misc/misc_utils.h"
#include "../../mem/allocator/mem_allocator.h"
#include "../../mem/arena/mem_arena_allocator.h"
#include "../../strings/str8/str8.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>

View File

@ -1,10 +1,10 @@
#ifndef CPATH_H
#define CPATH_H
#include "aliases.h"
#include "mem_allocator.h"
#include "platform.h"
#include "str8.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/platform/platform.h"
#include "../../mem/allocator/mem_allocator.h"
#include "../../strings/str8/str8.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE

View File

@ -1,15 +1,15 @@
#include "mem_os.h"
#include "mem_os_ops.h"
#include "aliases.h"
#include "platform.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/platform/platform.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#if defined(WAPP_PLATFORM_WINDOWS)
#include "mem_os_win.h"
#include "win/mem_os_win.h"
#elif defined(WAPP_PLATFORM_POSIX)
#include "mem_os_posix.h"
#include "posix/mem_os_posix.h"
#else
#error "Unrecognised platform"
#endif

View File

@ -1,8 +1,8 @@
#ifndef MEM_OS_H
#define MEM_OS_H
#include "aliases.h"
#include "platform.h"
#include "../../../common/aliases/aliases.h"
#include "../../../common/platform/platform.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE
@ -11,9 +11,9 @@ BEGIN_C_LINKAGE
#include "mem_os_ops.h"
#if defined(WAPP_PLATFORM_WINDOWS)
#include "mem_os_win.h"
#include "win/mem_os_win.h"
#elif defined(WAPP_PLATFORM_POSIX)
#include "mem_os_posix.h"
#include "posix/mem_os_posix.h"
#else
#error "Unrecognised platform"
#endif

View File

@ -1,10 +1,10 @@
#include "aliases.h"
#include "platform.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../../common/platform/platform.h"
#ifdef WAPP_PLATFORM_POSIX
#include "mem_os_ops.h"
#include "mem_os_posix.h"
#include "../mem_os_ops.h"
#include <sys/mman.h>
internal const i32 access_types[] = {

View File

@ -1,7 +1,7 @@
#ifndef MEM_OS_POSIX_H
#define MEM_OS_POSIX_H
#include "platform.h"
#include "../../../../common/platform/platform.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE

View File

@ -1,10 +1,10 @@
#include "aliases.h"
#include "platform.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../../common/platform/platform.h"
#ifdef WAPP_PLATFORM_WINDOWS
#include "mem_os_ops.h"
#include "mem_os_win.h"
#include "../mem_os_ops.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

View File

@ -1,7 +1,7 @@
#ifndef MEM_OS_WIN_H
#define MEM_OS_WIN_H
#include "platform.h"
#include "../../../../common/platform/platform.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE

View File

@ -1,11 +1,11 @@
#include "commander.h"
#include "aliases.h"
#include "commander_output.h"
#include "mem_allocator.h"
#include "mem_arena_allocator.h"
#include "misc_utils.h"
#include "shell_utils.h"
#include "str8.h"
#include "../utils/shell_utils.h"
#include "../../../mem/allocator/mem_allocator.h"
#include "../../../mem/arena/mem_arena_allocator.h"
#include "../../../strings/str8/str8.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../../common/misc/misc_utils.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>

View File

@ -1,9 +1,9 @@
#ifndef COMMANDER_H
#define COMMANDER_H
#include "aliases.h"
#include "commander_output.h"
#include "str8.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../strings/str8/str8.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,8 +1,8 @@
#ifndef COMMANDER_OUTPUT_H
#define COMMANDER_OUTPUT_H
#include "aliases.h"
#include "platform.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../../common/platform/platform.h"
#include <stdbool.h>
#ifdef __cplusplus

View File

@ -1,10 +1,10 @@
#include "aliases.h"
#include "platform.h"
#include "../../../../../common/aliases/aliases.h"
#include "../../../../../common/platform/platform.h"
#ifdef WAPP_PLATFORM_POSIX
#include "commander_output.h"
#include "shell_utils.h"
#include "../commander_output.h"
#include "../../utils/shell_utils.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,10 +1,10 @@
#include "aliases.h"
#include "platform.h"
#include "../../../../../common/aliases/aliases.h"
#include "../../../../../common/platform/platform.h"
#ifdef WAPP_PLATFORM_WINDOWS
#include "commander_output.h"
#include "shell_utils.h"
#include "../commander_output.h"
#include "../../utils/shell_utils.h"
#include <stdio.h>
CMDError get_output_status(FILE *fp, i32 *status_out) {

View File

@ -1,10 +1,10 @@
#include "aliases.h"
#include "platform.h"
#include "str8.h"
#include "../../../../../common/aliases/aliases.h"
#include "../../../../../common/platform/platform.h"
#include "../../../../strings/str8/str8.h"
#ifdef WAPP_PLATFORM_POSIX
#include "terminal_colours.h"
#include "../terminal_colours.h"
#include <stdio.h>
internal Str8RO colours[COUNT_TERM_COLOUR] = {

View File

@ -1,5 +1,6 @@
#include "termcolour.h"
#include "terminal_colours.h"
#include "../../../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) {

View File

@ -1,9 +1,9 @@
#ifndef TERM_COLOUR_H
#define TERM_COLOUR_H
#include "aliases.h"
#include "terminal_colours.h"
#include "str8.h"
#include "../../../../common/aliases/aliases.h"
#include "../../../strings/str8/str8.h"
#ifdef __cplusplus
BEGIN_C_LINKAGE

View File

@ -1,11 +1,11 @@
#include "aliases.h"
#include "platform.h"
#include "str8.h"
#include "../../../../../common/aliases/aliases.h"
#include "../../../../../common/platform/platform.h"
#include "../../../../strings/str8/str8.h"
#ifdef WAPP_PLATFORM_WINDOWS
#include "misc_utils.h"
#include "terminal_colours.h"
#include "../terminal_colours.h"
#include "../../../../../common/misc/misc_utils.h"
#include <stdio.h>
#define WIN32_LEAN_AND_MEAN

View File

@ -1,7 +1,7 @@
#ifndef SHELL_UTILS_H
#define SHELL_UTILS_H
#include "platform.h"
#include "../../../../common/platform/platform.h"
#include <stdio.h>
#ifdef WAPP_PLATFORM_WINDOWS

View File

@ -1,6 +1,6 @@
#include "str8.h"
#include "aliases.h"
#include "mem_allocator.h"
#include "../../../common/aliases/aliases.h"
#include "../../mem/allocator/mem_allocator.h"
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>

View File

@ -1,8 +1,8 @@
#ifndef STR8_H
#define STR8_H
#include "aliases.h"
#include "mem_allocator.h"
#include "../../../common/aliases/aliases.h"
#include "../../mem/allocator/mem_allocator.h"
#include <string.h>
#include <stdbool.h>

View File

@ -2,20 +2,20 @@
#define WAPP_CORE_C
#include "wapp_core.h"
#include "mem_utils.c"
#include "mem_arena.c"
#include "mem_arena_allocator.c"
#include "mem_allocator.c"
#include "str8.c"
#include "termcolour_win.c"
#include "termcolour_posix.c"
#include "termcolour.c"
#include "commander_win.c"
#include "commander.c"
#include "commander_posix.c"
#include "mem_os_win.c"
#include "mem_os.c"
#include "mem_os_posix.c"
#include "cpath.c"
#include "strings/str8/str8.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/allocator/mem_allocator.c"
#include "mem/arena/mem_arena.c"
#include "mem/arena/mem_arena_allocator.c"
#endif // !WAPP_CORE_C

View File

@ -1,21 +1,21 @@
#ifndef WAPP_CORE_H
#define WAPP_CORE_H
#include "mem_arena_allocator.h"
#include "mem_arena.h"
#include "mem_utils.h"
#include "mem_allocator.h"
#include "str8.h"
#include "termcolour.h"
#include "terminal_colours.h"
#include "shell_utils.h"
#include "commander_output.h"
#include "commander.h"
#include "mem_os_ops.h"
#include "mem_os_win.h"
#include "mem_os.h"
#include "mem_os_posix.h"
#include "cpath.h"
#include "wapp_common.h"
#include "strings/str8/str8.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/allocator/mem_allocator.h"
#include "mem/arena/mem_arena_allocator.h"
#include "mem/arena/mem_arena.h"
#include "../common/wapp_common.h"
#endif // !WAPP_CORE_H

View File

@ -1,7 +1,7 @@
#include "tester.h"
#include "aliases.h"
#include "termcolour.h"
#include "str8.h"
#include "../../common/aliases/aliases.h"
#include "../../core/os/shell/termcolour/termcolour.h"
#include "../../core/strings/str8/str8.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,9 +1,9 @@
#ifndef TESTER_H
#define TESTER_H
#include "misc_utils.h"
#include "platform.h"
#include "str8.h"
#include "../../common/misc/misc_utils.h"
#include "../../common/platform/platform.h"
#include "../../core/strings/str8/str8.h"
#include <stdbool.h>
#ifdef __cplusplus

View File

@ -2,7 +2,7 @@
#define WAPP_TESTING_C
#include "wapp_testing.h"
#include "tester.c"
#include "wapp_core.c"
#include "tester/tester.c"
#include "../core/wapp_core.c"
#endif // !WAPP_TESTING_C

View File

@ -1,8 +1,8 @@
#ifndef WAPP_TESTING_H
#define WAPP_TESTING_H
#include "tester.h"
#include "wapp_common.h"
#include "wapp_core.h"
#include "tester/tester.h"
#include "../common/wapp_common.h"
#include "../core/wapp_core.h"
#endif // !WAPP_TESTING_H

View File

@ -2,7 +2,7 @@
#define WAPP_C
#include "wapp.h"
#include "wapp_core.c"
#include "wapp_testing.c"
#include "core/wapp_core.c"
#include "testing/wapp_testing.c"
#endif // !WAPP_C

View File

@ -1,8 +1,8 @@
#ifndef WAPP_H
#define WAPP_H
#include "wapp_common.h"
#include "wapp_core.h"
#include "wapp_testing.h"
#include "common/wapp_common.h"
#include "core/wapp_core.h"
#include "testing/wapp_testing.h"
#endif // !WAPP_H