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