home *** CD-ROM | disk | FTP | other *** search
- c_lines is a program to find some ( very ) basic statistics about c
- programs. These statistics include the number of lines devoted to each
- of the following:
-
- 1) comments
- 2) pre-processor directives
- 3) areas that are being explicitly ignored with "#if 0" direcitves.
- 4) actual code.
-
- Note that only explicit removal with "#if 0" directives, makes the
- code inactive from the viewpoint of this program. Other pre-processor
- directives that eliminate the compilation of sections of code are
- counted as pre-processor directives, but are otherwise ignored. These
- are usually included for portability, and all the code in question is
- meant to be used, just in different environments, therefore the program
- considers all of them to be active, even if they are in mutually
- exclusive sections. This code has been fairly extensively tested ( ie.
- on several thousand lines of code from various sources. ) and seems to
- work correctly on all of them. If you do have problems, about the only
- way to get ahold of the author is to leave a message in the C_ECHO or
- C_PLUSPLUS echo on FIDO-NET. It should be addressed TO: JERRY COFFIN.
- You might also send netmail to me at 1:128/60.
-
- The program is used by supplying the names of files you want
- analyzed on the command line. You can use wildcards if you wish.
- If you don't supply a file name, it will attempt to read from standard
- input IF it has been re-directed. It will not attempt to read from the
- keyboard. If you haven't redirected input, and don't supply at least
- one argument, it prints a short help message. If supply an incomplete
- file-name, ( ie. one with no extension ) the following extensions will
- be searched in this order: 1) .c 2) .cpp 3) .cxx 4) .cc 5) .h 6) .hpp 7)
- .hxx
-
- I believe this is sufficient to accomodate the file names used by
- most c and c++ compilers. If you need others, leave a messge as noted
- above, but please don't expect instant response; I have a job during the
- day and don't always get to spend as much time programming as I'd like.
- I'm thinking about adding the ability to analyze c source code imbedded
- in lex and yacc type input files, so if you want/need/have use for this
- capability, let me know, and it may become a higher priority.
-
- I should note that there is a discrepency between C source code
- included, and the code Flex will generate for c_lines.l, unless you
- modify flex.ske. I've added a little code to turn any high-bit
- characters ( ones with a code higher than 127/0x7F ) into spaces.
- Without this, it will crash on any program that includes high-bit
- characters. As far as I know, these should only be included in string
- or character constants, so changing them to spaces should have on effect
- on the analysis.
-
- For the curious: this was written with FLEX, the lexical analyzer
- generator developed as part of the GNU project. I believe it counts as
- what is described as a "derived work" of that project, which means that
- I have to make the source code available to you if you want it. If you
- re-distribute it, the same restriction applies. The actual source in
- c_lines.l is Public Domain, so if you use a different lexical analyzer
- generator, you can do with it's output as you like ( within it's
- restrictions, if any. ) I've included the source code in the file
- "c_lines.l" which should be a little over 4 K long when uncompressed. If
- you want to re-build this program, a copy of Flex, lex, or another
- lexical analyzer generator will be needed. The lexical analyzer must be
- able to handle what are called "starting contexts" or it won't work with
- this. For one instance, Allen Holub's LeX won't work.
-
- Other than the restricion mentioned above, you're welcome to treat the
- code as your own. You're welcome to give away all the copies you want
- to. If you sell any copies, I'd appreciate any portion of the money you
- feel like sending me. If you modify or improve this program, I'd
- appreciate hearing about it and/or recieving a copy of the improved
- version, if it isn't a big hassle. Actually, more exciting to me than
- that would be if you mentioned my name as being an excellent programmer,
- since that feeds my ego, and if done correctly, might even get me a job
- programming, which would be a distinct improvement over $4.36/Hr. at
- Taco Bell, where I work now.
-
- The C source code compiles with MS QC 2.51 and Borland C++ 2.0. It
- will also probably work with other compilers from these vendors, but
- there's no guarantee of that. It's been tested pretty extensively with
- with the output from Quick C, but less so with the output from Borland
- C.
-
- Enjoy it, okay ? :-) And try bungee jumping, it's a blast ! You
- need to get away from the keyboard more often !
- Later,
- Jerry.
-