Debian Codegraph @

texmf-dist/tex/generic/tikz-ext/tikzext-util.tex

raw
1 % Copyright 2024 by Qrrbrbirlbel
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Free Documentation License.
7 %
8
9 \def\tikzextversion{0.6.2}
10 \def\tikzextversionnumber{10}
11 \def\tikzextset{\pgfqkeys{/tikz/ext}}
12 \def\pgfextset{\pgfqkeys{/pgf/ext}}
13 \pgfextset{
14 pgf/.code=\pgfset{#1},
15 .code=\pgfextset{#1}%
16 }
17 \tikzextset{
18 tikz/.code=\tikzset{#1},
19 .code=\tikzextset{#1},
20 .unknown/.code={%
21 \pgfextset{\pgfkeyscurrentname/.try={#1}}%
22 \unless\ifpgfkeyssuccess
23 \pgfutil@packageerror{tikz-ext}{%
24 I neither know '/tikz/ext/\pgfkeyscurrentname' nor
25 '/pgf/ext/\pgfkeyscurrentname' to which you passed '#1'.%
26 }%
27 \fi
28 },
29 /pgfplots/ext/.code=\tikzextset{#1},
30 /pgfplots/ext/.unknown/.code={%
31 \tikzextset{\pgfkeyscurrentname={#1}}%
32 }
33 }
34 % Compatibility
35 \gdef\tikzextutil@compatwarning@counter{0}
36 \def\tikzextutil@compatmaybewarning#1#2#3{%
37 \ifnum\tikzextutil@compatwarning@counter<25
38 \xdef\tikzextutil@compatwarning@counter{\the\numexpr\tikzextutil@compatwarning@counter+1\relax}%
39 \pgfutil@packagewarning{tikz-ext}{%
40 The deprecated #1 was used. It is now #2. Please use that instead.^^J%
41 To remove this warning use \string\tikzextset\string{compat/#3\string}.^^J%
42 This warning will be removed in the next version and the #1 will fail.^^J%
43 }%
44 \else\ifnum\tikzextutil@compatwarning@counter=25
45 \gdef\tikzextutil@compatwarning@counter{26}%
46 \pgfutil@packagewarning{tikz-ext}{Too many warnings generated. Remain silent.}%
47 \fi\fi
48 }
49 \def\tikzextutil@compatwarning@cmd#1#2#3#4#5{%
50 \pgfutil@IfUndefined{#3}{%
51 \pgfutil@namedef{#3}{%
52 \tikzextutil@compatmaybewarning
53 {command \expandafter\pgfutil@gobble\string\\#3}{\string#4}{#1 = #2}%
54 #4%
55 }%
56 }{}%
57 }
58 \def\tikzextutil@compatwarning@key#1#2#3{%
59 \pgfutil@ifnextchar[%
60 {\tikzextutil@compatwarning@key@opt{#1}{#2}{#3}}%
61 {\tikzextutil@compatwarning@key@ {#1}{#2}{#3}{}}%
62 }
63 \def\tikzextutil@compatwarning@key@opt#1#2#3[#4]{%
64 \tikzextutil@compatwarning@key@{#1}{#2}{#3}{\pgfkeyssetvalue{#3/.@def}{#4}}%
65 }
66 \def\tikzextutil@compatwarning@key@#1#2#3#4#5{%
67 \pgfkeys@pathtoks{#3}%
68 \pgfkeysifdefined{#3}{%
69 % The key is a value key. Do not overwrite or adjust.
70 % Old TikZ-Ext key simply will not work.
71 }{%
72 \pgfkeysifdefined{#3/.@cmd}{%
73 % The key is a code key. Do not overwrite or adjust.
74 % Old TikZ-Ext key simply will not work.
75 }{%
76 % The key is currently not used.
77 #4%
78 \pgfkeysdef{#3}{%
79 \tikzextutil@compatmaybewarning{key '#3'}{'#5'}{#1 = #2}%
80 \pgfkeysvalueof{#5/.@cmd}##1\pgfeov
81 }%
82 }
83 }
84 }
85 \def\tikzextutil@compatwarning@valuekey#1#2#3#4{%
86 \pgfkeys@pathtoks{#3}%
87 \pgfkeysifdefined{#3}{%
88 % The key is a value key. Do not overwrite or adjust.
89 % Old TikZ-Ext key simply will not work.
90 }{%
91 \pgfkeysifdefined{#3/.@cmd}{%
92 % The key is a code key. Do not overwrite or adjust.
93 % Old TikZ-Ext key simply will not work.
94 }{%
95 % The key is currently not used.
96 \pgfkeyssetvalue{#3}{\pgfkeysvalueof{#4}}%
97 \pgfkeysdef{#3}{%
98 \tikzextutil@compatmaybewarning{value-key '#3'}{'#4'}{#1 = #2}%
99 \pgfkeyssetvalue{#4}{##1}%
100 }%
101 }
102 }
103 }
104 \def\tikzextutil@compatwarning@mathcmdZ#1#2#3#4{%
105 \pgfutil@IfUndefined{pgfmath#3}{%
106 \pgfmathdeclarefunction*{#3}{0}{%
107 \tikzextutil@compatmaybewarning{PGFMath function '#3'}{'#4'}{#1 = #2}%
108 \csname pgfmath#4@\endcsname
109 }%
110 }{}%
111 }
112 \def\tikzextutil@compatwarning@mathcmdI#1#2#3#4{%
113 \pgfutil@IfUndefined{pgfmath#3}{%
114 \pgfmathdeclarefunction*{#3}{1}{%
115 \tikzextutil@compatmaybewarning{PGFMath function '#3'}{'#4'}{#1 = #2}%
116 \csname pgfmath#4@\endcsname{##1}%
117 }%
118 }{}%
119 }
120 \def\tikzextutil@compatwarning@mathcmdII#1#2#3#4{%
121 \pgfutil@IfUndefined{pgfmath#3}{%
122 \pgfmathdeclarefunction*{#3}{2}{%
123 \tikzextutil@compatmaybewarning{PGFMath function '#3'}{'#4'}{#1 = #2}%
124 \csname pgfmath#4@\endcsname{##1}{##2}%
125 }%
126 }{}%
127 }
128 \def\tikzextutil@compatwarning@mathcmdX#1#2#3#4{%
129 \pgfutil@IfUndefined{pgfmath#3}{%
130 \pgfmathdeclarefunction*{#3}{...}{%
131 \tikzextutil@compatmaybewarning{PGFMath function '#3'}{'#4'}{#1 = #2}%
132 \csname pgfmath#4@\endcsname##1%
133 }%
134 }{}%
135 }
136 \def\tikzextutil@compatwarning@handler#1#2#3#4{%
137 \pgfkeys@pathtoks{/handlers/#3}%
138 \pgfkeysifdefined{/handlers/#3}{%
139 % The key is a value key. Do not overwrite or adjust.
140 % Old TikZ-Ext key simply will not work.
141 }{%
142 \pgfkeysifdefined{/handlers/#3/.@cmd}{%
143 % The key is a code key. Do not overwrite or adjust.
144 % Old TikZ-Ext key simply will not work.
145 }{%
146 % The key is currently not used.
147 \pgfkeysdef{/handlers/#3}{%
148 \tikzextutil@compatmaybewarning{handler '#3'}{'#4'}{#1 = #2}%
149 \pgfkeysvalueof{/handlers/#4/.@cmd}##1\pgfeov
150 }%
151 }
152 }
153 }
154 \def\tikzextutil@compat@cloneshape#1#2{%
155 \pgfutil@namelet{pgf@sh@s@#1}{pgf@sh@s@ext_#1}%
156 \def\tikzext@temp{\edef\pgf@sm@shape@name{ext_#1}}%
157 \expandafter\tikzextutil@prefix@macrotomacro\csname pgf@sh@s@#1\endcsname\tikzext@temp
158 \pgfutil@namelet{pgf@anchor@#1@border}{pgf@anchor@ext_#1@border}%
159 \pgfutil@namelet{pgf@sh@boxes@#1}{pgf@sh@boxes@ext_#1}%
160 \pgfutil@for\tikzext@temp:=#2\do{%
161 \pgfutil@namelet{pgf@anchor@#1@\tikzext@temp}{pgf@anchor@ext_#1@\tikzext@temp}}%
162 \pgfutil@for\tikzext@temp:=bbg,bg,fbg,fg,ffg\do{%
163 \pgfutil@namelet{pgf@sh@\tikzext@temp @#1}{pgf@sh@\tikzext@temp @ext_#1}}}
164
165 \tikzextset{
166 compat/.is choice, compat/.default=warn,
167 /tikz-ext/compat/add library/.code 2 args={%
168 \tikzextset{
169 compat/#1/.is choice,
170 compat/#1/.default=#2,
171 compat/#1/0.6.1/.style={/tikz/ext/compat/#1/0.6},
172 compat/#1/0.6.2/.style={/tikz/ext/compat/#1/0.6}}%
173 \pgfutil@for\tikzext@temp:=pre 0.6,0.6,0.6.1,0.6.2,newest,warn\do{%
174 \pgfkeys@expanded{%
175 \noexpand\tikzextset{%
176 compat/\tikzext@temp/.append style=%
177 /tikz/ext/compat/#1/\tikzext@temp}}%
178 \pgfkeysedef
179 {/tikz/ext/compat/#1/\tikzext@temp}
180 {\noexpand\pgfkeyssetvalue{/tikz/ext/compat/#1}{\tikzext@temp}}%
181 }%
182 },
183 }
184
185 \def\tikzext@temp#1{%
186 \pgfkeysedef{/tikz/ext/compat/#1}{%
187 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/arrows} {#1}%
188 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/pgffor} {#1}%
189 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/misc} {#1}%
190 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/nodes} {#1}%
191 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/node-families} {#1}%
192 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/patterns.images} {#1}%
193 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/paths.arcto} {#1}%
194 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/paths.ortho} {#1}%
195 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/paths.timer} {#1}%
196 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/pgffor-ext} {#1}%
197 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/pgfkeys-plus} {#1}%
198 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/positioning-plus} {#1}%
199 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/pgfcalendar-ext} {#1}%
200 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/scalepicture} {#1}%
201 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/shapes} {#1}%
202 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/topaths.arcthrough} {#1}%
203 \noexpand\pgfkeyssetvalue{/tikz/ext/compat/transformations.mirror}{#1}%
204 }}
205 \tikzext@temp{pre 0.6}
206 \tikzext@temp{0.6}
207 \tikzextset{
208 compat/0.6.1/.style={/tikz/ext/compat/0.6},
209 compat/0.6.2/.style={/tikz/ext/compat/0.6}%
210 }
211 \tikzext@temp{newest}
212 \tikzext@temp{warn}
213 \tikzextset{compat=warn}
214
215 \long\def\tikzextutil@gobblethree#1#2#3{}
216 \def\tikzextutil@addto@macro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} % calendar: if
217 \def\tikzextutil@prefixtomacro#1#2{%
218 \def\tikzext@temp{#2}%
219 \tikzextutil@prefix@macrotomacro#1\tikzext@temp
220 }
221 \def\tikzextutil@prefix@macrotomacro#1#2{%
222 \expandafter\expandafter\expandafter\def
223 \expandafter\expandafter\expandafter#1%
224 \expandafter\expandafter\expandafter{\expandafter#2#1}}
225
226 \def\tikzextutil@firstofmany#1#2\pgf@stop{#1}
227 \def\tikzextutil@secondofmany#1#2\pgf@stop{#2}
228 \endinput