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 # the publication pages deserves some special handling too
168 my %pub_tabs = ("publis.html" =>"Reference publications",
169 "publis_core.html" =>"Other publication about SimGrid",
170 "publis_extern.html"=>"External papers using SimGrid",
171 "publis_intra.html"=>"Internal papers using SimGrid");
173 my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
176 my $newname = $oldname;
177 $newname =~ s/\.html$/.new.html/;
179 # print "Handle_pub($oldname -> $newname)\n";
181 open IN,"html/$oldname" || die "Cannot open $oldname";
182 open OUT,">html/$newname" || die "Cannot open $newname";
184 while ($line = <IN>) {
185 last if $line =~ /<h1>/;
189 print OUT "<div class=\"tabs\">\n<ul class=\"tablist\">\n";
190 foreach my $page (@pub_titles) {
191 print OUT " <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
194 print OUT " </ul></div>\n";
196 while ($line = <IN>) {
201 rename("html/$newname","html/$oldname") unless $debug{'rename'};
203 map {handle_pub($_)} @pub_titles;
206 # Operate the recursion
211 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
213 # we generate the tabs bottom up begining from where we are in the tree
214 # and display them top down, as it should in a file
216 my $found_div_tabs=0;
218 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
219 # print "handle $current->{'file'}, at level $level\n";
221 my $iterator = $current;
223 while ($lvl_it >= 0) {
224 my $father = $iterator->{'up'};
225 $tabs[$lvl_it] = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
226 foreach my $bro (@{$father->{'down'}}) {
227 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
229 $tabs[$lvl_it] .= " </ul></div>\n";
233 if (defined $current->{'down'}) { # there's some kid. Display them too
234 $tabs[$level+1] = "<div class=\"tabs2\">\n <ul class=\"tablist\">\n";
235 foreach my $kid (@{$current->{'down'}}) {
236 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
238 $tabs[$level+1] .= " </ul></div>\n";
242 open FROM,"html/$current->{'file'}" || die;
243 my $newname="html/$current->{'file'}";
244 $newname =~ s/.html/.handlepage.html/;
245 open TO,">$newname" || die;
246 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
249 # add "current" to the module API granfather page
250 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
251 # print "++Write $_";
252 $found_div_tabs=1 if m/div.*class="tabs"/;
254 last if ((m|</div>|)&&($found_div_tabs));
257 print TO "\n<!-- POST-PROCESSED TABS -->\n";
263 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
265 if ($current->{'file'} =~ m/^class/) {
272 if (m/POST-PROCESSED TABS/) {
274 last if (m/END OF POST-PROCESSED TABS/);
279 if (m/The documentation for/) {
288 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
292 foreach my $entry (@{$current->{'down'}}) {
293 handle_page($entry,$level+1);
298 ### Launch the modules navbar reworking
300 handle_page($top,-1);# skip roots (we have 2 roots) in level counting
303 ### Add the modules navbar reworking to the modules.html file
305 sub add_tabs_to_module_html {
306 my $found_div_tabs=0;
307 my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
308 foreach my $entry (@{$top->{'down'}}) {
309 $module_tabs .= " <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
311 $module_tabs .= " </ul></div>\n";
313 my $oldname = "html/modules.html";
314 open FROM,$oldname || die;
315 my $newname=$oldname;
316 $newname =~ s/.html/.handlepage.html/;
317 open TO,">$newname" || die;
319 $found_div_tabs=1 if m/div.*class="tabs"/;
321 last if ((m|</div>|)&&($found_div_tabs));
324 print TO "\n<!-- POST-PROCESSED TABS -->\n";
325 print TO $module_tabs;
326 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
333 rename($newname, $oldname) unless $debug{'rename'};
338 add_tabs_to_module_html;
341 ### Post-processsing common to all pages
343 map {push @allfiles,$_} @extra_files;
344 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
347 foreach my $file (@allfiles) {
348 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
350 open FROM,"$file" || die;
351 my $outfile = "$file";
352 $outfile =~ s/.(html|php)$/.new.$1/;
353 open TO,">$outfile" || die;
354 # print "POSTPROCESSING $file (tmp=$outfile)\n";
356 # Add the simgrid css, just in case
357 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
361 if($file =~ /^html\/index\..*/){
362 $_ =~ s/<li class="current">/<li>/g;
363 $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
365 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
367 if($file =~ /^html\/pages\..*/){
368 $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
372 if($file =~ /^html\/publis.*/){
373 $_ =~ s/<div class="header">/<div>/g;
374 $_ =~ s/<div class="headertitle">/<div>/g;
377 # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
378 if( $_ =~ /<div.*class="tabs">/){
381 if( $_ =~ /<\/div>/){
384 if( $_ =~ /<\/ul>/ && $tabs){
386 $tmp_buff .= ' <li><a href="use.html"><span>Using SimGrid</span></a></li>'."\n";
387 $tmp_buff .= ' <li><a href="http://gforge.inria.fr/projects/simgrid"><span>Forge</span></a></li>'."\n";
388 $tmp_buff .= ' <li><a href="http://simgrid.gforge.inria.fr/"><span>Website</span></a></li>'."\n";
389 $tmp_buff .= ' <li><a href="pages.html"><span>Documentation index</span></a></li>'."\n";
390 $tmp_buff .= ' <li><a href="FAQ.html"><span>FAQ</span></a></li>'."\n";
394 # Rework the navbar and add menu for use.html
395 # Fix the current "button" of buggy Doxygen tabs
396 if($file =~ /^html\/use.*/
397 || $file =~ /^html\/install.*/
398 || $file =~ /^html\/options.*/
399 || $file =~ /^html\/tracing.*/
400 || $file =~ /^html\/platform.*/
401 || $file =~ /^html\/bindings.*/
402 || $file =~ /^html\/pls.*/
403 || $file =~ /^html\/modules.*/
404 || $file =~ /^html\/annotated.*/
405 || $file =~ /^html\/group__.*/
406 || $file =~ /^html\/functions.*/
407 || $file =~ /^html\/GRAS_tut_tour_.*/)
409 $tmp_buff .= ' <div class="tabs_group_use">'."\n";
410 $tmp_buff .= ' <ul class="tablist">'."\n";
411 $tmp_buff .= ' <li><a href="install.html"><span>Installing SimGrid</span></a></li>'."\n";
412 $tmp_buff .= ' <li><a href="modules.html"><span>Modules API</span></a></li>'."\n";
413 $tmp_buff .= ' <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
414 $tmp_buff .= ' <li><a href="platform.html"><span>Platform Description</span></a></li>'."\n";
415 $tmp_buff .= ' <li><a href="tracing.html"><span>Tracing Simulations</span></a></li>'."\n";
416 $tmp_buff .= ' <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
417 $tmp_buff .= ' <li><a href="pls.html"><span>Packet-Level Simulation</span></a></li>'."\n";
418 $tmp_buff .= ' </ul></div>'."\n";
419 $tmp_buff .= ' </div>'."\n";
421 my $filename = $file;
422 $filename =~ s/html\///g;
423 $filename =~ s/\.html//g;
424 $filename =~ s/publis_.*/publis/g;
425 $tmp_buff =~ s/<li class="current">/<li>/g;
426 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
427 $tmp_buff =~ s/<li><a href="use.html">/<li class="current"><a href="use.html">/g;
432 # Fix the current "button" of buggy Doxygen tabs
433 if($file =~ /^html\/pages.*/
434 || $file =~ /^html\/FAQ.*/)
436 my $filename = $file;
437 $filename =~ s/html\///g;
438 $filename =~ s/\.html//g;
439 $tmp_buff =~ s/<li class="current">/<li>/g;
440 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
442 if($file =~ /^html\/group__.*/
443 || $file =~ /^html\/GRAS_tut_tour_.*/)
445 $tmp_buff =~ s/<li><a href="modules.html">/<li class="current"><a href="modules.html">/g;
447 if($file =~ /^html\/functions.*/)
449 $tmp_buff =~ s/<li><a href="annotated.html">/<li class="current"><a href="annotated.html">/g;
455 s|<span>Modules</span>|<span>Modules API</span>|g;
456 s|<li.*><a href="pages.html"><span>Related Pages</span></a></li>\n||g;
457 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
458 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
459 if($file =~ /^html\/group__.*/)
461 s|<li><a href="use.html">|<li class="current"><a href="use.html">|g;
462 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;
466 s|<li><a href="modules.html"><span>Modules API</span></a></li>\n||g;
468 s|<li><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
469 s|<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
470 s|Related Pages<|Documentation index<|g;
476 rename("$outfile", "$file") unless $debug{'rename'};