summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/utilities
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-12-19 22:11:59 +0000
committerKarl Berry <karl@freefriends.org>2019-12-19 22:11:59 +0000
commit8876a8021514f190d676e4e5261f1084a66754d3 (patch)
tree9a496107a312a1acbbdb06ea0e1657c285109729 /Master/texmf-dist/tex/generic/pgf/utilities
parent693eacf895c01285e2992460bb489142ead8ae8a (diff)
pgf (19dec19)
git-svn-id: svn://tug.org/texlive/trunk@53187 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/pgfkeys.code.tex20
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex53
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def9
-rw-r--r--Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def9
4 files changed, 73 insertions, 18 deletions
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 2f17652628a..73922a0f097 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
@@ -74,9 +74,9 @@
}
\long\def\pgfkeyssetevalue#1#2{%
- \pgfkeys@temptoks={#2}%
- \pgfkeys@temptoks=\scantokens\expandafter{\expandafter{\the\pgfkeys@temptoks}}%
- \expandafter\edef\csname pgfk@#1\expandafter\endcsname\expandafter{\the\pgfkeys@temptoks}%
+ \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}%
}
% Add text to a key at the end
@@ -401,11 +401,11 @@
% - path := '/my search path'
% - name := 'key/.code'
% - key = '/my search path/key/.code'
- \let\pgfkeys@temp=\pgfkeyscurrentkey
+ \let\pgfkeys@tempa=\pgfkeyscurrentkey
\let\pgfkeys@tempb=\pgfkeyscurrentname
\edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}%
\pgfkeys@split@path%
- \let\pgfkeyscurrentkey=\pgfkeys@temp
+ \let\pgfkeyscurrentkey=\pgfkeys@tempa
\edef\pgfkeyscurrentname{\pgfkeyscurrentname/\pgfkeys@tempb}%
\pgfkeys@unknown
}%
@@ -958,6 +958,16 @@
\long\def\pgfkeys@exp@call#1{\pgfkeysalso{\pgfkeyscurrentpath={#1}}}
+\def\pgfkeys@mathparse{%
+ \ifcsname pgfmathparse\endcsname
+ \expandafter\pgfmathparse
+ \else
+ \pgfkeys@error{You have to load `pgfmath' to use \string\pgfmathparse}%
+ \expandafter\def\expandafter\pgfmathresult
+ \fi
+}
+\pgfkeys{/handlers/.evaluated/.code=\pgfkeys@mathparse{#1}\expandafter\pgfkeys@exp@call\expandafter{\pgfmathresult}}
+
% Try to set a key and do nothing if not define
\newif\ifpgfkeyssuccess
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 6fbaf2687ba..b1c0546c17e 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
@@ -59,20 +59,16 @@
\fi}
% A variant of \pgfutil@ifundefined which will NOT let #1 to \relax it
-% is undefined. However, this macro is not expandable.
+% is undefined.
\def\pgfutil@IfUndefined#1{%
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname#1\endcsname\relax
- \expandafter\pgfutil@firstoftwo
- \else
+ \ifcsname#1\endcsname
\expandafter\pgfutil@secondoftwo
+ \else
+ \expandafter\pgfutil@firstoftwo
\fi
}
\long\def\pgfutil@firstofone#1{#1}
\long\def\pgfutil@firstoftwo#1#2{#1}
-\long\def\pgfutil@letfirst#1#2{\pgfutil@letfirst@#1#2\pgfutil@letfirst@end}
-\long\def\pgfutil@letfirst@#1#2#3\pgfutil@letfirst@end{\let#1=#2}
-\def\pgfutil@letfirst@end{}
\long\def\pgfutil@secondoftwo#1#2{#2}
\def\pgfutil@empty{}
\long\def\pgfutil@gobble@until@relax#1\relax{}
@@ -215,6 +211,45 @@
\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable
+% \pgfutil@switch
+%
+% #1: string to switch on
+% #2: sequence of label-value pairs
+%
+% 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
+}
+
+\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
+}
+
+
% aux-read-hook
\let\pgfutil@aux@read@hook=\relax
@@ -709,7 +744,7 @@
\let\pgfmathresult=\pgfutil@empty
\else
% xb := rb / bb (the modified rb and modified bb!)
- \edef\pgf@marshal{
+ \edef\pgf@marshal{%
\noexpand\pgfmathfloatdivide@
{\csname r\Pb\endcsname}
{\csname m\Pb b\endcsname}%
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 bf7e43a298c..7d244efc5fa 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def
@@ -167,11 +167,12 @@
\def\pgfutil@minipage[#1]#2{%
\hbox to#2\bgroup
\hsize=#2\relax
- \vbox\bgroup\leavevmode
+ \vbox\bgroup
+ \noindentation
}
\def\pgfutil@endminipage{%
- \egroup
+ \egroup
\egroup
}
@@ -225,7 +226,7 @@
\doifmodeelse {mkiv} {
- \def\pgfsysdriver{pgfsys-pdftex.def}
+ \def\pgfutil@guessdriver{\def\pgfsysdriver{pgfsys-luatex.def}}
\def\pgfutil@driver@if@in#1#2{%
\edef\pgf@marshal{\noexpand\pgfutil@in@{#1}{\preloadedspecials}}%
@@ -358,7 +359,7 @@
\appendtoks \the\pgfutil@everybye \to \everybye
-\long\def\AtBeginDocument#1{#1}%
+\long\def\AtBeginDocument#1{\appendtoks#1\to\everystarttext}%
% pgfcalendar uses translations
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 090fcaeb5ae..95dacd18a46 100644
--- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
+++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def
@@ -26,6 +26,15 @@
\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}}
\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}}
+\def\pgfutil@emu@RGB#1#2,#3,#4\@nil{%
+ \begingroup
+ \pgfmathdivide@{#2}{255}\let\pgfutil@emu@RGB@r\pgfmathresult
+ \pgfmathdivide@{#3}{255}\let\pgfutil@emu@RGB@g\pgfmathresult
+ \pgfmathdivide@{#4}{255}\let\pgfutil@emu@RGB@b\pgfmathresult
+ \edef\pgf@marshal{\def\expandafter\noexpand\csname\string\color@#1\endcsname{%
+ \noexpand\xcolor@{}{}{rgb}{\pgfutil@emu@RGB@r,\pgfutil@emu@RGB@g,\pgfutil@emu@RGB@b}}}%
+ \expandafter\endgroup\pgf@marshal
+}
\pgfutil@definecolor{white}{gray}{1}
\pgfutil@definecolor{black}{gray}{0}