Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 5-galaxy/postscript/book.ps
There is 1 other file named book.ps in the archive. Click here to see a list.
%!-Adobe-1.0
% Routine to convert straight text files to "book" output (aka Imagen)
% 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 .5 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
/top  {startY leading sub} def
/headerfontname where not
    { /headerfontname /Courier-Bold def } {pop} ifelse
/headerpointsize where not
    { /headerpointsize 9 def } {pop} ifelse
/headerfont
    headerfontname findfont headerpointsize scalefont
def
/page where not
    { /page 1 def } {pop} ifelse
/pagenumber where not
    { /pagenumber true def } {pop} ifelse

/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			%get rid of the width
	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
% This routine will print a header at the top of each page
/printheader {
    gsave
	currentdict /File_Name known {
	    .9 setgray
	    newpath    
	    .75 in. 10.4 in. moveto    
	    .75 in. 10.7 in. lineto    
	    2 in. 10.7 in. lineto    
	    2 in. 10.4 in. lineto    
	    closepath    
	    fill
	    .6 setgray
	    newpath    
	    6 in. 10.4 in. moveto    
	    6 in. 10.7 in. lineto    
	    7.25 in. 10.7 in. lineto    
	    7.25 in. 10.4 in. lineto    
	    closepath    
	    fill
	    .985 setgray
	    newpath    
	    2 in. 10.4 in. moveto    
	    2 in. 10.6 in. lineto    
	    6 in. 10.6 in. lineto    
	    6 in. 10.4 in. lineto    
	    closepath    
	    fill
	    0 setgray
	    headerfont setfont
	    date 10.55 in. 1.35 in. 90 date determine_size
	    time 10.43 in. 1.35 in. 90 time determine_size
	    File_Name 10.45 in. 4.1 in. 280 File_Name determine_size
	} if
    pagenumber {
    	1 setgray
    	boxfont setfont
    	page buff cvs dup 10.43 in. exch 6.6 in. exch 90 exch determine_size
    	0 setgray
    } if
    grestore
    startX startY moveto
} bind def
/new_page {
    /page page 1 add def
    page 2 mod 0 eq
    {564 0 translate 1 setgray  newpath 1 1 moveto 1 797 lineto 578 797 lineto
	    		578 1 lineto  closepath  fill 0 setgray printheader}
    {showpage 1 797 translate -90 rotate  .7 .77 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 {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

1 797 translate -90 rotate  .7 .77 scale
printheader		% execute header
currentfile cvlit	% uses rest of this file as input

% everything following 'PrintFile' is treated as data, through EOF
printfile