feat(furvm): add new frame callback to executor

This commit is contained in:
2026-08-12 23:44:15 +02:00
parent 15218d7530
commit 713aec199f
2 changed files with 13 additions and 1 deletions
+10
View File
@@ -5,6 +5,7 @@
#include "furvm/module.hpp" // IWYU pragma: keep
#include "furvm/thing.hpp" // IWYU pragma: keep
#include <functional>
#include <stack>
#include <utility>
#include <vector>
@@ -28,6 +29,8 @@ static inline executor_flags operator~(executor_flags flags) {
return executor_flags(~static_cast<std::uint32_t>(flags));
}
using executor_callback = std::function<void(executor&)>;
class executor {
public:
/**
@@ -73,6 +76,11 @@ public:
* @brief Copy constructor.
*/
executor& operator=(const executor&) = default;
public:
template <typename CallbackFwd>
void set_new_frame_callback(CallbackFwd&& callback) {
m_newFrameCb = std::forward<CallbackFwd>(callback);
}
public:
/**
* @brief Returns flags of this executor.
@@ -177,6 +185,8 @@ private:
std::stack<struct frame> m_frames;
std::stack<thing_h> m_stack;
executor_callback m_newFrameCb = nullptr;
};
} // namespace furvm