Debian Codegraph @

texmf-dist/tex/generic/xypic/xyps-ps.tex

raw
1 %% xyps-ps.tex from $Id: xyps-ps.doc,v 3.12 2011/03/14 20:14:00 krisrose Exp $
2 %%
3 %% Xy-pic ``PS-PS'' PostScript support.
4 %% Copyright (c) 1993-1997 Ross Moore <[email protected]>
5 %%
6 %% This file is part of the Xy-pic package for graphs and diagrams in TeX.
7 %% See the companion README and INSTALL files for further information.
8 %% Copyright (c) 1991-2011 Kristoffer H. Rose <[email protected]>
9 %%
10 %% The Xy-pic package is free software; you can redistribute it and/or modify
11 %% it under the terms of the GNU General Public License as published by the
12 %% Free Software Foundation; either version 2 of the License, or (at your
13 %% option) any later version.
14 %%
15 %% The Xy-pic package is distributed in the hope that it will be useful, but
16 %% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 %% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 %% for more details.
19 %%
20 %% You should have received a copy of the GNU General Public License along
21 %% with this package; if not, see http://www.gnu.org/licenses/.
22 %%
23 %% As a special exception, you may use this file and all files derived
24 %% from it without restrictions. This special exception was added with
25 %% version 3.7 of Xy-pic.
26 %%
27 \expandafter\ifx\csname xyps-psloaded\endcsname\empty
28 \message{not reloaded}\endinput \fi
29 \expandafter\let\csname xyps-psloaded\endcsname=\empty \xycatcodes
30 \xylet@\PSmacro@@=\eat@
31 \xylet@\PSdict@@=\eat@
32 \xylet@\PSspecial@@=\eat@
33 \xylet@\PSread@@=\eat@
34 \xylet@\PSinclude@@=\eat@
35 \xylet@\PSraw@@=\eat@
36 \xylet@\xyPSobeylines@@=\relax
37 \xylet@\PSspecialdict@@=\eat@
38 \xydef@\UnloadPSps@{%
39 \let\PSmacro@@=\eat@
40 \let\PSdict@@=\eat@
41 \let\PSspecial@@=\eat@
42 \let\PSread@@=\eat@
43 \let\PSinclude@@=\eat@
44 \let\PSraw@@=\eat@
45 \let\xyPSobeylines@@=\relax
46 \let\PSspecialdict@@=\eat@
47 }
48 \xydef@\UnloadPS@{\UnloadPSps@
49 \expandafter\ifx\csname xypsloaded\endcsname\unknown\PSspecials@false
50 \else\expandafter\NoPSspecials\fi}
51 \xylet@\UnloadPS@@=\UnloadPS@
52 \ifx\undefined\dvitype@\xydef@\dvitype@{null}\fi
53 \xylet@\xyrealshipout@=\shipout
54 \xydef@\xyPSshipout@{\setbox9=\copy\voidb@x
55 \afterassignment\xyPSshipout@i\setbox9=}
56 \xydef@\xyPSshipout@i{\ifvoid9 \expandafter\aftergroup\fi\xyPSshipout@ii}
57 \xydef@\xyPSshipout@ii{\xyrealshipout@\vbox{\XYpredict@@\box9}}
58 \xydef@\@PSshipout{\global\let\shipout=\xyPSshipout@ }
59 \xydef@\xyPSshipout@PSii{%
60 \ifUsePSdict@@\let\XYshipdict@=\includeXYPSdict@@
61 \else\def\XYshipdict@{\XYpredict@@\XYdict@@}\fi
62 \xyrealshipout@\vbox{\XYshipdict@\box9}}
63 \xydef@\firstPS@{%
64 \global\let\firstPS@@=\relax \global\let\firstPS@=\relax}
65 \xylet@\firstPS@@=\firstPS@
66 \ifx\undefined\dumpPSdict@@ \xylet@\dumpPSdict@@=\relax \fi
67 \xydef@\installxyps@{%
68 \xyinputorelse@{xyps-ps}{\xydrivernoload@{ps-ps}}\xycatcodes
69 \installxyps@@ \installxyps@x }
70 \xylet@\installxyps@@=\relax
71 \xylet@\setupxyPS@@=\relax
72 \xywithoption{ps}{\let\setupxyPS@@=\setupxyPS@}
73 \xydef@\installxyps@x{\dumpPSdict@@
74 \ifx\xyrealshipout@\undefined \let\xyrealshipout@=\shipout\fi
75 \ifx \shipout \xyrealshipout@
76 \ifUsePSdict@@ \DN@{\includePSmessage@\includeXYPSdict@\message{>}}%
77 \else \DN@{\XYdict@\endXYdict@}\fi
78 \else \DN@{\let\xyPSshipout@ii=\xyPSshipout@PSii \@PSshipout}\fi
79 \let\firstPS@=\relax \next@
80 \let\XYpredict@=\relax
81 \setupxyPS@@ }
82 \let\realinstallxyps@x=\installxyps@x
83 \ifx\undefined\AfterBeginDocument
84 \def\installxyps@x{\xysetup@@{\realinstallxyps@x}}%
85 \else
86 \def\installxyps@x{\AfterBeginDocument{\realinstallxyps@x}}%
87 \fi
88 \xydef@\xydefaultdriver@{dvips}
89 \xydef@\xyPSdriver#1{\def\xydefaultdriver@{#1}}
90 \xydef@\installxyps@orig{\DN@{}%
91 \ifx\xydriversselected@@\empty
92 \DN@{\expandafter\defaultinstallps@\expandafter{\xydefaultdriver@}}%
93 \else \def\do##1{%
94 \expandafter\ifx\csname##1@xy@ps\endcsname\relax
95 \DN@{\defaultinstallps@{##1}}}%
96 \xydriversselected@@
97 \else \DN@##1{}\fi\fi \next@ }
98 \xydef@\defaultinstallps@#1#2{%
99 \xywarning@{no driver specified, using #1 }%
100 \xyrequire{#1}\csname #1@xy@ps\endcsname{}}
101 \xydef@\null@xy@ps{\installxyps@}
102 \xydefcsname@{shape [!...]}#1{%
103 \expandafter\ifx\csname xyps-sloaded\endcsname\empty \DN@{\xyPSescapestyle@{#1}@@}%
104 \else\ifxyPSshapes@\DN@{\xyPSshapechar@{#1}@@}%
105 \else \DN@{\xyPScharwarning@}\fi\fi \next@ }
106 \xydefcsname@{shape [psxy]}{\ifxyPSshapes@\DN@{\xyPSpsxy@}%
107 \else \DN@{\xyPScharwarning@}\fi \next@ }
108 \xydef@\xyPSpsxy@{%
109 \setboxz@h{\dimen@=\L@p \advance\dimen@-\R@p
110 \dimen@ii=-\U@p \raise\dimen@ii\hbox to\z@{%
111 \kern\dimen@\xyPScurrpt@\kern-\dimen@}\boxz@}}%
112 \xydef@\xyPScurrpt@{\ifxyPSshapes@\expandafter\xyPScurrpt@@\fi}
113 \xydef@\xyPScurrpt@@@{\PSspecial@@{xyi}\PSraw@@{userdict begin xyx end}}
114 \ifx\undefined\xyPScurrpt@@ \xylet@\xyPScurrpt@@=\xyPScurrpt@@@ \fi
115 \xywarnifdefined\xyPSshapechar@
116 \xywarnifdefined\xyPSsplitshape@
117 {\xyuncatcodes \catcode`@=11
118 \gdef\xyPSshapechar@#1@@{\xyPSsplitshape@#1<><>@@}%
119 \gdef\xyPSsplitshape@#1<>#2<>#3@@{\xyPSsplitPS@{#1}{#2}}}
120 \xydef@\xyPSrawA@#1{\expandafter\xyPSrawAA@ #1{}}%
121 \xydef@\xyPSrawAA@#1#2{\PSraw@@{{pu #1}xyg #2}%
122 \PSmessage{{pu #1}xyg #2}}%
123 \xydef@\xyPSrawZ@#1{\PSraw@@{{#1 pp}xyf}\PSmessage{{#1 pp}xyf}}%
124 \xydef@\modPSboxz@{%
125 \expandafter\DN@\expandafter{\xyPSpre@{}}\ifx\next@\empty\else
126 \setboxz@h{\expandafter\xyPSrawA@\expandafter{\xyPSpre@{}}\boxz@
127 \expandafter\xyPSrawZ@\expandafter{\xyPSpost@}}\DN@{}\fi}%
128 \xydef@\modPSdrop@{%
129 \expandafter\DNii@\expandafter{%
130 \expandafter\xyPSrawA@\expandafter{\xyPSpre@{}}}%
131 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}%
132 \expandafter\next@\expandafter{\Drop@@}%
133 \expandafter\DNii@\expandafter{%
134 \expandafter\xyPSrawZ@\expandafter{\xyPSpost@}}%
135 \DN@##1{\expandafter\def\expandafter\Drop@@\expandafter{\tmp@ ##1}}%
136 \expandafter\next@\expandafter{\nextii@}}%
137 \xydef@\modPSconnect@{%
138 \expandafter\DNii@\expandafter{%
139 \expandafter\xyPSrawA@\expandafter{\xyPSpre@{}}}%
140 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}%
141 \expandafter\next@\expandafter{\Connect@@}%
142 \expandafter\DNii@\expandafter{%
143 \expandafter\xyPSrawZ@\expandafter{\xyPSpost@}}%
144 \DN@##1{\expandafter\def\expandafter\Connect@@\expandafter{\tmp@ ##1}}%
145 \expandafter\next@\expandafter{\nextii@}}%
146 \xydef@\xyPSpre@{{}{}}
147 \xydef@\xyPSpost@{}
148 \xydef@\PSmessage@#1{\W@{PS: #1, direction=\the\Direction}}
149 \xydef@\PSignore@#1{}%
150 \xydef@\showPSmessages{\let\PSmessage=\PSmessage@}
151 \xydef@\hidePSmessages{\let\PSmessage=\PSignore@}
152 \xylet@\PStracing=\showPSmessages
153 \hidePSmessages
154 \xydef@\PSmacro@#1{\PSmacro@@{#1}\PSmessage{#1}}
155 \xydef@\includeXYPSdict@@{%
156 \expandafter\PSinclude@@\expandafter{\xyPSdictname}}
157 \xydef@\includeXYPSdict@r{\message{PS: includeXYPSdict}\includeXYPSdict@@
158 \let\includeXYPSdict@=\relax}
159 \xylet@\includeXYPSdict@\includeXYPSdict@r
160 \xydef@\endXYdict@{}
161 \xydef@\includePSmessage@@{\message{<xyps: including \xyPSdictname}}
162 \xylet@\includePSmessage@=\includePSmessage@@
163 \xydef@\xyPSdictknown@{%
164 \immediate\closein\xyread@
165 \xywarning@{File \xyPSdictname\space already exists}
166 \message{ Do you wish to overwrite it \string? y/n }%
167 \read16 to \next
168 \DNii@{\xywarning@{You did not type Y or N -- try again please}%
169 \xyPSdictknown@}%
170 \DN@{Y }\ifx\next@\next \DNii@{\writePSdict@@}%
171 \else\DN@{y }\ifx\next@\next \DNii@{\writePSdict@@}%
172 \else\DN@{n }\ifx\next@\next \DNii@{\cancelPSdict@}%
173 \else\DN@{N }\ifx\next@\next \DNii@{\cancelPSdict@}%
174 \fi\fi\fi\fi \nextii@ }
175 \xydef@\cancelPSdict@{%
176 \xywarning@{cancelling dump of PostScript dictionary}}
177 \xydef@\noDictmessage@{%
178 \xywarning@{\dvitype@\space does not support the use of a header file}}
179 \DN@{\csname newif\endcsname\ifUsePSdict@@\DN@{}}
180 \ifx\undefined\UsePSdict@@true\else\DN@{}\fi \next@
181 \ifx\undefined\xyPSdefaultdict
182 \xydef@\xyPSdefaultdict{%
183 \DN@##1.##2.##3@{\gdef\xyPSdictname{xy##1##2dict.pro}}%
184 \expandafter\next@\xyversion.@}%
185 \fi
186 \ifx\undefined\UsePSheader@
187 \xydef@\UsePSheader@#1{%
188 \DN@{#1}\ifx\next@\empty
189 \else \gdef\xyPSdictname{#1}\fi
190 \ifx\xyPSdictname\undefined\xyPSdefaultdict\fi
191 \gdef\xyHeaderMessage@{%
192 It includes a reference to the PostScript file \xyPSdictname.^^J}%
193 \UsePSdict@@true}%
194 \let\UsePSheader=\UsePSheader@
195 \fi
196 \xywarnifdefined\xyPS@@
197 \xywarnifdefined\xyPS@@@
198 {\catcode`|=14 \catcode`\%=12 \catcode`\<=1 \catcode`\>=2 |
199 \gdef\xyPS@@<%%>\gdef\xyPS@@@<%!>}
200 \xydef@\writePSdict@@{\message{PS: writePSdict@@}\writePSdict@
201 \def\writePSdict@@{\message{write PS relaxed}}}
202 {\catcode`|=14 \catcode`\%=12
203 \gdef\writePSdict@{{\begingroup|
204 \immediate\openout\xywrite@=\xyPSdictname \relax
205 \message{<xyps: dumping \xyPSdictname}|
206 \def\PSdict@@@##1{\immediate\write\xywrite@{##1}}|
207 \let\xyPSobeylines@@=\obeyoutlines@
208 \let\firstPS@@=\relax
209 \let\endXYdict@=\relax
210 \PSdict@@@{\xyPS@@@ PS-Adobe-3.0 Resource-procset}|
211 \PSdict@@@{\xyPS@@ Title: \xyPSdictname}|
212 \PSdict@@@{\xyPS@@ Version: 3.8.9}|
213 \PSdict@@@{\xyPS@@ Creator: Xy-ps backend to Xy-pic}|
214 \PSdict@@@{\xyPS@@ DocumentSuppliedProcSets: XYdict}|
215 \ifx\dvitype@\undefined
216 \PSdict@@@{\xyPS@@ For: use with Xy-pic}\else
217 \PSdict@@@{\xyPS@@ For: \dvitype@ use of Xy-pic}\fi
218 \PSdict@@@{\xyPS@@ BeginResource: procset XYdict}|
219 \def\PSspecialdict@@##1{\PSdict@@@{##1^^J}}|
220 \let\PSdict@@=\PSdict@@@ \let\xy@begindvi=\literal@|
221 \UsePSdict@@false\XYpredict@@|
222 \XYdict@@|
223 \PSdict@@@{\xyPS@@ EndResource}|
224 \immediate\closeout\xywrite@
225 \message{>}|
226 \endgroup}}}
227 \xywarnifdefined\obeyoutlines@
228 {\catcode`\^^M=\active%
229 \gdef\obeyoutlines@{\catcode`\^^M=\active \def^^M{^^J}%
230 \newlinechar=`\^^J\obeyspaces}}
231 \xydef@\XYpredict@@{\ifUsePSdict@@\DN@{}\else
232 \DN@{\xy@begindvi{\xyinputorelse@{xyps-pro}%
233 {\xyerror@{Could not load xyps-pro}{}}\xyuncatcodes}}%
234 \next@
235 \DN@{\xy@begindvi{\xyinputorelse@{xypspatt}%
236 {\xyerror@{Could not load xypspatt}{}}\xyuncatcodes}}\fi
237 \next@ }
238 \xydef@\XYpredict@r{\XYpredict@@ \let\XYpredict@=\relax \installxyps@}
239 \xylet@\XYpredict@\XYpredict@r
240 \xydef@\XYdict@{\XYdict@@\def\XYdict@{\message{PS relaxed}}}%
241 \xydef@\XYdict@@{\DN@{\xyinputorelse@{xypsdict}%
242 {\xyerror@{Could not load xypsdict}{}}\xyuncatcodes}%
243 \expandafter\xy@begindvi\expandafter{\next@}}
244 \xydef@\forceload@XYdict{%
245 \let\includeXYPSdict@=\includeXYPSdict@r
246 \let\XYpredict@=\XYpredict@r
247 \let\XYdict@=\XYdict@@ \expandafter\installxyps@ }
248 \xynew@{if}\ifxyPSshapes@ \xyPSshapes@true
249 \xydef@\xyPScharwarning@@{\xyPScharmessage@
250 \gdef\xyPScharwarning@@{\xyPScharmessage@
251 \xywarning@{...no further PostScript warnings will be given}%
252 \global\let\xyPScharwarning@@=\relax }}
253 \xydef@\xyPScharmessage@{\xywarning@{%
254 the current <driver> does not fully support PostScript effects}}%
255 \xydef@\newxyshape#1#2#3{%
256 \DN@{#3}\ifx\next@\empty
257 \xydefcsname@{shape [#1]}{\csname xyshape@#1@\endcsname}%
258 \else \expandafter\def\csname shape [#1]\endcsname{%
259 \csname xyshape@#1@\endcsname}\fi
260 \DN@{#2}\ifx\next@\empty
261 \expandafter\def\csname xyshape@#1@\endcsname{%
262 \xyundefinedEffect@{#1}{}@@}%
263 \else \expandafter\def\csname xyshape@#1@\endcsname{#2}\fi }
264 \xydef@\xyundefinedEffect@#1#2@@{%
265 \xywarning@{The #1 #2 effect is not implemented with the current driver}}%
266 \xydef@\newxyPSshape#1#2{%
267 \expandafter\DN@\expandafter{\csname shape [#1]\endcsname}%
268 \DNii@{\relax}\ifx\next@\nextii@ \newxyshape{#1}{}\relax\fi
269 \expandafter\DNii@\expandafter{\csname xyPSshape@#1@\endcsname}%
270 \expandafter\def\nextii@{#2}%
271 \ifx\nextii@\empty\expandafter\def\next@{\xyPSnotimplemented@@`#1'@@}%
272 \else
273 \edef\tmp@{\noexpand\let\expandafter\noexpand\next@
274 \expandafter\noexpand\nextii@}%
275 \expandafter\tmp@\fi }
276 \xydef@\xyPSnotimplemented@@#1@@{%
277 \xywarning@{This PostScript effect is not implemented yet}}%
278 \xydef@\xyPSnotfinished@@{%
279 \xywarning@{This effect is not reliable yet; box sizes may be wrong}}%
280 \endinput