3 # Copyright (c) International Business Machines Corp., 2002
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or (at
8 # your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # This script generates a postscript file from output generated from the
23 # fcgp http://sourceforge.net/projects/fcgp/ for plotting
27 # 2003-09-04 wrote - James M Kenefick Jr. <jkenefic@us.ibm.com>
32 # a good deal of this could be turned in to cli
36 my $Title = "Linux Kernel Coverage";
37 my $KernelVersion = "2.5.73";
38 my $TestDescription = "A Sample Print";
39 my $Image = "../lgp/image.ps";
43 # Paper sizes in inches
45 my $PAPER_HEIGHT = 42;
52 my $BottomMargin = 1.5;
57 $RightMargin = $PAPER_WIDTH - $RightMargin;
58 $TopMargin = $PAPER_HEIGHT - $TopMargin;
60 my $filename = "poster.ps";
63 my $PPI_WIDTH = ($PAPER_WIDTH * $ppi);
64 my $PPI_HEIGHT = ($PAPER_HEIGHT * $ppi);
66 # Date we create poster
69 print STDERR
"Creating Poster\n";
71 open POSTER
, ">$filename";
75 print(POSTER
<<END_OF_USAGE);
77 %%DocumentFonts: Helvetica Helvetica-Bold
78 %%Title: Linux 2.4.0 Kernel Poster
79 %%Creator: Rusty's scripts and postersize (GPL)
82 %%BoundingBox: 0 0 $PPI_WIDTH $PPI_HEIGHT
85 /PRorig_showpage_x178313 /showpage load def /showpage{
86 errordict /handleerror {} put
88 /initgraphics{}def/setpagedevice{pop}def
89 statusdict begin /a4tray{}def /lettertray{}def end
90 /a4{}def/a3{}def/a0{}def/letter{}def/legal{}def
91 /a4small{}def /lettersmall{}def /a4tray{}def /lettertray{}def
92 /setscreen{pop pop pop}def
93 /ColorManagement {pop} def
96 /A {gsave newpath 0 360 arc stroke grestore} bind def
99 /D {[] 0 setdash} bind def
100 /D5 {[5] 0 setdash} bind def
101 /C0 {0 0 0 setrgbcolor} bind def
102 /C1 {.8 .4 .4 setrgbcolor} bind def
103 /C2 {.5 1 .5 setrgbcolor} bind def
104 /C3 {0 .7 0 setrgbcolor} bind def
105 /C4 {1 0 0 setrgbcolor} bind def
106 /C5 {0 0 1 setrgbcolor} bind def
107 /R {grestore} bind def
108 /S {0 0 M stroke} bind def
109 /T {gsave translate} bind def
110 /U {C0 newpath 4 copy 4 2 roll 8 7 roll M L L L closepath stroke
111 C1 findfont exch scalefont setfont M show} bind def
113 % Added James M Kenefick Jr.
114 /Hi_Color {0 0 1} def
115 /Med_Color {0 .60 1} def
116 /Lo_Color {0 1 1} def
117 /None_Color {.75 .75 .75} def
118 /Hi {newpath 4 copy 4 2 roll 8 7 roll M L L L Hi_Color setrgbcolor fill closepath} bind def
119 /Med {newpath 4 copy 4 2 roll 8 7 roll M L L L Med_Color setrgbcolor fill closepath} bind def
120 /Lo {newpath 4 copy 4 2 roll 8 7 roll M L L L Lo_Color setrgbcolor fill closepath} bind def
121 /None {newpath 4 copy 4 2 roll 8 7 roll M L L L None_Color setrgbcolor fill closepath} bind def
129 /LeftMargin $LeftMargin inch def
130 /RightMargin $RightMargin inch def
131 /TopMargin $TopMargin inch def
132 /BottomMargin $BottomMargin inch def
134 /AuthorFontScale 70 def
141 RightMargin LeftMargin sub 2 div
152 NextLine LineSpace2 add
160 NextLine LineSpace sub
167 TopMargin BottomMargin sub FontScale div
173 TopMargin BottomMargin sub AuthorFontScale div
181 RightMargin 1 inch sub
190 TopMargin LineSpace 3 mul sub BottomMargin sub
196 RightMargin LeftMargin sub
200 /Times-Roman findfont fontScale scalefont setfont
201 /LineSpace fontScale def
202 /NextLine (B) stringwidth pop TopMargin exch sub def
208 ($Title) centerText advanceLine
209 (Kernel: $KernelVersion) centerText advanceLine
210 ($TestDescription) centerText
213 LeftMargin BottomMargin translate
214 /Times-Roman findfont authorfontScale scalefont setfont
215 /LineSpace2 authorfontScale def
217 (Based on work by Rusty Russell, Christian Reiniger) rightJustify
219 (By James M. Kenefick Jr.) rightJustify
222 LeftMargin BottomMargin translate
226 % This is the key for the graph.
228 /box { newpath moveto 0 1 rlineto 2 0 rlineto 0 -1 rlineto closepath } def
229 /key { setrgbcolor 2 copy box gsave fill grestore 0 0 0 setrgbcolor strokepath fill moveto 2.4 0.25 rmoveto show } def
231 /Helvetica-Oblique findfont
235 (static functions) 1 5 0.5 1 0.5 key % Light green.
236 (indirectly called functions) 1 7 0 0.7 0 key % green
237 (exported functions) 1 9 1 0 0 key % red
238 (other functions) 1 11 0 0 1 key % blue
240 (Low Coverage) 1 15 Lo_Color key % blue
241 (Medium Coverage) 1 17 Med_Color key % blue
242 (Hi Coverage) 1 19 Hi_Color key % blue
243 (No Coverage) 1 21 None_Color key % blue
245 0.8 0.4 0.4 setrgbcolor
252 /Helvetica-Oblique findfont
257 0.8 0.4 0.4 setrgbcolor
258 /Helvetica-Bold findfont
264 /Helvetica-Oblique findfont
266 (source filename) show
269 /Helvetica-Bold findfont
283 1 15 div 1 15 div scale
285 % find and move to center
288 # Find the bounds for the image
290 $Bounds = `tail -1 $Image`;
291 ($Junk, $Junk, $minX, $minY, $maxX, $maxY) = split / /, $Bounds;
293 my $xRange = $maxX - $minX;
294 my $yRange = $maxY - $minY;
296 if ($xRange < $yRange){
301 print POSTER " 0 usableY usableX sub 2 div translate\n";
302 print POSTER "usableX $Range div usableX $Range div scale\n";
303 print POSTER "$Range 2 div $Range 2 div translate\n";
304 print POSTER "gsave\n";
305 # Paste in actual image.
306 print POSTER `cat /home/lgp/image.ps`;
307 print POSTER "%%Trailer\n";
308 print POSTER "grestore\n";
309 print POSTER "showpage\n";
310 print POSTER "PRorig_showpage_x178313\n";
311 print POSTER "/showpage /PRorig_showpage_x178313 load def\n";