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_tfa2cfa,'TFA>CFA',fasm
24 ;; Advance a word tfa pointer to the cfa field
30 WORD p_tfa2dfa,'TFA>DFA',fasm
32 ;; Advance a word tfa pointer to the dfa field
38 WORD p_dfa2tfa,'DFA>TFA',fasm
40 ;; Advance a word tfa pointer to the dfa field
42 mov rax,qword [rax-24] ; tfa
46 WORD p_wordlist,'CURRENT-WORDLIST',dovariable
47 ;; CURRENT-WORDLIST points to cfa of the currently active wordlist.
50 WORD p_words,'WORDS',fasm
54 mov rax,qword [p_wordlist_DFA] ; current wordlist word
55 mov rax,[rax] ; list start
56 sub rsp,8 ; use stack to hold ptr
64 ;; pfa@ => ( chars* length)
67 pop rax ; ignore errors
78 WORD p_strncmp,'STRNCMP',fasm
79 ;; ( chars1 chars2 n -- flag )
80 ;; Compare bytes until one is NUL, return <0, =0 or >0 to
81 ;; indicate that chars1 is lesser, they are equal, or chars2
82 ;; is lesser in ascii ordering respectively.
87 ;; rax = chars1, rbx = chars2, cl = byte acc, rdx = length
102 ;; ( chars length -- [ chars 0 | cfa 1 )
103 ;; Search the current wordlists for the given pname
105 mov rcx,[p_wordlist_DFA]
112 cmp rbx,qword [rcx+16] ; compare lengths
121 pop rax ; return value
131 mov qword [rsp+8],rcx ; replace chars with tfa