%OP%PL36
%OP%PS3
%OP%HE@T@
%OP%FO@P@
%OP%DEIndexer.doc
%CO:A,12,72%%H7%start of page 3%H7%
%H1%%H2%Indexer.doc%H1%%H2% R.Boam (2891) 2nd September 1990
     based on an idea by the Danish Z-88 Group ("EPROM" April 1990)
     Because it is intended to serve both as an explanation of 
Indexer.bas and as a sample text on which the program can be run this 
document has a somewhat odd appearance [%H2%and it begins on pg3 -see 
%H2%Options page%H2%] and if you wish to print it out it would be advisable to 
do a <>PHR on it to remove Printer Highlight 7 and reset the Options 
Page settings for Page length, Top, Bottom, Header and Footer text to 
their default values. These have been set to silly values in order to 
demonstrate what the program can cope with. {I hope it is not too 
unreadable as a result.} The Program can: 
     a)working out the number of lines per normal page by reading the 
Options Page settings
     b)allow for unconditional page breaks and conditional page breaks 
whether these are implemented or not
     c)references which start on one line and carry over to the next 
whether the next is on a new page or not (if it is, the reference is 
indexed to the page on which it starts.
     d)the program can also cope with errors in inserting the pairs of 
highlights in as much as it is not necessary to re-index the whole 
%H7%end of page 3%H7%
%H7%start of page 4%H7%
document if an error is detected, but only to restart from the 
beginning of the page on which the error occured. Similarly, a document 
can be indexed in a number of separate chapters rather than all in one 
go.
     %H1%PROCEDURE%H1%
          a) write the text and bracket the words or phrases to be 
indexed with a printer highlight which is not going to be used in 
printing. This can either be done at the time of writing or using <>BRP 
or <>BSE as aids. Only one reference per page will be made in the index 
%P2%
%H7%cond pg break no effect%H7% 
if two or more examples of the same word appear on the page so only one 
needs to be bracketed. The highlight can be deleted after indexing and 
before printing using <>PHR after marking the entire text with <>Z or 
the Printer Editor can be set to ignore it. The indexer.bas program 
sets Printer Highlight 7 as the default value, but this can be changed 
if so desired.
                                                            %H7%hard page 
%P0%
break4-5%H7%%H7%start of page 5%H7%

     b) Enter Basic and LOAD & RUN or CHAIN "Indexer.bas"
     c) you will firsP be asked wich highlight has been used for 
indexing if this is 7 press enter, otherwise <DELETE> the 7 and type 
the right number and press <ENTER>. If you prefer a different default 
value change line 80.
     d) next you will be asked for the name of the file you wish to 
have indexed.
     e) the program will suggest that this name with the extension 
".idx" would be appropriate as the file to write the index in: e.g. 
"indexer.idx" for the index to "indexer.doc". If you wish to use a 
different name delete this and type in your own choice otherwise just 
press <ENTER>.
     f) finally you will be asked for the length of the longest 
reference which is to be indexed and 24 characters will be suggested. 
This is to help in laying out the index in two columns the first the 
words the secone the page numbers and to prevent the program ploughing 
on regardless if you have put an opening highlight but forgotten to put 
in the closing one to that reference. Do not set this to an absurdly 
high value: the program will not acept a value greater than 100 and 
%H7%end of page 5%H7%
%H7%start of page 6%H7%
anything over about 50 will make the index difficult to read . Also if 
the program finds an opening highlight on one line and fails to find 
the closing one on the next it will give a "indexer highlight error" 
and stop running so there is no point entering a value greater than the 
length of 2 lines.
     g) the program will now run. Since it is a Basic doing an Asembler 
program job do not expect it to be fast. Actual speed will obviously 
depend on the length of the text and even more on the density of 
references in the text. The program does keep you informed as to which 
page it is on so running time - and whether to go and make another cup 
of coffee - can be estimated.

     What happens if you have put an opening highlight and not a 
closing one? As explained above, the program will stop as soon as it 
fails to find a closing highlight within the number of characters 
specified at the start or on the next line, whichever comes first. Load 
the index file as a plain text file and check if any rubbish has been 
entered - if it found what should have been an opening highlight when 
%H7%end 6 cond p b%H7%
%P9%
%H7%start of page 7%H7%
looking for the closing one it will have taken it as a closing one and 
its closing one as an opening one so in a very densely referenced text 
some erroneous entries will have been made. Delete the lines on which 
these occur using <>Y (not <>D) and save the index as a plain text 
file. Then load the document you have been indexing correct the 
error and find the beginning of the page on which the error occured - 
the program will have told you which page it stopped on so track back 
from there. Mark and delete (<>Z <>BD) all the text preceding this 
page. Call up the Options Page (<>O) and change the Start page to the 
number the page is in the document and save this file under a different 
name (the program uses a file called "temp" in the directory and device 
used by the index file but any other name will do. Now run the program 
giving the same highlight number, the new file number, the same index 
file name and the same longest reference number and the document will 
be correctly indexed. Finally delete the temporary file.

     To index a document in a number of chapters: Make sure that the 
options page settings are the same for each chapter and that the start 
pages of each are set to give the right order (i.e if chapter 1 ended 
on page 6 chapter 2 should start on page 7(or more). Use the same 
%H7%end of page 7%H7%
%H7%start of page 8%H7%
longest reference number for each chapter and give the same index file 
name for each run. Note you have to index chapter two after one and 
before three or you will have to sort the page references into their 
corrrect order by hand. Note also that since in order to make this and 
the correction facilities work if the program finds a file with the 
name given by you it tries to integrate the index into it so do not 
give the name of a file that already exists unless you intend this.

     What are the limitations of this program:
          1) do not include the symbol "|" in the phrase or word to be 
indexed. The program uses this as a delimiter between phrases and page 
references in the index (it can't use a space as then you could not 
index phrases and e.g. could index "John Smith" separate from "Fred 
Smith".
          2) the program organises the index accoring to the "size" of 
its entries in Basis. This means it puts all words beginning with 
capitals before those in lower case - "Zeberdee" before "aardvark". 
   The "|" can be removed by setting <>BRP to replace | with ^S and not 
asking for confirmation and the correct alphabetical order can be 
achieved by highlighting the whole index and doing <>BSO on cloumn A. 
%H7%end of page 8%H7%
%H7%start of page 9%H7%
DO NOT DO EITHER OF THESE THINGS IF YOU WISH TO INTEGRATE FURTHER 
DOCUMENT REFERENCES INTO THE INDEX.
         %H2%%H1%3) The program cannot cope if you have put text in columns 
%H2%%H1%other than A

     Any comments on this program, critical or complimentary but 
particularly regarding any improvements which could be made would be 
greatly appreciated. Write to me at: 

The Old Post Office, 
Rusness, 
Sanday, 
Orkney,
KW17 2BP.

lots of refs on one page but only two entries - upper & lower case 
"A"s:
     I hope %H7%a%H7%t some point to rewrite it in %H7%A%H7%ssembler to speed it up %H7%a%H7%nd 
to include %H7%a%H7% f%H7%a%H7%cility for using the index to %H7%a%H7%ccess cross-references in 
%H7%a%H7% body of text %H7%a%H7%s this would be useful in using long files of notes 
th%H7%a%H7%t %H7%a%H7%re often re%H7%a%H7%d  %H7%a%H7%nd %H7%a%H7%dded to but not ch%H7%a%H7%nged - %H7%a%H7%ny %H7%a%H7%c%H7%a%H7%demics out 
there who be interested in such a prog?
     Anyway try running this version on this doc and see what you 
think.
                     Richard P.Boam
%H7%the end%H7%
%CO:B,12,60%%CO:C,12,48%%CO:D,12,36%%CO:E,12,24%%CO:F,12,12%