From 6decb96948f61b9a311467ecdb621a048fbcd3d6 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 5 Dec 2025 16:48:25 -0500 Subject: chore: CompilerKit breaking changes. Signed-off-by: Amlal El Mahrouss --- src/CompilerKit/src/AssemblyFactory.cc | 51 ---------------------- .../src/CodeGenerator+AssemblyFactory.cc | 51 ++++++++++++++++++++++ .../src/Compilers/CPlusPlusCompiler+AMD64.cc | 6 +-- .../src/DyanmicLinkers/DynamicLinker64+PEF.cc | 2 +- 4 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 src/CompilerKit/src/AssemblyFactory.cc create mode 100644 src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc (limited to 'src/CompilerKit') diff --git a/src/CompilerKit/src/AssemblyFactory.cc b/src/CompilerKit/src/AssemblyFactory.cc deleted file mode 100644 index f386083..0000000 --- a/src/CompilerKit/src/AssemblyFactory.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* ======================================== - - Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license - -======================================== */ - -#include -#include - -/** - * @file AssemblyFactory.cc - * @author Amlal El Mahrouss (amlal@nekernel.org) - * @brief Assembly API of NeCTI - * @version 0.0.3 - * @copyright Copyright (c) 2024-2025 Amlal El Mahrouss - * - */ - -namespace CompilerKit { -///! @brief Compile for specific format (ELF, PEF, ZBIN) -Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) noexcept { - if (sourceFile.length() < 1) return NECTI_UNIMPLEMENTED; - - if (!fMounted) return NECTI_UNIMPLEMENTED; - if (arch != fMounted->Arch()) return NECTI_INVALID_ARCH; - - try { - return this->fMounted->CompileToFormat(sourceFile, arch); - } catch (std::exception& e) { - return NECTI_EXEC_ERROR; - } -} - -///! @brief mount assembly backend. -void AssemblyFactory::Mount(AssemblyInterface* mountPtr) noexcept { - if (mountPtr) { - fMounted = mountPtr; - } -} - -///! @brief Unmount assembler. -AssemblyInterface* AssemblyFactory::Unmount() noexcept { - auto mount_prev = fMounted; - - if (fMounted) { - fMounted = nullptr; - } - - return mount_prev; -} -} // namespace CompilerKit diff --git a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc new file mode 100644 index 0000000..44e2484 --- /dev/null +++ b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cc @@ -0,0 +1,51 @@ +/* ======================================== + + Copyright (C) 2024-2025 Amlal El Mahrouss, Licensed under the Apache 2.0 license + +======================================== */ + +#include +#include + +/** + * @file AssemblyFactory.cc + * @author Amlal El Mahrouss (amlal@nekernel.org) + * @brief Assembly API of NeCTI + * @version 0.0.3 + * @copyright Copyright (c) 2024-2025 Amlal El Mahrouss + * + */ + +namespace CompilerKit { +///! @brief Compile for specific format (ELF, PEF, ZBIN) +Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) noexcept { + if (sourceFile.length() < 1) return NECTI_UNIMPLEMENTED; + + if (!fMounted) return NECTI_UNIMPLEMENTED; + if (arch != fMounted->Arch()) return NECTI_INVALID_ARCH; + + try { + return this->fMounted->CompileToFormat(sourceFile, arch); + } catch (...) { + return NECTI_EXEC_ERROR; + } +} + +///! @brief mount assembly backend. +void AssemblyFactory::Mount(IAssembly* mountPtr) noexcept { + if (mountPtr) { + fMounted = mountPtr; + } +} + +///! @brief Unmount assembler. +IAssembly* AssemblyFactory::Unmount() noexcept { + auto mount_prev = fMounted; + + if (fMounted) { + fMounted = nullptr; + } + + return mount_prev; +} +} // namespace CompilerKit diff --git a/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc b/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc index 23e1bd8..d93256d 100644 --- a/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc +++ b/src/CompilerKit/src/Compilers/CPlusPlusCompiler+AMD64.cc @@ -35,7 +35,7 @@ /* (c) Amlal El Mahrouss 2024-2025 */ /// @author Amlal El Mahrouss (amlal@nekernel.org) -/// @file CPlusPlusCompilerAMD64.cxx +/// @file CPlusPlusCompilerAMD64.cc /// @brief Optimized C++ Compiler Driver. ///////////////////////////////////// @@ -146,7 +146,7 @@ static std::size_t kFunctionEmbedLevel = 0UL; /// detail namespaces const char* CompilerFrontendCPlusPlusAMD64::Language() { - return "AMD64 C++"; + return "AMD64 CFront"; } static std::uintptr_t kOrigin = kPefBaseOrigin; @@ -753,7 +753,7 @@ class AssemblyCPlusPlusInterfaceAMD64 final CK_ASSEMBLY_INTERFACE { ///////////////////////////////////////////////////////////////////////////////////////// -#define kExtListCxx {".cpp", ".cxx", ".cc", ".c++", ".cp"} +#define kExtListCxx {".cpp", ".cc", ".cc", ".c++", ".cp"} NECTI_MODULE(CompilerCPlusPlusAMD64) { bool skip = false; diff --git a/src/CompilerKit/src/DyanmicLinkers/DynamicLinker64+PEF.cc b/src/CompilerKit/src/DyanmicLinkers/DynamicLinker64+PEF.cc index 5e8253b..28e12a1 100644 --- a/src/CompilerKit/src/DyanmicLinkers/DynamicLinker64+PEF.cc +++ b/src/CompilerKit/src/DyanmicLinkers/DynamicLinker64+PEF.cc @@ -31,7 +31,7 @@ #define kLinkerId (0x5046FF) #define kLinkerAbiContainer "__PEFContainer:ABI:" -#define kLinkerSplash() kStdOut << kLinkerVersionStr << std::endl +#define kLinkerSplash() kStdOut << kLinkerVersionStr << kStdEndl /// @brief PEF stack size symbol. #define kLinkerStackSizeSymbol "__PEFSizeOfReserveStack" -- cgit v1.2.3