home *** CD-ROM | disk | FTP | other *** search
- \ WINDEX.SEQ Make an index of Forth words. by Tom Zimmer
-
- .comment:
-
- Displays a more or less alphabetized list of Forth words showing
- vocabulary and file where it was defined.
-
- Just type ALLWORDS <enter> to display an index of all forth words.
-
- Load PRINT.SEQ and use PFILE <name>, then print the file to disk with
- PRINT ALLWORDS.
-
- comment;
-
-
- VARIABLE WADDR
- 0 value FIRSTLETTER
-
- : >wviewfile ( cfa --- offset a1 )
- >r files_set off> maxcfa off> maxname
- begin 1file dup
- while r@ over name> u>
- if dup name> maxcfa u>
- if dup =: maxname
- dup name> =: maxcfa
- then
- then drop
- repeat drop r> >view y@
- maxname name>pad ;
-
- : W.ANAME ( NFA --- )
- DUP 1+ YC@ 127 AND FIRSTLETTER =
- IF CR DUP .ID TAB
- WADDR @ .ID TAB
- NAME> >wviewfile nip count type
- ELSE DROP THEN ;
-
- : .AVOCWORDS ( A1 --- ) \ A1 = BODY of vocabulary
- DUP HERE 1000 + #THREADS 2* CMOVE
- BODY> >NAME WADDR !
- BEGIN HERE 1000 + #THREADS LARGEST DUP
- ?KEYPAUSE
- WHILE DUP L>NAME W.ANAME Y@ SWAP !
- REPEAT 2DROP ;
-
- : <awords> ( c1 --- )
- =: firstletter
- VOC-LINK @
- BEGIN DUP #THREADS 2* - .AVOCWORDS @ DUP 0=
- UNTIL DROP ;
-
- : ALLWORDS ( --- )
- 60 RMARGIN !
- 16 TABSIZE !
- ASCII a BL 1+
- DO CR CR ." Words starting with " I EMIT CR
- I <AWORDS>
- LOOP ;
-
-