PPRINT manages print-outs of multiple files by producing both global and local page numbers. At the end of the run, it prints out a table of contents, and index, and a reference of all globally accessible typedefs and classes.
PPRINT works with C files, C++ files, Verilog files, and text files. It figures out which language based on extension:
|.h||C or C++, depending on whether -h_is_cc flag is set|
Other extensions are interpreted as straight text. This is useful for merging in ascii documentation, other languages, README files, etc.
C and C++ files can be parsed using the preprocessor, in order to see definitions hidden by macros, to suppress cross-referencing code that that is #ifdef'd out, and to cross reference typedefs that occur in include files that are not being printed in the same run of pprint. This is slower, of course, since it has to run the preprocessor, and requires that the user provide the include path (actually the whole call to the C preprocessor) as an argument.
Using the preprocessor is optional -- pprint can handle most C and C++ files directly -- it just won't cross-reference or boldface typedefs defined in includes, unless the include files are also printed in the same run. The preprocessor may be needed if a preprocessor-blind reading of the code would be syntactically invalid. This can occur when ifdefs are used to disable incomplete code, or when ifdefs are used inside function definitions, and ignoring them might cause parentheses or braces to appear unbalanced.
pprint src1/*.h src1/*.h src2/*.c src2/*.h | lpr pprint +h_is_cc README *.doc *.h *.cc \ +preprocess -cpp "g++ -E -I../include" \ >src_code.ps lpr src_code.ps pprint -line_numbers 0 text_file.txt | lpr pprint +landscape *.cc | lpr pprint +courier -size 5 *.cc | lpr
|-border ||18||Border spacing to edge of page, in printer points|
|+clip (turn on), -clip (turn off)||On||Clip the text so it doesn't overrwrite the next column|
|-columns ||2||Number of output columns|
|+courier (turn on), -courier (turn off)||Off||Print in landscape mode with a courier font, like a2ps, but with the cross-referencing, boldfacing, and italicizing.|
|-cpp ||"gcc -E"||Command to use to run the C Preprocessor. This should include all include directories, and be enclosed in double-quotes.|
|-expand ||100||Expand or shrink the value of spaces in column alignment. The value is expressed as a percentage. 100 keeps it the same. 50 will cut columns in half, 200 will double them.|
|+h_is_cc (turn on), -h_is_cc (turn off)||Off||Interpret .h files as C++|
|-header_size ||4||Size of line numbers in printer points, relative to size|
|+landscape (turn on), -landscape (turn off)||Off||Print in landscape mode (sideways)|
|-line_numbers ||5||Number of lines to skip in between printed line numbers A value of 0 means no line numbers are printed.|
|-linesep ||0||Line-to-line separation in printer points|
|-loglevel ||0||0=warnings only, 1=filenames, 2=pages|
|-npages ||10000||Maximum number of pages to print (0 means infinite)|
|-number_size ||-2||Size of line numbers in printer points, relative to size|
|-offset ||18||Distance between the source text, and the offset line numbers and line-wrap indicators, (+), in printer points|
|+preprocess (turn on), -preprocess (turn off)||Off||Run the C or C++ preprocessor on appropriate input files. To specify a preprocessor program and options, use -cpp. You will need to use the preprocessor if the code you are printing hides a large amount of invalid syntax with ifdefs. Pprint will emit lots of parse error messages, which will go away if you use the preprocessor.|
|-size ||7||Size of text in printer points|
|-start ||1||Page number at which to start printing, starting at 1|
|-tab ||8||Tab width of input files, in characters|
|+wrap (turn on), -wrap (turn off)||On||Wrap around long lines of text|
|-wrap_indent ||0||Number of printer points to indent wrapped lines|
Last updated $Date: 1997/02/24 19:54:04 $
There is one known Unix dependency in the source code, other than include file details, which is the use of "popen" to run the C preprocessor on input files. Apart from that, I believe a PC port would be straightforward, requiring only fixing the names of include files, etc.
Download (40k tar.gz file)
Download (43k zip file)
GNU Enscript: a free replacement for Adobe's Enscript