aboutsummaryrefslogtreecommitdiffstats
path: root/source/state.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/state.hpp')
-rw-r--r--source/state.hpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/state.hpp b/source/state.hpp
index 17d8e69..8bdc5dc 100644
--- a/source/state.hpp
+++ b/source/state.hpp
@@ -42,10 +42,15 @@ extern std::array<Cell, DictSize> DICT;
extern Cell& HERE; /** Linked to HERE's storage in DICT. */
extern Cell& LATEST; /** Linked to LATEST's storage in DICT. */
extern Cell& STATE; /** Linked to STATE's storage in DICT. */
+extern FuncList IP; /** Instruction pointer */
-extern Cell *SP; /** Data stack pointer */
-extern Cell *RP; /** Return stack pointer */
-extern FuncList IP; /** Instruction pointer */
+void push(Cell);
+[[nodiscard]] Cell pop();
+[[nodiscard]] Cell *sp();
+
+void rpush(Cell);
+[[nodiscard]] Cell rpop();
+[[nodiscard]] Cell *rp();
/**
* Initializes the dictionary to default values.
@@ -63,13 +68,15 @@ inline void initialize(const auto& wordset)
* Begins execution with the given function pointer list.
* @param list Function pointer list to execute
*/
-void executor(FuncList *list);
+[[nodiscard]]
+Error executor(FuncList *list);
/**
* Executes the given word by calling executor on its definition.
* @param word The word to execute
*/
-void execute1(Word *word);
+[[nodiscard]]
+Error execute1(Word *word);
/**
* Looks up the definition of the given word.