summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/.keep0
-rw-r--r--include/ocl/checksum/crc32.hpp (renamed from include/ocl/utility/crc32.hpp)0
-rw-r--r--include/ocl/core/allocator_op.hpp (renamed from include/ocl/memory/allocator_system.hpp)16
-rw-r--r--include/ocl/core/chunk_string.hpp2
-rw-r--r--include/ocl/core/equiv.hpp (renamed from include/ocl/logic/equiv.hpp)2
-rw-r--r--include/ocl/core/error.hpp (renamed from include/ocl/except/error.hpp)0
-rw-r--r--include/ocl/core/error_handler.hpp1
-rw-r--r--include/ocl/core/opt.hpp (renamed from include/ocl/logic/opt.hpp)2
-rw-r--r--include/ocl/fix/parser.hpp5
-rw-r--r--include/ocl/io/print.hpp5
-rw-r--r--include/ocl/logic/math.hpp33
-rw-r--r--include/ocl/memory/tracked_ptr.hpp241
-rw-r--r--include/ocl/net/modem.hpp4
-rw-r--r--include/ocl/net/url.hpp164
-rw-r--r--include/ocl/simd/basic_simd.hpp53
-rw-r--r--include/ocl/simd/simd.hpp61
-rw-r--r--include/ocl/tests/gtest.hpp10
-rw-r--r--include/ocl/tests/hpptest.hpp97
-rw-r--r--include/ocl/utility/cgi.hpp79
-rw-r--r--include/ocl/utility/embfs.hpp81
20 files changed, 18 insertions, 838 deletions
diff --git a/include/.keep b/include/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/include/.keep
diff --git a/include/ocl/utility/crc32.hpp b/include/ocl/checksum/crc32.hpp
index 2bcab29..2bcab29 100644
--- a/include/ocl/utility/crc32.hpp
+++ b/include/ocl/checksum/crc32.hpp
diff --git a/include/ocl/memory/allocator_system.hpp b/include/ocl/core/allocator_op.hpp
index 345b612..8fb8ce9 100644
--- a/include/ocl/memory/allocator_system.hpp
+++ b/include/ocl/core/allocator_op.hpp
@@ -1,5 +1,5 @@
/*
- * File: core/allocator_system.hpp
+ * File: core/allocator_op.hpp
* Purpose: Allocator System container.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license
@@ -38,19 +38,19 @@ namespace ocl
};
template <typename ret_type, typename allocator_new, typename allocator_delete>
- class allocator_system
+ class allocator_op
{
allocator_new m_alloc_{};
allocator_delete m_free_{};
public:
- allocator_system() = default;
- ~allocator_system() = default;
+ allocator_op() = default;
+ ~allocator_op() = default;
- allocator_system& operator=(const allocator_system&) = delete;
- allocator_system(const allocator_system&) = delete;
+ allocator_op& operator=(const allocator_op&) = delete;
+ allocator_op(const allocator_op&) = delete;
- ret_type* claim() noexcept
+ ret_type* claim()
{
return m_alloc_();
}
@@ -68,7 +68,7 @@ namespace ocl
};
template <typename type>
- using standard_allocator_type = allocator_system<type, new_op<type>, delete_op<type>>;
+ using allocator_type = allocator_op<type, new_op<type>, delete_op<type>>;
} // namespace ocl
#endif // ifndef _OCL_ALLOCATOR_SYSTEM_HPP \ No newline at end of file
diff --git a/include/ocl/core/chunk_string.hpp b/include/ocl/core/chunk_string.hpp
index ebcfda3..17d81bd 100644
--- a/include/ocl/core/chunk_string.hpp
+++ b/include/ocl/core/chunk_string.hpp
@@ -1,6 +1,6 @@
/*
* File: core/chunk_string.hpp
- * Purpose: String implementation for the OCL C++ library.
+ * Purpose: Chunked String implementation for the OCL C++ library.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss
*/
diff --git a/include/ocl/logic/equiv.hpp b/include/ocl/core/equiv.hpp
index 1bdb6d9..f98d86d 100644
--- a/include/ocl/logic/equiv.hpp
+++ b/include/ocl/core/equiv.hpp
@@ -7,6 +7,8 @@
#pragma once
+#include <core/config.hpp>
+
/// @brief OCL equivalence namespace.
namespace ocl::equiv
{
diff --git a/include/ocl/except/error.hpp b/include/ocl/core/error.hpp
index cf038f8..cf038f8 100644
--- a/include/ocl/except/error.hpp
+++ b/include/ocl/core/error.hpp
diff --git a/include/ocl/core/error_handler.hpp b/include/ocl/core/error_handler.hpp
index dcb0c89..971d91c 100644
--- a/include/ocl/core/error_handler.hpp
+++ b/include/ocl/core/error_handler.hpp
@@ -40,7 +40,6 @@ namespace ocl
}
};
- using standard_error_handler = basic_error_handler;
using error_handler_type = basic_error_handler;
} // namespace ocl
diff --git a/include/ocl/logic/opt.hpp b/include/ocl/core/opt.hpp
index ba76885..506f582 100644
--- a/include/ocl/logic/opt.hpp
+++ b/include/ocl/core/opt.hpp
@@ -7,7 +7,7 @@
#ifndef _OCL_OPT_HPP
#define _OCL_OPT_HPP
-#include <except/error.hpp>
+#include <core/config.hpp>
#include <utility>
namespace ocl
diff --git a/include/ocl/fix/parser.hpp b/include/ocl/fix/parser.hpp
index 02ab50c..3d24cf0 100644
--- a/include/ocl/fix/parser.hpp
+++ b/include/ocl/fix/parser.hpp
@@ -8,11 +8,12 @@
#ifndef _OCL_FIX_PARSER_HPP
#define _OCL_FIX_PARSER_HPP
-#include <algorithm>
#include <core/config.hpp>
-#include <string>
#include <io/print.hpp>
+#include <algorithm>
+#include <string>
+
namespace ocl::fix
{
template <typename char_type>
diff --git a/include/ocl/io/print.hpp b/include/ocl/io/print.hpp
index c710156..9629e05 100644
--- a/include/ocl/io/print.hpp
+++ b/include/ocl/io/print.hpp
@@ -8,6 +8,7 @@
#ifndef _OCL_PRINT_HPP
#define _OCL_PRINT_HPP
+#include <core/config.hpp>
#include <iostream>
namespace ocl::io
@@ -18,9 +19,7 @@ namespace ocl::io
std::cout << fmt;
}
- inline void print() noexcept
- {
- }
+ inline void print() noexcept {}
template <typename... Args>
inline void print(Args... fmt) noexcept
diff --git a/include/ocl/logic/math.hpp b/include/ocl/logic/math.hpp
deleted file mode 100644
index d131ef9..0000000
--- a/include/ocl/logic/math.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * File: math.hpp
- * Purpose: Mathematics c++ header.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License.
- */
-
-#pragma once
-
-namespace ocl
-{
- template <__SIZE_TYPE__ T>
- struct is_non_boolean_integer final
- {
- static constexpr const bool value = true;
- };
-
- template <>
- struct is_non_boolean_integer<false> final
- {
- static constexpr const bool value = false;
- };
-
- template <>
- struct is_non_boolean_integer<true> final
- {
- static constexpr const bool value = false;
- };
-
- constexpr inline auto not_a_number = __builtin_nanf("");
- constexpr inline auto positive_infinity = __builtin_inff();
- constexpr inline auto negative_infinity = -positive_infinity;
-} // namespace ocl \ No newline at end of file
diff --git a/include/ocl/memory/tracked_ptr.hpp b/include/ocl/memory/tracked_ptr.hpp
deleted file mode 100644
index f763802..0000000
--- a/include/ocl/memory/tracked_ptr.hpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * File: memory/tracked_ptr.hpp
- * Purpose: Strict pointer type implementation in C++
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
- */
-
-#pragma once
-
-#include <cstddef>
-#include <utility>
-#include <new>
-#include <atomic>
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.h>
-
-namespace ocl::memory
-{
- template <typename T>
- class tracked_allocator;
-
- template <typename T>
- class tracked_mgr;
-
- template <typename T, typename Mgr>
- class tracked_ptr;
-
- template <typename T>
- class tracked_allocator
- {
- public:
- std::atomic<size_t> allocated_count_ = 0;
- std::atomic<size_t> deallocated_count_ = 0;
-
- public:
- explicit tracked_allocator() = default;
- virtual ~tracked_allocator() = default;
-
- tracked_allocator& operator=(const tracked_allocator&) = default;
- tracked_allocator(const tracked_allocator&) = default;
-
- public:
- using pointer_type = T*;
-
- template <typename... U>
- void retain(pointer_type& ptr, U&&... args)
- {
- ptr = new T(std::forward<U>(args)...);
-
- if (ptr)
- {
- ++allocated_count_;
- return;
- }
-
- throw std::bad_alloc();
- }
-
- template <typename... U>
- void must_retain(pointer_type& ptr, U&&... args) noexcept
- {
- this->retain(ptr, args...);
- }
-
- void dispose(pointer_type& ptr) noexcept
- {
- if (ptr)
- {
- if (allocated_count_)
- --allocated_count_;
-
- ++deallocated_count_;
-
- delete ptr;
- ptr = nullptr;
- }
- }
- };
-
- template <typename T>
- class tracked_mgr
- {
- private:
- tracked_allocator<T> allocator_;
-
- public:
- explicit tracked_mgr() = default;
- virtual ~tracked_mgr() = default;
-
- tracked_mgr& operator=(const tracked_mgr&) = default;
- tracked_mgr(const tracked_mgr&) = default;
-
- public:
- using pointer_type = T*;
-
- const tracked_allocator<T>& allocator() noexcept
- {
- return allocator_;
- }
-
- template <typename... U>
- pointer_type retain(U&&... args)
- {
- pointer_type ptr = nullptr;
- allocator_.retain(ptr, std::forward<U>(args)...);
-
- return ptr;
- }
-
- template <typename... U>
- pointer_type must_retain(U&&... args) noexcept
- {
- return this->retain(std::forward<U>(args)...);
- }
-
- void dispose(pointer_type& ptr) noexcept
- {
- allocator_.dispose(ptr);
- }
- };
-
- template <typename T, typename Mgr = tracked_mgr<T>>
- class tracked_ptr
- {
- public:
- static Mgr& manager() noexcept
- {
- static Mgr mgr;
- return mgr;
- }
-
- public:
- template <typename... U>
- tracked_ptr(U&&... args)
- : ptr_(nullptr)
- {
- ptr_ = tracked_ptr::manager().retain(std::forward<U>(args)...);
- }
-
- virtual ~tracked_ptr() noexcept
- {
- this->reset();
- }
-
- tracked_ptr(const tracked_ptr&) = delete;
- tracked_ptr& operator=(const tracked_ptr&) = delete;
-
- public:
- using pointer_type = T*;
-
- void reset()
- {
- if (ptr_)
- {
- tracked_ptr::manager().dispose(ptr_);
- }
- }
-
- pointer_type get() const
- {
- return ptr_;
- }
-
- pointer_type data()
- {
- return ptr_;
- }
-
- T& operator*() const
- {
- return *ptr_;
- }
-
- pointer_type operator->() const
- {
- return ptr_;
- }
-
- explicit operator bool() const
- {
- return ptr_ != nullptr;
- }
-
- void swap(tracked_ptr& other)
- {
- std::swap(ptr_, other.ptr_);
- }
-
- public:
- tracked_ptr(tracked_ptr&& other) noexcept
- : ptr_(other.ptr_)
- {
- other.ptr_ = nullptr;
- }
-
- tracked_ptr& operator=(tracked_ptr&& other) noexcept
- {
- if (this != &other)
- {
- this->reset();
- ptr_ = other.ptr_;
- other.ptr_ = nullptr;
- }
-
- return *this;
- }
-
- private:
- pointer_type ptr_{nullptr};
- };
-
- template <typename T>
- inline auto make_tracked() -> tracked_ptr<T>
- {
- return tracked_ptr<T>();
- }
-
- template <typename U, typename... T>
- inline auto make_tracked(T&&... arg) -> tracked_ptr<U>
- {
- return tracked_ptr<U>(std::forward<T>(arg)...);
- }
-
- template <typename T>
- inline void swap(tracked_ptr<T>& a, tracked_ptr<T>& b)
- {
- a.swap(b);
- }
-
- /// @brief a Must Pass function is a standard way to verify a container' validity, inspired from NeKernel/VMKernel.
- template <typename T, typename error_handler>
- inline void must_pass(tracked_ptr<T>& ptr, error_handler handler)
- {
- if (ptr.manager().allocator().allocated_count_ < ptr.manager().allocator().deallocated_count_)
- {
- handler.template error<true>("Invalid TrackedPtr detected: Deallocated count exceeds allocated count.");
- }
- }
-} // namespace ocl::memory
diff --git a/include/ocl/net/modem.hpp b/include/ocl/net/modem.hpp
index 29db748..1e58d1d 100644
--- a/include/ocl/net/modem.hpp
+++ b/include/ocl/net/modem.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include <tests/hpptest.hpp>
+#include <core/config.hpp>
#include <unistd.h>
#include <arpa/inet.h>
@@ -24,8 +24,6 @@
namespace ocl::net
{
- using namespace hpptest;
-
class modem;
/// =============================================================================
diff --git a/include/ocl/net/url.hpp b/include/ocl/net/url.hpp
deleted file mode 100644
index 71c18d6..0000000
--- a/include/ocl/net/url.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * File: net/url.hpp
- * Purpose: URL container in modern C++
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
- */
-
-#pragma once
-
-#include <core/config.hpp>
-
-#include <string>
-#include <sstream>
-
-/// @author Amlal El Mahrouss (amlal@nekernel.org)
-/// @brief Parse URIs/URLs/URNs (Non rfc3986 compliant.)
-
-namespace ocl::net
-{
- template <typename char_type>
- class basic_url;
-
- /// @brief Basic URL parser container.
- template <typename char_type>
- class basic_url final
- {
- public:
- enum
- {
- invalid = 0,
- http = 100,
- https,
- file,
- ftp,
- mailto = 200,
- tel,
- bad = 0xff,
- };
-
- private:
- auto to_string_()
- {
- if (m_protocol_ == https)
- return "https://";
-
- if (m_protocol_ == http)
- return "http://";
-
- if (m_protocol_ == file)
- return "file://";
-
- if (m_protocol_ == tel)
- return "tel:";
-
- if (m_protocol_ == mailto)
- return "mailto:";
-
- return "invalid:";
- }
-
- auto to_enum_(const std::basic_string<char_type>& protocol)
- {
- if (protocol == "https")
- return https;
-
- if (protocol == "http")
- return http;
-
- if (protocol == "file")
- return file;
-
- if (protocol == "tel")
- return tel;
-
- if (protocol == "mailto")
- return mailto;
-
- return invalid;
- }
-
- uint32_t m_protocol_{basic_url::invalid};
- std::basic_stringstream<char_type> m_ss_{};
- std::basic_string<char_type> m_port_{""};
-
- public:
- using ref_type = basic_url&;
-
- explicit basic_url(const uint32_t& protocol)
- {
- m_protocol_ = protocol;
- }
-
- ~basic_url() = default;
-
- basic_url& operator=(const basic_url&) = default;
- basic_url(const basic_url&) = default;
-
- public:
- ref_type operator/=(const std::basic_string<char_type>& in)
- {
- if (in.empty())
- return *this;
-
- if (in.starts_with(":"))
- {
- if (m_protocol_ == tel || m_protocol_ == mailto)
- return *this;
-
- m_port_ = in.substr(1);
- }
- else if (in.starts_with("+"))
- {
- if (m_protocol_ != tel)
- return *this;
-
- for (auto& ch : in)
- {
- if (ch == ' ')
- return *this;
- }
- }
-
- m_ss_ << in;
-
- if (!in.ends_with("/"))
- m_ss_ << "/";
-
- return *this;
- }
-
- explicit operator bool()
- {
- return this->is_valid();
- }
-
- public:
- uint32_t protocol() const noexcept
- {
- return this->m_protocol_;
- }
-
- std::basic_string<char_type> port() const noexcept
- {
- return this->m_port_;
- }
-
- std::basic_string<char_type> assemble() noexcept
- {
- std::basic_string<char_type> out = to_string_();
- out += this->m_ss_.str();
-
- out.pop_back();
-
- return out;
- }
-
- bool is_valid() const noexcept
- {
- return m_ss_.size() > 0 && this->m_protocol_ != basic_url::bad || this->m_protocol_ != basic_url::invalid;
- }
- };
-
- using url = basic_url<char>;
-} // namespace ocl::net
diff --git a/include/ocl/simd/basic_simd.hpp b/include/ocl/simd/basic_simd.hpp
deleted file mode 100644
index d9d405e..0000000
--- a/include/ocl/simd/basic_simd.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * File: simd/basic_simd.hpp
- * Purpose: Basic SIMD backend C++ library.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the BSL 1.0 license.
- */
-
-#pragma once
-
-#include <core/config.hpp>
-
-#ifdef __x86_64__
-#include <immintrin.h>
-#endif
-
-#ifdef __aarch64__
-#include <arm_neon.h>
-#endif
-
-namespace ocl::simd
-{
- struct OCL_DEPRECATED_MSG("Unmaintained since v1.0.51") basic_simd final
- {
-#ifdef __x86_64__
- using simd_type = __m256;
-#endif
-
-#ifdef __aarch64__
- using simd_type = float32x4_t;
-#endif
-
- struct simd_traits final
- {
- simd_type __val;
-
- private:
- static bool bad;
- friend class basic_simd;
- };
-
- using register_type = simd_traits;
-
- const bool& is_bad() noexcept
- {
- return register_type::bad;
- }
-
- std::basic_string<char> isa()
- {
- return "basic_simd";
- }
- };
-} // namespace ocl::simd
diff --git a/include/ocl/simd/simd.hpp b/include/ocl/simd/simd.hpp
deleted file mode 100644
index 14d6922..0000000
--- a/include/ocl/simd/simd.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * File: simd/simd.hpp
- * Purpose: SIMD C++ library.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the BSL 1.0 license.
- */
-
-#pragma once
-
-#include <core/config.hpp>
-
-/// @author Amlal El Mahrouss
-/// @brief Basic SIMD processor.
-
-namespace ocl::simd
-{
- template <typename backend_type>
- class OCL_DEPRECATED_MSG("Unmaintained since v1.0.51") real_type
- {
- private:
- backend_type backend_;
-
- enum opcode
- {
- bad = 0,
- add,
- mul,
- div,
- invalid = 0xfff,
- };
-
- public:
- real_type() = default;
- virtual ~real_type() = default;
-
- real_type& operator=(const real_type&) = delete;
- real_type(const real_type&) = delete;
-
- typename backend_type::register_type& call(const opcode& op, typename backend_type::register_type& lhs, typename backend_type::register_type& rhs)
- {
- switch (op)
- {
- case add:
- return backend_.add(lhs, rhs);
- case mul:
- return backend_.mul(lhs, rhs);
- case div:
- return backend_.div(lhs, rhs);
- default:
- break;
- }
-
- return backend_.is_bad();
- }
-
- std::basic_string<char> isa()
- {
- return backend_.isa();
- }
- };
-} // namespace ocl::simd
diff --git a/include/ocl/tests/gtest.hpp b/include/ocl/tests/gtest.hpp
deleted file mode 100644
index ee328b0..0000000
--- a/include/ocl/tests/gtest.hpp
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * File: tests/gtest.hpp
- * Purpose: Google Test wrapper for the OCL library.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
- */
-
-#pragma once
-
-#include <gtest/gtest.h>
diff --git a/include/ocl/tests/hpptest.hpp b/include/ocl/tests/hpptest.hpp
deleted file mode 100644
index 0b5c54e..0000000
--- a/include/ocl/tests/hpptest.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * File: tests/hpptest.hpp
- * Purpose: HPP Test wrapper for the OCL library.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
- */
-
-#pragma once
-
-#include <boost/config.hpp>
-#include <core/config.hpp>
-#include <io/print.hpp>
-#include <string.h>
-#include <unistd.h>
-
-namespace ocl::hpptest
-{
- /// @brief Standard termination error handler, called when a test fails.
- struct standard_terminate final
- {
- template <bool stop_execution = true>
- static void error() noexcept
- {
- ocl::io::print("standard_terminate::error, terminating...\n");
-
- if (stop_execution)
- std::terminate();
- }
- };
-
-#ifdef __linux__
- using errno_t = error_t;
-#endif
-
- struct posix_terminate final
- {
- template <bool stop_execution = true, errno_t args>
- static void error(errno_t err) noexcept
- {
- ocl::io::print("posix_terminate::error: expected=", strerror(args), ", got=", strerror(err), "\n");
-
- if (stop_execution)
- std::terminate();
- }
- };
-
- typedef bool condition_type;
-
- template <condition_type expr = true>
- consteval inline void must_pass()
- {
-#ifdef OCL_HPPTEST
- OCL_HPPTEST_ASSERT(expr);
-#endif // _WIN32
- }
-
- template <condition_type expect, typename on_fail>
- inline void must_pass(condition_type cond) noexcept
- {
- if (cond != expect)
- {
- on_fail::template error<true>();
- }
- }
-
- template <errno_t expect = 0>
- inline void must_pass(errno_t ern) noexcept
- {
- if (ern != expect)
- {
- posix_terminate::error<true, expect>(ern);
- }
- }
-
-#ifdef _WIN32
- struct win32_terminate final
- {
- template <bool stop_execution = false>
- static void error(HRESULT err) noexcept
- {
- ocl::io::print("win32_terminate::error: expected=S_OK, got=", err, "\n");
-
- if (stop_execution)
- std::terminate();
- }
- };
-
- template <HRESULT expect = S_OK>
- inline void must_pass(HRESULT hr) noexcept
- {
- if (hr != expect)
- {
- win32_terminate::error<true>(hr);
- }
- }
-#endif // _WIN32
-} // namespace ocl::hpptest
diff --git a/include/ocl/utility/cgi.hpp b/include/ocl/utility/cgi.hpp
deleted file mode 100644
index 8849c2d..0000000
--- a/include/ocl/utility/cgi.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * File: cgi.hpp
- * Author: Amlal El Mahrouss,
- * Copyright 2023-2025, Amlal El Mahrouss, Licensed under the Boost Software License.
- */
-
-#ifndef _OCL_CGI_HPP
-#define _OCL_CGI_HPP
-
-#include <io/print.hpp>
-#include <core/chunk_string.hpp>
-#include <sstream>
-#include <format>
-
-namespace ocl
-{
- namespace cgi
- {
- /// @brief CGI Writer class, writes to stdout; as CGI expects.
- template <typename char_type = char>
- class basic_writer
- {
- private:
- basic_writer& eval_(const basic_chunk_string<char_type>& mime, const basic_chunk_string<char_type>& ss) noexcept
- {
- std::basic_stringstream<char_type> ss_out;
-
- ss_out << std::format("Content-Type: {}\r\n", mime.str());
- ss_out << std::format("Server: {}\r\n", "OCL/1.0");
- ss_out << std::format("Content-Length: {}\r\n\r\n", ss.str().size());
- ss_out << ss.str();
-
- io::print(ss_out.str());
-
- return *this;
- }
-
- public:
- explicit 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 basic_chunk_string<char_type>& ss_in)
- {
- self = self.eval_("text/plain", ss_in);
- }
-
- basic_writer& binary(const basic_chunk_string<char_type>& ss_in)
- {
- return this->eval_("application/octet-stream", ss_in);
- }
-
- basic_writer& html(const basic_chunk_string<char_type>& ss_in)
- {
- return this->eval_("text/html", ss_in);
- }
-
- basic_writer& xml(const basic_chunk_string<char_type>& ss_in)
- {
- return this->eval_("application/xml", ss_in);
- }
-
- basic_writer& json(const basic_chunk_string<char_type>& ss_in)
- {
- return this->eval_("application/json", ss_in);
- }
-
- basic_writer& js(const basic_chunk_string<char_type>& ss_in)
- {
- return this->eval_("text/javascript", ss_in);
- }
- };
- } // namespace cgi
-} // namespace ocl
-
-#endif // ifndef _OCL_CGI_HPP
diff --git a/include/ocl/utility/embfs.hpp b/include/ocl/utility/embfs.hpp
deleted file mode 100644
index 8a716ce..0000000
--- a/include/ocl/utility/embfs.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * File: embfs.hpp
- * Purpose: Embedded File System.
- * Author: Amlal El Mahrouss (amlal@nekernel.org)
- * Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License.
- */
-
-#ifndef _OCL_EMBFS_HPP
-#define _OCL_EMBFS_HPP
-
-#include <cstdint>
-#include <cstddef>
-
-/// @brief A filesystem designed for tiny storage medias.
-/// @author Amlal EL Mahrouss (amlal@nekernel.org)
-
-namespace ocl::embfs
-{
- namespace traits
- {
- struct embfs_superblock;
- struct embfs_inode;
-
- inline constexpr const size_t _superblock_name_len = 16;
- inline constexpr const size_t _superblock_reserve_len = 462;
-
- inline constexpr const size_t _inode_name_len = 128;
- inline constexpr const size_t _inode_arr_len = 12;
- inline constexpr const size_t _inode_lookup_len = 8;
-
-#if defined(EMBFS_28BIT_LBA)
- typedef std::uint32_t lba_t;
-#elif defined(EMBFS_48BIT_LBA)
- typedef std::uint64_t lba_t;
-#else
- typedef std::uint32_t lba_t;
-#endif
-
- typedef std::int16_t sword_t;
-
- typedef std::int32_t sdword_t;
-
- typedef std::uint8_t utf8_char_t;
-
- /// @brief Superblock data structure
- struct embfs_superblock
- {
- sword_t s_block_mag;
- sdword_t s_num_inodes;
- sdword_t s_part_size;
- sdword_t s_part_used;
- sdword_t s_version;
- sword_t s_sector_sz;
- lba_t s_inode_start;
- lba_t s_inode_end;
- utf8_char_t s_name[_superblock_name_len];
- utf8_char_t s_reserved[_superblock_reserve_len];
- };
-
- /// @brief Indexed node structure.
- /// @brief i_name file name
- /// @brief i_size_virt, i_size_phys: virtual and physical (sector count) size.
- /// @brief i_offset direct block pointer.
- /// @brief i_checksum crc32 checksum.
- /// @brief i_flags_perms flags and permissions
- /// @brief i_acl_* ACL to keep track of inode allocation status.
- struct embfs_inode
- {
- utf8_char_t i_name[_inode_name_len];
- sword_t i_size_virt, i_size_phys;
- lba_t i_offset[_inode_lookup_len];
- sword_t i_checksum, i_flags_perms;
- lba_t i_acl_creat, i_acl_edit, i_acl_delet;
- };
-
- /// @brief Indexed node linear array.
- typedef embfs_inode embfs_inode_arr_t[_inode_arr_len];
- } // namespace traits
-} // namespace ocl::embfs
-
-#endif // ifndef _OCL_EMBFS_HPP \ No newline at end of file