aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012/core/find.frt
blob: a289cc8ac915f5e528281be61fab2df33052fa19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
\ #require count.frt

: find ( addr --  addr 0 | xt -1 | xt 1 ) 
  dup count find-xt  dup
  if rot drop then
;

\ \ find-xt is using the order stack
\ \ with map-stack as iterator.
\ : (find-xt) ( addr len wid -- addr len 0 | xt +/-1 -1 )
\     >r 2dup r> search-wordlist 
\     dup if
\       >r nip nip r> -1 
\     then 
\ ;
\ 
\ : find-xt
\    ['] (find-xt) 'ORDER map-stack
\    0= if 2drop 0 then 
\ ;