%% xyps-f.tex from $Id: xyps-f.doc,v 3.4 1997/05/18 01:13:24 ross Exp $
%%
%% Xy-pic ``Frame extension'' PostScript backend support.
%% Copyright (c) 1995-1997 Ross Moore <ross@mpce.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-1997 Kristoffer H. Rose <krisrose@brics.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.
%%
\expandafter\ifx\csname xyps-floaded\endcsname\empty
 \message{not reloaded}\endinput \fi
\expandafter\let\csname xyps-floaded\endcsname=\empty \xycatcodes
\xydef@\installPSframes@{%
 \let\framed@body@@=\xyPSframed@body@
 \let\circled@x@@=\xyPScircled@x@
 \let\ellipsed@x@@=\xyPSellipsed@x@
 \installPSfills@
 \xyuncatcodes}
\xydef@\UsePSframes{\installPSframes@}
\xydef@\NoPSframes{\UnloadFrames@}
\xydef@\xyPSframed@body@{\DN@{\framed@body@}%
 \ifx\framehfill\frm@solidh@@
 \DN@{\xyPSframed@oval@\xyPSoval@Special}%
 \else\ifdim\R@=\z@\else
 \ifx\framehfill\frm@dashh@@
 \DN@{\xyPSframed@oval@\xyPSdashoval@Special}%
 \else\ifx\framehfill\frm@doth@@
 \DN@{\xyPSframed@oval@\xyPSdotoval@Special}%
 \fi\fi
 \fi\fi \next@ }
\xydef@\xyPSframed@oval@#1{\vglue\U@c
 \hbox{\hglue\L@c\xypsoval@#1\hglue\R@c}\vglue\D@c}
\xydef@\xyPScircled@x@{\DN@{\xyPScircled@x@@\xyPScirc@Special}%
 \ifx\framehfill\frm@doth@@
 \DN@{\xyPScircled@x@@\xyPSdotcirc@Special}%
 \else\ifx\framehfill\frm@dashh@@
 \DN@{\xyPScircled@x@@\xyPSdashcirc@Special}%
 \fi\fi \next@ }
\xydef@\xyPScircled@x@@#1{\vglue2\R@
 \hbox{\hglue2\R@\xypscircle@#1\hglue2\R@}%
 \vglue2\R@}
\xydef@\xyPSellipsed@x@#1#2{%
 \DN@{\xyPSellipsed@x@@\xyPScirc@Special}%
 \ifx\framehfill\frm@doth@@
 \DN@{\xyPSellipsed@x@@\xyPSdotcirc@Special}%
 \else\ifx\framehfill\frm@dashh@@
 \DN@{\xyPSellipsed@x@@\xyPSdashcirc@Special}%
 \fi\fi \next@{#1}{#2}}
\xydef@\xyPSellipsed@x@@#1#2#3{\vglue #3\vglue #3\relax
 \hbox{\L@c = #2\relax \R@c=\L@c \D@c = #3\relax \U@c=\D@c 
 \hglue#2\hglue#2\relax\xypsellipse@#1\hglue#2\hglue#2\relax}%
 \vglue #3\vglue #3\relax}
\xydef@\xyPSdashhfill@{{\SemiDirectionChar=95 \Direction=3072 \xyPSdash@}}
\xydef@\xyPSdashvfill@{{\SemiDirection=31 \Direction=1023 \xyPSdash@}}
\xydef@\xypsoval@#1{%
 \dimen@=\L@c \advance\dimen@\R@c
 \dimen@ii=\U@c \advance\dimen@ii\D@c 
 \ifdim\dimen@ii<\dimen@ \relax \dimen@=\dimen@ii\fi \divide\dimen@\tw@
 \ifdim\R@>\dimen@ \relax \R@=\dimen@ \fi
 \D@c=-\D@c \L@c=-\L@c 
 \edef\tmp@{\expandafter\removePT@\the\R@
 \space\expandafter\removePT@\the\R@c 
 \space\expandafter\removePT@\the\D@c 
 \space\expandafter\removePT@\the\L@c 
 \space\expandafter\removePT@\the\U@c }%
 \expandafter#1\expandafter{\tmp@}}
\xydef@\xypscircle@#1{\dimen@=\R@
 \edef\tmp@{\expandafter\removePT@\the\dimen@}%
 \expandafter#1\expandafter{\tmp@}}
\xydef@\xypsellipse@#1{\edef\tmp@{%
 \expandafter\removePT@\the\U@c \space
 \expandafter\removePT@\the\D@c \space
 \expandafter\removePT@\the\L@c \space
 \expandafter\removePT@\the\R@c }%
 \expandafter#1\expandafter{\tmp@}}
\xydef@\xyPSoval@Special#1{\PSmacro@{#1 ov}}
\xydef@\xyPScirc@Special#1{\PSmacro@{#1 ox}}
\xydef@\xyPSdotcirc@Special#1{\PSmacro@{#1 ot}}
\xydef@\xyPSdashcirc@Special#1{\PSmacro@{#1 od}}
\xydef@\xyPSdotoval@Special#1{\PSmacro@{#1 vt}}
\xydef@\xyPSdashoval@Special#1{\PSmacro@{#1 vd}}
\xydef@\xyPSfilledRegion#1#2{\setboxz@h{\lower\D@c\vbox{%
 \vglue\U@c\hbox{#1#2\empty\hglue\L@c\hglue\R@c}\vglue\D@c}}%
 \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}
\xydef@\filledRectangle@PS{%
 \xyPSfilledRegion{\xypsoval@\xyPSfilloval@Special}}
\xydef@\filledCircle@PS#1{{\R@c=\R@ \L@c=\R@ \U@c=\R@ \D@c=\R@
 \xyPSfilledRegion{\xypscircle@\xyPSfillcirc@Special}#1}}
\xydef@\filledEllipse@PS{%
 \xyPSfilledRegion{\xypsellipse@\xyPSfillellipse@Special}}
\xydef@\filledOval@PS{%
 \xyPSfilledRegion{\xypsoval@\xyPSfilloval@Special}}
\xydef@\frame@emph@PS#1{\filled@{#1}\relax}
\xydef@\installPSfills@{%
 \let\frame@emph@@=\frame@emph@PS
 \let\filledRectangle@@=\filledRectangle@PS
 \let\filledOval@@=\filledOval@PS
 \let\filledCircle@@=\filledCircle@PS
 \let\filledEllipse@@=\filledEllipse@PS
}
\xydef@\xyPSfilloval@Special#1#2{%
 \ifx#2\relax\PSmacro@{#1 sfo}%
 \else\PSmacro@{#1 fo}\fi}
\xydef@\xyPSfillcirc@Special#1#2{%
 \ifx#2\relax\PSmacro@{#1 sfc}%
 \else\PSmacro@{#1 fc}\fi}
\xydef@\xyPSfillellipse@Special#1#2{%
 \ifx#2\relax\PSmacro@{#1 sfe}%
 \else\PSmacro@{#1 fe}\fi}
\endinput
