diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-03 23:40:16 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-03 23:40:16 +0100 |
| commit | b03f3d83efcbc012c4153da14eaf158bb50031d2 (patch) | |
| tree | dc004f8d0ef866c77fff7aa4ec271363b5417f9d /C++Kit/AsmKit/AsmKit.cc | |
| parent | 05c51485d56b14f7cd3c05afebd920157d7a0b8b (diff) | |
tools: incremental changes, support for a C compiler will soon be here.
alongside the 32x0.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'C++Kit/AsmKit/AsmKit.cc')
| -rw-r--r-- | C++Kit/AsmKit/AsmKit.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/C++Kit/AsmKit/AsmKit.cc b/C++Kit/AsmKit/AsmKit.cc new file mode 100644 index 0000000..d44874d --- /dev/null +++ b/C++Kit/AsmKit/AsmKit.cc @@ -0,0 +1,47 @@ +/* + * ======================================================== + * + * C++Kit + * Copyright Western Company, all rights reserved. + * + * ======================================================== + */ + +#include <AsmKit/AsmKit.hpp> +#include <StdKit/ErrorID.hpp> + +#include <iostream> + +//! @file AsmKit.cpp +//! @brief AssemblyKit + +namespace CxxKit +{ + //! @brief Compile for specific format (ELF, PEF, ZBIN) + Int32 AssemblyFactory::Compile(StringView& sourceFile, + const Int32& arch) noexcept + { + if (sourceFile.Length() < 1 || + !fMounted) + return CXXKIT_UNIMPLEMENTED; + + return fMounted->CompileToFormat(sourceFile, arch); + } + + //! @brief mount assembly backend. + void AssemblyFactory::Mount(AssemblyMountpoint* mountPtr) noexcept + { + if (mountPtr) + fMounted = mountPtr; + } + + AssemblyMountpoint* AssemblyFactory::Unmount() noexcept + { + auto mount_prev = fMounted; + + if (mount_prev) + fMounted = nullptr; + + return mount_prev; + } +} |
