variable latest
variable dp
: link>name cell+ ;
: link>flags cell+ ;
: hidden? link>flags c@ %10000000 and ;
: visible? hidden? not ;
: immediate? link>flags c@ %01000000 and ;
: link> link>name dup c@ %00111111 and + 1+ aligned ;
: here dp @ ;
: allot here + dp ! ;
: org dp ! ;
: align here aligned org ;
: , here ! cell allot ;
: c, here c! 1 allot ;
: alloc dp +! ;
: pad dp @ $10 + aligned ;
: len= ( c-addr c-addr -- f ) c@ $3F and swap c@ $3F and = ;
: dict-compare ( c-addr1 c-addr2 -- f )
2dup len= 0= if 2drop 0 exit then
swap 1+ swap count begin ?dup while
-rot 2dup ci@= 0= if 2drop drop 0 exit then
1+ swap 1+ rot 1-
repeat 2drop -1 ;
: find >r latest begin
@ dup if dup link>name r@ dict-compare over visible? and
else r@ swap true
then
until rdrop
dup if
dup link>
swap immediate? not 1 or
then
;
: ' bl word find dup 0= if drop count type space $3F emit else drop then ;
: words latest begin @ ?dup while
dup link>name count $3F and type space
repeat ;