%% Copyright 2010 Clea F. Rees
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of all files listed in manifest.txt.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{adfarrows}[2010/08/03 v1.0 adfarrows CFR]
\RequirePackage{pifont,fp}
\Pifont{ArrowsADF}	

\def\adfarrows@ot{opentail}%
\def\adfarrows@p{plain}%
\def\adfarrows@c{comic}%
\def\adfarrows@st{solidtail}%
\def\adfarrows@th{thick}%
\def\adfarrows@t{tail}%
\def\adfarrows@e{e}%
\def\adfarrows@east{east}%
\def\adfarrows@se{se}%
\def\adfarrows@southeast{southeast}%
\def\adfarrows@s{s}%
\def\adfarrows@south{south}%
\def\adfarrows@sw{sw}%
\def\adfarrows@southwest{southwest}%
\def\adfarrows@w{w}%
\def\adfarrows@west{w}%
\def\adfarrows@nw{nw}%
\def\adfarrows@northwest{northwest}%
\def\adfarrows@n{n}%
\def\adfarrows@north{north}%
\def\adfarrows@ne{ne}%
\def\adfarrows@northeast{northeast}%
\FPset\adfarrows@base{0}%
\FPset\adfarrows@add{0}%
\FPset\adfarrowsbase@opentail{3}%
\FPset\adfarrowsbase@plain{11}%
\FPset\adfarrowsbase@comic{19}%
\FPset\adfarrowsbase@solidtail{29}%
\FPset\adfarrowsbase@thick{37}%
\FPset\adfarrowsbase@tail{45}%
\FPset\adfarrowsdir@e{0}%
\FPset\adfarrowsdir@se{1}%
\FPset\adfarrowsdir@s{2}%
\FPset\adfarrowsdir@sw{3}%
\FPset\adfarrowsdir@w{4}%
\FPset\adfarrowsdir@nw{5}%
\FPset\adfarrowsdir@n{6}%
\FPset\adfarrowsdir@ne{7}%
\newcommand*{\adfarrows@dir}[4]{%
	\edef\adfarrows@tempw{#1}%
	\edef\adfarrows@tempx{#2}%
	\edef\adfarrows@tempy{#3}%
	\edef\adfarrows@tempz{#4}%
	\ifx\adfarrows@tempw\adfarrows@tempz
		\FPset\adfarrows@addtemp{\adfarrows@tempy}%
		\global\let\adfarrows@add\adfarrows@addtemp
	\else
		\ifx\adfarrows@tempx\adfarrows@tempz
			\FPset\adfarrows@addtemp{\adfarrows@tempy}%
			\global\let\adfarrows@add\adfarrows@addtemp
		\fi
	\fi}
\newcommand*{\adfarrows@fam}[4]{%
	\edef\adfarrows@tempw{#1}%
	\edef\adfarrows@tempx{#2}%
	\edef\adfarrows@tempy{#3}%
	\edef\adfarrows@tempz{#4}%
	\ifx\adfarrows@tempw\adfarrows@tempz
		\FPset\adfarrows@basetemp{\adfarrows@tempy}%
		\global\let\adfarrows@base\adfarrows@basetemp
	\else
		\ifx\adfarrows@tempx\adfarrows@tempz
			\FPset\adfarrows@basetemp{\adfarrows@tempy}%
			\global\let\adfarrows@base\adfarrows@basetemp
		\fi
	\fi}
\newcommand*{\adfarrow}[2][]{%
	\def\adfarrows@tempa{#1}%
	\ifx\adfarrows@tempa\@empty
		\Pisymbol{ArrowsADF}{#2}%
	\else
		\adfarrows@fam{1}{\adfarrows@ot}{\adfarrowsbase@opentail}{#1}%
		\adfarrows@fam{2}{\adfarrows@p}{\adfarrowsbase@plain}{#1}%
		\adfarrows@fam{3}{\adfarrows@c}{\adfarrowsbase@comic}{#1}%
		\adfarrows@fam{4}{\adfarrows@st}{\adfarrowsbase@solidtail}{#1}%
		\adfarrows@fam{5}{\adfarrows@th}{\adfarrowsbase@thick}{#1}%
		\adfarrows@fam{6}{\adfarrows@t}{\adfarrowsbase@tail}{#1}%
		\adfarrows@dir{\adfarrows@s}{\adfarrows@south}{\adfarrowsdir@s}{#2}%
		\adfarrows@dir{\adfarrows@se}{\adfarrows@southeast}{\adfarrowsdir@se}{#2}%
		\adfarrows@dir{\adfarrows@sw}{\adfarrows@southwest}{\adfarrowsdir@sw}{#2}%
		\adfarrows@dir{\adfarrows@n}{\adfarrows@north}{\adfarrowsdir@n}{#2}%
		\adfarrows@dir{\adfarrows@ne}{\adfarrows@northeast}{\adfarrowsdir@ne}{#2}%
		\adfarrows@dir{\adfarrows@nw}{\adfarrows@northwest}{\adfarrowsdir@nw}{#2}%
		\adfarrows@dir{\adfarrows@w}{\adfarrows@west}{\adfarrowsdir@w}{#2}%
		\adfarrows@dir{\adfarrows@e}{\adfarrows@east}{\adfarrowsdir@e}{#2}%
		\FPadd\adfarrows@arrow\adfarrows@base\adfarrows@add
		\FPround{\adfarrows@arrow}{\adfarrows@arrow}{0}%
		\ifnum\adfarrows@arrow < 53
			\ifnum\adfarrows@arrow > 0
				\Pisymbol{ArrowsADF}{\adfarrows@arrow}%
			\else
				\PackageError{adfarrows}{adfarrows@arrow must be greater than 0 but is \adfarrows@arrow}%
			\fi
		\else
			\PackageError{adfarrows}{adfarrows@arrow must be less than than 53 but is \adfarrows@arrow}%
		\fi
	\fi}

\newcommand*{\adfhalfarrowright}{\adfarrow{1}}
\newcommand*{\adfhalfarrowleft}{\adfarrow{2}}
\newcommand*{\adfhalfarrowrightsolid}{\adfarrow{27}}
\newcommand*{\adfhalfarrowleftsolid}{\adfarrow{28}}

\gdef\adfarrowe#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{3}%
		\or	\adfarrow{11}%
		\or	\adfarrow{19}%
		\or	\adfarrow{29}%
		\or	\adfarrow{37}%
		\or	\adfarrow{45}%
	\fi}
\gdef\adfarrowse#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{4}%
		\or	\adfarrow{12}%
		\or	\adfarrow{20}%
		\or	\adfarrow{30}%
		\or	\adfarrow{38}%
		\or	\adfarrow{46}%
	\fi}
\gdef\adfarrows#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{5}%
		\or	\adfarrow{13}%
		\or	\adfarrow{21}%
		\or	\adfarrow{31}%
		\or	\adfarrow{39}%
		\or	\adfarrow{47}%
	\fi}
\gdef\adfarrowsw#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{6}%
		\or	\adfarrow{14}%
		\or	\adfarrow{22}%
		\or	\adfarrow{32}%
		\or	\adfarrow{40}%
		\or	\adfarrow{48}%
	\fi}
\gdef\adfarroww#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{7}%
		\or	\adfarrow{15}%
		\or	\adfarrow{23}%
		\or	\adfarrow{33}%
		\or	\adfarrow{41}%
		\or	\adfarrow{49}%
	\fi}
\gdef\adfarrownw#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{8}%
		\or	\adfarrow{16}%
		\or	\adfarrow{24}%
		\or	\adfarrow{34}%
		\or	\adfarrow{42}%
		\or	\adfarrow{50}%
	\fi}
\gdef\adfarrown#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{9}%
		\or	\adfarrow{17}%
		\or	\adfarrow{25}%
		\or	\adfarrow{35}%
		\or	\adfarrow{43}%
		\or	\adfarrow{51}%
	\fi}
\gdef\adfarrowne#1{%
	\ifcase	#1		\relax
		\or	\adfarrow{10}%
		\or	\adfarrow{18}%
		\or	\adfarrow{26}%
		\or	\adfarrow{36}%
		\or	\adfarrow{44}%
		\or	\adfarrow{52}%
	\fi}

\endinput
%% end adfarrows.sty

