[latex3-commits] [git/LaTeX3-latex3-latex3] main: Correct treatment of \EvaluateNow in xtemplate (db68a09be)

Bruno Le Floch blflatex at gmail.com
Tue Nov 2 13:32:58 CET 2021


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/db68a09be9dd7ba89b4f614260db57804b27d44f

>---------------------------------------------------------------

commit db68a09be9dd7ba89b4f614260db57804b27d44f
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Tue Nov 2 13:32:58 2021 +0100

    Correct treatment of \EvaluateNow in xtemplate
    
    Previously, \EvaluateNow only applied to numeric quantities (except
    floating points), now also to tokenlist and commalist.  This makes it
    possible to obtain -NoValue- as a default value using
    \EvaluateNow{\c_novalue_tl}.


>---------------------------------------------------------------

db68a09be9dd7ba89b4f614260db57804b27d44f
 l3packages/xtemplate/xtemplate.dtx | 107 +++++++++++--------------------------
 1 file changed, 31 insertions(+), 76 deletions(-)

diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index 75338d797..e48661dc7 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -1446,95 +1446,50 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_store_value_code:n}
-% \begin{macro}{\@@_store_value_choice:n}
-% \begin{macro}{\@@_store_value_commalist:n}
-% \begin{macro}{\@@_store_value_function:n}
-% \begin{macro}{\@@_store_value_instance:n}
-% \begin{macro}{\@@_store_value_real:n}
-% \begin{macro}{\@@_store_value_tokenlist:n}
+% \begin{macro}{\@@_store_value_code:n, \@@_store_value_choice:n,
+%   \@@_store_value_function:n, \@@_store_value_instance:n}
 %   With no need to worry about delayed evaluation, these keytypes all
 %   just store the input directly.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_store_value_code:n #1
   { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1} }
 \cs_new_eq:NN \@@_store_value_choice:n    \@@_store_value_code:n
-\cs_new_eq:NN \@@_store_value_commalist:n \@@_store_value_code:n
 \cs_new_eq:NN \@@_store_value_function:n  \@@_store_value_code:n
 \cs_new_eq:NN \@@_store_value_instance:n  \@@_store_value_code:n
-\cs_new_eq:NN \@@_store_value_real:n      \@@_store_value_code:n
-\cs_new_eq:NN \@@_store_value_tokenlist:n \@@_store_value_code:n
 %    \end{macrocode}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
-% \begin{macro}{\@@_store_value_integer:n}
-% \begin{macro}{\@@_store_value_length:n}
-% \begin{macro}{\@@_store_value_muskip:n}
-% \begin{macro}{\@@_store_value_skip:n}
-%   Storing the value of a number is in all cases more or less the same.
-%   If evaluation is taking place now, assignment is made to a scratch
-%   variable, and this result is then stored. On the other hand, if
-%   evaluation is delayed the current data is simply stored \enquote{as is}.
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_store_value_integer:n #1
-  {
-    \@@_if_eval_now:nTF {#1}
-      {
-        \int_set:Nn \l_@@_tmp_int {#1}
-        \prop_put:NVV \l_@@_values_prop \l_@@_key_name_int
-          \l_@@_tmp_int
-      }
-      {
-        \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1}
-      }
-  }
-\cs_new_protected:Npn \@@_store_value_length:n #1
-  {
-    \@@_if_eval_now:nTF {#1}
-      {
-        \dim_set:Nn \l_@@_tmp_dim {#1}
-        \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl
-          \l_@@_tmp_dim
-      }
-      {
-        \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1}
-      }
-  }
-\cs_new_protected:Npn \@@_store_value_muskip:n #1
-  {
-    \@@_if_eval_now:nTF {#1}
-      {
-        \muskip_set:Nn \l_@@_tmp_muskip {#1}
-        \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl
-          \l_@@_tmp_muskip
-      }
-      {
-        \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1}
-      }
-  }
-\cs_new_protected:Npn \@@_store_value_skip:n #1
-  {
-    \@@_if_eval_now:nTF {#1}
-      {
-        \skip_set:Nn \l_@@_tmp_skip {#1}
-        \prop_put:NVV \l_@@_values_prop \l_@@_key_name_tl
-          \l_@@_tmp_skip
-      }
-      {
-        \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#1}
-      }
-  }
+% \begin{macro}{\@@_store_value_aux:Nn, \@@_store_value_integer:n,
+%   \@@_store_value_length:n, \@@_store_value_muskip:n,
+%   \@@_store_value_real:n, \@@_store_value_skip:n,
+%   \@@_store_value_tokenlist:n, \@@_store_value_commalist:n}
+%   Storing values in \cs{l_@@_values_prop} is in most cases the same.
+%   If evaluation is taking place now, one \texttt{x}-expands an
+%   evaluation function and the result is then stored. On the other
+%   hand, if evaluation is delayed the current data is simply stored
+%   \enquote{as is}.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_store_value_aux:Nn #1#2
+  {
+    \@@_if_eval_now:nTF {#2}
+      { \prop_put:NVx \l_@@_values_prop \l_@@_key_name_tl { #1 {#2} } }
+      { \prop_put:Non \l_@@_values_prop \l_@@_key_name_tl {#2} }
+  }
+\cs_new_protected:Npn \@@_store_value_integer:n
+  { \@@_store_value_aux:Nn \int_eval:n }
+\cs_new_protected:Npn \@@_store_value_length:n
+  { \@@_store_value_aux:Nn \dim_eval:n }
+\cs_new_protected:Npn \@@_store_value_muskip:n
+  { \@@_store_value_aux:Nn \muskip_eval:n }
+\cs_new_protected:Npn \@@_store_value_real:n
+  { \@@_store_value_aux:Nn \fp_eval:n }
+\cs_new_protected:Npn \@@_store_value_skip:n
+  { \@@_store_value_aux:Nn \skip_eval:n }
+\cs_new_protected:Npn \@@_store_value_tokenlist:n
+  { \@@_store_value_aux:Nn \use:n }
+\cs_new_eq:NN \@@_store_value_commalist:n \@@_store_value_tokenlist:n
 %    \end{macrocode}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \subsection{Implementation part of template declaration}
 %





More information about the latex3-commits mailing list.