1 karl 1.1 #
2 # GAWK Program to extract all of the @name entities from
3 # the document and
4 #
5 BEGIN {
6 level = 0
7 count = 0
8 }
9 # Big limit here in that it is all not tied to the
10 # inside comments concept.
11 # Presumes one layer of includes only
12 { if (NF == 2 && $1 == "\/\/@Include:") {
13 incfile = $2
14 while ((getline < incfile) > 0)
15 {
16 if ($2 == "@name")
17 {
18 fil[count]= incfile
19 lvl[count] = level
20 nme[count] = compressstring(3)
21 flnme[count++] = Svstr(3)
22 karl 1.1 }
23 if (match ($1, "@name") > 0)
24 {
25 fil[count]= incfile
26 lvl[count] = level
27 nme[count] = compressstring(2)
28 flnme[count++] = Svstr(2)
29 }
30
31 if ($1 == "\/\/@{")
32 level++
33 if ($1 == "\/\/@}")
34 level--
35 }
36 close($2)
37 } else
38 {
39 if ($2 == "@name")
40 {
41 fil[count]= FILENAME
42 lvl[count] = level
43 karl 1.1 nme[count] = compressstring(3)
44 flnme[count++] = Svstr(3)
45 }
46 if (match ($1, "@name") > 0)
47 {
48 fil[count]= FILENAME
49 lvl[count] = level
50 nme[count] = compressstring(2)
51 flnme[count++] = Svstr(2)
52 }
53 if ($1 == "\/\/@{")
54 level++
55 if ($1 == "\/\/@}")
56 level--
57 }
58 }
59
60 END{
61 indent = 0
62 is = ""
63 lv = 0
64 karl 1.1 # Print the TOC Header
65 print "<html>"
66 print "<head>"
67 print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
68 print "<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\">"
69 print "<meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">"
70 print "<title>PegasusDocumentTOC</title>"
71 print "<base target=\"main\">"
72 print "</head>"
73 print "<body bgcolor=\"#FF9966\">"
|
74 karl 1.2 print "<p align=\"center\"><img border=\"0\" src=\"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 }
|