diff --git a/furvm/include/furvm/module.hpp b/furvm/include/furvm/module.hpp index 5c67b30..4a0666a 100644 --- a/furvm/include/furvm/module.hpp +++ b/furvm/include/furvm/module.hpp @@ -1,11 +1,25 @@ #ifndef FURVM_MODULE_HPP #define FURVM_MODULE_HPP +#include "furvm/fwd.hpp" + +#include + namespace furvm { class mod { public: - mod() = default; + using bytecode_t = std::vector; /**< An alias to a vector of bytes. */ +public: + /** + * @brief Construct a new module. + * + * @param args Arguments to forward to bytecode's constructor. + */ + template >> + mod(Args&&... args) + : m_bytecode(std::forward(args)...) {} + ~mod() = default; /** @@ -21,6 +35,7 @@ public: mod(const mod&) = delete; mod& operator=(const mod&) = delete; private: + bytecode_t m_bytecode; }; } // namespace furvm diff --git a/furvm/src/main.cpp b/furvm/src/main.cpp index 6b537b2..58201af 100644 --- a/furvm/src/main.cpp +++ b/furvm/src/main.cpp @@ -1,11 +1,19 @@ #ifndef LIBFURVM #include "furvm/context.hpp" +#include "furvm/instruction.hpp" + +#include +#include + +static constexpr std::array s_bytecode = { + furvm::byte(furvm::instruction_t::NoOperation), +}; int main(void) { furvm::context context; - auto mainModule = context.emplace(); + auto mainModule = context.emplace(s_bytecode.begin(), s_bytecode.end()); return 0; }