diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-21 09:12:06 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-21 09:12:06 +0200 |
| commit | 5e49fbae54bd7dcbf2e893acaef699ce9f2587f3 (patch) | |
| tree | 442826994985742eec15a6a26bf537141ebb379a /Sources/AssemblyFactory.cc | |
| parent | f4ee9dd22c91c076ad2bd8ba082f7ad02afac350 (diff) | |
MHR-21: Refactor, WiP symbol support in mov.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Sources/AssemblyFactory.cc')
| -rw-r--r-- | Sources/AssemblyFactory.cc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Sources/AssemblyFactory.cc b/Sources/AssemblyFactory.cc new file mode 100644 index 0000000..d5c0da7 --- /dev/null +++ b/Sources/AssemblyFactory.cc @@ -0,0 +1,58 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#include <Headers/AsmKit/AsmKit.hpp> +#include <Headers/StdKit/ErrorID.hpp> + +/** + * @file AssemblyFactory.cxx + * @author Amlal El Mahrouss (amlal@mahrouss.com) + * @brief Assembler Kit + * @version 0.1 + * @date 2024-01-27 + * + * @copyright Copyright (c) 2024, SoftwareLabs + * + */ + +#include <iostream> + +//! @file AsmKit.cpp +//! @brief AssemblyKit source implementation. + +namespace CompilerKit +{ + //! @brief Compile for specific format (ELF, PEF, ZBIN) + Int32 AssemblyFactory::Compile(std::string& sourceFile, + const Int32& arch) noexcept + { + if (sourceFile.length() < 1 || !fMounted) + return MPCC_UNIMPLEMENTED; + + return fMounted->CompileToFormat(sourceFile, arch); + } + + //! @brief mount assembly backend. + void AssemblyFactory::Mount(AssemblyInterface* mountPtr) noexcept + { + if (mountPtr) + { + fMounted = mountPtr; + } + } + + AssemblyInterface* AssemblyFactory::Unmount() noexcept + { + auto mount_prev = fMounted; + + if (mount_prev) + { + fMounted = nullptr; + } + + return mount_prev; + } +} // namespace CompilerKit |
