diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:02:41 +0000 |
| commit | c155ee9e0f133aafff70984f5b09c45efc62ca5a (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /0.8/scripts/stats.pl | |
| parent | 19f9940dc968afae01b54377ee23ec59069c9646 (diff) | |
moving stuff to branches
Diffstat (limited to '0.8/scripts/stats.pl')
| -rwxr-xr-x | 0.8/scripts/stats.pl | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/0.8/scripts/stats.pl b/0.8/scripts/stats.pl deleted file mode 100755 index 0eea04d..0000000 --- a/0.8/scripts/stats.pl +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/perl - -# The yChat Project (2003 - 2005) -# -# This script generates source code and project statistics - -use strict; - -use scripts::modules::file; - -my %stats; -my $param = shift; - -&recursive("."); - -$stats{"Lines total"} = $stats{"Lines of source"} - + $stats{"Lines of scripts"} - + $stats{"Lines of text"} - + $stats{"Lines of HTML"}; - -unless (defined $param) { - - print "$_ = " . $stats{$_} . "\n" - for ( sort keys %stats ); - -} else { - - print $stats{$_} . " " - for sort keys %stats; - -} - -print "\n"; - -sub recursive -{ - my $shift = shift; - my @dir = &dopen($shift); - - foreach (@dir) - { - next if /^\.$/ or /^\.{2}$/; - - if ( -f "$shift/$_" ) - { - $stats{"Number of files total"}++; - &filestats("$shift/$_"); - } - elsif ( -d "$shift/$_" ) - { - $stats{"Number of dirs total"}++; - &recursive("$shift/$_"); - } - } -} - -sub filestats -{ - my $shift = shift; - if ( $shift =~ /\.(cpp|h|tmpl)$/ ) - { - $stats{"Number of source files"}++; - $stats{"Lines of source"} += countlines($shift); - } - elsif ( $shift =~ /\.(html|css)$/ ) - { - $stats{"Number of HTML files"}++; - $stats{"Lines of HTML"} += countlines($shift); - } - elsif ( $shift =~ /\.(gif|png|jpg)$/ ) - { - $stats{"Number of gfx files"}++; - } - elsif ( $shift =~ /(\.pl|\.pm|\.sh|configure.*|Makefile.*)$/ ) - { - $stats{"Number of script files"}++; - $stats{"Lines of scripts"} += countlines($shift); - } - elsif ( $shift =~ /(\.txt|[A-Z]+)$/ ) - { - $stats{"Number of text files"}++; - $stats{"Lines of text"} += countlines($shift); - } - elsif ( $shift =~ /\.so$/ ) - { - $stats{"Number of compiled module files"}++; - } -} - -sub countlines -{ - my $shift = shift; - my @file = fopen($shift); - return $#file; -} |
