summaryrefslogtreecommitdiff
path: root/asl
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-02-17 00:21:48 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-02-17 22:29:50 +0100
commita141c401f78467bc15f62882fca5d55a007cacbb (patch)
tree908ac71a8640f78f45d22c6808c5fa6e373000fa /asl
parentcb77cbe9ce4cddad6a460aa190ff70f0c13e4703 (diff)
Reorganize everything
Diffstat (limited to 'asl')
-rw-r--r--asl/BUILD.bazel78
-rw-r--r--asl/assert.cpp11
-rw-r--r--asl/base/BUILD.bazel36
-rw-r--r--asl/base/annotations.hpp (renamed from asl/annotations.hpp)2
-rw-r--r--asl/base/assert.cpp12
-rw-r--r--asl/base/assert.hpp (renamed from asl/assert.hpp)4
-rw-r--r--asl/base/config.hpp (renamed from asl/config.hpp)0
-rw-r--r--asl/base/float.hpp (renamed from asl/float.hpp)2
-rw-r--r--asl/base/float_tests.cpp (renamed from asl/tests/float_tests.cpp)2
-rw-r--r--asl/base/functional.hpp (renamed from asl/functional.hpp)4
-rw-r--r--asl/base/functional_tests.cpp (renamed from asl/tests/functional_tests.cpp)2
-rw-r--r--asl/base/integers.hpp (renamed from asl/integers.hpp)2
-rw-r--r--asl/base/integers_tests.cpp (renamed from asl/tests/integers_tests.cpp)2
-rw-r--r--asl/base/meta.hpp (renamed from asl/meta.hpp)2
-rw-r--r--asl/base/meta_tests.cpp (renamed from asl/tests/meta_tests.cpp)6
-rw-r--r--asl/base/utility.hpp (renamed from asl/utility.hpp)7
-rw-r--r--asl/base/utility_tests.cpp1
-rw-r--r--asl/containers/BUILD.bazel58
-rw-r--r--asl/containers/buffer.hpp (renamed from asl/buffer.hpp)14
-rw-r--r--asl/containers/buffer_tests.cpp (renamed from asl/tests/buffer_tests.cpp)4
-rw-r--r--asl/containers/hash_map.hpp (renamed from asl/hash_map.hpp)10
-rw-r--r--asl/containers/hash_map_tests.cpp (renamed from asl/tests/hash_map_tests.cpp)2
-rw-r--r--asl/containers/hash_set.hpp (renamed from asl/hash_set.hpp)14
-rw-r--r--asl/containers/hash_set_tests.cpp (renamed from asl/tests/hash_set_tests.cpp)8
-rw-r--r--asl/formatting/BUILD.bazel32
-rw-r--r--asl/formatting/format.cpp (renamed from asl/format.cpp)8
-rw-r--r--asl/formatting/format.hpp (renamed from asl/format.hpp)10
-rw-r--r--asl/formatting/format_float.cpp (renamed from asl/format_float.cpp)4
-rw-r--r--asl/formatting/format_tests.cpp (renamed from asl/tests/format_tests.cpp)6
-rw-r--r--asl/hashing/BUILD.bazel33
-rw-r--r--asl/hashing/hash.hpp (renamed from asl/hash.hpp)8
-rw-r--r--asl/hashing/hash_cityhash.cpp (renamed from asl/hash_cityhash.cpp)4
-rw-r--r--asl/hashing/hash_tests.cpp (renamed from asl/tests/hash_tests.cpp)16
-rw-r--r--asl/io/BUILD.bazel26
-rw-r--r--asl/io/print.cpp (renamed from asl/print.cpp)2
-rw-r--r--asl/io/print.hpp (renamed from asl/print.hpp)3
-rw-r--r--asl/io/writer.hpp (renamed from asl/io.hpp)6
-rw-r--r--asl/logging/BUILD.bazel6
-rw-r--r--asl/logging/logging.cpp4
-rw-r--r--asl/logging/logging.hpp6
-rw-r--r--asl/logging/logging_tests.cpp2
-rw-r--r--asl/memory/BUILD.bazel16
-rw-r--r--asl/memory/allocator.cpp (renamed from asl/allocator.cpp)8
-rw-r--r--asl/memory/allocator.hpp (renamed from asl/allocator.hpp)6
-rw-r--r--asl/memory/layout.hpp (renamed from asl/layout.hpp)4
-rw-r--r--asl/memory/memory.hpp (renamed from asl/memory.hpp)8
-rw-r--r--asl/strings/BUILD.bazel56
-rw-r--r--asl/strings/string.hpp (renamed from asl/string.hpp)4
-rw-r--r--asl/strings/string_builder.hpp (renamed from asl/string_builder.hpp)10
-rw-r--r--asl/strings/string_builder_tests.cpp (renamed from asl/tests/string_builder_tests.cpp)2
-rw-r--r--asl/strings/string_tests.cpp (renamed from asl/tests/string_tests.cpp)4
-rw-r--r--asl/strings/string_view.hpp (renamed from asl/string_view.hpp)8
-rw-r--r--asl/strings/string_view_tests.cpp (renamed from asl/tests/string_view_tests.cpp)2
-rw-r--r--asl/synchronization/BUILD.bazel10
-rw-r--r--asl/synchronization/atomic.hpp (renamed from asl/atomic.hpp)2
-rw-r--r--asl/testing/BUILD.bazel4
-rw-r--r--asl/testing/testing.cpp2
-rw-r--r--asl/testing/testing.hpp2
-rw-r--r--asl/tests/BUILD.bazel10
-rw-r--r--asl/tests/types.hpp (renamed from asl/tests/test_types.hpp)5
-rw-r--r--asl/tests/utility_tests.cpp1
-rw-r--r--asl/types/BUILD.bazel135
-rw-r--r--asl/types/box.hpp (renamed from asl/box.hpp)12
-rw-r--r--asl/types/box_tests.cpp (renamed from asl/tests/box_tests.cpp)6
-rw-r--r--asl/types/maybe_uninit.hpp (renamed from asl/maybe_uninit.hpp)6
-rw-r--r--asl/types/maybe_uninit_tests.cpp (renamed from asl/tests/maybe_uninit_tests.cpp)4
-rw-r--r--asl/types/option.hpp (renamed from asl/option.hpp)12
-rw-r--r--asl/types/option_tests.cpp (renamed from asl/tests/option_tests.cpp)4
-rw-r--r--asl/types/span.hpp (renamed from asl/span.hpp)8
-rw-r--r--asl/types/span_tests.cpp (renamed from asl/tests/span_tests.cpp)4
-rw-r--r--asl/types/status.cpp (renamed from asl/status.cpp)12
-rw-r--r--asl/types/status.hpp (renamed from asl/status.hpp)6
-rw-r--r--asl/types/status_or.hpp (renamed from asl/status_or.hpp)6
-rw-r--r--asl/types/status_or_tests.cpp (renamed from asl/tests/status_or_tests.cpp)4
-rw-r--r--asl/types/status_tests.cpp (renamed from asl/tests/status_tests.cpp)6
75 files changed, 592 insertions, 256 deletions
diff --git a/asl/BUILD.bazel b/asl/BUILD.bazel
deleted file mode 100644
index 2cc4af5..0000000
--- a/asl/BUILD.bazel
+++ /dev/null
@@ -1,78 +0,0 @@
-cc_library(
- name = "asl",
- hdrs = [
- "allocator.hpp",
- "annotations.hpp",
- "assert.hpp",
- "atomic.hpp",
- "box.hpp",
- "buffer.hpp",
- "config.hpp",
- "float.hpp",
- "format.hpp",
- "functional.hpp",
- "hash.hpp",
- "hash_map.hpp",
- "hash_set.hpp",
- "integers.hpp",
- "io.hpp",
- "layout.hpp",
- "maybe_uninit.hpp",
- "memory.hpp",
- "meta.hpp",
- "option.hpp",
- "print.hpp",
- "span.hpp",
- "status.hpp",
- "status_or.hpp",
- "string.hpp",
- "string_builder.hpp",
- "string_view.hpp",
- "utility.hpp",
- ],
- srcs = [
- "allocator.cpp",
- "assert.cpp",
- "format.cpp",
- "format_float.cpp",
- "hash_cityhash.cpp",
- "print.cpp",
- "status.cpp",
- ],
- deps = [
- "//vendor/dragonbox",
- ],
- visibility = ["//visibility:public"],
-)
-
-[cc_test(
- name = "%s_tests" % name,
- srcs = [
- "tests/%s_tests.cpp" % name,
- "tests/test_types.hpp",
- ],
- deps = [
- ":asl",
- "//asl/testing",
- ],
-) for name in [
- "box",
- "buffer",
- "float",
- "format",
- "functional",
- "hash",
- "hash_map",
- "hash_set",
- "integers",
- "maybe_uninit",
- "meta",
- "option",
- "span",
- "status",
- "status_or",
- "string",
- "string_builder",
- "string_view",
- "utility",
-]]
diff --git a/asl/assert.cpp b/asl/assert.cpp
deleted file mode 100644
index 353232e..0000000
--- a/asl/assert.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "asl/assert.hpp"
-#include "asl/print.hpp"
-
-
-void asl::report_assert_failure(const char* msg, const source_location& sl)
-{
- eprint("------------------------------------------------------------\n");
- eprint("Assertion failure at {}, line {}:\n", sl.file, sl.line);
- eprint("{}\n", msg);
- eprint("------------------------------------------------------------\n");
-}
diff --git a/asl/base/BUILD.bazel b/asl/base/BUILD.bazel
new file mode 100644
index 0000000..317c20b
--- /dev/null
+++ b/asl/base/BUILD.bazel
@@ -0,0 +1,36 @@
+cc_library(
+ name = "base",
+ hdrs = [
+ "annotations.hpp",
+ "assert.hpp",
+ "config.hpp",
+ "float.hpp",
+ "functional.hpp",
+ "integers.hpp",
+ "meta.hpp",
+ "utility.hpp",
+ ],
+ srcs = [
+ "assert.cpp",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+[cc_test(
+ name = "%s_tests" % name,
+ srcs = [
+ "%s_tests.cpp" % name,
+ ],
+ deps = [
+ ":base",
+ "//asl/tests:utils",
+ "//asl/testing",
+ "//asl/types:box",
+ ],
+) for name in [
+ "float",
+ "functional",
+ "integers",
+ "meta",
+ "utility",
+]]
diff --git a/asl/annotations.hpp b/asl/base/annotations.hpp
index 6ea3a84..b87dbde 100644
--- a/asl/annotations.hpp
+++ b/asl/base/annotations.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "asl/config.hpp"
+#include "asl/base/config.hpp"
#if ASL_COMPILER_CLANG_CL
#define ASL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
diff --git a/asl/base/assert.cpp b/asl/base/assert.cpp
new file mode 100644
index 0000000..2383e9e
--- /dev/null
+++ b/asl/base/assert.cpp
@@ -0,0 +1,12 @@
+#include "asl/base/assert.hpp"
+// #include "asl/io/print.hpp"
+
+
+void asl::report_assert_failure(const char* msg, const source_location& sl)
+{
+ // @Todo(org)
+ // eprint("------------------------------------------------------------\n");
+ // eprint("Assertion failure at {}, line {}:\n", sl.file, sl.line);
+ // eprint("{}\n", msg);
+ // eprint("------------------------------------------------------------\n");
+}
diff --git a/asl/assert.hpp b/asl/base/assert.hpp
index 608a44f..42e8635 100644
--- a/asl/assert.hpp
+++ b/asl/base/assert.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "asl/config.hpp"
-#include "asl/meta.hpp"
+#include "asl/base/config.hpp"
+#include "asl/base/meta.hpp"
namespace asl
{
diff --git a/asl/config.hpp b/asl/base/config.hpp
index e182569..e182569 100644
--- a/asl/config.hpp
+++ b/asl/base/config.hpp
diff --git a/asl/float.hpp b/asl/base/float.hpp
index 99c3f32..2de2e0c 100644
--- a/asl/float.hpp
+++ b/asl/base/float.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "asl/meta.hpp"
+#include "asl/base/meta.hpp"
namespace asl
{
diff --git a/asl/tests/float_tests.cpp b/asl/base/float_tests.cpp
index d645be8..0a5bebf 100644
--- a/asl/tests/float_tests.cpp
+++ b/asl/base/float_tests.cpp
@@ -1,4 +1,4 @@
-#include "asl/float.hpp"
+#include "asl/base/float.hpp"
#include "asl/testing/testing.hpp"
diff --git a/asl/functional.hpp b/asl/base/functional.hpp
index f5ff0d9..d820bce 100644
--- a/asl/functional.hpp
+++ b/asl/base/functional.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "asl/meta.hpp"
-#include "asl/utility.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/base/utility.hpp"
namespace asl {
diff --git a/asl/tests/functional_tests.cpp b/asl/base/functional_tests.cpp
index 2cdbe7a..92c5c7b 100644
--- a/asl/tests/functional_tests.cpp
+++ b/asl/base/functional_tests.cpp
@@ -1,4 +1,4 @@
-#include "asl/functional.hpp"
+#include "asl/base/functional.hpp"
#include "asl/testing/testing.hpp"
struct HasFunction
diff --git a/asl/integers.hpp b/asl/base/integers.hpp
index 04722a3..c18c850 100644
--- a/asl/integers.hpp
+++ b/asl/base/integers.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "asl/config.hpp"
+#include "asl/base/config.hpp"
using int8_t = signed char;
using int16_t = signed short;
diff --git a/asl/tests/integers_tests.cpp b/asl/base/integers_tests.cpp
index 1b5a20a..52feb85 100644
--- a/asl/tests/integers_tests.cpp
+++ b/asl/base/integers_tests.cpp
@@ -1,4 +1,4 @@
-#include "asl/integers.hpp"
+#include "asl/base/integers.hpp"
static_assert(sizeof(int8_t) == 1);
static_assert(sizeof(int16_t) == 2);
diff --git a/asl/meta.hpp b/asl/base/meta.hpp
index a464e36..ce17420 100644
--- a/asl/meta.hpp
+++ b/asl/base/meta.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "asl/integers.hpp"
+#include "asl/base/integers.hpp"
namespace asl {
diff --git a/asl/tests/meta_tests.cpp b/asl/base/meta_tests.cpp
index b015eb6..7aa7145 100644
--- a/asl/tests/meta_tests.cpp
+++ b/asl/base/meta_tests.cpp
@@ -1,7 +1,7 @@
-#include "asl/meta.hpp"
-#include "asl/tests/test_types.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/tests/types.hpp"
#include "asl/testing/testing.hpp"
-#include "asl/box.hpp"
+#include "asl/types/box.hpp"
struct Struct {};
union Union {};
diff --git a/asl/utility.hpp b/asl/base/utility.hpp
index f3b94c3..c03554f 100644
--- a/asl/utility.hpp
+++ b/asl/base/utility.hpp
@@ -1,8 +1,7 @@
#pragma once
-#include "asl/meta.hpp"
-#include "asl/layout.hpp"
-#include "asl/assert.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/base/assert.hpp"
#define ASL_MOVE(...) (static_cast<::asl::un_ref_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__))
@@ -31,7 +30,7 @@ T exchange(T& obj, U&& new_value)
}
template<trivially_copy_constructible U, trivially_copy_constructible T>
-constexpr U bit_cast(T value) requires (size_of<T> == size_of<U>)
+constexpr U bit_cast(T value) requires (sizeof(T) == sizeof(U))
{
return __builtin_bit_cast(U, value);
}
diff --git a/asl/base/utility_tests.cpp b/asl/base/utility_tests.cpp
new file mode 100644
index 0000000..4b8e3d1
--- /dev/null
+++ b/asl/base/utility_tests.cpp
@@ -0,0 +1 @@
+#include "asl/base/utility.hpp"
diff --git a/asl/containers/BUILD.bazel b/asl/containers/BUILD.bazel
new file mode 100644
index 0000000..2d2e057
--- /dev/null
+++ b/asl/containers/BUILD.bazel
@@ -0,0 +1,58 @@
+cc_library(
+ name = "buffer",
+ hdrs = [
+ "buffer.hpp",
+ ],
+ deps = [
+ "//asl/memory",
+ "//asl/base",
+ "//asl/types:span",
+ "//asl/hashing",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "hash_set",
+ hdrs = [
+ "hash_set.hpp",
+ ],
+ deps = [
+ "//asl/base",
+ "//asl/memory",
+ "//asl/types:maybe_uninit",
+ "//asl/hashing",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "hash_map",
+ hdrs = [
+ "hash_map.hpp",
+ ],
+ deps = [
+ "//asl/base",
+ "//asl/memory",
+ "//asl/hashing",
+ ":hash_set",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+[cc_test(
+ name = "%s_tests" % name,
+ srcs = [
+ "%s_tests.cpp" % name,
+ ],
+ deps = [
+ ":%s" % name,
+ "//asl/tests:utils",
+ "//asl/testing",
+ "//asl/strings:string",
+ ],
+) for name in [
+ "buffer",
+ "hash_map",
+ "hash_set",
+]]
diff --git a/asl/buffer.hpp b/asl/containers/buffer.hpp
index 5cf9964..76562d3 100644
--- a/asl/buffer.hpp
+++ b/asl/containers/buffer.hpp
@@ -1,12 +1,12 @@
#pragma once
-#include "asl/meta.hpp"
-#include "asl/allocator.hpp"
-#include "asl/annotations.hpp"
-#include "asl/memory.hpp"
-#include "asl/assert.hpp"
-#include "asl/span.hpp"
-#include "asl/hash.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/memory/allocator.hpp"
+#include "asl/memory/memory.hpp"
+#include "asl/base/annotations.hpp"
+#include "asl/base/assert.hpp"
+#include "asl/types/span.hpp"
+#include "asl/hashing/hash.hpp"
namespace asl
{
diff --git a/asl/tests/buffer_tests.cpp b/asl/containers/buffer_tests.cpp
index 174b3bc..fd8ad45 100644
--- a/asl/tests/buffer_tests.cpp
+++ b/asl/containers/buffer_tests.cpp
@@ -1,7 +1,7 @@
-#include "asl/buffer.hpp"
+#include "asl/containers/buffer.hpp"
#include "asl/testing/testing.hpp"
-#include "asl/tests/test_types.hpp"
+#include "asl/tests/types.hpp"
struct Big
{
diff --git a/asl/hash_map.hpp b/asl/containers/hash_map.hpp
index edb3b4c..104bd6a 100644
--- a/asl/hash_map.hpp
+++ b/asl/containers/hash_map.hpp
@@ -1,10 +1,10 @@
#pragma once
-#include "asl/meta.hpp"
-#include "asl/utility.hpp"
-#include "asl/hash.hpp"
-#include "asl/allocator.hpp"
-#include "asl/hash_set.hpp"
+#include "asl/base/utility.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/hashing/hash.hpp"
+#include "asl/memory/allocator.hpp"
+#include "asl/containers/hash_set.hpp"
namespace asl
{
diff --git a/asl/tests/hash_map_tests.cpp b/asl/containers/hash_map_tests.cpp
index 619c5e7..6cb7fe1 100644
--- a/asl/tests/hash_map_tests.cpp
+++ b/asl/containers/hash_map_tests.cpp
@@ -1,5 +1,5 @@
#include "asl/testing/testing.hpp"
-#include "asl/hash_map.hpp"
+#include "asl/containers/hash_map.hpp"
ASL_TEST(default)
{
diff --git a/asl/hash_set.hpp b/asl/containers/hash_set.hpp
index d252b37..97a37f2 100644
--- a/asl/hash_set.hpp
+++ b/asl/containers/hash_set.hpp
@@ -1,12 +1,12 @@
#pragma once
-#include "asl/annotations.hpp"
-#include "asl/meta.hpp"
-#include "asl/utility.hpp"
-#include "asl/maybe_uninit.hpp"
-#include "asl/hash.hpp"
-#include "asl/allocator.hpp"
-#include "asl/memory.hpp"
+#include "asl/base/annotations.hpp"
+#include "asl/base/utility.hpp"
+#include "asl/base/meta.hpp"
+#include "asl/memory/allocator.hpp"
+#include "asl/memory/memory.hpp"
+#include "asl/types/maybe_uninit.hpp"
+#include "asl/hashing/hash.hpp"
namespace asl
{
diff --git a/asl/tests/hash_set_tests.cpp b/asl/containers/hash_set_tests.cpp
index 0c00c87..2baab94 100644
--- a/asl/tests/hash_set_tests.cpp
+++ b/asl/containers/hash_set_tests.cpp
@@ -1,8 +1,8 @@
-#include "asl/hash_set.hpp"
+#include "asl/containers/hash_set.hpp"
#include "asl/testing/testing.hpp"
-#i