5 # Add here the pages of the documentation generated by a @page doxygen macro
6 my @extra_files = qw(html/index.html html/pages.html html/modules.html html/annotated.html html/functions.html
7 html/functions_vars.html index.php
8 html/GRAS_tut.html html/tracing.html html/platform.html html/install.html html/bindings.html
9 html/options.html html/use.html html/pls.html html/FAQ.html);
12 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
13 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
14 tour_logs tour_timers tour_exceptions tour_simpledata tour_rpc tour_explicitwait
15 tour_message_recaping tour_staticstruct tour_pointers tour_dynar
16 tour_manualdatadef tour_exchangecb);
19 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
22 $debug{'parse'} = 0; # show how we parse the module tree
23 $debug{'input'} = 0; # display the resulting tree
24 $debug{'handle'}= 0; # Be verbose on the post-processing
25 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
29 ### Get the module definitions
32 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
36 last if /group__SimGrid__API.html/;
44 # $current->{'label'}="ROOT";
45 # push @{$top->{'down'}},$current;
46 # print "Push $current '".($current->{'label'})."' as child of $top '".($top->{'label'})."'\n" if $debug{'parse'};
48 $top->{'label'}="ROOT";
49 print "Create ROOT $top\n" if $debug{'parse'};
53 # Read the whole data to postprocess it a bit
58 $in =~ s/<ul>/\n<ul>\n/sg;
59 foreach $_ (split(/\n/,$in)) {
60 next unless length($_);
61 next if ($_ =~ m|^</li>$|);
62 print " Seen '$_'\n" if $debug{'parse'};
64 print "DOWN: $current '$current->{'label'}' -> " if $debug{'parse'};
65 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
66 print "$current '$current->{'label'}'\n" if $debug{'parse'};
70 $current = $current->{'up'};
71 print "UP to $current '$current->{'label'}'\n" if $debug{'parse'};
78 m|href="([^"]*)">([^<]*)</a>|; #"
81 $entry->{'file'} = $1;
82 $entry->{'label'} = $2;
83 $entry->{'up'} = $current;
84 push @{$current->{'down'}},$entry;
85 print "Push file:$1 label:'$2' as child of $current '$current->{'label'}'\n" if $debug{'parse'};
86 push @allfiles,"html/$1";
90 # Check each file for extra information (short name, extra childs)
94 if (defined($current->{'file'})) {
95 open IN, "html/$current->{'file'}";
97 if (/DOXYGEN_NAVBAR_LABEL/) {
98 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
99 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
100 $current->{'label'}=$1;
102 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
105 if (/DOXYGEN_NAVBAR_CHILD/) {
106 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
108 $entry->{'label'} = $1;
109 $entry->{'file'} = $2;
110 chomp($entry->{'file'});
111 $entry->{'up'} = $current;
112 push @{$current->{'down'}},$entry;
113 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
115 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
121 foreach my $entry (@{$current->{'down'}}) {
132 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
133 foreach my $entry (@{$current->{'down'}}) {
134 display($entry,$level+1);
138 display($top,0) if $debug{'input'};
141 ### Generate the navbar
144 # the root deserves some special handling
145 open IN,"html/modules.html" || die;
146 open OUT,">html/modules.new.html" || die;
148 while ($line = <IN>) {
149 last if $line =~ /<h1>SimGrid Modules</;
153 print OUT "<div class=\"tabs\">\n <ul class=\"tablist\">\n";
154 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
155 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
157 print OUT " </ul></div>\n";
165 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
167 # Operate the recursion
172 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
174 # we generate the tabs bottom up begining from where we are in the tree
175 # and display them top down, as it should in a file
177 my $found_div_tabs=0;
179 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
180 # print "handle $current->{'file'}, at level $level\n";
182 my $iterator = $current;
184 while ($lvl_it >= 0) {
185 my $father = $iterator->{'up'};
186 $tabs[$lvl_it] = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
187 foreach my $bro (@{$father->{'down'}}) {
188 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
190 $tabs[$lvl_it] .= " </ul></div>\n";
194 if (defined $current->{'down'}) { # there's some kid. Display them too
195 $tabs[$level+1] = "<div class=\"tabs2\">\n <ul class=\"tablist\">\n";
196 foreach my $kid (@{$current->{'down'}}) {
197 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
199 $tabs[$level+1] .= " </ul></div>\n";
203 open FROM,"html/$current->{'file'}" || die;
204 my $newname="html/$current->{'file'}";
205 $newname =~ s/.html/.handlepage.html/;
206 open TO,">$newname" || die;
207 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
210 # add "current" to the module API granfather page
211 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
212 # print "++Write $_";
213 $found_div_tabs=1 if m/div.*class="tabs"/;
215 last if ((m|</div>|)&&($found_div_tabs));
218 print TO "\n<!-- POST-PROCESSED TABS -->\n";
224 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
226 if ($current->{'file'} =~ m/^class/) {
233 if (m/POST-PROCESSED TABS/) {
235 last if (m/END OF POST-PROCESSED TABS/);
240 if (m/The documentation for/) {
249 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
253 foreach my $entry (@{$current->{'down'}}) {
254 handle_page($entry,$level+1);
259 ### Launch the modules navbar reworking
261 handle_page($top,-1);# skip roots (we have 2 roots) in level counting
264 ### Add the modules navbar reworking to the modules.html file
266 sub add_tabs_to_module_html {
267 my $found_div_tabs=0;
268 my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
269 foreach my $entry (@{$top->{'down'}}) {
270 $module_tabs .= " <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
272 $module_tabs .= " </ul></div>\n";
274 my $oldname = "html/modules.html";
275 open FROM,$oldname || die;
276 my $newname=$oldname;
277 $newname =~ s/.html/.handlepage.html/;
278 open TO,">$newname" || die;
280 $found_div_tabs=1 if m/div.*class="tabs"/;
282 last if ((m|</div>|)&&($found_div_tabs));
285 print TO "\n<!-- POST-PROCESSED TABS -->\n";
286 print TO $module_tabs;
287 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
294 rename($newname, $oldname) unless $debug{'rename'};
299 add_tabs_to_module_html;
302 ### Post-processsing common to all pages
304 map {push @allfiles,$_} @extra_files;
305 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
308 foreach my $file (@allfiles) {
309 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
311 open FROM,"$file" || die;
312 my $outfile = "$file";
313 $outfile =~ s/.(html|php)$/.new.$1/;
314 open TO,">$outfile" || die;
315 # print "POSTPROCESSING $file (tmp=$outfile)\n";
317 # Add the simgrid css, just in case
318 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
322 if($file =~ /^html\/index\..*/){
323 $_ =~ s/<li class="current">/<li>/g;
324 $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
326 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
328 if($file =~ /^html\/pages\..*/){
329 $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
333 if($file =~ /^html\/publis.*/){
334 $_ =~ s/<div class="header">/<div>/g;
335 $_ =~ s/<div class="headertitle">/<div>/g;
338 # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
339 if( $_ =~ /<div.*class="tabs">/){
342 if( $_ =~ /<\/div>/){
345 if( $_ =~ /<\/ul>/ && $tabs){
347 $tmp_buff .= ' <li><a href="use.html"><span>Using SimGrid</span></a></li>'."\n";
348 $tmp_buff .= ' <li><a href="http://gforge.inria.fr/projects/simgrid"><span>Forge</span></a></li>'."\n";
349 $tmp_buff .= ' <li><a href="http://simgrid.gforge.inria.fr/"><span>Website</span></a></li>'."\n";
350 $tmp_buff .= ' <li><a href="pages.html"><span>Documentation index</span></a></li>'."\n";
351 $tmp_buff .= ' <li><a href="FAQ.html"><span>FAQ</span></a></li>'."\n";
355 # Rework the navbar and add menu for use.html
356 # Fix the current "button" of buggy Doxygen tabs
357 if($file =~ /^html\/use.*/
358 || $file =~ /^html\/install.*/
359 || $file =~ /^html\/options.*/
360 || $file =~ /^html\/tracing.*/
361 || $file =~ /^html\/platform.*/
362 || $file =~ /^html\/bindings.*/
363 || $file =~ /^html\/pls.*/
364 || $file =~ /^html\/modules.*/
365 || $file =~ /^html\/annotated.*/
366 || $file =~ /^html\/group__.*/
367 || $file =~ /^html\/functions.*/
368 || $file =~ /^html\/GRAS_tut_tour_.*/)
370 $tmp_buff .= ' <div class="tabs_group_use">'."\n";
371 $tmp_buff .= ' <ul class="tablist">'."\n";
372 $tmp_buff .= ' <li><a href="install.html"><span>Installing SimGrid</span></a></li>'."\n";
373 $tmp_buff .= ' <li><a href="modules.html"><span>Modules API</span></a></li>'."\n";
374 $tmp_buff .= ' <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
375 $tmp_buff .= ' <li><a href="platform.html"><span>Platform Description</span></a></li>'."\n";
376 $tmp_buff .= ' <li><a href="tracing.html"><span>Tracing Simulations</span></a></li>'."\n";
377 $tmp_buff .= ' <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
378 $tmp_buff .= ' <li><a href="pls.html"><span>Packet-Level Simulation</span></a></li>'."\n";
379 $tmp_buff .= ' </ul></div>'."\n";
380 $tmp_buff .= ' </div>'."\n";
382 my $filename = $file;
383 $filename =~ s/html\///g;
384 $filename =~ s/\.html//g;
385 $filename =~ s/publis_.*/publis/g;
386 $tmp_buff =~ s/<li class="current">/<li>/g;
387 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
388 $tmp_buff =~ s/<li><a href="use.html">/<li class="current"><a href="use.html">/g;
393 # Fix the current "button" of buggy Doxygen tabs
394 if($file =~ /^html\/pages.*/
395 || $file =~ /^html\/FAQ.*/)
397 my $filename = $file;
398 $filename =~ s/html\///g;
399 $filename =~ s/\.html//g;
400 $tmp_buff =~ s/<li class="current">/<li>/g;
401 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
403 if($file =~ /^html\/group__.*/
404 || $file =~ /^html\/GRAS_tut_tour_.*/)
406 $tmp_buff =~ s/<li><a href="modules.html">/<li class="current"><a href="modules.html">/g;
408 if($file =~ /^html\/functions.*/)
410 $tmp_buff =~ s/<li><a href="annotated.html">/<li class="current"><a href="annotated.html">/g;
416 s|<span>Modules</span>|<span>Modules API</span>|g;
417 s|<li.*><a href="pages.html"><span>Related Pages</span></a></li>\n||g;
418 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
419 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
420 if($file =~ /^html\/group__.*/)
422 s|<li><a href="use.html">|<li class="current"><a href="use.html">|g;
423 s|<li><a href="modules.html"><span>Modules API</span></a></li>\n|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n|g;
427 s|<li><a href="modules.html"><span>Modules API</span></a></li>\n||g;
429 s|<li><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
430 s|<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
431 s|Related Pages<|Documentation index<|g;
437 rename("$outfile", "$file") unless $debug{'rename'};