From 4bde4893c9ab3a0d09570946b67734751bc84408 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 4 Aug 2026 16:16:32 +0200 Subject: Pushing something --- modules/codec-json/c++/json.hpp | 1 + modules/codec-unit/c++/unit_schema.hpp | 12 +++++++++--- modules/codec-unit/c++/unit_transform.hpp | 27 ++++++++++++++------------- modules/codec/.nix/derivation.nix | 2 ++ modules/codec/c++/data.hpp | 2 +- modules/codec/tests/forst.cpp | 4 ++-- modules/io/c++/log.hpp | 30 ++++++++++++++++++++++++++++++ modules/remote-io/c++/remote.hpp | 3 +++ modules/remote-io/c++/transfer.tmpl.hpp | 3 +++ 9 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 modules/io/c++/log.hpp create mode 100644 modules/remote-io/c++/transfer.tmpl.hpp (limited to 'modules') diff --git a/modules/codec-json/c++/json.hpp b/modules/codec-json/c++/json.hpp index 9a785b4..1da74b1 100644 --- a/modules/codec-json/c++/json.hpp +++ b/modules/codec-json/c++/json.hpp @@ -66,6 +66,7 @@ struct codec_config { uint64_t depth = 16u; uint64_t length = 4096u; bool pretty = false; + bool strict = false; bool is_within(uint64_t bytes, uint64_t d){ return bytes <= length && d <= depth; diff --git a/modules/codec-unit/c++/unit_schema.hpp b/modules/codec-unit/c++/unit_schema.hpp index 5de8770..a675e23 100644 --- a/modules/codec-unit/c++/unit_schema.hpp +++ b/modules/codec-unit/c++/unit_schema.hpp @@ -4,11 +4,17 @@ namespace saw { namespace schema { -template -struct UnitElement {}; +template +struct UnitElement { + using Schema = Un; + static constexpr int64_t Exponent = Expo; + static constexpr int64_t Scaling = Scal; +}; template -struct Unit {}; +struct Unit { + using Schema = BaseSchema; +}; template using Pure = Unit; diff --git a/modules/codec-unit/c++/unit_transform.hpp b/modules/codec-unit/c++/unit_transform.hpp index 5e90878..40a85a1 100644 --- a/modules/codec-unit/c++/unit_transform.hpp +++ b/modules/codec-unit/c++/unit_transform.hpp @@ -18,9 +18,9 @@ class unit_redux_list { using Type = unit_redux_list<>; }; -template -struct unit_redux_list, schema::UnitElement...> { - using Type = typename unit_matching, schema::UnitElement...>, unit_redux_list<>>::TypeList; +template +struct unit_redux_list, schema::UnitElement...> { + using Type = typename unit_matching, schema::UnitElement...>, unit_redux_list<>>::TypeList; }; template @@ -32,16 +32,16 @@ public: /** * Iterate over the left list to check against the left element. */ -template -class unit_matching_reduce, unit_redux_list,schema::UnitElement...>, unit_redux_list...>> { +template +class unit_matching_reduce, unit_redux_list,schema::UnitElement...>, unit_redux_list...>> { public: - static constexpr bool is_same = std::is_same_v; + static constexpr bool is_same = std::is_same_v and std::is_same_v; // Match T,E against T0,E0 - using ReducedType = typename std::conditional, schema::UnitElement>::type; - using ReducedTypeList = typename std::conditional...>, unit_redux_list..., schema::UnitElement>>::type; + using ReducedType = typename std::conditional, schema::UnitElement>::type; + using ReducedTypeList = typename std::conditional...>, unit_redux_list..., schema::UnitElement>>::type; - using NextMatcher = unit_matching_reduce...>, ReducedTypeList>; + using NextMatcher = unit_matching_reduce...>, ReducedTypeList>; using Type = typename NextMatcher::Type; using TypeList = typename NextMatcher::TypeList; static constexpr int64_t Num = NextMatcher::Num; @@ -51,12 +51,13 @@ public: * Final step after going through the list. This contains the final match result. * On the left is the accumulated type and on the right its's a list of non matching types */ -template -class unit_matching_reduce, unit_redux_list<>, unit_redux_list...>> { +template +class unit_matching_reduce, unit_redux_list<>, unit_redux_list...>> { public: - using Type = schema::UnitElement; - using TypeList = unit_redux_list...>; + using Type = schema::UnitElement; + using TypeList = unit_redux_list...>; static constexpr int64_t Num = E; + static constexpr int64_t Scale = S; }; template diff --git a/modules/codec/.nix/derivation.nix b/modules/codec/.nix/derivation.nix index c17d575..a8c39b1 100644 --- a/modules/codec/.nix/derivation.nix +++ b/modules/codec/.nix/derivation.nix @@ -1,6 +1,7 @@ { lib , stdenv , scons +, bear , clang-tools , version , forstio @@ -23,6 +24,7 @@ in stdenv.mkDerivation { nativeBuildInputs = [ scons + bear clang-tools ]; diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 4dd1fd3..afcf382 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -590,7 +590,7 @@ private: }; public: data() = default; - data(data init){ + data(const data& init){ if constexpr ( 0u < sizeof...(T) ){ init_helper<0u>::apply(value_, std::move(init)); } diff --git a/modules/codec/tests/forst.cpp b/modules/codec/tests/forst.cpp index 2bf6442..e68c539 100644 --- a/modules/codec/tests/forst.cpp +++ b/modules/codec/tests/forst.cpp @@ -18,7 +18,7 @@ using TestStruct = Struct< using TestArray = Array< TestStruct >; -/* + SAW_TEST("Codec Forst Layer Info"){ using namespace saw; @@ -39,7 +39,7 @@ SAW_TEST("Codec Forst Layer Info"){ SAW_EXPECT(depth == 2, "Layer info is wrong"); } } - +/* SAW_TEST("Codec Forst Static Size Info"){ using namespace saw; diff --git a/modules/io/c++/log.hpp b/modules/io/c++/log.hpp new file mode 100644 index 0000000..b4e0663 --- /dev/null +++ b/modules/io/c++/log.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include + +#include + +namespace saw { +namespace schema { +using LogMessage = Struct< + Member, + Member, + Member, + Member +>; +} + +class local_log final { +public: + void send(uint64_t kind, const std::string_view& msg, const std::source_location& loc); +}; + +logger& get_local_logger(); + +template +void log(const std::string_view& msg, const std::source_location& loc = std::source_location::current()){ + auto& lg = get_local_logger(); + + lg.send(kind, msg, file, line); +} +} diff --git a/modules/remote-io/c++/remote.hpp b/modules/remote-io/c++/remote.hpp index fe2804d..2337019 100644 --- a/modules/remote-io/c++/remote.hpp +++ b/modules/remote-io/c++/remote.hpp @@ -49,3 +49,6 @@ public: } }; } + +#include "transfer.tmpl.hpp" +#include "remote.tmpl.hpp" diff --git a/modules/remote-io/c++/transfer.tmpl.hpp b/modules/remote-io/c++/transfer.tmpl.hpp new file mode 100644 index 0000000..45dcbb0 --- /dev/null +++ b/modules/remote-io/c++/transfer.tmpl.hpp @@ -0,0 +1,3 @@ +#pragma once + + -- cgit v1.2.3