1c29eab7cb90b09629c6155461590e8bccc4c3e6
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 <title>OpenGL Documentation</title>
18 <style type="text/css">
25 font-family: Arial, Lucida, sans-serif;
41 border-collapse: separate;
42 background-color: #F0F0F0;
59 <h1>OpenGL 2.1 Reference Pages</h1>
72 sub TableElementForFilename
{
75 my $strippedname = $name;
76 $strippedname =~ s/\.xml//;
78 print '<tr><td><a target="pagedisp" href="' , $name , '">';
79 print "$strippedname";
80 print "</a></td></tr>\n";
85 print "<a name=\"$letter\"></a><br/><br/>\n";
86 print '<table width="200" align="center" class="sample">';
88 print "$letter</th>\n";
93 print '<tr><td><center><a href="#top">Top</a></center></td></tr>';
94 print "\n</table>\n\n";
109 # grab list of generated XHTML files
110 opendir(DIR
,$ARGV[0]) or die "couldn't open directory";
112 @files = readdir(DIR
);
114 @files = sort @files;
126 #pre-create list of all true entrypoint names
132 $parentName = $ARGV[1] . '/' . $_;
133 if (open(PARENT
, $parentName))
136 @funcs = grep(/<funcdef>/, @funcs);
140 $func =~ s/.*<function>//;
141 $func =~ s/<\/function>.*\n//;
143 push (@realEntrypoints, $func);
150 #pre-create list of page names
156 $parentName = $ARGV[1] . '/' . $_;
157 if (open(PARENT
, $parentName))
160 $entrypoint =~ s/\.xml//;
162 push (@pageNames, $entrypoint);
169 #sort the files into gl, glut, glu, and glX
175 # filter out entrypoint variations that don't have their own man pages
176 my $needIndexEntry = 0;
178 # continue only if parent page exists (e.g. glColor) OR
179 # different parent page exists with matching entrypoint (e.g. glEnd)
181 $entrypoint =~ s/\.xml//;
185 if ($_ eq $entrypoint)
187 # it has its own man page
192 if ($needIndexEntry == 0)
194 foreach (@realEntrypoints)
196 if ($_ eq $entrypoint)
198 # it's a real entrypoint, but make sure not a variation
203 my $alteredEntrypoint = $entrypoint;
204 $alteredEntrypoint =~ s/$_//;
206 if (!($alteredEntrypoint eq $entrypoint))
238 #output the table of contents
251 $firstletter = substr($name, 0, 1);
252 if ($firstletter ne $currentletter)
254 push (@toc, $firstletter);
255 $currentletter = $firstletter;
258 if ($#glu > 0) { push (@toc, "glu"); }
259 if ($#glut > 0) { push (@toc, "glut"); }
260 if ($#glX > 0) { push (@toc, "glX"); }
264 print '<div id="container">';
267 print '<b><a href="#';
269 print '" style="text-decoration:none"> ';
271 print " </a></b> ";
273 print "</div>\n\n\n";
286 $firstletter = substr($name, 0, 1);
287 if ($firstletter ne $currentletter)
293 BeginTable
($firstletter);
295 $currentletter = $firstletter;
297 TableElementForFilename
($_);
310 TableElementForFilename
($_);
320 TableElementForFilename
($_);
330 TableElementForFilename
($_);