2 %%BoundingBox: 25 25 290 900
3 %%Title: AMANDA Full Page Label
4 %%Creator: Amanda reporter
9 %% This template file is used by AMANDA to create PostScript dump log
10 %% listings for each run suitable for three-hole punching.
12 %% This prologue is based on one from Steven Freed <sfreed@gilasoft.com>
13 %% called 8.5x11.ps and was enhanced with assistance from Dale Talcott
16 %% John R. Jackson, Technical Software Specialist, jrj@purdue.edu
22 % If you are printing duplex, change the 0 to a 1 in the following line:
28 % The following string (inside the parenthesis) will be displayed as
29 % the "Location" (e.g. organization) on each page (see the page format
33 /LocationString (Magic Software Development, Inc.) def
36 % Set the margin widths. This may need adjustment based on how your
37 % printer defines the printable area on a page.
41 72 mul % one inch == 72 points
44 25.4 div % one inch == 25.4 mm
45 inch % convert inches to points
48 /TopMargin 0.25 inch def
49 /BottomMargin 0.25 inch def
51 /OddLeftMargin 0.625 inch def % 5/8 inch
52 /OddRightMargin 0.25 inch def
55 % even and odd are the same if duplex is not used
56 /EvenLeftMargin OddLeftMargin def
57 /EvenRightMargin OddRightMargin def
59 % otherwise they are reversed
60 /EvenLeftMargin OddRightMargin def
61 /EvenRightMargin OddLeftMargin def
65 % A page is made up of these parts. The base name of the internal variable
66 % related to each is shown in parenthesis:
70 % version of Amanda (Vers)
71 % location (e.g. organisation) (Loc)
73 % statistics (about the Amanda run) (Stat)
74 % message (how to do a restore) (Mess)
75 % header for the filesystem list (Heading)
76 % filesystem list (Host)
78 % Geometrically, an odd numbered page looks like this:
80 % +----+-------------------+
81 % | TAPE_NAME page | <- section 'A'
82 % | version location date | <- section 'B'
83 % +------------------------+
84 % |statistics | message | <- section 'C' | 'F'
85 % +----+--+--------+-------+
86 % | f# hst fs lvl O-KB C-KB| <- section 'D'
87 % +-------+--------+-------+
88 % | | | | <- section 'E'
92 % Even numbered pages look the same unless DoDuplex is turned on, in
93 % which case the "page" field is on the left and the gutter width for
94 % the punch is on the right (instead of the left).
98 % section 'A' fonts and strings
101 /TitleFontSize 24 def % 24 point Helvetica-Bold
103 /Helvetica-Bold findfont
104 TitleFontSize scalefont
107 /PageFontSize 11 def % 11 point Palatino-Bold
109 /Palatino-Bold findfont
110 PageFontSize scalefont
112 /PageString1 (Page ) def
113 /PageString2 ( of ) def
116 % section 'B' fonts and strings
119 /VersFontSize 11 def % 11 point Palatino-Bold
121 /Palatino-Bold findfont
122 VersFontSize scalefont
125 /LocFontSize 12 def % 12 point Helvetica-Bold
127 /Helvetica-Bold findfont
128 LocFontSize scalefont
131 /DateFontSize 11 def % 11 point Palatino-Bold
133 /Palatino-Bold findfont
134 DateFontSize scalefont
141 /StatFontSize 9 def % 9 point Courier
144 StatFontSize scalefont
148 % section 'D' font and strings
151 /HeadingFontSize 9 def % 9 point Palatino-Bold
153 /Palatino-Bold findfont
154 HeadingFontSize scalefont
157 /HeadingFileString (File #) def
158 /HeadingHostString (Host) def
159 /HeadingFsString (File System) def
160 /HeadingLvlString (Level) def
161 /HeadingOSizeString1 (Original) def
162 /HeadingOSizeString2 (File Size (KB)) def
163 /HeadingCSizeString1 (Compressed) def
164 /HeadingCSizeString2 (File Size (KB)) def
170 /HostFontSize 9 def % 9 point Courier
173 HostFontSize scalefont
177 % section 'F' font and strings
180 /MessFontSize 9 def % 9 point Courier
183 MessFontSize scalefont
186 /MessString1 (To restore:) def
187 /MessString2 ( position tape at the start of the file and run:) def
188 /MessString3 ( dd if=$TAPE bs=32k skip=1 | zcat | restore -ibf 2 -) def
189 /MessString4 ( or run:) def
190 /MessString5 ( amrestore -p $TAPE <host> <filesystem> | restore -ibf 2 -) def
193 %% END OF USER-CONFIGURABLE OPTIONS
195 %% The rest of this file contains the internal functions used to draw
196 %% the page and (hopefully) do not need any changes.
200 TitleFont setfont % make TitleFont current
203 PageFont setfont % make PageFont current
206 VersFont setfont % make VersFont current
209 LocFont setfont % make LocFont current
212 DateFont setfont % make DateFont current
215 StatFont setfont % make StatFont current
218 HeadingFont setfont % make HeadingFont current
221 HostFont setfont % make HostFont current
224 MessFont setfont % make MessFont current
228 % apush -- increase an array size by one and push a value on the end
229 % usage: value array apush array
230 % example: /jj 0 array def
231 % /jj (first) jj apush def
232 % /jj (second) jj apush def
233 % /jj (third) jj apush def
237 exch % [ array value ]
238 /.apush exch def % save and pop the value
240 aload % [ old ... array ]
241 length % length of the old array
243 1 add % bump it by one
244 % [ old ... length+1 ]
245 array % create the new array
246 % [ old ... newarray ]
247 .apush exch % [ old ... value newarray ]
248 astore % store the values
254 % usage: llx lly urx ury box -
258 3 index 2 1 add index moveto
259 3 index 0 1 add index lineto
260 1 index 0 1 add index lineto
261 1 index 2 1 add index lineto
267 % concat -- join two strings
268 % usage: str1 str2 concat new
274 length % str2 str1 str1l
275 2 index % str2 str1 str1l str2
276 length add string % str2 str1 new
277 dup dup % str2 str1 new new new
278 4 2 roll % str2 new new str1 new
279 copy % str2 new new (str1)
280 length % str2 new new newl
281 4 -1 roll % new new newl str2
286 % max -- return the max of two numbers
287 % usage: a b max a_or_b
291 1 index 1 index % [ a b a b ]
299 % Set the basic drawable area width and height.
302 clippath % make the clip area the path
303 pathbbox % and get its bounding box
304 % [ llx lly urx ury ]
305 exch % [ llx lly ury urx ]
306 4 1 roll % [ urx llx lly ury ]
307 exch sub % total height
308 TopMargin sub BottomMargin sub % minus the margins
309 /PageHeight exch def % [ urx llx ]
311 EvenLeftMargin sub EvenRightMargin sub % minus the margins
313 newpath % zap the path
316 % Define rectangles to separate the regions.
321 PageHeight % [ llx PageHeight ]
322 TitleFontSize PageFontSize max % 'A' height
323 2 add % space between 'A' and 'B'
324 4 add % space below 'B'
325 VersFontSize LocFontSize max
326 DateFontSize max % 'B' height
327 add % 'A' height+space+'B' height
329 PageWidth % [ llx lly urx ]
330 PageHeight % [ llx lly urx ury ]
334 TitleBox % [ llx lly urx ury ]
335 pop % [ llx lly urx ]
336 3 1 roll dup % [ urx llx lly lly ]
337 StatStrings length % number of status lines
338 StatFontSize mul % height of status lines
339 MessStrings length % number of message lines
340 MessFontSize mul % height of message lines
344 sub % [ urx llx ury lly ]
345 exch % [ urx llx lly ury ]
346 4 -1 roll % [ llx lly ury urx ]
347 exch % [ llx lly urx ury ]
351 StatBox % [ llx lly urx ury ]
352 3 1 roll % [ llx ury lly urx ]
353 pop exch % [ llx lly ury ]
354 3 -1 roll % [ lly ury llx ]
361 (nn) stringwidth pop add % left and right padding
363 3 1 roll % [ ly x uy x ]
364 4 1 roll % [ x ly x uy ]
368 StatBox % [ llx lly urx ury ]
369 pop % [ llx lly urx ]
370 3 1 roll dup % [ urx llx lly lly ]
371 HeadingFontSize 2 mul % two heading lines
374 sub % [ urx llx ury lly ]
375 exch % [ urx llx lly ury ]
376 4 -1 roll % [ llx lly ury urx ]
377 exch % [ llx lly urx ury ]
381 HeadingBox % [ llx lly urx ury ]
382 pop % [ llx lly urx ]
383 3 1 roll 0 % [ urx llx lly 0 ]
384 exch % [ urx llx lly ury ]
385 4 -1 roll % [ llx lly ury urx ]
386 exch % [ llx lly urx ury ]
390 % Compute the center point for the section 'A' title text.
394 TitleBox % [ llx lly urx ury ]
395 TitleFontSize sub % [ llx lly urx y ]
396 3 -1 roll % [ llx urx y lly ]
398 3 1 roll % [ y llx urx ]
399 exch dup % [ y urx llx llx ]
400 3 -1 roll % [ y llx llx urx ]
401 exch sub 2 div add % [ y x ]
406 % Compute the position of the odd page string (right adjusted).
410 TitleBox % [ llx lly urx ury ]
411 4 -2 roll % [ urx ury llx lly ]
415 (n) stringwidth pop sub % a little padding
422 % Compute the position of the even page string (left adjusted).
423 % Not used if DoDuplex is off.
427 TitleBox % [ llx lly urx ury ]
428 4 1 roll % [ ury llx lly urx ]
431 (n) stringwidth pop add % a little padding
438 % Compute the position of the version string.
442 TitleBox % [ llx lly urx ury ]
443 pop pop % [ llx lly ]
446 (n) stringwidth pop add % a little padding
452 % Compute the position of the location string (centered).
456 TitleBox % [ llx lly urx ury ]
457 pop % [ llx lly urx ]
458 3 -1 roll % [ lly urx llx ]
459 dup % [ lly urx llx llx ]
460 3 -1 roll % [ lly llx llx urx ]
461 exch sub 2 div add % [ y x ]
467 % Compute the position of the date string (right adjusted).
471 TitleBox % [ llx lly urx ury ]
472 pop % [ llx lly urx ]
473 3 -1 roll % [ lly urx llx ]
476 (n) stringwidth pop sub % a little padding
482 % Compute the position of the top status string.
486 StatBox % [ llx lly urx ury ]
487 exch pop % [ llx lly ury ]
488 dup % [ llx lly ury ury ]
489 3 1 roll % [ llx ury lly ury ]
490 exch sub % [ llx ury box_height ]
491 StatStrings length % number of status lines
492 StatFontSize mul % height of status lines
493 sub 2 div % [ llx ury space_above ]
495 StatFontSize sub % [ llx y ]
499 (n) stringwidth pop add % a little padding
504 % Compute the position of the top message string.
508 CFLine % [ lx ly ux uy ]
509 exch pop % [ lx ly uy ]
510 dup % [ lx ly uy uy ]
511 3 1 roll % [ lx uy ly uy ]
512 exch sub % [ lx uy box_height ]
513 MessStrings length % number of status lines
514 MessFontSize mul % height of status lines
515 sub 2 div % [ lx uy space_above ]
517 MessFontSize sub % [ lx y ]
521 (n) stringwidth pop add % a little padding
526 % Compute the heading positions that start at the left.
530 HeadingBox % [ llx lly urx ury ]
531 pop pop % [ llx lly ]
534 (n) stringwidth pop add % a little padding
536 HeadingFileString stringwidth pop add
537 /HeadingFilePosX exch def % for BuildHost
543 HeadingFilePos % [ x y ]
546 (nn) stringwidth pop add % a little padding
547 HeadingFileString stringwidth pop add
548 dup /HeadingHostPosX exch def % for BuildHost
553 HeadingHostPos % [ x y ]
555 setHostFont % use the host font for sizes
557 (nn) stringwidth pop add % a little padding
558 dup /HeadingFsPosX exch def % for BuildHost
560 setHeadingFont % leave it in the heading font
564 % Compute the heading positions that start at the right (and are right
569 HeadingBox % [ llx lly urx ury ]
570 pop % [ llx lly urx ]
571 3 -1 roll % [ lly urx llx ]
574 (n) stringwidth pop sub % a little padding
575 dup /HeadingCSizePosX exch def % for BuildHost
586 HeadingCSizePos2 % [ x y ]
589 HeadingCSizeString1 stringwidth pop
590 HeadingCSizeString2 stringwidth pop
593 (n) stringwidth pop sub % a little padding
594 dup /HeadingOSizePosX exch def % for BuildHost
604 HeadingOSizePos2 % [ x y ]
607 HeadingOSizeString1 stringwidth pop
608 HeadingOSizeString2 stringwidth pop
611 HeadingLvlString stringwidth pop
612 2 div sub % set up for centering
613 (n) stringwidth pop sub % a little padding
614 dup /HeadingLvlPosX exch def % for BuildHost
619 %% The following functions save strings for each kind of information
620 %% and handle the calls generated by amreport.
624 % DrawStat saves a string in the next position for section 'A'.
627 /StatStrings 0 array def
630 /StatStrings exch % [ /StatStrings value ]
631 StatStrings apush def
635 % DrawMess saves a string in the next position for section 'F'.
638 /MessStrings 0 array def
641 /MessStrings exch % [ /MessStrings value ]
642 MessStrings apush def
652 % DrawTitle saves the title string.
658 /TitleString exch def
662 % DrawDate save the date string.
672 % DrawLoc saves the location string. Amreport does not generate this
673 % call and the initial value has been set at the start of this file
674 % in the user-changeable area.
678 /LocationString exch def
682 % DrawVers saves the Amanda version string.
685 /VersionString () def
688 /VersionString exch def
692 % DrawHost expects six strings on the stack:
701 % They are saved for processing by the final showpage.
704 /HostStrings 0 array def
709 5 index % copy of host name
712 /HostNameWidth exch def % find maximum host name width
713 6 array astore % convert args to an array
714 /HostStrings exch % [ /HostStrings value ]
715 HostStrings apush def
719 %% Functions used during actual page drawing.
723 % Center a string on the current point.
733 % Right justify a string on the current point.
737 dup % [ (str) (str) ]
738 stringwidth pop % [ (str) width ]
743 % The main page drawing function called when a new page is started.
750 % translate to leave room for the margins
752 PageCount 2 mod 1 eq {
757 BottomMargin translate
761 currentgray % save the gray value
762 0 setgray % turn off gray
763 currentlinewidth % save the current line width
764 2 setlinewidth % thick lines
768 HeadingBox box stroke
770 CFLine moveto lineto stroke
772 setlinewidth % restore the line width
773 setgray % restore the gray value
783 % draw the page number string
787 32 string % big enough for the number
788 cvs % convert the number
789 PageString1 exch concat % (Page NN)
790 PageString2 concat % (Page NN of )
791 PageMaxString concat % (Page NN of MM)
792 PageCount 2 mod 1 eq {
804 /PageCount PageCount 1 add def % bump the page counter
806 % draw the version string
821 % draw the date string
829 % draw the status lines
835 exch dup CurrentY moveto
837 /CurrentY CurrentY StatFontSize sub def
839 pop % get rid of the X value
847 exch dup CurrentY moveto
849 /CurrentY CurrentY MessFontSize sub def
851 pop % get rid of the X value
856 HeadingFilePos moveto
859 HeadingHostPos moveto
869 HeadingOSizePos1 moveto
873 HeadingOSizePos2 moveto
877 HeadingCSizePos1 moveto
881 HeadingCSizePos2 moveto
886 % reset the host position variables
888 HeadingBox % [ llx lly urx ury ]
889 pop pop exch pop % [ lly ]
895 % Build the host line on the page.
900 HeadingCSizePosX CurrentY moveto
902 show % compressed size
903 HeadingOSizePosX CurrentY moveto
906 HeadingFilePosX CurrentY moveto
908 show % tape file number
909 HeadingLvlPosX CurrentY moveto
911 HeadingFsPosX CurrentY moveto
913 HeadingHostPosX CurrentY moveto
916 HostCount 0 gt { % if not at end of page
917 currentlinewidth % save the line width
918 .25 setlinewidth % thin lines
921 dup % keep this CurrentY
922 HostFontSize 2 add sub
923 /CurrentY exch def % update CurrentY for next host
925 2 sub % move down a little
929 PageWidth exch % [ PageWidth y ]
931 setlinewidth % restore the line width
936 % Magic time -- the input consists of lots of calls to the /DrawXXX
937 % functions, which gather the text into memory. It ends with a showpage,
938 % which we hook here to do all the real imaging after everything has
939 % been collected. The only reason to do all this is so we can know
940 % how many pages will be generated for the "Page N of M" line.
943 25 dict begin % emperically enough entries
944 /*showpage /showpage load def % rename showpage to *showpage
947 HostBox % [ llx lly urx ury ]
948 exch pop % [ llx lly ury ]
949 exch sub % [ llx height ]
950 exch pop % [ height ]
951 cvi % idiv requires integers
953 2 add % space below each line
954 idiv % hosts per page
959 /HostCount exch def % initialize the counter
961 dup % [ HostMax HostMax ]
962 HostStrings length % number of hosts
963 add 1 sub exch idiv % number of pages
965 /PageMaxString exch def
967 /HavePage 0 def % flag that page is built
970 aload pop % put host strings on the stack
971 HostCount HostMax eq {
972 BuildPage % time to build a new page
975 /HostCount HostCount 1 sub def
976 BuildHost % build this host line
978 *showpage % time to dump a page
980 /HostCount HostMax def
985 *showpage % dump the last page
988 % Clean up. Ideally this would be in the page epilog,
989 % but reporter.c only emits the "showpage".
990 end % end the dict in which this
991 % showpage redefinition lives
992 pageSave restore % free up memory
996 % Normally there would be an "end" here to match the "begin" for our
997 % dictionary, but we want to leave it on top of the dictionary stack
998 % so the final showpage runs our showpage replacement.
1002 %% END OF TEMPLATE FILE