%% xyv2.tex from $Id: xyv2.doc,v 2.12 1994/10/25 11:34:25 kris Exp $
%%
%% XY-pic ``Version 2 compatibility'' feature.
%% Copyright (c) 1993-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% 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-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% 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, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{v2}{Version 2 Compatibility feature}{\stripRCS$Revision: 2.12 $}%
 {Kristoffer H.~Rose}{kris@diku.dk}%
 {Computer Science, University of Copenhagen, Universitetsparken~1,
 DK--2100 K{\o}benhavn~{\O}}
\ifx\redefine\undefined \let\redefine=\def \fi
\ifx\define\undefined \let\define=\xydef@ \fi
\ifx\dsize\undefined \let\dsize=\displaystyle \fi
\ifx\tsize\undefined \let\dsize=\textstyle \fi
\ifx\ssize\undefined \let\ssize=\scriptstyle \fi
\ifx\sssize\undefined \let\sssize=\scriptscriptstyle \fi
\ifx\text\undefined
 \def\text#1{\relax
 \ifmmode\mathchoice
 {\hbox{\the\textfont0\relax#1}}%
 {\hbox{\the\textfont0\relax#1}}%
 {\hbox{\the\scriptfont0\relax#1}}%
 {\hbox{\the\scriptscriptfont0\relax#1}}%
 \else{\relax#1}\fi}
\fi
\xydef@\Text{\relax\xyFN@\Text@}
\xydef@\Text@{%
 \addLT@\ifx\next \addGT@{\addLT@\DN@##1}{\A@=##1\Text@i}%
 \else \DN@{\A@=\maxdimen \Text@i}\fi \next@}
\xydef@\Text@i#1{%
 \ifmmode \mathchoice
 {\expandafter\Text@ii\the\textfont0{#1}}%
 {\expandafter\Text@ii\the\textfont0{#1}}%
 {\expandafter\Text@ii\the\scriptfont0{#1}}%
 {\expandafter\Text@ii\the\scriptscriptfont0{#1}}%
 \else
 \leavevmode \expandafter\Text@ii\the\textfont0{#1}%
 \fi\ignorespaces}
\xydef@\Text@ii{\hbox\bgroup \txt@i}
\xylet@\cL=\Lc
\xylet@\cR=\Rc
\xylet@\cD=\Dc
\xylet@\cH=\Uc
\xydef@\go{\aftergo{}}
\xydef@\aftergo#1{\xy@\aftergo{\enter@\pfromthec@}\afterPOS{\xy@@\leave@#1}}
\xydef@\merge{\POS.p\relax}
\xydef@\swap{\xy@\swap\swap@}
\xydef@\Drop{\expandafter\drop\entrymodifiers@}
\xydef@\none{\xy@\none{}\ignorespaces}
\xydef@\solid{\connect h\dir{-}}
\xydef@\Solid{\connect h\dir2{-}}
\xydef@\Ssolid{\connect h\dir3{-}}
\xydef@\dashed{\connect h\dir{--}}
\xydef@\Dashed{\connect h\dir2{--}}
\xydef@\Ddashed{\connect h\dir3{--}}
\xydef@\dotted{\connect h\dir{.}}
\xydef@\Dotted{\connect h\dir2{.}}
\xydef@\Ddotted{\connect h\dir3{.}}
\xydef@\dottedwith#1{\connect h{#1}}
\xydef@\notip{\dir{}}
\xydef@\stop{\dir{|}}
\xydef@\astop{\dir^{|}}
\xydef@\bstop{\dir_{|}}
\xydef@\tip{\dir{>}}
\xydef@\atip{\dir^{>}}
\xydef@\btip{\dir_{>}}
\xydef@\Tip{\dir2{>}}
\xywarnifdefined\aTip
\xywarnifdefined\bTip
{\xyuncatcodes
 \gdef\aTip{\object=<5pt>:(32,-1)\dir^{>}}
 \gdef\bTip{\object=<5pt>:(32,+1)\dir_{>}}}
\xydef@\Ttip{\dir3{>}}
\xydef@\ahook{\dir^{(}}
\xydef@\bhook{\dir_{(}}
\xydef@\aturn{\dir^{'}}
\xydef@\bturn{\dir_{'}}
\xydef@\rotate{\hbox\bgroup
 \DN@{\ifx (\next
 \DN@(####1){\rotate@@{####1}}%
 \else \DN@{\rotate@}\fi\next@}\xyFN@\next@}
\xydef@\rotate@#1{\reverseDirection@ #1\OBJECT@x}
\xydef@\rotate@@#1#2{\dimen@=#1\p@
 \ifdim \dimen@=-\p@ \aboveDirection@\xydashl@
 \else\ifdim\dimen@= \p@ \belowDirection@\xydashl@
 \else\ifdim\dimen@<-1.5\p@ \advance\dimen@-2\p@
 \edef\next@{\expandafter\removePT@\the\dimen@}\vDirection@(-1,\next@){1pc}%
 \else\ifdim\dimen@<-.5\p@ \vDirection@(#1,-1){1pc}%
 \else\ifdim\dimen@< .5\p@ \vDirection@( 1,#1){1pc}%
 \else\ifdim\dimen@<1.5\p@ \vDirection@(#1, 1){1pc}%
 \else \dimen@=-\dimen@ \advance\dimen@2\p@
 \edef\next@{\expandafter\removePT@\the\dimen@}\vDirection@(-1,\next@){1pc}%
 \fi\fi\fi\fi\fi\fi
 #2\OBJECT@x}
\xydef@\hole{\hbox{\dimen@=\objectmargin@ \kern2\dimen@
 \vrule height\dimen@ depth\dimen@ width\z@}}
\xydef@\squash#1{%
 \ifmmode\setboxz@h{\m@th${\mathstrut}#1{\mathstrut}$}\else\setboxz@h{#1}\fi
 \setboxz@h{\kern-.5\wdz@ \dimen@=.5\ht\z@ \advance\dimen@-.5\dp\z@
 \lower\dimen@\boxz@}%
 \wdz@=\z@ \ht\z@=\z@ \dp\z@=\z@ \boxz@}
\xydef@\grow{%
 \DN@{\ifx <\next \DN@<####1>{\dimen@=####1\grow@\empty}%
 \else \DN@{\dimen@=2\p@ \grow@\empty}\fi\next@}\xyFN@\next@}
\xydef@\grow@#1#{\grow@@{#1}}
\xydef@\grow@@#1#2{\relax
 \ifmmode \setboxz@h{\kern\dimen@ \m@th$#2$\kern\dimen@}%
 \else \setboxz@h{\kern\dimen@ {#2}\kern\dimen@}\fi
 \dimen@ii=\ht\z@ \advance\dimen@ii\dimen@ \ht\z@=\dimen@ii
 \dimen@ii=\dp\z@ \advance\dimen@ii\dimen@ \dp\z@=\dimen@ii \boxz@}
\xydef@\squarify{\addEQ@{\addPLUS@\object}}
\xydef@\qc{\corn@@}
\xyuncatcodes \xyrequire{frame}\xycatcodes
\xyuncatcodes \xyrequire{matrix}\xycatcodes
\xydef@\diagram#1\enddiagram{\relax\diagram@\diagram@@{#1}}
\xydef@\diagram@{\relax
 \ifmmode \DN@##1##2{\vcenter{\oldxymatrix@true \xy##1{\xymatrix{##2}}\endxy}}%
 \else\DN@##1##2{{\oldxymatrix@true \xy/u.8ex/##1{\xymatrix{##2}}\endxy}}%
 \fi \next@}
\xydef@\LaTeXdiagrams{\def\diagram{\ltxdiagram@\diagram@@}%
 \def\diagramnocompile{\ltxdiagram@\literal@}%
 \def\diagramcompileto##1{\ltxdiagram@{\xycompileto{##1}}}}
\xydef@\ltxdiagram@#1#2\end#3{\relax
 \DN@{#3}\DNii@{diagram}\ifx\next@\nextii@\diagram@{#1}{#2}\end{diagram}%
 \else\xyerr@{Put \string{\string} around \string\begin...\string\end\space
 within diagrams}\fi}
\xylet@\diagram@@=\literal@
\xydef@\NoisyDiagrams{}
\xydef@\spreaddiagramrows#1{\addPLUS@\xymatrixrowsep{#1}}
\xydef@\spreaddiagramcolumns#1{\addPLUS@\xymatrixcolsep{#1}}
\xyuncatcodes\xyrequire{arrow}\xycatcodes
\xylet@\arrow=\ar
\xyuncatcodes \catcode35=6
 \def\next#1#2#3{\relax \PATH ~={**{}} ~-{\relax#1} ~>{?>*{#2}} ~<{;?<*{#3};}}
\xycatcodes
\xylet@\morphism=\next
\xydef@\definemorphism#1#2#3#4{%
 \xydefcsname@{x#1}{\morphism{#2}{#3}{#4}}%
 \xydefcsname@{u#1}{\morphism{#2}{#3}{#4}[u]}%
 \xydefcsname@{d#1}{\morphism{#2}{#3}{#4}[d]}%
 \xydefcsname@{l#1}{\morphism{#2}{#3}{#4}[l]}%
 \xydefcsname@{r#1}{\morphism{#2}{#3}{#4}[r]}%
 \xydefcsname@{uu#1}{\morphism{#2}{#3}{#4}[uu]}%
 \xydefcsname@{dd#1}{\morphism{#2}{#3}{#4}[dd]}%
 \xydefcsname@{ll#1}{\morphism{#2}{#3}{#4}[ll]}%
 \xydefcsname@{rr#1}{\morphism{#2}{#3}{#4}[rr]}%
 \xydefcsname@{ur#1}{\morphism{#2}{#3}{#4}[ur]}%
 \xydefcsname@{ul#1}{\morphism{#2}{#3}{#4}[ul]}%
 \xydefcsname@{dr#1}{\morphism{#2}{#3}{#4}[dr]}%
 \xydefcsname@{dl#1}{\morphism{#2}{#3}{#4}[dl]}%
 \xydefcsname@{uul#1}{\morphism{#2}{#3}{#4}[uul]}%
 \xydefcsname@{uur#1}{\morphism{#2}{#3}{#4}[uur]}%
 \xydefcsname@{ull#1}{\morphism{#2}{#3}{#4}[ull]}%
 \xydefcsname@{urr#1}{\morphism{#2}{#3}{#4}[urr]}%
 \xydefcsname@{ddl#1}{\morphism{#2}{#3}{#4}[ddl]}%
 \xydefcsname@{ddr#1}{\morphism{#2}{#3}{#4}[ddr]}%
 \xydefcsname@{dll#1}{\morphism{#2}{#3}{#4}[dll]}%
 \xydefcsname@{drr#1}{\morphism{#2}{#3}{#4}[drr]}%
 \xydefcsname@{uull#1}{\morphism{#2}{#3}{#4}[uull]}%
 \xydefcsname@{uurr#1}{\morphism{#2}{#3}{#4}[uurr]}%
 \xydefcsname@{ddll#1}{\morphism{#2}{#3}{#4}[ddll]}%
 \xydefcsname@{ddrr#1}{\morphism{#2}{#3}{#4}[ddrr]}}
\definemorphism{to}\solid\tip\notip
\definemorphism{line}\solid\notip\notip
\definemorphism{dashed}\dashed\notip\notip
\definemorphism{dotted}\dotted\notip\notip
\definemorphism{double}\Solid\notip\notip
\xywarnifdefined\to@@i
\xywarnifdefined\to@@ii
\xydef@\XXtoY@#1#2#3#4#5{\save;[#3]\relax
 \xy@@{%
 \dimen@=\turnradius@ \ifdim#1<#2\relax \dimen@ii=#2\else\dimen@ii=#1\fi
 \advance\dimen@\ifdim\dimen@>\dimen@ii +\dimen@\else +\dimen@ii\fi
 \edef\to@@i{\the\dimen@}\leave@}%
 \xto ~{[#3]} `#4[#3]#5/#4\to@@i/ `[#3]}
\xydef@\toXY@#1#2#3#4#5{\xy@@{\idfromc@{@}%
 \dimen@=\turnradius@ \dimen@ii=#1\relax
 \advance\dimen@\ifdim\dimen@>\dimen@ii +\dimen@\else +\dimen@ii\fi
 \edef\to@@i{\the\dimen@}%
 \dimen@=\turnradius@ \dimen@ii=#2\relax
 \advance\dimen@\ifdim\dimen@>\dimen@ii +\dimen@\else +\dimen@ii\fi
 \edef\to@@ii{\the\dimen@}}%
 \morphism\solid{\object #4:(-1,0)\dir{>}}\notip
 ~{`"@" "@"} `#3"@"#5/#3\to@@i/#5/#4\p@/ `"@"#5/#4\to@@ii/}
\xyuncatcodes \catcode64=11
\xydef@\lltod{\XXtoY@\Dc\Dp{ll}{d}+}
\xydef@\lltou{\XXtoY@\Uc\Up{ll}{u}+}
\xydef@\rrtod{\XXtoY@\Dc\Dp{rr}{d}+}
\xydef@\rrtou{\XXtoY@\Uc\Up{rr}{u}+}
\xydef@\ddtol{\XXtoY@\Lc\Lp{dd}{l}+}
\xydef@\ddtor{\XXtoY@\Rc\Rp{dd}{r}+}
\xydef@\uutol{\XXtoY@\Lc\Lp{uu}{l}+}
\xydef@\uutor{\XXtoY@\Rc\Rp{uu}{r}+}
\xydef@\told{\toXY@\Lc\Dc{l}{d}+}
\xydef@\tolu{\toXY@\Lc\Uc{l}{u}+}
\xydef@\tord{\toXY@\Rc\Dc{r}{d}+}
\xydef@\toru{\toXY@\Rc\Uc{r}{u}+}
\xydef@\todl{\toXY@\Dc\Lc{d}{l}+}
\xydef@\todr{\toXY@\Dc\Rc{d}{r}+}
\xydef@\toul{\toXY@\Uc\Lc{u}{l}+}
\xydef@\tour{\toXY@\Uc\Rc{u}{r}+}
\xycatcodes
\xydef@\TurnRadius{\addEQ@\turnradius}
\xydef@\diagramcompileto#1#2\enddiagram{\relax
 \diagram@{\xycompileto{#1}}{#2}}
\xynew@{count}\xydiagramno@
\xydef@\xycompilediagramprefix@{}
\xydef@\CompileAllDiagrams#1{\ifx\diagram@@\literal@
 \global\xydiagramno@=\z@
 \gdef\xycompilediagramprefix@{#1}%
 \def\diagram@@{\global\advance\xydiagramno@\@ne
 \edef\next{\noexpand\xycompileto{#1\the\xydiagramno@}}\next}%
 \else \xywarning@{Second \string\CompileAllDiagrams\space ignored}\fi}
\xydef@\diagramnocompile#1\enddiagram{\relax\diagram@\literal@{#1}}
\xydef@\NoCompileAllDiagrams{\let\diagram@@=\literal@}
\xydef@\ReCompileAllDiagrams{%
 \def\diagram@@{\global\advance\xydiagramno@\@ne
 \edef\next{\noexpand\xycompileto
 {\xycompilediagramprefix@\the\xydiagramno@}}\next}}
\xyendinput
