1 \ Vocabulary management
3 \ Forget word and everything defined after it in compilation dict
5 BL WORD CURRENT @ FINDVOCAB ( find the word, gets the dictionary entry address )
13 dup @ current @ 1+ ! ( set LATEST to point to the previous word )
18 BL WORD FIND DROP >NAME
19 DUP @ F_HIDDEN OR SWAP !
23 1+ ( skip over the link pointer )
24 @ ( get the flags/length byte )
25 F_HIDDEN AND ( mask the F_HIDDEN flag and return it (as a truth value) )
28 \ Display name of word
30 DUP @ ( get the flags/length byte )
31 F_LENMASK AND ( mask out the flags - just want the length )
34 DUP 0> ( length > 0? )
36 SWAP 1+ ( addr len -- len addr+1 )
37 DUP @ ( len addr -- len addr char | get the next character)
39 EMIT ( len addr char -- len addr | and print it)
45 SWAP 1- ( len addr -- addr len-1 | subtract one from length )
51 \ Create new vocabulary
55 body> context #context @ 1- + !
59 context #context @ 1- + @ current !
62 \ Define root vocabulary (always available)
74 1 <= abort" Cannot empty search order stack!"
80 context #context @ + dup 1- @ swap !
88 \ Display search order and compilation dictionary
92 context #context @ 1- + context swap
97 \ Current (definitions)
102 \ Display transient vocabulary contents
105 context #context @ 1- + @
108 ?DUP ( while link pointer is not 0 )
110 DUP ?HIDDEN NOT IF ( ignore hidden words )
111 DUP 1+ .NAME ( but if not hidden, print the word )
114 @ ( dereference the link pointer - go to previous word )
119 only forth also definitions