From 17352e275241d9c7b0b3b1fe255a89ca3e23a7c8 Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Wed, 15 Dec 2021 21:39:20 +0100 Subject: [PATCH 1/2] refactor: Simplify loading by delegating to top-level files Signed-off-by: Henri Menke --- tex/generic/pgf/basiclayer/pgfcore.code.tex | 10 ++++++++-- tex/generic/pgf/basiclayer/pgfcoreimage.code.tex | 2 -- tex/generic/pgf/math/pgfmath.code.tex | 11 +++++++++++ tex/generic/pgf/math/pgfmathcalc.code.tex | 5 ----- tex/generic/pgf/math/pgfmathfunctions.code.tex | 11 ----------- tex/generic/pgf/systemlayer/pgfsys.code.tex | 4 +++- tex/generic/pgf/utilities/pgfcalendar.code.tex | 4 +++- tex/generic/pgf/utilities/pgffor.code.tex | 4 +++- 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/tex/generic/pgf/basiclayer/pgfcore.code.tex b/tex/generic/pgf/basiclayer/pgfcore.code.tex index c751bf905..5f41348a2 100644 --- a/tex/generic/pgf/basiclayer/pgfcore.code.tex +++ b/tex/generic/pgf/basiclayer/pgfcore.code.tex @@ -12,8 +12,13 @@ \newif\ifpgf@draftmode \def\pgf@typeout{\immediate\write0} -\input pgfmath.code.tex -\input pgfint.code.tex +\ifdefined\pgfmathloaded\else + \input pgfmath.code.tex +\fi + +\ifdefined\pgfintloaded\else + \input pgfint.code.tex +\fi \input pgfcorepoints.code.tex \input pgfcorepathconstruct.code.tex @@ -27,6 +32,7 @@ \input pgfcorearrows.code.tex \input pgfcoreshade.code.tex \input pgfcoreimage.code.tex +\input pgfcoreexternal.code.tex \input pgfcorelayers.code.tex \input pgfcoretransparency.code.tex \input pgfcorepatterns.code.tex diff --git a/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex b/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex index 597561a00..fd1c0c48d 100644 --- a/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex +++ b/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex @@ -239,6 +239,4 @@ \pgfuseimage{pgflastimage}} -\input pgfcoreexternal.code.tex - \endinput diff --git a/tex/generic/pgf/math/pgfmath.code.tex b/tex/generic/pgf/math/pgfmath.code.tex index 7bfdf58a6..fd40a36d5 100644 --- a/tex/generic/pgf/math/pgfmath.code.tex +++ b/tex/generic/pgf/math/pgfmath.code.tex @@ -20,6 +20,17 @@ \input pgfkeys.code.tex \fi +\input pgfmathutil.code.tex +\input pgfmathparser.code.tex +\input pgfmathfunctions.code.tex +\input pgfmathfunctions.basic.code.tex +\input pgfmathfunctions.trigonometric.code.tex +\input pgfmathfunctions.random.code.tex +\input pgfmathfunctions.comparison.code.tex +\input pgfmathfunctions.base.code.tex +\input pgfmathfunctions.round.code.tex +\input pgfmathfunctions.misc.code.tex +\input pgfmathfunctions.integerarithmetics.code.tex \input pgfmathcalc.code.tex \input pgfmathfloat.code.tex diff --git a/tex/generic/pgf/math/pgfmathcalc.code.tex b/tex/generic/pgf/math/pgfmathcalc.code.tex index bb4d1022e..1e854864d 100755 --- a/tex/generic/pgf/math/pgfmathcalc.code.tex +++ b/tex/generic/pgf/math/pgfmathcalc.code.tex @@ -11,11 +11,6 @@ % % Version 1.414213 29/9/2007 -\input pgfmathutil.code.tex -\input pgfmathparser.code.tex -\input pgfmathfunctions.code.tex -%\input pgfmathbase.code.tex - % \pgfmathsetlength, \pgfmathaddtolength % % #1 = dimension register diff --git a/tex/generic/pgf/math/pgfmathfunctions.code.tex b/tex/generic/pgf/math/pgfmathfunctions.code.tex index 417ede069..6e5d079c6 100644 --- a/tex/generic/pgf/math/pgfmathfunctions.code.tex +++ b/tex/generic/pgf/math/pgfmathfunctions.code.tex @@ -262,17 +262,6 @@ \pgfmathredeclarefunction{#1}{#2}% }% -\input pgfmathfunctions.basic.code.tex -\input pgfmathfunctions.trigonometric.code.tex -\input pgfmathfunctions.random.code.tex -\input pgfmathfunctions.comparison.code.tex -\input pgfmathfunctions.base.code.tex -\input pgfmathfunctions.round.code.tex -\input pgfmathfunctions.misc.code.tex -\input pgfmathfunctions.integerarithmetics.code.tex - - - % Local Variables: % tab-width: 2 % End: diff --git a/tex/generic/pgf/systemlayer/pgfsys.code.tex b/tex/generic/pgf/systemlayer/pgfsys.code.tex index 250db69b4..a67329729 100644 --- a/tex/generic/pgf/systemlayer/pgfsys.code.tex +++ b/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -11,7 +11,9 @@ % Load key mechanism -\input pgfkeys.code.tex +\ifdefined\pgfkeysloaded\else + \input pgfkeys.code.tex +\fi % "pgf" is a family \pgfkeys{/pgf/.is family} diff --git a/tex/generic/pgf/utilities/pgfcalendar.code.tex b/tex/generic/pgf/utilities/pgfcalendar.code.tex index d473ed95b..0b02457d1 100644 --- a/tex/generic/pgf/utilities/pgfcalendar.code.tex +++ b/tex/generic/pgf/utilities/pgfcalendar.code.tex @@ -9,7 +9,9 @@ \ProvidesFileRCS{pgfcalendar.code.tex} -\input pgfint.code.tex +\ifdefined\pgfintloaded\else + \input pgfint.code.tex +\fi % Translation stuff diff --git a/tex/generic/pgf/utilities/pgffor.code.tex b/tex/generic/pgf/utilities/pgffor.code.tex index 65b62b8cf..f81a61c9e 100644 --- a/tex/generic/pgf/utilities/pgffor.code.tex +++ b/tex/generic/pgf/utilities/pgffor.code.tex @@ -10,7 +10,9 @@ \ProvidesPackageRCS{pgffor.code.tex} % pgfmath is needed -\input pgfmath.code.tex +\ifdefined\pgfmathloaded\else + \input pgfmath.code.tex +\fi \newdimen\pgffor@iter \newdimen\pgffor@skip From 5d099a8399436f46fba0ea464b54c301b1656abe Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Wed, 15 Dec 2021 21:40:48 +0100 Subject: [PATCH 2/2] refactor(pgfcore): replace nested \protect by \protected\def Signed-off-by: Henri Menke --- tex/generic/pgf/basiclayer/pgfcore.code.tex | 3 --- tex/generic/pgf/math/pgfmathfloat.code.tex | 7 +------ tex/latex/pgf/basiclayer/pgfcore.sty | 2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/tex/generic/pgf/basiclayer/pgfcore.code.tex b/tex/generic/pgf/basiclayer/pgfcore.code.tex index 5f41348a2..b7e47f4ee 100644 --- a/tex/generic/pgf/basiclayer/pgfcore.code.tex +++ b/tex/generic/pgf/basiclayer/pgfcore.code.tex @@ -38,7 +38,4 @@ \input pgfcorepatterns.code.tex \input pgfcorerdf.code.tex -\pgfutil@ifundefined{pgf@texdist@protect}{% - \def\pgf@texdist@protect{}% -}{} \endinput diff --git a/tex/generic/pgf/math/pgfmathfloat.code.tex b/tex/generic/pgf/math/pgfmathfloat.code.tex index e520a98eb..f133c6d49 100644 --- a/tex/generic/pgf/math/pgfmathfloat.code.tex +++ b/tex/generic/pgf/math/pgfmathfloat.code.tex @@ -1637,12 +1637,7 @@ % variables in /pgf/number format). % % You may specify optional arguments with \pgfmathprintnumber[...]. -\def\pgfmathprintnumber{% - % \protect allows to supply \pgfmathprintnumber inside of latex - % captions. The \csname yields \relax in case protect is undefined. - \pgf@texdist@protect\pgfmathprintnumber@protected -}% -\def\pgfmathprintnumber@protected{% +\pgfutil@protected\def\pgfmathprintnumber{% \pgfutil@ifnextchar[% {\pgfmathprintnumber@OPT}% {\pgfmathprintnumber@noopt}% diff --git a/tex/latex/pgf/basiclayer/pgfcore.sty b/tex/latex/pgf/basiclayer/pgfcore.sty index e50a3cec5..02c5e696e 100644 --- a/tex/latex/pgf/basiclayer/pgfcore.sty +++ b/tex/latex/pgf/basiclayer/pgfcore.sty @@ -12,8 +12,6 @@ \RequirePackage{keyval} \RequirePackage{xcolor} -\def\pgf@texdist@protect{\protect}% - \input{pgfcore.code.tex} \endinput