MAN page from PLD c2ps-4.0-2.i586.rpm
C2PS
Section: User Commands (1)
Updated: 15 May 1997
Index NAME
c2ps - converts a file with C/C++ code to Postscript
SYNOPSIS
c2ps[
-?h124abceikmnruvwx] [
-F defaultfont] [
-C commentfont] [
-K keywordfont] [
-N lnumberfont] [
-P preprocfont] [
-S stringfont] [
-T typefont] [
-U functionfont] [
-X nonlatinfont] [
-d dim] [
-f fontsize] [
-l lines] [
-p paper] [
-o outputfile] [
-s space] [
-t tabsize] [
-_ fun_highlight] [
-DPREPROC_VAR ...] [
-UPREPROC_VAR ...] [
file ...]
DESCRIPTION
Converts the specified file(s) containing C/C++ code to Postscript outputconforming to the Adobe Structuring Conventions.
If no input file is specified then input is accepted from stdin.Postscript output is directed to stdout unless you specifyan output file.The actual output page may be out with one, two or four columns.
Supported paper types are A4 and Letter.
Tabs in the input stream are expanded (by default) by blank characters to theclosest modulo 8 position. You can specify your ownconstant number of blanks different from 8 for a tab to expand.
A formfeed (^L) character makes the converter move to the next column.
By default, C/C++ constructs are highlighted with following standard fontspresented on every Postscript printer:
Preprocessor directives Courier-BoldOblique
Comments Helvetica-Oblique
Strings Courier-Oblique
Keywords Courier-Bold
Line numbers Times-Roman
Types Courier-Bold
Function identificators Bookman-LightItalic
The rest is printed with Courier (default font). If highlighting is disabledonly the default font is used to print the read code (but not line numbers).
Comments may be printed dimmed to a configurable degree in a way that allowsreader to concentrate mainly on the source itself referring to comments onlywhen needed.
c2ps has basic preprocessor capabilities. You may define/undefinepreprocessor variables in the command line.c2ps will neglect those pieces of code that are cut out by the preprocessorgiven a set of mentioned variables.
By default, on each column c2ps draws an alphabetic index of all function iddefinitions with locations, scanned from the beginning of the file being printed.As the number of these id's grows the font used to print the index may getsmaller in order to accommodate all the entries.
Occasionally, function index is drawn upon already printed source code.To cope with this you can either cancel the index option or use smaller fonts.
All the read symbols with codes 128..255 (0x80..0xff) are printed escapedso that c2ps output is all clean 7-bit ascii and can be sentover the Internet without uuencoding.
You can easily print source including fragments in Cyrillic, Hebrew, Arabic etc.which may be found in string and/or comments if you're printing C/C++ code andanywhere otherwise. You just need a postscript font with encoding correspondingto the one that is used in the above fragments. If there's no suitable built-infont in your PS printer you will have to prepend one to c2ps output.
If the symbols from the both halves of the code table are implemented in your PSfont, you may simply use it to print any constructs that include 8-bit text (don't forget to disable ISO Latin 1 font reencoding).Otherwise, with only upper half symbols (with codes > 127(0x7f)) implemented,there is an option to set a font to print specifically these symbols leavingthe rest to be printed by either default or newly set fonts.
Also, as much as we know there exists a version of c2ps modified to supportChinese (Hanja) and Korean (Hangul). An address of the implementor ison the c2ps web page.
This is a manual page for c2ps ver4.0
OPTIONS
- -? -h
- Print usage message.
- -1
- Specify single column per page output - default (portrait).
- -2
- Specify two columns per page output (1/2 size, landscape).
- -4
- Specifiy four columns per page output (1/4 size, portrait).
- -a
- Disable adjusted multiple lines comments printing.
- -b
- Disable drawing a box containing alphabetic index of functionsscanned from the beginning of the file.
- -c
- Disable C/C++ construct highlighting.
- -e
- Disable printing entry/exit function name in the column's header.
- -i
- Disable ISO 8859-1 (ISO Latin 1) character encoding.
- -k
- Use standard set of keywords rather than extended one.
- -m
- When printing a file use the date of printing instead of file'slast modification date.
- -n
- Disable line numbering.
- -r
- Draw a frame round each column.
- -u
- Disable drawing header at the top of each column.
- -v
- Print current version.
- -w
- Disable wrapping too wide lines onto following lines.Note, that when wrapping is enabled the maximum number of characters in line printed with anyfont is the number of the same point size Courier characters that may appear in single linewithout crossing column's border.
- -x
- Automatically toggle C/C++ highlight flag for each file according to its extension.( Applicable extensions include .c .h .cc .hh .cpp .hpp )
- -F defaultfont
- Use defaultfont as default font.
- -C commentfont
Use commentfont to print comments.- -K keywordfont
- Use keywordfont to print keywords.
- -N lnumberfont
- Use lnumberfont to print line numbers.
- -P preprocfont
- Use preprocfont to print preprocessor directives.
- -S stringfont
- Use stringfont to print strings.
- -T typefont
- Use typefont to print types.
- -U functionfont
- Use functionfont to print function identificators being defined.
- -X nonlatinfont
- Use nonlatinfont to print all symbols with codes > 127(0x7f). ISO Latin 1 encoding is automatically cancelled.
- -d dim
- Print comments dimmed with the coefficientdim.
( black: 0.0 <= dim <= 1.0 :white ). Default is 0.75.So you can actually get rid of the comments in your printout by setting dim coef. to 1.0 - -f pointsize
- Use pointsize -scaled fonts ( 10 - default ).
- -l lines
- Make converter start a new column after each set oflinesprinted lines. You may want to use the resulted at the bottom of the columnwhite space for notes if the space on the right is not sufficient.
- -p paper
- Paper type specification ( A4 - default, Letter ).
- -s points
- Leavepoints * 1/72 inch space between lines ( 0.0 - default ).
- -t tabsize
- Expand each read tab with blanks to a next modulotabsize position ( 8 - default ).
- -_ fun_highlight
- Specify function id highlighting type ( none, box, underline - default ).
- -DPREPROC_VAR
- -UPREPROC_VAR
- You may define or undefine preprocessor variables in a standardcompiler option fashion.
Below:
+/-: printed/not printed by c2ps
column 1: for variable X not mentioned in command line
column 2: for variable X defined
column 3: for variable X undefined
1 2 3
+ - - #ifdef X
+ + - C/C++ code (+ preprocessor directives)
+ - - #else
+ - + C/C++ code (+ preprocessor directives)
+ - - #endif
Similarly for #ifndef, just switch columns 2 and 3.
EXAMPLES
Multiple files
c2ps *.c *.h | lpr
Ordinary text
c2ps note.txt -c -n -u > note.ps
ISO Latin 1 font reencoding by default
c2ps -2 -c -n -F Times-Roman german.txt > german.ps
A different look
c2ps -F Times-Roman -C Palatino-BoldItalic -K Times-Bold
-N Helvetica -P Helvetica-Bold -S Times-Italic
-T Times-BoldItalic -_ box -w sample.c > sample.ps
An option set looking better on low resolution printers
c2ps -d 0 -C Palatino-Italic main.cc > main.ps
Partial preprocessing, selective printing
c2ps -DDEBUG -DSUN_SPECIFIC -UPRINT *.cc | lpr
Temporarily commented out code (still looks like a part of the codebut a little bit dimmed)
c2ps -C Courier -d 0.5 temp.c -o temp.ps
Getting rid of comments
c2ps -_ box -d 1 main.cc | lpr
Printing 8-bit text (e.g. Cyrillic, koi-8 encoding)
c2ps -i -C Antique-Italic -S Antique koi8.cc > tmp
cat Antique-Italic.pfa Antique.pfa tmp | lpr
c2ps -i -c -n -F Antique koi8.cc > tmp
cat Antique.pfa tmp | lpr
c2ps -X Cyrillic-Italic-koi8 koi8.cc > tmp
cat Cyrillic-Italic-koi8.ps tmp | lpr
BUGS
c2ps is generally quite stable. Howerver, if you encounter any problemusing it, please, send a report to:
c2psAATTgeocities.com
Last version of c2ps is located at
http://www.geocities.com/SiliconValley/Park/2055/
SEE ALSO
enscript, vgrind, troff, pprint, a2ps
ACKNOWLEDGEMENTS
We would like to thank Prof. Daniel Berry of the Technion who has supervisedthis project at its beginning for numerous most useful recommendations.Also, we are very thankful for many suggestions, proposals and of coursebug reports that have been received.
AUTHORS
Dmitri Shtilman
Dmitri Makarov
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- EXAMPLES
- BUGS
- SEE ALSO
- ACKNOWLEDGEMENTS
- AUTHORS
This document was created byman2html,using the manual pages.