From d043a18e288914d3c46a1b10af1f30ce2df00588 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 29 Sep 2020 03:02:54 +0000 Subject: CTAN sync 202009290302 --- graphics/pgf/base/tex/pgfkeys.code.tex | 41 ++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'graphics/pgf/base/tex/pgfkeys.code.tex') diff --git a/graphics/pgf/base/tex/pgfkeys.code.tex b/graphics/pgf/base/tex/pgfkeys.code.tex index 73922a0f09..e32745317c 100644 --- a/graphics/pgf/base/tex/pgfkeys.code.tex +++ b/graphics/pgf/base/tex/pgfkeys.code.tex @@ -1,4 +1,4 @@ -% Copyright 2007 by Till Tantau +% Copyright 2019 by Till Tantau % % This file may be distributed and/or modified % @@ -24,6 +24,8 @@ % works with all TeX formats and has no save-stack impact \def\pgfkeys@empty{} +\long\def\pgfkeys@firstoftwo#1#2{#1} +\long\def\pgfkeys@secondoftwo#1#2{#2} % This is useful: @@ -43,8 +45,6 @@ \csname @@end\expandafter\endcsname\expandafter\end% \fi -\expandafter\let\expandafter\pgfkeys@ifcsname\csname ifcsname\endcsname% - % Set a key to a value % % #1 = key @@ -178,7 +178,7 @@ % % \pgfkeysifdefined{/tikz/length}{key exists}{does not exist} -\long\def\pgfkeysifdefined#1#2#3{\pgfkeys@ifcsname pgfk@#1\endcsname#2\else#3\fi} +\long\def\pgfkeysifdefined#1#2#3{\ifcsname pgfk@#1\endcsname#2\else#3\fi} % Tests whether a key is assignable. For standard keys which just % store their value, this is identical to \pgfkeysifdefined. @@ -420,7 +420,7 @@ \def\pgfkeys@ifexecutehandler#1#2{#1}% \let\pgfkeys@ifexecutehandler@handleall=\pgfkeys@ifexecutehandler \def\pgfkeys@ifexecutehandler@handleonlyexisting#1#2{% - \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname% + \ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname% #1% ok, this particular key handler is known and should be processed in any case (for example .try) \else % implement the 'only existing' feature here: @@ -431,7 +431,7 @@ }% \def\pgfkeys@ifexecutehandler@handlefullorexisting#1#2{% \ifpgfkeysaddeddefaultpath - \pgfkeys@ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname% + \ifcsname pgfk@excpt@\pgfkeyscurrentname\endcsname% #1% ok, this particular key handler is known and be processed in any case (for example .try) \else % implement the 'only existing' feature here: @@ -719,7 +719,11 @@ % (with expansion of '#1'): \edef\pgfkeys@tempargs{\noexpand\pgfkeysvalueof{#1/.@@body}}% \def\pgfkeys@temp{\pgfkeysdef{#1}}% - \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}% + \ifnum#2=1\relax + \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs{##1}}% + \else + \expandafter\pgfkeys@temp\expandafter{\pgfkeys@tempargs##1}% + \fi #5{#1/.@body}{#3}% } @@ -795,7 +799,11 @@ % Defining a value -\pgfkeys{/handlers/.initial/.code=\pgfkeyssetvalue{\pgfkeyscurrentpath}{#1}} +\pgfkeys{/handlers/.initial/.code=% + \pgfkeyslet{\pgfkeyscurrentpath/.@cmd}\undefined + \pgfkeyslet{\pgfkeyscurrentpath/.@args}\undefined + \pgfkeyssetvalue{\pgfkeyscurrentpath}{#1}% +} \pgfkeys{/handlers/.add/.code 2 args=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{#2}} \pgfkeys{/handlers/.prefix/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{#1}{}} \pgfkeys{/handlers/.append/.code=\pgfkeysaddvalue{\pgfkeyscurrentpath}{}{#1}} @@ -828,7 +836,7 @@ }% } \def\pgfkeys@handle@boolean#1#2{% - \pgfkeys@ifcsname#1#2\endcsname% + \ifcsname#1#2\endcsname% \csname#1#2\endcsname% \else% \def\pgf@marshal{\pgfkeysvalueof{/errors/boolean expected/.@cmd}}% @@ -895,10 +903,17 @@ \pgfkeys@searchalso@parse#1,\pgfkeys@mainstop {% \toks0=\expandafter{\pgfkeys@global@temp##1\pgfeov}% - \toks1={\pgfkeysalso{/handlers/.unknown/.@cmd/.expand once=\pgfkeys@searchalso@temp@value}}% + \toks1={% + \pgfkeysgetvalue{/handlers/.unknown/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeys@searchalso@temp@value\pgfeov + }% \xdef\pgfkeys@global@temp{% \noexpand\def\noexpand\pgfkeys@searchalso@temp@value{####1}% \noexpand\ifpgfkeysaddeddefaultpath + \noexpand\expandafter\noexpand\pgfkeys@firstoftwo + \noexpand\else + \noexpand\expandafter\noexpand\pgfkeys@secondoftwo + \noexpand\fi{% \noexpand\pgfkeyssuccessfalse \noexpand\let\noexpand\pgfkeys@searchalso@name=\noexpand\pgfkeyscurrentkeyRAW \the\toks0 % one or more /.try things; one for each path. The last element won't have a /.try @@ -906,9 +921,9 @@ %\noexpand\else % \the\toks1 % invoke /handlers/.unknown handler %\noexpand\fi - \noexpand\else + }{% \the\toks1 % invoke /handlers/.unknown handler - \noexpand\fi + }% }% \expandafter\gdef\expandafter\pgfkeys@global@temp\expandafter##\expandafter1\expandafter\pgfeov\expandafter{\pgfkeys@global@temp}% }% @@ -952,7 +967,6 @@ % Value expansion \pgfkeys{/handlers/.expand once/.code=\expandafter\pgfkeys@exp@call\expandafter{#1}} -\pgfkeys{/handlers/.expand two once/.code 2 args=\expandafter\expandafter\expandafter\pgfkeys@exp@call\expandafter\expandafter\expandafter{\expandafter#1\expandafter}\expandafter{#2}} \pgfkeys{/handlers/.expand twice/.code=\expandafter\expandafter\expandafter\pgfkeys@exp@call\expandafter\expandafter\expandafter{#1}} \pgfkeys{/handlers/.expanded/.code=\edef\pgfkeys@temp{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfkeys@temp}} @@ -1101,7 +1115,6 @@ \pgfkeysaddhandleonlyexistingexception{.lastretry}% \pgfkeysaddhandleonlyexistingexception{.unknown}% \pgfkeysaddhandleonlyexistingexception{.expand once}% -\pgfkeysaddhandleonlyexistingexception{.expand two once}% \pgfkeysaddhandleonlyexistingexception{.expand twice}% \pgfkeysaddhandleonlyexistingexception{.expanded}% -- cgit v1.2.3