summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex66
1 files changed, 66 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
index ad8f8bd36a9..d08717c533a 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
@@ -65,6 +65,22 @@
\pgfplotslistnew#1{#2}%
}%
+\def\pgfplots@shellescape@lua@eightseven#1{%
+ \pgfplotsutil@directlua{os.execute("\pgfplotsutil@luaescapestring{#1}")}%
+}%
+\def\pgfplots@shellescape#1{%
+ \immediate\write18{#1}%
+}%
+\pgfutil@IfUndefined{directlua}{%
+}{%
+ \pgfutil@IfUndefined{lastsavedimageresourcepages}{%
+ \pgfplots@log3{Found old luatex which supports write18 (shell-escape)}%
+ }{%
+ \pgfplots@log3{Found new luatex: initializing lua commands instead of write18 (shell-escape)}%
+ \let\pgfplots@shellescape=\pgfplots@shellescape@lua@eightseven
+ }%
+}%
+
% Sets the boolean \ifpgfplots@is@old@list@format to true if and only
% if the input is a list in the format '{first\\second\\}'.
%
@@ -633,6 +649,56 @@
\fi
}%
+% Defines \pgfplotsretval to contain a 'domain' argument if '#1' is
+% actually a domain listing. In this case, '\pgfplotsretvalb' will be
+% set to the number of samples.
+%
+% If #1 is no valid domain argument, \pgfplotsretval will be set to
+% empty.
+\def\pgfplotsforeachtodomain#1{%
+ \begingroup
+ \long\def\pgfplotsforeachungroupednonuniform@##1##2##3{%
+ \def\pgfplotsretval{}%
+ \def\pgfplotsretvalb{}%
+ }%
+ \long\def\pgfplotsforeachungroupedslashed@##1/##2##3##4{%
+ \def\pgfplotsretval{}%
+ \def\pgfplotsretvalb{}%
+ }%
+ \long\def\pgfplotsforeachungroupeduniform@##1##2,##3,...,##4\relax##5{%
+ \edef\pgfplotsretval{##2:##4}%
+ \pgfkeys{/pgf/fpu}%
+ \pgfmathparse{##3-##2}%
+ \let\pgfplots@h=\pgfmathresult
+ \pgfmathparse{(##4-##2)/\pgfplots@h + 1}%
+ \pgfmathfloattofixed\pgfmathresult
+ \afterassignment\pgfplotsforeachtodomain@@
+ \c@pgf@counta=\pgfmathresult
+ }%
+ \edef\pgfplots@loc@TMPa{\noexpand\pgfplotsforeachungrouped \noexpand\x\space in{#1}{}}%
+ \pgfplots@loc@TMPa
+ %
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand\pgfplotsretval{\pgfplotsretval}%
+ \noexpand\def\noexpand\pgfplotsretvalb{\pgfplotsretvalb}%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+\def\pgfplotsforeachtodomain@@.#1\relax{%
+ \pgf@xa=0.#1pt %
+ \ifnum\pgf@xa>0.01pt % FIXME : threshold is chosen in a bad way... should be relative to number range!
+ % this is not an integer! We cannot convert it to a domain.
+ \def\pgfplotsretval{}%
+ \def\pgfplotsretvalb{}%
+ \else
+ % ok, it is an integer. Return it as number samples!
+ % \pgfplotsretval already contains the domain.
+ \edef\pgfplotsretvalb{\the\c@pgf@counta}%
+ \fi
+}%
+
\long\def\pgfplotsforeachungrouped@@#1#2#3#4{%
\pgfplots@for@reset@break{%
%