function defbox;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% defbox.m                               %
% written 2/24/00 by ben olding          %
% defines a box in a postscript file     %
% bxheight, bxwidth are in inches        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Requires: al.m

global PSText PSComment

% PS commands used -- 
% newpath  : starts a new path of lines
% moveto   : moves start to specificed coordinates
% inch     : user defined conversion from point to inch
% bxwidth  : user defined box width
% bxheight : user defined box height
% cyn,mag,yel,blk
%          : user defined colors
% rlineto  : 10 20 rlineto makes a line from current point
%            to 10 units to the right and 20 units up
% closepath: ends current path of lines back to start
% bind def : defines (and evaluates) current definition

al(['/colorfill {setcmykcolor fill} bind def'],['% Change color & fill']);

al(['/box {']);
al('  newpath');
al(['  moveto'],                ['% Current point is on stack']);
al(['  0 bxwidth inch rlineto'], ['% Left']);
al(['  bxheight inch 0 rlineto'],['% Top']);
al(['  0 0 bxwidth sub inch rlineto'],['% Right']);
al(['  closepath'],              ['% Bottom']);
al(['  cyn mag yel blk colorfill'],['% Color & fill box']);
al('} def');
     
