From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5cbd8c12c7e53bc X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Lines-Of-Code Utility? Date: 1998/11/05 Message-ID: #1/1 X-Deja-AN: 408733822 References: Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Newsgroups: comp.lang.ada Date: 1998-11-05T00:00:00+00:00 List-Id: "joecool" 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