1 \ @(#) filefind.fth 98/01/26 1.2
2 \ FILE? ( <name> -- , report which file this Forth word was defined in )
4 \ FILE? looks for ::::Filename and ;;;; in the dictionary
5 \ that have been left by INCLUDE. It figures out nested
6 \ includes and reports each file that defines the word.
9 \ Copyright 1992 Phil Burk
11 \ 00001 PLB 2/21/92 Handle words from kernel or keyboard.
13 \ 961213 PLB Port to pForth.
15 ANEW TASK-FILEFIND.FTH
17 : BE@ { addr | val -- val , fetch from unaligned address in BigEndian order }
21 val 8 lshift or -> val
26 : BE! { val addr -- , store to unaligned address in BigEndian order }
33 : BEW@ { addr -- , fetch word from unaligned address in BigEndian order }
38 : BEW! { val addr -- , store word to unaligned address in BigEndian order }
43 \ scan dictionary from NFA for filename
44 : F?.SEARCH.NFA { nfa | dpth stoploop keyb nfa0 -- addr count }
69 true -> keyb \ maybe from keyboard
86 : FINDNFA.FROM { $name start_nfa -- nfa true | $word false }
93 \ Search entire dictionary for all occurences of named word.
94 : FILE? { | $word nfa done? -- , take name from input }
99 $word count type ." from:" cr
102 nfa f?.search.nfa ( addr cnt )
103 nfa name> 12 .r \ print xt
105 nfa prevname dup -> nfa
108 $word nfa findnfa.from \ search from one behind found nfa
116 count type ." not found!" cr