|
|
@ -153,6 +153,8 @@ struct forth : public word_list
|
|
|
|
else
|
|
|
|
else
|
|
|
|
execute(body);
|
|
|
|
execute(body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sourcei = sv.find_first_not_of(" \t\r\n", sourcei);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -272,6 +274,11 @@ constexpr auto initialize()
|
|
|
|
fthp->push(std::bit_cast<cell>(fthp->source));
|
|
|
|
fthp->push(std::bit_cast<cell>(fthp->source));
|
|
|
|
fthp->push(len); }, 0
|
|
|
|
fthp->push(len); }, 0
|
|
|
|
, S{">in"}, [](auto) { fthp->push(std::bit_cast<cell>(&fthp->sourcei)); }, 0
|
|
|
|
, S{">in"}, [](auto) { fthp->push(std::bit_cast<cell>(&fthp->sourcei)); }, 0
|
|
|
|
|
|
|
|
, S{"key"}, [](auto) {
|
|
|
|
|
|
|
|
if (fthp->sourcei != std::string_view::npos)
|
|
|
|
|
|
|
|
fthp->push(fthp->source[fthp->sourcei++]);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
fthp->push(0); }, 0
|
|
|
|
>::word;
|
|
|
|
>::word;
|
|
|
|
constexpr static auto& dict2 = comp_dict<prologue, &dict1
|
|
|
|
constexpr static auto& dict2 = comp_dict<prologue, &dict1
|
|
|
|
, S{"align" }, S{"here dup aligned swap - allot"}, 0
|
|
|
|
, S{"align" }, S{"here dup aligned swap - allot"}, 0
|
|
|
@ -282,6 +289,7 @@ constexpr auto initialize()
|
|
|
|
, S{"2!" }, S{"swap over ! cell+ !"}, 0
|
|
|
|
, S{"2!" }, S{"swap over ! cell+ !"}, 0
|
|
|
|
, S{"2@" }, S{"dup cell+ @ swap @"}, 0
|
|
|
|
, S{"2@" }, S{"dup cell+ @ swap @"}, 0
|
|
|
|
, S{"c," }, S{"here c! 1 allot"}, 0
|
|
|
|
, S{"c," }, S{"here c! 1 allot"}, 0
|
|
|
|
|
|
|
|
, S{"exit" }, S{"0 ,"}, word_base::immediate
|
|
|
|
, S{"," }, S{"here ! cell allot"}, 0
|
|
|
|
, S{"," }, S{"here ! cell allot"}, 0
|
|
|
|
, S{"allot" }, S{"dp +!"}, 0
|
|
|
|
, S{"allot" }, S{"dp +!"}, 0
|
|
|
|
, S{"+!" }, S{"dup >r swap r> @ + swap !"}, 0
|
|
|
|
, S{"+!" }, S{"dup >r swap r> @ + swap !"}, 0
|
|
|
@ -304,6 +312,7 @@ constexpr auto initialize()
|
|
|
|
, S{"-rot" }, S{"rot rot"}, 0
|
|
|
|
, S{"-rot" }, S{"rot rot"}, 0
|
|
|
|
, S{"2drop" }, S{"drop drop"}, 0
|
|
|
|
, S{"2drop" }, S{"drop drop"}, 0
|
|
|
|
, S{"0<" }, S{"0 <"}, 0
|
|
|
|
, S{"0<" }, S{"0 <"}, 0
|
|
|
|
|
|
|
|
, S{"0<>" }, S{"0 <>"}, 0
|
|
|
|
, S{"<>" }, S{"= 0="}, 0
|
|
|
|
, S{"<>" }, S{"= 0="}, 0
|
|
|
|
, S{"0=" }, S{"0 ="}, 0
|
|
|
|
, S{"0=" }, S{"0 ="}, 0
|
|
|
|
, S{">" }, S{"swap <"}, 0
|
|
|
|
, S{">" }, S{"swap <"}, 0
|
|
|
|