Reorganize everything
This commit is contained in:
2
MODULE.bazel.lock
generated
2
MODULE.bazel.lock
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"lockFileVersion": 16,
|
||||
"lockFileVersion": 18,
|
||||
"registryFileHashes": {
|
||||
"https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
|
||||
"https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
|
||||
|
@ -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",
|
||||
]]
|
@ -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");
|
||||
}
|
36
asl/base/BUILD.bazel
Normal file
36
asl/base/BUILD.bazel
Normal file
@ -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",
|
||||
]]
|
@ -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]]
|
12
asl/base/assert.cpp
Normal file
12
asl/base/assert.cpp
Normal file
@ -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");
|
||||
}
|
@ -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
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
#include "asl/float.hpp"
|
||||
#include "asl/base/float.hpp"
|
||||
|
||||
#include "asl/testing/testing.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 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "asl/functional.hpp"
|
||||
#include "asl/base/functional.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
|
||||
struct HasFunction
|
@ -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;
|
@ -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);
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
|
||||
namespace asl {
|
||||
|
@ -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 {};
|
@ -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);
|
||||
}
|
1
asl/base/utility_tests.cpp
Normal file
1
asl/base/utility_tests.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "asl/base/utility.hpp"
|
58
asl/containers/BUILD.bazel
Normal file
58
asl/containers/BUILD.bazel
Normal file
@ -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",
|
||||
]]
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/hash_map.hpp"
|
||||
#include "asl/containers/hash_map.hpp"
|
||||
|
||||
ASL_TEST(default)
|
||||
{
|
@ -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
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#include "asl/hash_set.hpp"
|
||||
#include "asl/containers/hash_set.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/string.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
#include "asl/strings/string.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
|
||||
ASL_TEST(empty)
|
||||
{
|
32
asl/formatting/BUILD.bazel
Normal file
32
asl/formatting/BUILD.bazel
Normal file
@ -0,0 +1,32 @@
|
||||
cc_library(
|
||||
name = "formatting",
|
||||
hdrs = [
|
||||
"format.hpp",
|
||||
],
|
||||
srcs = [
|
||||
"format.cpp",
|
||||
"format_float.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/memory",
|
||||
"//asl/strings:string_view",
|
||||
"//asl/types:span",
|
||||
"//asl/io:writer",
|
||||
"//vendor/dragonbox",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "tests",
|
||||
srcs = [
|
||||
"format_tests.cpp",
|
||||
],
|
||||
deps = [
|
||||
":formatting",
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/strings:string_builder",
|
||||
],
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/assert.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/base/assert.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
|
||||
void asl::format_internals::format(
|
||||
Writer* writer,
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/io.hpp"
|
||||
#include "asl/span.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/io/writer.hpp"
|
||||
#include "asl/types/span.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/float.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/base/float.hpp"
|
||||
|
||||
#define JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED 0
|
||||
#define JKJ_STATIC_DATA_SECTION_DEFINED 0
|
@ -1,7 +1,7 @@
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/float.hpp"
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/base/float.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
|
||||
static_assert(asl::formattable<decltype("Hello")>);
|
||||
|
33
asl/hashing/BUILD.bazel
Normal file
33
asl/hashing/BUILD.bazel
Normal file
@ -0,0 +1,33 @@
|
||||
cc_library(
|
||||
name = "hashing",
|
||||
hdrs = [
|
||||
"hash.hpp",
|
||||
],
|
||||
srcs = [
|
||||
"hash_cityhash.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/types:span",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "tests",
|
||||
srcs = [
|
||||
"hash_tests.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
":hashing",
|
||||
"//asl/strings:string_view",
|
||||
"//asl/strings:string",
|
||||
"//asl/containers:buffer",
|
||||
"//asl/types:box",
|
||||
"//asl/types:option",
|
||||
"//asl/types:status",
|
||||
],
|
||||
)
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/span.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/types/span.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
|
||||
namespace asl::city_hash
|
||||
{
|
@ -27,8 +27,8 @@
|
||||
// possible hash functions, by using SIMD instructions, or by
|
||||
// compromising on hash quality.
|
||||
|
||||
#include "asl/hash.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/hashing/hash.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
|
||||
using uint8 = uint8_t;
|
||||
using uint32 = uint32_t;
|
@ -1,12 +1,12 @@
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/hash.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/string.hpp"
|
||||
#include "asl/buffer.hpp"
|
||||
#include "asl/box.hpp"
|
||||
#include "asl/option.hpp"
|
||||
#include "asl/status.hpp"
|
||||
#include "asl/status_or.hpp"
|
||||
#include "asl/hashing/hash.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
#include "asl/strings/string.hpp"
|
||||
#include "asl/containers/buffer.hpp"
|
||||
#include "asl/types/box.hpp"
|
||||
#include "asl/types/option.hpp"
|
||||
#include "asl/types/status.hpp"
|
||||
#include "asl/types/status_or.hpp"
|
||||
|
||||
static_assert(!asl::hashable<int*>);
|
||||
static_assert(!asl::hashable<int[]>);
|
26
asl/io/BUILD.bazel
Normal file
26
asl/io/BUILD.bazel
Normal file
@ -0,0 +1,26 @@
|
||||
cc_library(
|
||||
name = "writer",
|
||||
hdrs = [
|
||||
"writer.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/types:span",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "print",
|
||||
hdrs = [
|
||||
"print.hpp",
|
||||
],
|
||||
srcs = [
|
||||
"print.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/formatting",
|
||||
":writer",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#include "asl/print.hpp"
|
||||
#include "asl/io/print.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/io/writer.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/span.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/types/span.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -7,7 +7,11 @@ cc_library(
|
||||
"logging.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl",
|
||||
"//asl/base",
|
||||
"//asl/types:box",
|
||||
"//asl/formatting",
|
||||
"//asl/io:print",
|
||||
"//asl/strings:string_builder",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "asl/logging/logging.hpp"
|
||||
#include "asl/print.hpp"
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/io/print.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
|
||||
// @Todo Don't use internal get_stdout_writer, make console module
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/box.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/types/box.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
|
||||
namespace asl::log
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "asl/logging/logging.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
|
||||
ASL_TEST(log)
|
||||
{
|
||||
|
16
asl/memory/BUILD.bazel
Normal file
16
asl/memory/BUILD.bazel
Normal file
@ -0,0 +1,16 @@
|
||||
cc_library(
|
||||
name = "memory",
|
||||
hdrs = [
|
||||
"allocator.hpp",
|
||||
"layout.hpp",
|
||||
"memory.hpp",
|
||||
],
|
||||
srcs = [
|
||||
"allocator.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "asl/allocator.hpp"
|
||||
#include "asl/assert.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/print.hpp"
|
||||
#include "asl/memory/allocator.hpp"
|
||||
#include "asl/base/assert.hpp"
|
||||
#include "asl/memory/layout.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/layout.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/memory/layout.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/layout.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/memory/layout.hpp"
|
||||
|
||||
constexpr void* operator new(size_t, void* ptr)
|
||||
{
|
56
asl/strings/BUILD.bazel
Normal file
56
asl/strings/BUILD.bazel
Normal file
@ -0,0 +1,56 @@
|
||||
cc_library(
|
||||
name = "string_view",
|
||||
hdrs = [
|
||||
"string_view.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/memory",
|
||||
"//asl/types:span",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "string",
|
||||
hdrs = [
|
||||
"string.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/containers:buffer",
|
||||
":string_view",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "string_builder",
|
||||
hdrs = [
|
||||
"string_builder.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/containers:buffer",
|
||||
"//asl/formatting",
|
||||
":string",
|
||||
"//asl/io:writer",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
[cc_test(
|
||||
name = "%s_tests" % name,
|
||||
srcs = [
|
||||
"%s_tests.cpp" % name,
|
||||
],
|
||||
deps = [
|
||||
":string",
|
||||
":string_builder",
|
||||
":string_view",
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
],
|
||||
) for name in [
|
||||
"string",
|
||||
"string_view",
|
||||
"string_builder",
|
||||
]]
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/buffer.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/containers/buffer.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/buffer.hpp"
|
||||
#include "asl/string.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/io.hpp"
|
||||
#include "asl/containers/buffer.hpp"
|
||||
#include "asl/strings/string.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/io/writer.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
|
||||
ASL_TEST(string_builder)
|
@ -1,6 +1,6 @@
|
||||
#include "asl/string.hpp"
|
||||
#include "asl/strings/string.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
|
||||
ASL_TEST(default)
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/span.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/types/span.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
|
||||
static_assert(asl::trivially_destructible<asl::string_view>);
|
10
asl/synchronization/BUILD.bazel
Normal file
10
asl/synchronization/BUILD.bazel
Normal file
@ -0,0 +1,10 @@
|
||||
cc_library(
|
||||
name = "atomic",
|
||||
hdrs = [
|
||||
"atomic.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -7,7 +7,9 @@ cc_library(
|
||||
"testing.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl",
|
||||
"//asl/base",
|
||||
"//asl/formatting",
|
||||
"//asl/io:print",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "asl/testing/testing.hpp"
|
||||
|
||||
#include "asl/print.hpp"
|
||||
#include "asl/io/print.hpp"
|
||||
|
||||
static asl::testing::Test* g_head = nullptr;
|
||||
static asl::testing::Test* g_tail = nullptr;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
|
||||
namespace asl::testing
|
||||
{
|
||||
|
10
asl/tests/BUILD.bazel
Normal file
10
asl/tests/BUILD.bazel
Normal file
@ -0,0 +1,10 @@
|
||||
cc_library(
|
||||
name = "utils",
|
||||
hdrs = [
|
||||
"types.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
],
|
||||
visibility = ["//asl:__subpackages__"],
|
||||
)
|
@ -1,9 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/io.hpp"
|
||||
#include "asl/allocator.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
|
||||
struct TrivialType
|
||||
{
|
@ -1 +0,0 @@
|
||||
#include "asl/utility.hpp"
|
135
asl/types/BUILD.bazel
Normal file
135
asl/types/BUILD.bazel
Normal file
@ -0,0 +1,135 @@
|
||||
cc_library(
|
||||
name = "box",
|
||||
hdrs = [
|
||||
"box.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/memory",
|
||||
"//asl/hashing",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "span",
|
||||
hdrs = [
|
||||
"span.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/memory",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "maybe_uninit",
|
||||
hdrs = [
|
||||
"maybe_uninit.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/memory",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "option",
|
||||
hdrs = [
|
||||
"option.hpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/types:maybe_uninit",
|
||||
"//asl/hashing",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "status",
|
||||
hdrs = [
|
||||
"status.hpp",
|
||||
"status_or.hpp",
|
||||
],
|
||||
srcs = [
|
||||
"status.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//asl/base",
|
||||
"//asl/strings:string",
|
||||
"//asl/strings:string_builder",
|
||||
"//asl/formatting",
|
||||
"//asl/memory",
|
||||
"//asl/synchronization:atomic",
|
||||
"//asl/types:maybe_uninit",
|
||||
"//asl/hashing",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "box_tests",
|
||||
srcs = ["box_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:box",
|
||||
"//asl/types:option",
|
||||
"//asl/types:maybe_uninit",
|
||||
"//asl/hashing",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "maybe_uninit_tests",
|
||||
srcs = ["maybe_uninit_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:maybe_uninit",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "span_tests",
|
||||
srcs = ["span_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:span",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "option_tests",
|
||||
srcs = ["option_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:option",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "status_tests",
|
||||
srcs = ["status_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:status",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "status_or_tests",
|
||||
srcs = ["status_or_tests.cpp"],
|
||||
deps = [
|
||||
"//asl/tests:utils",
|
||||
"//asl/testing",
|
||||
"//asl/types:status",
|
||||
],
|
||||
)
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/allocator.hpp"
|
||||
#include "asl/assert.hpp"
|
||||
#include "asl/annotations.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/hash.hpp"
|
||||
#include "asl/base/assert.hpp"
|
||||
#include "asl/base/annotations.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
#include "asl/memory/allocator.hpp"
|
||||
#include "asl/hashing/hash.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#include "asl/box.hpp"
|
||||
#include "asl/option.hpp"
|
||||
#include "asl/types/box.hpp"
|
||||
#include "asl/types/option.hpp"
|
||||
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
|
||||
static_assert(sizeof(asl::box<int>) == sizeof(int*));
|
||||
static_assert(!asl::copyable<asl::box<int>>);
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/utility.hpp"
|
||||
#include "asl/memory.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/base/utility.hpp"
|
||||
#include "asl/memory/memory.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
#include "asl/maybe_uninit.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/types/maybe_uninit.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
|
||||
static_assert(asl::layout::of<int>() == asl::layout::of<asl::maybe_uninit<int>>());
|
||||
static_assert(asl::size_of<int> == asl::size_of<asl::maybe_uninit<int>>);
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/assert.hpp"
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/maybe_uninit.hpp"
|
||||
#include "asl/functional.hpp"
|
||||
#include "asl/annotations.hpp"
|
||||
#include "asl/hash.hpp"
|
||||
#include "asl/base/assert.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/base/functional.hpp"
|
||||
#include "asl/base/annotations.hpp"
|
||||
#include "asl/types/maybe_uninit.hpp"
|
||||
#include "asl/hashing/hash.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
#include "asl/option.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/types/option.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
|
||||
class Base {};
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/meta.hpp"
|
||||
#include "asl/annotations.hpp"
|
||||
#include "asl/layout.hpp"
|
||||
#include "asl/assert.hpp"
|
||||
#include "asl/base/meta.hpp"
|
||||
#include "asl/base/assert.hpp"
|
||||
#include "asl/base/annotations.hpp"
|
||||
#include "asl/memory/layout.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#include "asl/span.hpp"
|
||||
#include "asl/types/span.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
|
||||
static_assert(asl::trivially_destructible<asl::span<int>>);
|
||||
static_assert(asl::trivially_destructible<asl::span<WithDestructor>>);
|
@ -1,9 +1,9 @@
|
||||
#include "asl/status.hpp"
|
||||
#include "asl/allocator.hpp"
|
||||
#include "asl/string.hpp"
|
||||
#include "asl/atomic.hpp"
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/types/status.hpp"
|
||||
#include "asl/memory/allocator.hpp"
|
||||
#include "asl/strings/string.hpp"
|
||||
#include "asl/synchronization/atomic.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
|
||||
// @Todo Use custom allocator
|
||||
using Allocator = asl::DefaultAllocator;
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/integers.hpp"
|
||||
#include "asl/string_view.hpp"
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/base/integers.hpp"
|
||||
#include "asl/strings/string_view.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "asl/status.hpp"
|
||||
#include "asl/maybe_uninit.hpp"
|
||||
#include "asl/hash.hpp"
|
||||
#include "asl/types/status.hpp"
|
||||
#include "asl/types/maybe_uninit.hpp"
|
||||
#include "asl/hashing/hash.hpp"
|
||||
|
||||
namespace asl
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#include "asl/status_or.hpp"
|
||||
#include "asl/types/status_or.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/tests/test_types.hpp"
|
||||
#include "asl/tests/types.hpp"
|
||||
|
||||
static_assert(asl::copyable<asl::status_or<TrivialType>>);
|
||||
static_assert(asl::moveable<asl::status_or<TrivialType>>);
|
@ -1,7 +1,7 @@
|
||||
#include "asl/status.hpp"
|
||||
#include "asl/types/status.hpp"
|
||||
#include "asl/testing/testing.hpp"
|
||||
#include "asl/format.hpp"
|
||||
#include "asl/string_builder.hpp"
|
||||
#include "asl/formatting/format.hpp"
|
||||
#include "asl/strings/string_builder.hpp"
|
||||
|
||||
ASL_TEST(simple_ok)
|
||||
{
|
Reference in New Issue
Block a user