home *** CD-ROM | disk | FTP | other *** search
- CP (C Printer) is from Dr. Dobbs Journal, Aug 88 (DDJ8808)
-
- Key extract from the article "An Aid to Documenting C"
- by Stewart Nutter
-
- ....
-
- The following list are features that I wanted in my charting program:
-
- * It should take as input a list of filenames.
-
- * It should output a list of all functions, in the order called,
- starting with main.
-
- * The program should count the number of times each function is
- invoked.
-
- * The program should maintain the module's filename that contains
- the function's source code.
-
- * It should count the number of lines and characters in each module.
-
- * It should identify the functions not used in the project.
-
- * It should create a function index.
-
- ......
-
- To use the program, you must create a file that contains a list of
- all your C source filenames. You do not need to sort the file: cp sorts
- the file itself so it can tell how far along it is during the processing.
- For example, the program cp.exe is created from the two source files
- cp.c and cpfuncts.c. Example 2, on page 48, shows the contents of the
- list file. [See CPLST]
-
- The command line in this example should have the following information:
- cp mylist outfile
-
- mylist is the file that contains the names of the sourcecode files.
- outfile is the name of the output file or device. If the cp program
- is called without any arguments on the command line then it will display
- the proper usage for the program. The program defaults to an output file
- name of prn if no file name is given on the command line. To invoke cp
- for the xample program, type
-
- cp cplist cplist.prn<enter>
-
- The program cp will read the file cplist for the list of filenames and
- will output the printout to the file cplist.prn.
-
- ....
-
- Revisions and improvements:
-
- ...
-
- Since I finished the first version of cp, I've added a number of
- improvements, including these:
-
- 1. Support for Microsoft Windows C programs.
-
- 2. The ability to enter a starting function name, instead of just main
- from the command line. For example, in a windows program, main would
- be named WinMain.
-
- 3. Command-line arguments for page width and length.
-
- 4. The saving of the first comment of each module to be printed as a
- short module description list.
-
- 5. A command-line switch to print the statistical information only.
-
- Feel free to use the program at home or in your business, but please don't
- distribute it for profit.
-
- [Stewart Nutter is a senior programmer for York International Inc.
- He can be reached at 1111 W. Gay St., Red Lion PA 17356.]
-
- Extract, C compiles, Borland C tweaks, courtesy of David Kirschbaum,
- Toad Hall, kirsch@usasoc.soc.mil.
-
- v1.4 Tweaks
- - Changed to COMPACT model: runs fine.
- - Removed output file parameter processing, PRN default, etc.
- All now goes to STDOUT (and you redirect where you want it).
- - Funny bug: during initial processing, the first string (I suppose
- in the data segment) of the program keeps getting displayed.