(file) Return to PegasusDocTOC.awk CVS log (file) (dir) Up to [Pegasus] / pegasus / doc / DevManual

  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           print "<p>&nbsp;</p>"
 75           print "<p><b><font size=\"5\">Contents</font></b></p>"
 76           print "<TABLE>"
 77           
 78           # The array contains Filename, lvl, section name
 79           #<TR><TD VALIGN=TOP>
 80           # <IMG ALT="o" BORDER=0 SRC=icon1.gif><A NAME="Introduction"></A>
 81           # <A HREF=Introduction.html><B>Introduction</B></A></TD><TD><BR>
 82           # </TD></TR>
 83           
 84           # Print an output for each line that represents the TOC HTML for that line
 85 karl  1.1   for (x = 0; x <= count; x++)
 86             	{
 87             	print
 88             	print "<!--Diagnostic " x " " lvl[x] " " nme[x] "-->"
 89             	if (lvl[x] != 0){
 90             		ft = "<FONT SIZE= \"-"lvl[x] "\"> "
 91             		nft = "</FONT>"
 92             		}
 93             	else {
 94             		ft = ""
 95             		nft = ""
 96             		}
 97             	print "<TR><TD VALIGN=TOP>"
 98             	print "<IMG ALT=""o"" BORDER=0 SRC=icon1.gif>" ist(lvl[x])" <A NAME=" nme[x] "></A>"
 99             	print "<A HREF=" nme[x] ".html><B>"  ft flnme[x] nft " </B></A></TD><TD><BR>"
100             	print "</TD></TR>"
101             	print	
102             	}
103              
104           
105           # Print the closing section
106 karl  1.1 
107           print "</table>"
108           print "<UL>"
109           print "<LI><I><A HREF=\"index.html\">Alphabetic index</A></I>"
110           #print "<LI><I><A HREF=\"toc.html\">Alphabetic index</A></I>"
111           print "<LI><I><A HREF=\"HIER.html\">Hierarchy of classes</A></I>"
112           print "</UL>"
113           print "</body>"
114           print "</html>"
115           }
116           #
117           # functions
118           #
119           # Compress the $0 string, taking out all spaces from the pos defined
120           # returns the result With quotes around it.
121           function compressstring(pos){ 
122           	out = ""
123           	for (i = pos; i <= NF; i++)
124           		out = out $i
125           	return out
126           }
127 karl  1.1 # Simply duplicate the remainder of the $0 string and return it
128           function Svstr(pos){
129           	out = ""
130           	for (i = pos; i <= NF; i++)
131           		out = out " " $i
132           	return out
133           }
134           # create an indent string with length corresponding to the
135           #indent count.  0 = zero length, 1, 3 char, etc.
136           # uses the &nbsp; to indent for the moment
137           function ist (indent){
138           	isstring = ""
139           	if (indent == 0)
140           		return ""
141           	for (i=1; i <= indent; i++)
142           		isstring = isstring "&nbsp; &nbsp;"
143           	return isstring
144           }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2