Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/generic/xypic/xypsdict.tex

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


%% xypsdict.tex from $Id: xypsdict.doc,v 3.3 1996/12/19 03:50:08 ross Exp $
%%
%% Xy-pic ``PostScript backend prolog''.
%% Copyright (c) 1995-1996 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-1996 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.
%%
\begingroup \xycatcodes%
 \count@=\xydashl@\relax \count@@=\xydashw@\relax%
 \XYpredict@\relax \xycatcodes \xyPSobeylines@@%
\PSdict@@{/XYdict where pop begin XYdict begin}%
\PSdict@@{%
 /xysize 10 def /T true def /F false def
 /dimendiv{65536 div}bind def 
 /xysegl \number\count@\space dimendiv def 
 /xyopp{1 -1 scale}bind def 
 /xynormwidth{\number\count@@\space dimendiv pscorrect}bind def
 /xywidth{xynormwidth setlinewidth}bind def 
}%
\PSdict@@{%
 /xyfont{4096 add 64 div round 64 mul 4096 sub}def 
 /xysdfont{4096 add 32 div round 32 mul 4096 sub}def 
 /xydots{xywidth 1 setlinecap [0 2] 0 setdash}bind def 
 /f /xyfont load def /fs /xysdfont load def}%
\PSdict@@{%
 /xyCheckDir{dup 8 div 3 mul 3 -1 roll sub neg exch div 360 mul 
 dup dup XYdirection sub 180 div round 180 mul XYdirection add 
 dup 3 -1 roll sub abs 10 gt not{exch}if pop}def 
}%
\ifdim\xydashw@=0pt\xydashw@=.4pt\fi\count@@=\xydashw@\relax%
\PSdict@@{%
 /xyrulth{\number\count@@\space dimendiv pscorrect setlinewidth 
 0 setlinecap}bind def
}%
\PSdict@@{%
 /gsavexy{gsave xypspt XYdirection rotate xywidth newpath 0 0 moveto}def 
 /gchksavexy{gsave xypspt setupDirection xywidth newpath 0 0 moveto}def 
}%
\PSdict@@{%
 /xyswap{XYdirection 180 add /XYdirection exch def}def 
 /xyline{gstartxy setupDirection rlineto xystroke}def 
}%
\PSdict@@{%
 /dash{exch gchksavexy xysegl XYdirection dup 
 -90 lt{pop neg}{90 gt{neg}if}ifelse exch{neg}if
 0 rlineto xystroke}def 
 /stopper{gstartxy setupDirection 0 xysegl 2 div rmoveto 
 0 xysegl neg rlineto xystroke }def 
 /d /dash load def /st /stopper load def}%
\PSdict@@{%
 /solid{gstartxy xydash neg exch neg exch rlineto xystroke}def 
 /dashed{gstartxy 2 copy dup mul exch dup mul add sqrt dup 
 xysegl add xysegl 2 mul div round 2 mul 1 sub div [ exch dup ] 0 setdash 
 neg exch neg exch rlineto xystroke}def
 /l /solid load def /dd /dashed load def}%
\PSdict@@{%
 /dot{gstartxy 2 setlinecap [0 2] 0 setdash 
 1 0 rlineto xystroke}def 
 /dotted{gstartxy 2 copy dup mul exch dup mul add sqrt dup 
 2 div round 1 add div 2 setlinecap [0 3 -1 roll] 0 setdash 
 neg exch neg exch rlineto 0 0 rlineto xystroke}def
 /p /dot load def /dt /dotted load def}%
\PSdict@@{%
 /cubic{gstartxy docubic} def 
 /docubic{chkvalid 
 {chkcubedge 8 -2 roll moveto curveto xystroke pop}
 {cleartomark grestore}ifelse}def 
 /chkcubedge{2 copy 1.0 eq{0.0 eq{pop pop}{cubicedge}ifelse}
 {pop cubicedge}ifelse}def
 /bz /cubic load def}%
\PSdict@@{%
 /dotcubic{gstartxy 1 setlinecap [0 2] 0 setdash docubic}def 
 /dashcubic{gstartxy [5 5] 0 setdash docubic}def 
 /bt /dotcubic load def /bd /dashcubic load def}%
\PSdict@@{%
 /squine{gstartxy dosquine}def 
 /dosquine{chkvalid 
 {chksquedge 2 copy moveto xysq2cub curveto xystroke pop}
 {cleartomark grestore}ifelse}def
 /q /squine load def}%
\PSdict@@{%
 /chkvalid{2 copy lt{dup 1 gt{false}{true}ifelse}{false}ifelse}def 
}%
\PSdict@@{%
 /chksquedge{2 copy 1.0 eq{0.0 eq{pop pop}{squineedge}ifelse}
 {pop squineedge}ifelse}def 
 /xysq2cub{xysq2cubit 6 1 roll xysq2cubit 6 1 roll 3 index 3 index 
 xysq2cubit 6 1 roll xysq2cubit 6 1 roll pop pop}def 
 /xysq2cubit{2 index 2 mul add 3 div}def 
}%
\PSdict@@{%
 /dotsquine{gstartxy 1 setlinecap [0 2] 0 setdash dosquine}def 
 /dashsquine{gstartxy [5 5] 0 setdash dosquine}def 
 /qt /dotsquine load def /qd /dashsquine load def}%
\PSdict@@{%
/xy4mul{8 copy 
 5 -1 roll mul 5 1 roll 6 -1 roll mul 6 1 roll 
 3 -1 roll mul exch 4 -1 roll mul 3 1 roll 
 add 3 1 roll add exch 10 2 roll 
 7 -1 roll mul 7 1 roll 4 -1 roll mul 5 1 roll 
 4 -1 roll mul 4 1 roll mul add 3 1 roll add 
 exch 3 -1 roll }def 
}%
\PSdict@@{%
 /xy44mul{4 copy 16 4 roll exch 3 1 roll 4 copy 12 4 roll
 xy4mul 12 4 roll xy4mul 12 -4 roll 4 copy 16 4 roll
 8 4 roll xy4mul 12 4 roll xy4mul}def
}%
\PSdict@@{%
 /cubicedge{10 2 roll exch 8 1 roll 3 -1 roll dup dup 9 2 roll
 5 -1 roll dup dup 9 1 roll 8 3 roll
 4 1 roll dup dup 5 3 roll dup dup 5 1 roll 3 -1 roll
 18 -2 roll 2 copy 1 sub neg 4 1 roll 1 sub neg exch 4 1 roll
 xy444mul
 pop pop pop 13 1 roll pop pop pop 9 1 roll 10 1 roll
 pop 8 1 roll 7 1 roll 8 1 roll pop 5 1 roll 3 1 roll}def
}%
\PSdict@@{%
 /xy444mul{4 copy 24 4 roll 12 -4 roll 16 4 roll 4 copy 16 4 roll
 xy44mul 20 8 roll xy44mul
 12 -4 roll 4 -1 roll 7 1 roll exch 4 1 roll exch 6 -1 roll exch
 4 2 roll 16 8 roll 8 4 roll
 4 -1 roll 7 1 roll exch 4 1 roll exch 6 -1 roll exch 4 2 roll
 8 4 roll 16 4 roll 8 4 roll 20 -4 roll exch 3 1 roll
 4 copy 20 4 roll 4 copy 16 4 roll 4 copy 12 4 roll
 xy4mul 28 4 roll xy4mul 20 4 roll xy4mul 12 4 roll xy4mul}def
}%
\PSdict@@{%
 /squineedge{8 2 roll
 exch 5 1 roll 3 -1 roll dup 6 2 roll 1 index exch
 10 -2 roll 2 copy 1 sub neg 4 1 roll 1 sub neg exch 4 1 roll
 xy44mul 4 1 roll pop 5 1 roll 6 1 roll 3 -1 roll pop}def
}%
\PSdict@@{%
 /xyshort{2 copy abs exch abs add xysegl .5 mul lt
 {pop pop grestore}{rlineto xystroke}ifelse}def
}%
\PSdict@@{%
 /tipwidth{xywidth xynormwidth dup currentlinewidth exch div 
 sqrt dup dup scale mul setlinewidth 1 setlinecap}def
}%
\PSdict@@{%
 /halftip{tipwidth xysize 10 div 0 0 moveto
 -.25 0 3 -1 roll -2.5 mul 0 xysize 2 div neg
 dup .62 mul 2 div neg curveto}bind def
}%
\PSdict@@{/atip{gchksavexy halftip xystroke}def
 /btip{gchksavexy xyopp halftip xystroke}def
 /tip{gchksavexy gsave halftip stroke grestore
 xyopp halftip xystroke}def
 /t /tip load def /a /atip load def /b /btip load def}%
\PSdict@@{/cmatip{gchksavexy halfcmtip xystroke}def 
 /cmbtip{gchksavexy xyopp halfcmtip xystroke}def
 /cmtip{gchksavexy gsave halfcmtip stroke grestore
 xyopp halfcmtip xystroke}def
 /halfcmtip{tipwidth 0 0 moveto
 -.1333 0 .25 neg dup .125 3 -1 roll .25 curveto}bind def
 /ct /cmtip load def /ca /cmatip load def /cb /cmbtip load def}%
\PSdict@@{%
 /xyfscale{/xyfsize exch def}def /xyfsize{10}def
 /eu{-0.0551 0.0643 -0.0976 0.1386 -0.125 0.2188}def
 /cm{-0.105 0.0437 -0.1804 0.1380 -0.2 0.25}def
 /XY{-0.1753 0.0181 -0.3452 0.0708 -0.5 0.155}def
 /tipstart{3 -1 roll gchksavexy exch xyfscale tipwidth dup XYdict exch 
 known{dup /xy eq{pop /XY}if}{pop /XY}ifelse XYdict exch get}def
 /tipend{halfxytip xystroke}def 
 /halfxytip{1 1 6{pop xyfsize mul 6 1 roll}for 0 0 moveto curveto}def
 /A{tipstart D}def /B{tipstart C}def /C{xyopp D}def /D{exec tipend}def
 /AB{tipstart dup gsave exec halfxytip stroke grestore C}def
}%
\PSdict@@{%
 /Tip{exch gchksavexy /xyfsize{10}def tipwidth gsave 
 dup XYdict exch known{dup /xy eq{pop /XT}if}{pop /XT}ifelse
 XYdict exch get dup
 halfTip stroke grestore xyopp halfTip xystroke}def
 /XT{360 32 div neg}def /Xt{-1 .31 mul 1 atan}def
 /ET{360 64 div 5 mul neg}def /Et{-1 .31 mul 1 atan}def
 /halfTip{exec rotate XY halfxytip}def /halfTtip{halfTip}def
 /Ttip{exch gchksavexy /xyfsize{10}def tipwidth gsave 
 dup XYdict exch known{dup /xy eq{pop /Xt}if}{pop /Xt}ifelse
 XYdict exch get dup
 halfTtip stroke grestore xyopp halfTtip xystroke}def
 /tt /Tip load def /tT /Ttip load def}%
\PSdict@@{/halfturn{xysegl 2 div dup dup neg exch rmoveto
 0 exch dup exch -180 -90 arc}bind def
 /aturn{gchksavexy halfturn xystroke}def
 /bturn{gchksavexy xyopp halfturn xystroke}def
 /ta /aturn load def /tb /bturn load def}%
\dimen@=\xybsqll@\relax\count@=\dimen@%
\PSdict@@{%
 /xysqll \the\count@\space dimendiv def 
 /squigl{gchksavexy xysqll dup neg 0 rmoveto
 2 div dup dup neg dup 3 -1 roll
 2 sqrt mul dup 5 1 roll
 135 45 arcn dup 3 -1 roll -135 -45 arc
 xystroke}def
 /g /squigl load def}%
\PSdict@@{/fullhook{0 xysegl 2 div dup -90 90 arcn}bind def
 /halfhook{xysegl 2 div dup 0 exch 180 90 arcn}bind def
}%
\PSdict@@{/ahook{gchksavexy fullhook xystroke}def
 /bhook{gchksavexy xyopp fullhook xystroke}def
 /hook{gchksavexy gsave halfhook stroke grestore
 xyopp halfhook xystroke}def
 /h /hook load def /ha /ahook load def /hb /bhook load def}%
\PSdict@@{%
 /xyqcirc{dup dup neg exch translate newpath 
 dup neg 0 exch moveto 0 0 3 -1 roll -90 0 arc}bind def
}%
\PSdict@@{%
 /circ{gstartxy 
 3 copy pop 2 copy cos mul 3 1 roll sin mul
 rmoveto 0 0 5 2 roll arc xystroke}bind def
 /o /circ load def}%
\PSdict@@{%
 /circhar{gsave dup 3 gt{7 sub neg}if dup
 3 eq{pop dup 2 sqrt -2 div mul}{dup 1 eq{pop dup 2 sqrt 2 div mul}
 {0 eq{dup}{0}ifelse}ifelse}ifelse 
 0 translate 3 1 roll circ grestore}bind def
 /c /circhar load def}%
\PSdict@@{end end}%
\endgroup%
\endinput

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.