Overview
Counts total lines of code, lines of comments, and blank lines in all files which match the specified filters, optionally recursing into subdirectories. Use CSL with no command line arguments to see a list of options and copyright information..
The syntax used for detecting what is code and what is comment is selected using a command line argument and may be set to C++, Ada, FORTRAN Free Form, FORTRAN Fixed Form, Visual Basic or Matlab.
Compatibility
- Tested with Windows 9x/NT 4/2000/XP
- Untested but should work with DOS 6/Win 3.x /NT 3.51
Installation / Usage
- Download csl.zip (24KB)
- Copy csl.exe into a directory in your PATH envinronment variable (eg.
C:\WINDOWS)
- Open a command shell (run "cmd" on NT/2000/XP, run "command" on Win9x)
- Navigate to the desired directory
- Type csl with command switches for the files you wish
to find and the language, eg "csl -cpp *.cpp *.h" will count
all files with the extentions cpp and h using the C++ syntax
- To learn more about the available options type "csl"
with no switches
- Alternatively create a shortcut in Windows to count the lines in a
particular directory
Reference
Line count is based on the LF or CRLF terminated lines in the source file.
Multiple commands on the same line are counted as one line, one command split
across multiple lines is counted as multiple lines. This method is easier
to process and is believed to gave a better measure of code complexity
than counting number of commands.
A comment line which contains no alphanumeric characters is not believed
to help document the code and is therefore counted as blank. Where a line
contains both code and comment, it is counted as code.
In C++ syntax, lines containing only { or ; are considered blank.
Lines containing only } are considered code. This is intended give closer
alignment with other languages where the looping and branching structures
have a terminating line of code such as "END IF".
In C++ syntax each line inside a block comment must contain one or more
alphanumeric characters to be classed as comment. Lines which do not meet
this criteria are classed as blank.
In FORTRAN Fixed syntax, lines must have characters between column 7 and
72 inclusive to be classed as code. In FORTRAN Fixed syntax, Compaq
Visual FORTRAN allows comments to be started by a ! anywhere on the
line, as per free form syntax. This is not in the FORTRAN 77 specification
and these lines will be counted as blank.
Note that all output is tab delimited for easy import into spreadsheets
or other post processing tools.
Version History
1.3
|
Added directory exclusion and corrected /m clashs
|
1.2
|
Added summary output
|
1.1
|
Added "Bare" output and FORTRAN Fixed Form syntax
|
1.0
|
Original Release
|
page last updated: 2 November 2003