Improved statistics message wrt "pass"/"wrap" functions
authorshort <>
Sat, 1 Feb 2003 20:13:16 +0000 (20:13 +0000)
committershort <>
Sat, 1 Feb 2003 20:13:16 +0000 (20:13 +0000)
src/libcaptive/ke/captivesym.pl

index 980e7c5..14171f5 100755 (executable)
@@ -61,6 +61,7 @@ while ($ARGV[0] && $ARGV[0]=~/[.]def$/) {
 my %module;    # $module{'module'}{'symbol'}=1/""
 my %symbol;    # $symbol{'symbol'}='module'
 my %patch;     # $patch{'module'}=1/undef
+my %stats;     # $stats{'iswhat'}=42
 while (<>) {
        chomp;
        next if /^\s*$/;        # empty
@@ -88,6 +89,7 @@ while (<>) {
                }
        $module{$module}{$symbol}=$iswhat ne "undef";
        $symbol{$symbol}=$module;
+       $stats{$iswhat}++;
        }
 
 # file header
@@ -105,7 +107,6 @@ print <<"HERE";
 
 HERE
 
-my $symbols_undef=0;
 for my $symbol (sort keys(%symbol)) {
        my $def=$def{$symbol};
        if (!$def) {
@@ -117,7 +118,6 @@ void ${symbol}(void)
        g_error("%s: Function '$symbol' NOT IMPLEMENTED",G_STRLOC);
 }
 HERE
-               $symbols_undef++;
                next;
                }
        if ($patch{$symbol{$symbol}} && "data" ne $def->{"type"}) {
@@ -243,9 +243,13 @@ HERE
        }
 
 # exit
-print STDERR "$0: Processed ".scalar(keys(%module))." modules, ".scalar(keys(%symbol))." symbols",
-               " (".int(100*(1-$symbols_undef/scalar(keys(%symbol)))).'%'." implemented)\n";
-print STDERR "$0: warning: $symbols_undef symbols are NOT IMPLEMENTED yet!\n" if $symbols_undef;
+my $total=0;
+$total+=$_ for (values(%stats));
+my $statstring;
+for my $statname (sort keys(%stats)) {
+       $statstring.=" ".($statname || "define")."=".$stats{$statname}."(".int(100*$stats{$statname}/$total)."%)";
+       }
+print STDERR "$0: Processed ".scalar(keys(%module))." modules:".$statstring."\n";
 exit 0;