Making [IF] [THEN] work at console, bumping version.

This commit is contained in:
Brad Nelson
2023-01-03 21:01:51 -08:00
parent a1a934397d
commit 3d1cf4b93c
4 changed files with 12 additions and 3 deletions

View File

@ -15,9 +15,12 @@
( Interpret time conditionals )
: DEFINED? ( "name" -- xt|0 )
bl parse find state @ if aliteral then ; immediate
begin bl parse dup 0= while 2drop refill 0= throw repeat
find state @ if aliteral then ; immediate
defer [SKIP]
: [THEN] ; : [ELSE] [SKIP] ; : [IF] 0= if [SKIP] then ;
: [THEN] ; immediate
: [ELSE] [SKIP] ; immediate
: [IF] 0= if [SKIP] then ; immediate
: [SKIP]' 0 begin postpone defined? dup if
dup ['] [IF] = if swap 1+ swap then
dup ['] [ELSE] = if swap dup 0 <= if 2drop exit then swap then

View File

@ -109,6 +109,9 @@ static cell_t same(const char *a, const char *b, cell_t len) {
}
static cell_t find(const char *name, cell_t len) {
if (len == 0) {
return 0;
}
for (cell_t ***voc = g_sys->context; *voc; ++voc) {
cell_t xt = (cell_t) **voc;
while (xt) {