Debian Codegraph @

texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfutil-common-lists.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%% This file is a copy of some part of PGF/Tikz.
3 %%% It has been copied here to provide :
4 %%% - compatibility with older PGF versions
5 %%% - availability of PGF contributions by Christian Feuersaenger
6 %%% which are necessary or helpful for pgfplots.
7 %%%
8 %%% For reasons of simplicity, I have copied the whole file, including own contributions AND
9 %%% PGF parts. The copyrights are as they appear in PGF.
10 %%%
11 %%% Note that pgfplots has compatible licenses.
12 %%%
13 %%% This copy has been modified in the following ways:
14 %%% - nested \input commands have been updated
15 %%%
16 %
17 % Support for the contents of this file will NOT be done by the PGF/TikZ team.
18 % Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
19 % with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
20 % This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 %%% Date of this copy: Sa 7. Dez 20:58:23 CET 2013 %%%
23
24
25
26 % Copyright 2013 by Christian Feuersaenger
27 %
28 % This file may be distributed and/or modified
29 %
30 % 1. under the LaTeX Project Public License and/or
31 % 2. under the GNU Public License.
32 %
33 % See the file doc/generic/pgf/licenses/LICENSE for more details.
34
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
36 %
37 % This list here is a general re-implementation of the list used in
38 % the PGF system layer.
39 % It employs two collect-buffers to reduce the runtime.
40 %
41 % - It has preasymptotical runtime O(N), but is O(N^2) asymptotically.
42 % - It requires only 5 macros per list.
43 %
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45
46 % Usage:
47 % \pgfapplistnewempty\macro
48 \def\pgfapplistnewempty#1{%
49 \expandafter\let\csname pgfapp@#1\endcsname=\pgfutil@empty
50 \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty
51 \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty
52 \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}%
53 \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}%
54 }%
55
56 % #1: the item to append
57 % #2: the list as macro name
58 \long\def\pgfapplistpushback#1\to#2{%
59 \begingroup
60 \c@pgf@counta=\csname pgfapp@#2@smallbuf@c\endcsname\relax
61 \advance\c@pgf@counta by1
62 \xdef\pgf@glob@TMPa{\the\c@pgf@counta}%
63 \endgroup
64 \expandafter\let\csname pgfapp@#2@smallbuf@c\endcsname=\pgf@glob@TMPa
65 \ifnum\csname pgfapp@#2@smallbuf@c\endcsname<40
66 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}%
67 \expandafter\edef\csname pgfapp@#2@smallbuf\endcsname{\the\t@pgf@toka}%
68 \else
69 \pgfapplistpushback@smallbufoverfl{#1}{#2}%
70 \fi
71 }%
72 \long\def\pgfapplistpushback@smallbufoverfl#1#2{%
73 \begingroup
74 \c@pgf@counta=\csname pgfapp@#2@bigbuf@c\endcsname\relax
75 \advance\c@pgf@counta by1
76 \xdef\pgf@glob@TMPa{\the\c@pgf@counta}%
77 \endgroup
78 \expandafter\let\csname pgfapp@#2@bigbuf@c\endcsname=\pgf@glob@TMPa
79 %
80 \ifnum\csname pgfapp@#2@bigbuf@c\endcsname<30
81 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}%
82 \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}%
83 \expandafter\edef\csname pgfapp@#2@bigbuf\endcsname{\the\t@pgf@toka\the\t@pgf@tokb}%
84 \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty
85 \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}%
86 \else%
87 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2\endcsname}%
88 \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}%
89 \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}%
90 \expandafter\edef\csname pgfapp@#2\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}%
91 \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty
92 \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}%
93 \expandafter\let\csname pgfapp@#2@bigbuf\endcsname=\pgfutil@empty
94 \expandafter\def\csname pgfapp@#2@bigbuf@c\endcsname{0}%
95 \fi%
96 }%
97 \def\pgfapplist@flushbuffers#1{%
98 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#1\endcsname}%
99 \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#1@bigbuf\endcsname}%
100 \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#1@smallbuf\endcsname}%
101 \expandafter\edef\csname pgfapp@#1\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}%
102 \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty
103 \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}%
104 \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty
105 \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}%
106 }%
107
108 \def\pgfapplistlet#1=#2{%
109 \pgfapplist@flushbuffers{#2}%
110 \expandafter\let\expandafter#1\csname pgfapp@#2\endcsname
111 }%
112
113
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 %
116 % A variant of applist which has the same runtime requirements, but
117 % does PUSH FRONT only.
118 %
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120
121
122 % Usage:
123 % \pgfprependlistnewempty{list}
124 \def\pgfprependlistnewempty#1{%
125 \expandafter\let\csname pgfpPRP@#1\endcsname=\pgfutil@empty
126 \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty
127 \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty
128 \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}%
129 \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}%
130 }%
131
132 % #1: the item to append
133 % #2: the list as macro name
134 \long\def\pgfprependlistpushfront#1\to#2{%
135 \begingroup
136 \c@pgf@counta=\csname pgfpPRP@#2@smallbuf@c\endcsname\relax
137 \advance\c@pgf@counta by1
138 \xdef\pgf@glob@TMPa{\the\c@pgf@counta}%
139 \endgroup
140 \expandafter\let\csname pgfpPRP@#2@smallbuf@c\endcsname=\pgf@glob@TMPa
141 \ifnum\csname pgfpPRP@#2@smallbuf@c\endcsname<40
142 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}%
143 \t@pgf@tokb={#1}%
144 \expandafter\edef\csname pgfpPRP@#2@smallbuf\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}%
145 \else
146 \pgfprependlistpushfront@smallbufoverfl{#1}{#2}%
147 \fi
148 }%
149 \long\def\pgfprependlistpushfront@smallbufoverfl#1#2{%
150 \begingroup
151 \c@pgf@counta=\csname pgfpPRP@#2@bigbuf@c\endcsname\relax
152 \advance\c@pgf@counta by1
153 \xdef\pgf@glob@TMPa{\the\c@pgf@counta}%
154 \endgroup
155 \expandafter\let\csname pgfpPRP@#2@bigbuf@c\endcsname=\pgf@glob@TMPa
156 %
157 \ifnum\csname pgfpPRP@#2@bigbuf@c\endcsname<30
158 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@bigbuf\endcsname}%
159 \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}%
160 \t@pgf@tokc={#1}%
161 \expandafter\edef\csname pgfpPRP@#2@bigbuf\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}%
162 \expandafter\let\csname pgfpPRP@#2@smallbuf\endcsname=\pgfutil@empty
163 \expandafter\def\csname pgfpPRP@#2@smallbuf@c\endcsname{0}%
164 \else%
165 \pgfprependlist@flushbuffers{#2}%
166 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2\endcsname}%
167 \t@pgf@tokb={#1}%
168 \expandafter\edef\csname pgfpPRP@#2\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}%
169 \fi%
170 }%
171 \def\pgfprependlist@flushbuffers#1{%
172 \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1\endcsname}%
173 \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@bigbuf\endcsname}%
174 \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@smallbuf\endcsname}%
175 \expandafter\edef\csname pgfpPRP@#1\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}%
176 \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty
177 \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}%
178 \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty
179 \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}%
180 }%
181 \def\pgfprependlistlet#1=#2{%
182 \pgfprependlist@flushbuffers{#2}%
183 \expandafter\let\expandafter#1\csname pgfpPRP@#2\endcsname
184 }%