📄 3hole.ps
字号:
%%%% Compute the position of the top message string.%%%/MessPos { CFLine % [ lx ly ux uy ] exch pop % [ lx ly uy ] dup % [ lx ly uy uy ] 3 1 roll % [ lx uy ly uy ] exch sub % [ lx uy box_height ] MessStrings length % number of status lines MessFontSize mul % height of status lines sub 2 div % [ lx uy space_above ] sub MessFontSize sub % [ lx y ] 2 add % space above exch % [ y lx ] setMessFont (n) stringwidth pop add % a little padding exch % [ x y ]} def%%%% Compute the heading positions that start at the left.%%%/HeadingFilePos { HeadingBox % [ llx lly urx ury ] pop pop % [ llx lly ] exch % [ y x ] setHeadingFont (n) stringwidth pop add % a little padding dup HeadingFileString stringwidth pop add /HeadingFilePosX exch def % for BuildHost exch % [ x y ] 4 add % space below} def/HeadingHostPos { HeadingFilePos % [ x y ] exch % [ y x ] setHeadingFont (nn) stringwidth pop add % a little padding HeadingFileString stringwidth pop add dup /HeadingHostPosX exch def % for BuildHost exch % [ x y ]} def/HeadingFsPos { HeadingHostPos % [ x y ] exch % [ y x ] setHostFont % use the host font for sizes HostNameWidth add (nn) stringwidth pop add % a little padding dup /HeadingFsPosX exch def % for BuildHost exch % [ x y ] setHeadingFont % leave it in the heading font} def%%%% Compute the heading positions that start at the right (and are right% justified).%%%/HeadingCSizePos2 { HeadingBox % [ llx lly urx ury ] pop % [ llx lly urx ] 3 -1 roll % [ lly urx llx ] pop % [ lly urx ] setHeadingFont (n) stringwidth pop sub % a little padding dup /HeadingCSizePosX exch def % for BuildHost exch % [ x y ] 4 add % space below} def/HeadingCSizePos1 { HeadingCSizePos2 HeadingFontSize add} def/HeadingOSizePos2 { HeadingCSizePos2 % [ x y ] exch % [ y x ] setHeadingFont HeadingCSizeString1 stringwidth pop HeadingCSizeString2 stringwidth pop max % widest string sub % [ y x ] (n) stringwidth pop sub % a little padding dup /HeadingOSizePosX exch def % for BuildHost exch % [ x y ]} def/HeadingOSizePos1 { HeadingOSizePos2 HeadingFontSize add} def/HeadingLvlPos { HeadingOSizePos2 % [ x y ] exch % [ y x ] setHeadingFont HeadingOSizeString1 stringwidth pop HeadingOSizeString2 stringwidth pop max % widest string sub % [ y x ] HeadingLvlString stringwidth pop 2 div sub % set up for centering (n) stringwidth pop sub % a little padding dup /HeadingLvlPosX exch def % for BuildHost exch % [ x y ]} def%%%%%% The following functions save strings for each kind of information%% and handle the calls generated by amreport.%%%%%%%% DrawStat saves a string in the next position for section 'A'.%%%/StatStrings 0 array def/DrawStat { /StatStrings exch % [ /StatStrings value ] StatStrings apush def} def%%%% DrawMess saves a string in the next position for section 'F'.%%%/MessStrings 0 array def/DrawMess { /MessStrings exch % [ /MessStrings value ] MessStrings apush def} defMessString1 DrawMessMessString2 DrawMessMessString3 DrawMessMessString4 DrawMessMessString5 DrawMess%%%% DrawTitle saves the title string.%%%/TitleString () def/DrawTitle { /TitleString exch def} def%%%% DrawDate save the date string.%%%/DateString () def/DrawDate { /DateString exch def} def%%%% DrawLoc saves the location string. Amreport does not generate this% call and the initial value has been set at the start of this file% in the user-changeable area.%%%/DrawLoc { /LocationString exch def} def%%%% DrawVers saves the Amanda version string.%%%/VersionString () def/DrawVers { /VersionString exch def} def%%%% DrawHost expects six strings on the stack:%% Host Name% Partition Name% Dump Level% Tape File Number% Original Size% Compressed Size%% They are saved for processing by the final showpage.%%%/HostStrings 0 array def/HostNameWidth 0 def/DrawHost { setHostFont 5 index % copy of host name stringwidth pop HostNameWidth max /HostNameWidth exch def % find maximum host name width 6 array astore % convert args to an array /HostStrings exch % [ /HostStrings value ] HostStrings apush def} def%%%%%% Functions used during actual page drawing.%%%%%%%% Center a string on the current point.%%%/Center { dup stringwidth pop 2 div neg 0 rmoveto} bind def%%%% Right justify a string on the current point.%%%/RightJustify { dup % [ (str) (str) ] stringwidth pop % [ (str) width ] neg 0 rmoveto} bind def%%%% The main page drawing function called when a new page is started.%%%/PageCount 1 def/BuildPage { % translate to leave room for the margins PageCount 2 mod 1 eq { OddLeftMargin } { EvenLeftMargin } ifelse BottomMargin translate % draw the boxes currentgray % save the gray value 0 setgray % turn off gray currentlinewidth % save the current line width 2 setlinewidth % thick lines StatBox box stroke TitleBox box stroke HeadingBox box stroke HostBox box stroke CFLine moveto lineto stroke setlinewidth % restore the line width setgray % restore the gray value % draw the title setTitleFont TitleString TitlePos moveto Center show % draw the page number string setPageFont PageCount 32 string % big enough for the number cvs % convert the number PageString1 exch concat % (Page NN) PageString2 concat % (Page NN of ) PageMaxString concat % (Page NN of MM) PageCount 2 mod 1 eq { OddPagePos moveto RightJustify } { DoDuplex 0 eq { OddPagePos moveto RightJustify } { EvenPagePos moveto } ifelse } ifelse show /PageCount PageCount 1 add def % bump the page counter % draw the version string setVersFont VersionString VersPos moveto show % draw the location setLocFont LocationString LocPos moveto Center show % draw the date string setDateFont DateString DatePos moveto RightJustify show % draw the status lines setStatFont StatPos /CurrentY exch def StatStrings { exch dup CurrentY moveto exch show /CurrentY CurrentY StatFontSize sub def } forall pop % get rid of the X value % draw the messages setMessFont MessPos /CurrentY exch def MessStrings { exch dup CurrentY moveto exch show /CurrentY CurrentY MessFontSize sub def } forall pop % get rid of the X value % draw the headings setHeadingFont HeadingFilePos moveto HeadingFileString show HeadingHostPos moveto HeadingHostString show HeadingFsPos moveto HeadingFsString show HeadingLvlPos moveto HeadingLvlString Center show HeadingOSizePos1 moveto HeadingOSizeString1 RightJustify show HeadingOSizePos2 moveto HeadingOSizeString2 RightJustify show HeadingCSizePos1 moveto HeadingCSizeString1 RightJustify show HeadingCSizePos2 moveto HeadingCSizeString2 RightJustify show % reset the host position variables HeadingBox % [ llx lly urx ury ] pop pop exch pop % [ lly ] HostFontSize sub /CurrentY exch def} def%%%% Build the host line on the page.%%%/BuildHost { setHostFont HeadingCSizePosX CurrentY moveto RightJustify show % compressed size HeadingOSizePosX CurrentY moveto RightJustify show % original size HeadingFilePosX CurrentY moveto RightJustify show % tape file number HeadingLvlPosX CurrentY moveto show % dump level HeadingFsPosX CurrentY moveto show % file system HeadingHostPosX CurrentY moveto show % host HostCount 0 gt { % if not at end of page currentlinewidth % save the line width .25 setlinewidth % thin lines CurrentY dup % keep this CurrentY HostFontSize 2 add sub /CurrentY exch def % update CurrentY for next host 2 sub % move down a little dup 0 exch % [ y 0 y ] moveto PageWidth exch % [ PageWidth y ] lineto stroke setlinewidth % restore the line width } if} def%%%% Magic time -- the input consists of lots of calls to the /DrawXXX% functions, which gather the text into memory. It ends with a showpage,% which we hook here to do all the real imaging after everything has% been collected. The only reason to do all this is so we can know% how many pages will be generated for the "Page N of M" line.%%%25 dict begin % emperically enough entries /*showpage /showpage load def % rename showpage to *showpage % in our dictionary /showpage { HostBox % [ llx lly urx ury ] exch pop % [ llx lly ury ] exch sub % [ llx height ] exch pop % [ height ] cvi % idiv requires integers HostFontSize 2 add % space below each line idiv % hosts per page dup /HostMax exch def dup /HostCount exch def % initialize the counter dup % [ HostMax HostMax ] HostStrings length % number of hosts add 1 sub exch idiv % number of pages 32 string cvs /PageMaxString exch def /HavePage 0 def % flag that page is built HostStrings { aload pop % put host strings on the stack HostCount HostMax eq { BuildPage % time to build a new page /HavePage 1 def } if /HostCount HostCount 1 sub def BuildHost % build this host line HostCount 0 le { *showpage % time to dump a page /HavePage 0 def /HostCount HostMax def } if } forall HavePage 1 eq { *showpage % dump the last page } if % Clean up. Ideally this would be in the page epilog, % but reporter.c only emits the "showpage". end % end the dict in which this % showpage redefinition lives pageSave restore % free up memory } def%%%% Normally there would be an "end" here to match the "begin" for our% dictionary, but we want to leave it on top of the dictionary stack% so the final showpage runs our showpage replacement.%%%%%%%%% END OF TEMPLATE FILE%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -