[latex3-commits] [l3svn] r6916 - In l3flag, rename clear to zero and height to use

noreply at latex-project.org noreply at latex-project.org
Tue Feb 14 00:07:49 CET 2017


Author: bruno
Date: 2017-02-14 00:07:49 +0100 (Tue, 14 Feb 2017)
New Revision: 6916

Modified:
   trunk/l3experimental/l3str/l3flag.dtx
   trunk/l3experimental/l3str/l3regex.dtx
   trunk/l3experimental/l3str/l3str-convert.dtx
   trunk/l3experimental/l3str/testfiles/m3flag001.lvt
   trunk/l3experimental/l3str/testfiles/m3flag001.tlg
Log:
In l3flag, rename clear to zero and height to use

There remains the question of whether \flag_raise:n should be
\flag_incr:n despite being expandable, and how to name
\flag_if_raise:nTF in that case.  See #336.


Modified: trunk/l3experimental/l3str/l3flag.dtx
===================================================================
--- trunk/l3experimental/l3str/l3flag.dtx	2017-02-13 22:50:20 UTC (rev 6915)
+++ trunk/l3experimental/l3str/l3flag.dtx	2017-02-13 23:07:49 UTC (rev 6916)
@@ -98,16 +98,16 @@
 %   local variables. The \meta{flag} will initially have zero height.
 % \end{function}
 %
-% \begin{function}{\flag_clear:n}
+% \begin{function}{\flag_zero:n}
 %   \begin{syntax}
-%     \cs{flag_clear:n} \Arg{flag name}
+%     \cs{flag_zero:n} \Arg{flag name}
 %   \end{syntax}
 %   The \meta{flag}'s height is set to zero. The assignment is local.
 % \end{function}
 %
-% \begin{function}{\flag_clear_new:n}
+% \begin{function}{\flag_zero_new:n}
 %   \begin{syntax}
-%     \cs{flag_clear_new:n} \Arg{flag name}
+%     \cs{flag_zero_new:n} \Arg{flag name}
 %   \end{syntax}
 %   Ensures that the \meta{flag} exists globally by applying
 %   \cs{flag_new:n} if necessary, then applies \cs{flag_zero:n}, setting
@@ -147,9 +147,9 @@
 %   height, and \texttt{false} if the \meta{flag} has zero height.
 % \end{function}
 %
-% \begin{function}[EXP]{\flag_height:n}
+% \begin{function}[EXP]{\flag_use:n}
 %   \begin{syntax}
-%     \cs{flag_height:n} \Arg{flag name}
+%     \cs{flag_use:n} \Arg{flag name}
 %   \end{syntax}
 %   Expands to the height of the \meta{flag} as an integer denotation.
 % \end{function}
@@ -202,22 +202,22 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\flag_clear:n}
-% \begin{macro}[aux]{\@@_clear:ww}
+% \begin{macro}{\flag_zero:n}
+% \begin{macro}[aux]{\@@_zero:ww}
 %   Undefine control sequences, starting from the |0| flag, upwards,
 %   until reaching an undefined control sequence.  We don't use
 %   \cs{cs_undefine:N} because that would act globally.
 %    \begin{macrocode}
-\cs_new_protected:Npn \flag_clear:n #1
-  { \@@_clear:ww 0 ; #1 \q_stop }
-\cs_new_protected:Npn \@@_clear:ww #1 ; #2 \q_stop
+\cs_new_protected:Npn \flag_zero:n #1
+  { \@@_zero:ww 0 ; #1 \q_stop }
+\cs_new_protected:Npn \@@_zero:ww #1 ; #2 \q_stop
   {
     \if_cs_exist:w flag~#2~#1 \cs_end:
     \else:
       \exp_after:wN \use_none_delimit_by_q_stop:w
     \fi:
     \cs_set_eq:cN { flag~#2~#1 } \tex_undefined:D
-    \exp_after:wN \@@_clear:ww
+    \exp_after:wN \@@_zero:ww
     \__int_value:w \__int_eval:w \c_one + #1 ;
     #2 \q_stop
   }
@@ -225,12 +225,12 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\flag_clear_new:n}
-%   As for other datatypes, clear the \meta{flag} or create a new one,
+% \begin{macro}{\flag_zero_new:n}
+%   As for other datatypes, zero the \meta{flag} or create a new one,
 %   as appropriate.
 %    \begin{macrocode}
-\cs_new_protected:Npn \flag_clear_new:n #1
-  { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} }
+\cs_new_protected:Npn \flag_zero_new:n #1
+  { \flag_if_exist:nTF {#1} { \flag_zero:n } { \flag_new:n } {#1} }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -241,7 +241,7 @@
 \cs_new_protected:Npn \flag_show:n #1
   {
     \exp_args:Nc \__msg_show_variable:NNNnn { flag~#1 } \cs_if_exist:NTF ? { }
-      { > ~ flag ~ #1 ~ height = \flag_height:n {#1} }
+      { > ~ flag ~ #1 ~ height = \flag_use:n {#1} }
   }
 \cs_new_protected:Npn \flag_log:n
   { \__msg_log_next: \flag_show:n }
@@ -276,12 +276,12 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\flag_height:n}
+% \begin{macro}[EXP]{\flag_use:n}
 % \begin{macro}[EXP, aux]{\@@_height_loop:ww, \@@_height_end:ww}
 %   Extract the value of the flag by going through all of the
 %   control sequences starting from |0|.
 %    \begin{macrocode}
-\cs_new:Npn \flag_height:n #1 { \@@_height_loop:ww 0; #1 \q_stop }
+\cs_new:Npn \flag_use:n #1 { \@@_height_loop:ww 0; #1 \q_stop }
 \cs_new:Npn \@@_height_loop:ww #1 ; #2 \q_stop
   {
     \if_cs_exist:w flag~#2~#1 \cs_end:
@@ -302,7 +302,7 @@
 \cs_new:Npn \flag_raise:n #1
   {
     \cs:w flag~#1 \exp_after:wN \cs_end:
-    \__int_value:w \flag_height:n {#1} ;
+    \__int_value:w \flag_use:n {#1} ;
   }
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/l3experimental/l3str/l3regex.dtx
===================================================================
--- trunk/l3experimental/l3str/l3regex.dtx	2017-02-13 22:50:20 UTC (rev 6915)
+++ trunk/l3experimental/l3str/l3regex.dtx	2017-02-13 23:07:49 UTC (rev 6916)
@@ -5484,8 +5484,8 @@
 \cs_new_protected:Npn \@@_group_end_extract_seq:N #1
   {
       \cs_set_eq:NN \__seq_item:n \scan_stop:
-      \flag_clear:n { @@_begin }
-      \flag_clear:n { @@_end }
+      \flag_zero:n { @@_begin }
+      \flag_zero:n { @@_end }
       \tl_set:Nx \l_@@_internal_a_tl
         {
           \s__seq
@@ -5496,13 +5496,13 @@
             \@@_extract_seq_aux:n
         }
       \int_compare:nNnF
-        { \flag_height:n { @@_begin } + \flag_height:n { @@_end } }
+        { \flag_use:n { @@_begin } + \flag_use:n { @@_end } }
         = \c_zero
         {
           \__msg_kernel_error:nnxxx { regex } { result-unbalanced }
             { splitting~or~extracting~submatches }
-            { \flag_height:n { @@_end } }
-            { \flag_height:n { @@_begin } }
+            { \flag_use:n { @@_end } }
+            { \flag_use:n { @@_begin } }
         }
       \use:x
         {

Modified: trunk/l3experimental/l3str/l3str-convert.dtx
===================================================================
--- trunk/l3experimental/l3str/l3str-convert.dtx	2017-02-13 22:50:20 UTC (rev 6915)
+++ trunk/l3experimental/l3str/l3str-convert.dtx	2017-02-13 23:07:49 UTC (rev 6916)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project
+%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project
 %
 % It may be distributed and/or modified under the conditions of the
 % LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -713,7 +713,7 @@
 %   error if it occurred, nothing otherwise.
 %    \begin{macrocode}
 \cs_new:Npn \@@_if_flag_times:nT #1#2
-  { \flag_if_raised:nT {#1} { #2~(x \flag_height:n {#1} ) } }
+  { \flag_if_raised:nT {#1} { #2~(x \flag_use:n {#1} ) } }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1044,7 +1044,7 @@
   {
     \cs_new_protected:Npn \@@_convert_unescape_:
       {
-        \flag_clear:n { str_byte }
+        \flag_zero:n { str_byte }
         \tl_gset:Nx \g_@@_result_tl
           { \exp_args:No \@@_filter_bytes:n \g_@@_result_tl }
         \@@_if_flag_error:nnx { str_byte } { non-byte } { bytes }
@@ -1139,7 +1139,7 @@
     {
       \cs_new_protected:Npn \@@_convert_encode_:
         {
-          \flag_clear:n { str_error }
+          \flag_zero:n { str_error }
           \@@_convert_gmap_internal:N \@@_encode_native_char:n
           \@@_if_flag_error:nnx { str_error }
             { pdfTeX-native-overflow } { }
@@ -1281,7 +1281,7 @@
         { \tl_use:c { c_@@_encoding_#1_missing_tl } }
         { \q_stop \__prg_break: }
       \__prg_break_point:
-      \flag_clear:n { str_error }
+      \flag_zero:n { str_error }
       \@@_convert_gmap:N \@@_decode_eight_bit_char:N
       \@@_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
     \group_end:
@@ -1335,7 +1335,7 @@
         { \tl_use:c { c_@@_encoding_#1_tl } }
         { \q_stop \__prg_break: } { }
       \__prg_break_point:
-      \flag_clear:n { str_error }
+      \flag_zero:n { str_error }
       \@@_convert_gmap_internal:N \@@_encode_eight_bit_char:n
       \@@_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
     \group_end:
@@ -1478,7 +1478,7 @@
 \cs_new_protected:Npn \@@_convert_unescape_hex:
   {
     \group_begin:
-      \flag_clear:n { str_error }
+      \flag_zero:n { str_error }
       \int_set:Nn \tex_escapechar:D { 92 }
       \tl_gset:Nx \g_@@_result_tl
         {
@@ -1558,8 +1558,8 @@
     \cs_new_protected:cpn { @@_convert_unescape_#2: }
       {
         \group_begin:
-          \flag_clear:n { str_byte }
-          \flag_clear:n { str_error }
+          \flag_zero:n { str_byte }
+          \flag_zero:n { str_error }
           \int_set:Nn \tex_escapechar:D { 92 }
           \tl_gset:Nx \g_@@_result_tl
             {
@@ -1652,8 +1652,8 @@
       \cs_new_protected:Npn \@@_convert_unescape_string:
         {
           \group_begin:
-            \flag_clear:n { str_byte }
-            \flag_clear:n { str_error }
+            \flag_zero:n { str_byte }
+            \flag_zero:n { str_error }
             \int_set:Nn \tex_escapechar:D { 92 }
             \tl_gset:Nx \g_@@_result_tl
               {
@@ -1975,7 +1975,7 @@
 %   }
 %   When decoding a string that is purportedly in the \textsc{utf-8}
 %   encoding, four different errors can occur, signalled by a specific
-%   flag for each (we define those flags using \cs{flag_clear_new:n}
+%   flag for each (we define those flags using \cs{flag_zero_new:n}
 %   rather than \cs{flag_new:n}, because they are shared with other
 %   encoding definition files).
 %   \begin{itemize}
@@ -1996,10 +1996,10 @@
 %   first remind the user what a correct \textsc{utf-8} string should
 %   look like, then add error-specific information.
 %    \begin{macrocode}
-\flag_clear_new:n { str_missing }
-\flag_clear_new:n { str_extra }
-\flag_clear_new:n { str_overlong }
-\flag_clear_new:n { str_overflow }
+\flag_zero_new:n { str_missing }
+\flag_zero_new:n { str_extra }
+\flag_zero_new:n { str_overlong }
+\flag_zero_new:n { str_overflow }
 \__msg_kernel_new:nnnn { str } { utf8-decode }
   {
     Invalid~UTF-8~string: \exp_last_unbraced:Nf \use_none:n
@@ -2115,11 +2115,11 @@
 %    \begin{macrocode}
 \cs_new_protected:cpn { @@_convert_decode_utf8: }
   {
-    \flag_clear:n { str_error }
-    \flag_clear:n { str_missing }
-    \flag_clear:n { str_extra }
-    \flag_clear:n { str_overlong }
-    \flag_clear:n { str_overflow }
+    \flag_zero:n { str_error }
+    \flag_zero:n { str_missing }
+    \flag_zero:n { str_extra }
+    \flag_zero:n { str_overlong }
+    \flag_zero:n { str_overflow }
     \tl_gset:Nx \g_@@_result_tl
       {
         \exp_after:wN \@@_decode_utf_viii_start:N \g_@@_result_tl
@@ -2271,7 +2271,7 @@
     { \@@_encode_utf_xvi_aux:N \@@_output_byte_pair_le:n }
   \cs_new_protected:Npn \@@_encode_utf_xvi_aux:N #1
     {
-      \flag_clear:n { str_error }
+      \flag_zero:n { str_error }
       \cs_set_eq:NN \@@_tmp:w #1
       \@@_convert_gmap_internal:N \@@_encode_utf_xvi_char:n
       \@@_if_flag_error:nnx { str_error } { utf16-encode } { }
@@ -2314,9 +2314,9 @@
 %   an unexpected trail surrogate, and a string containing an odd number
 %   of bytes.
 %    \begin{macrocode}
-  \flag_clear_new:n { str_missing }
-  \flag_clear_new:n { str_extra }
-  \flag_clear_new:n { str_end }
+  \flag_zero_new:n { str_missing }
+  \flag_zero_new:n { str_extra }
+  \flag_zero_new:n { str_end }
   \__msg_kernel_new:nnnn { str } { utf16-encode }
     { Unicode~string~cannot~be~expressed~in~UTF-16:~surrogate. }
     {
@@ -2409,10 +2409,10 @@
     }
   \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s__stop
     {
-      \flag_clear:n { str_error }
-      \flag_clear:n { str_missing }
-      \flag_clear:n { str_extra }
-      \flag_clear:n { str_end }
+      \flag_zero:n { str_error }
+      \flag_zero:n { str_missing }
+      \flag_zero:n { str_extra }
+      \flag_zero:n { str_end }
       \cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
       \tl_gset:Nx \g_@@_result_tl
         {
@@ -2613,8 +2613,8 @@
 %   happens if the encoding was in fact not \textsc{utf-32}, because
 %   most arbitrary strings are not valid in \textsc{utf-32}.
 %    \begin{macrocode}
-  \flag_clear_new:n { str_overflow }
-  \flag_clear_new:n { str_end }
+  \flag_zero_new:n { str_overflow }
+  \flag_zero_new:n { str_end }
   \__msg_kernel_new:nnnn { str } { utf32-decode }
     {
       Invalid~UTF-32~string: \exp_last_unbraced:Nf \use_none:n
@@ -2696,9 +2696,9 @@
     }
   \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s__stop
     {
-      \flag_clear:n { str_overflow }
-      \flag_clear:n { str_end }
-      \flag_clear:n { str_error }
+      \flag_zero:n { str_overflow }
+      \flag_zero:n { str_end }
+      \flag_zero:n { str_error }
       \cs_set:Npn \@@_tmp:w ##1 ##2 { ` ## #1 }
       \tl_gset:Nx \g_@@_result_tl
         {

Modified: trunk/l3experimental/l3str/testfiles/m3flag001.lvt
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3flag001.lvt	2017-02-13 22:50:20 UTC (rev 6915)
+++ trunk/l3experimental/l3str/testfiles/m3flag001.lvt	2017-02-13 23:07:49 UTC (rev 6916)
@@ -38,7 +38,7 @@
 \cs_new:Npn \test:
   {
     \flag_if_raised:nTF { C } { T } { F } ~
-    \flag_height:n { C } ~
+    \flag_use:n { C } ~
     \cs_meaning:c { flag~C~0 } ~
     \cs_meaning:c { flag~C~1 } ~
     \cs_meaning:c { flag~C~2 } ~ \NEWLINE
@@ -52,12 +52,12 @@
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\TEST { clear }
+\TEST { zero }
   {
     \TYPE { \test: \flag_raise:n {C} \test: }
     {
       \prg_replicate:nn {10} { \flag_raise:n {C} }
-      \flag_clear:n {C}
+      \flag_zero:n {C}
       \TYPE { \test: \prg_replicate:nn {10} { \flag_raise:n {C} } \test: }
     }
     \TYPE { \test: }

Modified: trunk/l3experimental/l3str/testfiles/m3flag001.tlg
===================================================================
--- trunk/l3experimental/l3str/testfiles/m3flag001.tlg	2017-02-13 22:50:20 UTC (rev 6915)
+++ trunk/l3experimental/l3str/testfiles/m3flag001.tlg	2017-02-13 23:07:49 UTC (rev 6916)
@@ -39,7 +39,7 @@
 F 0 undefined undefined undefined 
 ============================================================
 ============================================================
-TEST 3: clear
+TEST 3: zero
 ============================================================
 F 0 undefined undefined undefined 
 T 1 \relax undefined undefined 



More information about the latex3-commits mailing list