aboutsummaryrefslogtreecommitdiffstats
path: root/libalee/state.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libalee/state.hpp')
-rw-r--r--libalee/state.hpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/libalee/state.hpp b/libalee/state.hpp
index 648b868..325f405 100644
--- a/libalee/state.hpp
+++ b/libalee/state.hpp
@@ -24,6 +24,7 @@
#include <csetjmp>
#include <cstddef>
+#include <tuple>
constexpr unsigned DataStackSize = 16;
constexpr unsigned ReturnStackSize = 16;
@@ -31,17 +32,6 @@ constexpr unsigned ReturnStackSize = 16;
class State
{
public:
- enum class Error : int {
- none = 0,
- push,
- pop,
- pushr,
- popr,
- top,
- pick,
- exit
- };
-
Addr ip = 0;
Dictionary& dict;
void (*input)(State&);
@@ -54,7 +44,11 @@ public:
bool compiling() const;
void compiling(bool);
+ std::pair<Addr, std::jmp_buf> save();
+ void load(const std::pair<Addr, std::jmp_buf>&);
+
Error execute(Addr);
+ void reset();
std::size_t size() const noexcept;
std::size_t rsize() const noexcept;