| |
|
| \ SEARCH 02sep94py |
\ SEARCH 02sep94py |
| |
|
| : search ( buf buflen text textlen -- restbuf restlen flag ) \ string |
: search ( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 flag ) \ string |
| 2over 2 pick - 1+ 3 pick c@ >r |
\ not very efficient; but if we want efficiency, we'll do it as primitive |
| BEGIN |
2>r 2dup |
| r@ scan dup |
begin |
| WHILE |
dup r@ >= |
| >r >r 2dup r@ -text |
while |
| 0= |
over 2r@ swap -text 0= if |
| IF |
2swap 2drop 2r> 2drop true exit |
| >r drop 2drop r> r> r> rot + 1- rdrop true |
endif |
| EXIT |
1 /string |
| THEN |
repeat |
| r> r> 1 /string |
2drop 2r> 2drop false ; |
| REPEAT |
|
| 2drop 2drop rdrop false ; |
|
| |
|
| \ SOURCE-ID SAVE-INPUT RESTORE-INPUT 11jun93jaw |
\ SOURCE-ID SAVE-INPUT RESTORE-INPUT 11jun93jaw |
| |
|