summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/liststructure
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-02-18 17:29:19 +0000
committerKarl Berry <karl@freefriends.org>2009-02-18 17:29:19 +0000
commit580735009eac6952e6ce112bd3c6f00fade80c3f (patch)
treef30360f712a94d2d7fb524989a55fd6a97ccda9e /Master/texmf-dist/tex/generic/pgfplots/liststructure
parent55304cf473fbdece6b5392aac6cfb75671e34189 (diff)
pgfplots update (17feb09)
git-svn-id: svn://tug.org/texlive/trunk@12180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/liststructure')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex6
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex56
2 files changed, 55 insertions, 7 deletions
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 6f0d12ee115..acc5ec7c53b 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex
@@ -42,6 +42,12 @@
\pgfplotsarray@@def{#1@size}{0}%
}
+% Invokes code '#2' if the array named '#1' exists and '#3' if it does
+% not exist.
+\def\pgfplotsarrayifdefined#1#2#3{%
+ \pgfutil@ifundefined{#1@size}{#3}{#2}%
+}%
+
% Creates a new array with an abirtrary number of elements.
% Arguments:
% #1: the array's name (a macro name)
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 91caf2a033f..aa21ad13dc4 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex
@@ -290,13 +290,55 @@
\newif\ifpgfplotslistforeachungroupedrunning
% The same but without groups around #3.
+%
+% The list can be nested.
\long\def\pgfplotslistforeachungrouped#1\as#2#3{%
- \ifpgfplotslistforeachungroupedrunning
- \pgfplots@error{Sorry, you can't nest pgfplotslistforeachungrouped.}%
+ \t@pgfplots@tokb={{#2}{#3}}%
+ \t@pgfplots@tokc=\expandafter{#1}%
+ \edef\pgfplotslist@loc@TMPa{%
+ \noexpand\pgfplotslistforeachungrouped@
+ \the\t@pgfplots@tokb%
+ \the\t@pgfplots@tokc
+ \noexpand\pgfpl@@\noexpand\pgfplotslistforeachungrouped@EOI
+ }%
+ \pgfplotslist@loc@TMPa
+}%
+
+% Technical helper method which performs the loop.
+% ASSUMPTION:
+% \pgfplotslistforeachungrouped@
+% {<macro name>}
+% {<code to execute>}
+% \pgfpl@@{<list elem>}\pgfpl@@{<list elem>}\pgfpl@@{<list elem>}\pgfpl@@\pgfplotslistforeachungrouped@EOI
+%
+% -> iterate through argument until \pgfplotslistforeachungrouped@EOI
+% comes.
+\long\def\pgfplotslistforeachungrouped@#1#2\pgfpl@@#3{%
+ \def\pgfplots@loc@TMPa{#3}%
+ \ifx\pgfplots@loc@TMPa\pgfplotslistforeachungrouped@EOI
+ % ok, terminate loop.
+ \let\pgfplotslistforeachungrouped@next=\relax
\else
- \pgfplotslistforeachungroupedrunningtrue
- \long\def\pgfpl@@##1{\def#2{##1}#3}%
- #1\relax
- \pgfplotslistforeachungroupedrunningfalse
+ % perform loop iteration ...
+ \def#1{#3}%
+ #2\relax
+ % and continue iterating.
+ \def\pgfplotslistforeachungrouped@next{\pgfplotslistforeachungrouped@{#1}{#2}}%
\fi
-}
+ \pgfplotslistforeachungrouped@next
+}%
+\def\pgfplotslistforeachungrouped@EOI{\pgfplotslistforeachungrouped@EOI}% equals only itself in \ifx
+
+%--------------------------------------------------
+% \long\def\pgfplotslistforeachungrouped#1\as#2#3{%
+% \ifpgfplotslistforeachungroupedrunning
+% \pgfplots@error{Sorry, you can't nest pgfplotslistforeachungrouped.}%
+% \else
+% \pgfplotslistforeachungroupedrunningtrue
+% \long\def\pgfpl@@##1{\def#2{##1}#3}%
+% #1\relax
+% \pgfplotslistforeachungroupedrunningfalse
+% \fi
+% }
+%--------------------------------------------------
+