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 @ LATEST ! ( 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)
38 DUP 32 >= OVER 127 <= AND IF
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)
76 CR ." Cannot empty search order stack!"
81 context #context @ + dup 1- @ swap !
89 \ Display search order and compilation dictionary
93 context #context @ 1- + context swap
98 \ Current (definitions)
100 current @ >name .name
103 \ Display transient vocabulary contents
106 context #context @ 1- + @
109 ?DUP ( while link pointer is not 0 )
111 DUP ?HIDDEN NOT IF ( ignore hidden words )
112 DUP 1+ .NAME ( but if not hidden, print the word )
115 @ ( dereference the link pointer - go to previous word )
120 only forth also definitions