aboutsummaryrefslogtreecommitdiffstats
path: root/source/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core.cpp')
-rw-r--r--source/core.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/core.cpp b/source/core.cpp
index c5d7f28..cc7c267 100644
--- a/source/core.cpp
+++ b/source/core.cpp
@@ -29,13 +29,13 @@ void jump(FuncList ip)
// LITERAL's run-time semantics: push the given value onto the stack.
static auto literall = WordWrap<[] {
- *++SP = (Cell)*++IP;
+ push((Cell)*++IP);
}>();
void compileliteral()
{
comma((Cell)literall);
- comma(*SP--);
+ comma(pop());
}
bool haskey()
@@ -114,11 +114,11 @@ void word()
auto here = (char *)HERE;
++HERE;
- readword(*SP);
+ readword(*sp());
here[0] = strlen(here + 1);
HERE = (Cell)here;
- *SP = HERE;
+ *sp() = HERE;
}
void colon()
@@ -132,7 +132,7 @@ void colon()
// Build the Word structure.
comma(HERE + 4 * sizeof(Cell)); // exec ptr
comma(name); // name ptr
- *++SP = (Cell)comma(0); // link (to be set by semic())
+ push((Cell)comma(0)); // link (to be set by semic())
comma(0); // immediate
// The word's execution begins with a prologue that technically performs
@@ -141,13 +141,13 @@ void colon()
// about if it is running words or routines (i.e. pre-defined words).
comma((Cell)+[](FuncList *ip) {
++ip;
- *++RP = (Cell)IP;
+ rpush((Cell)IP);
jump((FuncList)*ip);
});
// The actual function list will begin one Cell beyond here.
comma(HERE + sizeof(Cell));
- DICT[DIdxCompXt] = *SP - 2 * sizeof(Cell);
+ DICT[DIdxCompXt] = *sp() - 2 * sizeof(Cell);
// Enter compiling state.
STATE = -1;
@@ -159,7 +159,7 @@ void semic()
comma((Cell)fexit);
// Complete the new word's linkage to make it usable.
- auto link = (Cell *)*SP--;
+ auto link = (Cell *)pop();
*link = LATEST;
LATEST = (Cell)(link - 2);
@@ -177,7 +177,7 @@ void tick()
// Look up the name and push the result.
int len = HERE - (Cell)name - 1;
auto word = find(name, len);
- *++SP = (Cell)word;
+ push((Cell)word);
// Deallocate `name`.
HERE = (Cell)name;