% This is the TeX source for what I passed out at the SLATEC meeting-Phil

\magnification=\magstep1\baselineskip=14pt\parskip=5 pt
\nopagenumbers
\centerline{\bf Indexing CGM files at PSC}
\bigskip

As you know, I originally wanted the index blocks to contain both byte
offsets and record and numbers to help indexing under VMS. However I
convinced myself that there was no hope of reaching a standard with
records, so I went with only byte offsets. This meant that our CGM
files had to become of fixed record length to enable random access (I'm
using 512 byte records).

I tried to make the format as close as possible to what we discussed,
the index blocks are encoded as escape elements (presently index -64). 
I understood from the standard that all escape elements were essentially
strings and I've encoded the index blocks that way.

The format of an index block is (presently)

\line{\hrulefill}
\line{No. of pages in this block\hfil 	(n, non-negative decimal integer)}

\leftline{then repeat n times}
\hbox to 4 true in{\hrulefill}
\line{page offset\hfil			(p, decimal integer)}
\line{string length	\hfil		(q, non-negative decimal integer)}
\leftline{one space character}
\line{page string		\hfil	(q characters)}
\hbox to 4 true in{\hrulefill}
\leftline{then two offsets}
\line{offset to next index block\hfil(decimal integer)}
\line{offset to previous index block\hfil(decimal integer)}

\line{\hrulefill}

e.g. the string ``2 530 10 first page 1520 11 second page 2048 0''
\bigskip

If either of the index offsets are 0 then this is the last (first)
index block.

All offsets are in bytes from the start of the present index block
command, and can be positive or negative.

Presently I lay down the first index block immediately after the begin
metafile and the last one immediately before the end metafile so the
file could be parsed in either direction. Index blocks are up to 512
bytes. I allow a /index qualifier (-I in UNIX) which merely produces a
table of contents and /pages selects sets of pages, e.g.,
/pages=(1,5,20\_35).


\bye
