summaryrefslogtreecommitdiffhomepage
path: root/Sources/AssemblyFactory.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-12 18:53:08 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-12 18:53:08 +0200
commit28dc20ee517dbbf98bd741fc2dfa24c82281d754 (patch)
treef49fca25c0e51632beb4a96eb031e9a4e346884f /Sources/AssemblyFactory.cxx
parent543b8c7287ac1248453a59cd3d759ce5ffeec4a3 (diff)
MHR-21: Lots of improvements and changes to the C++ compiler.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Sources/AssemblyFactory.cxx')
-rw-r--r--Sources/AssemblyFactory.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/Sources/AssemblyFactory.cxx b/Sources/AssemblyFactory.cxx
new file mode 100644
index 0000000..5a1475f
--- /dev/null
+++ b/Sources/AssemblyFactory.cxx
@@ -0,0 +1,51 @@
+/* -------------------------------------------
+
+ 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