summaryrefslogtreecommitdiffhomepage
path: root/C++Kit/AsmKit/AsmKit.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2023-12-30 23:39:37 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2023-12-30 23:39:37 +0100
commit263915832993dd12beee10e204f9ebcc6c786ed2 (patch)
tree862e51208a99c35746e574a76564a4532b3a4a49 /C++Kit/AsmKit/AsmKit.cpp
Meta: initial commit of WestCo optimized toolchain.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'C++Kit/AsmKit/AsmKit.cpp')
-rw-r--r--C++Kit/AsmKit/AsmKit.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/C++Kit/AsmKit/AsmKit.cpp b/C++Kit/AsmKit/AsmKit.cpp
new file mode 100644
index 0000000..75aaa55
--- /dev/null
+++ b/C++Kit/AsmKit/AsmKit.cpp
@@ -0,0 +1,47 @@
+/*
+ * ========================================================
+ *
+ * C++Kit
+ * Copyright WestCo, 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;
+ }
+}