828541ed023ff33474299be09efe3646b2461030
5 "Usage: makeindex xhtmldir xmldir
6 where xhtmldir contains a directory full of OpenGL .xml XHTML man pages -AND-
7 where xmldir contains a directory full of OpenGL .xml source XML man pages
9 probably want to redirect output into a file like
10 ./makeindex.pl . .. > ./index.html
17 <link rel="stylesheet" type="text/css" href="opengl-man.css" />
18 <title>OpenGL Documentation</title>
22 <center><h1>OpenGL 3.3 Reference Pages</h1></center>
35 sub TableElementForFilename
{
38 my $strippedname = $name;
39 $strippedname =~ s/\.xml//;
41 print '<tr><td><a target="pagedisp" href="' , $name , '">';
42 print "$strippedname";
43 print "</a></td></tr>\n";
48 print "<a name=\"$letter\"></a><br/><br/>\n";
49 print '<table width="200" class="sample">';
51 print "$letter</th>\n";
56 print '<tr><td align="right"><a href="#top">Top</a></td></tr>';
57 print "\n</table>\n\n";
72 # grab list of generated XHTML files
73 opendir(DIR
,$ARGV[0]) or die "couldn't open directory";
75 @files = readdir(DIR
);
89 #pre-create list of all true entrypoint names
95 $parentName = $ARGV[1] . '/' . $_;
96 if (open(PARENT
, $parentName))
99 @funcs = grep(/<funcdef>/, @funcs);
103 $func =~ s/.*<function>//;
104 $func =~ s/<\/function>.*\n//;
106 push (@realEntrypoints, $func);
113 #pre-create list of page names
119 $parentName = $ARGV[1] . '/' . $_;
120 if (open(PARENT
, $parentName))
123 $entrypoint =~ s/\.xml//;
125 push (@pageNames, $entrypoint);
132 #sort the files into gl, glut, glu, and glX
138 # filter out entrypoint variations that don't have their own man pages
139 my $needIndexEntry = 0;
141 # continue only if parent page exists (e.g. glColor) OR
142 # different parent page exists with matching entrypoint (e.g. glEnd)
144 $entrypoint =~ s/\.xml//;
148 if ($_ eq $entrypoint)
150 # it has its own man page
155 if ($needIndexEntry == 0)
157 foreach (@realEntrypoints)
159 if ($_ eq $entrypoint)
161 # it's a real entrypoint, but make sure not a variation
166 my $alteredEntrypoint = $entrypoint;
167 $alteredEntrypoint =~ s/$_//;
169 if (!($alteredEntrypoint eq $entrypoint))
201 #output the table of contents
214 $firstletter = substr($name, 0, 1);
215 if ($firstletter ne $currentletter)
217 push (@toc, $firstletter);
218 $currentletter = $firstletter;
221 if ($#glu > 0) { push (@toc, "glu"); }
222 if ($#glut > 0) { push (@toc, "glut"); }
223 if ($#glX > 0) { push (@toc, "glX"); }
228 print '<div id="container">';
231 print '<b><a href="#';
233 print '" style="text-decoration:none"> ';
235 print " </a></b> ";
237 print "</div>\n\n\n";
251 $firstletter = substr($name, 0, 1);
252 if ($firstletter ne $currentletter)
258 BeginTable
($firstletter);
260 $currentletter = $firstletter;
262 TableElementForFilename
($_);
275 TableElementForFilename
($_);
285 TableElementForFilename
($_);
295 TableElementForFilename
($_);