feat(furvm): add serializer

This commit is contained in:
2026-06-14 15:19:12 +02:00
parent f6f716e8c9
commit 759ccad7a6
4 changed files with 127 additions and 9 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ namespace furvm {
class mod {
friend class function;
friend class serializer;
public:
using bytecode_t = std::vector<byte>; /**< An alias to a vector of bytes. */
public:
@@ -67,4 +68,4 @@ private:
} // namespace furvm
#endif // FURVM_MODULE_HPP
#endif // FURVM_MODULE_HPP
+20
View File
@@ -0,0 +1,20 @@
#ifndef FURVM_SERIALIZER_HPP
#define FURVM_SERIALIZER_HPP
#include "furvm/fwd.hpp"
#include <ostream>
namespace furvm {
class serializer {
public:
static constexpr byte MODULE_MAGIC[4] = { 'F', 'u', 'r', 'M' };
static constexpr std::uint32_t VERSION = 0;
public:
static bool serialize_module(std::ostream& os, const mod_p& mod);
};
} // namespace furvm
#endif // FURVM_SERIALIZER_HPP