summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/utilities
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-15 20:36:08 +0000
committerKarl Berry <karl@freefriends.org>2021-05-15 20:36:08 +0000
commit544b3afa0b563118bfa9a64d8ab468ee47c1fbd2 (patch)
tree5daa86acec73defb207aefe148404f0131e08e45 /Master/texmf-dist/tex/generic/pgf/utilities
parentbf129e8b52e880fb8fdf9d68afd6995df3f225ed (diff)
pgf (15may21)
git-svn-id: svn://tug.org/texlive/trunk@59210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/utilities')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex1
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex16
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex110
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def7
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def7
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def7
6 files changed, 88 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
index 579b6dccea3..a954d4adf03 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex
@@ -789,7 +789,6 @@
}
\pgfkeys{/pgf/calendar/Easter/.cd,.default=0,.code={%
- \show\pgfcalendarifdateyear
\pgfcalendareastersunday{\pgfcalendarifdateyear}{\pgf@cal@easter@julianday}%
\ifnum\pgfcalendarifdatejulian=\pgfinteval{\pgf@cal@easter@julianday+#1}
\expandafter\pgfcalendarmatchestrue
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
index db89141aca1..184506a1851 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
@@ -45,6 +45,17 @@
\csname @@end\expandafter\endcsname\expandafter\end%
\fi
+% e-TeX primitives and beyond
+
+\ifx\contextversion\undefined
+ \let\pgfkeys@expanded \expanded
+ \let\pgfkeys@unexpanded \unexpanded
+\else
+ \let\pgfkeys@expanded \normalexpanded
+ \let\pgfkeys@unexpanded \normalunexpanded
+\fi
+
+
% Set a key to a value
%
% #1 = key
@@ -74,9 +85,8 @@
}
\long\def\pgfkeyssetevalue#1#2{%
- \edef\pgfkeys@temp##1##2##3##4##5##6##7##8##9{#2}%
- \pgfkeys@temptoks=\expandafter{\pgfkeys@temp{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}%
- \expandafter\edef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}%
+ \expandafter\edef\csname pgfk@#1\endcsname
+ {\pgfkeys@unexpanded\expandafter{\pgfkeys@expanded{#2}}}%
}
% Add text to a key at the end
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
index 37210d48703..952af70f550 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
@@ -32,6 +32,10 @@
\newif\ifpgfutil@format@is@plain
\newif\ifpgfutil@format@is@context
+% Aliases
+
+\let\pgfutil@exp\romannumeral
+\chardef\pgfutil@exp@end=0
% Simple stuff
@@ -45,13 +49,43 @@
\def\pgfutil@trimspaces@@#1Q#2{#1}
\catcode`\Q=11
-% \pgfutil@ifempty{<cs>}{<true code>}{<false code>}
+% \pgfutil@ifx{<token 1>}{<token 2>}{<true code>}{<false code>}
+%
+% This macro is expandable.
+\long\def\pgfutil@ifx#1#2{%
+ \ifx#1#2%
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+
+% \pgfutil@ifstrequal{<lhs>}{<rhs>}{<true code>}{<false code>}
%
-% Check if <cs> is equal to \pgfutil@empty
+% Check if <lhs> and <rhs> are equal by string comparison
%
% This macro is expandable.
-\def\pgfutil@ifempty#1{%
- \ifx#1\pgfutil@empty
+\long\def\pgfutil@ifstrequal#1#2{%
+ \ifnum\pgfsys@strcmp{\pgfutil@unexpanded{#1}}{\pgfutil@unexpanded{#2}}=0
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+}
+
+% \pgfutil@ifxempty{<token 1>}{<true code>}{<false code>}
+%
+% Shortcut for \pgfutil@ifx\pgfutil@empty{<token 1>}{<true code>}{<false code>}
+%
+% This macro is expandable.
+\def\pgfutil@ifxempty{\pgfutil@ifx\pgfutil@empty}
+
+% pgfutil@ifempty
+%
+% Check if #1 is empty. No expansion is performed on #1.
+%
+% This macro is expandable.
+\long\def\pgfutil@ifempty#1{%
+ \if\relax\detokenize{#1}\relax
\expandafter\pgfutil@firstoftwo
\else
\expandafter\pgfutil@secondoftwo
@@ -64,11 +98,7 @@
%
% This macro is expandable.
\def\pgfutil@ifundefined#1{%
- \expandafter\ifx\csname#1\endcsname\relax
- \expandafter\pgfutil@firstoftwo
- \else
- \expandafter\pgfutil@secondoftwo
- \fi}
+ \expandafter\pgfutil@ifx\csname#1\endcsname\relax}
% A variant of \pgfutil@ifundefined which will NOT let #1 to \relax it
% is undefined.
@@ -79,6 +109,7 @@
\expandafter\pgfutil@firstoftwo
\fi
}
+
\long\def\pgfutil@firstofone#1{#1}
\long\def\pgfutil@firstoftwo#1#2{#1}
\long\def\pgfutil@secondoftwo#1#2{#2}
@@ -222,45 +253,42 @@
\def\pgfutil@iterate{\pgfutil@body \let\pgfutil@next\pgfutil@iterate \else\let\pgfutil@next\relax\fi \pgfutil@next}
\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable
-
% \pgfutil@switch
%
-% #1: string to switch on
-% #2: sequence of label-value pairs
+% #1: comparison function of the form
+% \comp{<lhs>}{<rhs>}{<true code>}{<false code>}
+% Has to be expandable!
+% #2: lhs
+% #3: sequence of rhs-value pairs
+% #4: default statement in case of match
+% #5: default statement in case of no match
%
% Example:
%
-% \pgfutil@switch{foo}{%
-% {foo}{1}%
-% {bar}{2}%
-% {default}{X}%
-% }
-%
-% If a statement with the label `default' exists it will be executed
-% if no other label matches.
-
-\long\def\pgfutil@switch#1#2{%
- \begingroup
- \def\pgfutil@switch@selected{}%
- \pgfutil@switch@collect@statements#2{}{}%
- \ifcsname pgfutil@switch@choice@\detokenize{#1}\endcsname
- \expandafter\let\expandafter\pgfutil@switch@selected\csname pgfutil@switch@choice@\detokenize{#1}\endcsname
- \else
- \ifdefined\pgfutil@switch@choice@default
- \let\pgfutil@switch@selected\pgfutil@switch@choice@default
- \fi
- \fi
- \expandafter\endgroup\pgfutil@switch@selected
+% \pgfutil@switch\pgfutil@ifx\pgf@let@token{%
+% {(}{\tikz@movetoabs}%)
+% {+}{\tikz@movetorel}%
+% {-}{\tikz@lineto}%
+% }{}{\tikz@expand}
+
+\let\pgfutil@scan@mark\relax
+\let\pgfutil@scan@stop\relax
+
+\long\def\pgfutil@switch#1#2#3#4#5{%
+ \pgfutil@exp
+ \pgfutil@switch@@{#1}%
+ {#2}#3% user-defined cases
+ {#2}{}% default case
+ \pgfutil@scan@mark{#4}% true code
+ \pgfutil@scan@mark{#5}% false code
+ \pgfutil@scan@stop
}
-
-\long\def\pgfutil@switch@collect@statements#1{%
- \if\relax\detokenize{#1}\relax
- \else
- \afterassignment\pgfutil@switch@collect@statements
- \expandafter\def\csname pgfutil@switch@choice@\detokenize{#1}\expandafter\endcsname
- \fi
+\long\def\pgfutil@switch@@#1#2#3#4{%
+ #1{#2}{#3}%
+ {\pgfutil@switch@end{#4}}%
+ {\pgfutil@switch@@{#1}{#2}}%
}
-
+\long\def\pgfutil@switch@end#1#2#3\pgfutil@scan@mark#4#5\pgfutil@scan@stop{\pgfutil@exp@end#1#4}
% aux-read-hook
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
index 651b1cd169c..eddab09aba8 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
@@ -367,10 +367,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{normalprotected}{%
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\normalprotected
-}
+\let\pgfutil@protected\normalprotected
+\let\pgfutil@unexpanded\normalunexpanded
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
index a21f3b4d633..07a7fb1a4bf 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
@@ -208,10 +208,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{protected}{%
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\protected
-}
+\let\pgfutil@protected\protected
+\let\pgfutil@unexpanded\unexpanded
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
index 58fa3eac5f8..2d08c5303fe 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
@@ -337,10 +337,7 @@
% e-TeX primitives
-\pgfutil@IfUndefined{protected}{
- \def\pgfutil@protected{}%
-}{%
- \let\pgfutil@protected\protected
-}
+\let\pgfutil@protected\protected
+\let\pgfutil@unexpanded\unexpanded
\endinput