Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_1_19910112
-
5-galaxy/postscript/two_up.ps
There are no other files named two_up.ps in the archive.
%!
% Routine to convert straight text files to two up.
% output headers if defined.
% Inputs:
% File_Name - String to placed in Header line (filename)
% date - Date String
% time - Time string
% page - Starting page number (Optional)
%
/in. {72 mul} def
/line 512 string def % for input line buffering
/buff 10 string def % for page number conversion
/leftmargin where not
{ /leftmargin .75 in. def } {pop} ifelse
/bottom where not
{ /bottom .5 in. def } {pop} ifelse
/startX where not
{ /startX leftmargin def } {pop} ifelse
/startY where not
{ /startY 10.2 in. def } {pop} ifelse
/fontname where not
{ /fontname /Courier def } {pop} ifelse
/pointsize where not
{ /pointsize 11 def } {pop} ifelse
/leading where not
{ /leading pointsize 1 add def } {pop} ifelse
/headerfontname where not
{ /headerfontname /Times-Bold def } {pop} ifelse
/headerpointsize where not
{ /headerpointsize 11 def } {pop} ifelse
/headerfont
headerfontname findfont headerpointsize scalefont
def
/boxfontname where not
{ /boxfontname /Times-Bold def } {pop} ifelse
/boxpointsize where not
{ /boxpointsize 25 def } {pop} ifelse
/boxfont
boxfontname findfont boxpointsize scalefont
def
/center {
stringwidth
pop
2 div
sub
exch
moveto
} def
/determine_size {
gsave
2 copy stringwidth pop
sub
0 le
{currentfont [.95 0 0 .95 0 0] makefont setfont determine_size}
{exch pop center show} ifelse
grestore
} def
/replace_tabs {
( ) search
{mark exch dup show length 8 mod 1 7 {( ) show} for cleartomark
pop replace_tabs}
{show} ifelse
} def
/form_feeds {
(
) search
{replace_tabs pop new_page form_feeds}
{replace_tabs} ifelse
} def
/page where not
{ /page 1 def } {pop} ifelse
/pagenumber where not
{ /pagenumber true def } {pop} ifelse
% This routine will print a header at the top of each page
/printheader {
gsave
currentdict /File_Name known {
.95 setgray
newpath
.75 in. 10.5 in. moveto
.75 in. 10.8 in. lineto
2.0 in. 10.8 in. lineto
2.0 in. 10.5 in. lineto
closepath
fill
.7 setgray
newpath
11.6 in. 10.5 in. moveto
11.6 in. 10.8 in. lineto
12.85 in. 10.8 in. lineto
12.85 in. 10.5 in. lineto
closepath
fill
.985 setgray
newpath
2.0 in. 10.5 in. moveto
2.0 in. 10.7 in. lineto
11.6 in. 10.7 in. lineto
11.6 in. 10.5 in. lineto
closepath
fill
0 setgray
headerfont setfont
date 10.67 in. 1.35 in. 108 date determine_size
time 10.53 in. 1.35 in. 108 time determine_size
File_Name 10.55 in. 6.4 in. 550 File_Name determine_size
} if
pagenumber {
1 setgray
boxfont setfont
page buff cvs dup 10.54 in. exch 12.2 in. exch 90 exch determine_size
0 setgray
} if
grestore
startX startY moveto %printheader % execute header
} bind def
/new_page {
/page page 1 add def
page 2 mod 0 eq
{0 -790 translate printheader}
{showpage 0 395 translate .6 .5 scale printheader} ifelse
} def
/crlf {
leftmargin currentpoint exch pop % replace X with leftmargin
leading sub
dup bottom le
{ pop pop new_page}
{ moveto } ifelse
} bind def
/printfile {
line readline % read a line from the file
{ % 'if' procedure body (+boolean)
{ % 'while' procedure body
form_feeds crlf % show what's left by readline
currentfile cvlit % use as operand
line readline % and read the next line
not {currentpoint exit} if % exit if no more input to be had
} loop % end of while-proc
} if
showpage % when input file is exhausted
} bind def % /printfile
fontname findfont pointsize scalefont setfont
0 395 translate
.6 .5 scale
printheader
currentfile cvlit % uses rest of this file as input
printfile