############################################################################ # # File: iaprep.icn # # Subject: Program to prepare Analyst contents for permuted index # # Author: Ralph E. Griswold # # Date: November 30, 1997 # ############################################################################ # Takes iatoc.txt from the Icon FTP area. Writes file for iplpdx to # standard output. # ############################################################################ procedure main() local head, line, input input := open("/cs/www/icon/ftp/doc/iatoc.txt") | # One hopes ... stop("*** cannot open iatoc.txt") while line := read(input) do { line ? { if find("What's" | "Subscription" | "Thanks") then next else if ="Issue " then head := tab(upto(',')) || " " else if ="\t" then write(head, plusmap(tab(find(" ...")))) else write(&errout, "bad line: ", line) } } end # Some blanks are mapped to +s here to avoid bad breaks in ptx -- # and then mapped back in the final step. procedure plusmap(line) local result line ? { if result := tab(find(" --" | " 8")) then { move(1) return result || "+" || tab(0) } else return tab(0) } end