home *** CD-ROM | disk | FTP | other *** search
- \\ NEWHYPER.SEQ Convert HYPER.NDX file to TARGET.NDX for debug/browsing
- ─────────────────────────────────────────────────────────────────────────────
- $Header:$
- ─────────────────────────────────────────────────────────────────────────────
- This program assumes a TARGET.FLS file exists, generated by TCOM,
- and that HYPER.NDX exists, generated by INDEX.COM
- It copies HYPER.NDX to TARGET.NDX while changing the file name references
- to pointers into TARGET.FLS
-
- ─────────────────────────────────────────────────────────────────────────────
- $Log:$
- ─────────────────────────────────────────────────────────────────────────────
- {
- anew convndxwords
- decimal
-
- 300 constant fblen
- create filesbuf fblen allot \ Here we put a copy of TARGET.FLS
- create namepointers 40 allot \ List of pointers into filesbuf,
- \ pointing to starts of filenames
-
- : ?serror ( f a c -- ) [ editor ] ?softerror ; \ show error in a box
-
- : lookup ( a c -- a' c' ) \ look up the file name in the filenames list
- 2dup
- 1 /string \ skip over the 249 character
- filesbuf fblen search \ look for name in files list
- if
- 0 38 do namepointers i + @ \ scan for name pointer
- over < if drop i leave then
- -2 +loop
- namepointers + @ \ this is the pointer into the file
- 2 pick 1+ !
- else
- drop
- then
- ;
-
- : copyline ( -- ) \ copy every line into the new index
- lineread count
- dup
- 0<> if over c@ 249 ( ∙ ) =
- if \ convert filename line to a pointer into .FLS file
- lookup
- then
- tuck seqhandle+ hwrite
- - dup " Error writing TARGET.NDX" ?serror
- 0= \ flag for getting out of loop that repeats for each line
- else
- nip \ discard lineread address
- then
- ;
- \ check-ndx
-
- : open.hyper ( -- f )
- " HYPER.NDX" ">$ $hopen \ open HYPER.NDX
- dup " Cannot open HYPER.NDX" ?serror
- 0.0 seqhandle movepointer \ reset to beginning of file
- 0.0 filepointer 2!
- loadline off \ reset file offset
- ibreset
- 0 %!> screenchar
- ;
-
- 0 value tofilesbuf
- : >filesbuf ( c -- c a ) \ return a pointer to the files buffer, and update it
- tofilesbuf
- over +!> tofilesbuf ;
-
- : read.fls ( -- f ) \ read in the files file
- " TARGET.FLS" ">$ $hopen
- dup " Cannot read filenames file" ?serror
- 0.0 seqhandle movepointer \ reset to beginning of file
- 0.0 filepointer 2!
- loadline off \ reset file offset
- ibreset
- 0 %!> screenchar
- dup
- 0= if \ get file into buffer and index it
- filesbuf !> tofilesbuf
- filesbuf fblen erase
- namepointers 40 erase
- 0
- 40 2 do lineread count
- tuck >filesbuf swap cmove \ copy line to buffer
- + dup namepointers i + ! \ index filenames
- 2 +loop
- drop
- then
- seqhandle hclose drop
- ;
-
- : conv-hyper ( -- )
- defers boot
- ." Converting HYPER.NDX into TARGET.NDX format....."
- read.fls \ read the file list
- open.hyper \ open input index file
- or
- 0= if \ create new .NDX file
- " TARGET.NDX" ">$ seqhandle+ $>handle
- seqhandle+ hcreate " Couldn't Create TARGET.NDX" ?serror
- begin copyline 0= until \ copy every line
- then
- seqhandle+ hclose drop
- seqhandle hclose drop
- cr
- bye
- ;
- ' conv-hyper is boot
- ' noop is .hello
- ' noop is .curfile
-
- only forth also definitions
- save-exe newhyper
-
-