%% xyarrow.tex from $Id: xyarrow.doc,v 3.9 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``Arrows and Paths'' feature.
%% Copyright (c) 1991-1997 Kristoffer H. Rose <krisrose@tug.org>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-2011 Kristoffer H. Rose <krisrose@tug.org>
%%
%% The Xy-pic package 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.
%%
%% The Xy-pic package 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 this package; if not, see http://www.gnu.org/licenses/.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{arrow}{Arrow and Path feature}{\stripRCS$Revision: 3.9 $}%
 {Kristoffer H.~Rose}{krisrose@tug.org}%
 {IBM T.~ J.\ Watson Research Center, P.O.~Box 704, Yorktown Heights, NY 10598 (USA)}
\message{path,}
\xydef@\PATH{\afterPATH{}}
\xylet@\afterPATH@=\empty
\xydef@\afterPATH#1{\save
 \DN@##1{\def\afterPATH@{\restore \def\afterPATH@{##1}#1}}%
 \expandafter\next@\expandafter{\afterPATH@}%
 \let\PATHfail@@=\empty
 \let\PATHbefore@@=\empty
 \let\PATHafter@@=\empty
 \let\PATHlabelsevery@@=\empty
 \let\PATHlabelsnext@@=\empty
 \let\PATHlabelslast@@=\empty
 \xy@{\afterPATH{#1}}{\def\PATHslide@@{\z@}}%
 \def\PATHcontinue@@{\xyFN@\PATH@}%
 \xyFN@\PATH@}
\xynew@{if}\ifPATHsingle@
\xydef@\PATH@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATH@}%
 \else\ifPATHsingle@ \let\next@=\PATH@single
 \else \let\next@=\PATH@normal \fi\fi \next@}
\xydef@\PATH@normal{%
 \ifx ~\next \DN@ ~{\xyFN@\PATHsetting@}%
 \else \addRQ@\ifx \next \addRQ@\DN@{\xy@'{}\xyFN@\PATHstraight@}%
 \else \addLQ@\ifx \next \addLQ@\DN@{\xy@`{}\xyFN@\PATHturn@}%
 \else\ifx \PATHfail@@\PATH@x \DN@{\xyFN@\PATHfinal@}%
 \else
 \DNii@{\let\PATHfail@@=\PATH@x \xyFN@\PATH@}%
 \DN@{\expandafter\nextii@\PATHfail@@}%
 \fi\fi\fi\fi \next@}
\xylet@\PATHfail@@=\empty
\xylet@\PATHbefore@@=\empty
\xylet@\PATHafter@@=\empty
\xylet@\PATHlabelsevery@@=\empty
\xylet@\PATHlabelsnext@@=\empty
\xylet@\PATHlabelslast@@=\empty
\xydef@\PATHsetting@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATHsetting@}%
 \else\ifx \bgroup\next
 \DN@##1{\xy@{~{##1}}{}\def\PATHfail@@{##1}\xyFN@\PATH@}%
 \else \addEQ@\ifx \next
 \addEQ@\DN@##1{\xy@{~={##1}}{}\def\PATHbefore@@{##1}\xyFN@\PATH@}%
 \else \addLT@\ifx \next
 \addLT@\DN@##1{\xy@{~<{##1}}{}\def\PATHlabelsnext@@{##1}\xyFN@\PATH@}%
 \else \addGT@\ifx \next
 \addGT@\DN@##1{\xy@{~>{##1}}{}\def\PATHlabelslast@@{##1}\xyFN@\PATH@}%
 \else \addPLUS@\ifx \next
 \addPLUS@\DN@##1{\xy@{~+{##1}}{}\def\PATHlabelsevery@@{##1}\xyFN@\PATH@}%
 \else \ifx /\next
 \DN@/##1{\xy@{~/{##1}}{}\def\PATHafter@@{##1}\xyFN@\PATH@}%
 \else \addDASH@\ifx \next
 \xywarning@{Obsolete `-' PATH <action> translated to `='.}%
 \addDASH@\DN@##1{\xy@{~-{##1}}{}\def\PATHbefore@@{##1}\xyFN@\PATH@}%
 \else
 \xyerror@{Unknown \string~ setting: \meaning\next}%
 {See the Xy-pic arrow feature documentation for help.}%
 \fi\fi\fi\fi\fi\fi\fi\fi \next@}
\xylet@\PATHinit@@=\empty
\xylet@\PATHextra@@=\empty
\xylet@\PATHpost@@=\empty
\xylet@\PATHcontinue@@=\empty
\xydef@\PATHstraight@{%
 \def\PATHinit@@{\PATHinitstraight@}%
 \let\PATHextra@@=\empty
 \let\PATHpost@@=\empty
 \let\PATHlabelsextra@@=\relax
 \xy@@\pfromc@ \PATHafterPOS{\xyFN@\PATHsegment@}}
\xydef@\PATHfinal@{%
 \def\PATHinit@@{\PATHinitstraight@}%
 \def\PATHextra@@{\let\PATHcontinue@@=\afterPATH@}%
 \let\PATHpost@@=\empty
 \let\PATHlabelsextra@@=\PATHlabelsextralast@
 \xy@@\pfromc@ \PATHafterPOS{\xyFN@\PATHsegment@}}
\xydef@\PATHlabelsextralast@{\let\PATHlabelsextra@@=\relax
 \expandafter\xyFN@\expandafter\PATHlabels@\PATHlabelslast@@}
\xydef@\PATHinitstraight@{\xy@@{\setupDirection@ \dimen@=\PATHslide@@
 \dimen@ii=-\sinDirection\dimen@
 \ifPATHomitslide@@\else\advance\X@p\dimen@ii\fi \advance\X@c\dimen@ii
 \dimen@ii= \cosDirection\dimen@
 \ifPATHomitslide@@\else\advance\Y@p\dimen@ii\fi \advance\Y@c\dimen@ii
 \PATHomitslide@@false \resetupDirection@}}
\xydef@\PATHslide@@{\z@}
\xynew@{if}\ifPATHomitslide@@
\xydef@\PATHsegment@{%
 \addLT@\ifx\next
 \addGT@{\addLT@\DN@##1}{%
 \xy@{<##1>}{\dimen@=##1\relax \edef\PATHslide@@{\the\dimen@}}%
 \xyFN@\PATHsegment@@}%
 \else \let\next@=\PATHsegment@@
 \fi \next@}
\xydef@\PATHsegment@@{\PATHinit@@ \addEQ@\PATHaction@\PATHbefore@@ \PATHextra@@
 \expandafter\toks@\expandafter{\PATHlabelsnext@@}\let\PATHlabelsnext@@=\empty
 \expandafter\addtotoks@\expandafter{\PATHlabelsevery@@}%
 \expandafter\def\expandafter\PATHlabels@@\expandafter{\the\toks@}%
 \toks@={}\expandafter\xyFN@\expandafter\PATHlabels@\PATHlabels@@}
\xylet@\PATHlabelit@@=\empty
\xydef@\PATHlabels@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATHlabels@}%
 \else \ifx ^\next 
 \DN@##1{\xy@^{}\let\PATHlabelit@@=\PATHlabelabove@@
 \DNii@{}\xyFN@\PATHanchor@}%
 \else \ifx _\next
 \DN@##1{\xy@_{}\let\PATHlabelit@@=\PATHlabelbelow@@
 \DNii@{}\xyFN@\PATHanchor@}%
 \else \ifx |\next
 \DN@##1{\xy@|{}\let\PATHlabelit@@=\PATHlabelbreak@
 \DNii@{}\xyFN@\PATHanchor@}%
 \else \let\next@=\PATHfinishsegments@ \fi\fi\fi\fi \next@}
\xydef@\PATHanchor@{\begingroup \toks@={}\PATHanchor@i}
\xydef@\PATHanchor@i{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATHanchor@i}%
 \else\addDASH@\ifx \next
 \addDASH@\DN@{\expandafter\addtotoks@\expandafter{\PATHanchor@toks}%
 \xyFN@\PATHanchor@i}%
 \else
 \DNii@##1{\endgroup\afterPLACE{\xyFN@\PATHit@}##1}%
 \DN@{\expandafter\nextii@\expandafter{\the\toks@}}%
 \fi\fi \next@}
{\xyuncatcodes \gdef\next{<>(.5)}}
\xylet@\PATHanchor@toks=\next
\xylet@\PATHitshapes@@=\empty
\xydef@\PATHit@{\let\PATHitshape@@=\empty \xyFN@\PATHit@i}
\xydef@\PATHit@i{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATHit@i}%
 \else \ifx *\next \DN@*##1##{\PATHlabelit@@{!C##1}}%
 \else \addAT@\ifx\next \addAT@\DN@##1##{\PATHlabelit@@{\dir##1}}%
 \else \ifx [\next \DN@[##1]{%
 \expandafter\def\expandafter\PATHitshape@@\expandafter{\PATHitshape@@[##1]}%
 \xyFN@\PATHit@i}%
 \else \DN@{\PATHlabelit@@{}}%
 \fi\fi\fi\fi \next@}
\xydef@\PATHfinishsegments@{%
 \ifx\PATHlabelsextra@@\relax \expandafter\PATHfinishsegments@i
 \else
 \expandafter\PATHlabelsextra@@ \fi}
\xydef@\PATHfinishsegments@i{%
 \xy@@{\Clast@@}\the\toks@ \toks@={}%
 \xy@@\setupDirection@
 \PATHpost@@ \PATHaction@/\PATHafter@@
 \PATHcontinue@@}
\xydef@\PATHaction@default#1#2{\xy@{PATHaction#1{#2}}{}\POS#2\relax}
\xylet@\PATHaction=\PATHaction@default
\xydef@\PATHaction@#1#2{\expandafter\PATHaction\expandafter#1\expandafter{#2}}
\xylet@\PATHafterPOS@default=\afterPOS
\xylet@\PATHafterPOS=\PATHafterPOS@default
\xydef@\PATHlastout@@{3}
\xydef@\PATHturn@{\afterCIRorDIAG\PATHturn@cir\PATHturn@diag}
\xydef@\PATHturn@cir{\toks@={\xy@@{%
 \count@=\CIRin@@ \ifnum\count@<4\else\advance\count@-4\fi
 \count@@=\CIRout@@ \ifnum\count@@<4\else\advance\count@@-4\fi
 \ifnum\count@=\count@@ \xyerror@{<turn> cannot be half or full}{%
You asked for a <turn>ed segment with parallel in- and out-direction.^^J%
This is not allowed because it is not possible to position it uniquely.}\fi}}%
 \edef\next@{{\CIRin@@}{\expandafter\noexpand\CIRorient@@}{\CIRout@@}}%
 \expandafter\PATHturn@i\next@}
\xydef@\PATHturn@diag{\toks@={\xy@@{%
 \setupDirection@ \count@=\CIRin@@ \dimen@=\xydashl@ \ABfromdiag@
 \ifdim \sinDirection\A@>\cosDirection\B@ \def\CIRorient@@{\CIRacw@}%
 \advance\count@\ifnum\count@<6 \tw@ \else -6\fi
 \else \def\CIRorient@@{\CIRcw@}%
 \advance\count@\ifnum\count@>\@ne -\tw@ \else 6\fi
 \fi
 \edef\CIRout@@{\the\count@}}}%
 \edef\next@{{\CIRin@@}{}{}}%
 \expandafter\PATHturn@i\next@}
\xylet@\PATHpostpos@@=\empty
\xydef@\PATHturn@i#1#2#3{%
 \DN@##1{\def\PATHinit@@{\xy@@{%
 \def\CIRin@@{#1}\def\CIRorient@@{#2}\def\CIRout@@{#3}%
 \ifnum\CIRin@@=8 \let\CIRin@@=\PATHlastout@@ \fi
 \R@=\turnradius@
 ##1\relax}%
 \xy@@{\count@=\CIRin@@
 \ifPATHomitslide@@ \dimen@=-\PATHslide@@
 \ABfromdiag@ \advance\X@p-\B@ \advance\Y@p\A@ \fi
 \enter@{\pfromthep@ \basefromthebase@}}%
 \xy@@{\dimen@=\expandafter\ifx\CIRorient@@\CIRcw@-\fi\R@
 \ABfromdiag@ \advance\X@p-\B@ \advance\Y@p\A@
 \X@origin=\X@p \Y@origin=\Y@p}%
 \xy@@{\dimen@=\xydashl@ \ABfromdiag@ \R@c=\A@ \U@c=\B@
 \count@=\CIRout@@
 \dimen@=\expandafter\ifx\CIRorient@@\CIRcw@-\fi\R@
 \ABfromdiag@ \advance\X@c-\B@ \advance\Y@c\A@
 \dimen@=\xydashl@ \X@p=\X@c \Y@p=\Y@c
 \ABfromdiag@ \advance\X@p-\A@ \advance\Y@p-\B@
 \intersect@
 \count@=\CIRin@@ \dimen@=\p@ \ABfromdiag@}%
 \xy@@{\edef\next@{\expandafter\removePT@\the\A@}%
 \edef\nextii@{\expandafter\removePT@\the\B@}%
 \A@=\X@c \advance\A@-\X@origin \B@=\Y@c \advance\B@-\Y@origin
 \ifdim \next@\A@<-\nextii@\B@
 \dontleave@ \cfromp@
 \count@=\CIRin@@ \advance\count@\ifnum\count@<4 +4\else -4\fi
 \dimen@=\xydashl@ \Directionfromdiag@
 \the\Edge@c\z@
 \count@=\CIRin@@ \dimen@=\expandafter\ifx\CIRorient@@\CIRcw@-\fi\R@
 \ABfromdiag@ \advance\X@c-\B@ \advance\Y@c\A@
 \dimen@=5sp \ABfromdiag@ \advance\X@c\A@ \advance\Y@c\B@
 \fi
 \dimen@ii=\expandafter\ifx\CIRorient@@\CIRacw@-\fi\PATHslide@@
 \advance\R@\dimen@ii
 \drop@\literal@{\hbox\bgroup\cir@i}}%
 \xy@@{\X@p=\X@c \Y@p=\Y@c
 \count@=\CIRout@@
 \dimen@=\expandafter\ifx\CIRorient@@\CIRacw@-\fi\R@c
 \ABfromdiag@ \advance\X@p-\B@ \advance\Y@p\A@
 \edef\PATHpostpos@@{\X@c=\the\X@p \Y@c=\the\Y@p \noexpand\czeroEdge@
 \noexpand\PATHomitslide@@true}}%
 \xy@@{\count@=\CIRin@@
 \dimen@=\expandafter\ifx\CIRorient@@\CIRacw@-\fi\R@c
 \ABfromdiag@ \advance\X@c-\B@ \advance\Y@c\A@ \czeroEdge@}%
 \xy@@{\leave@
 \count@=\CIRin@@ \dimen@=\PATHslide@@
 \ABfromdiag@ \advance\X@p-\B@ \advance\Y@p\A@
 \edef\PATHlastout@@{\CIRout@@}%
 \count@=\CIRout@@ \dimen@=\xydashl@ \Directionfromdiag@}}}%
 \expandafter\next@\expandafter{\the\toks@}\toks@={}%
 \let\PATHextra@@=\empty
 \def\PATHpost@@{\xy@@\PATHpostpos@@}%
 \let\PATHlabelsextra@@=\relax
 \xyFN@\PATHturn@ii}
\xydef@\PATHturn@ii{%
 \ifx /\next
 \DN@ /{\afterassignment\nextii@\dimen@=}%
 \DNii@{%
 \edef\next@{\noexpand\xy@@{\edef\noexpand\turnradius@{\the\dimen@}}}\next@
 \xy@@\pfromc@ \PATHafterPOS{\xyFN@\PATHsegment@}}%
 \else \DN@{\xy@@\pfromc@ \PATHafterPOS{\xyFN@\PATHsegment@}}\fi
 \next@}
\xydef@\ABfromdiag@{\ifcase\count@\relax
 \A@=-.7071\dimen@ \B@=-.7071\dimen@ \or \A@=\z@ \B@=-\dimen@
 \or \A@=+.7071\dimen@ \B@=-.7071\dimen@ \or \A@=\dimen@ \B@=\z@
 \or \A@=+.7071\dimen@ \B@=+.7071\dimen@ \or \A@=\z@ \B@=+\dimen@
 \or \A@=-.7071\dimen@ \B@=+.7071\dimen@ \or \A@=-\dimen@ \B@=\z@
 \else\xybug@{impossible <diag>?}\fi}
\xydef@\turnradius@{10pt}
\xydef@\turnradius{\afterADDOP{\Addop@@\turnradius@}}
\xydef@\PATHlabelabove@#1#2{\droplabel@\belowDirection@{#1}{#2}%
 \let\afteraliases@@=\empty \xyFN@\PATHlabelalias@}
\xydef@\PATHlabelbelow@#1#2{\droplabel@\aboveDirection@{#1}{#2}%
 \let\afteraliases@@=\empty \xyFN@\PATHlabelalias@}
\xylet@\PATHlabelabove@@=\PATHlabelabove@
\xylet@\PATHlabelbelow@@=\PATHlabelbelow@
\xydef@\droplabel@#1#2#3{\xy@@{\enter@\DirectionfromtheDirection@}%
 \DN@{#2}\ifx\next@\empty
 \expandafter\xy@@ix@\expandafter{\PATHitshape@@\labelbox{#3}}%
 \else \expandafter\xy@@ix@\expandafter{\PATHitshape@@#2{#3}}\fi
 \xy@@{\setbox\z@=\expandafter\object\the\toks9
 \advance\L@c\labelmargin@ \advance\R@c\labelmargin@
 \advance\D@c\labelmargin@ \advance\U@c\labelmargin@ 
 \setboxz@h{\kern\labelmargin@\boxz@\kern\labelmargin@}%
 \A@=\X@c \B@=\Y@c #1\xydashl@ \the\Edge@c\thr@@ 
 \advance\A@-\X@c \advance\B@-\Y@c \advance\X@c 2\A@ \advance\Y@c 2\B@
 \ht\z@=\U@c \dp\z@=\D@c \dimen@=\L@c \advance\dimen@\R@c \wd\z@=\dimen@ 
 \setbox\lastobjectbox@=\hbox{\X@c=\L@c \Y@c=\z@ \Drop@@}%
 \drop@{\box\lastobjectbox@}{}%
 \leave@}}
\xydef@\PATHlabelbreak@#1#2{%
 \DN@{#1}\ifx\next@\empty \drop\labelbox{#2}\else \drop#1{#2}\fi
 \def\afteraliases@@{\xy@@\Cbreak@@}\xyFN@\PATHlabelalias@}
\xylet@\labelmargin@=\objectmargin@
\xydef@\labelmargin{\afterADDOP{\Addop@@\labelmargin@}}
\xydef@\hole{\hbox{\dimen@=\objectmargin@ \kern2\dimen@
 \vrule height\dimen@ depth\dimen@ width\z@}}
\xylet@\labelstyle=\scriptstyle
\xydef@\labelbox#1{\hbox{$\m@th\labelstyle{#1}$}}
\xydef@\PATHlabelalias@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\PATHlabelalias@}%
 \else \addEQ@\ifx \next
 \addEQ@\DN@"##1"{\savealias@{##1}\xyFN@\PATHlabelalias@}%
 \else \DN@{\afteraliases@@\PATHlabels@}\fi\fi \next@}
\xylet@\afteraliases@@=\empty
\xydef@\savealias@#1{\xy@@{\enter@\cfromthec@
 \advance\X@c-\L@c \advance\L@c\R@c \L@c=.5\L@c \R@c=\L@c \advance\X@c\L@c 
 \advance\Y@c-\D@c \advance\D@c\U@c \D@c=.5\D@c \U@c=\D@c \advance\Y@c\D@c 
 \idfromc@{#1}\leave@}}
\message{\string\ar,}
\xylet@\arvariant@@=\empty
\xylet@\arstemprefix@@=\empty
\xylet@\artail@@=\empty
\xylet@\arstem@@=\empty
\xylet@\arhead@@=\empty
\xylet@\armodifiers@@=\empty
\xylet@\arlabels@@=\empty
\xylet@\arafterPOS@@=\empty
\xylet@\arinit@@=\empty
\xylet@\arexit@@=\empty
\xylet@\arcomponent@@=\relax
\xylet@\arcomponenttype@@=\relax
\xylet@\afterar@@=\relax
\xydef@\ar{\relax\arSAFE}
\xydef@\arSAFE{%
 \let\arvariant@@=\empty
 \def\arstemprefix@@{\dir}%
 \edef\artail@@{\arvariant@@{}}%
 \edef\arstem@@{\arvariant@@{-}}%
 \edef\arhead@@{\arvariant@@{>}}%
 \def\armodifiers@@{}%
 \def\arafterPOS@@{}%
 \def\arlabels@@{}%
 \def\arinit@@{}%
 \def\arexit@@{}%
 \let\PATHlabelabove@@=\PATHlabelabove@
 \let\PATHlabelbelow@@=\PATHlabelbelow@
 \xyFN@\ar@}
\xydef@\ar@{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\ar@}%
 \else \addAT@\ifx\next \addAT@\DN@{\xyFN@\ar@form}%
 \else\ifx |\next
 \DN@ |{\ar@anchor|}%
 \else\ifx ^\next
 \DN@ ^{\ar@anchor^}%
 \else\ifx _\next
 \DN@ _{\ar@anchor_}%
 \else \let\next@=\ar@x \fi\fi\fi\fi\fi \next@}
\xydef@\addtoarinit@#1{%
 \expandafter\def\expandafter\arinit@@\expandafter{\arinit@@ #1}}
\xydef@\addtoarlabels@#1{%
 \expandafter\def\expandafter\arlabels@@\expandafter{\arlabels@@ #1}}
\xydef@\ar@anchor#1{\begingroup
 \def\PATHlabelit@@##1##2{%
 \DN@{##1}\ifx\next@\empty
 \DN@####1{\expandafter\endgroup\expandafter\addtoarlabels@
 \expandafter{\the\toks@####1{##2}}\xyFN@\ar@}%
 \else
 \DN@####1{\expandafter\endgroup\expandafter\addtoarlabels@
 \expandafter{\the\toks@*!C####1##1{##2}}\xyFN@\ar@}\fi
 \expandafter\next@\expandafter{\PATHitshape@@}}%
 \toks@={#1}%
 \def\xy@##1##2{\addtotoks@{##1}}\change@oxy@\xy@ \let\xy@@ix@=\eat@
 \DNii@{}\xyFN@\PATHanchor@}
\xydef@\ar@form{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\ar@form}%
 \else\ifx ^\next \DN@ ^{\xyFN@\ar@style}\edef\arvariant@@{\string^}%
 \else\ifx _\next \DN@ _{\xyFN@\ar@style}\edef\arvariant@@{\string_}%
 \else\ifx 0\next \DN@ 0{\xyFN@\ar@style}\def\arvariant@@{0}%
 \else\ifx 1\next \DN@ 1{\xyFN@\ar@style}\def\arvariant@@{1}%
 \else\ifx 2\next \DN@ 2{\xyFN@\ar@style}\def\arvariant@@{2}%
 \else\ifx 3\next \DN@ 3{\xyFN@\ar@style}\def\arvariant@@{3}%
 \else\ifx \bgroup\next \let\next@=\ar@style
 \else\ifx [\next \DN@[##1]{\ar@modifiers{[##1]}}%
 \else\ifx *\next \DN@ *{\ar@modifiers}%
 \else\addLT@\ifx\next \let\next@=\ar@slide
 \else\ifx /\next \let\next@=\ar@curveslash
 \else\ifx (\next \let\next@=\ar@curveinout
 \else\addRQ@\ifx\next \addRQ@\DN@{\ar@curve@}%
 \else\addLQ@\ifx\next \addLQ@\DN@{\xyFN@\ar@curve}%
 \else\addDASH@\ifx\next \addDASH@\DN@{\defarstem@-\xyFN@\ar@}%
 \else\addEQ@\ifx\next \addEQ@\DN@{\def\arvariant@@{2}\defarstem@-\xyFN@\ar@}%
 \else\addDOT@\ifx\next \addDOT@\DN@{\defarstem@.\xyFN@\ar@}%
 \else\ifx :\next \DN@:{\def\arvariant@@{2}\defarstem@.\xyFN@\ar@}%
 \else\ifx ~\next \DN@~{\defarstem@~\xyFN@\ar@}%
 \else\ifx !\next \DN@!{\dasharstem@\xyFN@\ar@}%
 \else\ifx ?\next \DN@?{\ar@upsidedown\xyFN@\ar@}%
 \else \let\next@=\ar@error
 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next@}
\xydef@\defarstem@#1{\edef\arstem@@{\arvariant@@{\string#1}}%
 \DNii@##1##{\next@}%
 \edef\next@##1{\def\noexpand\artail@@{\arvariant@@{##1}}}%
 \expandafter\nextii@\artail@@
 \edef\next@##1{\def\noexpand\arhead@@{\arvariant@@{##1}}}%
 \expandafter\nextii@\arhead@@}
\xydef@\dasharstem@{%
 \DN@##1##{\nextii@{##1}}\DNii@##1##2{\def\arstem@@{##1{##2##2}}}%
 \expandafter\next@\arstem@@}
\xydef@\ar@error#1{\xyerror@{Illegal <form>ation (\meaning\next)}{}%
 \xyFN@\ar@}
\xydef@\ar@style{%
 \ifx \bgroup\next \def\artail@@{{}}%
 \edef\arstem@@{\arvariant@@{-}}\edef\arhead@@{\arvariant@@{>}}%
 \expandafter\ar@i
 \else \resetvariant@\artail@@ \resetvariant@\arstem@@ \resetvariant@\arhead@@
 \expandafter\xyFN@\expandafter\ar@ \fi}
\xydef@\resetvariant@#1{%
 \DN@##1##{\DN@{##1}\ifx\next@\empty
 \DN@{\expandafter\nextii@\expandafter{\arvariant@@}}%
 \else \DN@{\nextii@{##1}}\fi \next@}%
 \DNii@##1##2{\def#1{##1{##2}}}%
 \expandafter\next@#1}
\xydef@\ar@i#1{\DN@{#1}%
 \ifx\next@\empty \edef\arstem@@{\arvariant@@{}}\edef\arhead@@{\arvariant@@{}}%
 \DN@{\xyFN@\ar@}%
 \else
 \let\arcomponent@@=\ar@ii \let\arcomponenttype@@=\artip@
 \DN@{\xyFN@\arcomponent@#1$}%
 \fi \next@}
\xydef@\ar@ii{\ifx $\next \let\next@=\ar@iv
 \else \expandafter\def\expandafter\artail@@\expandafter{\the\toks@}%
 \let\arcomponent@@=\ar@iii \let\arcomponenttype@@=\arconn@
 \DN@{\xyFN@\arcomponent@}\fi \next@}
\xydef@\ar@iii{%
 \expandafter\def\expandafter\arstem@@\expandafter{\the\toks@}%
 \resetvariant@\artail@@
 \let\arcomponent@@=\ar@iv \let\arcomponenttype@@=\artip@
 \xyFN@\arcomponent@}
\xydef@\ar@iv{%
 \expandafter\def\expandafter\arhead@@\expandafter{\the\toks@}%
 \ifx $\next \DN@ ${\xyFN@\ar@}%
 \else \xyerror@{illegal <arrow>: \meaning\next\space not valid}{}\fi \next@}
\xydef@\ar@x{%
 \let\arsavedPATHafterPOS@@=\PATHafterPOS \let\PATHafterPOS=\arafterPOS@
 \toks@={\ar@PATH}%
 \expandafter\addtotoks@\expandafter{\expandafter{\artail@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arstem@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arstemprefix@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arhead@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\armodifiers@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arinit@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arexit@@}}%
 \expandafter\addtotoks@\expandafter{\expandafter{\arlabels@@}}%
 \addtotoks@{\afterar@@}%
 \expandafter\DNii@\expandafter{\the\toks@}\toks@={}%
 \nextii@}
{\xyuncatcodes \gdef\next#1#2#3#4#5#6#7#8#9{%
 \def\next{%
 \afterPATH{#9}%
 ~={#6\preconnect#5#3#2}%
 ~/{#7}%
 ~<{|<*h#5\dir#1}%
 ~>{|>*h#5\dir#4}%
 ~+{#8}%
 }%
 \next}}
\xylet@\ar@PATH=\next
\xydef@\arafterPOS@#1{%
 \arsavedPATHafterPOS@@{\let\PATHafterPOS=\arsavedPATHafterPOS@@
 \DN@{#1}\expandafter\next@\arafterPOS@@}}%
\xylet@\arsavedPATHafterPOS@@=\relax
\xydef@\arcomponent@{%
 \ifx ^\next \toks@ii={^}\DN@ ^{\xyFN@\arcomponent@i}%
 \else\ifx _\next \toks@ii={_}\DN@ _{\xyFN@\arcomponent@i}%
 \else\ifx 1\next \toks@ii={1}\DN@ 1{\xyFN@\arcomponent@i}%
 \else\ifx 2\next \toks@ii={2}\DN@ 2{\xyFN@\arcomponent@i}%
 \else\ifx 3\next \toks@ii={3}\DN@ 3{\xyFN@\arcomponent@i}%
 \else\ifx \bgroup\next \expandafter\toks@ii\expandafter{\arvariant@@}%
 \let\next@=\arcomponent@i
 \else\ifx *\next \DN@*##1##{\arcomponent@ii{##1}}%
 \else \expandafter\toks@ii\expandafter{\arvariant@@}\toks@={}%
 \let\next@=\arcomponenttype@@
 \fi\fi\fi\fi\fi\fi\fi
 \next@}
\xydef@\arcomponent@i#1{\toks@={#1}\arcomponent@x}
\xydef@\arcomponent@ii#1#2{\toks@={*#1{#2}}\xyFN@\arcomponent@@}
\xydef@\artip@{%
 \addGT@\ifx\next \addGT@\addtotoks@ \addGT@\DN@{\xyFN@\artip@}%
 \else\addLT@\ifx\next \addLT@\addtotoks@ \addLT@\DN@{\xyFN@\artip@}%
 \else\ifx (\next \addtotoks@(\DN@({\xyFN@\artip@}%
 \else\ifx )\next \addtotoks@)\DN@){\xyFN@\artip@}%
 \else\ifx |\next \addtotoks@|\DN@|{\xyFN@\artip@}%
 \else\addLQ@\ifx\next \addLQ@\addtotoks@ \addLQ@\DN@{\xyFN@\artip@}%
 \else\addRQ@\ifx\next \addRQ@\addtotoks@ \addRQ@\DN@{\xyFN@\artip@}%
 \else\addPLUS@\ifx \next \addPLUS@\addtotoks@ \addPLUS@\DN@{\xyFN@\artip@}%
 \else\ifx /\next \addtotoks@/\DN@/{\xyFN@\artip@}%
 \else\ifcat A\noexpand\next \DN@##1{\addtotoks@{##1}\xyFN@\artip@}%
 \else\ifx\space@\next \addtotoks@{ }\expandafter\DN@\space{\xyFN@\artip@}%
 \else \let\next@=\arcomponent@x
 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next@}
\xydef@\arconn@{%
 \addDASH@\ifx\next \addDASH@\addtotoks@ \addDASH@\DN@{\xyFN@\arconn@}%
 \else\addEQ@\ifx\next \addEQ@\addtotoks@ \addEQ@\DN@{\xyFN@\arconn@}%
 \ifx\arvariant@@\empty \def\arvariant@@{2}\fi
 \else\addDOT@\ifx\next \addDOT@\addtotoks@ \addDOT@\DN@{\xyFN@\arconn@}%
 \else\ifx :\next \addtotoks@:\DN@:{\xyFN@\arconn@}%
 \ifx\arvariant@@\empty \def\arvariant@@{2}\fi
 \else\ifx ~\next \addtotoks@~\DN@~{\xyFN@\arconn@}%
 \else \let\next@=\arcomponent@x
 \fi\fi\fi\fi\fi \next@}
\xydef@\arcomponent@x{%
 \DN@##1{\toks@=\expandafter{\the\toks@ii{##1}}}%
 \expandafter\next@\expandafter{\the\toks@}%
 \xyFN@\arcomponent@@}
\xydef@\ar@curveslash/#1/{\expandafter\ar@curve@\ar@slashing{#1}}
\xydef@\ar@slashing#1{{\xy@{**{} ?+/#1/+/#1/ @+c}{\setupDirection@
 \vfromslide@{#1}%
 \X@c=2\X@c \advance\X@c\X@p \advance\X@c.5\d@X
 \Y@c=2\Y@c \advance\Y@c\Y@p \advance\Y@c.5\d@Y
 \czeroEdge@
 \spushc@}}}
{\xyuncatcodes \catcode`\#=6
 \gdef\next(#1,#2){{+/#1 3pc/,p+/#2 3pc/}}}
\xylet@\ar@curveinout@=\next
\xydef@\ar@curveinout{\expandafter\ar@curve@load\ar@curveinout@}
\xydef@\ar@curve{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\ar@curve}%
 \else\ifx \bgroup\next \let\next@=\ar@curve@load
 \else\ifx "\next \DN@"##1"{\ar@curve@{"##1"}}%
 \else \xyerror@{@= <form> must be followed by \string"<id>\string" or
 {<control point list>}}{}%
 \fi\fi\fi \next@}
{\xyuncatcodes \gdef\next#1#2{\def#1##1{#2{;@={##1}}}}}
\next\ar@curve@load\ar@curve@
\xydef@\ar@curve@#1{\curve@check
 \setcurvearinit@{#1}\setcurvearexit@\arexit@@
 \def\arstemprefix@@{\crvi}\xyFN@\ar@}
{\xyuncatcodes \gdef\next#1{\save @(,#1\restore}}
\xylet@\setcurvearinit@i=\next
\xydef@\setcurvearinit@#1{%
 \expandafter\addtoarinit@\expandafter{\setcurvearinit@i{#1}}}
{\xyuncatcodes \gdef\next#1{\def#1{\POS @i @) }}}
\xylet@\setcurvearexit@=\next
\xydef@\curve@check{%
 \xyerror@{Forms @/.../, @(...), and @`{...}, only available when curve
 extension loaded}{}}
\xywithoption{curve}{\let\curve@check=\relax}
\xydef@\ar@modifiers#1{%
 \expandafter\def\expandafter\armodifiers@@\expandafter{\armodifiers@@#1}%
 \xyFN@\ar@}
{\xyuncatcodes \catcode`\#=6 \catcode`\@=11
 \gdef\next<#1>{\def\arafterPOS@@{<#1>}\xyFN@\ar@}}
\xylet@\ar@slide=\next
\xydef@\ar@upsidedown{\let\next=\PATHlabelabove@@
 \let\PATHlabelabove@@=\PATHlabelbelow@@ \let\PATHlabelbelow@@=\next}
\xyendinput
