trueprint - print program listings on postscript printer.
trueprint [ options ] [ files ]
trueprint is a general purpose program printing program. It
tries to produce everything that anybody could need in a program printout
without the need for large numbers of switches or pipelines.
trueprint can currently handle C, C++, Java, Perl, Verilog, shell
(including ksh), Pascal, pseudo C, report files (trueprint report file, see
NOTES), listing files, text files.
Each page in the output has a default header consisting of the
date or a user-defined string, the current function name, and the overall
page number (which is used in the indexes); and a footer consisting of the
date, the current file name and page number within file, and the overall
page number. If the language contains the concept of braces then
trueprint will include a braces depth count in the left-hand
margin.
The printout has two function indexes at the front - one is an
alphabetical list of all functions and the other is a list of files with
functions in each file in alphabetical order. The first is suppressed if
there are no functions and the second is suppressed if there is only one
file.
If no language is specified on the command line then options are
defaulted to be appropriate for the first file specified on the command
line. The filetype is taken from the suffix - valid suffixes are
- Language Suffix language
option
-
- C .c .h -language=c
- C++ .cxx .cpp
.cc -langauge=cxx
-
.C .hpp .H
- Java .java -language=java
- Shell .sh -language=sh
- Perl .pl -language=perl
- Pascal .pas -language=pascal
- Verilog .v -language=v
- Pseudo C .pc
.ph -language=pseudoc
- Report
format .rep -language=report
- Listing .lst -language=list
- Plain
Text default -language=text
When Trueprint starts it uses four sets of options:
— Hard-coded defaults
— Language-specific defaults
— Options taken from the environment variable `$TP_OPTS'
— Command-line options
Each set of options overrides the earlier sets, so command-line
options override all other sets.
If you want to set some personal default options, then simply set the
environment variable `$TP_OPTS'.
- -D <string>,
--debug=<string>
- set debug options to <string> (see USAGE whatfor <string>
is).
- -O <string>,
--diff=<string>
- if <string> is a file then print diffs between <string> and
input file otherwise use as a prefix and print diffs. See USAGE for more
information on usage.
- -t <string>,
--language=<string>
- treat input as language. Use --help=language for list.
- -U <string>,
--username=<string>
- set username for coversheet
- -H,
--help[=<string>]
- Type help information and given the <string> option it lists options
for the following topics:
- all-options - all options
misc-options - miscellaneous options
page-furniture-options - page furniture options
text-format-options - text formatting options
print-options - options that select what to print
page-format-options - page format options
output-options - options affecting output
language - languages
prompt - format for --print-pages string
debug - format for --debug string
header - format for header & footer strings
report - file format for --language=report input
environment - environment vars used
- -V, --version
- Type version information
- -N,
--use-environment
- use environment variables
- --N,
--ignore-environment
- don't use values from environment, such as time, $USER, etc. This is for
test purposes, to make test results more reproducible
- -R 1, --ps-level-one
- Use level one postscript.
- -R 2,
--ps-level-two
- Use level two postscript.
- -b,
--no-page-break-after-function
- don't print page breaks at the end of functions
- --b,
--page-break-after-function
- print page breaks at the end of functions
- -W,
--no-intelligent-line-wrap
- Wrap lines at exactly the line-wrap column
- --W,
--intelligent-line-wrap
- Wrap lines intelligently at significant characters, such as a space
- -L <number>,
--minimum-line-length=<number>
- minimum line length permitted by intelligent line wrap (default 10)
- -T <number>,
--tabsize=<number>
- set tabsize (default 8)
- -E,
--ignore-form-feeds
- don't expand form feed characters to new page
- --E,
--form-feeds
- expand form feed characters to new page
- -p <number>,
--point-size=<number>
- specify point size (default 10)
- -g <number>,
--leading=<number>
- specify interline gap in points (default 1)
- -w <number>,
--line-wrap=<number>
- specify the line-wrap column.
- --no-line-wrap
- turn off line-wrap
- -l <number>,
--page-length=<number>
- specify number of lines on a page, point size is calculated appropriately
- -I, --no-holepunch
- don't leave space for holepunch at the side of each page
- --I,
--holepunch
- leave space for holepunch at the side of each page
- -J,
--no-top-holepunch
- don't leave space for holepunch at the top of each page
- --J,
--top-holepunch
- leave space for holepunch at the top of each page
- -o p, --portrait
- print using portrait orientation
- -o l,
--landscape
- print using landscape orientation
- -S 1, --single-sided
- print single-sided
- -S 2,
--double-sided
- print double-sided
- -1, --one-up
- print 1-on-1 (default)
- -2, --two-up
- print 2-on-1
- -3, --two-tall-up
- print 2-on-1 at 4-on-1 pointsize
- -4, --four-up
- print 4-on-1
- -X <string>,
--left-header=<string>
- specify string for left side of header
- -x <string>,
--left-footer=<string>
- specify string for left side of footer
- -Y <string>,
--center-header=<string>
- specify string for center of header
- -y <string>,
--center-footer=<string>
- specify string for center of footer
- -Z <string>,
--right-header=<string>
- specify string for right side of header
- -z <string>,
--right-footer=<string>
- specify string for right side of footer
- -m <string>,
--message=<string>
- message to be printed over page. Will be printed in a very large, light
gray font. There are a few escapes as a replacement for <string>;
see USAGE for more information.
- -G <number>,
--gray-bands=<number>
- Emulate the old lineprinter paper with gray bands across each page. The
value of <number> gives the width of the bands and the gaps between
them
- -K, --headers
- include the header on each page
- --K,
--no-headers
- suppress the header on each page
- -k, --footers
- include the footer on each page
- --k,
--no-footers
- suppress the footer on each page
- -u,
--page-furniture-lines
- Draw lines around header & footer boxes and down left side of
page.
- --u,
--no-page-furniture-lines
- Don't draw lines around header & footer boxes or down left side of
page.
- -i,
--no-braces-depth
- exclude the braces depth count
- --i,
--braces-depth
- include the braces depth count
- -n,
--no-line-numbers
- exclude the line number count
- --n,
--line-numbers
- include the line number count
- -C,
--no-cover-sheet
- don't print cover sheet
- --C,
--cover-sheet
- print cover sheet
- -A <selection>,
--print-pages=<selection>
- specify list of pages to be printed (see USAGE whatfor <selection>
is).
- -a, --no-prompt
- don't prompt for each page, whether it should be printed or not
- --a, --prompt
- prompt for each page, whether it should be printed or not
- -F,
--no-file-index
- don't print file index
- --F,
--file-index
- print file index
- -f,
--no-function-index
- don't print function index
- --f,
--function-index
- print function index
- -B,
--no-print-body
- don't print body of text
- --B,
--print-body
- print body of text
The usage of the `-D <string>',
`--debug=<string>' is as follows:
Each letter turns on a set of debugging messages, and the corresponding digit
indicates the level of messages, with 1 indicating the least number of
messages and 9 turning on all messages. The letter `@' can be used to turn
on all areas, so `--debug=@9' will turn on all messages. Use `--help=debug'
for details of what letters turn on what areas.
Note that this feature is not uniformly implemented - messages were only
typically added where they were needed. Also note that messages will not be
generated in code prior to the code that sets the debug string!
The usage of the `-O <string>',
`--diff=<string>' option looks as follows:
You specify the old version of the file or files with
`--diff=<pathname>'. If <pathname> suffixed with the current
filename is a valid file then the differences between
<pathname>/<filename> are displayed. Alternatively, if
<pathname> is a file and you're printing one file, then the
differences between <pathname> and the current file are displayed.
Examples how to make it are shown below:
- trueprint --diff=../old- this.c that.c
will print the differences between ../old-this.c and this.c, and
../old-that.c and that.c.
- trueprint --diff=../old/ this.c that.c
will print the differences between ../old/this.c and this.c, and
../old/that.c and that.c. Note that the trailing / is important.
- trueprint --diff=this.c that.c
will print the differences between this.c and that.c.
The usage of the `-A <selection>',
`--print-pages=<selection>' option looks as follows:
<selection> consists of a comma-seperated list of page selections:
- `<number>' -- print the specific page
`<number>-<number>' -- Print all pages between, and
including, the specified pages
`<function-name>' -- Print all pages that include
function-name.
`d' -- Print all pages that have changed (this is only useful with
the `--diff' (see above) option.
`D' -- Print all pages containing functions that have changed (this
is only useful with the `--diff' (see above) option.
`f' -- Print the function index
`F' -- Print the file index.
For example,
- --print-pages=1-5,main,f
will print the function index, pages 1 to 5, and all the pages for
the function `main'.
If you specify `--prompt'then trueprint will
prompt you for each page, whether or not it should print that page. It will
give you information such as the current filename, current functionname,
page number, and so on. The possible responses are:
- `y' -- Print this page.
`y<number>' -- Print <number> pages.
`y*' -- Print all the remaining pages.
`n' -- Skip this page
`n<number>' -- Skip <number> pages.
`n*' -- Skip all the remaining pages.
`p<selection>' -- Print all remaining pages that match
<selection>, where <selection> is in the format defined above.
`?' -- Print a help message.
The `--message=<string>' option takes a few % escapes
for <string> which are listed below:
- `%%' -- Print a simple %.
`%m' -- Print the current month of the year as a number, e.g. 05.
`%d' -- Print the current day of the month, e.g. 01.
`%y' -- Print the current year, e.g. 1999
`%D' -- Print the date in the format mm/dd/yy.
`%L' -- Print the date and time in long format, e.g. Fri Oct 8
11:49:51 1999
`%c' -- Print the last modified date of the current file in the
format mm/dd/yy.
`%C' -- Print the last modified date and time of the current file in
long format, e.g. Fri Oct 8 11:49:51 1999
`%H' -- Print the current hour.
`%M' -- Print the current minute.
`%S' -- Print the current second.
`%T' -- Print the time in the format HH:MM:SS.
`%j' -- Print the day of the year, e.g. 095.
`%w' -- Print the day of the week, e.g. Sunday.
`%a' -- Print the abbreviated day of the week, e.g. Sun.
`%h' -- Print the abbreviated month name, e.g. Mar.
`%r' -- Print the time in am/pm notation, e.g. 10:45pm.
`%p' -- Print the page number in the current file.
`%P' -- Print the overall page number.
`%f' -- Print the total number of pages of the current file.
`%F' -- Print the total number of pages.
`%n' -- Print the current filename.
`%N' -- Print the current function name.
`%l' -- Print the username of the current user.
Default Values are:
- `left-header' `%L'
`center-header' `%N'
`right-header' `Page %P of %F'
`left-footer' `%L'
`center-footer' `%n %p'
`right-footer' `Page %P of %F'
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). However there are some special features for some of the
languages:
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.
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.
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.
By default Trueprint uses environment variables and the current
username.
- PRINTER
- Specify the printer to use when sending postscript output to the
printer.
- TP_OPTS
- Specify options. These options override any default options including
language defaults, but are 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 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 stdout.
- 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.
The program was written by Lezz Giles. Please send bug reports to
<bug-trueprint@gnu.org> and ideas for enhancement or similar things to
<enhance-trueprint@gnu.org>. The manpage was written by Othmar Pasteka
<othmar@tron.at>.