home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / procprep.icn < prev    next >
Text File  |  2000-07-29  |  2KB  |  64 lines

  1. ############################################################################
  2. #
  3. #    File:     procprep.icn
  4. #
  5. #    Subject:  Program to produce input to index for procedure comments
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 22, 1996
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program is used to produce the data needed to index the "#:"
  18. #  comments on procedure declarations that is needed to produces a
  19. #  permuted index to procedures.
  20. #
  21. ############################################################################
  22.  
  23. procedure main()
  24.    local files, file, input, line, prefix
  25.  
  26.    files := open("ls [a-z]*.icn", "p")
  27.  
  28.    while file := read(files) do {
  29.       if *file > 13 then write(&errout,"*** file name too long: ", file)
  30.       prefix := file[1:-4]
  31.       input := open(file)
  32.       every 1 to 4 do read(input)        # skip to subject line
  33.       line := read(input) | {
  34.          write(&errout, "*** no subject in ", file)
  35.          next
  36.          }
  37.       line ? {
  38.          if tab(find("Subject:  Procedures") + 21) |
  39.             tab(find("Subject:  Declarations ") + 23) |
  40.             tab(find("Subject:  Declaration ") + 22) |
  41.             tab(find("Subject:  Procedure ") + 20) then {
  42.                =("for " | "to ")
  43.                }
  44.           else {
  45.              write(&errout, "*** bad subject line in ", file)
  46.              close(input)
  47.              next
  48.              }
  49.          }
  50.       
  51.       while line := read(input) do
  52.          line ? {
  53.             if ="procedure" then {
  54.                tab(many(' \t'))
  55.                write(prefix, ":", tab(upto('(')), ": ", (tab(find("#: ") + 3),
  56.                   tab(0)))
  57.                }
  58.          }
  59.                
  60.       close(input)
  61.       }
  62.  
  63. end
  64.