%% xyps.tex from $Id: xyps.doc,v 3.3 1996/12/19 03:50:08 ross Exp $
%%
%% Xy-pic ``PostScript backend''.
%% Copyright (c) 1993-1996 Ross Moore <[email protected]>
%%
%% 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-1996 Kristoffer H. Rose <[email protected]>
%%
%% 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{ps}{PostScript backend}{\stripRCS$Revision: 3.3 $}%
{Ross Moore}{[email protected]}%
{Mathematics Department, Macquarie University, NSW~2109, Australia}
\xydef@\UsePSspecials{\DNii@{{[4]}}\xyFN@\UsePSspecials@i}
\xydef@\UsePSspecials@i{%
\ifx \space@\next \expandafter\DN@\space{\xyFN@\UsePSspecials@i}%
\else\ifx [\next \DN@[##1]{\DNii@{{[##1]}}\xyFN@\UsePSspecials@i}%
\else\ifcat 5\noexpand\next \DN@##1{\DNii@{{[##1]}}\xyFN@\UsePSspecials@i}%
\else\ifx\bgroup\next \DN@{\expandafter\UsePS@specials\nextii@}%
\else \DN@{\UsePS@specials{[4]}}%
\fi\fi\fi\fi \next@ }
\xydef@\UsePS@specials#1#2{%
\ifx\empty\whichPSspecials@
\DN@{#2}\ifx\next@\empty
\else
\expandafter\let\expandafter\next\csname#2@\endcsname
\ifx\next\relax \DN@{\UsePSspecials@{#2}{}}%
\else \DN@{\UsePSspecials@{#2}{#1}}\fi
\fi
\else
\DN@{#2}\ifx\next@\empty \DN@{\PSspecials@true}%
\else
\DN@{#2}%
\edef\nextii@{\expandafter\string\whichPSspecials@}%
\ifx\next@\nextii@\DN@{\PSspecials@true}%
\else
\ifx\firstPS@@\relax
\DN@{\xyerror@{Only one PS <driver> allowed: \dvitype@ already loaded}{}}%
\else
\expandafter\let\expandafter\next\csname#2@\endcsname
\ifx\next\relax
\DN@{\xyerror@{PostScript specials for `#2' not supported}{}}%
\else
\xywarning@{Changing PS <driver> to #2 }%
\DN@{\UsePSspecials@{#2}{#1}}%
\fi
\fi
\fi
\fi
\fi \next@}
\xydef@\UseDVIPSspecials{\UsePSspecials@\dvips@}
\xydef@\UseTexturesPSspecials{\UsePSspecials@\Textures@}
\xydef@\UseTexturesSpecials{\UsePSspecials@\Textures@}
\xydef@\UsePostScriptSpecials{\UsePSspecials@\dvips@}
\xydef@\UseOzTeXspecials{\UsePSspecials@\OzTeX@}
\xydef@\UseDVITOPSspecials{\UsePSspecials@\dvitops@}
\message{drivers,}
\xydef@\loadPSdriver@#1#2{\xyinputorelse@{xy#1}%
{\xyrequire{#2}\expandafter\ifx\csname xy#2loaded\else
{\xyerror@{Unable to load xy#1.tex for #2 driver}{}}\fi}}
\xydef@\dvips@{\loadPSdriver@{ps-dvi}{dvips}}
\xydef@\Textures@{\loadPSdriver@{ps-txt}{Textures}}
\xydef@\OzTeX@{\loadPSdriver@{ps-oz}{OzTeX}}
\xydef@\dvitops@{\loadPSdriver@{ps-dto}{dvitops}}
\xydef@\dvipsone@{\loadPSdriver@{ps-one}{dvipsone}}
\global\newif\ifPSspecials@
\xydef@\UsePSspecials@#1{\def\whichPSspecials@{#1}%
\DN@{\Textures@}\ifx\next@\whichPSspecials@
\DN@##1{\xyrequire{textures}%
\def\whichPSspecials@{textures}\xyps@options}%
\else\DN@{\dvips@}\ifx\next@\whichPSspecials@
\DN@##1{\xyrequire{dvips}%
\def\whichPSspecials@{dvips}\xyps@options}%
\else\DN@{\OzTeX@}\ifx\next@\whichPSspecials@
\DN@##1{\xyrequire{oztex}%
\def\whichPSspecials@{oztex}\xyps@options}%
\else\DN@{\dvitops@}\ifx\next@\whichPSspecials@
\DN@##1{\xyrequire{dvitops}%
\def\whichPSspecials@{dvitops}\xyps@options}%
\else
\DN@##1{\xyrequire{ps}\xyrequire{#1}\xyps@options}%
\fi\fi\fi\fi \next@ }
\xydef@\xyps@options{%
\xyrequire{ps}\xyrequire{line}\xyrequire{color}\xyrequire{crayon}%
\xyrequire{rotate}\xyrequire{tile}\xyrequire{frame}\xyuncatcodes }
\xydef@\whichPSspecials@{}
\xydef@\NoPSspecials{\xyPSwarning@{off}%
\PSspecials@false\aftergroup\resetPS@}
\xydef@\resetPS@{\ifPSspecials@\xyPSwarning@{back on}\fi}
\xydef@\UsePSspecials@x{\PSspecials@true\resetPS@}
\xydef@\xyPSwarning@#1{\xywarning@{PostScript switched #1}}
\xyaddunsupport{ps}{\csname UnloadPS@@\endcsname}
\xydef@\PSspecials@{%
\ifx\next[\DN@[##1]{\setxyPSlevel@{##1}\xyFN@\PSspecials@}%
\else\DN@{\whichPSspecials@\PSspecials@@}%
\fi \next@ }%
\xydef@\PSspecials@@{%
\ifx\und@fined\PSmessage\hidePSmessages\fi \setupxyPS@}
\xydef@\setupxyPSlevelO@{\relax}
\xydef@\setxyPSlevel@#1{\ifcase#1%
\gdef\setupxyPS@{\setupxyPSlevelO@}%
\or\gdef\setupxyPS@{\setupxyPSlevelA@}%
\or\gdef\setupxyPS@{\setupxyPSlevelB@}%
\or\gdef\setupxyPS@{\setupxyPSlevelC@}%
\or\gdef\setupxyPS@{\setupxyPSlevelD@}%
\else\gdef\setupxyPS@{\setupxyPSlevelD@}\fi }
\xywarnifdefined\setupxyPS@
\gdef\setupxyPS@{\setupxyPSlevelD@ \gdef\setupxyPS@{\PSspecials@true}}
\xydef@\PSincrease@#1{%
\xywarning@{The PS level may only increase: #1 is already active}}
\DN@{\csname newif\endcsname\ifUsePSdict@@\DN@{}}
\ifx\undefined\UsePSdict@@true\else\DN@{}\fi \next@
\ifx\undefined\xyPSdefaultdict
\xydef@\xyPSdefaultdict{%
\DN@##1.##2.##3@{\gdef\xyPSdictname{xy##1##2dict.pro}}%
\expandafter\next@\xyversion.@}%
\fi
\ifx\undefined\UsePSheader@
\xydef@\UsePSheader@#1{%
\DN@{#1}\ifx\next@\empty
\else \gdef\xyPSdictname{#1}\fi
\ifx\xyPSdictname\undefined\xyPSdefaultdict\fi
\gdef\xyHeaderMessage@{%
It includes a reference to the PostScript file \xyPSdictname.^^J}%
\UsePSdict@@true}%
\let\UsePSheader=\UsePSheader@
\fi
\xydef@\dumpPSdict#1{\DN@{#1}\ifx\next@\empty
\ifx\undefined\xyPSdictname\xyPSdefaultdict\fi
\else\gdef\xyPSdictname{#1}\fi
\def\dumpPSdict@@{\writePSdict@@}%
\ifx\xydriversselected@@\empty\DN@{\xysetup@@\null@xy@ps}%
\else \DN@{\installxyps@x}\fi \next@}
\message{hooks,}
\gdef\xyPSalternative@#1#2{%
\expandafter\global\expandafter\let\csname origxy#2@\endcsname=#1%
\xdef#1{\noexpand\ifPSspecials@
\noexpand\expandafter\expandafter\noexpand\csname xyPS#2@\endcsname
\noexpand\else
\noexpand\expandafter\expandafter\noexpand\csname origxy#2@\endcsname
\noexpand\fi}}%
\xydef@\setupxyPSlevelA@{\xyPStips@%
\xyPSalternative@{\Tip@@}{Tip}%
\xyPSalternative@{\Ttip@@}{Ttip}%
\xyPSalternative@{\Tip@@eu}{Tip@eu}%
\xyPSalternative@{\Ttip@@eu}{Ttip@eu}%
\xyPSalternative@{\hook@@}{hook}%
\xyPSalternative@{\ahook@@}{ahook}%
\xyPSalternative@{\bhook@@}{bhook}%
\xyPSalternative@{\aturn@@}{aturn}%
\xyPSalternative@{\bturn@@}{bturn}%
\xyPSalternative@{\squiggle@@}{squiggle}%
\xyPSalternative@{\stopper@@}{stopper}%
\xyPSalternative@{\line@@}{dash}%
\xyPSalternative@{\circhar@@}{circhar@}%
\gdef\setupxyPSlevelA@{\PSincrease@{1}}%
\global\let\UsePSspecials=\UsePSspecials@x \PSspecials@true}
\xydef@\setupxyPSlevelB@{%
\let\xyPSfont@=\empty \let\xyPSsemifont@=\empty
\xyPSalternative@{\cirrestrict@@}{cirrest}%
\gdef\setupxyPSlevelB@{\PSincrease@{2}}%
\setupxyPSlevelA@ }
\xydef@\setupxyPSlevelC@{%
\xyPSalternative@{\cirbuild@}{cirbuild}%
\xyPSalternative@{\CIRfull@}{CIRfull}%
\xyPSalternative@{\solid@}{solid}%
\xyPSalternative@{\point@}{point}%
\xywithoption{curve}{%
\xyPSalternative@{\splinesolid@}{splinesolid}}%
\gdef\setupxyPSlevelC@{\PSincrease@{3}}%
\setupxyPSlevelB@ }%
\xydef@\setupxyPSlevelD@{%
\xyPSalternative@{\dash@}{dashed}%
\xywithoption{curve}{%
\xyPSalternative@{\splinedashed@}{splinedashed}%
\xyPSalternative@{\splinedotted@}{splinedotted}}%
\gdef\setupxyPSlevelD@{}%
\setupxyPSlevelC@ }
\xydef@\xyPSchar@#1{%
\PSmessage{\the\Direction\space #1}%
\PSmacro@@{\the\Direction\space \xyPSfont@ #1}}
\xydef@\xyPSsemichar@#1{%
\PSmessage{\the\Direction\space\xyPSsemifont@ #1}%
\PSmacro@@{\the\Direction\space \xyPSsemifont@ #1}}
\xydef@\xyPSfont@{f }%
\xydef@\xyPSsemifont@{fs }%
\xydef@\xyPStip@{\xyPSchar@{t}}%
\xydef@\xyPSTip@{\xyPSchar@{/XT tt}}%
\xydef@\xyPSTtip@{\setboxz@h\bgroup
\reverseDirection@\line@ \wdz@=\z@ \ht\z@=\z@ \dp\z@=\z@
\kern-\L@c \boxz@ \kern\L@c \xyPSchar@{/Xt tT}}%
\xydef@\xyPSTip@eu@{\xyPSchar@{/ET tt}}%
\xydef@\xyPSTtip@eu@{\setboxz@h\bgroup
\reverseDirection@\line@ \wdz@=\z@ \ht\z@=\z@ \dp\z@=\z@
\kern-\L@c \boxz@ \kern\L@c \xyPSchar@{/ET tT}}%
\xydef@\xyPScm@\tip@x{\xyFN@\xyPScm@@}%
\xydef@\xyPScm@@{%
\ifx\next\tip@@ \DN@\tip@@{\tip@x\xyPScmtip@}%
\else\ifx\next\atip@@ \DN@\atip@@{\tip@x\xyPScmatip@}%
\else\ifx\next\btip@@ \DN@\btip@@{\tip@x\xyPScmbtip@}%
\else\DN@{}%
\fi\fi\fi \next@}%
\xydef@\xyPScmtip@{\xyPSchar@{ct}}%
\xydef@\xyPScmatip@{\xyPSchar@{ca}}%
\xydef@\xyPScmbtip@{\xyPSchar@{cb}}%
\xydef@\xyPStips@{%
\xyPSalternative@{\atip@@}{atip}%
\xyPSalternative@{\btip@@}{btip}%
\xyPSalternative@{\tip@@}{abtip}%
}%
\xydef@\xyPSatip@{\xyPSwhichatip@
\expandafter\xyPSchar@\expandafter{\xyPSfont@@}}%
\xydef@\xyPSbtip@{\xyPSwhichbtip@
\expandafter\xyPSchar@\expandafter{\xyPSfont@@}}%
\xydef@\xyPSabtip@{\xyPSwhichabtip@
\expandafter\xyPSchar@\expandafter{\xyPSfont@@}}%
\xydef@\xyPSwhichatip@{\ifx\xyatipfont\xy@@atfont
\expandafter\xyPSatip@i \else\def\xyPSfont@@{10 /xy A}\fi }%
\xydef@\xyPSwhichbtip@{\ifx\xybtipfont\xy@@btfont
\expandafter\xyPSbtip@i \else\def\xyPSfont@@{10 /xy B}\fi }%
\xydef@\xyPSwhichabtip@{\ifx\xyatipfont\xy@@atfont
\expandafter\xyPSabtip@i \else\def\xyPSfont@@{10 /xy AB}\fi }%
\xydef@\xyPSatip@i{%
\edef\xyPSfont@@{\tipsize@@\space/\tipfamily@@\space A}}
\xydef@\xyPSbtip@i{%
\edef\xyPSfont@@{\tipsize@@\space/\tipfamily@@\space B}}
\xydef@\xyPSabtip@i{%
\edef\xyPSfont@@{\tipsize@@\space/\tipfamily@@\space AB}}
\xydef@\xyPSTtips@{%
\let\Ttip@xy=\Ttip@
\let\Ttip@cm=\Ttip@
\let\Ttip@eu=\Ttip@ }
\xydef@\xyPShook@{\xyPSchar@{h}}%
\xydef@\xyPSahook@{\xyPSchar@{ha}}%
\xydef@\xyPSbhook@{\xyPSchar@{hb}}%
\xydef@\xyPSaturn@{\xyPSchar@{ta}}%
\xydef@\xyPSbturn@{\xyPSchar@{tb}}%
\xydef@\xyPSsquiggle@{\xyPSchar@{g}}%
\xydef@\xyPSstopper@{\xyPSchar@{st}}%
\xydef@\xyPSfliptrue@{\DN@{\xyPSsemichar@{T d}}}
\xydef@\xyPSdash@{%
\DN@{\xyPSsemichar@{F d}}%
\ifnum\SemiDirectionChar=31
\ifdim\d@Y<\z@
\ifdim\d@X<\z@ \ifx\xyPSsemifont@\empty\xyPSfliptrue@\fi\fi
\else
\ifdim\z@>\d@X
\ifx\xyPSsemifont@\empty\else\xyPSfliptrue@\fi
\else\xyPSfliptrue@\fi
\fi\fi
\next@ \setboxz@h{\origxydash@}\kern\wdz@
\setbox\z@=\box\voidb@x }
\xydef@\xyPScirchar@#1{\count@=#1\edef\tmp@{\the\count@}%
\ifcase#1%
\xyPScirchar@@@{-180}{-135}{\tmp@}\dimen@=\partroottwo\R@
\or\xyPScirchar@@@{-135}{-90}{\tmp@}\dimen@=\halfroottwo\R@
\or\xyPScirchar@@@{-90}{-45}{\tmp@}\dimen@=\halfroottwo\R@
\or\xyPScirchar@@@{-45}0{\tmp@}\dimen@=\partroottwo\R@
\or\xyPScirchar@@@0{45}{\tmp@}\dimen@=\partroottwo\R@
\or\xyPScirchar@@@{45}{90}{\tmp@}\dimen@=\halfroottwo\R@
\or\xyPScirchar@@@{90}{135}{\tmp@}\dimen@=\halfroottwo\R@
\or\xyPScirchar@@@{135}{180}{\tmp@}\dimen@=\partroottwo\R@
\fi}
\xydef@\xyPScirrest@{\relax}%
\xydef@\xyPScirchar@@#1{\relax\count@=#1\edef\tmp@{\the\count@}%
\expandafter\xyPScirchar@@@\ifcase#1%
{-180}{-135}{\tmp@}\kern\partroottwo\R@
\or{-135}{-90}{\tmp@}\kern\halfroottwo\R@
\or{-90}{-45}{\tmp@}\kern\halfroottwo\R@
\or{-45}0{\tmp@}\kern\partroottwo\R@
\or 0{45}{\tmp@}\kern\partroottwo\R@
\or{45}{90}{\tmp@}\kern\halfroottwo\R@
\or{90}{135}{\tmp@}\kern\halfroottwo\R@
\or{135}{180}{\tmp@}\kern\partroottwo\R@
\fi}
\xydef@\xyPScirchar@@@#1#2#3{\edef\tmp@{#1\space#2\space
\expandafter\removePT@\the\R@\space #3\space c}%
\PSmessage{\tmp@}\PSmacro@@{\tmp@}}
\xydef@\xyPScirc@#1#2{\edef\tmp@{\expandafter\removePT@\the\R@}%
\PSmessage{\tmp@\space #1 #2 o}\PSmacro@@{\tmp@\space #1 #2 o}}
\xydef@\xyPSCIRfull@{\setboxz@h{\kern\R@\xyPScirc@0{360}\kern\R@}%
\wd\z@=\z@ \ht\z@=\R@ \dp\z@=\R@ \boxz@}%
\xydef@\xyPScirbuild@{{%
\count@=\CIRlo@@ \count@@=\CIRhi@@
\multiply\count@ by45 \advance\count@-180 \relax
\multiply\count@@ by45 \advance\count@@-180 \relax
\def\tmp@{}%
\ifx\CIRtest@@\CIRtest@inside
\ifnum\count@@>\count@
\edef\tmp@{\noexpand\xyPScirc@{\the\count@}{\the\count@@}}\fi
\else\ifx\CIRtest@@\CIRtest@outside
\ifnum\count@>-180 \advance\count@ by360 \relax
\edef\tmp@{\noexpand\xyPScirc@{\the\count@@}{\the\count@}}%
\else
\ifnum\count@@<180 \relax
\edef\tmp@{\noexpand\xyPScirc@{\the\count@@}{180}}%
\fi\fi
\fi\fi
\kern\R@\tmp@\kern\R@}}
\xydef@\xyPSstraight@#1{\setupDirection@
\edef\Creset@@{\cfromthec@ \pfromthep@ \DirectionfromtheDirection@}%
\DN@##1##2{\def\checkoverlap@@{%
\ifdim##1\X@p>##1\X@c \let\next@=\relax \fi
\ifdim##2\Y@p>##2\Y@c \let\next@=\relax \fi}}%
\edef\nextii@{{\sd@X}{\sd@Y}}\expandafter\next@\nextii@
\noCshavep@@
\edef\Cshavep@@{\pfromthep@ \noexpand\resetDirection@}%
\noCshavec@@
\edef\Cshavec@@{\cfromthec@ \noexpand\resetDirection@}%
\ifHidden@\else
\ifdim\Y@c>\Y@max \Y@max=\Y@c \fi \ifdim\Y@p>\Y@max \Y@max=\Y@p \fi
\ifdim\Y@c<\Y@min \Y@min=\Y@c \fi \ifdim\Y@p<\Y@min \Y@min=\Y@p \fi
\ifdim\X@c>\X@max \X@max=\X@c \fi \ifdim\X@p>\X@max \X@max=\X@p \fi
\ifdim\X@c<\X@min \X@min=\X@c \fi \ifdim\X@p<\X@min \X@min=\X@p \fi \fi
\ifInvisible@\let\next@=\relax \else
\DN@{\setboxz@h{\kern\X@c \raise\Y@c\hbox{#1}}%
\ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@ {\xykillstyles@\Drop@@}}%
\fi
\checkoverlap@@
\ifdim\d@X=\z@ \ifdim\d@Y=\z@ \DN@{\relax}\fi\fi \next@
\def\Cslidep@@{\noCslidep@@}\def\Cslidec@@{\noCslidec@@}%
\def\Calong@@{\noCalong@@}\Creset@@ }
\xylet@\xykillstyles@=\relax
\xydef@\xyPSsolid@{\straight@\xyPSsolidSpread@}%
\xydef@\xyPSsolidSpread@{\xyPSspread@{solid}{l}@@}%
\xydef@\xyPSdottedSpread@{\xyPSspread@{dotted}{dt}@@}%
\xydef@\xyPSdashed@{\line@ \def\Connect@@{\straight@\xyPSdashedSpread@}}
\xydef@\xyPSdashedSpread@{\xyPSspread@{dashed}{dd}@@}%
\xydef@\xyPSspread@#1#2@@#3\repeat@{\edef\tmp@{%
\expandafter\removePT@\the\d@X\space\expandafter\removePT@\the\d@Y}%
\setboxz@h{\kern\X@c \raise\Y@c\hbox{%
\PSmessage{#1 line: \tmp@}\PSmacro@@{\tmp@\space #2}}}%
\ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@ \boxz@}
\xydef@\xyPSpoint@{\xyPSzerodot@\egroup
\Invisible@false \Hidden@false \def\Leftness@{.5}\def\U@pness@{.5}\ctipEdge@
\def\Drop@@{\styledboxz@}\def\Connect@@{\straight@\xyPSdottedSpread@}}
\xydef@\xyPSzerodot@{\PSmessage{dot}\PSmacro@@{p}}
\xydef@\xyPScubic@#1{\readsplineparams@
\DN@{#1}\ifx\next@\empty\PSmacro@@{mark \cubicinfo@\space bz}%
\else\PSmacro@@{mark \cubicinfo@\space b#1}\fi
\PSmessage{\cubicinfo@\space #1cubic}}
\xydef@\xyPSsquine@#1{\readsplineparams@
\DN@{#1}\ifx\next@\empty\PSmacro@@{mark \squineinfo@\space q#1}%
\else\PSmacro@@{mark \squineinfo@\space q#1}\fi
\PSmessage{\squineinfo@\space #1squine}}
\xydef@\xyPSsplinesolid@{\ifx\splineinfo@\squineinfo@
\expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{}}
\xydef@\xyPSsplinedashed@{\ifx\splineinfo@\squineinfo@
\expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{d}}
\xydef@\xyPSsplinedotted@{\ifx\splineinfo@\squineinfo@
\expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{t}}
\xyendinput
|