Blob Blame History Raw
%!
%%BoundingBox: 0 0 595 842
%%Title: AMANDA ExaLabel
%%Pages: 1
%%EndComments

%%%%
%%%% This is a template file used by AMANDA to create PostScript tape
%%%% labels for each dump.  This file is set up for DAT 4mm tapes,
%%%% but you can edit it to work with anything.
%%%%
%%%% NOTE: this is quick-hack for DAT TAPES; it is simply a scaled 
%%%% version of the Exabyte version.
%%%%

%
% The label is made up of 6 parts:  statistics, tape name, date,
% header, filesystem list, and the logo.  Geometrically, the label 
% looks like this:
%
%   +------------------------+
%   |statistics              |   <- section 'A'
%   +----+-------------------+
%   |logo|     TAPE_NAME     |   <- section 'B'  (logo) <- section 'F'
%   |    | version      date |   <- section 'C'
%   +----+--+--------+-------+
%   | h   fs   l | h  fs   l |   <- section 'D'
%   +-------+--------+-------+
%   |            |           |   <- section 'E'
%   |            |           |
%   v            v           v
%
% Sections D and E, which hold the bulk of the information are 
% cut into columns.
%

% Quick-hack for DAT tapes
%

72 25.4 div dup scale              %% scale to millimeters

% section 'A' font, start position, and line separation
%
/StatFont 		{ /Courier findfont 4.5 scalefont setfont } def
/StatPos		{ 30 255 } def
/StatSep		{ 4 } def

% section 'B' font and position (text centered around this point)
%
/TitleFont		{ /Helvetica-Bold findfont 10 scalefont setfont } def
/TitlePos		{ 115 230 } def

% section 'C' font, position of the date (left justified) and the version
%
/DateFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/DatePos		{ 190 222 } def
/VersFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/VersPos		{ 43 222 } def

% section 'D' font, and field positions (x coord is relative to each column)
%

/HeadingFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/HeadingHostPos		{ 0 212 } def
/HeadingFsPos		{ 25 212 } def
/HeadingLvlPos		{ 110 212 } def

% section 'E' font, and line separation
%
/HostFont		{ /Courier findfont 4 scalefont setfont } def
/HostSep		{ 3.2 } def


% the following rectangles separate the regions
%
/StatBox		{ 200 260 15 240 } def
/TitleBox		{ 200 240 15 220 } def
/LogoBox		{ 35 240 15 220 } def
/HeadingBox		{ 200 220 15 210 } def
/HostBox		{ 200 210 15 0 } def


% number of columns for section 'E,' column width, position of first 
% entry in first column, y coordinate of top and bottom of dividing lines
%
/NumColumns		{ 1 } def
/ColumnWidth		{ 132 } def
/ColumnBasePos		{ 25 190 } def
/TopColDivLine		{ 190 } def
/BotColDivLine		{ 0 } def


%%%%
%%%% END OF USER-CONFIGURABLE OPTIONS
%%%%
%%%% the rest of this file contains the internal functions that are used
%%%% by genlabel to draw the label
%%%%


%
% Initial Setup... draws everything that is the same for all labels
%

% function to draw a box
%
/box {
	/ury exch def
	/urx exch def
	/lly exch def
	/llx exch def

	llx lly moveto
	llx ury lineto
	urx ury lineto
	urx lly lineto
	closepath
} def


% move the origin up a bit
%
0 20 translate

% draw all of the boxes
%
0 setgray 
.3 setlinewidth					% thick lines
StatBox box stroke
TitleBox box stroke
LogoBox box stroke
HeadingBox box stroke
HostBox box stroke


% draw the column dividers
%
0.5 setlinewidth				% thin lines
/i 1 def
{
	NumColumns i sub 0 le { exit } if	% no lines if this last col.
	/xoff ColumnBasePos pop			% get x base position
	   i ColumnWidth mul add def		% offset for this column
	xoff TopColDivLine moveto 
	xoff BotColDivLine lineto stroke	
	/i i 1 add def
} loop


% draw the heading names
%
/i 0 def
HeadingFont
{
	NumColumns i sub 0 le { exit } if
	/xoff ColumnBasePos pop
	  i ColumnWidth mul add def
	HeadingHostPos exch xoff add exch moveto
	  (Host) show
	HeadingFsPos exch xoff add exch moveto
	  (Fs) show
	HeadingLvlPos exch xoff add exch moveto
	  (Lv) show
	/i i 1 add def
} loop


%
% the following functions draw strings for each kind of information
%

/CurrStatY StatPos exch pop def
ColumnBasePos /CurrColumnY exch def
  /CurrColumnX exch def


% DrawStat draws the string on the top of the stack in the next position
% in section 'A'
%
/DrawStat {
	StatFont
	StatPos pop CurrStatY moveto
	show
	/CurrStatY CurrStatY StatSep sub def
} def


% DrawTitle draws the string on the top of the stack in section 'B'
%
/DrawTitle {
	TitleFont
	TitlePos moveto
	dup stringwidth pop 2 div neg 0 rmoveto
	show
} def


% DrawDate draws the string on the top of the stack in section 'C'
%
/DrawDate {
	DateFont
	DatePos moveto
	dup stringwidth pop neg 0 rmoveto
	show
} def


% DrawVers draws the string on the top of the stack in section 'C'
%
/DrawVers {
	VersFont
	VersPos moveto
	show
} def


% DrawHost expects five strings to be on the stack; right now it
% uses only the first three.  The strings are Host Name, Partition Name,
% Dump Level, Tape File Number, and Output Size.
% 
/DrawHost {
	HostFont
	pop pop pop 			% discard sizes and fileno
	CurrColumnX HeadingLvlPos pop add CurrColumnY moveto
	show
	CurrColumnX HeadingFsPos pop add CurrColumnY moveto
	show
	CurrColumnX HeadingHostPos pop add CurrColumnY moveto
	show
	/CurrColumnY CurrColumnY HostSep sub def
	CurrColumnY BotColDivLine lt {
		/CurrColumnY ColumnBasePos exch pop def
		/CurrColumnX CurrColumnX ColumnWidth add def
	} if
} def


%%%%
%%%% END OF TEMPLATE FILE
%%%%