home *** CD-ROM | disk | FTP | other *** search
- ############################################################################
- #
- # File: ipldoc.icn
- #
- # Subject: Program to collect library documentation
- #
- # Author: Ralph E. Griswold
- #
- # Date: November 27, 1992
- #
- ###########################################################################
- #
- # This program collects selected information from documentation headers
- # for Icon procedure files.
- #
- # If called with no arguments, it processes the files named in standard
- # input. E.g., in UNIX this might be:
- #
- # ls *.icn | ipldoc
- #
- # If called with an argument, that argument is taken to be a directory
- # name and all files named *.icn in that directory are processed.
- #
- ############################################################################
- #
- # Requires: UNIX if called with an argument.
- #
- ############################################################################
-
- procedure main(args)
- local procedures, bar1, bar2, file, program, line, dir, input, max
-
- procedures := table()
-
- bar1 := repl("=", 75)
- bar2 := repl("-", 75)
-
- if dir := \args[1] then
- input := open("ls " || dir || "/*.icn" , "p")
- else input := &input
-
- while file := read(input) do {
-
- program := open(file) | stop("*** cannot open program ", image(file))
-
- write(bar1, "\n")
-
- while line := read(program) | break do
- line ? {
- if tab(find("File:") + 6) then {
- tab(many(' \t'))
- write(file ,":")
- write()
- write(tab(0))
- break
- }
- }
- while line := read(program) | break do
- line ? {
- if ="##########" then break
- }
- while line := read(program) | break do
- line ? {
- if ="#" then {
- if ="##########" then {
- line := read(program) | break
- line ? {
- if pos(0) then break
- else if ="#" then {
- write(bar2)
- write(" ", tab(0))
- }
- }
- }
- else write(" ", tab(0))
- }
- else break
- }
- while line := read(program) | break do
- line ? {
- if ="procedure" then {
- tab(many(' \t'))
- if ="main(" then next
- procedures[tab(upto(')') + 1)] := file
- }
- }
- close(program)
- }
-
- write(bar1)
- write()
- write("Procedure List")
- write()
-
- max := 0
-
- every max <:= *!procedures | 45
- max +:= 2
-
- procedures := sort(procedures, 3)
-
- while write(left(get(procedures), max), get(procedures))
-
- end
-