From 45c17f712b6a0424970bcac3405efca824615dcd Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 5 Sep 2025 18:14:40 +0200 Subject: feat: `lib/simd`: alternative SIMD library — a work in progress library to manipulate SIMD data. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Amlal El Mahrouss --- dev/examples/fix/fix.cc | 2 +- dev/lib/fix/fix.hpp | 216 ++++++++++++++++++++++++++++++++++++++++ dev/lib/fix/parser.hpp | 216 ---------------------------------------- dev/lib/net/url.hpp | 8 ++ dev/lib/simd/simd.hpp | 18 ++++ dev/tests/fix_basic/fix_test.cc | 4 +- 6 files changed, 245 insertions(+), 219 deletions(-) create mode 100644 dev/lib/fix/fix.hpp delete mode 100644 dev/lib/fix/parser.hpp create mode 100644 dev/lib/simd/simd.hpp diff --git a/dev/examples/fix/fix.cc b/dev/examples/fix/fix.cc index e3d669b..ec6668a 100644 --- a/dev/examples/fix/fix.cc +++ b/dev/examples/fix/fix.cc @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp new file mode 100644 index 0000000..723506e --- /dev/null +++ b/dev/lib/fix/fix.hpp @@ -0,0 +1,216 @@ +/* + * File: fix/parser.hpp + * Purpose: Financial Information Exchange parser in C++ + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss + */ + +#ifndef _OCL_FIX_PARSER_HPP +#define _OCL_FIX_PARSER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace ocl::fix +{ + template + class basic_visitor; + + template + struct basic_range; + + template + class basic_range_data; + + /// @brief Buffer+Length structure + template + using range_ptr_t = basic_range; + + namespace detail + { + template + const char_type* begin_fix(); + + template <> + inline const char* begin_fix() + { + return "FIX."; + } + + template <> + inline const char16_t* begin_fix() + { + return u"FIX."; + } + + template <> + inline const char8_t* begin_fix() + { + return u8"FIX."; + } + } // namespace detail + + template + struct basic_range final + { + char_type* bytes_{nullptr}; + size_t length_{}; + + bool is_valid() noexcept + { + return this->bytes_ && this->length_ > 0; + } + + explicit operator bool() + { + return this->is_valid(); + } + }; + + /// @brief Convert basic_range to usable string. + /// @note This function assumes that the basic_range is valid and contains ASCII bytes. + template + inline std::basic_string to_string(basic_range& basic_range) noexcept + { + if (basic_range.length_ < 0) + return std::basic_string{}; + + return std::basic_string(basic_range.ascii_bytes_, basic_range.length_); + } + + /// @brief a basic_range object containing the FIX packet values. + template + class basic_range_data final + { + public: + std::size_t magic_len_; + std::basic_string magic_; + std::size_t body_len_; + std::vector, std::basic_string>> body_; + + static inline const char_type* begin = detail::begin_fix(); + + explicit basic_range_data() = default; + ~basic_range_data() = default; + + basic_range_data& operator=(const basic_range_data&) = default; + basic_range_data(const basic_range_data&) = default; + + std::basic_string operator[](const std::basic_string& key) + { + if (key.empty()) + { + return std::basic_string{}; + } + + for (const auto& pair : this->body_) + { + if (pair.first == key) + { + return pair.second; + } + } + + return std::basic_string{}; + } + + bool is_valid() + { + return magic_.starts_with(basic_range_data::begin); + } + + explicit operator bool() + { + return this->is_valid(); + } + }; + + /// @brief basic_visitor object which returns a fix::basic_range_data instance. + template + class basic_visitor final + { + public: + static constexpr const char_type soh = '|'; + static constexpr const char_type eq = '='; + static constexpr uint32_t base = 10U; + + explicit basic_visitor() = default; + ~basic_visitor() = default; + + basic_visitor& operator=(const basic_visitor&) = default; + basic_visitor(const basic_visitor&) = default; + + basic_range operator()(const std::basic_string& in) + { + return this->visit(in); + } + + basic_range_data visit(const std::basic_string& in) + { + thread_local basic_range_data ret{}; + + if (in.empty()) + return ret; + + static thread_local std::basic_string in_tmp{}; + + in_tmp.reserve(in.size()); + + try + { + for (auto& ch : in) + { + if (ch != basic_visitor::soh) + { + in_tmp += ch; + continue; + } + + std::basic_string key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq)); + std::basic_string val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1); + + if (ret.magic_.empty()) + { + ret.magic_ = val; + ret.magic_len_ = ret.magic_.size(); + } + else + { + ret.body_.emplace_back(std::make_pair(key, val)); + ret.body_len_ += in_tmp.size(); + } + + in_tmp.clear(); + } + } + catch (...) + { + in_tmp.clear(); + return ret; + } + + in_tmp.clear(); + return ret; + } + }; + + template + inline void must_pass(basic_range_data& basic_range, error_handler& handler) + { + if (!basic_range.is_valid()) + { + handler("Invalid FIX packet"); + } + } + + using fix_tag_type = std::uint32_t; +} // namespace ocl::fix + +#endif // ifndef _OCL_FIX_PARSER_HPP diff --git a/dev/lib/fix/parser.hpp b/dev/lib/fix/parser.hpp deleted file mode 100644 index 723506e..0000000 --- a/dev/lib/fix/parser.hpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * File: fix/parser.hpp - * Purpose: Financial Information Exchange parser in C++ - * Author: Amlal El Mahrouss (amlal@nekernel.org) - * Copyright 2025, Amlal El Mahrouss - */ - -#ifndef _OCL_FIX_PARSER_HPP -#define _OCL_FIX_PARSER_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ocl::fix -{ - template - class basic_visitor; - - template - struct basic_range; - - template - class basic_range_data; - - /// @brief Buffer+Length structure - template - using range_ptr_t = basic_range; - - namespace detail - { - template - const char_type* begin_fix(); - - template <> - inline const char* begin_fix() - { - return "FIX."; - } - - template <> - inline const char16_t* begin_fix() - { - return u"FIX."; - } - - template <> - inline const char8_t* begin_fix() - { - return u8"FIX."; - } - } // namespace detail - - template - struct basic_range final - { - char_type* bytes_{nullptr}; - size_t length_{}; - - bool is_valid() noexcept - { - return this->bytes_ && this->length_ > 0; - } - - explicit operator bool() - { - return this->is_valid(); - } - }; - - /// @brief Convert basic_range to usable string. - /// @note This function assumes that the basic_range is valid and contains ASCII bytes. - template - inline std::basic_string to_string(basic_range& basic_range) noexcept - { - if (basic_range.length_ < 0) - return std::basic_string{}; - - return std::basic_string(basic_range.ascii_bytes_, basic_range.length_); - } - - /// @brief a basic_range object containing the FIX packet values. - template - class basic_range_data final - { - public: - std::size_t magic_len_; - std::basic_string magic_; - std::size_t body_len_; - std::vector, std::basic_string>> body_; - - static inline const char_type* begin = detail::begin_fix(); - - explicit basic_range_data() = default; - ~basic_range_data() = default; - - basic_range_data& operator=(const basic_range_data&) = default; - basic_range_data(const basic_range_data&) = default; - - std::basic_string operator[](const std::basic_string& key) - { - if (key.empty()) - { - return std::basic_string{}; - } - - for (const auto& pair : this->body_) - { - if (pair.first == key) - { - return pair.second; - } - } - - return std::basic_string{}; - } - - bool is_valid() - { - return magic_.starts_with(basic_range_data::begin); - } - - explicit operator bool() - { - return this->is_valid(); - } - }; - - /// @brief basic_visitor object which returns a fix::basic_range_data instance. - template - class basic_visitor final - { - public: - static constexpr const char_type soh = '|'; - static constexpr const char_type eq = '='; - static constexpr uint32_t base = 10U; - - explicit basic_visitor() = default; - ~basic_visitor() = default; - - basic_visitor& operator=(const basic_visitor&) = default; - basic_visitor(const basic_visitor&) = default; - - basic_range operator()(const std::basic_string& in) - { - return this->visit(in); - } - - basic_range_data visit(const std::basic_string& in) - { - thread_local basic_range_data ret{}; - - if (in.empty()) - return ret; - - static thread_local std::basic_string in_tmp{}; - - in_tmp.reserve(in.size()); - - try - { - for (auto& ch : in) - { - if (ch != basic_visitor::soh) - { - in_tmp += ch; - continue; - } - - std::basic_string key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq)); - std::basic_string val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1); - - if (ret.magic_.empty()) - { - ret.magic_ = val; - ret.magic_len_ = ret.magic_.size(); - } - else - { - ret.body_.emplace_back(std::make_pair(key, val)); - ret.body_len_ += in_tmp.size(); - } - - in_tmp.clear(); - } - } - catch (...) - { - in_tmp.clear(); - return ret; - } - - in_tmp.clear(); - return ret; - } - }; - - template - inline void must_pass(basic_range_data& basic_range, error_handler& handler) - { - if (!basic_range.is_valid()) - { - handler("Invalid FIX packet"); - } - } - - using fix_tag_type = std::uint32_t; -} // namespace ocl::fix - -#endif // ifndef _OCL_FIX_PARSER_HPP diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index ff6aebe..7263a52 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -61,4 +61,12 @@ namespace ocl::net return ss_.size() > 0; } }; + + enum class protocol + { + http, + https, + mailto, + bad + }; } // namespace ocl::net diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp new file mode 100644 index 0000000..6374a51 --- /dev/null +++ b/dev/lib/simd/simd.hpp @@ -0,0 +1,18 @@ +/* + * File: simd/simd.hpp + * Purpose: SIMD C++ library. + * Author: Amlal El Mahrouss (founder@snu.systems) + * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. + */ + +#pragma once + +#include + +namespace ocl::snu::simd +{ + struct simd_backend; + + template + struct basic_simd; +} diff --git a/dev/tests/fix_basic/fix_test.cc b/dev/tests/fix_basic/fix_test.cc index bdde392..1c80716 100644 --- a/dev/tests/fix_basic/fix_test.cc +++ b/dev/tests/fix_basic/fix_test.cc @@ -5,7 +5,7 @@ * Copyright 2025, Amlal El Mahrouss */ -#include +#include #include TEST(FIXTest, BasicFIXUsage) @@ -15,4 +15,4 @@ TEST(FIXTest, BasicFIXUsage) EXPECT_EQ(fix.magic_, ocl::fix::detail::begin_fix()); EXPECT_TRUE(fix.is_valid()); -} \ No newline at end of file +} -- cgit v1.2.3 From 2ecbd2bfb27060b6f45196d8481fd0ccdbea730c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 8 Sep 2025 23:18:52 +0200 Subject: feat: wip: `simd` module in progress. Signed-off-by: Amlal El Mahrouss --- dev/lib/simd/avx.hpp | 0 dev/lib/simd/simd.hpp | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 dev/lib/simd/avx.hpp diff --git a/dev/lib/simd/avx.hpp b/dev/lib/simd/avx.hpp new file mode 100644 index 0000000..e69de29 diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp index 6374a51..0f8f451 100644 --- a/dev/lib/simd/simd.hpp +++ b/dev/lib/simd/simd.hpp @@ -9,10 +9,51 @@ #include +/// @author Amlal El Mahrouss +/// @brief Basic SIMD processor. + namespace ocl::snu::simd { - struct simd_backend; + template + class basic_simd_processor + { + private: + SimdBackend processor_; + + enum opcode + { + bad, + add, + mul, + div, + }; + + public: + basic_simd_processor() = default; + virtual ~basic_simd_processor() = default; + + basic_simd_processor& operator=(const basic_simd_processor&) = delete; + basic_simd_processor(const basic_simd_processor&) = delete; + + typename SimdBackend::Register& call(const opcode& op, typename SimdBackend::Register& lhs, typename SimdBackend::Register& rhs) + { + switch (op) + { + case add: + return processor_.add(lhs, rhs); + case mul: + return processor_.mul(lhs, rhs); + case div: + return processor_.div(lhs, rhs); + default: + break; + } + return SimdBackend::Register::bad; + } - template - struct basic_simd; -} + std::basic_string isa() + { + return processor_.isa(); + } + }; +} // namespace ocl::snu::simd -- cgit v1.2.3 From 3f9c5017abf3c4279780f685580a334574e6d760 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 10 Sep 2025 03:28:35 +0200 Subject: feat:! breaking changes in the `opt` module. Fix `println` in `io` module. Signed-off-by: Amlal El Mahrouss --- README.md | 10 +++++----- dev/examples/opt/opt.cc | 2 +- dev/lib/io/print.hpp | 1 + dev/lib/logic/opt.hpp | 17 +++++++++++++++-- dev/lib/simd/avx.hpp | 21 +++++++++++++++++++++ 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b7790c3..0e876d7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Open C++ Library +# SIMD C++ Library [![License: GPL-2.0](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) ## Brief: -A C++ library with additional modules for your C++ SDLC. +A C++ library with additional modules for your C++ SDLC. Based on the Open C++ Library. ## Requirements: @@ -21,10 +21,10 @@ A C++ library with additional modules for your C++ SDLC. int main(int argc, char** argv) { - auto opt = ocl::opt(ocl::eval_eq(50, 50)).expect("ocl::eval_eq, does not match!"); + auto opt = ocl::opt(ocl::eval_eq(50, 50)).try_or_throw("ocl::eval_eq, does not match!"); opt = ocl::opt(ocl::eval_eq(50, 40)); - opt.expect("this time it doesn't."); - + opt.try_or_throw("this time it doesn't."); + return EXIT_SUCCESS; } ``` diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc index b34f2c7..8a74fa2 100644 --- a/dev/examples/opt/opt.cc +++ b/dev/examples/opt/opt.cc @@ -38,7 +38,7 @@ int main(int argc, char** argv) ocl::io::println("Testing data..."); auto opt = do_some("Ohio", "Ohio"); - opt.expect("Checksum failed, Ohio isn't Ohio!"); + opt.try_or_throw("Checksum failed, Ohio isn't Ohio!"); return 0; diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index 4b32ddb..40ae1bb 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -35,6 +35,7 @@ namespace ocl::io inline void println(T... fmt) noexcept { print(fmt...); + print(); } } // namespace ocl::io diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index 442756c..137460c 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -20,6 +20,7 @@ namespace ocl count = err - okay + 1, }; + template struct opt final { explicit opt(const return_type& return_type) @@ -27,11 +28,23 @@ namespace ocl { } - opt& expect(const char* input) + template + opt& try_or_handle(const char_type* input) { if (m_ret == return_type::err) { - throw std::runtime_error(input); + ErrorHandler handler; + handler(input ? input : ""); + } + + return *this; + } + + opt& try_or_throw(const char_type* input) + { + if (m_ret == return_type::err) + { + throw std::runtime_error(input ? input : ""); } return *this; diff --git a/dev/lib/simd/avx.hpp b/dev/lib/simd/avx.hpp index e69de29..16e495e 100644 --- a/dev/lib/simd/avx.hpp +++ b/dev/lib/simd/avx.hpp @@ -0,0 +1,21 @@ +/* + * File: simd/avx.hpp + * Purpose: AVX C++ library. + * Author: Amlal El Mahrouss (founder@snu.systems) + * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. + */ + +#pragma once + +#include + +namespace ocl::snu::simd +{ + struct avx_256_backend final + { + std::basic_string isa() + { + return "AVX-256"; + } + }; +} // namespace ocl::snu::simd -- cgit v1.2.3 From fa4748e414e9494442f9bcde9c659d3951af19c0 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 12 Sep 2025 20:23:39 +0200 Subject: feat: dev/lib: new `basic_simd` class, better `error_handler` class. Signed-off-by: Amlal El Mahrouss --- dev/lib/core/error_handler.hpp | 4 +++- dev/lib/io/print.hpp | 2 +- dev/lib/simd/avx.hpp | 21 ------------------ dev/lib/simd/basic_simd.hpp | 50 ++++++++++++++++++++++++++++++++++++++++++ dev/lib/simd/simd.hpp | 9 ++++---- 5 files changed, 59 insertions(+), 27 deletions(-) delete mode 100644 dev/lib/simd/avx.hpp create mode 100644 dev/lib/simd/basic_simd.hpp diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 593e54a..1a1515d 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -9,6 +9,7 @@ #define _OCL_ERROR_HANDLER_HPP #include +#include #include namespace ocl @@ -25,11 +26,12 @@ namespace ocl virtual void operator()(const std::basic_string& msg) { - ((void)msg); + ocl::io::print(msg); } }; using standard_error_handler = basic_error_handler; + using error_handler_type = basic_error_handler; } // namespace ocl #endif // ifndef _OCL_ERROR_HANDLER_HPP diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index 40ae1bb..307c06f 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -35,7 +35,7 @@ namespace ocl::io inline void println(T... fmt) noexcept { print(fmt...); - print(); + print(); } } // namespace ocl::io diff --git a/dev/lib/simd/avx.hpp b/dev/lib/simd/avx.hpp deleted file mode 100644 index 16e495e..0000000 --- a/dev/lib/simd/avx.hpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * File: simd/avx.hpp - * Purpose: AVX C++ library. - * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. - */ - -#pragma once - -#include - -namespace ocl::snu::simd -{ - struct avx_256_backend final - { - std::basic_string isa() - { - return "AVX-256"; - } - }; -} // namespace ocl::snu::simd diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp new file mode 100644 index 0000000..d748d0c --- /dev/null +++ b/dev/lib/simd/basic_simd.hpp @@ -0,0 +1,50 @@ +/* + * File: simd/basic_simd.hpp + * Purpose: Basic SIMD backend C++ library. + * Author: Amlal El Mahrouss (founder@snu.systems) + * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. + */ + +#pragma once + +#include +#include + +#ifdef __x86_64__ +#include + +using simd_type = __m256; +#endif + +#ifdef __aarch64__ +#include + +using simd_type = float32x4_t; +#endif + +namespace ocl::snu::simd +{ + struct basic_simd_backend final + { + struct simd_traits final + { + simd_type __val; + + private: + static bool bad; + friend class basic_simd_backend; + }; + + using register_type = simd_traits; + + const bool& is_bad() noexcept + { + return register_type::bad; + } + + std::basic_string isa() + { + return "basic-backend"; + } + }; +} // namespace ocl::snu::simd diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp index 0f8f451..779d020 100644 --- a/dev/lib/simd/simd.hpp +++ b/dev/lib/simd/simd.hpp @@ -14,11 +14,11 @@ namespace ocl::snu::simd { - template + template class basic_simd_processor { private: - SimdBackend processor_; + backend_type processor_; enum opcode { @@ -35,7 +35,7 @@ namespace ocl::snu::simd basic_simd_processor& operator=(const basic_simd_processor&) = delete; basic_simd_processor(const basic_simd_processor&) = delete; - typename SimdBackend::Register& call(const opcode& op, typename SimdBackend::Register& lhs, typename SimdBackend::Register& rhs) + typename backend_type::register_type& call(const opcode& op, typename backend_type::register_type& lhs, typename backend_type::register_type& rhs) { switch (op) { @@ -48,7 +48,8 @@ namespace ocl::snu::simd default: break; } - return SimdBackend::Register::bad; + + return processor_.is_bad(); } std::basic_string isa() -- cgit v1.2.3 From a786997f304745ce3766a82be06dc6a5d0c2f02c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 14 Oct 2025 04:35:26 +0200 Subject: feat: scl: major refactors and new version of SCL. Signed-off-by: Amlal El Mahrouss --- Doxyfile | 4 ++-- README.md | 4 ++-- compile_flags.txt | 2 +- dev/examples/allocator_system/allocator_system.cc | 13 +++++++---- dev/examples/cgi/cgi.cc | 4 ++-- dev/examples/equiv/equiv.cc | 6 ++--- dev/examples/fix/fix.cc | 6 ++--- dev/examples/opt/opt.cc | 4 ++-- dev/examples/tracked_ptr/tracked_ptr.cc | 8 +++---- dev/lib/core/allocator_system.hpp | 10 ++++---- dev/lib/core/error_handler.hpp | 12 +++++----- dev/lib/except/error.hpp | 10 ++++---- dev/lib/fix/fix.hpp | 10 ++++---- dev/lib/io/print.hpp | 10 ++++---- dev/lib/logic/equiv.hpp | 4 ++-- dev/lib/logic/math.hpp | 4 ++-- dev/lib/logic/opt.hpp | 10 ++++---- dev/lib/memory/tracked_ptr.hpp | 4 ++-- dev/lib/net/modem.hpp | 22 +++++++++--------- dev/lib/net/url.hpp | 4 ++-- dev/lib/simd/basic_simd.hpp | 4 ++-- dev/lib/simd/simd.hpp | 4 ++-- dev/lib/tests/hpptest.hpp | 4 ++-- dev/lib/utility/cgi_writer.hpp | 28 +++++++++++------------ dev/lib/utility/chunk_string.hpp | 6 ++--- dev/lib/utility/crc32.hpp | 10 ++++---- dev/lib/utility/embfs.hpp | 10 ++++---- dev/tests/chunk_string/chunk_test.cc | 2 +- dev/tests/fix_basic/fix_test.cc | 6 ++--- dev/tests/network_basic/net_test.cc | 4 ++-- dev/tests/tracked_ptr_basic/tracked_ptr_test.cc | 8 +++---- dev/tests/tracked_ptr_leak/tracked_ptr_test.cc | 10 ++++---- meta/tex/embfs.tex | 2 +- 33 files changed, 126 insertions(+), 123 deletions(-) diff --git a/Doxyfile b/Doxyfile index a558fb4..af59bc5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -74,7 +74,7 @@ PROJECT_ICON = # entered, it will be relative to the location where Doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./ocl/docs +OUTPUT_DIRECTORY = ./scl/docs # If the CREATE_SUBDIRS tag is set to YES then Doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -991,7 +991,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = /Volumes/Projects/src/ocl +INPUT = /Volumes/Projects/src/scl # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/README.md b/README.md index 0e876d7..20fee1a 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ A C++ library with additional modules for your C++ SDLC. Based on the Open C++ L int main(int argc, char** argv) { - auto opt = ocl::opt(ocl::eval_eq(50, 50)).try_or_throw("ocl::eval_eq, does not match!"); - opt = ocl::opt(ocl::eval_eq(50, 40)); + auto opt = scl::opt(scl::eval_eq(50, 50)).try_or_throw("scl::eval_eq, does not match!"); + opt = scl::opt(scl::eval_eq(50, 40)); opt.try_or_throw("this time it doesn't."); return EXIT_SUCCESS; diff --git a/compile_flags.txt b/compile_flags.txt index 1c9f6fb..da935d4 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -2,4 +2,4 @@ -std=c++20 -DEMBFS_28BIT_LBA -xc++ --I/opt/homebrew/Cellar/boost/1.87.0/include \ No newline at end of file +-I/opt/homebrew/Cellar/boost/1.89.0/include \ No newline at end of file diff --git a/dev/examples/allocator_system/allocator_system.cc b/dev/examples/allocator_system/allocator_system.cc index c3cd689..169cd97 100644 --- a/dev/examples/allocator_system/allocator_system.cc +++ b/dev/examples/allocator_system/allocator_system.cc @@ -8,10 +8,11 @@ #include #include -struct MyClass +class MyClass final { - int a; - std::string b; +public: + int a{}; + std::string b{}; MyClass() : a(0), b("default") { @@ -31,17 +32,19 @@ struct MyClass int main() { - using Alloc = ocl::standard_allocator_type; - Alloc allocator; + scl::standard_allocator_type allocator; // Test 1: claim() + unclaim() std::cout << "=== Test 1: claim/unclaim ===\n"; + MyClass* raw = allocator.claim(); + std::cout << "raw->a = " << raw->a << ", raw->b = " << raw->b << "\n"; allocator.unclaim(raw); // Manual delete // Test 2: construct() → shared_ptr std::cout << "\n=== Test 2: construct (shared_ptr) ===\n"; + auto ptr = allocator.construct(42, "hello"); std::cout << "ptr->a = " << ptr->a << ", ptr->b = " << ptr->b << "\n"; diff --git a/dev/examples/cgi/cgi.cc b/dev/examples/cgi/cgi.cc index 692f90c..6f73eff 100644 --- a/dev/examples/cgi/cgi.cc +++ b/dev/examples/cgi/cgi.cc @@ -6,7 +6,7 @@ #include -static ocl::basic_chunk_string text_sample = R"( +static scl::basic_chunk_string text_sample = R"( @@ -68,7 +68,7 @@ static ocl::basic_chunk_string text_sample = R"( /* @brief this stub loads a 'index.html' or returns an error message if not found. */ int main(int argc, char** argv) { - ocl::cgi::basic_writer<> writer; + scl::cgi::basic_writer<> writer; writer << text_sample; return 0; diff --git a/dev/examples/equiv/equiv.cc b/dev/examples/equiv/equiv.cc index 12207f4..9d41afb 100644 --- a/dev/examples/equiv/equiv.cc +++ b/dev/examples/equiv/equiv.cc @@ -11,9 +11,9 @@ int main(int argc, char** argv) { std::cout << std::boolalpha; - std::cout << ocl::equiv::is_same::value << std::endl; - std::cout << ocl::equiv::is_same::value << std::endl; - std::cout << ocl::equiv::is_same::value << std::endl; + std::cout << scl::equiv::is_same::value << std::endl; + std::cout << scl::equiv::is_same::value << std::endl; + std::cout << scl::equiv::is_same::value << std::endl; return 0; } diff --git a/dev/examples/fix/fix.cc b/dev/examples/fix/fix.cc index ec6668a..aaac979 100644 --- a/dev/examples/fix/fix.cc +++ b/dev/examples/fix/fix.cc @@ -15,14 +15,14 @@ int main(int argc, char** argv) { constexpr auto default_fix = "8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"; - ocl::fix::basic_visitor basic_visitor; - ocl::fix::basic_range_data fix = basic_visitor.visit(default_fix); + scl::fix::basic_visitor basic_visitor; + scl::fix::basic_range_data fix = basic_visitor.visit(default_fix); std::cout << "magic=" << fix.magic_ << std::endl; std::cout << "magic_len=" << fix.magic_len_ << std::endl; std::cout << "is_valid=" << std::boolalpha << fix.is_valid() << std::endl; - ocl::fix::must_pass(fix); + scl::fix::must_pass(fix); for (auto fields : fix.body_) { diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc index 8a74fa2..eb725c4 100644 --- a/dev/examples/opt/opt.cc +++ b/dev/examples/opt/opt.cc @@ -26,7 +26,7 @@ static auto do_some(const std::string recv_data, const std::string check_data) const int hash_to_check = do_hash(check_data); /* here we assume this should match opt_hash */ const int opt_hash = do_hash(recv_data); /* we assume that the hash is correct */ - auto opt = ocl::opt(ocl::eval_eq(hash_to_check, opt_hash)); /* do the compute */ + auto opt = scl::opt(scl::eval_eq(hash_to_check, opt_hash)); /* do the compute */ return opt; } @@ -35,7 +35,7 @@ int main(int argc, char** argv) { // ... let's assume we fetch data from network... - ocl::io::println("Testing data..."); + scl::io::println("Testing data..."); auto opt = do_some("Ohio", "Ohio"); opt.try_or_throw("Checksum failed, Ohio isn't Ohio!"); diff --git a/dev/examples/tracked_ptr/tracked_ptr.cc b/dev/examples/tracked_ptr/tracked_ptr.cc index 6e3f4a2..6b8a859 100644 --- a/dev/examples/tracked_ptr/tracked_ptr.cc +++ b/dev/examples/tracked_ptr/tracked_ptr.cc @@ -9,13 +9,13 @@ static void summon_tracked_ptr() { - ocl::memory::tracked_ptr ptr = ocl::memory::make_tracked(42); + scl::memory::tracked_ptr ptr = scl::memory::make_tracked(42); std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; } static void summon_leak_tracked_ptr() { - ocl::memory::tracked_ptr* ptr = new ocl::memory::tracked_ptr(42); + scl::memory::tracked_ptr* ptr = new scl::memory::tracked_ptr(42); std::cout << ptr->data() << "=" << ptr->manager().allocator().allocated_count_ << std::endl; } @@ -27,7 +27,7 @@ int main(int argc, char** argv) summon_tracked_ptr(); summon_tracked_ptr(); - ocl::memory::tracked_ptr ptr; + scl::memory::tracked_ptr ptr; std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; @@ -46,7 +46,7 @@ int main(int argc, char** argv) std::cout << "total=" << ptr.manager().allocator().deallocated_count_ << std::endl; std::cout << "leak-detected=" << std::boolalpha << (ptr.manager().allocator().allocated_count_ > ptr.manager().allocator().deallocated_count_) << std::endl; - ocl::memory::must_pass(ptr); + scl::memory::must_pass(ptr); return EXIT_SUCCESS; } diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/core/allocator_system.hpp index 1243ed5..53cf095 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/core/allocator_system.hpp @@ -5,14 +5,14 @@ * Copyright 2025, Amlal El Mahrouss. Licensed under the BSL 1.0 license */ -#ifndef _OCL_ALLOCATOR_SYSTEM_HPP -#define _OCL_ALLOCATOR_SYSTEM_HPP +#ifndef _SCL_ALLOCATOR_SYSTEM_HPP +#define _SCL_ALLOCATOR_SYSTEM_HPP #include #include #include -namespace ocl +namespace scl { template struct new_op final @@ -70,6 +70,6 @@ namespace ocl template using standard_allocator_type = allocator_system, delete_op>; -} // namespace ocl +} // namespace scl -#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP +#endif // ifndef _SCL_ALLOCATOR_SYSTEM_HPP diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 1a1515d..939a0ff 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -5,14 +5,14 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _OCL_ERROR_HANDLER_HPP -#define _OCL_ERROR_HANDLER_HPP +#ifndef _SCL_ERROR_HANDLER_HPP +#define _SCL_ERROR_HANDLER_HPP #include #include #include -namespace ocl +namespace scl { struct basic_error_handler; @@ -26,12 +26,12 @@ namespace ocl virtual void operator()(const std::basic_string& msg) { - ocl::io::print(msg); + scl::io::print(msg); } }; using standard_error_handler = basic_error_handler; using error_handler_type = basic_error_handler; -} // namespace ocl +} // namespace scl -#endif // ifndef _OCL_ERROR_HANDLER_HPP +#endif // ifndef _SCL_ERROR_HANDLER_HPP diff --git a/dev/lib/except/error.hpp b/dev/lib/except/error.hpp index 16bf5eb..31b9894 100644 --- a/dev/lib/except/error.hpp +++ b/dev/lib/except/error.hpp @@ -4,17 +4,17 @@ * Copyright 2023-2025, Amlal El Mahrouss */ -#ifndef _OCL_ERR_HPP -#define _OCL_ERR_HPP +#ifndef _SCL_ERR_HPP +#define _SCL_ERR_HPP #include -namespace ocl +namespace scl { using runtime_error = std::runtime_error; using fix_error = runtime_error; using math_error = runtime_error; using cgi_error = runtime_error; -} // namespace ocl +} // namespace scl -#endif // _OCL_ERR_HPP \ No newline at end of file +#endif // _SCL_ERR_HPP \ No newline at end of file diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp index 723506e..4a5a3ae 100644 --- a/dev/lib/fix/fix.hpp +++ b/dev/lib/fix/fix.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef _OCL_FIX_PARSER_HPP -#define _OCL_FIX_PARSER_HPP +#ifndef _SCL_FIX_PARSER_HPP +#define _SCL_FIX_PARSER_HPP #include #include @@ -18,7 +18,7 @@ #include #include -namespace ocl::fix +namespace scl::fix { template class basic_visitor; @@ -211,6 +211,6 @@ namespace ocl::fix } using fix_tag_type = std::uint32_t; -} // namespace ocl::fix +} // namespace scl::fix -#endif // ifndef _OCL_FIX_PARSER_HPP +#endif // ifndef _SCL_FIX_PARSER_HPP diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index 307c06f..8463b6f 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -5,13 +5,13 @@ * Copyright 2025 */ -#ifndef _OCL_PRINT_HPP -#define _OCL_PRINT_HPP +#ifndef _SCL_PRINT_HPP +#define _SCL_PRINT_HPP #include #include -namespace ocl::io +namespace scl::io { template inline void print(T fmt, Args... other) noexcept @@ -37,6 +37,6 @@ namespace ocl::io print(fmt...); print(); } -} // namespace ocl::io +} // namespace scl::io -#endif // ifndef _OCL_PRINT_HPP +#endif // ifndef _SCL_PRINT_HPP diff --git a/dev/lib/logic/equiv.hpp b/dev/lib/logic/equiv.hpp index 5b022f8..05d0f53 100644 --- a/dev/lib/logic/equiv.hpp +++ b/dev/lib/logic/equiv.hpp @@ -8,7 +8,7 @@ #pragma once /// @brief OCL equivalence namespace. -namespace ocl::equiv +namespace scl::equiv { template struct basic_hash_trait @@ -101,4 +101,4 @@ namespace ocl::equiv return left_ / right_ == 1; } }; -} // namespace ocl::equiv +} // namespace scl::equiv diff --git a/dev/lib/logic/math.hpp b/dev/lib/logic/math.hpp index e796eae..2d00595 100644 --- a/dev/lib/logic/math.hpp +++ b/dev/lib/logic/math.hpp @@ -9,7 +9,7 @@ #include -namespace ocl +namespace scl { template struct is_non_boolean_integer final @@ -32,4 +32,4 @@ namespace ocl constexpr inline auto not_a_number = NAN; constexpr inline auto positive_infinity = INFINITY; constexpr inline auto negative_infinity = -positive_infinity; -} // namespace ocl \ No newline at end of file +} // namespace scl \ No newline at end of file diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index 137460c..4ce999c 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -4,13 +4,13 @@ * Copyright 2023-2025, Amlal El Mahrouss */ -#ifndef _OCL_OPT_HPP -#define _OCL_OPT_HPP +#ifndef _SCL_OPT_HPP +#define _SCL_OPT_HPP #include #include -namespace ocl +namespace scl { enum class return_type { @@ -129,6 +129,6 @@ namespace ocl { return return_type::err; } -} // namespace ocl +} // namespace scl -#endif /* ifndef _OCL_OPT_HPP */ +#endif /* ifndef _SCL_OPT_HPP */ diff --git a/dev/lib/memory/tracked_ptr.hpp b/dev/lib/memory/tracked_ptr.hpp index d2f8450..eb33bd0 100644 --- a/dev/lib/memory/tracked_ptr.hpp +++ b/dev/lib/memory/tracked_ptr.hpp @@ -16,7 +16,7 @@ #include #include -namespace ocl::memory +namespace scl::memory { template class tracked_allocator; @@ -232,4 +232,4 @@ namespace ocl::memory ::kill(::getpid(), SIGTRAP); } } -} // namespace ocl::memory +} // namespace scl::memory diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp index 074f182..69b1aef 100644 --- a/dev/lib/net/modem.hpp +++ b/dev/lib/net/modem.hpp @@ -5,19 +5,18 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef _OCL_NET_NETWORK_HPP -#define _OCL_NET_NETWORK_HPP +#ifndef _SCL_NET_NETWORK_HPP +#define _SCL_NET_NETWORK_HPP #include #include #include #include -#include #include -#define OCL_MODEM_INTERFACE : public ocl::net::basic_modem +#define OCL_MODEM_INTERFACE : public scl::net::basic_modem -namespace ocl::net +namespace scl::net { class basic_modem; @@ -130,12 +129,13 @@ namespace ocl::net return ret == 0L; } - ::bind(fd_, (struct sockaddr*)&addr_, sizeof(addr_)); - ::listen(fd_, basic_modem::backlog_count); + int ret = ::bind(fd_, (struct sockaddr*)&addr_, sizeof(addr_)); - bad_ = false; + bad_ = ret == -1; + + ::listen(fd_, basic_modem::backlog_count); - return true; + return bad_ == false; } bool destroy() noexcept @@ -151,6 +151,6 @@ namespace ocl::net return true; } }; -} // namespace ocl::net +} // namespace scl::net -#endif // ifndef _OCL_NET_NETWORK_HPP +#endif // ifndef _SCL_NET_NETWORK_HPP diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index 7263a52..3ada418 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -13,7 +13,7 @@ /// @author Amlal El Mahrouss (amlal@nekernel.org) -namespace ocl::net +namespace scl::net { template class basic_url; @@ -69,4 +69,4 @@ namespace ocl::net mailto, bad }; -} // namespace ocl::net +} // namespace scl::net diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp index d748d0c..97d0399 100644 --- a/dev/lib/simd/basic_simd.hpp +++ b/dev/lib/simd/basic_simd.hpp @@ -22,7 +22,7 @@ using simd_type = __m256; using simd_type = float32x4_t; #endif -namespace ocl::snu::simd +namespace scl::snu::simd { struct basic_simd_backend final { @@ -47,4 +47,4 @@ namespace ocl::snu::simd return "basic-backend"; } }; -} // namespace ocl::snu::simd +} // namespace scl::snu::simd diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp index 779d020..3cb4d7a 100644 --- a/dev/lib/simd/simd.hpp +++ b/dev/lib/simd/simd.hpp @@ -12,7 +12,7 @@ /// @author Amlal El Mahrouss /// @brief Basic SIMD processor. -namespace ocl::snu::simd +namespace scl::snu::simd { template class basic_simd_processor @@ -57,4 +57,4 @@ namespace ocl::snu::simd return processor_.isa(); } }; -} // namespace ocl::snu::simd +} // namespace scl::snu::simd diff --git a/dev/lib/tests/hpptest.hpp b/dev/lib/tests/hpptest.hpp index f520339..87d8f77 100644 --- a/dev/lib/tests/hpptest.hpp +++ b/dev/lib/tests/hpptest.hpp @@ -8,7 +8,7 @@ #pragma once #ifdef OCL_HPPTEST -namespace ocl::hpptest +namespace scl::hpptest { typedef bool condition_type; @@ -17,5 +17,5 @@ namespace ocl::hpptest { OCL_HPPTEST_ASSERT(expr); } -} // namespace ocl::hpptest +} // namespace scl::hpptest #endif diff --git a/dev/lib/utility/cgi_writer.hpp b/dev/lib/utility/cgi_writer.hpp index 126b299..87354ac 100644 --- a/dev/lib/utility/cgi_writer.hpp +++ b/dev/lib/utility/cgi_writer.hpp @@ -4,15 +4,15 @@ * Copyright 2023-2025, Amlal El Mahrouss. */ -#ifndef _OCL_CGI_WRITER_HPP -#define _OCL_CGI_WRITER_HPP +#ifndef _SCL_CGI_WRITER_HPP +#define _SCL_CGI_WRITER_HPP #include #include #include #include -namespace ocl +namespace scl { namespace cgi { @@ -21,7 +21,7 @@ namespace ocl class basic_writer { private: - basic_writer& eval_(const ocl::basic_chunk_string& mime, const ocl::basic_chunk_string& ss) noexcept + basic_writer& eval_(const scl::basic_chunk_string& mime, const scl::basic_chunk_string& ss) noexcept { std::basic_stringstream ss_out; @@ -30,50 +30,50 @@ namespace ocl ss_out << std::format("Content-Length: {}\r\n\r\n", ss.str().size()); ss_out << ss.str(); - ocl::io::print(ss_out.str()); + scl::io::print(ss_out.str()); return *this; } public: explicit basic_writer() = default; - ~basic_writer() = default; + virtual ~basic_writer() = default; basic_writer& operator=(const basic_writer&) = default; basic_writer(const basic_writer&) = default; public: - friend void operator<<(basic_writer& self, const ocl::basic_chunk_string& ss_in) + friend void operator<<(basic_writer& self, const scl::basic_chunk_string& ss_in) { self = self.eval_("text/plain", ss_in); } - basic_writer& binary(const ocl::basic_chunk_string& ss_in) + basic_writer& binary(const scl::basic_chunk_string& ss_in) { return this->eval_("application/octet-stream", ss_in); } - basic_writer& html(const ocl::basic_chunk_string& ss_in) + basic_writer& html(const scl::basic_chunk_string& ss_in) { return this->eval_("text/html", ss_in); } - basic_writer& xml(const ocl::basic_chunk_string& ss_in) + basic_writer& xml(const scl::basic_chunk_string& ss_in) { return this->eval_("application/xml", ss_in); } - basic_writer& json(const ocl::basic_chunk_string& ss_in) + basic_writer& json(const scl::basic_chunk_string& ss_in) { return this->eval_("application/json", ss_in); } - basic_writer& js(const ocl::basic_chunk_string& ss_in) + basic_writer& js(const scl::basic_chunk_string& ss_in) { return this->eval_("text/javascript", ss_in); } }; } // namespace cgi -} // namespace ocl +} // namespace scl -#endif // ifndef _OCL_CGI_WRITER_HPP +#endif // ifndef _SCL_CGI_WRITER_HPP diff --git a/dev/lib/utility/chunk_string.hpp b/dev/lib/utility/chunk_string.hpp index 4fe5cc2..c5bf5c6 100644 --- a/dev/lib/utility/chunk_string.hpp +++ b/dev/lib/utility/chunk_string.hpp @@ -10,7 +10,7 @@ #include -namespace ocl +namespace scl { template class basic_chunk_string; @@ -89,7 +89,7 @@ namespace ocl void print() noexcept { - ocl::io::print(packed_chunks_); + scl::io::print(packed_chunks_); } }; @@ -98,5 +98,5 @@ namespace ocl { fmt.print(); } -} // namespace ocl +} // namespace scl #endif // ifndef OCL_UTILITY_CHUNK_STRING_HPP diff --git a/dev/lib/utility/crc32.hpp b/dev/lib/utility/crc32.hpp index ea09b94..93347a8 100644 --- a/dev/lib/utility/crc32.hpp +++ b/dev/lib/utility/crc32.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _OCL_CRC32_HPP -#define _OCL_CRC32_HPP +#ifndef _SCL_CRC32_HPP +#define _SCL_CRC32_HPP #include #include @@ -15,7 +15,7 @@ /// @brief Crc32 implementation in C++ /// @author Amlal EL Mahrouss (amlal@nekernel.org) -namespace ocl::crc32 +namespace scl::crc32 { namespace detail { @@ -76,6 +76,6 @@ namespace ocl::crc32 { return detail::crc32(in.c_str(), in.size()); } -} // namespace ocl::crc32 +} // namespace scl::crc32 -#endif // !_OCL_CRC32_HPP \ No newline at end of file +#endif // !_SCL_CRC32_HPP \ No newline at end of file diff --git a/dev/lib/utility/embfs.hpp b/dev/lib/utility/embfs.hpp index 0f20596..689082c 100644 --- a/dev/lib/utility/embfs.hpp +++ b/dev/lib/utility/embfs.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _OCL_EMBFS_HPP -#define _OCL_EMBFS_HPP +#ifndef _SCL_EMBFS_HPP +#define _SCL_EMBFS_HPP #include #include @@ -14,7 +14,7 @@ /// @brief A filesystem designed for tiny storage medias. /// @author Amlal EL Mahrouss (amlal@nekernel.org) -namespace ocl::embfs +namespace scl::embfs { namespace traits { @@ -75,6 +75,6 @@ namespace ocl::embfs /// @brief Indexed node linear array. typedef embfs_inode embfs_inode_arr_t[_inode_arr_len]; } // namespace traits -} // namespace ocl::embfs +} // namespace scl::embfs -#endif // ifndef _OCL_EMBFS_HPP \ No newline at end of file +#endif // ifndef _SCL_EMBFS_HPP \ No newline at end of file diff --git a/dev/tests/chunk_string/chunk_test.cc b/dev/tests/chunk_string/chunk_test.cc index ad3d31b..b24b332 100644 --- a/dev/tests/chunk_string/chunk_test.cc +++ b/dev/tests/chunk_string/chunk_test.cc @@ -16,7 +16,7 @@ TEST(ChunkTest, BasicChunkUsage) auto start = std::chrono::high_resolution_clock::now(); - ocl::basic_chunk_string optimized; + scl::basic_chunk_string optimized; for (unsigned i = 0; i < iterations; ++i) { diff --git a/dev/tests/fix_basic/fix_test.cc b/dev/tests/fix_basic/fix_test.cc index 1c80716..5457f21 100644 --- a/dev/tests/fix_basic/fix_test.cc +++ b/dev/tests/fix_basic/fix_test.cc @@ -10,9 +10,9 @@ TEST(FIXTest, BasicFIXUsage) { - ocl::fix::basic_visitor basic_visitor; - ocl::fix::basic_range_data fix = basic_visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"); + scl::fix::basic_visitor basic_visitor; + scl::fix::basic_range_data fix = basic_visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"); - EXPECT_EQ(fix.magic_, ocl::fix::detail::begin_fix()); + EXPECT_EQ(fix.magic_, scl::fix::detail::begin_fix()); EXPECT_TRUE(fix.is_valid()); } diff --git a/dev/tests/network_basic/net_test.cc b/dev/tests/network_basic/net_test.cc index 61d0b28..4bd3a9f 100644 --- a/dev/tests/network_basic/net_test.cc +++ b/dev/tests/network_basic/net_test.cc @@ -12,8 +12,8 @@ TEST(NetworkTest, BasicNetworkUsage) { - ocl::net::basic_modem modem; - modem.construct(ocl::net::basic_modem::local_address_ip4, true); + scl::net::basic_modem modem; + modem.construct(scl::net::basic_modem::local_address_ip4, true); EXPECT_TRUE(modem.is_valid()); diff --git a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc b/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc index 1e97188..decae88 100644 --- a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc +++ b/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc @@ -10,16 +10,16 @@ TEST(TrackedPtrTest, BasicTrackedPtrUsage) { - ocl::memory::tracked_ptr ptr = ocl::memory::make_tracked(42); + scl::memory::tracked_ptr ptr = scl::memory::make_tracked(42); ASSERT_TRUE(ptr); EXPECT_EQ(*ptr, 42); - ocl::memory::tracked_ptr ptr2; + scl::memory::tracked_ptr ptr2; - ocl::memory::swap(ptr, ptr2); + scl::memory::swap(ptr, ptr2); ptr2.reset(); - EXPECT_EQ(ocl::memory::tracked_ptr::manager().allocator().allocated_count_, 1); + EXPECT_EQ(scl::memory::tracked_ptr::manager().allocator().allocated_count_, 1); } \ No newline at end of file diff --git a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc b/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc index f349f47..375fb35 100644 --- a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc +++ b/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc @@ -10,10 +10,10 @@ TEST(TrackedPtrTest, LeakTrackedPtrUsage) { - ocl::memory::tracked_ptr* ptr = new ocl::memory::tracked_ptr(42); - ocl::memory::tracked_ptr* ptr2 = new ocl::memory::tracked_ptr(42); - ocl::memory::tracked_ptr* ptr3 = new ocl::memory::tracked_ptr(42); + scl::memory::tracked_ptr* ptr = new scl::memory::tracked_ptr(42); + scl::memory::tracked_ptr* ptr2 = new scl::memory::tracked_ptr(42); + scl::memory::tracked_ptr* ptr3 = new scl::memory::tracked_ptr(42); - EXPECT_EQ(ocl::memory::tracked_ptr::manager().allocator().allocated_count_, 3); - ASSERT_TRUE(ocl::memory::tracked_ptr::manager().allocator().deallocated_count_ == 0); + EXPECT_EQ(scl::memory::tracked_ptr::manager().allocator().allocated_count_, 3); + ASSERT_TRUE(scl::memory::tracked_ptr::manager().allocator().deallocated_count_ == 0); } \ No newline at end of file diff --git a/meta/tex/embfs.tex b/meta/tex/embfs.tex index 2d5c60e..1548ab8 100644 --- a/meta/tex/embfs.tex +++ b/meta/tex/embfs.tex @@ -37,7 +37,7 @@ The \textbf{Embedded File System (EMBFS)} is a compact and minimal filesystem de \section{Namespace} The EMBFS implementation resides under: \begin{lstlisting} -namespace ocl::embfs +namespace scl::embfs \end{lstlisting} \section{Supported Logical Block Addressing (LBA) Modes} -- cgit v1.2.3 From 01c6071ac4a64cbee4270a73f0fe88b10b31097d Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 26 Oct 2025 12:28:20 +0100 Subject: feat: important refactors for SCL. Signed-off-by: Amlal El Mahrouss --- dev/lib/core/allocator_system.hpp | 1 - dev/lib/core/error_handler.hpp | 1 - dev/lib/fix/fix.hpp | 1 - dev/lib/net/modem.hpp | 2 +- dev/lib/net/url.hpp | 1 - dev/lib/simd/basic_simd.hpp | 5 +---- dev/lib/tests/gtest.hpp | 2 ++ dev/lib/tests/hpptest.hpp | 4 ++-- dev/lib/utility/chunk_string.hpp | 6 +++--- tools/hpptest.py | 2 +- 10 files changed, 10 insertions(+), 15 deletions(-) diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/core/allocator_system.hpp index 53cf095..3ffa02a 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/core/allocator_system.hpp @@ -9,7 +9,6 @@ #define _SCL_ALLOCATOR_SYSTEM_HPP #include -#include #include namespace scl diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 939a0ff..449e255 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -10,7 +10,6 @@ #include #include -#include namespace scl { diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp index 4a5a3ae..672b8a1 100644 --- a/dev/lib/fix/fix.hpp +++ b/dev/lib/fix/fix.hpp @@ -16,7 +16,6 @@ #include #include #include -#include namespace scl::fix { diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp index 69b1aef..6c63399 100644 --- a/dev/lib/net/modem.hpp +++ b/dev/lib/net/modem.hpp @@ -14,7 +14,7 @@ #include #include -#define OCL_MODEM_INTERFACE : public scl::net::basic_modem +#define SCL_MODEM_INTERFACE : public scl::net::basic_modem namespace scl::net { diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index 3ada418..6772ac4 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -8,7 +8,6 @@ #pragma once #include -#include #include /// @author Amlal El Mahrouss (amlal@nekernel.org) diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp index 97d0399..b3087ff 100644 --- a/dev/lib/simd/basic_simd.hpp +++ b/dev/lib/simd/basic_simd.hpp @@ -8,17 +8,14 @@ #pragma once #include -#include #ifdef __x86_64__ #include - using simd_type = __m256; #endif #ifdef __aarch64__ #include - using simd_type = float32x4_t; #endif @@ -44,7 +41,7 @@ namespace scl::snu::simd std::basic_string isa() { - return "basic-backend"; + return "basic_simd_backend"; } }; } // namespace scl::snu::simd diff --git a/dev/lib/tests/gtest.hpp b/dev/lib/tests/gtest.hpp index deb2ddf..c333d2c 100644 --- a/dev/lib/tests/gtest.hpp +++ b/dev/lib/tests/gtest.hpp @@ -5,4 +5,6 @@ * Copyright 2025, Amlal El Mahrouss */ +#pragma once + #include diff --git a/dev/lib/tests/hpptest.hpp b/dev/lib/tests/hpptest.hpp index 87d8f77..333ece3 100644 --- a/dev/lib/tests/hpptest.hpp +++ b/dev/lib/tests/hpptest.hpp @@ -7,7 +7,7 @@ #pragma once -#ifdef OCL_HPPTEST +#ifdef SCL_HPPTEST namespace scl::hpptest { typedef bool condition_type; @@ -15,7 +15,7 @@ namespace scl::hpptest template consteval inline void must_pass() { - OCL_HPPTEST_ASSERT(expr); + SCL_HPPTEST_ASSERT(expr); } } // namespace scl::hpptest #endif diff --git a/dev/lib/utility/chunk_string.hpp b/dev/lib/utility/chunk_string.hpp index c5bf5c6..6778173 100644 --- a/dev/lib/utility/chunk_string.hpp +++ b/dev/lib/utility/chunk_string.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef OCL_UTILITY_CHUNK_STRING_HPP -#define OCL_UTILITY_CHUNK_STRING_HPP +#ifndef SCL_UTILITY_CHUNK_STRING_HPP +#define SCL_UTILITY_CHUNK_STRING_HPP #include @@ -99,4 +99,4 @@ namespace scl fmt.print(); } } // namespace scl -#endif // ifndef OCL_UTILITY_CHUNK_STRING_HPP +#endif // ifndef SCL_UTILITY_CHUNK_STRING_HPP diff --git a/tools/hpptest.py b/tools/hpptest.py index dbed143..5bb09bd 100755 --- a/tools/hpptest.py +++ b/tools/hpptest.py @@ -5,7 +5,7 @@ import sys, os if __name__ == '__main__': if len(sys.argv) == 3: - ret = os.system(f"clang++ -I./dev/ -I{sys.argv[2]} -std=c++20 -DOCL_HPPTEST '-DOCL_HPPTEST_ASSERT(x)=static_assert(x, #x)' {sys.argv[1]}") + ret = os.system(f"clang++ -I./dev/ -I{sys.argv[2]} -std=c++20 -DSCL_HPPTEST '-DSCL_HPPTEST_ASSERT(x)=static_assert(x, #x)' {sys.argv[1]}") if ret == 0: print("[TEST] HEADER COMPILATION PASSES") -- cgit v1.2.3 From 964f0d8ca36d9333efcfd3136a5cae77dc5dded4 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 5 Nov 2025 21:16:28 +0100 Subject: feat: lib: implement basic_url and fix httptest header. Signed-off-by: Amlal El Mahrouss --- dev/lib/net/url.hpp | 59 ++++++++++++++++++++++++++++++++--------------- dev/lib/tests/hpptest.hpp | 4 ++-- dev/lib/utility/embfs.hpp | 3 ++- 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index 6772ac4..52991f2 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -11,42 +11,67 @@ #include /// @author Amlal El Mahrouss (amlal@nekernel.org) +/// @brief Parse URLs (in a non-standard way). namespace scl::net { template class basic_url; - template - class basic_url_traits; + enum class url_protocol + { + invalid = 0, + http, + https, + mailto, + bad = 0xff, + }; /// @brief Basic URL parser container. template class basic_url final { - friend basic_url_traits; - - std::basic_stringstream ss_{}; + url_protocol m_protocol_{url_protocol::invalid}; + std::basic_stringstream m_ss_{}; public: - explicit basic_url() = default; - ~basic_url() = default; + explicit basic_url(const std::basic_string& protocol) + { + if (protocol.starts_with("https://")) + { + m_protocol_ = url_protocol::https; + this->operator/=(protocol.substr(strlen("https://"))); + } + else if (protocol.starts_with("http://")) + { + m_protocol_ = url_protocol::http; + this->operator/=(protocol.substr(strlen("http://"))); + } + else if (protocol.starts_with("mailto:")) + { + m_protocol_ = url_protocol::mailto; + this->operator/=(protocol.substr(strlen("mailto:"))); + } + } + + ~basic_url() = default; basic_url& operator=(const basic_url&) = default; basic_url(const basic_url&) = default; + private: basic_url& operator/=(const std::basic_string& in) { if (in.empty()) return *this; - ss_ += in; + m_ss_ += in; return *this; } basic_url& operator/=(const char_type& in) { - ss_ += in; + m_ss_ += in; return *this; } @@ -55,17 +80,15 @@ namespace scl::net return this->is_valid(); } - bool is_valid() + public: + bool protocol_exists() { - return ss_.size() > 0; + return this->m_protocol_ != url_protocol::bad || this->m_protocol_ != url_protocol::invalid; } - }; - enum class protocol - { - http, - https, - mailto, - bad + bool is_valid() + { + return m_ss_.size() > 0 && this->protocol_exists(); + } }; } // namespace scl::net diff --git a/dev/lib/tests/hpptest.hpp b/dev/lib/tests/hpptest.hpp index 333ece3..63fc962 100644 --- a/dev/lib/tests/hpptest.hpp +++ b/dev/lib/tests/hpptest.hpp @@ -7,7 +7,6 @@ #pragma once -#ifdef SCL_HPPTEST namespace scl::hpptest { typedef bool condition_type; @@ -15,7 +14,8 @@ namespace scl::hpptest template consteval inline void must_pass() { +#ifdef SCL_HPPTEST SCL_HPPTEST_ASSERT(expr); +#endif } } // namespace scl::hpptest -#endif diff --git a/dev/lib/utility/embfs.hpp b/dev/lib/utility/embfs.hpp index 689082c..2738ae7 100644 --- a/dev/lib/utility/embfs.hpp +++ b/dev/lib/utility/embfs.hpp @@ -28,7 +28,7 @@ namespace scl::embfs inline constexpr const size_t _inode_arr_len = 12; inline constexpr const size_t _inode_lookup_len = 8; -#ifdef EMBFS_28BIT_LBA +#if defined(EMBFS_28BIT_LBA) typedef std::uint32_t lba_t; #elif defined(EMBFS_48BIT_LBA) typedef std::uint64_t lba_t; @@ -37,6 +37,7 @@ namespace scl::embfs #endif typedef std::int16_t sword_t; + typedef std::int32_t sdword_t; typedef std::uint8_t utf8_char_t; -- cgit v1.2.3 From 5c5a101c9618f8edea5038e94df64508b0f0a70e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 14 Nov 2025 14:32:05 +0100 Subject: feat: minor codebase refactors. Signed-off-by: Amlal El Mahrouss --- dev/lib/simd/basic_simd.hpp | 2 +- dev/lib/simd/simd.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp index b3087ff..d182aaf 100644 --- a/dev/lib/simd/basic_simd.hpp +++ b/dev/lib/simd/basic_simd.hpp @@ -2,7 +2,7 @@ * File: simd/basic_simd.hpp * Purpose: Basic SIMD backend C++ library. * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. + * Copyright 2025, Amlal El Mahrouss, and SNUPowered, licensed under the BSL 1.0 license. */ #pragma once diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp index 3cb4d7a..9234e67 100644 --- a/dev/lib/simd/simd.hpp +++ b/dev/lib/simd/simd.hpp @@ -2,7 +2,7 @@ * File: simd/simd.hpp * Purpose: SIMD C++ library. * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license. + * Copyright 2025, Amlal El Mahrouss, and SNUPowered, licensed under the BSL 1.0 license. */ #pragma once -- cgit v1.2.3 From 3827ae4e821ff3758d1eaf2dbacc55a22f802731 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 17 Nov 2025 10:31:30 +0100 Subject: feat: fixing merge conflicts. Signed-off-by: Amlal El Mahrouss --- Doxyfile | 4 ++-- README.md | 4 ++-- dev/examples/allocator_system/allocator_system.cc | 2 +- dev/examples/cgi/cgi.cc | 4 ++-- dev/examples/equiv/equiv.cc | 6 +++--- dev/examples/fix/fix.cc | 6 +++--- dev/examples/opt/opt.cc | 4 ++-- dev/examples/tracked_ptr/tracked_ptr.cc | 8 +++---- dev/lib/core/allocator_system.hpp | 10 ++++----- dev/lib/core/error_handler.hpp | 12 +++++------ dev/lib/except/error.hpp | 10 ++++----- dev/lib/fix/fix.hpp | 10 ++++----- dev/lib/io/print.hpp | 10 ++++----- dev/lib/logic/equiv.hpp | 4 ++-- dev/lib/logic/math.hpp | 4 ++-- dev/lib/logic/opt.hpp | 10 ++++----- dev/lib/memory/tracked_ptr.hpp | 4 ++-- dev/lib/net/modem.hpp | 12 +++++------ dev/lib/net/url.hpp | 4 ++-- dev/lib/simd/basic_simd.hpp | 8 +++---- dev/lib/simd/simd.hpp | 8 +++---- dev/lib/tests/hpptest.hpp | 8 +++---- dev/lib/utility/cgi_writer.hpp | 26 +++++++++++------------ dev/lib/utility/chunk_string.hpp | 12 +++++------ dev/lib/utility/crc32.hpp | 10 ++++----- dev/lib/utility/embfs.hpp | 10 ++++----- dev/tests/chunk_string/chunk_test.cc | 2 +- dev/tests/fix_basic/fix_test.cc | 6 +++--- dev/tests/network_basic/net_test.cc | 4 ++-- dev/tests/tracked_ptr_basic/tracked_ptr_test.cc | 8 +++---- dev/tests/tracked_ptr_leak/tracked_ptr_test.cc | 10 ++++----- meta/tex/embfs.tex | 2 +- tools/hpptest.py | 2 +- 33 files changed, 122 insertions(+), 122 deletions(-) diff --git a/Doxyfile b/Doxyfile index af59bc5..a558fb4 100644 --- a/Doxyfile +++ b/Doxyfile @@ -74,7 +74,7 @@ PROJECT_ICON = # entered, it will be relative to the location where Doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./scl/docs +OUTPUT_DIRECTORY = ./ocl/docs # If the CREATE_SUBDIRS tag is set to YES then Doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -991,7 +991,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = /Volumes/Projects/src/scl +INPUT = /Volumes/Projects/src/ocl # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/README.md b/README.md index 20fee1a..0e876d7 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ A C++ library with additional modules for your C++ SDLC. Based on the Open C++ L int main(int argc, char** argv) { - auto opt = scl::opt(scl::eval_eq(50, 50)).try_or_throw("scl::eval_eq, does not match!"); - opt = scl::opt(scl::eval_eq(50, 40)); + auto opt = ocl::opt(ocl::eval_eq(50, 50)).try_or_throw("ocl::eval_eq, does not match!"); + opt = ocl::opt(ocl::eval_eq(50, 40)); opt.try_or_throw("this time it doesn't."); return EXIT_SUCCESS; diff --git a/dev/examples/allocator_system/allocator_system.cc b/dev/examples/allocator_system/allocator_system.cc index 169cd97..b500e30 100644 --- a/dev/examples/allocator_system/allocator_system.cc +++ b/dev/examples/allocator_system/allocator_system.cc @@ -32,7 +32,7 @@ public: int main() { - scl::standard_allocator_type allocator; + ocl::standard_allocator_type allocator; // Test 1: claim() + unclaim() std::cout << "=== Test 1: claim/unclaim ===\n"; diff --git a/dev/examples/cgi/cgi.cc b/dev/examples/cgi/cgi.cc index 6f73eff..692f90c 100644 --- a/dev/examples/cgi/cgi.cc +++ b/dev/examples/cgi/cgi.cc @@ -6,7 +6,7 @@ #include -static scl::basic_chunk_string text_sample = R"( +static ocl::basic_chunk_string text_sample = R"( @@ -68,7 +68,7 @@ static scl::basic_chunk_string text_sample = R"( /* @brief this stub loads a 'index.html' or returns an error message if not found. */ int main(int argc, char** argv) { - scl::cgi::basic_writer<> writer; + ocl::cgi::basic_writer<> writer; writer << text_sample; return 0; diff --git a/dev/examples/equiv/equiv.cc b/dev/examples/equiv/equiv.cc index 9d41afb..12207f4 100644 --- a/dev/examples/equiv/equiv.cc +++ b/dev/examples/equiv/equiv.cc @@ -11,9 +11,9 @@ int main(int argc, char** argv) { std::cout << std::boolalpha; - std::cout << scl::equiv::is_same::value << std::endl; - std::cout << scl::equiv::is_same::value << std::endl; - std::cout << scl::equiv::is_same::value << std::endl; + std::cout << ocl::equiv::is_same::value << std::endl; + std::cout << ocl::equiv::is_same::value << std::endl; + std::cout << ocl::equiv::is_same::value << std::endl; return 0; } diff --git a/dev/examples/fix/fix.cc b/dev/examples/fix/fix.cc index aaac979..ec6668a 100644 --- a/dev/examples/fix/fix.cc +++ b/dev/examples/fix/fix.cc @@ -15,14 +15,14 @@ int main(int argc, char** argv) { constexpr auto default_fix = "8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"; - scl::fix::basic_visitor basic_visitor; - scl::fix::basic_range_data fix = basic_visitor.visit(default_fix); + ocl::fix::basic_visitor basic_visitor; + ocl::fix::basic_range_data fix = basic_visitor.visit(default_fix); std::cout << "magic=" << fix.magic_ << std::endl; std::cout << "magic_len=" << fix.magic_len_ << std::endl; std::cout << "is_valid=" << std::boolalpha << fix.is_valid() << std::endl; - scl::fix::must_pass(fix); + ocl::fix::must_pass(fix); for (auto fields : fix.body_) { diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc index eb725c4..8a74fa2 100644 --- a/dev/examples/opt/opt.cc +++ b/dev/examples/opt/opt.cc @@ -26,7 +26,7 @@ static auto do_some(const std::string recv_data, const std::string check_data) const int hash_to_check = do_hash(check_data); /* here we assume this should match opt_hash */ const int opt_hash = do_hash(recv_data); /* we assume that the hash is correct */ - auto opt = scl::opt(scl::eval_eq(hash_to_check, opt_hash)); /* do the compute */ + auto opt = ocl::opt(ocl::eval_eq(hash_to_check, opt_hash)); /* do the compute */ return opt; } @@ -35,7 +35,7 @@ int main(int argc, char** argv) { // ... let's assume we fetch data from network... - scl::io::println("Testing data..."); + ocl::io::println("Testing data..."); auto opt = do_some("Ohio", "Ohio"); opt.try_or_throw("Checksum failed, Ohio isn't Ohio!"); diff --git a/dev/examples/tracked_ptr/tracked_ptr.cc b/dev/examples/tracked_ptr/tracked_ptr.cc index 6b8a859..6e3f4a2 100644 --- a/dev/examples/tracked_ptr/tracked_ptr.cc +++ b/dev/examples/tracked_ptr/tracked_ptr.cc @@ -9,13 +9,13 @@ static void summon_tracked_ptr() { - scl::memory::tracked_ptr ptr = scl::memory::make_tracked(42); + ocl::memory::tracked_ptr ptr = ocl::memory::make_tracked(42); std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; } static void summon_leak_tracked_ptr() { - scl::memory::tracked_ptr* ptr = new scl::memory::tracked_ptr(42); + ocl::memory::tracked_ptr* ptr = new ocl::memory::tracked_ptr(42); std::cout << ptr->data() << "=" << ptr->manager().allocator().allocated_count_ << std::endl; } @@ -27,7 +27,7 @@ int main(int argc, char** argv) summon_tracked_ptr(); summon_tracked_ptr(); - scl::memory::tracked_ptr ptr; + ocl::memory::tracked_ptr ptr; std::cout << ptr.data() << "=" << ptr.manager().allocator().allocated_count_ << std::endl; @@ -46,7 +46,7 @@ int main(int argc, char** argv) std::cout << "total=" << ptr.manager().allocator().deallocated_count_ << std::endl; std::cout << "leak-detected=" << std::boolalpha << (ptr.manager().allocator().allocated_count_ > ptr.manager().allocator().deallocated_count_) << std::endl; - scl::memory::must_pass(ptr); + ocl::memory::must_pass(ptr); return EXIT_SUCCESS; } diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/core/allocator_system.hpp index 3ffa02a..6fd0119 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/core/allocator_system.hpp @@ -5,13 +5,13 @@ * Copyright 2025, Amlal El Mahrouss. Licensed under the BSL 1.0 license */ -#ifndef _SCL_ALLOCATOR_SYSTEM_HPP -#define _SCL_ALLOCATOR_SYSTEM_HPP +#ifndef _OCL_ALLOCATOR_SYSTEM_HPP +#define _OCL_ALLOCATOR_SYSTEM_HPP #include #include -namespace scl +namespace ocl { template struct new_op final @@ -69,6 +69,6 @@ namespace scl template using standard_allocator_type = allocator_system, delete_op>; -} // namespace scl +} // namespace ocl -#endif // ifndef _SCL_ALLOCATOR_SYSTEM_HPP +#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 449e255..67bf7b4 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -5,13 +5,13 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _SCL_ERROR_HANDLER_HPP -#define _SCL_ERROR_HANDLER_HPP +#ifndef _OCL_ERROR_HANDLER_HPP +#define _OCL_ERROR_HANDLER_HPP #include #include -namespace scl +namespace ocl { struct basic_error_handler; @@ -25,12 +25,12 @@ namespace scl virtual void operator()(const std::basic_string& msg) { - scl::io::print(msg); + ocl::io::print(msg); } }; using standard_error_handler = basic_error_handler; using error_handler_type = basic_error_handler; -} // namespace scl +} // namespace ocl -#endif // ifndef _SCL_ERROR_HANDLER_HPP +#endif // ifndef _OCL_ERROR_HANDLER_HPP diff --git a/dev/lib/except/error.hpp b/dev/lib/except/error.hpp index 31b9894..16bf5eb 100644 --- a/dev/lib/except/error.hpp +++ b/dev/lib/except/error.hpp @@ -4,17 +4,17 @@ * Copyright 2023-2025, Amlal El Mahrouss */ -#ifndef _SCL_ERR_HPP -#define _SCL_ERR_HPP +#ifndef _OCL_ERR_HPP +#define _OCL_ERR_HPP #include -namespace scl +namespace ocl { using runtime_error = std::runtime_error; using fix_error = runtime_error; using math_error = runtime_error; using cgi_error = runtime_error; -} // namespace scl +} // namespace ocl -#endif // _SCL_ERR_HPP \ No newline at end of file +#endif // _OCL_ERR_HPP \ No newline at end of file diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp index 672b8a1..243d01c 100644 --- a/dev/lib/fix/fix.hpp +++ b/dev/lib/fix/fix.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef _SCL_FIX_PARSER_HPP -#define _SCL_FIX_PARSER_HPP +#ifndef _OCL_FIX_PARSER_HPP +#define _OCL_FIX_PARSER_HPP #include #include @@ -17,7 +17,7 @@ #include #include -namespace scl::fix +namespace ocl::fix { template class basic_visitor; @@ -210,6 +210,6 @@ namespace scl::fix } using fix_tag_type = std::uint32_t; -} // namespace scl::fix +} // namespace ocl::fix -#endif // ifndef _SCL_FIX_PARSER_HPP +#endif // ifndef _OCL_FIX_PARSER_HPP diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index 8463b6f..307c06f 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -5,13 +5,13 @@ * Copyright 2025 */ -#ifndef _SCL_PRINT_HPP -#define _SCL_PRINT_HPP +#ifndef _OCL_PRINT_HPP +#define _OCL_PRINT_HPP #include #include -namespace scl::io +namespace ocl::io { template inline void print(T fmt, Args... other) noexcept @@ -37,6 +37,6 @@ namespace scl::io print(fmt...); print(); } -} // namespace scl::io +} // namespace ocl::io -#endif // ifndef _SCL_PRINT_HPP +#endif // ifndef _OCL_PRINT_HPP diff --git a/dev/lib/logic/equiv.hpp b/dev/lib/logic/equiv.hpp index 05d0f53..5b022f8 100644 --- a/dev/lib/logic/equiv.hpp +++ b/dev/lib/logic/equiv.hpp @@ -8,7 +8,7 @@ #pragma once /// @brief OCL equivalence namespace. -namespace scl::equiv +namespace ocl::equiv { template struct basic_hash_trait @@ -101,4 +101,4 @@ namespace scl::equiv return left_ / right_ == 1; } }; -} // namespace scl::equiv +} // namespace ocl::equiv diff --git a/dev/lib/logic/math.hpp b/dev/lib/logic/math.hpp index 2d00595..e796eae 100644 --- a/dev/lib/logic/math.hpp +++ b/dev/lib/logic/math.hpp @@ -9,7 +9,7 @@ #include -namespace scl +namespace ocl { template struct is_non_boolean_integer final @@ -32,4 +32,4 @@ namespace scl constexpr inline auto not_a_number = NAN; constexpr inline auto positive_infinity = INFINITY; constexpr inline auto negative_infinity = -positive_infinity; -} // namespace scl \ No newline at end of file +} // namespace ocl \ No newline at end of file diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index 4ce999c..137460c 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -4,13 +4,13 @@ * Copyright 2023-2025, Amlal El Mahrouss */ -#ifndef _SCL_OPT_HPP -#define _SCL_OPT_HPP +#ifndef _OCL_OPT_HPP +#define _OCL_OPT_HPP #include #include -namespace scl +namespace ocl { enum class return_type { @@ -129,6 +129,6 @@ namespace scl { return return_type::err; } -} // namespace scl +} // namespace ocl -#endif /* ifndef _SCL_OPT_HPP */ +#endif /* ifndef _OCL_OPT_HPP */ diff --git a/dev/lib/memory/tracked_ptr.hpp b/dev/lib/memory/tracked_ptr.hpp index eb33bd0..d2f8450 100644 --- a/dev/lib/memory/tracked_ptr.hpp +++ b/dev/lib/memory/tracked_ptr.hpp @@ -16,7 +16,7 @@ #include #include -namespace scl::memory +namespace ocl::memory { template class tracked_allocator; @@ -232,4 +232,4 @@ namespace scl::memory ::kill(::getpid(), SIGTRAP); } } -} // namespace scl::memory +} // namespace ocl::memory diff --git a/dev/lib/net/modem.hpp b/dev/lib/net/modem.hpp index 6c63399..0e935c7 100644 --- a/dev/lib/net/modem.hpp +++ b/dev/lib/net/modem.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef _SCL_NET_NETWORK_HPP -#define _SCL_NET_NETWORK_HPP +#ifndef _OCL_NET_NETWORK_HPP +#define _OCL_NET_NETWORK_HPP #include #include @@ -14,9 +14,9 @@ #include #include -#define SCL_MODEM_INTERFACE : public scl::net::basic_modem +#define OCL_MODEM_INTERFACE : public ocl::net::basic_modem -namespace scl::net +namespace ocl::net { class basic_modem; @@ -151,6 +151,6 @@ namespace scl::net return true; } }; -} // namespace scl::net +} // namespace ocl::net -#endif // ifndef _SCL_NET_NETWORK_HPP +#endif // ifndef _OCL_NET_NETWORK_HPP diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp index 52991f2..83ab587 100644 --- a/dev/lib/net/url.hpp +++ b/dev/lib/net/url.hpp @@ -13,7 +13,7 @@ /// @author Amlal El Mahrouss (amlal@nekernel.org) /// @brief Parse URLs (in a non-standard way). -namespace scl::net +namespace ocl::net { template class basic_url; @@ -91,4 +91,4 @@ namespace scl::net return m_ss_.size() > 0 && this->protocol_exists(); } }; -} // namespace scl::net +} // namespace ocl::net diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp index d182aaf..f14d977 100644 --- a/dev/lib/simd/basic_simd.hpp +++ b/dev/lib/simd/basic_simd.hpp @@ -1,8 +1,8 @@ /* * File: simd/basic_simd.hpp * Purpose: Basic SIMD backend C++ library. - * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss, and SNUPowered, licensed under the BSL 1.0 license. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss, licensed under the BSL 1.0 license. */ #pragma once @@ -19,7 +19,7 @@ using simd_type = __m256; using simd_type = float32x4_t; #endif -namespace scl::snu::simd +namespace ocl::snu::simd { struct basic_simd_backend final { @@ -44,4 +44,4 @@ namespace scl::snu::simd return "basic_simd_backend"; } }; -} // namespace scl::snu::simd +} // namespace ocl::snu::simd diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp index 9234e67..e571b23 100644 --- a/dev/lib/simd/simd.hpp +++ b/dev/lib/simd/simd.hpp @@ -1,8 +1,8 @@ /* * File: simd/simd.hpp * Purpose: SIMD C++ library. - * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss, and SNUPowered, licensed under the BSL 1.0 license. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss, licensed under the BSL 1.0 license. */ #pragma once @@ -12,7 +12,7 @@ /// @author Amlal El Mahrouss /// @brief Basic SIMD processor. -namespace scl::snu::simd +namespace ocl::snu::simd { template class basic_simd_processor @@ -57,4 +57,4 @@ namespace scl::snu::simd return processor_.isa(); } }; -} // namespace scl::snu::simd +} // namespace ocl::snu::simd diff --git a/dev/lib/tests/hpptest.hpp b/dev/lib/tests/hpptest.hpp index 63fc962..f5fa5c2 100644 --- a/dev/lib/tests/hpptest.hpp +++ b/dev/lib/tests/hpptest.hpp @@ -7,15 +7,15 @@ #pragma once -namespace scl::hpptest +namespace ocl::hpptest { typedef bool condition_type; template consteval inline void must_pass() { -#ifdef SCL_HPPTEST - SCL_HPPTEST_ASSERT(expr); +#ifdef OCL_HPPTEST + OCL_HPPTEST_ASSERT(expr); #endif } -} // namespace scl::hpptest +} // namespace ocl::hpptest diff --git a/dev/lib/utility/cgi_writer.hpp b/dev/lib/utility/cgi_writer.hpp index 87354ac..d54d9de 100644 --- a/dev/lib/utility/cgi_writer.hpp +++ b/dev/lib/utility/cgi_writer.hpp @@ -4,15 +4,15 @@ * Copyright 2023-2025, Amlal El Mahrouss. */ -#ifndef _SCL_CGI_WRITER_HPP -#define _SCL_CGI_WRITER_HPP +#ifndef _OCL_CGI_WRITER_HPP +#define _OCL_CGI_WRITER_HPP #include #include #include #include -namespace scl +namespace ocl { namespace cgi { @@ -21,7 +21,7 @@ namespace scl class basic_writer { private: - basic_writer& eval_(const scl::basic_chunk_string& mime, const scl::basic_chunk_string& ss) noexcept + basic_writer& eval_(const ocl::basic_chunk_string& mime, const ocl::basic_chunk_string& ss) noexcept { std::basic_stringstream ss_out; @@ -30,7 +30,7 @@ namespace scl ss_out << std::format("Content-Length: {}\r\n\r\n", ss.str().size()); ss_out << ss.str(); - scl::io::print(ss_out.str()); + ocl::io::print(ss_out.str()); return *this; } @@ -43,37 +43,37 @@ namespace scl basic_writer(const basic_writer&) = default; public: - friend void operator<<(basic_writer& self, const scl::basic_chunk_string& ss_in) + friend void operator<<(basic_writer& self, const ocl::basic_chunk_string& ss_in) { self = self.eval_("text/plain", ss_in); } - basic_writer& binary(const scl::basic_chunk_string& ss_in) + basic_writer& binary(const ocl::basic_chunk_string& ss_in) { return this->eval_("application/octet-stream", ss_in); } - basic_writer& html(const scl::basic_chunk_string& ss_in) + basic_writer& html(const ocl::basic_chunk_string& ss_in) { return this->eval_("text/html", ss_in); } - basic_writer& xml(const scl::basic_chunk_string& ss_in) + basic_writer& xml(const ocl::basic_chunk_string& ss_in) { return this->eval_("application/xml", ss_in); } - basic_writer& json(const scl::basic_chunk_string& ss_in) + basic_writer& json(const ocl::basic_chunk_string& ss_in) { return this->eval_("application/json", ss_in); } - basic_writer& js(const scl::basic_chunk_string& ss_in) + basic_writer& js(const ocl::basic_chunk_string& ss_in) { return this->eval_("text/javascript", ss_in); } }; } // namespace cgi -} // namespace scl +} // namespace ocl -#endif // ifndef _SCL_CGI_WRITER_HPP +#endif // ifndef _OCL_CGI_WRITER_HPP diff --git a/dev/lib/utility/chunk_string.hpp b/dev/lib/utility/chunk_string.hpp index 6778173..4fe5cc2 100644 --- a/dev/lib/utility/chunk_string.hpp +++ b/dev/lib/utility/chunk_string.hpp @@ -5,12 +5,12 @@ * Copyright 2025, Amlal El Mahrouss */ -#ifndef SCL_UTILITY_CHUNK_STRING_HPP -#define SCL_UTILITY_CHUNK_STRING_HPP +#ifndef OCL_UTILITY_CHUNK_STRING_HPP +#define OCL_UTILITY_CHUNK_STRING_HPP #include -namespace scl +namespace ocl { template class basic_chunk_string; @@ -89,7 +89,7 @@ namespace scl void print() noexcept { - scl::io::print(packed_chunks_); + ocl::io::print(packed_chunks_); } }; @@ -98,5 +98,5 @@ namespace scl { fmt.print(); } -} // namespace scl -#endif // ifndef SCL_UTILITY_CHUNK_STRING_HPP +} // namespace ocl +#endif // ifndef OCL_UTILITY_CHUNK_STRING_HPP diff --git a/dev/lib/utility/crc32.hpp b/dev/lib/utility/crc32.hpp index 93347a8..ea09b94 100644 --- a/dev/lib/utility/crc32.hpp +++ b/dev/lib/utility/crc32.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _SCL_CRC32_HPP -#define _SCL_CRC32_HPP +#ifndef _OCL_CRC32_HPP +#define _OCL_CRC32_HPP #include #include @@ -15,7 +15,7 @@ /// @brief Crc32 implementation in C++ /// @author Amlal EL Mahrouss (amlal@nekernel.org) -namespace scl::crc32 +namespace ocl::crc32 { namespace detail { @@ -76,6 +76,6 @@ namespace scl::crc32 { return detail::crc32(in.c_str(), in.size()); } -} // namespace scl::crc32 +} // namespace ocl::crc32 -#endif // !_SCL_CRC32_HPP \ No newline at end of file +#endif // !_OCL_CRC32_HPP \ No newline at end of file diff --git a/dev/lib/utility/embfs.hpp b/dev/lib/utility/embfs.hpp index 2738ae7..6da8874 100644 --- a/dev/lib/utility/embfs.hpp +++ b/dev/lib/utility/embfs.hpp @@ -5,8 +5,8 @@ * Copyright 2025, Amlal El Mahrouss. */ -#ifndef _SCL_EMBFS_HPP -#define _SCL_EMBFS_HPP +#ifndef _OCL_EMBFS_HPP +#define _OCL_EMBFS_HPP #include #include @@ -14,7 +14,7 @@ /// @brief A filesystem designed for tiny storage medias. /// @author Amlal EL Mahrouss (amlal@nekernel.org) -namespace scl::embfs +namespace ocl::embfs { namespace traits { @@ -76,6 +76,6 @@ namespace scl::embfs /// @brief Indexed node linear array. typedef embfs_inode embfs_inode_arr_t[_inode_arr_len]; } // namespace traits -} // namespace scl::embfs +} // namespace ocl::embfs -#endif // ifndef _SCL_EMBFS_HPP \ No newline at end of file +#endif // ifndef _OCL_EMBFS_HPP \ No newline at end of file diff --git a/dev/tests/chunk_string/chunk_test.cc b/dev/tests/chunk_string/chunk_test.cc index b24b332..ad3d31b 100644 --- a/dev/tests/chunk_string/chunk_test.cc +++ b/dev/tests/chunk_string/chunk_test.cc @@ -16,7 +16,7 @@ TEST(ChunkTest, BasicChunkUsage) auto start = std::chrono::high_resolution_clock::now(); - scl::basic_chunk_string optimized; + ocl::basic_chunk_string optimized; for (unsigned i = 0; i < iterations; ++i) { diff --git a/dev/tests/fix_basic/fix_test.cc b/dev/tests/fix_basic/fix_test.cc index 5457f21..1c80716 100644 --- a/dev/tests/fix_basic/fix_test.cc +++ b/dev/tests/fix_basic/fix_test.cc @@ -10,9 +10,9 @@ TEST(FIXTest, BasicFIXUsage) { - scl::fix::basic_visitor basic_visitor; - scl::fix::basic_range_data fix = basic_visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"); + ocl::fix::basic_visitor basic_visitor; + ocl::fix::basic_range_data fix = basic_visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"); - EXPECT_EQ(fix.magic_, scl::fix::detail::begin_fix()); + EXPECT_EQ(fix.magic_, ocl::fix::detail::begin_fix()); EXPECT_TRUE(fix.is_valid()); } diff --git a/dev/tests/network_basic/net_test.cc b/dev/tests/network_basic/net_test.cc index 4bd3a9f..61d0b28 100644 --- a/dev/tests/network_basic/net_test.cc +++ b/dev/tests/network_basic/net_test.cc @@ -12,8 +12,8 @@ TEST(NetworkTest, BasicNetworkUsage) { - scl::net::basic_modem modem; - modem.construct(scl::net::basic_modem::local_address_ip4, true); + ocl::net::basic_modem modem; + modem.construct(ocl::net::basic_modem::local_address_ip4, true); EXPECT_TRUE(modem.is_valid()); diff --git a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc b/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc index decae88..1e97188 100644 --- a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc +++ b/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc @@ -10,16 +10,16 @@ TEST(TrackedPtrTest, BasicTrackedPtrUsage) { - scl::memory::tracked_ptr ptr = scl::memory::make_tracked(42); + ocl::memory::tracked_ptr ptr = ocl::memory::make_tracked(42); ASSERT_TRUE(ptr); EXPECT_EQ(*ptr, 42); - scl::memory::tracked_ptr ptr2; + ocl::memory::tracked_ptr ptr2; - scl::memory::swap(ptr, ptr2); + ocl::memory::swap(ptr, ptr2); ptr2.reset(); - EXPECT_EQ(scl::memory::tracked_ptr::manager().allocator().allocated_count_, 1); + EXPECT_EQ(ocl::memory::tracked_ptr::manager().allocator().allocated_count_, 1); } \ No newline at end of file diff --git a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc b/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc index 375fb35..f349f47 100644 --- a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc +++ b/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc @@ -10,10 +10,10 @@ TEST(TrackedPtrTest, LeakTrackedPtrUsage) { - scl::memory::tracked_ptr* ptr = new scl::memory::tracked_ptr(42); - scl::memory::tracked_ptr* ptr2 = new scl::memory::tracked_ptr(42); - scl::memory::tracked_ptr* ptr3 = new scl::memory::tracked_ptr(42); + ocl::memory::tracked_ptr* ptr = new ocl::memory::tracked_ptr(42); + ocl::memory::tracked_ptr* ptr2 = new ocl::memory::tracked_ptr(42); + ocl::memory::tracked_ptr* ptr3 = new ocl::memory::tracked_ptr(42); - EXPECT_EQ(scl::memory::tracked_ptr::manager().allocator().allocated_count_, 3); - ASSERT_TRUE(scl::memory::tracked_ptr::manager().allocator().deallocated_count_ == 0); + EXPECT_EQ(ocl::memory::tracked_ptr::manager().allocator().allocated_count_, 3); + ASSERT_TRUE(ocl::memory::tracked_ptr::manager().allocator().deallocated_count_ == 0); } \ No newline at end of file diff --git a/meta/tex/embfs.tex b/meta/tex/embfs.tex index 1548ab8..2d5c60e 100644 --- a/meta/tex/embfs.tex +++ b/meta/tex/embfs.tex @@ -37,7 +37,7 @@ The \textbf{Embedded File System (EMBFS)} is a compact and minimal filesystem de \section{Namespace} The EMBFS implementation resides under: \begin{lstlisting} -namespace scl::embfs +namespace ocl::embfs \end{lstlisting} \section{Supported Logical Block Addressing (LBA) Modes} diff --git a/tools/hpptest.py b/tools/hpptest.py index 5bb09bd..dbed143 100755 --- a/tools/hpptest.py +++ b/tools/hpptest.py @@ -5,7 +5,7 @@ import sys, os if __name__ == '__main__': if len(sys.argv) == 3: - ret = os.system(f"clang++ -I./dev/ -I{sys.argv[2]} -std=c++20 -DSCL_HPPTEST '-DSCL_HPPTEST_ASSERT(x)=static_assert(x, #x)' {sys.argv[1]}") + ret = os.system(f"clang++ -I./dev/ -I{sys.argv[2]} -std=c++20 -DOCL_HPPTEST '-DOCL_HPPTEST_ASSERT(x)=static_assert(x, #x)' {sys.argv[1]}") if ret == 0: print("[TEST] HEADER COMPILATION PASSES") -- cgit v1.2.3 From 8535440f6bebdf785683b4a62073f9465ca7e9cc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 17 Nov 2025 10:33:21 +0100 Subject: fix: fixing merge conflicts. Signed-off-by: Amlal El Mahrouss --- README.md | 6 +++--- dev/examples/opt/opt.cc | 2 +- dev/lib/core/allocator_system.hpp | 2 +- dev/lib/fix/fix.hpp | 6 +++--- dev/lib/logic/opt.hpp | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0e876d7..263f494 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Brief: -A C++ library with additional modules for your C++ SDLC. Based on the Open C++ Library. +A C++ library with additional modules for your C++ SDLC. ## Requirements: @@ -21,9 +21,9 @@ A C++ library with additional modules for your C++ SDLC. Based on the Open C++ L int main(int argc, char** argv) { - auto opt = ocl::opt(ocl::eval_eq(50, 50)).try_or_throw("ocl::eval_eq, does not match!"); + auto opt = ocl::opt(ocl::eval_eq(50, 50)).expect("ocl::eval_eq, does not match!"); opt = ocl::opt(ocl::eval_eq(50, 40)); - opt.try_or_throw("this time it doesn't."); + opt.expect("this time it doesn't."); return EXIT_SUCCESS; } diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc index 8a74fa2..b34f2c7 100644 --- a/dev/examples/opt/opt.cc +++ b/dev/examples/opt/opt.cc @@ -38,7 +38,7 @@ int main(int argc, char** argv) ocl::io::println("Testing data..."); auto opt = do_some("Ohio", "Ohio"); - opt.try_or_throw("Checksum failed, Ohio isn't Ohio!"); + opt.expect("Checksum failed, Ohio isn't Ohio!"); return 0; diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/core/allocator_system.hpp index 6fd0119..1873064 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/core/allocator_system.hpp @@ -71,4 +71,4 @@ namespace ocl using standard_allocator_type = allocator_system, delete_op>; } // namespace ocl -#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP +#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP \ No newline at end of file diff --git a/dev/lib/fix/fix.hpp b/dev/lib/fix/fix.hpp index 243d01c..ddfd9dc 100644 --- a/dev/lib/fix/fix.hpp +++ b/dev/lib/fix/fix.hpp @@ -1,8 +1,8 @@ /* - * File: fix/parser.hpp + * File: fix/fix.hpp * Purpose: Financial Information Exchange parser in C++ * Author: Amlal El Mahrouss (amlal@nekernel.org) - * Copyright 2025, Amlal El Mahrouss + * Copyright 2025, Amlal El Mahrouss, licensed under the MIT license. */ #ifndef _OCL_FIX_PARSER_HPP @@ -212,4 +212,4 @@ namespace ocl::fix using fix_tag_type = std::uint32_t; } // namespace ocl::fix -#endif // ifndef _OCL_FIX_PARSER_HPP +#endif // ifndef _OCL_FIX_PARSER_HPP \ No newline at end of file diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index 137460c..ceee917 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -28,23 +28,23 @@ namespace ocl { } - template - opt& try_or_handle(const char_type* input) + opt& expect(const char_type* input) { if (m_ret == return_type::err) { - ErrorHandler handler; - handler(input ? input : ""); + throw std::runtime_error(input ? input : "opt::error"); } return *this; } - opt& try_or_throw(const char_type* input) + template + opt& expect_or_handle(const char_type* input) { if (m_ret == return_type::err) { - throw std::runtime_error(input ? input : ""); + ErrorHandler err_handler; + err_handler(input ? input : "opt::error"); } return *this; @@ -131,4 +131,4 @@ namespace ocl } } // namespace ocl -#endif /* ifndef _OCL_OPT_HPP */ +#endif /* ifndef _OCL_OPT_HPP */ \ No newline at end of file -- cgit v1.2.3 From 845958a457898343de40ea12953bf9ea3606d69b Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 17 Nov 2025 10:39:17 +0100 Subject: feat: fix merge conflicts. Signed-off-by: Amlal El Mahrouss --- dev/lib/core/allocator_system.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/core/allocator_system.hpp index 1873064..5308dc3 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/core/allocator_system.hpp @@ -9,6 +9,7 @@ #define _OCL_ALLOCATOR_SYSTEM_HPP #include +#include #include namespace ocl -- cgit v1.2.3