1 karl 1.1 #
2 # GAWK Program to extract all of the @name entities from
|
3 karl 1.3.2.1 # the document and create a table of contents page.
4 # This file analyzes all of the files pointed to by the top
5 # level file in the document structure.
|
6 karl 1.1 #
7 BEGIN {
8 level = 0
9 count = 0
10 }
11 # Big limit here in that it is all not tied to the
12 # inside comments concept.
13 # Presumes one layer of includes only
14 { if (NF == 2 && $1 == "\/\/@Include:") {
15 incfile = $2
16 while ((getline < incfile) > 0)
17 {
18 if ($2 == "@name")
19 {
20 fil[count]= incfile
21 lvl[count] = level
22 nme[count] = compressstring(3)
23 flnme[count++] = Svstr(3)
24 }
25 if (match ($1, "@name") > 0)
26 {
27 karl 1.1 fil[count]= incfile
28 lvl[count] = level
29 nme[count] = compressstring(2)
30 flnme[count++] = Svstr(2)
31 }
32
33 if ($1 == "\/\/@{")
34 level++
35 if ($1 == "\/\/@}")
36 level--
37 }
38 close($2)
39 } else
40 {
41 if ($2 == "@name")
42 {
43 fil[count]= FILENAME
44 lvl[count] = level
45 nme[count] = compressstring(3)
46 flnme[count++] = Svstr(3)
47 }
48 karl 1.1 if (match ($1, "@name") > 0)
49 {
50 fil[count]= FILENAME
51 lvl[count] = level
52 nme[count] = compressstring(2)
53 flnme[count++] = Svstr(2)
54 }
55 if ($1 == "\/\/@{")
56 level++
57 if ($1 == "\/\/@}")
58 level--
59 }
60 }
61
62 END{
63 indent = 0
64 is = ""
65 lv = 0
66 # Print the TOC Header
67 print "<html>"
68 print "<head>"
69 karl 1.1 print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
70 print "<title>PegasusDocumentTOC</title>"
71 print "<base target=\"main\">"
72 print "</head>"
73 print "<body bgcolor=\"#FF9966\">"
|
74 karl 1.3.2.3 print "<p align=\"center\"><img border=\"0\" src=\"/pegasus/images/pegicon2.gif\" width=\"100\" height=\"100\"></p>"
|
75 karl 1.1 print "<p> </p>"
76 print "<p><b><font size=\"5\">Contents</font></b></p>"
77 print "<TABLE>"
78
79 # The array contains Filename, lvl, section name
80 #<TR><TD VALIGN=TOP>
81 # <IMG ALT="o" BORDER=0 SRC=icon1.gif><A NAME="Introduction"></A>
82 # <A HREF=Introduction.html><B>Introduction</B></A></TD><TD><BR>
83 # </TD></TR>
84
85 # Print an output for each line that represents the TOC HTML for that line
86 for (x = 0; x <= count; x++)
87 {
88 print
89 print "<!--Diagnostic " x " " lvl[x] " " nme[x] "-->"
90 if (lvl[x] != 0){
|
91 karl 1.2 ft = "<FONT SIZE=\"-"lvl[x] "\"> "
|
92 karl 1.1 nft = "</FONT>"
93 }
94 else {
95 ft = ""
96 nft = ""
97 }
98 print "<TR><TD VALIGN=TOP>"
|
99 karl 1.2 print ist(lvl[x])"<IMG ALT=\"o\" BORDER=0 SRC=icon1.gif>" " <A NAME=" nme[x] "></A>"
100 print "<A HREF=" nme[x] ".html><B>" ft flnme[x] nft "</B></A></TD><TD><BR>"
|
101 karl 1.1 print "</TD></TR>"
102 print
103 }
104
105
106 # Print the closing section
107
108 print "</table>"
109 print "<UL>"
110 print "<LI><I><A HREF=\"index.html\">Alphabetic index</A></I>"
111 #print "<LI><I><A HREF=\"toc.html\">Alphabetic index</A></I>"
112 print "<LI><I><A HREF=\"HIER.html\">Hierarchy of classes</A></I>"
113 print "</UL>"
114 print "</body>"
115 print "</html>"
116 }
117 #
118 # functions
119 #
120 # Compress the $0 string, taking out all spaces from the pos defined
121 # returns the result With quotes around it.
122 karl 1.1 function compressstring(pos){
123 out = ""
124 for (i = pos; i <= NF; i++)
125 out = out $i
126 return out
127 }
128 # Simply duplicate the remainder of the $0 string and return it
129 function Svstr(pos){
130 out = ""
131 for (i = pos; i <= NF; i++)
132 out = out " " $i
133 return out
134 }
135 # create an indent string with length corresponding to the
136 #indent count. 0 = zero length, 1, 3 char, etc.
137 # uses the to indent for the moment
138 function ist (indent){
139 isstring = ""
140 if (indent == 0)
141 return ""
142 for (i=1; i <= indent; i++)
143 karl 1.1 isstring = isstring " "
144 return isstring
145 }
|