From f41811b55dfce3a5f59b953b68457b0aa5491baf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 9 Aug 2008 23:39:38 +0000 Subject: pgfplots update (10aug08) git-svn-id: svn://tug.org/texlive/trunk@10222 c570f23f-e606-0410-a88d-b1316a301751 --- .../pgfplots/liststructure/pgfplotsarray.code.tex | 16 +- .../liststructure/pgfplotsliststructure.code.tex | 98 +++-- .../pgfplotsliststructureext.code.tex | 459 +++++++++++++++++++++ 3 files changed, 540 insertions(+), 33 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex (limited to 'Master/texmf-dist/tex/generic/pgfplots/liststructure') diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex index 16e4b539c02..77fc52b1115 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -56,7 +56,7 @@ \long\def\pgfplotsarraynew#1#2{% \pgfplotsarraynewempty{#1}% \long\def\pgfplotsarraynew@impl@rest{#2}% - \loop + \pgfutil@loop \ifx\pgfplotsarraynew@impl@rest\pgfutil@empty \pgfplots@loop@CONTINUEfalse \else @@ -64,7 +64,7 @@ \fi \ifpgfplots@loop@CONTINUE \expandafter\pgfplotsarraynew@impl\pgfplotsarraynew@impl@rest\toarray#1\relax - \repeat + \pgfutil@repeat } % helper macro for \pgfplotsarraynew @@ -96,11 +96,11 @@ \pgfplotsarray@@let{#2@size}={#1@size}% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0 - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP \pgfplotsarray@@let{#2@\the\c@pgfplotsarray@tmp}={#1@\the\c@pgfplotsarray@tmp}% \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } @@ -179,24 +179,24 @@ \long\def\pgfplotsarrayforeach#1\as#2#3{% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0\relax - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax \begingroup \expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname% #3% \endgroup \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } % The same but without groups around #3. \long\def\pgfplotsarrayforeachungrouped#1\as#2#3{% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0\relax - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax \expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname% #3% \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex index 48fd19a890c..d7bd7dc73ed 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -4,12 +4,17 @@ % % Its implementation is based on Knuth's list macros in "The TeXbook". % +% It features a convenient set of list macros, but it is not fast. +% In fact, every elementary operation requires time O(N), so working +% with this list easily leads to O(N^2) runtime. +% % The following macros are supplied: % % \pgfplotslistnewempty % \pgfplotslistnew % \pgfplotslistcopy % \pgfplotslistpopfront +% \pgfplotslistfront % \pgfplotslistpushback % \pgfplotslistpushfront % \pgfplotslistsize @@ -17,6 +22,10 @@ % \pgfplotslistcheckempty % \pgfplotslistforeach % +% @see \pgfplotsapplist a "real" list with O(1) pushback, but limited application. +% @see \pgfplotsapplistX a preasymptotical fast list to accumulate elements. +% @see \pgfplotsapplistXX an optimized version of \pgfplotsapplistX. +% % Copyright 2007/2008 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify @@ -36,8 +45,6 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newtoks\pgfplotslist@TOK@a -\newtoks\pgfplotslist@TOK@b \newif\ifpgfplotslistempty @@ -74,7 +81,7 @@ \else \expandafter\def\expandafter\pgfplotslistnew@impl@rest\expandafter{\pgfplotslistnew@impl@rest,}% \fi - \loop + \pgfutil@loop \ifx\pgfplotslistnew@impl@rest\pgfutil@empty \pgfplots@loop@CONTINUEfalse \else @@ -86,13 +93,13 @@ \else \expandafter\pgfplotslistnew@impl@comma\pgfplotslistnew@impl@rest\tolist#1\relax \fi - \repeat + \pgfutil@repeat } \def\pgfplotslist@EOI{\pgfplotslist@EOI} \def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{% - \def\pgfplotslist@TMPB{#2}% - \ifx\pgfplotslist@TMPB\pgfutil@empty + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfutil@empty \pgfplotslist@is@backslash@terminatedfalse \else \pgfplotslist@is@backslash@terminatedtrue @@ -119,9 +126,15 @@ % Example: % \pgfplotslistpushfront Next first Element\to\foolist \long\def\pgfplotslistpushfront#1\to#2{% - \pgfplotslist@TOK@a={\pgfplotslist@sep{#1}}% - \pgfplotslist@TOK@b=\expandafter{#2}% - \edef#2{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka={\pgfpl@@{#1}}% + \t@pgfplots@tokb=\expandafter{#2}% + \edef#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% +} + +% Assembles a low-level list item representation into the token +% register #2. +\def\pgfplotslist@assembleentry#1\into#2{% + #2={\pgfpl@@{#1}}% } % #1: the item to append @@ -129,22 +142,32 @@ % Example: % \pgfplotslistpushback Next last element\to\foolist \long\def\pgfplotslistpushback#1\to#2{% - \pgfplotslist@TOK@a={\pgfplotslist@sep{#1}}% + \t@pgfplots@toka={\pgfpl@@{#1}}% \ifx#2\pgfutil@empty - \pgfplotslist@TOK@b={}% + \t@pgfplots@tokb={}% \else - \pgfplotslist@TOK@b=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter{#2}% \fi - \edef#2{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% + \edef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% +} +% Adds '#1' to the GLOBAL list '#2'. +\long\def\pgfplotslistpushbackglobal#1\to#2{% + \t@pgfplots@toka={\pgfpl@@{#1}}% + \ifx#2\pgfutil@empty + \t@pgfplots@tokb={}% + \else + \t@pgfplots@tokb=\expandafter{#2}% + \fi + \xdef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% } % Concatenates two lists #2 and #3 into #1 % Example: % \pgfplotslistconcat\result=\foolist&\bar \long\def\pgfplotslistconcat#1=#2{% - \pgfplotslist@TOK@a=\expandafter{#2}% - \pgfplotslist@TOK@b=\expandafter{#3}% - \edef#1{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter{#3}% + \edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% } % implements #2 := pop_front(#1) @@ -154,16 +177,29 @@ \pgfplotslistcheckempty#1\relax \ifpgfplotslistempty \pgfplots@error{ERROR: \string\pgfplotslistpopfront\ from \string#1\ although list is EMPTY}% + \let#2=\pgfutil@empty \else \expandafter\pgfplotslistpopfront@impl#1\pgfplotslistpopfront@macronames#1#2% \fi } +\long\def\pgfplotslistfront#1\to#2{% + \pgfplotslistcheckempty#1\relax + \ifpgfplotslistempty + \pgfplots@error{ERROR: \string\pgfplotslistfront\ from \string#1\ although list is EMPTY}% + \let#2=\pgfutil@empty + \else + \expandafter\pgfplotslistfront@impl#1\pgfplotslistpopfront@macronames#2% + \fi +} % implementation helper for listpopfront -\long\def\pgfplotslistpopfront@impl\pgfplotslist@sep#1#2\pgfplotslistpopfront@macronames#3#4{% +\long\def\pgfplotslistpopfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3#4{% \def#4{#1}% \def#3{#2}% } +\long\def\pgfplotslistfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3{% + \def#3{#1}% +} % Counts the number of elements in list #1, storing it into the count % register #2. @@ -172,7 +208,7 @@ % \the\count0 \long\def\pgfplotslistsize#1\to#2{% #2=0% - \long\def\pgfplotslist@sep##1{\advance#2 by 1 }% + \long\def\pgfpl@@##1{\advance#2 by 1 }% #1% } @@ -188,12 +224,15 @@ % \elem % Element \count1: % \pgfplotslistselect\count1\of\foo\to\elem -\long\def\pgfplotslistselect#1\of#2\to#3{% - \global\def\pgfplotslistselect@tmp{\def#3{\pgfplots@error{The requested item #1 of \string#2 is OUT OF RANGE.}}}% +\def\pgfplotslistselect#1\of#2\to#3{% + \global\def\pgfplotslistselect@tmp{\def#3{}\pgfplots@error{The requested list entry with index #1 of \string#2 is too large; this list has not enough elements.}}% + \pgfplotslistselect@{#1}\of{#2}\to{#3}% +} +\def\pgfplotslistselect@#1\of#2\to#3{% \begingroup \count0=#1\relax - \long\def\pgfplotslist@sep##1{% - \advance\count0-1\relax + \long\def\pgfpl@@##1{% + \advance\count0 by-1\relax \ifnum\count0=-1\relax \global\def\pgfplotslistselect@tmp{\def#3{##1}}% \fi% @@ -202,6 +241,10 @@ \endgroup \pgfplotslistselect@tmp } +\def\pgfplotslistselectorempty#1\of#2\to#3{% + \global\def\pgfplotslistselect@tmp{\def#3{}}% + \pgfplotslistselect@{#1}\of{#2}\to{#3}% +} % Sets the boolean \ifpgfplotslistempty depending on whether list #1 is empty % or not. @@ -217,7 +260,12 @@ \ifx#1\pgfutil@empty \pgfplotslistemptytrue \else - \pgfplotslistemptyfalse + \ifx#1\relax + \pgfplots@warning{WARNING: possible logic error in script code: the command \string\pgfplotslistcheckempty{\string#1} encountered an undefined argument.}% + \pgfplotslistemptytrue + \else + \pgfplotslistemptyfalse + \fi \fi } @@ -233,7 +281,7 @@ % Each single element will be grouped with TeX groups. \long\def\pgfplotslistforeach#1\as#2#3{% \begingroup - \long\def\pgfplotslist@sep##1{\def#2{##1}% + \long\def\pgfpl@@##1{\def#2{##1}% \begingroup #3 \endgroup}% @@ -249,7 +297,7 @@ \pgfplots@error{Sorry, you can't nest pgfplotslistforeachungrouped.}% \else \pgfplotslistforeachungroupedrunningtrue - \long\def\pgfplotslist@sep##1{\def#2{##1}#3}% + \long\def\pgfpl@@##1{\def#2{##1}#3}% #1\relax \pgfplotslistforeachungroupedrunningfalse \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex new file mode 100644 index 00000000000..a10e67c82f3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex @@ -0,0 +1,459 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This is a helper package with an elementary list datastructure. +% In contrast to \pgfplotslist, this one features fast append and fast +% copy-to-macro. +% +% The 'pgfplotsapplist' is a list which has ONLY the features +% +% \pgfplotsapplistnewempty +% \pgfplotsapplistpushback O(1) +% \pgfplotsapplistedefcontenttomacro (N) +% \pgfplotsapplistxdefcontenttomacro (N) +% +% It has been designed to accumulate macro content in O(N) (in +% contrast to TeX's macro append routines which lead to O(N^2) +% runtime). +% +% Furthermore, there is the +% +% \pgfplotsapplistXnewempty +% \pgfplotsapplistXpushback +% \pgfplotsapplistXedefcontenttomacro (N) +% \pgfplotsapplistXxdefcontenttomacro (N) +% \pgfplotsapplistXlet (N) +% +% structure which features **preasymptotical** constant runtime for +% pushback. That means, as long as N < 80000, the runtime is linear. +% It is only slightly slower than \pgfplotsapplist, and that only due +% to its generality. It could easily be adopted to be FASTER than +% \pgfplotsapplist. +% +% Credits for \pgfplotsapplist go to Till Tantau: he developped it for +% the PGF kernel. +% +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program 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 3 of the License, or +% (at your option) any later version. +% +% This program 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 program. If not, see . +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the applist defines one macro for each element, like +% +% \def\element{\element} +% \def\element{\element} +% \def\element{} +% +% The '' value belongs to the private interface and is part of the +% macro name. +% +% It features: +% - real O(1) pushback +% - O(N) edef to macro +% - O(N) execute +% - it requires O(N) different macros. +% - it ***can't*** be copied outside of the current TeX group! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Time: O(1), number of macros: 3 +\def\pgfplotsapplistnewempty#1{% + \expandafter\def\csname\string#1@endno\endcsname{0}% + \edef#1{\expandafter\noexpand\csname\string#1@0\endcsname}% + \expandafter\def\csname\string#1@0\endcsname{}% +}% + +% Time: O(1), number of macros per list: about N +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistpushback#1\to#2{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname\string#2@endno\endcsname + \begingroup + \c@pgf@counta=\pgfplots@loc@TMPa\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@endno\endcsname=\pgfplots@glob@TMPa% + \t@pgfplots@toka={#1}% + \t@pgfplots@tokb=\expandafter{\csname\string#2@\pgfplots@glob@TMPa\endcsname}% + \expandafter\edef\csname\string#2@\pgfplots@loc@TMPa\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \expandafter\let\the\t@pgfplots@tokb=\pgfutil@empty +}% + +% time O(N) +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistedefcontenttomacro#1\to#2{\edef#2{#1}} +\def\pgfplotsapplistxdefcontenttomacro#1\to#2{\xdef#2{#1}} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +% time O(N) +\def\pgfplotsapplistexecute#1{#1}% + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% This list here is a general re-implementation of the list used in +% the PGF system layer. +% It employs two collect-buffers to reduce the runtime. +% +% - It has preasymptotical runtime O(N), but is O(N^2) asymptotically. +% - It requires only 5 macros per list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Usage: +% \pgfplotsapplistXnewempty\macro +% \pgfplotsapplistXnewempty[to global]\macro +% +% The 'to global' flag will configure the list such that all +% assignments to \macro are global. The list accumulation is +% LOCAL, however: 'to global' is to be used inside of a local +% group such that the final result, when all buffers are flushed, +% is assigned globally. +\def\pgfplotsapplistXnewempty{% + \pgfutil@ifnextchar[{% + \pgfplotsapplistXnewempty@opt + }{% + \pgfplotsapplistXnewempty@opt[]% + }% +} + +\def\pgfplotsapplistXnewempty@opt@TOGLOBAL{to global} + +\def\pgfplotsapplistXnewempty@opt[#1]#2{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \expandafter\let\csname\string#2@let\endcsname=\let% + \expandafter\let\csname\string#2@edef\endcsname=\edef + \else + \ifx\pgfplots@loc@TMPa\pgfplotsapplistXnewempty@opt@TOGLOBAL + \expandafter\def\csname\string#2@let\endcsname{\global\let}% + \expandafter\let\csname\string#2@edef\endcsname=\xdef + \else + \pgfplots@error{Sorry, the argument '#1' to \string\pgfplotsapplistXnewempty\ is unknown. Accepted is 'to global' or empty.}% + \fi + \fi + \pgfplotsapplistXnewempty@{#2}% +}% + +\def\pgfplotsapplistXnewempty@#1{% + \csname\string#1@let\endcsname#1=\pgfutil@empty + \expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@smallbuf@c\endcsname{0}% + \expandafter\def\csname\string#1@bigbuf@c\endcsname{0}% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXpushback#1\to#2{% + \begingroup + \c@pgf@counta=\csname\string#2@smallbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@smallbuf@c\endcsname=\pgfplots@glob@TMPa + \ifnum\csname\string#2@smallbuf@c\endcsname<40 + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \expandafter\edef\csname\string#2@smallbuf\endcsname{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXpushback@smallbufoverfl{#1}{#2}% + \fi +}% +\def\pgfplotsapplistXpushback@smallbufoverfl#1#2{% + \begingroup + \c@pgf@counta=\csname\string#2@bigbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@bigbuf@c\endcsname=\pgfplots@glob@TMPa + % + \ifnum\csname\string#2@bigbuf@c\endcsname<30 + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \expandafter\edef\csname\string#2@bigbuf\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@smallbuf@c\endcsname{0}% + \else% + \t@pgfplots@toka=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}% + \t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \csname\string#2@edef\endcsname#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@smallbuf@c\endcsname{0}% + \expandafter\let\csname\string#2@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@bigbuf@c\endcsname{0}% + \fi% +}% +\def\pgfplotsapplistXflushbuffers#1{% + \t@pgfplots@toka=\expandafter{#1}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#1@bigbuf\endcsname}% + \t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#1@smallbuf\endcsname}% + \csname\string#1@edef\endcsname#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@smallbuf@c\endcsname{0}% + \expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@bigbuf@c\endcsname{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistXedefcontenttomacro#1\to#2{% + \pgfplotsapplistXflushbuffers#1% + \edef#2{#1}} +\def\pgfplotsapplistXxdefcontenttomacro#1\to#2{% + \pgfplotsapplistXflushbuffers#1% + \xdef#2{#1}} +\def\pgfplotsapplistXlet#1=#2{% + \pgfplotsapplistXflushbuffers#2% + \let#1=#2} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +\def\pgfplotsapplistXexecute#1{% + \pgfplotsapplistXflushbuffers#1% + #1}% + + + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% This list \pgfplotsapplistXX here is essentially the SAME as \pgfplotslistX. +% +% But there can only be one such list at a time, so it is faster than +% \pgfplotslistX. +% +% This here is probably the fastest list. +% +% It is nothing else but a copy of Till Tantau's pgf kernel list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 + + + +% WARNING: call \pgfplotsapplistclear if there is another list active. +\def\pgfplotsapplistXXnewempty{% + \pgfutil@ifundefined{pgfplotsapplistXX}{}{% + \ifx\pgfplotsapplistXX\pgfutil@empty + \else + \pgfplots@error{\string\pgfplotsapplistXXnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXX'. Please call '\string\pgfplotsapplistXXclear' before using a new list to ensure clean separations.}% + \fi + }% + \let\pgfplotsapplistXX=\pgfutil@empty + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \def\pgfplotsapplistXX@bigbuf@c{0}% +}% + + +\def\pgfplotsapplistXXclear{% + \pgfutil@ifundefined{pgfplotsapplistXX}{}{% + \let\pgfplotsapplistXX=\pgfutil@empty + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \def\pgfplotsapplistXX@bigbuf@c{0}% + }% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXXpushback#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXX@smallbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsapplistXX@smallbuf@c=\pgfplots@glob@TMPa + \ifnum\pgfplotsapplistXX@smallbuf@c<40 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX@smallbuf{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXXpushback@smallbufoverfl{#1}% + \fi +}% +\def\pgfplotsapplistXXpushback@smallbufoverfl#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXX@bigbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsapplistXX@bigbuf@c=\pgfplots@glob@TMPa + % + \ifnum\pgfplotsapplistXX@bigbuf@c<30 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \else% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@bigbuf@c{0}% + \fi% +}% +\def\pgfplotsapplistXXflushbuffers{% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf}% + \edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@bigbuf@c{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistXXedefcontenttomacro#1{% + \pgfplotsapplistXXflushbuffers + \edef#1{\pgfplotsapplistXX}} +\def\pgfplotsapplistXXxdefcontenttomacro#1{% + \pgfplotsapplistXXflushbuffers% + \xdef#1{\pgfplotsapplistXX}} +\def\pgfplotsapplistXXlet#1{% + \pgfplotsapplistXXflushbuffers% + \let#1=\pgfplotsapplistXX} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +\def\pgfplotsapplistXXexecute#1{% + \pgfplotsapplistXXflushbuffers + #1}% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% \pgfplotslistXXglobal assigns to a global list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +\def\pgfplotsapplistXXglobalnewempty{% + \pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{% + \ifx\pgfplotsapplistXXglobal\pgfutil@empty + \else + \pgfplots@error{\string\pgfplotsapplistXXglobalnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXXglobal'. Please call '\string\pgfplotsapplistXXglobalclear' before using a new list to ensure clean separations.}% + \fi + }% + \global\let\pgfplotsapplistXXglobal=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% +}% + + +\def\pgfplotsapplistXXglobalclear{% + \pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{% + \global\let\pgfplotsapplistXXglobal=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% + }% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXXglobalpushback#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXXglobal@smallbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \global\let\pgfplotsapplistXXglobal@smallbuf@c=\pgfplots@glob@TMPa + \ifnum\pgfplotsapplistXXglobal@smallbuf@c<40 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal@smallbuf{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXXglobalpushback@smallbufoverfl{#1}% + \fi +}% +\def\pgfplotsapplistXXglobalpushback@smallbufoverfl#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXXglobal@bigbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \global\let\pgfplotsapplistXXglobal@bigbuf@c=\pgfplots@glob@TMPa + % + \ifnum\pgfplotsapplistXXglobal@bigbuf@c<30 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \else% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% + \fi% +}% +\def\pgfplotsapplistXXglobalflushbuffers{% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf}% + \xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +% +% this assigns locally into #1. +\def\pgfplotsapplistXXglobaledefcontenttomacro#1{% + \pgfplotsapplistXXglobalflushbuffers + \edef#1{\pgfplotsapplistXXglobal}} +% this assigns locally into #1. +\def\pgfplotsapplistXXglobalxdefcontenttomacro#1{% + \pgfplotsapplistXXglobalflushbuffers% + \xdef#1{\pgfplotsapplistXXglobal}} +% this assigns locally into #1. +\def\pgfplotsapplistXXgloballet#1{% + \pgfplotsapplistXXglobalflushbuffers% + \let#1=\pgfplotsapplistXXglobal} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +% this assigns locally into #1. +\def\pgfplotsapplistXXglobalexecute#1{% + \pgfplotsapplistXXglobalflushbuffers + #1}% -- cgit v1.2.3