|
|
|
@ -22,16 +22,19 @@
|
|
|
|
|
#include <span>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
constinit static sforth::forth<1024> forth {sforth::initialize<&forth>()};
|
|
|
|
|
constinit static sforth::forth<2048> forth {sforth::initialize<&forth>()};
|
|
|
|
|
|
|
|
|
|
constinit static sforth::native_word<".", [](auto) {
|
|
|
|
|
char buf[32] = {};
|
|
|
|
|
auto ptr = buf + sizeof(buf);
|
|
|
|
|
auto v = forth.pop();
|
|
|
|
|
bool neg = v < 0;
|
|
|
|
|
if (neg) v = -v;
|
|
|
|
|
*--ptr = '\0';
|
|
|
|
|
do {
|
|
|
|
|
*--ptr = "0123456789abcdefghijklmnopqrstuvwxyz"[v % forth.base];
|
|
|
|
|
} while (v /= forth.base);
|
|
|
|
|
if (neg) *--ptr = '-';
|
|
|
|
|
std::cout << ptr << ' ';
|
|
|
|
|
}> dot;
|
|
|
|
|
constinit static sforth::native_word<"emit", [](auto) {
|
|
|
|
|