Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Available command sync-gforge-website.
[simgrid.git] / tools / doxygen / bibtex2html_table_count.pl
1 #!/usr/bin/perl -w
2 use utf8;
3
4 $first=1;
5 while($line = <STDIN>) {
6     chomp $line;
7     if($line =~ /^\s*@[\w\s]*{/) {
8         if(!$first) {
9             $count{$cat}{$year}++;
10         } else {
11             $first=0;
12         }
13         next;
14     }
15     if($line =~ /^\s*year\s*=\s*/i) {
16         $year = $line;
17         $year =~ s/\D*//g;
18     }
19     if($line =~ /^\s*category\s*=\s*/i) {
20         $cat = $line;
21         $cat =~ s/^.*=//;
22         $cat =~ s/\s*//g;
23         $cat =~ s/\W*//g;
24     }
25 }
26 $count{$cat}{$year}++;
27
28 %pretty_print = (
29     "core" => "Other publications about the SimGrid framework",
30     "extern" => "Papers that use SimGrid-generated results (not counting our owns)",
31     "intra" => "Our own papers that use SimGrid-generated results"
32     );
33
34 @years=();
35 foreach $cat (keys %count) {
36     push @years, keys %{$count{$cat}};
37 }
38
39 @years = sort {$a <=> $b} @years;
40 $year_min = $years[0];
41 $year_max = $years[$#years];
42
43 #Print
44 print "<table border='1' cellspacing='3' cellpadding='3'>
45 <tr><td>Year</td>";
46 foreach $year ($year_min..$year_max) {
47     print "<td>$year</td> ";
48 }
49 print "<td>Total</td>\n";
50 print "</td>\n";
51
52 foreach $cat (keys %count) {
53     $sum = 0;
54     print "<tr><td>$pretty_print{$cat}</td>";
55     
56     foreach $year ($year_min..$year_max) {
57         if(defined($count{$cat}{$year})) {
58             print "<td>$count{$cat}{$year}</td> ";
59             $sum+=$count{$cat}{$year};
60         } else {
61             print "<td>-</td> ";
62         }
63     }
64     print "<td>$sum</td>\n";
65     print "</tr>\n";
66 }
67
68
69
70 print "<tr><td>Total </td>";
71
72 $ssum=0;
73 foreach $year ($year_min..$year_max) {
74     $sum = 0;
75     foreach $cat (keys %count) {
76         if(defined($count{$cat}{$year})) {
77             $sum+=$count{$cat}{$year};
78         }
79     } 
80     $ssum+=$sum;
81     print "<td>$sum</td> ";
82 }
83 print "<td>$ssum</td> ";
84 print "</tr>\n";
85
86
87 print "</table>\n";
88