summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 17:27:19 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 17:27:19 -0500
commitdad25544802de6d4cd839f5d6d5753ad7faeef97 (patch)
treeac60308829c163689c47da059d5de14296d81f4e /src
parentbdef578a578177ce95c01fa061a028292556ecbe (diff)
chore: update general specs and citation file, breaking project structure changes as well.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/LibC++/.gitignore2
-rwxr-xr-xsrc/LibC++/make-stdcpp-hdrs.sh (renamed from src/LibC++/make_hdrs.sh)2
-rw-r--r--src/Tools/asm.cc96
-rw-r--r--src/Tools/asm.json12
-rw-r--r--src/Tools/cppdrv.cc27
-rw-r--r--src/Tools/cppdrv.json12
-rw-r--r--src/Tools/dbg.cc18
-rw-r--r--src/Tools/dbg.json12
-rw-r--r--src/Tools/kdbg.cc18
-rw-r--r--src/Tools/kdbg.json12
-rwxr-xr-xsrc/Tools/ld64bin0 -> 16152 bytes
-rw-r--r--src/Tools/ld64.cc16
-rw-r--r--src/Tools/ld64.json12
-rwxr-xr-xsrc/Tools/pef-amd64-cxxdrvbin0 -> 17768 bytes
-rw-r--r--src/Tools/pef-amd64-cxxdrv.cc40
-rw-r--r--src/Tools/pef-amd64-cxxdrv.json19
-rw-r--r--src/Tools/pef-arm64-cdrv.cc49
-rw-r--r--src/Tools/pef-arm64-cdrv.json19
18 files changed, 364 insertions, 2 deletions
diff --git a/src/LibC++/.gitignore b/src/LibC++/.gitignore
index 5fa1170..e3f10ea 100644
--- a/src/LibC++/.gitignore
+++ b/src/LibC++/.gitignore
@@ -1 +1 @@
-stdcxx/
+libc++/
diff --git a/src/LibC++/make_hdrs.sh b/src/LibC++/make-stdcpp-hdrs.sh
index 5e8907e..a3730de 100755
--- a/src/LibC++/make_hdrs.sh
+++ b/src/LibC++/make-stdcpp-hdrs.sh
@@ -1,6 +1,6 @@
#! /bin/sh
-outputDir=libCxx/
+outputDir=libc++/
mkdir -p $outputDir
diff --git a/src/Tools/asm.cc b/src/Tools/asm.cc
new file mode 100644
index 0000000..025b158
--- /dev/null
+++ b/src/Tools/asm.cc
@@ -0,0 +1,96 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+/// @file asm.cc
+/// @brief Assembler frontend.
+
+#include <CompilerKit/Defines.h>
+#include <CompilerKit/Version.h>
+#include <cstring>
+#include <vector>
+
+CK_IMPORT_C Int32 AssemblerMainPower64(Int32 argc, Char const* argv[]);
+CK_IMPORT_C Int32 AssemblerMainARM64(Int32 argc, Char const* argv[]);
+CK_IMPORT_C Int32 AssemblerMain64x0(Int32 argc, Char const* argv[]);
+CK_IMPORT_C Int32 AssemblerMainAMD64(Int32 argc, Char const* argv[]);
+
+enum AsmKind : Int32 {
+ kInvalidAssembler = 0,
+ kX64Assembler = 100,
+ k64X0Assembler,
+ kPOWER64Assembler,
+ kARM64Assembler,
+ kAssemblerCount = kARM64Assembler - kX64Assembler + 1,
+};
+
+Int32 main(Int32 argc, Char const* argv[]) {
+ std::vector<const Char*> arg_vec_cstr;
+ arg_vec_cstr.push_back(argv[0]);
+
+ const Int32 kInvalidAssembler = -1;
+ Int32 asm_type = kInvalidAssembler;
+
+ for (size_t index_arg = 1; index_arg < argc; ++index_arg) {
+ if (strstr(argv[index_arg], "-asm:h")) {
+ std::printf("asm: Frontend Assembler (64x0, power64, arm64, x64).\n");
+ std::printf("asm: Version: %s, Release: %s.\n", kDistVersion, kDistRelease);
+ std::printf(
+ "asm: Designed by Amlal El Mahrouss, Copyright (C) 2024-2025 Amlal El Mahrouss, all "
+ "rights reserved.\n");
+ std::printf(
+ "CompilerKit: Designed by Amlal El Mahrouss, Copyright (C) 2024-2025 Amlal El Mahrouss, "
+ "Licensed under the Apache 2.0 license.\n");
+
+ return 0;
+ } else if (strstr(argv[index_arg], "-asm:x64")) {
+ asm_type = kX64Assembler;
+ } else if (strstr(argv[index_arg], "-asm:aarch64")) {
+ asm_type = kARM64Assembler;
+ } else if (strstr(argv[index_arg], "-asm:64x0")) {
+ asm_type = k64X0Assembler;
+ } else if (strstr(argv[index_arg], "-asm:power64")) {
+ asm_type = kPOWER64Assembler;
+ } else {
+ arg_vec_cstr.push_back(argv[index_arg]);
+ }
+ }
+
+ switch (asm_type) {
+ case kPOWER64Assembler: {
+ if (int32_t code = AssemblerMainPower64(arg_vec_cstr.size(), arg_vec_cstr.data()); code) {
+ std::printf("asm: frontend exited with code %i.\n", code);
+ return code;
+ }
+ break;
+ }
+ case k64X0Assembler: {
+ if (int32_t code = AssemblerMain64x0(arg_vec_cstr.size(), arg_vec_cstr.data()); code) {
+ std::printf("asm: frontend exited with code %i.\n", code);
+ return code;
+ }
+ break;
+ }
+ case kARM64Assembler: {
+ if (int32_t code = AssemblerMainARM64(arg_vec_cstr.size(), arg_vec_cstr.data()); code) {
+ std::printf("asm: frontend exited with code %i.\n", code);
+ return code;
+ }
+ break;
+ }
+ case kX64Assembler: {
+ if (int32_t code = AssemblerMainAMD64(arg_vec_cstr.size(), arg_vec_cstr.data()); code) {
+ std::printf("asm: frontend exited with code %i.\n", code);
+ return code;
+ }
+ break;
+ }
+ default: {
+ return EXIT_FAILURE;
+ }
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Tools/asm.json b/src/Tools/asm.json
new file mode 100644
index 0000000..bfb8ac7
--- /dev/null
+++ b/src/Tools/asm.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"],
+ "sources_path": ["asm.cc"],
+ "output_name": "asm",
+ "compiler_flags": ["-L/usr/lib", "-lCompilerKit"],
+ "cpp_macros": [
+ "__ASM__=202401",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+}
diff --git a/src/Tools/cppdrv.cc b/src/Tools/cppdrv.cc
new file mode 100644
index 0000000..2cccf2b
--- /dev/null
+++ b/src/Tools/cppdrv.cc
@@ -0,0 +1,27 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+/// @file cxxdrv.cc
+/// @brief NeCTI frontend preprocessor.
+
+#include <CompilerKit/Defines.h>
+#include <CompilerKit/ErrorID.h>
+#include <CompilerKit/Version.h>
+#include <cstring>
+#include <iostream>
+#include <vector>
+
+CK_IMPORT_C int CPlusPlusPreprocessorMain(int argc, char const* argv[]);
+
+int main(int argc, char const* argv[]) {
+ if (auto code = CPlusPlusPreprocessorMain(argc, argv); code > 0) {
+ std::printf("cppdrv: preprocessor exited with code %i.\n", code);
+
+ return NECTI_EXEC_ERROR;
+ }
+
+ return NECTI_SUCCESS;
+}
diff --git a/src/Tools/cppdrv.json b/src/Tools/cppdrv.json
new file mode 100644
index 0000000..9eb5e54
--- /dev/null
+++ b/src/Tools/cppdrv.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"],
+ "sources_path": ["cppdrv.cc"],
+ "output_name": "cppdrv",
+ "compiler_flags": ["-L/usr/local/lib", "-lCompilerKit"],
+ "cpp_macros": [
+ "__CPPDRV__=202504",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+}
diff --git a/src/Tools/dbg.cc b/src/Tools/dbg.cc
new file mode 100644
index 0000000..a54c59e
--- /dev/null
+++ b/src/Tools/dbg.cc
@@ -0,0 +1,18 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+#include <CompilerKit/Defines.h>
+
+/// @file dbg.cc
+/// @brief NeCTI debugger.
+
+CK_IMPORT_C Int32 DebuggerMachPOSIX(Int32 argc, Char const* argv[]);
+
+/// @brief Debugger entrypoint.
+/// @return Status code of debugger.
+Int32 main(Int32 argc, Char const* argv[]) {
+ return DebuggerMachPOSIX(argc, argv);
+}
diff --git a/src/Tools/dbg.json b/src/Tools/dbg.json
new file mode 100644
index 0000000..8e786a7
--- /dev/null
+++ b/src/Tools/dbg.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"],
+ "sources_path": ["dbg.cc"],
+ "output_name": "dbg",
+ "compiler_flags": ["-L/usr/lib", "-lDebuggerKit"],
+ "cpp_macros": [
+ "__DBG__=202401",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+}
diff --git a/src/Tools/kdbg.cc b/src/Tools/kdbg.cc
new file mode 100644
index 0000000..4ee508d
--- /dev/null
+++ b/src/Tools/kdbg.cc
@@ -0,0 +1,18 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+#include <CompilerKit/Defines.h>
+
+/// @file kdbg.cc
+/// @brief NeKernel debugger.
+
+CK_IMPORT_C Int32 DebuggerNeKernel(Int32 argc, Char const* argv[]);
+
+/// @brief Debugger entrypoint.
+/// @return Status code of debugger.
+Int32 main(Int32 argc, Char const* argv[]) {
+ return DebuggerNeKernel(argc, argv);
+}
diff --git a/src/Tools/kdbg.json b/src/Tools/kdbg.json
new file mode 100644
index 0000000..f661fc5
--- /dev/null
+++ b/src/Tools/kdbg.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"],
+ "sources_path": ["kdbg.cc"],
+ "output_name": "kdbg",
+ "compiler_flags": ["-L/usr/lib", "-lDebuggerKit"],
+ "cpp_macros": [
+ "__DBG__=202401",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+}
diff --git a/src/Tools/ld64 b/src/Tools/ld64
new file mode 100755
index 0000000..cd81455
--- /dev/null
+++ b/src/Tools/ld64
Binary files differ
diff --git a/src/Tools/ld64.cc b/src/Tools/ld64.cc
new file mode 100644
index 0000000..1f0392d
--- /dev/null
+++ b/src/Tools/ld64.cc
@@ -0,0 +1,16 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+#include <CompilerKit/Defines.h>
+
+/// @file ld64.cc
+/// @brief NeCTI linker for AE objects.
+
+CK_IMPORT_C Int32 DynamicLinker64PEF(Int32 argc, Char const* argv[]);
+
+Int32 main(Int32 argc, Char const* argv[]) {
+ return DynamicLinker64PEF(argc, argv);
+}
diff --git a/src/Tools/ld64.json b/src/Tools/ld64.json
new file mode 100644
index 0000000..2045550
--- /dev/null
+++ b/src/Tools/ld64.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"],
+ "sources_path": ["ld64.cc"],
+ "output_name": "ld64",
+ "compiler_flags": ["-L/usr/lib", "-lCompilerKit"],
+ "cpp_macros": [
+ "__LD64__=202401",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+}
diff --git a/src/Tools/pef-amd64-cxxdrv b/src/Tools/pef-amd64-cxxdrv
new file mode 100755
index 0000000..16189ea
--- /dev/null
+++ b/src/Tools/pef-amd64-cxxdrv
Binary files differ
diff --git a/src/Tools/pef-amd64-cxxdrv.cc b/src/Tools/pef-amd64-cxxdrv.cc
new file mode 100644
index 0000000..3fc41fe
--- /dev/null
+++ b/src/Tools/pef-amd64-cxxdrv.cc
@@ -0,0 +1,40 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+/// @file cxxdrv.cc
+/// @brief NeCTI C++ frontend compiler.
+
+#include <CompilerKit/Defines.h>
+#include <CompilerKit/ErrorID.h>
+#include <CompilerKit/Version.h>
+#include <CompilerKit/utils/CompilerUtils.h>
+#include <CompilerKit/utils/DylibHelpers.h>
+
+#ifdef __APPLE__
+static auto kPath = "/usr/local/lib/libCompilerKit.dylib";
+#else
+static auto kPath = "/usr/lib/libCompilerKit.so";
+#endif
+
+static auto kSymbol = "CompilerCPlusPlusAMD64";
+
+Int32 main(Int32 argc, Char const* argv[]) {
+ CompilerKitDylibTraits dylib;
+ dylib(kPath, kSymbol);
+
+ CompilerKitEntrypoint entrypoint_cxx = (CompilerKitEntrypoint) dylib.fEntrypoint;
+
+ if (!entrypoint_cxx) {
+ kStdOut;
+ std::printf("error: Could not find entrypoint in %s: %s\n", kPath, dlerror());
+
+ return EXIT_FAILURE;
+ }
+
+ auto ret = (entrypoint_cxx(argc, argv) == NECTI_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE;
+
+ return ret;
+}
diff --git a/src/Tools/pef-amd64-cxxdrv.json b/src/Tools/pef-amd64-cxxdrv.json
new file mode 100644
index 0000000..62b5b4d
--- /dev/null
+++ b/src/Tools/pef-amd64-cxxdrv.json
@@ -0,0 +1,19 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../CompilerKit",
+ "../",
+ "../CompilerKit/src/Detail"
+ ],
+ "sources_path": [
+ "pef-amd64-cxxdrv.cc"
+ ],
+ "output_name": "pef-amd64-cxxdrv",
+ "compiler_flags": [
+ ],
+ "cpp_macros": [
+ "__CXXDRV__=202504",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+} \ No newline at end of file
diff --git a/src/Tools/pef-arm64-cdrv.cc b/src/Tools/pef-arm64-cdrv.cc
new file mode 100644
index 0000000..0a4a9af
--- /dev/null
+++ b/src/Tools/pef-arm64-cdrv.cc
@@ -0,0 +1,49 @@
+/* ========================================
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license
+
+======================================== */
+
+/// @file cxxdrv.cc
+/// @brief NeCTI C++ frontend compiler.
+
+#include <CompilerKit/Defines.h>
+#include <CompilerKit/ErrorID.h>
+#include <CompilerKit/Version.h>
+#include <CompilerKit/utils/CompilerUtils.h>
+#include <CompilerKit/utils/DylibHelpers.h>
+
+#ifdef __APPLE__
+static auto kPath = "/usr/local/lib/libCompilerKit.dylib";
+#else
+static auto kPath = "/usr/lib/libCompilerKit.so";
+#endif
+
+static auto kSymbol = "CompilerCLangARM64";
+
+Int32 main(Int32 argc, Char const* argv[]) {
+ CompilerKitDylib handler = dlopen(kPath, RTLD_LAZY | RTLD_GLOBAL);
+
+ if (!handler) {
+ kStdOut;
+ std::printf("error: Could not load dylib in %s: %s\n", kPath, dlerror());
+
+ return EXIT_FAILURE;
+ }
+
+ CompilerKitEntrypoint entrypoint_cxx = (CompilerKitEntrypoint) dlsym(handler, kSymbol);
+
+ if (!entrypoint_cxx) {
+ kStdOut;
+ std::printf("error: Could not find entrypoint in %s: %s\n", kPath, dlerror());
+ dlclose(handler);
+
+ return EXIT_FAILURE;
+ }
+
+ auto ret = (entrypoint_cxx(argc, argv) == NECTI_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE;
+
+ dlclose(handler);
+
+ return ret;
+}
diff --git a/src/Tools/pef-arm64-cdrv.json b/src/Tools/pef-arm64-cdrv.json
new file mode 100644
index 0000000..be6a1be
--- /dev/null
+++ b/src/Tools/pef-arm64-cdrv.json
@@ -0,0 +1,19 @@
+{
+ "compiler_path": "clang++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../CompilerKit",
+ "../",
+ "../CompilerKit/src/Detail"
+ ],
+ "sources_path": [
+ "pef-arm64-cdrv.cc"
+ ],
+ "output_name": "pef-arm64-cdrv",
+ "compiler_flags": [
+ ],
+ "cpp_macros": [
+ "__CXXDRV__=202504",
+ "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
+ ]
+} \ No newline at end of file