comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Lines-Of-Code Utility?
Date: 1998/11/05
Date: 1998-11-05T00:00:00+00:00	[thread overview]
Message-ID: <ud8722fet.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: Auij4FgA#GA.64@samson.airnet.net

"joecool" <nobody@nowhere.com> writes:

> Does anyone know if there is a utility that will run on NT 4.0 that can be
> run in batch mode to generate a report on the lines of code contained in Ada
> source files located within a directory tree (that is, it needs to
> recursively look for Ada source within a dir tree)?  And if so, what is it
> capable of doing?

I wrote a wrapper for an old "count of Ada statements" program from
the PAL; it counts all lines, terminal semicolons, and comment lines
in files listed on the command line. Using the cygwin tools 'find' and
'xargs', you can count lines in directory trees:

bash$ find . -name "*.ad?" -print | xargs ada_stats
File name	Statements, Lines, Comments
./Ada_Stats/ada_stats.adb	 47, 102, 29
./Ada_Stats/character_set.adb	 152, 264, 0
./Ada_Stats/character_set.ads	 22, 58, 30
./Ada_Stats/count_of_ada_statements.adb	 72, 225, 100
./hexdump/Source/hexdump.adb	 78, 140, 9
./command_line_io.adb	 38, 110, 8
./command_line_io.ads	 11, 74, 39
./time_convert.adb	 207, 463, 20

Total files      :  8
Total statements :  627
Total lines      :  1436
Total comments   :  235

Guess I need to allow more space for the file names :).

It does enough parsing to not count semicolons in strings and
comments. You might be able to enhance it enough to count tokens, as
Robert Dewar suggests.

Source is too long to post here, but I'd be happy to email on request
(I _really_ need to get web page at work!).

-- Stephe




      parent reply	other threads:[~1998-11-05  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Auij4FgA#GA.64@samson.airnet.net>
     [not found] ` <3642c88c.24407137@news.geccs.gecm.com>
1998-11-02  0:00   ` Lines-Of-Code Utility? joecool
1998-11-04  0:00     ` dennison
1998-11-04  0:00     ` dewarr
1998-11-05  0:00       ` Marc A. Criley
1998-11-05  0:00     ` Martin C. Carlisle
1998-11-04  0:00 ` Tucker Taft
1998-11-05  0:00 ` Stephen Leake [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox