Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 5-galaxy/postscript/fix_file.ps
There are no other files named fix_file.ps in the archive.
%!
% Routine to convert straight text files.
% 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 printheader showpage startX startY moveto form_feeds}
	{replace_tabs} ifelse
    } def

/page where not
    { /page 1 def } {pop} ifelse
/pagenumber where not
    { /pagenumber true def } {pop} ifelse
/printheader {
    gsave
	currentdict /File_Name known {
	    .8 setgray
	    newpath    
	    .25 in. 10.5 in. moveto    
	    .25 in. 10.85 in. lineto    
	    1.5 in. 10.85 in. lineto    
	    1.5 in. 10.5 in. lineto    
	    closepath    
	    fill
	    newpath    
	    7 in. 10.5 in. moveto    
	    7 in. 10.85 in. lineto    
	    8.25 in. 10.85 in. lineto    
	    8.25 in. 10.5 in. lineto    
	    closepath    
	    fill
	    .95 setgray
	    newpath    
	    1.5 in. 10.5 in. moveto    
	    1.5 in. 10.7 in. lineto    
	    7 in. 10.7 in. lineto    
	    7 in. 10.5 in. lineto    
	    closepath    
	    fill
	    0 setgray
	    headerfont setfont
	    date 10.7 in. .85 in. 90 date determine_size
	    time 10.55 in. .85 in. 90 time determine_size
	    File_Name 10.55 in. 4.1 in. 350 File_Name determine_size
	} if
    pagenumber {
    	1 setgray
    	boxfont setfont
    	page buff cvs dup 10.55 in. exch 7.6 in. exch 90 exch determine_size
    	/page page 1 add def
    	0 setgray
    } if
    grestore

} bind def
/crlf {
    leftmargin currentpoint exch pop	% replace X with leftmargin
    leading sub
    dup bottom le
    { pop pop printheader showpage    startX startY moveto}
    { 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
    startY sub 0 lt
    { printheader showpage}if	% when input file is exhausted
} bind def			% /printfile
fontname findfont pointsize scalefont setfont
    startX startY moveto	%printheader		% execute header
currentfile cvlit	% uses rest of this file as input
printfile