;;; This file contains words dealing with word lists (vocabularies)
-;;;
- WORD p_wordlists,'WORDLIST',dovariable
+
+ WORD p_wordlist,'WORDLIST',dovariable
;; VARIABLE WORDLIST is the currently active wordlist.
dq last_word
+ WORD p_words,'WORDS',fasm
+ ;; ( -- )
+ ;; Dump all words
+ pushr rsi
+ push qword [p_wordlist_DFA]
+p_words_LOOP:
+ mov rax,qword [rsp]
+ cmp rax,0
+ je p_words_END
+ ;; tfa>pfa
+ add rax,9
+ ;; pfa@ => ( chars* length)
+ xor rbx,rbx
+ mov bl,[rax]
+ inc rax
+ push 1
+ push rax
+ push rbx
+ DOFORTH sys_write
+ pop rax ; ignore errors
+ push 10
+ DOFORTH p_emit
+ mov rax,qword [rsp]
+ mov rax,qword [rax]
+ mov qword [rsp],rax
+ jmp p_words_LOOP
+
+p_words_END:
+ popr rsi
+ next
+
WORD p_strncmp,'STRNCMP',fasm
;; ( chars1 chars2 n -- flag )
;; Compare bytes until one is NUL, return <0, =0 or >0 to
WORD p_find,'FIND'
;; ( chars length -- [ chars 0 | cfa 1 )
;; Search the current wordlists for the given pname
- mov rcx,[p_wordlists_DFA]
+ mov rcx,[p_wordlist_DFA]
p_find_loop:
cmp rcx,0
je p_find_done