// $Id$
// Slopes

// Copyright (C) 1993 Technische Universitaet Braunschweig, Germany.
// Written by Andreas Zeller <zeller@gnu.org>.
// 
// This file is part of DDD.
// 
// DDD is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
// 
// DDD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with DDD -- see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// 
// DDD is the data display debugger.
// For details, see the DDD World-Wide-Web page, 
// `http://www.gnu.org/software/ddd/',
// or send a mail to the DDD developers <ddd@gnu.org>.

// Version
slopes_version() = "$Id$";

// Synonyms
slopethickness() = rulethickness();
rise() = rise(slopethickness());
fall() = fall(slopethickness());

// Makros
// Arrows
_arrowheadsize() = rulethickness() * 6;
_n_arrowhead() = fix((rise() & vrule() & fall()) ^ _arrowheadsize());
_w_arrowhead() = fix((rise() | hrule() | fall()) ^ _arrowheadsize());
_s_arrowhead() = fix((fall() & vrule() & rise()) ^ _arrowheadsize());
_e_arrowhead() = fix((fall() | hrule() | rise()) ^ _arrowheadsize());

n_arrow() = _n_arrowhead() | hcenter(vrule());
w_arrow() = _w_arrowhead() & vcenter(hrule());
s_arrow() = hcenter(vrule()) | _s_arrowhead();
e_arrow() = vcenter(hrule()) & _e_arrowhead();

ns_arrow() = n_arrow() | s_arrow();	// Arrows with common origin
we_arrow() = w_arrow() & e_arrow();
sn_arrow() = s_arrow() | n_arrow();     // Arrows with common target
ew_arrow() = e_arrow() & w_arrow();

_ne_arrowhead() = fix(((hrule() | fill()) & vrule()) ^ _arrowheadsize());
_se_arrowhead() = fix(((fill() | hrule()) & vrule()) ^ _arrowheadsize());
_nw_arrowhead() = fix((vrule() & (hrule() | fill())) ^ _arrowheadsize());
_sw_arrowhead() = fix((vrule() & (fill() | hrule())) ^ _arrowheadsize());

ne_arrow() = rise() ^ (fill() & _ne_arrowhead() | fill());
se_arrow() = fall() ^ (fill() | fill() & _se_arrowhead());
sw_arrow() = rise() ^ (fill() | _sw_arrowhead() & fill());
nw_arrow() = fall() ^ (_nw_arrowhead() & fill() | fill());

// Angles
n_angle() = rise() & fall();
w_angle() = rise() | fall();
s_angle() = fall() & rise();
e_angle() = fall() | rise();

// Punch cards
_punchcardcornersize() = rulethickness() * 10;
_punchcardcorner() = fix(rise() ^ _punchcardcornersize());
punchcard(box) = 
  (_punchcardcorner() | vrule() & fill() | hrule())
& (n_rule() | box & vwhite() | s_rule())
& vrule();

// Rhombs
_rhomb(box) =
fix((
	space(box / 2) & n_angle() & space(box / 2)
|	w_angle()      & box       & e_angle()
|	space(box / 2) & s_angle() & space(box / 2)
) ^ space(box * 2));
rhomb(box) = _rhomb(whiteframe(box));

// Octogons
_octogon(box) =
fix((
	rise() & (hrule() | fill()) & fall()
|   vrule() & fill() & vrule()
|	fall() & (fill() | hrule()) & rise()
) ^ square(box) ^ center(box));
octogon(box) = _octogon(whiteframe(box));
