1 ;;; This file contains words dealing with word lists (vocabularies)
3 ;;; CURRENT-WORDLIST (variable) points out "the current wordlist"
4 ;;; SYSCALLS is a wordl list
5 ;;; FORTH is a word list
7 ;;; !! When a word list word is created, it gets added to the tail end
8 ;;; of the current word list as way of making all word list words be
9 ;;; present in all word lists. This is different to all other kinds of
10 ;;; words, which instead are added to the head end of the current word
13 ;;; !! A word list word is created, it is initialised to the head end
14 ;;; of the current word list. It will this be an extension to that
15 ;;; current word list.
17 ;;; EMPTY-WORDLIST is a word list word for an empty word list. It thus
18 ;;; only contains word list words.
20 ;;; WORDLIST ( "name" -- ) = start
22 WORD p_wordlist,'CURRENT-WORDLIST',dovariable
23 ;; CURRENT-WORDLIST points to cfa of the currently active wordlist.
26 WORD p_words,'WORDS',fasm
30 mov rax,qword [p_wordlist_DFA] ; current wordlist word
31 mov rax,[rax] ; list start
32 sub rsp,8 ; use stack to hold ptr
40 ;; pfa@ => ( chars* length)
43 pop rax ; ignore errors
54 WORD p_strncmp,'STRNCMP',fasm
55 ;; ( chars1 chars2 n -- flag )
56 ;; Compare bytes until one is NUL, return <0, =0 or >0 to
57 ;; indicate that chars1 is lesser, they are equal, or chars2
58 ;; is lesser in ascii ordering respectively.
63 ;; rax = chars1, rbx = chars2, cl = byte acc, rdx = length
77 WORD p_find,'FIND',fasm
78 ;; ( chars* length -- [ chars* length 0 ]|[ tfa ] )
79 ;; Search the current wordlists for the given pname
81 mov rcx,[p_wordlist_DFA]
82 mov rcx,qword [rcx] ; use rcx for word list traversing
83 mov rbx,qword [rsp] ; rbx is input length
84 mov rsi,qword [rsp+8] ; rsi is input chars*
87 je p_find_notfound ; jump at end of word list
88 cmp rbx,qword [rcx+16] ; compare lengths
89 jne p_find_nextword ; jump on length mismatch
90 push rcx ; save tfa for later
92 push rsi ; input chars
97 pop rax ; return value
102 mov rsi,qword [rsp+8]
111 mov qword [rsp],rcx ; replace with tfa / 0