diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-10-21 20:24:25 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-10-21 20:24:25 +0200 |
| commit | 662860f03cdff8ea18b691dca1f3c84a4aaf07d5 (patch) | |
| tree | b3869c84e6a146ff183e0e201ab7160ce5d2a9a6 /dev/ToolchainKit/src/AssemblyFactory.cc | |
| parent | 32312160ea0c1fc2fd1e893721260de44dfdd78c (diff) | |
IMP: Major refactor of header and source files extensions.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ToolchainKit/src/AssemblyFactory.cc')
| -rw-r--r-- | dev/ToolchainKit/src/AssemblyFactory.cc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dev/ToolchainKit/src/AssemblyFactory.cc b/dev/ToolchainKit/src/AssemblyFactory.cc new file mode 100644 index 0000000..0d47a06 --- /dev/null +++ b/dev/ToolchainKit/src/AssemblyFactory.cc @@ -0,0 +1,59 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co + +------------------------------------------- */ + +#include <ToolchainKit/AAL/Asm.hxx> +#include <ToolchainKit/NFC/ErrorID.hxx> + +/** + * @file AssemblyFactory.cxx + * @author amlal (amlal@zeta.com) + * @brief Assembler Kit + * @version 0.1 + * @date 2024-01-27 + * + * @copyright Copyright (c) 2024, ZKA Web Services Co + * + */ + +#include <iostream> + +//! @file Asm.cpp +//! @brief AssemblyKit source implementation. + +namespace NDK +{ + ///! @brief Compile for specific format (ELF, PEF, ZBIN) + Int32 AssemblyFactory::Compile(std::string& sourceFile, + const Int32& arch) noexcept + { + if (sourceFile.length() < 1 || !fMounted) + return NDK_UNIMPLEMENTED; + + return fMounted->CompileToFormat(sourceFile, arch); + } + + ///! @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 (mount_prev) + { + fMounted = nullptr; + } + + return mount_prev; + } +} // namespace NDK |
