summaryrefslogtreecommitdiffhomepage
path: root/dev/lib
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-10-14 04:35:26 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-10-14 04:35:26 +0200
commita786997f304745ce3766a82be06dc6a5d0c2f02c (patch)
treedb923caaec3762fbb68290fd1ae94cb1465378e7 /dev/lib
parentfa4748e414e9494442f9bcde9c659d3951af19c0 (diff)
feat: scl: major refactors and new version of SCL.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib')
-rw-r--r--dev/lib/core/allocator_system.hpp10
-rw-r--r--dev/lib/core/error_handler.hpp12
-rw-r--r--dev/lib/except/error.hpp10
-rw-r--r--dev/lib/fix/fix.hpp10
-rw-r--r--dev/lib/io/print.hpp10
-rw-r--r--dev/lib/logic/equiv.hpp4
-rw-r--r--dev/lib/logic/math.hpp4
-rw-r--r--dev/lib/logic/opt.hpp10
-rw-r--r--dev/lib/memory/tracked_ptr.hpp4
-rw-r--r--dev/lib/net/modem.hpp22
-rw-r--r--dev/lib/net/url.hpp4
-rw-r--r--dev/lib/simd/basic_simd.hpp4
-rw-r--r--dev/lib/simd/simd.hpp4
-rw-r--r--dev/lib/tests/hpptest.hpp4
-rw-r--r--dev/lib/utility/cgi_writer.hpp28
-rw-r--r--dev/lib/utility/chunk_string.hpp6
-rw-r--r--dev/lib/utility/crc32.hpp10
-rw-r--r--dev/lib/utility/embfs.hpp10
18 files changed, 83 insertions, 83 deletions
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 <lib/core/includes.hpp>
#include <stdexcept>
#include <memory>
-namespace ocl
+namespace scl
{
template <typename type>
struct new_op final
@@ -70,6 +70,6 @@ namespace ocl
template <typename type>
using standard_allocator_type = allocator_system<type, new_op<type>, delete_op<type>>;
-} // 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 <lib/core/includes.hpp>
#include <lib/io/print.hpp>
#include <stdexcept>
-namespace ocl
+namespace scl
{
struct basic_error_handler;
@@ -26,12 +26,12 @@ namespace ocl
virtual void operator()(const std::basic_string<char>& 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 <stdexcept>
-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 <cstddef>
#include <cassert>
@@ -18,7 +18,7 @@
#include <unistd.h>
#include <signal.h>
-namespace ocl::fix
+namespace scl::fix
{
template <typename char_type>
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 <iostream>
#include <ostream>
-namespace ocl::io
+namespace scl::io
{
template <typename T, typename... Args>
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 <typename T>
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 <cmath>
-namespace ocl
+namespace scl
{
template <std::size_t T>
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 <lib/except/error.hpp>
#include <utility>
-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 <unistd.h>
#include <signal.h>
-namespace ocl::memory
+namespace scl::memory
{
template <typename T>
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 <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <string>
-#include <utility>
#include <cstddef>
-#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 <typename char_type>
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 <typename backend_type>
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 <lib/io/print.hpp>
#include <lib/utility/chunk_string.hpp>
#include <sstream>
#include <format>
-namespace ocl
+namespace scl
{
namespace cgi
{
@@ -21,7 +21,7 @@ namespace ocl
class basic_writer
{
private:
- basic_writer& eval_(const ocl::basic_chunk_string<char_type>& mime, const ocl::basic_chunk_string<char_type>& ss) noexcept
+ basic_writer& eval_(const scl::basic_chunk_string<char_type>& mime, const scl::basic_chunk_string<char_type>& ss) noexcept
{
std::basic_stringstream<char_type> 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<char_type>& ss_in)
+ friend void operator<<(basic_writer& self, const scl::basic_chunk_string<char_type>& ss_in)
{
self = self.eval_("text/plain", ss_in);
}
- basic_writer& binary(const ocl::basic_chunk_string<char_type>& ss_in)
+ basic_writer& binary(const scl::basic_chunk_string<char_type>& ss_in)
{
return this->eval_("application/octet-stream", ss_in);
}
- basic_writer& html(const ocl::basic_chunk_string<char_type>& ss_in)
+ basic_writer& html(const scl::basic_chunk_string<char_type>& ss_in)
{
return this->eval_("text/html", ss_in);
}
- basic_writer& xml(const ocl::basic_chunk_string<char_type>& ss_in)
+ basic_writer& xml(const scl::basic_chunk_string<char_type>& ss_in)
{
return this->eval_("application/xml", ss_in);
}
- basic_writer& json(const ocl::basic_chunk_string<char_type>& ss_in)
+ basic_writer& json(const scl::basic_chunk_string<char_type>& ss_in)
{
return this->eval_("application/json", ss_in);
}
- basic_writer& js(const ocl::basic_chunk_string<char_type>& ss_in)
+ basic_writer& js(const scl::basic_chunk_string<char_type>& 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 <lib/core/includes.hpp>
-namespace ocl
+namespace scl
{
template <typename char_type, std::size_t max_chunk_size = 8196>
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 <cstdint>
#include <string>
@@ -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 <cstdint>
#include <cstddef>
@@ -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