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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2