program for NB-users (55)

Willard McCarty (MCCARTY@VM.EPAS.UTORONTO.CA)
Tue, 28 Mar 89 20:44:17 EST


Humanist Mailing List, Vol. 2, No. 773. Tuesday, 28 Mar 1989.

Date: Tue, 28 Mar 89 16:53:38 CST
From: Richard Goerwitz <goer@sophist.uchicago.edu>
Subject: labels in Nota Bene

Often when I write long papers using Nota Bene, revisions leave many
stranded labels and references to labels. I wrote a small program that
outputs a list of stranded labels (labels without any references to
them) and stranded references (references pointing to a label that doesn't
exist). The program is written in Icon.

Since e-mail doesn't permit me to send 8-bit codes, you'll need to
change every instance of % into a right-hand European quotation mark,
and every instance of @ ("at" sign) into a left-hand European quotation
mark. Cut the junk off up to the dotted line. The program does about
100k of text per minute on an old 8088 PC compatible.

------------------------------------------------------------------------
procedure main()

lbtbl := table()
while line := !&input do {
line ? {
while tab(find("%LB")+3) do {
label := map(tab(find("@")))
/lbtbl[label] := set()
insert(lbtbl[label],"lb")
}
}
line ? {
while value := (tab(find("%RE")+1), ="RE" || tab(any('FCP'))) do {
label := map(tab(find("@")))
/lbtbl[label] := set()
insert(lbtbl[label],map(value))
}
}
}
lblst := sort(lbtbl,3)
every i := 1 to *lblst by 2 do {
("lb" == !lblst[i+1], match("re",!lblst[i+1])) & next
writes(lblst[i]," ")
every writes(!lblst[i+1]," ")
write("\n")
}
write("execution time = ", &time / 1000)

end