feat(furvm): add a thing

This commit is contained in:
2026-06-06 22:52:25 +02:00
parent 5ace40b6aa
commit a077457636
5 changed files with 171 additions and 2 deletions
+30
View File
@@ -17,4 +17,34 @@ std::shared_ptr<executor> executor::create(const std::shared_ptr<context>& conte
return std::move(ex);
}
void executor::push_frame(const std::shared_ptr<mod>& mod, std::size_t position) {
m_frames.emplace((struct executor::frame){ mod, position, m_stack.size() });
}
struct executor::frame executor::pop_frame() {
struct executor::frame frame = m_frames.top();
m_frames.pop();
return frame;
}
struct executor::frame executor::frame() const {
return m_frames.top();
}
void executor::push_thing(const std::shared_ptr<class thing>& thing) {
m_stack.push(thing);
}
std::shared_ptr<class thing> executor::pop_thing() {
if (m_frames.top().stackBase >= m_stack.size()) return {};
std::shared_ptr<class thing> top = std::move(m_stack.top());
m_stack.pop();
return top;
}
std::shared_ptr<class thing> executor::thing() const {
if (m_frames.top().stackBase >= m_stack.size()) return {};
return m_stack.top();
}
} // namespace furvm
View File