From af51fb5bdfd9c338b7cf8b75b792e04a2667af5e Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 13 Nov 2023 09:13:32 -0500 Subject: add LIBALEE_SECTION; minor fixes --- libalee/state.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libalee/state.cpp') diff --git a/libalee/state.cpp b/libalee/state.cpp index df785e0..ed1562f 100644 --- a/libalee/state.cpp +++ b/libalee/state.cpp @@ -16,31 +16,35 @@ * along with this program. If not, see . */ -#include "corewords.hpp" -#include "state.hpp" +#include "alee.hpp" #include +LIBALEE_SECTION bool State::compiling() const { return dict.read(Dictionary::Compiling); } +LIBALEE_SECTION void State::compiling(bool yes) { dict.write(Dictionary::Compiling, yes); } +LIBALEE_SECTION State::Context State::save() { return context; } +LIBALEE_SECTION void State::load(const State::Context& ctx) { context = ctx; } +LIBALEE_SECTION Error State::execute(Addr addr) { auto stat = static_cast(setjmp(context.jmpbuf)); @@ -63,6 +67,7 @@ Error State::execute(Addr addr) return stat; } +LIBALEE_SECTION void State::reset() { while (size()) @@ -74,11 +79,13 @@ void State::reset() context.ip = 0; } +LIBALEE_SECTION std::size_t State::size() const noexcept { return dsp - dstack; } +LIBALEE_SECTION std::size_t State::rsize() const noexcept { return rsp - rstack; -- cgit v1.2.3