cyosta@taux01.UUCP ( Yossie Silverman ) (07/12/89)
I once wrote a program to generate an "load-average" plot for a UNIX system.
This program now runs on many machines, each one producing a single page plot.
We run the program with the 'rsh' interface from one computer catching the
output from each into the same file which is then sent to the LaserWriter
for output. The problem was that we were generating 70+ pager per run, which
was wasteful and unmanagable. Since we are getting even more computers (work
stations) in the near future, we had to find a solution. The soltution was to
cram 9 plots into a single page. The problem with this was we wanted to do it
without changing the C program that generates the postscript data. The way
I did it was to override a few of the PostScript operators with my own
procedures. I based this on the fact that I had exactely one 'clippath' call
at the start of a single page output and either 'showpage' or 'erasepage
initgraphics' at the end. The following code will do what is needed. The
only thing to make note of is that 'showpage' should be called an extra
8 times at the end of the postscript in order to flush the last page (anyone
have a better idea? Something that could be set up at the start to trap
the 'end-of-job' condition?).
- Yossie
---
% place this code segment before the collection of output pages.
% place a file with eight 'showpage's at the end.
/Initgraphics {initgraphics} bind def
/initgraphics {} def
/Erasepage {erasepage} bind def
/erasepage {Clippath pathbbox 1 setgray fill} def
/Showpage {showpage} bind def
/showpage {
Which 1 add 9 mod dup /Which exch def
0 eq {Showpage} if
} def
/Clippath {clippath} bind def
/clippath {
Initgraphics 1 3 div dup scale
Clippath pathbbox
2 index sub 3 div dup 5 1 roll 2 Which 3 mod sub mul exch
3 index sub 3 div dup 6 1 roll 2 Which 3 idiv sub mul exch
translate translate 2 copy
newpath 0 0 moveto 0 exch lineto exch lineto 0 lineto 0 0 lineto clip
} def
/Which 0 def
--
Yossie Silverman What did the Caspian sea?
National Semiconductor Ltd. (Israel)
cyosta%taux01@nsc.nsc.COM or RPR1YOS@TECHNION.BITNET
NSA LSD FBI KGB PCP CIA MOSAD NUCLEAR MI5 SPY ASSASSINATE SDI -- OOCLAY ITAYamanda@intercon.uu.net (Amanda Walker) (07/12/89)
In article <2148@taux01.UUCP>, cyosta@taux01.UUCP ( Yossie Silverman ) writes: > The > only thing to make note of is that 'showpage' should be called an extra > 8 times at the end of the postscript in order to flush the last page (anyone > have a better idea? Something that could be set up at the start to trap > the 'end-of-job' condition?). How about adding a definition along the lines of: /Flushpages { Which 0 neq { Showpage } if } def This does a "real" showpage if the last page hasn't. -- Amanda Walker InterCon Systems Corporation -- amanda@intercon.uu.net | ...!uunet!intercon!amanda
cyosta@taux01.UUCP ( Yossie Silverman ) (07/13/89)
In article <1265@intercon.UUCP> amanda@intercon.uu.net (Amanda Walker) writes: .In article <2148@taux01.UUCP>, cyosta@taux01.UUCP ( Yossie Silverman ) writes: .> The .> only thing to make note of is that 'showpage' should be called an extra .> 8 times at the end of the postscript in order to flush the last page (anyone .> have a better idea? Something that could be set up at the start to trap .> the 'end-of-job' condition?). . .How about adding a definition along the lines of: . ./Flushpages { Which 0 neq { Showpage } if } def . .This does a "real" showpage if the last page hasn't. . .-- .Amanda Walker .InterCon Systems Corporation .-- .amanda@intercon.uu.net | ...!uunet!intercon!amanda And is about as long as typing 'showpage' 8 times. No, I am looking for something that can set at the START of the header and will take effect at the END of the job. It's not really that important... - Yossie -- Yossie Silverman What did the Caspian sea? National Semiconductor Ltd. (Israel) cyosta%taux01@nsc.nsc.COM or RPR1YOS@TECHNION.BITNET NSA LSD FBI KGB PCP CIA MOSAD NUCLEAR MI5 SPY ASSASSINATE SDI -- OOCLAY ITAY