[latex3-commits] [git/LaTeX3-latex3-latex3] master: Avoid one expansion (9c4e50cda)
Joseph Wright
joseph.wright at morningstar2.co.uk
Mon Jun 1 16:32:16 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/9c4e50cda2e22926c9d5e88068f11028ea2dd8ab
>---------------------------------------------------------------
commit 9c4e50cda2e22926c9d5e88068f11028ea2dd8ab
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon Jun 1 15:32:16 2020 +0100
Avoid one expansion
This simplifies things for upcoming color changes.
>---------------------------------------------------------------
9c4e50cda2e22926c9d5e88068f11028ea2dd8ab
l3backend/l3backend-color.dtx | 40 ++++++++++++++++++++--------------------
l3kernel/l3color-base.dtx | 13 +------------
2 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 6323c3825..d4e0564de 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -110,17 +110,17 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_backend_cmyk:nnnn}
-% \begin{macro}{\@@_backend_gray:n}
-% \begin{macro}{\@@_backend_rgb:nnn}
-% \begin{macro}{\@@_backend_spot:nn}
+% \begin{macro}{\@@_backend_cmyk:w}
+% \begin{macro}{\@@_backend_gray:w}
+% \begin{macro}{\@@_backend_rgb:w}
+% \begin{macro}{\@@_backend_spot:w}
% \begin{macro}{\@@_backend_select:n, \@@_backend_select:x}
% \begin{macro}{\@@_backend_reset:}
% \begin{macro}{color.fc}
% Push the data to the stack. In the case of \texttt{dvips} also reset the
% drawing fill color in raw PostScript.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_cmyk:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_backend_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
{
\@@_backend_select:x
{
@@ -129,14 +129,14 @@
\fp_eval:n {#3} ~ \fp_eval:n {#4}
}
}
-\cs_new_protected:Npn \@@_backend_gray:n #1
+\cs_new_protected:Npn \@@_backend_gray:w #1 \s_@@_stop
{ \@@_backend_select:x { gray~ \fp_eval:n {#1} } }
-\cs_new_protected:Npn \@@_backend_rgb:nnn #1#2#3
+\cs_new_protected:Npn \@@_backend_rgb:w #1 ~ #2 ~ #3 \s_@@_stop
{
\@@_backend_select:x
{ rgb~ \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} }
}
-\cs_new_protected:Npn \@@_backend_spot:nn #1#2
+\cs_new_protected:Npn \@@_backend_spot:w #1 ~ #2 \s_@@_stop
{ \@@_backend_select:n { #1 } }
\cs_new_protected:Npn \@@_backend_select:n #1
{
@@ -226,35 +226,35 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_cmyk:nnnn, \@@_backend_cmyk_aux:nnnn}
-% \begin{macro}{\@@_backend_gray:n, \@@_backend_gray_aux:n}
-% \begin{macro}{\@@_backend_rgb:nnn, \@@_backend_rgb_aux:nnn}
-% \begin{macro}{\@@_backend_spot:nn}
+% \begin{macro}{\@@_backend_cmyk:w, \@@_backend_cmyk:nnnn}
+% \begin{macro}{\@@_backend_gray:w, \@@_backend_gray:n}
+% \begin{macro}{\@@_backend_rgb:w, \@@_backend_rgb:nnn}
+% \begin{macro}{\@@_backend_spot:w}
% \begin{macro}{\@@_backend_select:n, \@@_backend_select:x}
% \begin{macro}{\@@_backend_reset:}
% Simply dump the data, but allowing for \LuaTeX{}.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_cmyk:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_backend_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
{
\use:x
{
- \@@_backend_cmyk_aux:nnnn
+ \@@_backend_cmyk:nnnn
{ \fp_eval:n {#1} }
{ \fp_eval:n {#2} }
{ \fp_eval:n {#3} }
{ \fp_eval:n {#4} }
}
}
-\cs_new_protected:Npn \@@_backend_cmyk_aux:nnnn #1#2#3#4
+\cs_new_protected:Npn \@@_backend_cmyk:nnnn #1#2#3#4
{
\@@_backend_select:n
{ #1 ~ #2 ~ #3 ~ #4 ~ k ~ #1 ~ #2 ~ #3 ~ #4 ~ K }
}
+\cs_new_protected:Npn \@@_backend_gray:w #1 \s_@@_stop
+ { \exp_args:Nx \@@_backend_gray:n { \fp_eval:n {#1} } }
\cs_new_protected:Npn \@@_backend_gray:n #1
- { \exp_args:Nx \@@_backend_gray_aux:n { \fp_eval:n {#1} } }
-\cs_new_protected:Npn \@@_backend_gray_aux:n #1
{ \@@_backend_select:n { #1 ~ g ~ #1 ~ G } }
-\cs_new_protected:Npn \@@_backend_rgb:nnn #1#2#3
+\cs_new_protected:Npn \@@_backend_rgb:w #1~ #2 ~ #3 \s_@@_stop
{
\use:x
{
@@ -264,9 +264,9 @@
{ \fp_eval:n {#3} }
}
}
-\cs_new_protected:Npn \@@_backend_rgb_aux:nnn #1#2#3
+\cs_new_protected:Npn \@@_backend_rgb:nnn #1#2#3
{ \@@_backend_select:n { #1 ~ #2 ~ #3 ~ rg ~ #1 ~ #2 ~ #3 ~ RG } }
-\cs_new_protected:Npn \@@_backend_spot:nn #1#2
+\cs_new_protected:Npn \@@_backend_spot:w #1 ~ #2 \s_@@_stop
{ \@@_backend_select:n { /#1 ~ cs ~ /#1 ~ CS ~ #2 ~ sc ~ #2 ~ SC } }
\cs_new_protected:Npx \@@_backend_select:n #1
{
diff --git a/l3kernel/l3color-base.dtx b/l3kernel/l3color-base.dtx
index d44274517..67a586765 100644
--- a/l3kernel/l3color-base.dtx
+++ b/l3kernel/l3color-base.dtx
@@ -156,8 +156,6 @@
%
% \begin{macro}{\@@_select:n, \@@_select:V}
% \begin{macro}{\@@_select:w}
-% \begin{macro}
-% {\@@_select_cmyk:w, \@@_select_gray:w, \@@_select_rgb:w, \@@_select_spot:w}
% Take an internal color specification and pass it to the driver. This code
% is needed to ensure the current color but will also be used by the
% higher-level experimental material.
@@ -166,19 +164,10 @@
{ \@@_select:w #1 \s_@@_stop }
\cs_generate_variant:Nn \@@_select:n { V }
\cs_new_protected:Npn \@@_select:w #1 ~ #2 \s_@@_stop
- { \use:c { @@_select_ #1 :w } #2 \s_@@_stop }
-\cs_new_protected:Npn \@@_select_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
- { \@@_backend_cmyk:nnnn {#1} {#2} {#3} {#4} }
-\cs_new_protected:Npn \@@_select_gray:w #1 \s_@@_stop
- { \@@_backend_gray:n {#1} }
-\cs_new_protected:Npn \@@_select_rgb:w #1 ~ #2 ~ #3 \s_@@_stop
- { \@@_backend_rgb:nnn {#1} {#2} {#3} }
-\cs_new_protected:Npn \@@_select_spot:w #1 ~ #2 \s_@@_stop
- { \@@_backend_spot:nn {#1} {#2} }
+ { \use:c { @@_backend_ #1 :w } #2 \s_@@_stop }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{variable}{\l_@@_current_tl}
% As the setting data is used only
More information about the latex3-commits
mailing list.