[comp.lang.perl] Wanted - Source Code Line Counter

carlton@apollo.HP.COM (Carlton B. Hommel) (01/26/91)

This is another one of those "stop me before I reinvent the wheel"
postings.  I would like something that would read in C or Pascal
source files, and produce output reporting:
  - total lines of code
  - number of comment lines
  - number of blank lines
  - number of non-blank, non-commented lines

An added fillip would be the ability to compare this source file with a
previous version, and give an add/change/delete count.

Yes, I realize that this would be very easy to write.  However, it
should be able to deal with multiline comments, things in #define
statements that look like comments, etc.  I've already got an
implemetation in "New Hire" C, but it is slooow, calling system("diff
file1 file2"), and using putc and getc.

Why do I want this?  Our group will use the metrics for good, not evil
:-)  Rather than saying that there is a Platonic Ideal metric for these
figures, we compare against previous releases, and compare the trends.

Carl Hommel
carlton@apollo.hp.com

echo "Just Another Perl Hacker," | perl -e 'print grep(/^J/, <>)'