#!/usr/bin/perl # # Main authors: # Christian Schulte # # Copyright: # Christian Schulte, 2005 # # Last modified: # $Date: 2008-02-28 00:31:18 +0100 (Thu, 28 Feb 2008) $ by $Author: schulte $ # $Revision: 6336 $ # # This file is part of Gecode, the generic constraint # development environment: # http://www.gecode.org # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # # # Get statistics for all files # $i = 0; while ($file = @ARGV[$i++]) { open(FILE,"<$file"); my $module = "UNKNOWN"; my $cat = "UNKNOWN"; my $n_blank; my $n_comment; my $n_code; my $n_class; while ($l = ) { if ($l =~ /\/\/ STATISTICS: ([A-Za-z]+)-([A-Za-z]+)/) { $module = $1; $cat = $2; } if ($l =~ /^[ \t]*$/) { $n_blank += 1; } elsif ($l =~ /^[ \t]*\/\//) { $n_comment += 1; } elsif ($l =~ /\/\*/) { $n_comment += 1; while (!($l =~ /\*\//) && ($l = )) { $n_comment += 1; } } else { $n_code += 1; } if ($l =~ /class [A-Za-z_][A-Za-z0-9_]*.*\{/) { $n_class += 1; } } if ($module eq "UNKNOWN") { print "UNKNOWN: $file\n"; exit 1; } $m{$module} = 1; $c{$cat} = 1; $class{"$module-$cat"} += $n_class; $comment{"$module-$cat"} += $n_comment; $blank{"$module-$cat"} += $n_blank; $code{"$module-$cat"} += $n_code; close FILE; } @modorder = ("kernel","search","int","set","cpltset","minimodel", "serialization", "iter","support","example","test"); @catorder = ("core","var","prop","branch","post","search", "int","set","cpltset","minimodel","stress","any","other"); $i = 0; $modclear{"kernel"} = "Kernel"; $modclear{"search"} = "Search engines"; $modclear{"int"} = "Finite domain integers"; $modclear{"set"} = "Finite integer sets"; $modclear{"cpltset"} = "Finite integer sets with complete domain representation"; $modclear{"minimodel"} = "Minimal modelling support"; $modclear{"serialization"} = "Serialization support"; $modclear{"iter"} = "Range and value iterators"; $modclear{"support"} = "Support algorithms and datastructures"; $modclear{"example"} = "\%Example scripts"; $modclear{"test"} = "Systematic tests"; $catclear{"core"} = "Core functionality"; $catclear{"var"} = "Variables, views, and variable implementations"; $catclear{"prop"} = "Propagators"; $catclear{"branch"} = "Branchings"; $catclear{"search"} = "Search engines"; $catclear{"post"} = "Posting propagators and branchings"; $catclear{"any"} = "All"; $catclear{"other"} = "Miscellaneous"; $catclear{"int"} = "Finite domain integers"; $catclear{"set"} = "Finite integer sets"; $catclear{"cpltset"} = "Finite integer sets with complete domain representation"; $catclear{"minimodel"} = "Minimal modelling support"; $catclear{"stress"} = "System stress"; print < 1) { print $doc; } $an_code += $mn_code; $an_comment += $mn_comment; $an_class += $mn_class; } print <