[net.lang.lisp] Script to make index for Franz Lisp manual

stephent@shark.UUCP (Steve Tyler) (08/12/85)

Appended is a script which will generate an index to the Franz Lisp Manual
by Foderaro and Sklower.  On our VAX the manual (June 83 version) comes with
a helpindex but this index only gives section numbers.

The manual's page numbering in section 4 is off by one so those pages have
to be renumbered in the manual by hand.  The index contains all functions in
the helpindex plus a few extra.  To print it I filter it through "pr -2"
("pr -3" truncates some lines).

The regular expression in the awk script selects lines that look like:
"(xxx...)" or
"(yyy..." where y is not a right-paren.

===============================================================================
#! /bin/sh
#
# makelispindex
#
# usage: makelispindex > lispindex
#
# Prints each line that matches the regular expression below followed by
# the computed section and page number.
# The index is sorted and uniq'd.
# Assumes 66 lines per page.
# Example output:
#	changes 13-4
#	top-level) 13-2
#	trace 11-1
#	traceargs 11-5
#	tracedump) 11-5
#	untrace 11-5
#	valueof 13-3
#

chaplist='0 1 10 11 12 13 14 15 16 2 3 4 5 6 61 7 8 9 b c'

for chap in $chaplist
do
col < /usr/lib/lisp/manual/ch$chap.r | \
awk '
BEGIN {
	chapter = '$chap'
	page = 1
	line = 1
}
/^\(.*\)[ 	]*$|^\([^\)]+$/ {
	split($1, nam, "(")
	print  nam[2] " " chapter "-" page
}
{
	if (line >= 66) {
		line = 1
		page = page + 1
	}
	else {
		line = line + 1
	}
}
' >> /tmp/,makelispindex$$
done

sort < /tmp/,makelispindex$$ | uniq
rm /tmp/,makelispindex$$