[latex3-commits] [git/LaTeX3-latex3-latex3] l3bitset: initialize bitset to \c_zero-str (perhaps l3str-tests need adaption) (4d69ffe92)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Dec 17 12:18:02 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : l3bitset
Link       : https://github.com/latex3/latex3/commit/4d69ffe9280b5cc37fe322cf0922426bd9929741

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

commit 4d69ffe9280b5cc37fe322cf0922426bd9929741
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Dec 17 12:18:02 2020 +0100

    initialize bitset to \c_zero-str (perhaps l3str-tests need adaption)


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

4d69ffe9280b5cc37fe322cf0922426bd9929741
 l3kernel/l3bitset.dtx | 8 +++++---
 l3kernel/l3str.dtx    | 9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/l3kernel/l3bitset.dtx b/l3kernel/l3bitset.dtx
index f6b0cb21f..62e7ceda7 100644
--- a/l3kernel/l3bitset.dtx
+++ b/l3kernel/l3bitset.dtx
@@ -70,7 +70,7 @@
 %     \cs{bitset_new:N}  \meta{bitset var} \\
 %   \end{syntax}
 % Creates a new \meta{bitset var} or raises an error if the name is already taken.
-% The declaration is global. The \meta{bitset var} is initially empty.
+% The declaration is global. The \meta{bitset var} is initially 0.
 %
 %  Bitsets are implemented as string variables consisting of
 %  \texttt{1}'s and \texttt{0}'s.
@@ -136,7 +136,7 @@
 %   \end{syntax}
 % This leaves the current value of the bitset expressed as
 % a binary (string) number in the input stream.
-% If no bit has been set yet, the output is empty.
+% If no bit has been set yet, the output is zero.
 % \end{function}
 % \begin{function}[EXP,added = 2020-12-13]
 %   {\bitset_to_arabic:N, \bitset_to_arabic:c}
@@ -244,8 +244,10 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \bitset_new:N #1
   {
-    \str_new:N #1
+    \__kernel_chk_if_free_cs:N #1
+    \cs_gset_eq:NN #1 \c_zero_str
   }
+
 \cs_generate_variant:Nn \bitset_new:N {c}
 %    \end{macrocode}
 % \end{macro}
diff --git a/l3kernel/l3str.dtx b/l3kernel/l3str.dtx
index 3152e7dae..9f2ded7b2 100644
--- a/l3kernel/l3str.dtx
+++ b/l3kernel/l3str.dtx
@@ -815,7 +815,7 @@
 %
 % \section{Constant token lists}
 %
-% \begin{variable}[added = 2015-09-19]
+% \begin{variable}[added = 2015-09-19,updated=2020-12-17]
 %   {
 %     \c_ampersand_str,
 %     \c_atsign_str,
@@ -828,7 +828,8 @@
 %     \c_hash_str,
 %     \c_percent_str,
 %     \c_tilde_str,
-%     \c_underscore_str
+%     \c_underscore_str,
+%     \c_zero_str
 %   }
 %   Constant strings, containing a single character token, with category
 %   code $12$.
@@ -1943,7 +1944,8 @@
 %     \c_hash_str,
 %     \c_percent_str,
 %     \c_tilde_str,
-%     \c_underscore_str
+%     \c_underscore_str,
+%     \c_zero_str
 %   }
 %   For all of those strings, use \cs{cs_to_str:N} to get characters with
 %   the correct category code without worries
@@ -1960,6 +1962,7 @@
 \str_const:Nx \c_percent_str     { \cs_to_str:N \% }
 \str_const:Nx \c_tilde_str       { \cs_to_str:N \~ }
 \str_const:Nx \c_underscore_str  { \cs_to_str:N \_ }
+\str_const:Nx \c_zero_str        { 0 }
 %    \end{macrocode}
 % \end{variable}
 %





More information about the latex3-commits mailing list.