[latex3-commits] [git/LaTeX3-latex3-latex3] l3bitset: add clear function (d1ebb853d)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Dec 22 15:48:03 CET 2020


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

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

commit d1ebb853dc6162ecf60fb9128ff945437437d9d0
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Dec 22 15:48:03 2020 +0100

    add clear function


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

d1ebb853dc6162ecf60fb9128ff945437437d9d0
 l3kernel/l3bitset.dtx              | 27 +++++++++++++++++++++++++++
 l3kernel/testfiles/m3bitset001.lvt | 13 +++++++++++++
 l3kernel/testfiles/m3bitset001.tlg | 14 ++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/l3kernel/l3bitset.dtx b/l3kernel/l3bitset.dtx
index e096fcb68..a364cf966 100644
--- a/l3kernel/l3bitset.dtx
+++ b/l3kernel/l3bitset.dtx
@@ -120,6 +120,15 @@
 % zeros are not trimmed but stay in the bit vector.
 % \end{function}
 %
+% \begin{function}[added = 2020-12-22]
+%   {\bitset_clear:N,\bitset_clear:c,\bitset_gclear:N,\bitset_gclear:c}
+%   \begin{syntax}
+%     \cs{bitset_clear:N}  \meta{bitset var} \\
+%     \cs{bitset_gclear:N}  \meta{bitset var}
+%   \end{syntax}
+% This resets the bitset to the initial state.
+% \end{function}
+%
 % \section{Using bitsets}
 %
 % \begin{function}[EXP,added = 2020-12-14]
@@ -387,6 +396,24 @@
 %  \end{macro}
 % \begin{macro}
 %   {
+%     \bitset_clear:N,  \bitset_clear:c,
+%     \bitset_gclear:N, \bitset_gclear:c
+%   }
+%    \begin{macrocode}
+\cs_new_protected:Npn \bitset_clear:N #1
+  {
+    \str_set_eq:NN #1 \c_zero_str
+  }
+\cs_new_protected:Npn \bitset_gclear:N #1
+  {
+    \str_gset_eq:NN #1 \c_zero_str
+  }
+\cs_generate_variant:Nn \bitset_clear:N {c}
+\cs_generate_variant:Nn \bitset_gclear:N {c}
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}
+%   {
 %     \bitset_to_arabic:N, \bitset_to_arabic:c,
 %     \bitset_to_bin:N,    \bitset_to_bin:c,
 %   }
diff --git a/l3kernel/testfiles/m3bitset001.lvt b/l3kernel/testfiles/m3bitset001.lvt
index e2a195f58..674a92a00 100644
--- a/l3kernel/testfiles/m3bitset001.lvt
+++ b/l3kernel/testfiles/m3bitset001.lvt
@@ -248,4 +248,17 @@
      }
  }
 
+\OMIT
+\bitset_clear:N \l_my_test_bitset
+\bitset_gclear:N \g_my_test_bitset
+\TIMO 
+
+\TEST {clear}
+  {
+     \bitset_show:N \l_my_test_bitset
+     \NEWLINE
+     \bitset_show:N \g_my_test_bitset
+  }
+
+
 \END
diff --git a/l3kernel/testfiles/m3bitset001.tlg b/l3kernel/testfiles/m3bitset001.tlg
index 9afb391c5..245033968 100644
--- a/l3kernel/testfiles/m3bitset001.tlg
+++ b/l3kernel/testfiles/m3bitset001.tlg
@@ -376,3 +376,17 @@ The bitset \l_my_testb_bitset has the representation:
 <recently read> }
 l. ... }
 ============================================================
+============================================================
+TEST 25: clear
+============================================================
+The bitset \l_my_test_bitset has the representation:
+> binary: 0
+> arabic: 0.
+<recently read> }
+l. ...  }
+The bitset \g_my_test_bitset has the representation:
+> binary: 0
+> arabic: 0.
+<recently read> }
+l. ...  }
+============================================================





More information about the latex3-commits mailing list.