- WORD p_wordlists,'WORDLIST',dovariable
- ;; VARIABLE WORDLIST is the currently active wordlist.
- dq last_word
+;;; CURRENT-WORDLIST (variable) points out "the current wordlist"
+;;; FORTH is a word list
+;;;
+
+ ;; FORTH is the last word of WORDLIST FORTH
+ WORD p_forth,'FORTH',dovariable
+ ;; The FORTH word list
+ dq last_forth_word ; tfa of last FORTH word
+ dq 0 ; successor word list dfa
+
+ WORD p_wordlist,'CURRENT-WORDLIST',dovariable
+ ;; CURRENT-WORDLIST points to dfa of the currently active wordlist.
+ dq p_forth_DFA ; compilation word list
+
+ WORD p_definitions,'DEFINITIONS',fasm
+ ;; ( wordlist -- )
+ ;; Change CURRENT-WORDLIST to use the given word list
+ pop qword [p_wordlist_DFA]
+ next
+
+ WORD p_use,'USE',fasm
+ ;; ( wordlist "name" -- cfa )
+ ;; Read next word using the given wordlist
+ pushr rsi
+ mov rax,qword [p_wordlist_DFA]
+ pushr rax
+ pop qword [p_wordlist_DFA]
+ DOFORTH p_input, p_get, p_read_word, p_find
+ popr rax
+ mov qword [p_wordlist_DFA],rax
+ cmp qword [rsp],0
+ jne p_use_done
+ add rsp,16
+ mov qword [rsp],0
+p_use_done:
+ popr rsi
+ next