From 693dd621321e3af029d2c8cc8d58af716eb43988 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 9 Jan 2026 02:16:39 +0100 Subject: feat: necfront: final refactors and improvements before finishing Netcar implementation. Signed-off-by: Amlal El Mahrouss --- src/CommandLine/cppdrv.cc | 4 ++-- src/CommandLine/pef-amd64-cxxdrv.cc | 37 ----------------------------------- src/CommandLine/pef-amd64-cxxdrv.json | 20 ------------------- src/CommandLine/pef-amd64-necdrv.cc | 37 +++++++++++++++++++++++++++++++++++ src/CommandLine/pef-amd64-necdrv.json | 20 +++++++++++++++++++ 5 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 src/CommandLine/pef-amd64-cxxdrv.cc delete mode 100644 src/CommandLine/pef-amd64-cxxdrv.json create mode 100644 src/CommandLine/pef-amd64-necdrv.cc create mode 100644 src/CommandLine/pef-amd64-necdrv.json (limited to 'src/CommandLine') diff --git a/src/CommandLine/cppdrv.cc b/src/CommandLine/cppdrv.cc index d5d2cd0..6977923 100644 --- a/src/CommandLine/cppdrv.cc +++ b/src/CommandLine/cppdrv.cc @@ -9,10 +9,10 @@ #include #include -CK_IMPORT_C int CPlusPlusPreprocessorMain(int argc, char const* argv[]); +CK_IMPORT_C int GenericPreprocessorMain(int argc, char const* argv[]); int main(int argc, char const* argv[]) { - if (auto code = CPlusPlusPreprocessorMain(argc, argv); code > 0) { + if (auto code = GenericPreprocessorMain(argc, argv); code > 0) { std::printf("cppdrv: preprocessor exited with code %i.\n", code); return NECTAR_EXEC_ERROR; diff --git a/src/CommandLine/pef-amd64-cxxdrv.cc b/src/CommandLine/pef-amd64-cxxdrv.cc deleted file mode 100644 index 6617d2c..0000000 --- a/src/CommandLine/pef-amd64-cxxdrv.cc +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024-2025, 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 - -/// @file pef-amd64-cxxdrv.cc -/// @brief Nectar C++ frontend compiler for AMD64. - -#include -#include -#include -#include - -#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[]) { - CompilerKit::DLLLoader dylib; - dylib(kPath, kSymbol); - - CompilerKit::DLLLoader::EntryT entrypoint_cxx = - reinterpret_cast(dylib.fEntrypoint); - - if (!entrypoint_cxx) { - kStdOut; - std::printf("error: Could not find entrypoint in %s: %s\n", kPath, dlerror()); - - return EXIT_FAILURE; - } - - return (entrypoint_cxx(argc, argv) == NECTAR_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/src/CommandLine/pef-amd64-cxxdrv.json b/src/CommandLine/pef-amd64-cxxdrv.json deleted file mode 100644 index 90295b9..0000000 --- a/src/CommandLine/pef-amd64-cxxdrv.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compiler_path": "clang++", - "compiler_std": "c++20", - "headers_path": [ - "../include/CompilerKit", - "../../include", - "../include/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)" - ] -} - diff --git a/src/CommandLine/pef-amd64-necdrv.cc b/src/CommandLine/pef-amd64-necdrv.cc new file mode 100644 index 0000000..921c674 --- /dev/null +++ b/src/CommandLine/pef-amd64-necdrv.cc @@ -0,0 +1,37 @@ +// Copyright 2024-2025, 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 + +/// @file pef-amd64-cxxdrv.cc +/// @brief Nectar C++ frontend compiler for AMD64. + +#include +#include +#include +#include + +#ifdef __APPLE__ +static auto kPath = "/usr/local/lib/libCompilerKit.dylib"; +#else +static auto kPath = "/usr/lib/libCompilerKit.so"; +#endif + +static auto kSymbol = "CompilerNectarAMD64"; + +Int32 main(Int32 argc, Char const* argv[]) { + CompilerKit::DLLLoader dylib; + dylib(kPath, kSymbol); + + CompilerKit::DLLLoader::EntryT entrypoint_cxx = + reinterpret_cast(dylib.fEntrypoint); + + if (!entrypoint_cxx) { + kStdOut; + std::printf("error: Could not find entrypoint in %s: %s\n", kPath, dlerror()); + + return EXIT_FAILURE; + } + + return (entrypoint_cxx(argc, argv) == NECTAR_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/src/CommandLine/pef-amd64-necdrv.json b/src/CommandLine/pef-amd64-necdrv.json new file mode 100644 index 0000000..ea2209d --- /dev/null +++ b/src/CommandLine/pef-amd64-necdrv.json @@ -0,0 +1,20 @@ +{ + "compiler_path": "clang++", + "compiler_std": "c++20", + "headers_path": [ + "../include/CompilerKit", + "../../include", + "../include/CompilerKit/src/Detail" + ], + "sources_path": [ + "pef-amd64-necdrv.cc" + ], + "output_name": "pef-amd64-necdrv", + "compiler_flags": [ + ], + "cpp_macros": [ + "__NECDRV__=202504", + "kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)" + ] +} + -- cgit v1.2.3