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 / fileprep.icn < prev    next >
Text File  |  2000-07-29  |  2KB  |  60 lines

  1. ############################################################################
  2. #
  3. #    File:     fileprep.icn
  4. #
  5. #    Subject:  Program to prepare file information for IPL indexes
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     November 25, 1996
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program creates files used in the construction of indexes for the
  18. #  Icon program library.
  19. #
  20. ############################################################################
  21.  
  22. procedure main()
  23.    local files, file, input, line
  24.  
  25.    files := open("ls [a-z]*.icn", "p")
  26.  
  27.    while file := read(files) do {
  28.       if *file > 13 then write(&errout,"*** file name too long: ", file)
  29.       input := open(file)
  30.       every 1 to 4 do read(input)        # skip to subject line
  31.       line := read(input) | {
  32.          write(&errout, "*** no subject in ", file)
  33.          next
  34.          }
  35.       line ? {
  36.          if tab(find("Subject:  Program ") + 18) |
  37.             tab(find("Subject:  Procedures") + 21) |
  38.             tab(find("Subject:  Procedure ") + 20) |
  39.             tab(find("Subject:  Procedure ") + 20) |
  40.             tab(find("Subject:  Definitions ") + 22) |
  41.             tab(find("Subject:  Declarations ") + 23) |
  42.             tab(find("Subject:  Declaration ") + 22) |
  43.             tab(find("Subject:  Link declarations ") + 28) |
  44.             tab(find("Subject:  Link declaration ") + 27) |
  45.             tab(find("Subject:  Record declarations ") + 30) |
  46.             tab(find("Subject:  Record declaration ") + 29) then
  47.                {
  48.                   =("for " | "to ")            # optional in some cases
  49.                   write(file ? tab(find(".icn")), ": ", tab(0))
  50.                   }
  51.             else {
  52.                write(&errout, "*** bad subject line in ", file)
  53.                write(&errout, line)
  54.                }
  55.             }
  56.          close(input)
  57.       }
  58.  
  59. end
  60.