1*32183Sedward .\" @(#)psgrind.l 1.1 09/15/87 2*32183Sedward .TH PSGRIND 1 3*32183Sedward .ds PS P\s-2OST\s+2S\s-2CRIPT\s+2 4*32183Sedward .SH NAME 5*32183Sedward psgrind \- convert C source files to P\s-2OST\s+2S\s-2CRIPT\s+2 format for printing 6*32183Sedward .SH SYNOPSIS 7*32183Sedward .B psgrind 8*32183Sedward [ 9*32183Sedward .I options 10*32183Sedward ] [ 11*32183Sedward .I files 12*32183Sedward ] 13*32183Sedward .SH DESCRIPTION 14*32183Sedward .I psgrind 15*32183Sedward reads in C source files, converts them to \*(PS format, and spools them for 16*32183Sedward printing on a \*(PS printer. The different fonts used for the different 17*32183Sedward syntactic elements of C source code may be specified on the command line. 18*32183Sedward .I Psgrind 19*32183Sedward is also much faster than any other grind program since it outputs a 20*32183Sedward direct printer language without going through a normal document formatter 21*32183Sedward as other pretty source printers must. 22*32183Sedward .sp 23*32183Sedward The five syntactic categories that 24*32183Sedward .I psgrind 25*32183Sedward recognizes and displays in different ways are page headings (which are 26*32183Sedward actually not part of the C source code), the ``body'' or main text, 27*32183Sedward keywords, which are C reserved words, literal strings and comments. 28*32183Sedward Normally, the heading and keywords are set in a bold Helvetica font, 29*32183Sedward the comments in a slanted Helvetica font, the body in a normal Helvetica 30*32183Sedward font and literal strings and character constants in Courier font. 31*32183Sedward .sp 32*32183Sedward All the above fonts may be changed, see the 33*32183Sedward .BR \-H , 34*32183Sedward .BR \-B , 35*32183Sedward .BR \-K , 36*32183Sedward .BR \-L 37*32183Sedward and 38*32183Sedward .B -C 39*32183Sedward options. 40*32183Sedward All these options take as their argument a font specfication. 41*32183Sedward These font specifications have two parts: 42*32183Sedward A font name as known to \*(PS (e.g., Times-Roman, Times-BoldItalic, 43*32183Sedward Helvetica, Courier), and a 44*32183Sedward point size (1 point = 1/72 inch\-8 point is a good small font). 45*32183Sedward So ``Courier-Bold8'' is 8 point Courier Bold, ``Helvetica12'' is 12 point 46*32183Sedward Helvetica. 47*32183Sedward .sp 48*32183Sedward The environment variable PSGRIND may be used to specify defaults. The 49*32183Sedward value of PSGRIND is parsed as a string of arguments 50*32183Sedward .I before 51*32183Sedward the arguments 52*32183Sedward that appear on the command line. For example setting the 53*32183Sedward environment variable PSGRIND to the string ``-B Times-Roman12'' 54*32183Sedward sets your default body font to 12 point Times Roman. 55*32183Sedward .sp 56*32183Sedward The possible options are: 57*32183Sedward .TP 58*32183Sedward .B \-2 59*32183Sedward Sets two column mode. 60*32183Sedward .TP 61*32183Sedward .B \-1 62*32183Sedward Force one column mode. 63*32183Sedward .TP 64*32183Sedward .B \-g 65*32183Sedward Causes the fact that a file is garbage to be ignored. Normally, any file 66*32183Sedward with more than a small number of non-printing characters is suspected of 67*32183Sedward being garbage, and not printed\-this option means ``print it anyway.'' 68*32183Sedward .TP 69*32183Sedward .B \-o 70*32183Sedward If 71*32183Sedward .I psgrind 72*32183Sedward cannot find characters in a font, the missing characters are listed. 73*32183Sedward .TP 74*32183Sedward .BI \-p " file" 75*32183Sedward Causes the \*(PS file to be written to the named file rather than 76*32183Sedward being spooled for printing. As a special case, 77*32183Sedward .B \-p 78*32183Sedward .B \- 79*32183Sedward will send the \*(PS to the standard output. 80*32183Sedward .TP 81*32183Sedward .B \-r 82*32183Sedward Causes the output to be rotated 90 degrees on the page (landscape mode). 83*32183Sedward This is good for output that requires a wide page or for program listings 84*32183Sedward when used in conjunction with two column mode. 85*32183Sedward ``psgrind -2r 86*32183Sedward .IR files '' 87*32183Sedward is a nice way to get program listings. 88*32183Sedward .TP 89*32183Sedward .B \-R 90*32183Sedward Force portrait (non-rotated) mode. 91*32183Sedward .TP 92*32183Sedward .B \-k 93*32183Sedward Enable page prefeed (if the printer supports it). This allows 94*32183Sedward simple documents (e.g., program listings in one font) 95*32183Sedward to print somewhat faster by keeping the printer 96*32183Sedward running between pages. 97*32183Sedward .TP 98*32183Sedward .BI \-s " pagespec" 99*32183Sedward Allows you to specify a range (or several ranges) of pages to be printed. 100*32183Sedward .I Pagespec 101*32183Sedward is a string, not containing spaces, of the form ``pagerange[,pagespec]''. 102*32183Sedward .I Pagerange 103*32183Sedward may be a single page number or a range 104*32183Sedward of the form ``N-M'' which means print pages N through M. 105*32183Sedward -N means print from the beginning of the docment to page N. 106*32183Sedward M- means print from page M to the end of the document. 107*32183Sedward .TP 108*32183Sedward .BI \-H " font" 109*32183Sedward This allows the respecification of the font used to print running 110*32183Sedward titles listing the source file name and current page number. 111*32183Sedward The option argument to 112*32183Sedward .BR \-H , 113*32183Sedward and the other font options, 114*32183Sedward should be a font specification as described above. 115*32183Sedward .TP 116*32183Sedward .BI \-B " font" 117*32183Sedward This allows one to respecify the font to be used for the main body 118*32183Sedward of the source, that not set specially in another font. 119*32183Sedward .TP 120*32183Sedward .BI \-K " font" 121*32183Sedward This option allows the respecification of the font used to show 122*32183Sedward keywords as separate from normal body text. 123*32183Sedward .TP 124*32183Sedward .BI \-L " font" 125*32183Sedward This option allows the respecification of the font used to show 126*32183Sedward string and character constants (literals) separate from normal body text. 127*32183Sedward .TP 128*32183Sedward .BI \-C " font" 129*32183Sedward This option respecifies the font used to print comment text to 130*32183Sedward show its separateness from normal text. 131*32183Sedward .PP 132*32183Sedward The following options are passed on as is to 133*32183Sedward .I lpr. 134*32183Sedward .TP 135*32183Sedward .BI \-P printer 136*32183Sedward Causes the output to be sent to the named printer. 137*32183Sedward .TP 138*32183Sedward .BI \-# n 139*32183Sedward Causes n copies of the output to be produced. The default is one. 140*32183Sedward .TP 141*32183Sedward .B \-m 142*32183Sedward Causes the printer daemon to send mail upon job completion. 143*32183Sedward .TP 144*32183Sedward .B \-h 145*32183Sedward Suppress the printing of the burst page. 146*32183Sedward .TP 147*32183Sedward .BI \-J " name" 148*32183Sedward Set the job name for use on the burst page. Otherwise, the name of the 149*32183Sedward first input file will be used. 150*32183Sedward .SH ENVIRONMENT 151*32183Sedward .PP 152*32183Sedward .IP PSGRIND 153*32183Sedward string of options to be used by 154*32183Sedward .I psgrind. 155*32183Sedward .IP METRICS 156*32183Sedward path name of a directory to use instead of 157*32183Sedward /usr/lib/ps for font metric files. 158*32183Sedward .IP PRINTER 159*32183Sedward the name of a printer (as in the 160*32183Sedward .B \-P 161*32183Sedward option) for 162*32183Sedward .I lpr 163*32183Sedward to use. If no 164*32183Sedward .B \-P 165*32183Sedward option is specified, 166*32183Sedward .I lpr 167*32183Sedward will use this printer. If 168*32183Sedward .B \-P 169*32183Sedward is not specified and 170*32183Sedward PRINTER is not defined in the environment, 171*32183Sedward .I psgrind 172*32183Sedward will spool to a printer named ``PostScript''. 173*32183Sedward .SH FILES 174*32183Sedward .TP 2.2i 175*32183Sedward /usr/local/lib/ps/*.afm 176*32183Sedward font metrics files. 177*32183Sedward .TP 178*32183Sedward /usr/local/lib/ps/psgrind.pro 179*32183Sedward prologue for 180*32183Sedward .I psgrind 181*32183Sedward \*(PS files. 182*32183Sedward .TP 183*32183Sedward lpr 184*32183Sedward Printer spooler 185*32183Sedward .br 186*32183Sedward .SH "SEE ALSO" 187*32183Sedward enscript(1), lpr(1) 188*32183Sedward .SH AUTHOR 189*32183Sedward John Coker, 190*32183Sedward .br 191*32183Sedward University of California, Berkeley 192*32183Sedward .br 193*32183Sedward This code is based on the 194*32183Sedward .I enscript 195*32183Sedward utility from Adobe Systems, Inc. 196*32183Sedward .fi 197*32183Sedward .SH BUGS 198*32183Sedward If you give the 199*32183Sedward .B \-p 200*32183Sedward argument after the file to be converted, 201*32183Sedward .I psgrind 202*32183Sedward will lie and tell you that the file has been put in the right 203*32183Sedward place, when in fact it is in some obscure temporary file. Always give 204*32183Sedward the 205*32183Sedward .B \-p 206*32183Sedward argument first. 207*32183Sedward .sp 208*32183Sedward Long lines are not truncated in 2 column mode. Line truncation may be 209*32183Sedward off by a little bit as printer margins vary. There should be a 210*32183Sedward ``wrap'' option and multiple (truncated or wrapped) columns. 211*32183Sedward .sp 212*32183Sedward .I Psgrind 213*32183Sedward generates temporary files which are spooled for printing. The temporary file 214*32183Sedward names are used by the spooling software (e.g., 215*32183Sedward .IR lpq ), 216*32183Sedward rather than the symbolic job name passed to 217*32183Sedward .IR lpr . 218*32183Sedward .SH NOTES 219*32183Sedward \*(PS is a trademark of Adobe Systems, Incorporated. 220*32183Sedward .br 221*32183Sedward Times is a trademark of Allied Corporation. 222*32183Sedward .br 223*32183Sedward Helvetica is a registered trademark of Allied Corporation. 224