summaryrefslogtreecommitdiff
path: root/ipl/progs/fileprep.icn
blob: 7e4f835fa5112dc193d14e360bf45bfd6b098db8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
############################################################################
#
#	File:     fileprep.icn
#
#	Subject:  Program to prepare file information for IPL indexes
#
#	Author:   Ralph E. Griswold
#
#	Date:     November 25, 1996
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  This program creates files used in the construction of indexes for the
#  Icon program library.
#
############################################################################

procedure main()
   local files, file, input, line

   files := open("ls [a-z]*.icn", "p")

   while file := read(files) do {
      if *file > 13 then write(&errout,"*** file name too long: ", file)
      input := open(file)
      every 1 to 4 do read(input)		# skip to subject line
      line := read(input) | {
         write(&errout, "*** no subject in ", file)
         next
         }
      line ? {
         if tab(find("Subject:  Program ") + 18) |
            tab(find("Subject:  Procedures") + 21) |
            tab(find("Subject:  Procedure ") + 20) |
            tab(find("Subject:  Procedure ") + 20) |
            tab(find("Subject:  Definitions ") + 22) |
            tab(find("Subject:  Declarations ") + 23) |
            tab(find("Subject:  Declaration ") + 22) |
            tab(find("Subject:  Link declarations ") + 28) |
            tab(find("Subject:  Link declaration ") + 27) |
            tab(find("Subject:  Record declarations ") + 30) |
            tab(find("Subject:  Record declaration ") + 29) then
               {
                  =("for " | "to ")			# optional in some cases
                  write(file ? tab(find(".icn")), ": ", tab(0))
                  }
            else {
               write(&errout, "*** bad subject line in ", file)
               write(&errout, line)
               }
            }
         close(input)
      }

end