An invaluable tool for printing source code. Highlights function names, italicizes comments. Generates per-file and per-function indexes. Works with several programming languages, including C, Perl, and Java. Generates postscript output.

trueprint is an ugly flower that smells beautiful.


.I n t r o d u c t i o n.

trueprint is intended to be the only printing program you will ever need to print the source code and other text files. It tries to achieve this by being simple to use, yet powerful, and intelligent features. The original author and current maintainer of trueprint is Lezz Giles.

trueprint knows about common programming languages and will select features appropriate to each language. For example if the language contains functions then trueprint will generate a function index. And if the language contains the concept of braces then trueprint will include a braces depth count in the left-hand margin. It can also be used to print only the differences between two files (typically two versions of the same source code file) side by side. In short, it's a neat tool.

trueprint's features can be turned on or off if one needs to customize the appearance of the printed output. Using the command line options, one can specify that the output be printed landscape, two-up, using an eight-point font with line numbers etc. Also, by setting some environment variables you can create personal defaults for trueprint which will override the language defaults and which will in turn be overridden by the command line options.

trueprint knows about the printers available on your system via a special 'printers' file. This file tells it how large a page is and whether the printer is double or single sided. Using this information, trueprint can format your output appropriately.

trueprint is covered by the GPL and is an open source software, so if there's anything that trueprint doesn't do, one can modify the tool. If deemed useful, the changes can be sent to !


.L a n g u a g e s.

Different programming languages have different features and look their best with different formats. Since trueprint tries to be all things to all people, it understands a number of different languages and tries to accomodate most of them. In version 5.0 trueprint understands:

It also understands some other formats like:

However, not all of the languages are fully supported. C is very well supported, but Java has only a minimally support.

trueprint finds out what type of language a file contains by lookint at the filename extension, or it can be told using the '--language' command line option as follows:

Language        suffix        -language option
=====================================================
C              .c .h          -language=c
Verilog        .v             -language=v
C++            .cxx .cpp .cc  -language=cxx
               .C .hpp .H
Shell          .sh            -language=sh
Pascal         .pas           -language=pascal
Perl           .pl            -language=perl
Java           .java          -language=java
Plain text     default        -language=text
Pseudo C       .pc .ph        -language=pseudoc
Listing        .lst           -language=list
Report format  .rep           -language=report
=====================================================

For most of the languages, trueprint uses the language to work out where comments are so it can print them in italics, and where the function names are so it can print them in bold and include them in the function index.


.E n v i r o n m e n t V a r i a b l e s.

Bwsides several command line options trueprint uses following environment variables along with the current username:

PRINTER

Specify the printer to send the postscript output to.

TP_OPTS

Various options. These options override any default options including language defaults, but can be overridden by command line options.

TP_DIFF_CMD

Specify the diff command to be used. The command must produce output in the same format as the classic Unix diff. This variable can be used to add flags to the diff command used, for example to make diff ignore whitespace.

TP_PRINT_CMD

Specify the print command. The default is lpr. If this variable is set then it should be set to a command that takes standard input. If this is set then the destination and number of copies have no effect, i.e. there is no mechanism to pass these values to your print command. If you set this to /bin/cat then the postscript output will appear on standard output.

TP_PRINTERS_FILE

Specify the printers file. The default is the printers file that was initially configured when trueprint was installed. This can be used to test out a new printers file.


1. Pseudo C is like C, except it has a more forgiving syntax. In particular it ignores strings, so if you leave off a closing quote then pseudo C will print out using a vaguely sensible format. Pseudo C is intended for printing code that doesn't yet compile.

2. Listing format assumes very wide lines and a fixed page length of sixty-six characters, so it turns off line-wrap and sets the page length appropriately.

3. Report format uses a few special characters: anything between ^A and ^E is printed in bold and included in the function index, and anything between a pair of ^Cs is printed in italics.


Main Source: http://www.go.dlr.de:8081/cgi-bin/info2www?(trueprint.info)Overview

Log in or register to write something here or to contact authors.