%% xytile.tex from $Id: xytile.doc,v 3.8 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``Pattern and Tile extension'' option.
%% Copyright (c) 1993-1997 Ross Moore <ross.moore@mq.edu.au>
%%
%% 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{tile}{Pattern and Tile extension}{\stripRCS$Revision: 3.8 $}%
 {Ross Moore}{ross.moore@mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\xydef@\xypatternwarning@@{\xypatternmessage@
 \gdef\xypatternwarning@{\xypatternmessage@
 \xywarning@{...no further pattern warnings will be given.}%
 \global\let\xypatternwarning@=\relax }}
\xylet@\xypatternwarning@=\xypatternwarning@@
\xydef@\xypatternmessage@{%
 \xywarning@{Current driver does not support patterns.}}%
\xydef@\newxypattern{\begingroup\xycatcodes\newxypattern@i}
\xydef@\newxypattern@i#1#2{\edef\next@{\endgroup
 \noexpand\newxyPattern{#1}{}{#2}{}}\next@}
\xydef@\newxyPattern#1#2#3#4{\newxypattern@{#1}{#2}{#3}{#4}{}}
\xydef@\newxypattern@#1#2#3#4#5{%
 \expandafter\let\expandafter\next@\csname shape [#1]\endcsname
 \ifx\next@\relax
 \DN@{#4}\ifx\next@\empty
 \DN@{#2}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalpattern@{}{#3}\xypattern@{#3}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalpattern@{#2}{#3}\xypattern@{#2 #3}}}%
 \fi
 \else\DN@{#2#3}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalpattern@{#4}{}\xypattern@{#4}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalpattern@{#2}{#3}\xypattern@{#4}}}%
 \fi\fi 
 \else \def\tmp@{\relax}\DNii@{#5}%
 \ifx\nextii@\tmp@
 \DN@{#4}\ifx\next@\empty
 \DN@{#2}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalpattern@{}{#3}\xypattern@{#3}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalpattern@{#2}{#3}\xypattern@{#2 #3}}}%
 \fi
 \else
 \DN@{#2#3}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalpattern@{#4}{}\xypattern@{#4}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalpattern@{#2}{#3}\xypattern@{#4}}}%
 \fi\fi 
 \else\DN@{}\fi\fi \next@\relax }
\xydef@\xyNopattern@#1{}
\xylet@\xypattern@@=\xyNopattern@
\xydef@\xyNopattern@@#1#2{\xypatternwarning@}
\xylet@\xypattern@=\xypattern@@
\xylet@\xylocalpattern@=\xyNopattern@@
\xydef@\Unloadpattern@{%
 \let\xylocalpattern@=\xyNopattern@@
 \let\xypattern@=\xyNopattern@
 \let\xypatternwarning@=\xypatternwarning@@ }
\Unloadpattern@
\xydef@\xystandardpatterns@{}%
\xynew@{read}{\xypatread@}
\xydef@\defaultpattfile@{}
\xydef@\xygetfilepatterns@#1{\DN@{#1}%
 \ifx\next@\empty
 \ifx\defaultpattfile@\empty \xywarning@{No pattern file specified.}%
 \else \DN@{\expandafter\openpattfile@\expandafter{\defaultpattfile@}}\fi
 \else \DN@{\openpattfile@{#1}}\fi \next@ }
\xydef@\openpattfile@#1{\openin\xypatread@=#1.xyp
 \ifeof\xypatread@\xywarning@{No patterns in file: #1.xyp}%
 \closein\xypatread@
 \else \expandafter \xyreadpatfile@ \fi }%
\xydef@\UsePatternFile#1{\def\defaultpattfile@{#1}}
\xydef@\LoadAllPatterns{\let\parsepattern@=\parsepattern@@
 \xygetfilepatterns@ }
\xydef@\LoadPattern#1{\let\parsepattern@=\filepattern@@
 \def\pattname@{#1}\xygetfilepatterns@}
\xydef@\AliasPattern#1#2{\let\parsepattern@=\aliaspattern@@
 \def\aliasname@{#1}\def\pattname@{#2}\xygetfilepatterns@}
\xydef@\xyreadpatfile@{%
 \loop@ \bgroup\xycatcodes
 \global\read\xypatread@ to\xypatline@
 \ifeof\xypatread@ \aftergroup\endpatread@
 \else\aftergroup\morepatread@\fi \edef\next@{%
 \egroup\noexpand\getxypattern@{\xypatline@!!!}\relax}\next@
 \repeat@ }
\xydef@\endpatread@{\closein\xypatread@\iffalse}
\xydef@\morepatread@{\iftrue}
\xydef@\getxypattern@#1{\def\next{#1}\getxypattern@@}
\xydef@\getxypattern@@{\DN@{!!!}\ifx\next\next@\DN@{}%
 \else\DN@{\expandafter\parsepattern@\next}\fi \next@ }
\xydef@\parsepattern@@#1 #2!#3\relax{\newxypattern{#1}{#2}}
\xydef@\filepattern@@#1 #2!#3\relax{\DN@{#1}%
 \ifx\next@\pattname@
 \DN@{\expandafter\foundpattern@\expandafter{\pattname@}{#2}}%
 \else\DN@{}\fi \next@ }
\xydef@\foundpattern@#1#2{\newxypattern{#1}{#2}\endpatread@\fi
 \expandafter\eat@}
\xydef@\aliaspattern@@#1 #2!#3\relax{\DN@{#1}%
 \ifx\next@\pattname@
 \DN@{\expandafter\foundpattern@\expandafter{\aliasname@}{#2}}%
 \else\DN@{}\fi \next@ }
\DN@{\xyaddunsupport{tile}\Unloadpattern@}%
\ifx\xyeverywithoption@tile@\undefined
\else\ifx\xyeverywithoption@tile@\empty
\else
 \DN@{\xysetup@@{\xywithoption{tile}{\xyeverywithoption@tile@\xydriversloaded@@}}}%
\fi\fi \next@
\xyendinput
