Restructuring
This commit is contained in:
@@ -5,8 +5,8 @@ int ReturnValue = 0;
|
|||||||
|
|
||||||
int Main() {
|
int Main() {
|
||||||
Strs cc = CMDLine.get("cc"_s, ON_WINDOWS("cl"_s) ON_MAC("clang"_s) ON_LINUX("gcc"_s));
|
Strs cc = CMDLine.get("cc"_s, ON_WINDOWS("cl"_s) ON_MAC("clang"_s) ON_LINUX("gcc"_s));
|
||||||
Strs files = ListDir("../test");
|
Strs files = ListDir("../tests");
|
||||||
CompileFiles(cc, {"../test/main_core_as_header.cpp", "../core.c"});
|
CompileFiles(cc, {"../tests/main_core_as_header.cpp", "../core_library/core.c"});
|
||||||
For(files) {
|
For(files) {
|
||||||
if (S8_Find(it, "test_"_s, 0, 0)) {
|
if (S8_Find(it, "test_"_s, 0, 0)) {
|
||||||
CompileFiles(cc, it);
|
CompileFiles(cc, it);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ DEBUG = -fsanitize=address
|
|||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../core.c"
|
#include "../core_library/core.c"
|
||||||
|
|
||||||
#define CL_Arena MA_Arena
|
#define CL_Arena MA_Arena
|
||||||
#define CL_PushSize MA_PushSizeNonZeroed
|
#define CL_PushSize MA_PushSizeNonZeroed
|
||||||
@@ -41,7 +41,7 @@ DEBUG = -fsanitize=address
|
|||||||
#define CL_VSNPRINTF stbsp_vsnprintf
|
#define CL_VSNPRINTF stbsp_vsnprintf
|
||||||
#define CL_SNPRINTF stbsp_snprintf
|
#define CL_SNPRINTF stbsp_snprintf
|
||||||
#define AND_CL_STRING_TERMINATE_ON_NEW_LINE
|
#define AND_CL_STRING_TERMINATE_ON_NEW_LINE
|
||||||
#include "../standalone_modules/clexer.c"
|
#include "../standalone_libraries/clexer.c"
|
||||||
|
|
||||||
#define SRC_CACHE_ENTRY_COUNT 1024
|
#define SRC_CACHE_ENTRY_COUNT 1024
|
||||||
struct SRC_CacheEntry {
|
struct SRC_CacheEntry {
|
||||||
|
|||||||
22
core.c
22
core.c
@@ -1,22 +0,0 @@
|
|||||||
#include "core.h"
|
|
||||||
|
|
||||||
#define STB_SPRINTF_IMPLEMENTATION
|
|
||||||
#include "standalone_modules/stb_sprintf.h"
|
|
||||||
#define IO_VSNPRINTF stbsp_vsnprintf
|
|
||||||
#define IO_SNPRINTF stbsp_snprintf
|
|
||||||
#include "standalone_modules/io.c"
|
|
||||||
#define MA_ASSERT(x) IO_Assert(x)
|
|
||||||
#include "standalone_modules/arena.c"
|
|
||||||
#define RE_ASSERT(x) IO_Assert(x)
|
|
||||||
#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 "standalone_modules/string.c"
|
|
||||||
#define MU_ASSERT IO_Assert
|
|
||||||
#include "standalone_modules/multimedia.h"
|
|
||||||
#include "standalone_modules/hash.c"
|
|
||||||
#include "standalone_modules/load_library.c"
|
|
||||||
#include "filesystem/filesystem.c"
|
|
||||||
22
core_library/core.c
Normal file
22
core_library/core.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "core.h"
|
||||||
|
|
||||||
|
#define STB_SPRINTF_IMPLEMENTATION
|
||||||
|
#include "../standalone_libraries/stb_sprintf.h"
|
||||||
|
#define IO_VSNPRINTF stbsp_vsnprintf
|
||||||
|
#define IO_SNPRINTF stbsp_snprintf
|
||||||
|
#include "../standalone_libraries/io.c"
|
||||||
|
#define MA_ASSERT(x) IO_Assert(x)
|
||||||
|
#include "../standalone_libraries/arena.c"
|
||||||
|
#define RE_ASSERT(x) IO_Assert(x)
|
||||||
|
#include "../standalone_libraries/regex.c"
|
||||||
|
#include "../standalone_libraries/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 "../standalone_libraries/string.c"
|
||||||
|
#define MU_ASSERT IO_Assert
|
||||||
|
#include "../standalone_libraries/multimedia.h"
|
||||||
|
#include "../standalone_libraries/hash.c"
|
||||||
|
#include "../standalone_libraries/load_library.c"
|
||||||
|
#include "filesystem.c"
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "standalone_modules/preproc_env.h"
|
#include "../standalone_libraries/preproc_env.h"
|
||||||
#include "standalone_modules/stb_sprintf.h"
|
#include "../standalone_libraries/stb_sprintf.h"
|
||||||
#include "standalone_modules/io.h"
|
#include "../standalone_libraries/io.h"
|
||||||
#include "standalone_modules/arena.h"
|
#include "../standalone_libraries/arena.h"
|
||||||
#include "standalone_modules/string.h"
|
#include "../standalone_libraries/string.h"
|
||||||
#include "standalone_modules/unicode.h"
|
#include "../standalone_libraries/unicode.h"
|
||||||
#include "standalone_modules/hash.h"
|
#include "../standalone_libraries/hash.h"
|
||||||
#include "standalone_modules/linked_list.h"
|
#include "../standalone_libraries/linked_list.h"
|
||||||
#include "standalone_modules/regex.h"
|
#include "../standalone_libraries/regex.h"
|
||||||
#include "standalone_modules/multimedia.h"
|
#include "../standalone_libraries/multimedia.h"
|
||||||
#include "standalone_modules/load_library.h"
|
#include "../standalone_libraries/load_library.h"
|
||||||
#include "filesystem/filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "standalone_modules/defer.hpp"
|
#include "../standalone_libraries/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 "standalone_modules/table.hpp"
|
#include "../standalone_libraries/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 "standalone_modules/array.hpp"
|
#include "../standalone_libraries/array.hpp"
|
||||||
#endif
|
#endif
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../core.h"
|
#include "../core_library/core.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
MA_Arena arena = {};
|
MA_Arena arena = {};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../core.c"
|
#include "../core_library/core.c"
|
||||||
|
|
||||||
void TestBootstrapArenaClear() {
|
void TestBootstrapArenaClear() {
|
||||||
MA_Arena *arena = MA_Bootstrap();
|
MA_Arena *arena = MA_Bootstrap();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../core.c"
|
#include "../core_library/core.c"
|
||||||
void TestExclusiveArenaBackedArray() {
|
void TestExclusiveArenaBackedArray() {
|
||||||
MA_Scratch scratch;
|
MA_Scratch scratch;
|
||||||
MA_Arena ex = MA_Create();
|
MA_Arena ex = MA_Create();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "../core.c"
|
#include "../core_library/core.c"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
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("../tests/data/read_file");
|
||||||
|
|
||||||
// Read file test
|
// Read file test
|
||||||
{
|
{
|
||||||
@@ -12,7 +12,7 @@ int main() {
|
|||||||
|
|
||||||
// Write file test
|
// Write file test
|
||||||
{
|
{
|
||||||
S8_String path = S8_Lit("../test/data/write_file");
|
S8_String path = S8_Lit("../tests/data/write_file");
|
||||||
{
|
{
|
||||||
S8_String data = S8_Lit("WRITE1 OK");
|
S8_String data = S8_Lit("WRITE1 OK");
|
||||||
OS_Result result = OS_WriteFile(path, data);
|
OS_Result result = OS_WriteFile(path, data);
|
||||||
@@ -32,7 +32,7 @@ int main() {
|
|||||||
|
|
||||||
// Append file test
|
// Append file test
|
||||||
{
|
{
|
||||||
S8_String path = S8_Lit("../test/data/append_file");
|
S8_String path = S8_Lit("../tests/data/append_file");
|
||||||
{
|
{
|
||||||
S8_String data = S8_Lit("WRITE OK");
|
S8_String data = S8_Lit("WRITE OK");
|
||||||
OS_Result result = OS_WriteFile(path, data);
|
OS_Result result = OS_WriteFile(path, data);
|
||||||
@@ -71,13 +71,13 @@ int main() {
|
|||||||
IO_Assert(S8_Find(exe_path, S8_Lit("/build"), 0, 0));
|
IO_Assert(S8_Find(exe_path, S8_Lit("/build"), 0, 0));
|
||||||
IO_Assert(S8_Find(dir_path, S8_Lit("/build"), 0, 0));
|
IO_Assert(S8_Find(dir_path, S8_Lit("/build"), 0, 0));
|
||||||
IO_Assert(S8_Find(work_path, S8_Lit("/build"), 0, 0));
|
IO_Assert(S8_Find(work_path, S8_Lit("/build"), 0, 0));
|
||||||
IO_Assert(S8_Find(abs_path, S8_Lit("/test/data"), 0, 0));
|
IO_Assert(S8_Find(abs_path, S8_Lit("/tests/data"), 0, 0));
|
||||||
IO_Assert(!S8_Find(abs_path, S8_Lit("../"), 0, 0));
|
IO_Assert(!S8_Find(abs_path, S8_Lit("../"), 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// List dir test
|
// List dir test
|
||||||
{
|
{
|
||||||
S8_List list = OS_ListDir(&arena, S8_Lit("../test"), 0);
|
S8_List list = OS_ListDir(&arena, S8_Lit("../tests"), 0);
|
||||||
IO_Assert(list.node_count > 4);
|
IO_Assert(list.node_count > 4);
|
||||||
int dir_count = 0;
|
int dir_count = 0;
|
||||||
S8_For(it, list) {
|
S8_For(it, list) {
|
||||||
@@ -85,16 +85,16 @@ int main() {
|
|||||||
IO_Assert(it->string.str[it->string.len - 1] == '/');
|
IO_Assert(it->string.str[it->string.len - 1] == '/');
|
||||||
dir_count += 1;
|
dir_count += 1;
|
||||||
}
|
}
|
||||||
IO_Assert(S8_Find(it->string, S8_Lit("/test"), 0, 0));
|
IO_Assert(S8_Find(it->string, S8_Lit("/tests"), 0, 0));
|
||||||
IO_Assert(!S8_Find(it->string, S8_Lit("../test"), 0, 0));
|
IO_Assert(!S8_Find(it->string, S8_Lit("../tests"), 0, 0));
|
||||||
}
|
}
|
||||||
IO_Assert(dir_count > 0);
|
IO_Assert(dir_count > 0);
|
||||||
|
|
||||||
// relative
|
// relative
|
||||||
{
|
{
|
||||||
S8_List list = OS_ListDir(&arena, S8_Lit("../test"), OS_RELATIVE_PATHS);
|
S8_List list = OS_ListDir(&arena, S8_Lit("../tests"), OS_RELATIVE_PATHS);
|
||||||
S8_For(it, list) {
|
S8_For(it, list) {
|
||||||
IO_Assert(S8_Find(it->string, S8_Lit("../test"), 0, 0));
|
IO_Assert(S8_Find(it->string, S8_Lit("../tests"), 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../core.c"
|
#include "../core_library/core.c"
|
||||||
|
|
||||||
void TestSimpleInsertAndIntegrity() {
|
void TestSimpleInsertAndIntegrity() {
|
||||||
MA_Scratch scratch;
|
MA_Scratch scratch;
|
||||||
Reference in New Issue
Block a user