summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xypic/xypsdict.tex
blob: 2b3191a5352302ffde26ffd5892d2a54c6c80f5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
%% xypsdict.tex from $Id: xypsdict.doc,v 3.7 1999/02/16 15:12:50 krisrose Exp $
%%
%% Xy-pic ``PostScript backend prolog''.
%% 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@ens-lyon.fr>
%%
%% 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.
%%
%% As a special exception, you may use this file and all files derived
%% from it without restrictions. This special exception was added with
%% version 3.7 of Xy-pic.
\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 /xydt 0.01 def
 /xysdfont{4096 add 32 div round 32 mul 4096 sub}def 
 /xydots{xywidth 1 setlinecap [xydt 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 [xydt 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 [xydt 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 [xydt 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 [xydt 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