2 # A script to calculate the number and percentage of entities and functions
3 # that are documented (with Doxygen documentation comments).
5 # It operates by parsing the output of Doxygen. It could break for different
6 # versions of Doxygen -- it is known to work with version 1.5.5.
13 &process_files
('html/*_8c.html');
17 my %total = &new_list
();
21 foreach my $file (glob $pattern) {
22 my ($srcfile, %count) = &parse_file
($file);
23 &print_line
($srcfile, %count);
25 foreach my $group (keys %total) {
26 $total{$group}->{'total'} += $count{$group}->{'total'};
27 $total{$group}->{'documented'} += $count{$group}->{'documented'};
31 &print_line
(" *** Total ***", %total);
36 'all' => {'documented' => 0, 'total' => 0},
37 'static' => {'documented' => 0, 'total' => 0},
38 'normal' => {'documented' => 0, 'total' => 0}
52 my %count = &new_list
();
56 while($line = <FILE
>) {
59 if($line =~ m
|^<title
>\w
+: (.*) File Reference
</title
>$|) {
62 elsif($line =~ m
|^<hr
><h2
>(\w
+) Documentation
</h2
>$|) {
66 if($mode eq 'initial') {
67 if($line eq '<div class="memproto">') {
71 elsif($mode eq 'findname') {
72 if($line =~ m
|<td
class="memname">([^<]+)|) {
80 elsif($mode eq 'finddoc') {
81 if($line eq '<div class="memdoc">') {
85 elsif($mode eq 'findp') {
90 elsif($mode eq 'findline') {
96 $count{'all'}->{'total'} ++;
97 $count{'all'}->{'documented'} ++ if $documented;
99 if($section eq 'Function') {
100 if($name =~ /^static/) {
101 $count{'static'}->{'total'} ++;
102 $count{'static'}->{'documented'} ++ if $documented;
105 $count{'normal'}->{'total'} ++;
106 $count{'normal'}->{'documented'} ++ if $documented;
116 return ($srcfile, %count);
120 print " *** Number and percentage of entities and functions "
121 . "that are documented ***\n";
122 printf("%-25s | %-15s | %-15s | %-15s\n",
123 "Source file name", "All entities", "Normal funcs", "Static funcs");
130 printf("%-25s", $file);
132 # Do not use a foreach loop because a specific order is desired
133 &print_group
('all', %count);
134 &print_group
('normal', %count);
135 &print_group
('static', %count);
145 $count{$group}->{'documented'}, $count{$group}->{'total'});
146 if($count{$group}->{'total'}) {
148 $count{$group}->{'documented'} / $count{$group}->{'total'}