summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/xypic/xypsdict.doc
blob: 34a63c0c4c5b4dc4698724334bfc51ecf6341c4d (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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
%% $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.

%\let\xypsdictloaded=\empty %

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This file contains the addendum to the dictionary of \PS\ commands which 
need to be available to the \PS\ driver when the \PS\ back-end has been 
requested.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Header:}\leavevmode
\DOCHEADER
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection*{\PS\ backend Dictionary}

Open a group and set some constants.
Make sure the preliminary part is also loaded, in case |\XYpredict@| 
has not been set to |\relax|.
Then make line-ends active.

\DOCMODE(
\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
% /xypspt{72 72.27 div dup scale}bind 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@@{%
% /xy{mark exch countdictstack /xylevel exch def xyopen xycolor stopped
%  xyclose cleartomark}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
% /cma{exch gchksavexy xyfscale cm halfxytip xystroke}def
% /cmb{exch gchksavexy xyfscale xyopp cm halfxytip xystroke}def
% /cmab{exch gchksavexy xyfscale gsave cm halfxytip stroke
%  grestore xyopp cm halfxytip xystroke}def
 /ct /cmtip load def /ca /cmatip load def /cb /cmbtip load def}%
%
\PSdict@@{%
% /halfxytip{xyfsize mul 2 div exch xyfsize mul neg tipwidth 0 0 moveto
%  dup dup 5 -2 roll dup dup 4 2 roll mul 5 1 roll 3 1 roll curveto}bind def
% /eu{2 3 div 1 8 div 7 16 div}def
% /cm{1 3 div 1 5 div 1 2 div}def
% /XY{1 3 div 1 2 div .31}def
% /eua{exch gchksavexy xyfscale eu halfxytip xystroke}def
% /eub{exch gchksavexy xyfscale xyopp eu halfxytip xystroke}def
% /euab{exch gchksavexy xyfscale gsave eu halfxytip stroke
%  grestore xyopp eu halfxytip xystroke}def
% /xya{exch gchksavexy xyfscale XY halfxytip xystroke}def
% /xyb{exch gchksavexy xyfscale xyopp XY halfxytip xystroke}def
% /xyab{exch gchksavexy xyfscale gsave  XY halfxytip stroke
%  grestore xyopp XY halfxytip xystroke}def
%
 /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@@{/aTip{gchksavexy halfTip xystroke}def
% /bTip{gchksavexy xyopp halfTip xystroke}def }
%
\PSdict@@{%/halfTip{360 32 div neg rotate halftip}bind def
% /halfTtip{.31 mul 1 atan rotate halftip}bind def
% /Tip{gchksavexy gsave halfTip stroke grestore
% xyopp halfTip xystroke}def
% /Ttip{gchksavexy xysegl neg 0 rlineto 0 0 moveto
% gsave -1 halfTtip stroke grestore xyopp -1 halfTtip xystroke}def
%
 /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@@{/halfstop{90 rotate xysegl 1.4 mul 0 rlineto}bind def}
%\PSdict@@{/astop{gsavexy halfstop xystroke}def}
%\PSdict@@{/bstop{gsavexy xyopp halfstop xystroke}def}
%\PSdict@@{/abstop{gsavexy 90 rotate xysegl 1.4 mul 
% dup 2 div 0 rmoveto neg 0 rlineto xystroke}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%
\DOCMODE)

Close the group and clean-up.

\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\paragraph*{The end \& Log}\leavevmode

\DOCMODE(
\endinput

% $Log: xypsdict.doc,v $
% Revision 3.7  1999/02/16 15:12:50  krisrose
% Interim release (Y&Y fonts now free).
%
% Revision 3.6  1998/03/06 01:28:05  krisrose
% Releasing (with Y&Y fonts).
%
% Revision 3.4  1997/05/18 01:13:24  ross
% Essential bugfixes.
%
% Revision 3.3  1996/12/19 03:50:08  ross
% Maintenance release.
%
% Revision 3.3  1996/12/18  09:36:42  ross
% PostScript support for scaling arrow-tips: CM and Euler
%
% Revision 3.2  1995/09/19  18:21:41  ross
% Bug fix release.
%
% Revision 3.1  1995/09/05  20:28:57  ross
% Releasing version 3.1!
%
% Revision 3.0  1995/07/07  20:13:19  ross
% Major release w/new User's Guide!
%
% Revision 2.13  1995/07/04  15:04:51  ross
% Ready for release of v3.
%
%
% new for version 3.1.
\DOCMODE)

\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Tell Emacs that this is a LaTeX document and how it is formatted:
% Local Variables:
% mode:latex
% fill-column:77
% fill-prefix:""
% End: