# # GAWK Program to extract all of the @name entities from # the document and create a table of contents page. # This file analyzes all of the files pointed to by the top # level file in the document structure. # BEGIN { level = 0 count = 0 } # Big limit here in that it is all not tied to the # inside comments concept. # Presumes one layer of includes only { if (NF == 2 && $1 == "\/\/@Include:") { incfile = $2 while ((getline < incfile) > 0) { if ($2 == "@name") { fil[count]= incfile lvl[count] = level nme[count] = compressstring(3) flnme[count++] = Svstr(3) } if (match ($1, "@name") > 0) { fil[count]= incfile lvl[count] = level nme[count] = compressstring(2) flnme[count++] = Svstr(2) } if ($1 == "\/\/@{") level++ if ($1 == "\/\/@}") level-- } close($2) } else { if ($2 == "@name") { fil[count]= FILENAME lvl[count] = level nme[count] = compressstring(3) flnme[count++] = Svstr(3) } if (match ($1, "@name") > 0) { fil[count]= FILENAME lvl[count] = level nme[count] = compressstring(2) flnme[count++] = Svstr(2) } if ($1 == "\/\/@{") level++ if ($1 == "\/\/@}") level-- } } END{ indent = 0 is = "" lv = 0 # Print the TOC Header print "" print "
" print "" print "" print "
Contents
" print "# # Introduction | # |
" print ist(lvl[x])"" " " print "" ft flnme[x] nft " | " print " |