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