summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-12 20:54:09 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-12 20:54:09 +0100
commitef7f9bead82e73ff3efd4577a20e5170b017a859 (patch)
treee54802488350234b4ac8a5a98d573096a21ce83c
parentff7ee3e3e070a2abee70fd93062065060118cf9e (diff)
chore: Nectar Generics Library improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--CLAUDE.md2
-rw-r--r--include/LibNectar/iostream.nhh (renamed from include/LibNectarStd/iostream.ncpp)11
-rw-r--r--include/LibNectar/iterator.nhh33
-rw-r--r--include/LibNectarCore/.gitignore (renamed from include/LibNectar/.gitignore)0
-rw-r--r--include/LibNectarCore/__abi.h (renamed from include/LibNectar/__abi.h)8
-rw-r--r--include/LibNectarCore/__power64.inc (renamed from include/LibNectar/__power64.inc)0
-rw-r--r--include/LibNectarCore/base_alloc.h (renamed from include/LibNectar/base_alloc.h)2
-rw-r--r--include/LibNectarCore/base_exception.h (renamed from include/LibNectar/base_exception.h)6
-rw-r--r--include/LibNectarCore/base_math.h (renamed from include/LibNectar/base_math.h)2
-rw-r--r--include/LibNectarCore/base_process.h (renamed from include/LibNectar/base_process.h)10
-rw-r--r--include/LibNectarCore/defines.h (renamed from include/LibNectar/defines.h)0
-rw-r--r--include/LibNectarCore/filesystem.h (renamed from include/LibNectar/filesystem.h)0
-rwxr-xr-xinclude/LibNectarCore/mkhdrs.sh (renamed from include/LibNectar/mkhdrs.sh)0
-rw-r--r--include/LibNectarCore/new.h (renamed from include/LibNectar/new.h)2
-rw-r--r--include/LibNectarCore/utility.h (renamed from include/LibNectar/utility.h)0
-rw-r--r--include/LibNectarStd/iterator.ncpp13
-rw-r--r--test/test_samples/iostream.ncpp2
-rw-r--r--test/test_samples/return_value.ncpp2
18 files changed, 60 insertions, 33 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index c470fec..65404fd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -76,7 +76,7 @@ src/
│ ├── dbg.cc # User-space debugger
│ └── kdbg.cc # Kernel debugger
-└── LibNectar/ # Nectar ABI runtime (header-only)
+└── LibNectarCore/ # C++/Nectar ABI runtime (header-only)
```
### Compilation Pipeline
diff --git a/include/LibNectarStd/iostream.ncpp b/include/LibNectar/iostream.nhh
index ecd1132..9e14174 100644
--- a/include/LibNectarStd/iostream.ncpp
+++ b/include/LibNectar/iostream.nhh
@@ -3,17 +3,22 @@
// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/nectar
+#ifndef NECTAR_LIBNECTAR_IOSTREAM_NHH
+#define NECTAR_LIBNECTAR_IOSTREAM_NHH
+
import printf, scanf;
struct ostream
{
- let print(let data)
+ let write(let data, let size)
{
return nil;
}
- let scan(let fmt)
+ let read(let region, let size)
{
return nil;
}
-}; \ No newline at end of file
+};
+
+#endif // NECTAR_LIBNECTAR_IOSTREAM_NHH \ No newline at end of file
diff --git a/include/LibNectar/iterator.nhh b/include/LibNectar/iterator.nhh
new file mode 100644
index 0000000..2f4e34e
--- /dev/null
+++ b/include/LibNectar/iterator.nhh
@@ -0,0 +1,33 @@
+// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (See accompanying
+// file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0)
+// Official repository: https://github.com/nekernel-org/nectar
+
+#ifndef NECTAR_LIBNECTAR_ITERATOR_NHH
+#define NECTAR_LIBNECTAR_ITERATOR_NHH
+
+struct iterator_traits
+{
+ let begin(let collection)
+ {
+ return collection._begin;
+ }
+
+ let end(let collection)
+ {
+ return collection._begin + collection._size;
+ }
+
+ let size(let collection)
+ {
+ return collection._size;
+ }
+};
+
+type <struct It>
+typedef It::pointer iterator_pointer;
+
+type <struct It>
+typedef It::reference iterator_reference;
+
+#endif // NECTAR_LIBNECTAR_ITERATOR_NHH \ No newline at end of file
diff --git a/include/LibNectar/.gitignore b/include/LibNectarCore/.gitignore
index e3f10ea..e3f10ea 100644
--- a/include/LibNectar/.gitignore
+++ b/include/LibNectarCore/.gitignore
diff --git a/include/LibNectar/__abi.h b/include/LibNectarCore/__abi.h
index ce6424b..802bd1c 100644
--- a/include/LibNectar/__abi.h
+++ b/include/LibNectarCore/__abi.h
@@ -6,15 +6,15 @@
#ifndef NECTAR_LIBNECTAR_ABI_H
#define NECTAR_LIBNECTAR_ABI_H
-#include <LibNectar/base_process.h>
-#include <LibNectar/defines.h>
+#include <LibNectarCore/base_process.h>
+#include <LibNectarCore/defines.h>
__init_decl()
- static constexpr int32_t __unreachable_code = 34;
+static constexpr int32_t __unreachable_code = 34;
inline void __compilerkit_unreachable(void) {
- std::base_process::signal(__unreachable_code);
+ signal(__unreachable_code);
while (1);
}
diff --git a/include/LibNectar/__power64.inc b/include/LibNectarCore/__power64.inc
index 8b65ad7..8b65ad7 100644
--- a/include/LibNectar/__power64.inc
+++ b/include/LibNectarCore/__power64.inc
diff --git a/include/LibNectar/base_alloc.h b/include/LibNectarCore/base_alloc.h
index 81a3299..e68efdb 100644
--- a/include/LibNectar/base_alloc.h
+++ b/include/LibNectarCore/base_alloc.h
@@ -6,7 +6,7 @@
#ifndef NECTAR_LIBNECTAR_BASE_ALLOC_H
#define NECTAR_LIBNECTAR_BASE_ALLOC_H
-#include <LibNectar/defines.h>
+#include <LibNectarCore/defines.h>
/// @brief allocate a new class.
/// @tparam KindClass the class type to allocate.
diff --git a/include/LibNectar/base_exception.h b/include/LibNectarCore/base_exception.h
index b5c6a88..992f76f 100644
--- a/include/LibNectar/base_exception.h
+++ b/include/LibNectarCore/base_exception.h
@@ -6,9 +6,9 @@
#ifndef NECTAR_LIBCXX_BASE_EXCEPTION_H
#define NECTAR_LIBCXX_BASE_EXCEPTION_H
-#include <LibNectar/__abi.h>
-#include <LibNectar/base_process.h>
-#include <LibNectar/defines.h>
+#include <LibNectarCore/__abi.h>
+#include <LibNectarCore/base_process.h>
+#include <LibNectarCore/defines.h>
/// @author Amlal El Mahrouss (amlal@nekernel.org)
diff --git a/include/LibNectar/base_math.h b/include/LibNectarCore/base_math.h
index 5a1ce8b..af31764 100644
--- a/include/LibNectar/base_math.h
+++ b/include/LibNectarCore/base_math.h
@@ -6,7 +6,7 @@
#ifndef NECTAR_LIBCXX_BASE_MATH_H
#define NECTAR_LIBCXX_BASE_MATH_H
-#include <LibNectar/defines.h>
+#include <LibNectarCore/defines.h>
#ifndef NAN
#define NAN (__builtin_nanf(""))
diff --git a/include/LibNectar/base_process.h b/include/LibNectarCore/base_process.h
index 80ef299..15d601b 100644
--- a/include/LibNectar/base_process.h
+++ b/include/LibNectarCore/base_process.h
@@ -6,14 +6,14 @@
#ifndef NECTAR_LIBCXX_BASE_PROCESS_H
#define NECTAR_LIBCXX_BASE_PROCESS_H
-#include <LibNectar/defines.h>
+#include <LibNectarCore/defines.h>
__init_decl()
- /// @brief CRT exit, with exit code (!!! exits all threads. !!!)
- /// @param code the exit code.
- /// @return the return > 0 for non successful.
- extern int exit_(int code);
+/// @brief CRT exit, with exit code (!!! exits all threads. !!!)
+/// @param code the exit code.
+/// @return the return > 0 for non successful.
+extern int exit_(int code);
/// @brief CRT signal handler.
/// @param code the signal code.
diff --git a/include/LibNectar/defines.h b/include/LibNectarCore/defines.h
index 061769c..061769c 100644
--- a/include/LibNectar/defines.h
+++ b/include/LibNectarCore/defines.h
diff --git a/include/LibNectar/filesystem.h b/include/LibNectarCore/filesystem.h
index daac4c1..daac4c1 100644
--- a/include/LibNectar/filesystem.h
+++ b/include/LibNectarCore/filesystem.h
diff --git a/include/LibNectar/mkhdrs.sh b/include/LibNectarCore/mkhdrs.sh
index b6b9f75..b6b9f75 100755
--- a/include/LibNectar/mkhdrs.sh
+++ b/include/LibNectarCore/mkhdrs.sh
diff --git a/include/LibNectar/new.h b/include/LibNectarCore/new.h
index 31f80bf..58ea424 100644
--- a/include/LibNectar/new.h
+++ b/include/LibNectarCore/new.h
@@ -6,7 +6,7 @@
#ifndef NECTAR_LIBNECTAR_NEW_H
#define NECTAR_LIBNECTAR_NEW_H
-#include <LibNectar/defines.h>
+#include <LibNectarCore/defines.h>
struct nothrow_t final {
explicit nothrow_t() = default;
diff --git a/include/LibNectar/utility.h b/include/LibNectarCore/utility.h
index 834b1a6..834b1a6 100644
--- a/include/LibNectar/utility.h
+++ b/include/LibNectarCore/utility.h
diff --git a/include/LibNectarStd/iterator.ncpp b/include/LibNectarStd/iterator.ncpp
deleted file mode 100644
index fe9015d..0000000
--- a/include/LibNectarStd/iterator.ncpp
+++ /dev/null
@@ -1,13 +0,0 @@
-
-struct iterator
-{
- let begin(let collection)
- {
- return nil;
- }
-
- let end(let collection)
- {
- return nil;
- }
-}; \ No newline at end of file
diff --git a/test/test_samples/iostream.ncpp b/test/test_samples/iostream.ncpp
index de1e6b8..6ba52ac 100644
--- a/test/test_samples/iostream.ncpp
+++ b/test/test_samples/iostream.ncpp
@@ -1,4 +1,4 @@
-import iostream;
+#include "../../include/LibNectar/iostream.nhh"
let main()
{
diff --git a/test/test_samples/return_value.ncpp b/test/test_samples/return_value.ncpp
index 897ca15..812743a 100644
--- a/test/test_samples/return_value.ncpp
+++ b/test/test_samples/return_value.ncpp
@@ -1,3 +1,5 @@
+#include "../../include/LibNectar/iostream.nhh"
+
let main()
{
let six_seven = 67;