a81b73cb4123d5d548bfcc8679e4aada8b7a4f39
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="../../mancommon/opengl-man.css" />
18 <title>OpenGL Shading Language Reference Pages</title>
22 <center><h1>OpenGL Shading Language Reference Pages</h1></center>
32 <small>OpenGL Shading Language (GLSL) Reference Pages Copyright © 2011 Khronos Group, Inc.</small>
40 sub TableElementForFilename
{
43 my $strippedname = $name;
44 $strippedname =~ s/\.xml//;
46 print '<tr><td><a target="pagedisp" href="' , $name , '">';
47 print "$strippedname";
48 print "</a></td></tr>\n";
53 print "<a name=\"$letter\"></a><br/><br/>\n";
54 print '<table width="200" class="sample">';
56 print "$letter</th>\n";
61 print '<tr><td align="right"><a href="#top">Top</a></td></tr>';
62 print "\n</table>\n\n";
77 # grab list of generated XHTML files
78 opendir(DIR
,$ARGV[0]) or die "couldn't open directory";
80 @files = readdir(DIR
);
82 @files = sort {uc($a) cmp uc($b)} @files;
92 #pre-create list of all true entrypoint names
98 $parentName = $ARGV[1] . '/' . $_;
99 if (open(PARENT
, $parentName))
102 @funcs = grep(/<funcdef>/, @funcs);
106 $func =~ s/.*<function>//;
107 $func =~ s/<\/function>.*\n//;
109 push (@realEntrypoints, $func);
116 #pre-create list of page names
122 $parentName = $ARGV[1] . '/' . $_;
123 if (open(PARENT
, $parentName))
126 $entrypoint =~ s/\.xml//;
128 push (@pageNames, $entrypoint);
135 #sort the files into gl, glut, glu, and glX
141 # filter out entrypoint variations that don't have their own man pages
142 my $needIndexEntry = 0;
144 # continue only if parent page exists (e.g. glColor) OR
145 # different parent page exists with matching entrypoint (e.g. glEnd)
147 $entrypoint =~ s/\.xml//;
151 if ($_ eq $entrypoint)
153 # it has its own man page
158 if ($needIndexEntry == 0)
160 foreach (@realEntrypoints)
162 if ($_ eq $entrypoint)
164 # it's a real entrypoint, but make sure not a variation
169 my $alteredEntrypoint = $entrypoint;
170 $alteredEntrypoint =~ s/$_//;
172 if (!($alteredEntrypoint eq $entrypoint))
181 #if ($needIndexEntry)
182 if (substr($_, 0, 3) eq "gl_")
184 push (@builtins, $_);
194 #output the table of contents
206 $firstletter = uc(substr($name, 0, 1));
207 if ($firstletter ne $currentletter)
209 push (@toc, $firstletter);
210 $currentletter = $firstletter;
217 print '<div id="container">';
220 print '<b><a href="#';
222 print '" style="text-decoration:none"> ';
224 print " </a></b> ";
228 print '<br/><b><a href="#Built-in Variables" style="text-decoration:none">Built-in Variables</a></b>';
230 print "</div>\n\n\n";
243 $firstletter = uc(substr($name, 0, 1));
244 if ($firstletter ne $currentletter)
250 BeginTable
($firstletter);
252 $currentletter = $firstletter;
254 TableElementForFilename
($_);
264 BeginTable
("Built-in Variables");
267 TableElementForFilename
($_);