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