diff options
Diffstat (limited to 'ipl/progs/roffcmds.icn')
-rw-r--r-- | ipl/progs/roffcmds.icn | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ipl/progs/roffcmds.icn b/ipl/progs/roffcmds.icn new file mode 100644 index 0000000..bfeb153 --- /dev/null +++ b/ipl/progs/roffcmds.icn @@ -0,0 +1,59 @@ +############################################################################ +# +# File: roffcmds.icn +# +# Subject: Program to list roff commands and macros +# +# Author: Ralph E. Griswold +# +# Date: June 10, 1988 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# This progam processes standard input and writes a tabulation of +# nroff/troff commands and defined strings to standard output. +# +# Limitations: +# +# This program only recognizes commands that appear at the beginning of +# lines and does not attempt to unravel conditional constructions. +# Similarly, defined strings buried in disguised form in definitions are +# not recognized. +# +# Reference: +# +# Nroff/Troff User's Manual, Joseph F. Ossana, Bell Laboratories, +# Murray Hill, New Jersey. October 11, 1976. +# +############################################################################ + +procedure main() + local line, con, mac, y, nonpuncs, i, inname, infile, outname, outfile + + nonpuncs := ~'. \t\\' + + con := table(0) + mac := table(0) + while line := read() do { + line ? if tab(any('.\'')) then + con[tab(any(nonpuncs)) || (tab(upto(' ') | 0))] +:= 1 + line ? while tab((i := find("\\")) + 1) do { + case move(1) of { + "(": move(2) + "*" | "f" | "n": if ="(" then move(2) else move(1) + } + mac[&subject[i:&pos]] +:= 1 + } + } + con := sort(con,3) + write(,"Commands:\n") + while write(,get(con),"\t",get(con)) + mac := sort(mac,3) + write(,"\nControls:\n") + while write(,get(mac),"\t",get(mac)) + +end |