Imported Upstream version 2.4.5
[debian/amanda] / example / 3hole.ps
1 %!
2 %%BoundingBox: 25 25 290 900
3 %%Title: AMANDA Full Page Label
4 %%Creator: Amanda reporter
5 %%Pages: 1
6 %%EndComments
7
8 %%%%
9 %% This template file is used by AMANDA to create PostScript dump log
10 %% listings for each run suitable for three-hole punching.
11 %%
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
14 %% <aeh@purdue.edu>.
15 %%
16 %% John R. Jackson, Technical Software Specialist, jrj@purdue.edu
17 %%%%
18
19 /pageSave save def
20
21 %%%
22 % If you are printing duplex, change the 0 to a 1 in the following line:
23 %%%
24
25 /DoDuplex 0 def
26
27 %%%
28 % The following string (inside the parenthesis) will be displayed as
29 % the "Location" (e.g. organization) on each page (see the page format
30 % below).
31 %%%
32
33 /LocationString         (Magic Software Development, Inc.) def
34
35 %%%
36 % Set the margin widths.  This may need adjustment based on how your
37 % printer defines the printable area on a page.
38 %%%
39
40 /inch {
41         72 mul                                  % one inch == 72 points
42 } def
43 /mm {
44         25.4 div                                % one inch == 25.4 mm
45         inch                                    % convert inches to points
46 } def
47
48 /TopMargin              0.25 inch def
49 /BottomMargin           0.25 inch def
50
51 /OddLeftMargin          0.625 inch def          % 5/8 inch
52 /OddRightMargin         0.25 inch def
53
54 DoDuplex 0 eq {
55         % even and odd are the same if duplex is not used
56         /EvenLeftMargin OddLeftMargin def
57         /EvenRightMargin OddRightMargin def
58 } {
59         % otherwise they are reversed
60         /EvenLeftMargin OddRightMargin def
61         /EvenRightMargin OddLeftMargin def
62 } ifelse
63
64 %%%
65 % A page is made up of these parts.  The base name of the internal variable
66 % related to each is shown in parenthesis:
67 %
68 %       tape name                               (Title)
69 %       page number                             (Page)
70 %       version of Amanda                       (Vers)
71 %       location (e.g. organisation)            (Loc)
72 %       date                                    (Date)
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)
77 %
78 % Geometrically, an odd numbered page looks like this:
79 %
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'
89 %   |       |        |       |
90 %   v       v        v       v
91 %
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).
95 %%%
96
97 %%%
98 % section 'A' fonts and strings
99 %%%
100
101 /TitleFontSize          24 def                  % 24 point Helvetica-Bold
102 /TitleFont
103         /Helvetica-Bold findfont
104         TitleFontSize scalefont
105 def
106
107 /PageFontSize           11 def                  % 11 point Palatino-Bold
108 /PageFont
109         /Palatino-Bold findfont
110         PageFontSize scalefont
111 def
112 /PageString1            (Page ) def
113 /PageString2            ( of ) def
114
115 %%%
116 % section 'B' fonts and strings
117 %%%
118
119 /VersFontSize           11 def                  % 11 point Palatino-Bold
120 /VersFont
121         /Palatino-Bold findfont
122         VersFontSize scalefont
123 def
124
125 /LocFontSize            12 def                  % 12 point Helvetica-Bold
126 /LocFont
127         /Helvetica-Bold findfont
128         LocFontSize scalefont
129 def
130
131 /DateFontSize           11 def                  % 11 point Palatino-Bold
132 /DateFont
133         /Palatino-Bold findfont
134         DateFontSize scalefont
135 def
136
137 %%%
138 % section 'C' font
139 %%%
140
141 /StatFontSize           9 def                   % 9 point Courier
142 /StatFont
143         /Courier findfont
144         StatFontSize scalefont
145 def
146
147 %%%
148 % section 'D' font and strings
149 %%%
150
151 /HeadingFontSize        9 def                   % 9 point Palatino-Bold
152 /HeadingFont
153         /Palatino-Bold findfont
154         HeadingFontSize scalefont
155 def
156
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
165
166 %%%
167 % section 'E' font
168 %%%
169
170 /HostFontSize           9 def                   % 9 point Courier
171 /HostFont
172         /Courier findfont
173         HostFontSize scalefont
174 def
175
176 %%%
177 % section 'F' font and strings
178 %%%
179
180 /MessFontSize           9 def                   % 9 point Courier
181 /MessFont
182         /Courier findfont
183         MessFontSize scalefont
184 def
185
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
191
192 %%%%
193 %% END OF USER-CONFIGURABLE OPTIONS
194 %%
195 %% The rest of this file contains the internal functions used to draw
196 %% the page and (hopefully) do not need any changes.
197 %%%%
198
199 /setTitleFont {
200         TitleFont setfont                       % make TitleFont current
201 } def
202 /setPageFont {
203         PageFont setfont                        % make PageFont current
204 } def
205 /setVersFont {
206         VersFont setfont                        % make VersFont current
207 } def
208 /setLocFont {
209         LocFont setfont                         % make LocFont current
210 } def
211 /setDateFont {
212         DateFont setfont                        % make DateFont current
213 } def
214 /setStatFont {
215         StatFont setfont                        % make StatFont current
216 } def
217 /setHeadingFont {
218         HeadingFont setfont                     % make HeadingFont current
219 } def
220 /setHostFont {
221         HostFont setfont                        % make HostFont current
222 } def
223 /setMessFont {
224         MessFont setfont                        % make MessFont current
225 } def
226
227 %%%
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
234 %%%
235
236 /apush {
237         exch                                    % [ array value ]
238         /.apush exch def                        % save and pop the value
239                                                 % [ array ]
240         aload                                   % [ old ... array ]
241         length                                  % length of the old array
242                                                 % [ old ... length ]
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
249                                                 % [ newarray ]
250 } def
251
252 %%%
253 % box -- draw a box
254 % usage:        llx lly urx ury box -
255 %%%
256
257 /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
262         pop pop pop pop
263         closepath
264 } def
265
266 %%%
267 % concat -- join two strings
268 % usage:        str1 str2 concat new
269 %%%
270
271 /concat {
272         exch                                    % str2 str1
273         dup                                     % str2 str1
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
282         putinterval                             % new
283 } bind def
284
285 %%%
286 % max -- return the max of two numbers
287 % usage:        a b max a_or_b
288 %%%
289
290 /max {
291         1 index 1 index                         % [ a b a b ]
292         lt {
293                 exch                            % [ b a ]
294         } if
295         pop
296 } def
297
298 %%%
299 % Set the basic drawable area width and height.
300 %%%
301
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 ]
310 sub                                             % total width
311 EvenLeftMargin sub EvenRightMargin sub          % minus the margins
312 /PageWidth exch def
313 newpath                                         % zap the path
314
315 %%%
316 % Define rectangles to separate the regions.
317 %%%
318
319 /TitleBox {
320         0                                       % [ llx ]
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
328           sub                                   % [ llx lly ]
329         PageWidth                               % [ llx lly urx ]
330         PageHeight                              % [ llx lly urx ury ]
331 } bind def
332
333 /StatBox {
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
341         max                                     % max height
342         2 add                                   % space above
343         4 add                                   % space below
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 ]
348 } def
349
350 /CFLine {
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 ]
355         setStatFont
356         0
357         StatStrings {
358                 stringwidth pop max
359         } forall
360         add
361         (nn) stringwidth pop add                % left and right padding
362         dup                                     % [ ly uy x x ]
363         3 1 roll                                % [ ly x uy x ]
364         4 1 roll                                % [ x ly x uy ]
365 } def
366
367 /HeadingBox {
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
372         2 add                                   % space above
373         4 add                                   % space below
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 ]
378 } def
379
380 /HostBox {
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 ]
387 } def
388
389 %%%
390 % Compute the center point for the section 'A' title text.
391 %%%
392
393 /TitlePos {
394         TitleBox                                % [ llx lly urx ury ]
395         TitleFontSize sub                       % [ llx lly urx y ]
396         3 -1 roll                               % [ llx urx y lly ]
397         pop                                     % [ llx urx y ]
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 ]
402         exch                                    % [ x y ]
403 } def
404
405 %%%
406 % Compute the position of the odd page string (right adjusted).
407 %%%
408
409 /OddPagePos {
410         TitleBox                                % [ llx lly urx ury ]
411         4 -2 roll                               % [ urx ury llx lly ]
412         pop pop                                 % [ x y ]
413         exch                                    % [ y x ]
414         setPageFont
415         (n) stringwidth pop sub                 % a little padding
416         exch                                    % [ x y ]
417         PageFontSize sub
418         2 sub                                   % space above
419 } def
420
421 %%%
422 % Compute the position of the even page string (left adjusted).
423 % Not used if DoDuplex is off.
424 %%%
425
426 /EvenPagePos {
427         TitleBox                                % [ llx lly urx ury ]
428         4 1 roll                                % [ ury llx lly urx ]
429         pop pop                                 % [ y x ]
430         setPageFont
431         (n) stringwidth pop add                 % a little padding
432         exch                                    % [ x y ]
433         PageFontSize sub
434         2 sub                                   % space above
435 } def
436
437 %%%
438 % Compute the position of the version string.
439 %%%
440
441 /VersPos {
442         TitleBox                                % [ llx lly urx ury ]
443         pop pop                                 % [ llx lly ]
444         exch                                    % [ lly llx ]
445         setVersFont
446         (n) stringwidth pop add                 % a little padding
447         exch                                    % [ x y ]
448         4 add                                   % space below
449 } def
450
451 %%%
452 % Compute the position of the location string (centered).
453 %%%
454
455 /LocPos {
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 ]
462         exch                                    % [ x y ]
463         4 add                                   % space below
464 } def
465
466 %%%
467 % Compute the position of the date string (right adjusted).
468 %%%
469
470 /DatePos {
471         TitleBox                                % [ llx lly urx ury ]
472         pop                                     % [ llx lly urx ]
473         3 -1 roll                               % [ lly urx llx ]
474         pop                                     % [ y x ]
475         setDateFont
476         (n) stringwidth pop sub                 % a little padding
477         exch                                    % [ x y ]
478         4 add                                   % space below
479 } def
480
481 %%%
482 % Compute the position of the top status string.
483 %%%
484
485 /StatPos {
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 ]
494         sub
495         StatFontSize sub                        % [ llx y ]
496         2 add                                   % space above
497         exch                                    % [ y llx ]
498         setStatFont
499         (n) stringwidth pop add                 % a little padding
500         exch                                    % [ x y ]
501 } def
502
503 %%%
504 % Compute the position of the top message string.
505 %%%
506
507 /MessPos {
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 ]
516         sub
517         MessFontSize sub                        % [ lx y ]
518         2 add                                   % space above
519         exch                                    % [ y lx ]
520         setMessFont
521         (n) stringwidth pop add                 % a little padding
522         exch                                    % [ x y ]
523 } def
524
525 %%%
526 % Compute the heading positions that start at the left.
527 %%%
528
529 /HeadingFilePos {
530         HeadingBox                              % [ llx lly urx ury ]
531         pop pop                                 % [ llx lly ]
532         exch                                    % [ y x ]
533         setHeadingFont
534         (n) stringwidth pop add                 % a little padding
535         dup
536         HeadingFileString stringwidth pop add
537         /HeadingFilePosX exch def               % for BuildHost
538         exch                                    % [ x y ]
539         4 add                                   % space below
540 } def
541
542 /HeadingHostPos {
543         HeadingFilePos                          % [ x y ]
544         exch                                    % [ y x ]
545         setHeadingFont
546         (nn) stringwidth pop add                % a little padding
547         HeadingFileString stringwidth pop add
548         dup /HeadingHostPosX exch def           % for BuildHost
549         exch                                    % [ x y ]
550 } def
551
552 /HeadingFsPos {
553         HeadingHostPos                          % [ x y ]
554         exch                                    % [ y x ]
555         setHostFont                             % use the host font for sizes
556         HostNameWidth add
557         (nn) stringwidth pop add                % a little padding
558         dup /HeadingFsPosX exch def             % for BuildHost
559         exch                                    % [ x y ]
560         setHeadingFont                          % leave it in the heading font
561 } def
562
563 %%%
564 % Compute the heading positions that start at the right (and are right
565 % justified).
566 %%%
567
568 /HeadingCSizePos2 {
569         HeadingBox                              % [ llx lly urx ury ]
570         pop                                     % [ llx lly urx ]
571         3 -1 roll                               % [ lly urx llx ]
572         pop                                     % [ lly urx ]
573         setHeadingFont
574         (n) stringwidth pop sub                 % a little padding
575         dup /HeadingCSizePosX exch def          % for BuildHost
576         exch                                    % [ x y ]
577         4 add                                   % space below
578 } def
579
580 /HeadingCSizePos1 {
581         HeadingCSizePos2
582         HeadingFontSize add
583 } def
584
585 /HeadingOSizePos2 {
586         HeadingCSizePos2                        % [ x y ]
587         exch                                    % [ y x ]
588         setHeadingFont
589         HeadingCSizeString1 stringwidth pop
590         HeadingCSizeString2 stringwidth pop
591         max                                     % widest string
592         sub                                     % [ y x ]
593         (n) stringwidth pop sub                 % a little padding
594         dup /HeadingOSizePosX exch def          % for BuildHost
595         exch                                    % [ x y ]
596 } def
597
598 /HeadingOSizePos1 {
599         HeadingOSizePos2
600         HeadingFontSize add
601 } def
602
603 /HeadingLvlPos {
604         HeadingOSizePos2                        % [ x y ]
605         exch                                    % [ y x ]
606         setHeadingFont
607         HeadingOSizeString1 stringwidth pop
608         HeadingOSizeString2 stringwidth pop
609         max                                     % widest string
610         sub                                     % [ y x ]
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
615         exch                                    % [ x y ]
616 } def
617
618 %%%%
619 %% The following functions save strings for each kind of information
620 %% and handle the calls generated by amreport.
621 %%%%
622
623 %%%
624 % DrawStat saves a string in the next position for section 'A'.
625 %%%
626
627 /StatStrings 0 array def
628
629 /DrawStat {
630         /StatStrings exch                       % [ /StatStrings value ]
631         StatStrings apush def
632 } def
633
634 %%%
635 % DrawMess saves a string in the next position for section 'F'.
636 %%%
637
638 /MessStrings 0 array def
639
640 /DrawMess {
641         /MessStrings exch                       % [ /MessStrings value ]
642         MessStrings apush def
643 } def
644
645 MessString1 DrawMess
646 MessString2 DrawMess
647 MessString3 DrawMess
648 MessString4 DrawMess
649 MessString5 DrawMess
650
651 %%%
652 % DrawTitle saves the title string.
653 %%%
654
655 /TitleString () def
656
657 /DrawTitle {
658         /TitleString exch def
659 } def
660
661 %%%
662 % DrawDate save the date string.
663 %%%
664
665 /DateString () def
666
667 /DrawDate {
668         /DateString exch def
669 } def
670
671 %%%
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.
675 %%%
676
677 /DrawLoc {
678         /LocationString exch def
679 } def
680
681 %%%
682 % DrawVers saves the Amanda version string.
683 %%%
684
685 /VersionString () def
686
687 /DrawVers {
688         /VersionString exch def
689 } def
690
691 %%%
692 % DrawHost expects six strings on the stack:
693 %
694 %       Host Name
695 %       Partition Name
696 %       Dump Level
697 %       Tape File Number
698 %       Original Size
699 %       Compressed Size
700 %
701 % They are saved for processing by the final showpage.
702 %%%
703
704 /HostStrings 0 array def
705 /HostNameWidth 0 def
706
707 /DrawHost {
708         setHostFont
709         5 index                                 % copy of host name
710         stringwidth pop
711         HostNameWidth max
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
716 } def
717
718 %%%%
719 %% Functions used during actual page drawing.
720 %%%%
721
722 %%%
723 % Center a string on the current point.
724 %%%
725
726 /Center {
727         dup stringwidth pop
728         2 div
729         neg 0 rmoveto
730 } bind def
731
732 %%%
733 % Right justify a string on the current point.
734 %%%
735
736 /RightJustify {
737         dup                                     % [ (str) (str) ]
738         stringwidth pop                         % [ (str) width ]
739         neg 0 rmoveto
740 } bind def
741
742 %%%
743 % The main page drawing function called when a new page is started.
744 %%%
745
746 /PageCount 1 def
747
748 /BuildPage {
749
750         % translate to leave room for the margins
751
752         PageCount 2 mod 1 eq {
753                 OddLeftMargin
754         } {
755                 EvenLeftMargin
756         } ifelse
757         BottomMargin translate
758
759         % draw the boxes
760
761         currentgray                             % save the gray value
762         0 setgray                               % turn off gray
763         currentlinewidth                        % save the current line width
764         2 setlinewidth                          % thick lines
765
766         StatBox box stroke
767         TitleBox box stroke
768         HeadingBox box stroke
769         HostBox box stroke
770         CFLine moveto lineto stroke
771
772         setlinewidth                            % restore the line width
773         setgray                                 % restore the gray value
774
775         % draw the title
776
777         setTitleFont
778         TitleString
779         TitlePos moveto
780         Center
781         show
782
783         % draw the page number string
784
785         setPageFont
786         PageCount
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 {
793                 OddPagePos moveto
794                 RightJustify
795         } {
796                 DoDuplex 0 eq {
797                         OddPagePos moveto
798                         RightJustify
799                 } {
800                         EvenPagePos moveto
801                 } ifelse
802         } ifelse
803         show
804         /PageCount PageCount 1 add def          % bump the page counter
805
806         % draw the version string
807
808         setVersFont
809         VersionString
810         VersPos moveto
811         show
812
813         % draw the location
814
815         setLocFont
816         LocationString
817         LocPos moveto
818         Center
819         show
820
821         % draw the date string
822
823         setDateFont
824         DateString
825         DatePos moveto
826         RightJustify
827         show
828
829         % draw the status lines
830
831         setStatFont
832         StatPos
833         /CurrentY exch def
834         StatStrings {
835                 exch dup CurrentY moveto
836                 exch show
837                 /CurrentY CurrentY StatFontSize sub def
838         } forall
839         pop                                     % get rid of the X value
840
841         % draw the messages
842
843         setMessFont
844         MessPos
845         /CurrentY exch def
846         MessStrings {
847                 exch dup CurrentY moveto
848                 exch show
849                 /CurrentY CurrentY MessFontSize sub def
850         } forall
851         pop                                     % get rid of the X value
852
853         % draw the headings
854
855         setHeadingFont
856         HeadingFilePos moveto
857           HeadingFileString
858           show
859         HeadingHostPos moveto
860           HeadingHostString
861           show
862         HeadingFsPos moveto
863           HeadingFsString
864           show
865         HeadingLvlPos moveto
866           HeadingLvlString
867           Center
868           show
869         HeadingOSizePos1 moveto
870           HeadingOSizeString1
871           RightJustify
872           show
873         HeadingOSizePos2 moveto
874           HeadingOSizeString2
875           RightJustify
876           show
877         HeadingCSizePos1 moveto
878           HeadingCSizeString1
879           RightJustify
880           show
881         HeadingCSizePos2 moveto
882           HeadingCSizeString2
883           RightJustify
884           show
885
886         % reset the host position variables
887
888         HeadingBox                              % [ llx lly urx ury ]
889         pop pop exch pop                        % [ lly ]
890         HostFontSize sub
891         /CurrentY exch def
892 } def
893
894 %%%
895 % Build the host line on the page.
896 %%%
897
898 /BuildHost {
899         setHostFont
900         HeadingCSizePosX CurrentY moveto
901           RightJustify
902           show                                  % compressed size
903         HeadingOSizePosX CurrentY moveto
904           RightJustify
905           show                                  % original size
906         HeadingFilePosX CurrentY moveto
907           RightJustify
908           show                                  % tape file number
909         HeadingLvlPosX CurrentY moveto
910           show                                  % dump level
911         HeadingFsPosX CurrentY moveto
912           show                                  % file system
913         HeadingHostPosX CurrentY moveto
914           show                                  % host
915
916         HostCount 0 gt {                        % if not at end of page
917                 currentlinewidth                % save the line width
918                 .25 setlinewidth                % thin lines
919
920                 CurrentY
921                 dup                             % keep this CurrentY
922                 HostFontSize 2 add sub
923                 /CurrentY exch def              % update CurrentY for next host
924
925                 2 sub                           % move down a little
926                 dup
927                 0 exch                          % [ y 0 y ]
928                 moveto
929                 PageWidth exch                  % [ PageWidth y ]
930                 lineto stroke
931                 setlinewidth                    % restore the line width
932         } if
933 } def
934
935 %%%
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.
941 %%%
942
943 25 dict begin                                   % emperically enough entries
944         /*showpage /showpage load def           % rename showpage to *showpage
945                                                 % in our dictionary
946         /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
952                 HostFontSize
953                 2 add                           % space below each line
954                 idiv                            % hosts per page
955                 dup
956                 /HostMax exch def
957
958                 dup
959                 /HostCount exch def             % initialize the counter
960
961                 dup                             % [ HostMax HostMax ]
962                 HostStrings length              % number of hosts
963                 add 1 sub exch idiv             % number of pages
964                 32 string cvs
965                 /PageMaxString exch def
966
967                 /HavePage 0 def                 % flag that page is built
968
969                 HostStrings {
970                         aload pop               % put host strings on the stack
971                         HostCount HostMax eq {
972                                 BuildPage       % time to build a new page
973                                 /HavePage 1 def
974                         } if
975                         /HostCount HostCount 1 sub def
976                         BuildHost               % build this host line
977                         HostCount 0 le {
978                                 *showpage       % time to dump a page
979                                 /HavePage 0 def
980                                 /HostCount HostMax def
981                         } if
982                 } forall
983
984                 HavePage 1 eq {
985                         *showpage               % dump the last page
986                 } if
987
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
993                 
994         } def
995 %%%
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.
999 %%%
1000
1001 %%%%
1002 %% END OF TEMPLATE FILE
1003 %%%%