make strncmp direction safe
[rrq/rrqforth.git] / adoc / p_find.adoc
index c8f355c2d1c8528e689a396be8c448ed2e407063..01c4579148af95865c8ddb054c56188defadefa7 100644 (file)
@@ -1,9 +1,22 @@
+// wordlists.asm:      WORD p_find,'FIND',fasm
+
 anchor:p_find[]
 
-Word: FIND
-----------
+=== Word: FIND
+....
+Data stack: ( char* n -- [ char* n 0 ]/[ tfa ] )
+....
+
+"FIND" is a function word that searches the current word list search
+path for the given [n:char*] word, and returns the TFA of the matching
+word if any. Otherwise FIND preserves the initial data stack but adds
+0 to it.
 
-----
-wordlists.asm: WORD p_find,'FIND',fasm
-----
+The word is sought starting with the
+<<p_current_wordlist,CURRENT-WORDLIST>> word list, for the first
+occurence of a match. If not found, the search continues with the
+subsequent word list, and so on.
 
+When a word is found, then the data stack is changed by discarding the
+[n:char*] double cell string pointer and pushing (only) the TFA of the
+matching word instead.