home *** CD-ROM | disk | FTP | other *** search
- \ Recreates the index file for the WHATIS database.
- \ Use this if you modify WHATIS.DOC .
- \
- \ make-index whatis.doc Generate the new index
- \ write-index whatis.ind Write it to disk
-
- decimal
- only forth hidden also forth definitions
-
- variable last-char
- : dropline ( -- )
- delimiter @ newline <>
- if
- pad newline ifd @ getcword drop
- delimiter off
- then
- ;
- : set-index ( position char -- )
- dup last-char @ <> ( position char flag )
- if dup last-char !
- 32 - index swap na+ !
- else 2drop
- then
- ;
- : 1line ( -- end? )
- ifd @ ftell ( pos )
- pad ifd @ getword ( pos str )
- delimiter @ eof =
- if 2drop true
- else 1+ c@ set-index
- dropline dropline
- false
- then
- ;
- : make-index ( -- ) \ filename
- reading
- index /index th ff fill
- last-char off
- begin 1line until
- ifd @ close
- ;
- : write-index ( -- ) \ filename
- writing
- index /index ofd @ fputs
- ofd @ close
- ;
- only forth also definitions
-