|
|
@ -40,17 +40,12 @@ constinit static sforth::native_word<"U.", [](auto) {
|
|
|
|
constinit static sforth::native_word<"EMIT", [](auto) {
|
|
|
|
constinit static sforth::native_word<"EMIT", [](auto) {
|
|
|
|
std::cout << static_cast<char>(forth.pop());
|
|
|
|
std::cout << static_cast<char>(forth.pop());
|
|
|
|
}, &udot> emit;
|
|
|
|
}, &udot> emit;
|
|
|
|
constinit static sforth::native_word<"TYPE", [](auto) {
|
|
|
|
|
|
|
|
const unsigned u = forth.pop();
|
|
|
|
|
|
|
|
const auto caddr = reinterpret_cast<const char *>(forth.pop());
|
|
|
|
|
|
|
|
std::cout << std::string_view{caddr, u};
|
|
|
|
|
|
|
|
}, &emit> type;
|
|
|
|
|
|
|
|
constinit static sforth::native_word<"INCLUDE", [](auto) {
|
|
|
|
constinit static sforth::native_word<"INCLUDE", [](auto) {
|
|
|
|
const auto w = forth.parse();
|
|
|
|
const auto w = forth.parse();
|
|
|
|
std::string s {w.begin(), w.end()};
|
|
|
|
std::string s {w.begin(), w.end()};
|
|
|
|
std::ifstream file {s};
|
|
|
|
std::ifstream file {s};
|
|
|
|
parse_stream(forth, file);
|
|
|
|
parse_stream(forth, file);
|
|
|
|
}, &type> incl;
|
|
|
|
}, &emit> incl;
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, const char *argv[])
|
|
|
|
int main(int argc, const char *argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|