summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-09 02:31:16 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-09 02:31:16 +0100
commit365e1851ab1b2f2e7eca2fb0697e5b7ff1023b60 (patch)
tree4f82da02b080a6de9ba0756bf1f21c319569831f /include
parent3550c29636d9a46f40d02908605144221bb7eb9b (diff)
chore: Nectar grunt work on runtime library and test code.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/LibNectar/.gitignore (renamed from include/LibC++/.gitignore)0
-rw-r--r--include/LibNectar/__abi.h (renamed from include/LibC++/__abi.h)10
-rw-r--r--include/LibNectar/__power64.inc (renamed from include/LibC++/__power64.inc)0
-rw-r--r--include/LibNectar/base_alloc.h (renamed from include/LibC++/base_alloc.h)10
-rw-r--r--include/LibNectar/base_exception.h (renamed from include/LibC++/base_exception.h)12
-rw-r--r--include/LibNectar/base_math.h (renamed from include/LibC++/base_math.h)4
-rw-r--r--include/LibNectar/base_process.h (renamed from include/LibC++/base_process.h)15
-rw-r--r--include/LibNectar/defines.h (renamed from include/LibC++/defines.h)0
-rw-r--r--include/LibNectar/filesystem.h (renamed from include/LibC++/filesystem.h)9
-rwxr-xr-xinclude/LibNectar/mkhdrs.sh (renamed from include/LibC++/make-stdcpp-hdrs.sh)3
-rw-r--r--include/LibNectar/new.h (renamed from include/LibC++/new.h)22
-rw-r--r--include/LibNectar/utility.h (renamed from include/LibC++/utility.h)8
12 files changed, 37 insertions, 56 deletions
diff --git a/include/LibC++/.gitignore b/include/LibNectar/.gitignore
index e3f10ea..e3f10ea 100644
--- a/include/LibC++/.gitignore
+++ b/include/LibNectar/.gitignore
diff --git a/include/LibC++/__abi.h b/include/LibNectar/__abi.h
index 86e5cda..ce6424b 100644
--- a/include/LibC++/__abi.h
+++ b/include/LibNectar/__abi.h
@@ -3,11 +3,11 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/nectar
-#ifndef NECTAR_LIBCXX_ABI_H
-#define NECTAR_LIBCXX_ABI_H
+#ifndef NECTAR_LIBNECTAR_ABI_H
+#define NECTAR_LIBNECTAR_ABI_H
-#include <LibC++/base_process.h>
-#include <LibC++/defines.h>
+#include <LibNectar/base_process.h>
+#include <LibNectar/defines.h>
__init_decl()
@@ -21,4 +21,4 @@ inline void __compilerkit_unreachable(void) {
__fini_decl()
-#endif // NECTAR_LIBCXX_ABI_H
+#endif // NECTAR_LIBNECTAR_ABI_H
diff --git a/include/LibC++/__power64.inc b/include/LibNectar/__power64.inc
index 8b65ad7..8b65ad7 100644
--- a/include/LibC++/__power64.inc
+++ b/include/LibNectar/__power64.inc
diff --git a/include/LibC++/base_alloc.h b/include/LibNectar/base_alloc.h
index 6c7ad06..81a3299 100644
--- a/include/LibC++/base_alloc.h
+++ b/include/LibNectar/base_alloc.h
@@ -3,12 +3,11 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/nectar
-#ifndef NECTAR_LIBCXX_BASE_ALLOC_H
-#define NECTAR_LIBCXX_BASE_ALLOC_H
+#ifndef NECTAR_LIBNECTAR_BASE_ALLOC_H
+#define NECTAR_LIBNECTAR_BASE_ALLOC_H
-#include <LibC++/defines.h>
+#include <LibNectar/defines.h>
-namespace std::base_alloc {
/// @brief allocate a new class.
/// @tparam KindClass the class type to allocate.
template <class KindClass, typename... Args>
@@ -40,6 +39,5 @@ template <class KindClass>
inline void release_nothrow(KindClass ptr) noexcept {
release(ptr);
}
-} // namespace std::base_alloc
-#endif // NECTAR_LIBCXX_BASE_ALLOC_H
+#endif // NECTAR_LIBNECTAR_BASE_ALLOC_H
diff --git a/include/LibC++/base_exception.h b/include/LibNectar/base_exception.h
index ddddda9..b5c6a88 100644
--- a/include/LibC++/base_exception.h
+++ b/include/LibNectar/base_exception.h
@@ -6,23 +6,20 @@
#ifndef NECTAR_LIBCXX_BASE_EXCEPTION_H
#define NECTAR_LIBCXX_BASE_EXCEPTION_H
-#include <LibC++/__abi.h>
-#include <LibC++/base_process.h>
-#include <LibC++/defines.h>
-#include <iostream>
+#include <LibNectar/__abi.h>
+#include <LibNectar/base_process.h>
+#include <LibNectar/defines.h>
/// @author Amlal El Mahrouss (amlal@nekernel.org)
-namespace std::base_exception::abi {
inline constexpr int __terminate_id = 33;
/// @note This function is internal, don't call it.
extern void __unwind_object_list();
inline void __throw_general(const char* what) {
- std::cout << "LibC++: Unwinding exception of kind: " << what << ", aborting here..." << std::endl;
__unwind_object_list();
- base_process::exit(__terminate_id);
+ exit(__terminate_id);
}
inline void __throw_domain_error(const char* what) {
@@ -34,6 +31,5 @@ inline void __throw_bad_array_new_length(const char* what) {
__throw_general(what);
__builtin_unreachable(); // prevent from continuing.
}
-} // namespace std::base_exception::abi
#endif // NECTAR_LIBCXX_BASE_EXCEPTION_H
diff --git a/include/LibC++/base_math.h b/include/LibNectar/base_math.h
index e4370eb..5a1ce8b 100644
--- a/include/LibC++/base_math.h
+++ b/include/LibNectar/base_math.h
@@ -6,7 +6,7 @@
#ifndef NECTAR_LIBCXX_BASE_MATH_H
#define NECTAR_LIBCXX_BASE_MATH_H
-#include <defines>
+#include <LibNectar/defines.h>
#ifndef NAN
#define NAN (__builtin_nanf(""))
@@ -21,7 +21,6 @@ typedef double real_type;
typedef float real_type;
#endif
-namespace std::base_math {
inline constexpr static auto not_a_number = NAN;
/// =========================================================== ///
@@ -91,7 +90,6 @@ struct complex_domain final {
};
typename<class Result> using callable_type = Result (*)(size_t n, ...);
-} // namespace std::base_math
#ifdef __cpp_lib_base_math
#define __cpp_lib_base_math 1
diff --git a/include/LibC++/base_process.h b/include/LibNectar/base_process.h
index ccda74c..358dd70 100644
--- a/include/LibC++/base_process.h
+++ b/include/LibNectar/base_process.h
@@ -6,7 +6,7 @@
#ifndef NECTAR_LIBCXX_BASE_PROCESS_H
#define NECTAR_LIBCXX_BASE_PROCESS_H
-#include <defines>
+#include <LibNectar/defines.h>
__init_decl()
@@ -25,23 +25,20 @@ extern size_t __atexit_lst_cnt;
__fini_decl()
- /// @brief Standard C++ namespace
- namespace std::base_process {
- inline int signal(int code) {
+inline int signal(int code) {
signal_(code);
return -1;
- }
+}
- inline int32_t exit(const int32_t& code) {
+inline int32_t exit(const int32_t& code) {
for (auto idx = 0UL; idx < __atexit_lst_cnt; ++idx) {
- __atexit_lst_ptr[idx]();
+ __atexit_lst_ptr[idx]();
}
if (__atexit_cdecl_ptr) __atexit_cdecl_ptr();
exit_(code);
return -1;
- }
-} // namespace std::base_process
+}
#endif // NECTAR_LIBCXX_BASE_PROCESS_H
diff --git a/include/LibC++/defines.h b/include/LibNectar/defines.h
index 061769c..061769c 100644
--- a/include/LibC++/defines.h
+++ b/include/LibNectar/defines.h
diff --git a/include/LibC++/filesystem.h b/include/LibNectar/filesystem.h
index 9667a78..daac4c1 100644
--- a/include/LibC++/filesystem.h
+++ b/include/LibNectar/filesystem.h
@@ -6,18 +6,13 @@
#ifndef __NECTAR_FS_H__
#define __NECTAR_FS_H__
-#include <chrono>
-#include <defines>
-
-namespace std {
class path;
class filesystem_error;
class directory_entry;
class directory_iterator;
-} // namespace std
-#ifndef __cpp_lib_filesystem
-#define __cpp_lib_filesystem 201703L
+#ifndef __nec_lib_filesystem
+#define __nec_lib_filesystem 201703L
#endif
#endif // __NECTAR_FS_H__
diff --git a/include/LibC++/make-stdcpp-hdrs.sh b/include/LibNectar/mkhdrs.sh
index 09d5616..b6b9f75 100755
--- a/include/LibC++/make-stdcpp-hdrs.sh
+++ b/include/LibNectar/mkhdrs.sh
@@ -1,6 +1,6 @@
#! /bin/sh
-outputDir=libc++/nectar/
+outputDir=libcnec/
mkdir -p $outputDir
@@ -8,6 +8,7 @@ for f in *.h; do
#This line splits the file name on the delimiter "."
baseName=`echo $f | cut -d "." -f 1`
+
cp $f $outputDir$baseName
done
diff --git a/include/LibC++/new.h b/include/LibNectar/new.h
index f7e3abb..31f80bf 100644
--- a/include/LibC++/new.h
+++ b/include/LibNectar/new.h
@@ -3,12 +3,11 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/nectar
-#ifndef NECTAR_LIBCXX_NEW_H
-#define NECTAR_LIBCXX_NEW_H
+#ifndef NECTAR_LIBNECTAR_NEW_H
+#define NECTAR_LIBNECTAR_NEW_H
-#include <defines>
+#include <LibNectar/defines.h>
-namespace std {
struct nothrow_t final {
explicit nothrow_t() = default;
~nothrow_t() = default;
@@ -22,16 +21,15 @@ struct placement_t final {
int32_t __align{};
size_t __size{};
};
-} // namespace std
// AMLALE: Define the placement_t feature.
-#ifndef __cpp_has_placement
-#define __cpp_has_placement 1
+#ifndef __nectar_has_placement
+#define __nectar_has_placement 1
#endif
// AMLALE: Define nothrow
-#ifndef __cpp_has_nothrow
-#define __cpp_has_nothrow 1
+#ifndef __nectar_has_nothrow
+#define __nectar_has_nothrow 1
#endif
void* operator new(size_t);
@@ -40,8 +38,8 @@ void* operator new[](size_t);
/// \brief placement_t new and delete operators. Governs how the memory shall be placed.
/// \note This is a feature that shall be used wisely, failure to do so will produce Undefined
/// Behaviors at runtime.
-void* operator _placement_new(struct placement_t*);
-void operator _placement_delete(struct placement_t*, void*);
+void* operator pnew(struct placement_t*);
+void operator pdelete(struct placement_t*, void*);
/// \brief For all offsets within the base range and alignement 'align'
/// \brief Allocate offsets with respect to the `base` interval, apply alignement of `align` value.
@@ -64,4 +62,4 @@ void operator delete(void*, size_t) noexcept;
void operator delete[](void*) noexcept;
-#endif // NECTAR_LIBCXX_NEW_H
+#endif // NECTAR_LIBNECTAR_NEW_H
diff --git a/include/LibC++/utility.h b/include/LibNectar/utility.h
index 45000c3..834b1a6 100644
--- a/include/LibC++/utility.h
+++ b/include/LibNectar/utility.h
@@ -3,10 +3,9 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/nectar
-#ifndef LIBCXX_UTILITY_H
-#define LIBCXX_UTILITY_H
+#ifndef LIBNECTAR_UTILITY_H
+#define LIBNECTAR_UTILITY_H
-namespace std {
/// @brief Forward object.
/// @tparam Args the object type.
/// @param arg the object.
@@ -24,6 +23,5 @@ template <typename Args>
inline auto move(Args&& arg) -> Args&& {
return static_cast<Args&&>(arg);
}
-} // namespace std
-#endif // LIBCXX_UTILITY_H
+#endif // LIBNECTAR_UTILITY_H