[latex3-commits] [latex3/latex3] main: Ensure all fun. and var. are defined globally (2eab9a89c)

github at latex-project.org github at latex-project.org
Tue Feb 27 09:54:30 CET 2024


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

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

commit 2eab9a89c6c12cd5d3a0e0f7a30bd4a1db57190d
Author: Yukai Chou <muzimuzhi at gmail.com>
Date:   Tue Feb 20 23:46:43 2024 +0800

    Ensure all fun. and var. are defined globally


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

2eab9a89c6c12cd5d3a0e0f7a30bd4a1db57190d
 l3kernel/CHANGELOG.md      |   2 +-
 l3kernel/l3basics.dtx      | 498 ++++++++++++++++++++++-----------------------
 l3kernel/l3bootstrap.dtx   |   2 +-
 l3kernel/l3coffins.dtx     |   2 +-
 l3kernel/l3deprecation.dtx |   6 +-
 l3kernel/l3int.dtx         |   8 +-
 l3kernel/l3luatex.dtx      |   4 +-
 l3kernel/l3regex.dtx       |   2 +-
 l3kernel/l3text.dtx        |  12 +-
 l3kernel/l3token.dtx       |   2 +-
 10 files changed, 269 insertions(+), 269 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 644571ae5..839074d89 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -9,7 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Fixed
 - Typeset `TF` of internal conditionals in current color (issue \#730)
-
+- Some functions and variables were defined locally
 ## [2024-02-20]
 
 ### Changed
diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index 67bd4b879..41c0cbd33 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -1387,17 +1387,17 @@
 %   }
 %   Then some conditionals.
 %    \begin{macrocode}
-\tex_let:D \if_true:           \tex_iftrue:D
-\tex_let:D \if_false:          \tex_iffalse:D
-\tex_let:D \or:                \tex_or:D
-\tex_let:D \else:              \tex_else:D
-\tex_let:D \fi:                \tex_fi:D
-\tex_let:D \reverse_if:N       \tex_unless:D
-\tex_let:D \if:w               \tex_if:D
-\tex_let:D \if_charcode:w      \tex_if:D
-\tex_let:D \if_catcode:w       \tex_ifcat:D
-\tex_let:D \if_meaning:w       \tex_ifx:D
-\tex_let:D \if_bool:N          \tex_ifodd:D
+\tex_global:D \tex_let:D \if_true:           \tex_iftrue:D
+\tex_global:D \tex_let:D \if_false:          \tex_iffalse:D
+\tex_global:D \tex_let:D \or:                \tex_or:D
+\tex_global:D \tex_let:D \else:              \tex_else:D
+\tex_global:D \tex_let:D \fi:                \tex_fi:D
+\tex_global:D \tex_let:D \reverse_if:N       \tex_unless:D
+\tex_global:D \tex_let:D \if:w               \tex_if:D
+\tex_global:D \tex_let:D \if_charcode:w      \tex_if:D
+\tex_global:D \tex_let:D \if_catcode:w       \tex_ifcat:D
+\tex_global:D \tex_let:D \if_meaning:w       \tex_ifx:D
+\tex_global:D \tex_let:D \if_bool:N          \tex_ifodd:D
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1410,20 +1410,20 @@
 %   }
 %   \TeX{} lets us detect some if its modes.
 %    \begin{macrocode}
-\tex_let:D \if_mode_math:       \tex_ifmmode:D
-\tex_let:D \if_mode_horizontal: \tex_ifhmode:D
-\tex_let:D \if_mode_vertical:   \tex_ifvmode:D
-\tex_let:D \if_mode_inner:      \tex_ifinner:D
+\tex_global:D \tex_let:D \if_mode_math:       \tex_ifmmode:D
+\tex_global:D \tex_let:D \if_mode_horizontal: \tex_ifhmode:D
+\tex_global:D \tex_let:D \if_mode_vertical:   \tex_ifvmode:D
+\tex_global:D \tex_let:D \if_mode_inner:      \tex_ifinner:D
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\if_cs_exist:N, \if_cs_exist:w, \cs:w, \cs_end:}
 %   Building csnames and testing if control sequences exist.
 %    \begin{macrocode}
-\tex_let:D \if_cs_exist:N      \tex_ifdefined:D
-\tex_let:D \if_cs_exist:w      \tex_ifcsname:D
-\tex_let:D \cs:w               \tex_csname:D
-\tex_let:D \cs_end:            \tex_endcsname:D
+\tex_global:D \tex_let:D \if_cs_exist:N      \tex_ifdefined:D
+\tex_global:D \tex_let:D \if_cs_exist:w      \tex_ifcsname:D
+\tex_global:D \tex_let:D \cs:w               \tex_csname:D
+\tex_global:D \tex_let:D \cs_end:            \tex_endcsname:D
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1431,28 +1431,28 @@
 %    The five |\exp_| functions are used in the \pkg{l3expan} module
 %    where they are described.
 %    \begin{macrocode}
-\tex_let:D \exp_after:wN       \tex_expandafter:D
-\tex_let:D \exp_not:N          \tex_noexpand:D
-\tex_let:D \exp_not:n          \tex_unexpanded:D
-\tex_let:D \exp:w              \tex_romannumeral:D
-\tex_chardef:D \exp_end:  = 0 ~
+\tex_global:D \tex_let:D \exp_after:wN       \tex_expandafter:D
+\tex_global:D \tex_let:D \exp_not:N          \tex_noexpand:D
+\tex_global:D \tex_let:D \exp_not:n          \tex_unexpanded:D
+\tex_global:D \tex_let:D \exp:w              \tex_romannumeral:D
+\tex_global:D \tex_chardef:D \exp_end:  = 0 ~
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\token_to_meaning:N, \cs_meaning:N}
 %   Examining a control sequence or token.
 %    \begin{macrocode}
-\tex_let:D \token_to_meaning:N \tex_meaning:D
-\tex_let:D \cs_meaning:N       \tex_meaning:D
+\tex_global:D \tex_let:D \token_to_meaning:N \tex_meaning:D
+\tex_global:D \tex_let:D \cs_meaning:N       \tex_meaning:D
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\tl_to_str:n, \token_to_str:N, \__kernel_tl_to_str:w}
 %   Making strings.
 %    \begin{macrocode}
-\tex_let:D \tl_to_str:n          \tex_detokenize:D
-\tex_let:D \token_to_str:N       \tex_string:D
-\tex_let:D \__kernel_tl_to_str:w \tex_detokenize:D
+\tex_global:D \tex_let:D \tl_to_str:n          \tex_detokenize:D
+\tex_global:D \tex_let:D \token_to_str:N       \tex_string:D
+\tex_global:D \tex_let:D \__kernel_tl_to_str:w \tex_detokenize:D
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1461,9 +1461,9 @@
 %    versions that are safe inside alignments. These safe versions are
 %    defined in the \pkg{l3prg} module.
 %    \begin{macrocode}
-\tex_let:D \scan_stop:         \tex_relax:D
-\tex_let:D \group_begin:       \tex_begingroup:D
-\tex_let:D \group_end:         \tex_endgroup:D
+\tex_global:D \tex_let:D \scan_stop:         \tex_relax:D
+\tex_global:D \tex_let:D \group_begin:       \tex_begingroup:D
+\tex_global:D \tex_let:D \group_end:         \tex_endgroup:D
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1474,24 +1474,24 @@
 % \begin{macro}[EXP]{\if_int_compare:w, \@@_to_roman:w}
 %   For integers.
 %    \begin{macrocode}
-\tex_let:D \if_int_compare:w   \tex_ifnum:D
-\tex_let:D \@@_to_roman:w     \tex_romannumeral:D
+\tex_global:D \tex_let:D \if_int_compare:w   \tex_ifnum:D
+\tex_global:D \tex_let:D \@@_to_roman:w     \tex_romannumeral:D
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\group_insert_after:N}
 %   Adding material after the end of a group.
 %    \begin{macrocode}
-\tex_let:D \group_insert_after:N \tex_aftergroup:D
+\tex_global:D \tex_let:D \group_insert_after:N \tex_aftergroup:D
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\exp_args:Nc, \exp_args:cc}
 %   Discussed in \pkg{l3expan}, but needed much earlier.
 %    \begin{macrocode}
-\tex_long:D \tex_def:D \exp_args:Nc #1#2
+\tex_long:D \tex_gdef:D \exp_args:Nc #1#2
   { \exp_after:wN #1 \cs:w #2 \cs_end: }
-\tex_long:D \tex_def:D \exp_args:cc #1#2
+\tex_long:D \tex_gdef:D \exp_args:cc #1#2
   { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: }
 %    \end{macrocode}
 % \end{macro}
@@ -1505,8 +1505,8 @@
 %   are used.  The \cs{cs_meaning:c} command must check for an undefined
 %   control sequence to avoid defining it mistakenly.
 %    \begin{macrocode}
-\tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N }
-\tex_long:D \tex_def:D \cs_meaning:c #1
+\tex_gdef:D \token_to_str:c { \exp_args:Nc \token_to_str:N }
+\tex_long:D \tex_gdef:D \cs_meaning:c #1
   {
     \if_cs_exist:w #1 \cs_end:
       \exp_after:wN \use_i:nn
@@ -1516,7 +1516,7 @@
     { \exp_args:Nc \cs_meaning:N {#1} }
     { \tl_to_str:n {undefined} }
   }
-\tex_let:D \token_to_meaning:c = \cs_meaning:c
+\tex_global:D \tex_let:D \token_to_meaning:c = \cs_meaning:c
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1531,7 +1531,7 @@
 %   required but it can't be used until the allocation has been set
 %   up properly!
 %    \begin{macrocode}
-\tex_chardef:D \c_zero_int    = 0 ~
+\tex_global:D \tex_chardef:D \c_zero_int    = 0 ~
 %    \end{macrocode}
 % \end{variable}
 %
@@ -1542,12 +1542,12 @@
 %   more registers available than \eTeX{}.
 %    \begin{macrocode}
 \tex_ifdefined:D \tex_luatexversion:D
-  \tex_chardef:D \c_max_register_int = 65 535 ~
+  \tex_global:D \tex_chardef:D \c_max_register_int = 65 535 ~
 \tex_else:D
   \tex_ifdefined:D \tex_omathchardef:D
-    \tex_omathchardef:D \c_max_register_int = 65535 ~
+    \tex_global:D \tex_omathchardef:D \c_max_register_int = 65535 ~
   \tex_else:D
-    \tex_mathchardef:D \c_max_register_int = 32767 ~
+    \tex_global:D \tex_mathchardef:D \c_max_register_int = 32767 ~
   \tex_fi:D
 \tex_fi:D
 %    \end{macrocode}
@@ -1556,39 +1556,7 @@
 % \subsection{Defining functions}
 %
 % We start by providing functions for the typical definition
-% functions. First the local ones.
-%
-% \begin{macro}
-%   {
-%     \cs_set_nopar:Npn           , \cs_set_nopar:Npe           , \cs_set_nopar:Npx           ,
-%     \cs_set:Npn                 , \cs_set:Npe                 , \cs_set:Npx                 ,
-%     \cs_set_protected_nopar:Npn , \cs_set_protected_nopar:Npe , \cs_set_protected_nopar:Npx ,
-%     \cs_set_protected:Npn       , \cs_set_protected:Npe       , \cs_set_protected:Npx
-%   }
-%   All assignment functions in \LaTeX3 should be naturally protected;
-%   after all, the \TeX{} primitives for assignments are and it can be
-%   a cause of problems if others aren't.
-%    \begin{macrocode}
-\tex_let:D \cs_set_nopar:Npn            \tex_def:D
-\tex_let:D \cs_set_nopar:Npe            \tex_edef:D
-\tex_let:D \cs_set_nopar:Npx            \tex_edef:D
-\tex_protected:D \tex_long:D \tex_def:D \cs_set:Npn
-  { \tex_long:D \tex_def:D }
-\tex_protected:D \tex_long:D \tex_def:D \cs_set:Npe
-  { \tex_long:D \tex_edef:D }
-\tex_let:D \cs_set:Npx \cs_set:Npe
-\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected_nopar:Npn
-  { \tex_protected:D \tex_def:D }
-\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected_nopar:Npe
-  { \tex_protected:D \tex_edef:D }
-\tex_let:D \cs_set_protected_nopar:Npx \cs_set_protected_nopar:Npe
-\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected:Npn
-  { \tex_protected:D \tex_long:D \tex_def:D }
-\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected:Npe
-  { \tex_protected:D \tex_long:D \tex_edef:D }
-\tex_let:D \cs_set_protected:Npx \cs_set_protected:Npe
-%    \end{macrocode}
-% \end{macro}
+% functions. First the global ones.
 %
 % \begin{macro}
 %   {
@@ -1597,26 +1565,58 @@
 %     \cs_gset_protected_nopar:Npn , \cs_gset_protected_nopar:Npe , \cs_gset_protected_nopar:Npx ,
 %     \cs_gset_protected:Npn       , \cs_gset_protected:Npe       , \cs_gset_protected:Npx
 %   }
-%   Global versions of the above functions.
+%   All assignment functions in \LaTeX3 should be naturally protected;
+%   after all, the \TeX{} primitives for assignments are and it can be
+%   a cause of problems if others aren't.
 %    \begin{macrocode}
-\tex_let:D \cs_gset_nopar:Npn           \tex_gdef:D
-\tex_let:D \cs_gset_nopar:Npe           \tex_xdef:D
-\tex_let:D \cs_gset_nopar:Npx           \tex_xdef:D
-\cs_set_protected:Npn \cs_gset:Npn
+\tex_global:D \tex_let:D \cs_gset_nopar:Npn           \tex_gdef:D
+\tex_global:D \tex_let:D \cs_gset_nopar:Npe           \tex_xdef:D
+\tex_global:D \tex_let:D \cs_gset_nopar:Npx           \tex_xdef:D
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset:Npn
   { \tex_long:D \tex_gdef:D }
-\cs_set_protected:Npn \cs_gset:Npe
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset:Npe
   { \tex_long:D \tex_xdef:D }
-\tex_let:D \cs_gset:Npx \cs_gset:Npe
-\cs_set_protected:Npn \cs_gset_protected_nopar:Npn
+\tex_global:D \tex_let:D \cs_gset:Npx \cs_gset:Npe
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset_protected_nopar:Npn
   { \tex_protected:D \tex_gdef:D }
-\cs_set_protected:Npn \cs_gset_protected_nopar:Npe
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset_protected_nopar:Npe
   { \tex_protected:D \tex_xdef:D }
-\tex_let:D \cs_gset_protected_nopar:Npx \cs_gset_protected_nopar:Npe
-\cs_set_protected:Npn \cs_gset_protected:Npn
+\tex_global:D \tex_let:D \cs_gset_protected_nopar:Npx \cs_gset_protected_nopar:Npe
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset_protected:Npn
   { \tex_protected:D \tex_long:D \tex_gdef:D }
-\cs_set_protected:Npn \cs_gset_protected:Npe
+\tex_protected:D \tex_long:D \tex_gdef:D \cs_gset_protected:Npe
   { \tex_protected:D \tex_long:D \tex_xdef:D }
-\tex_let:D \cs_gset_protected:Npx \cs_gset_protected:Npe
+\tex_global:D \tex_let:D \cs_gset_protected:Npx \cs_gset_protected:Npe
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+%   {
+%     \cs_set_nopar:Npn           , \cs_set_nopar:Npe           , \cs_set_nopar:Npx           ,
+%     \cs_set:Npn                 , \cs_set:Npe                 , \cs_set:Npx                 ,
+%     \cs_set_protected_nopar:Npn , \cs_set_protected_nopar:Npe , \cs_set_protected_nopar:Npx ,
+%     \cs_set_protected:Npn       , \cs_set_protected:Npe       , \cs_set_protected:Npx
+%   }
+%   Local versions of the above functions.
+%    \begin{macrocode}
+\tex_global:D \tex_let:D \cs_set_nopar:Npn           \tex_def:D
+\tex_global:D \tex_let:D \cs_set_nopar:Npe           \tex_edef:D
+\tex_global:D \tex_let:D \cs_set_nopar:Npx           \tex_edef:D
+\cs_gset_protected:Npn \cs_set:Npn
+  { \tex_long:D \tex_def:D }
+\cs_gset_protected:Npn \cs_set:Npe
+  { \tex_long:D \tex_edef:D }
+\tex_global:D \tex_let:D \cs_set:Npx \cs_set:Npe
+\cs_gset_protected:Npn \cs_set_protected_nopar:Npn
+  { \tex_protected:D \tex_def:D }
+\cs_gset_protected:Npn \cs_set_protected_nopar:Npe
+  { \tex_protected:D \tex_edef:D }
+\tex_global:D \tex_let:D \cs_set_protected_nopar:Npx \cs_set_protected_nopar:Npe
+\cs_gset_protected:Npn \cs_set_protected:Npn
+  { \tex_protected:D \tex_long:D \tex_def:D }
+\cs_gset_protected:Npn \cs_set_protected:Npe
+  { \tex_protected:D \tex_long:D \tex_edef:D }
+\tex_global:D \tex_let:D \cs_set_protected:Npx \cs_set_protected:Npe
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1631,14 +1631,14 @@
 %   used in defining conditionals.  We don't use |tl| methods because
 %   \pkg{l3basics} is loaded earlier.
 %    \begin{macrocode}
-\cs_set_nopar:Npn \l_@@_internal_tl { }
+\cs_gset_nopar:Npn \l_@@_internal_tl { }
 %    \end{macrocode}
 % \end{variable}
 %
 % \begin{macro}[EXP]{\use:c}
 %    This macro grabs its argument and returns a csname from it.
 %    \begin{macrocode}
-\cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: }
+\cs_gset:Npn \use:c #1 { \cs:w #1 \cs_end: }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1646,7 +1646,7 @@
 %   Fully expands its argument and passes it to the input stream. Uses
 %   the reserved \cs{l_@@_internal_tl} which we've set up above.
 %    \begin{macrocode}
-\cs_set_protected:Npn \use:x #1
+\cs_gset_protected:Npn \use:x #1
   {
     \cs_set_nopar:Npx \l_@@_internal_tl {#1}
     \l_@@_internal_tl
@@ -1660,7 +1660,7 @@
 %
 % \begin{macro}[EXP]{\use:e}
 %    \begin{macrocode}
-\cs_set:Npn \use:e #1 { \tex_expanded:D {#1} }
+\cs_gset:Npn \use:e #1 { \tex_expanded:D {#1} }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1672,18 +1672,18 @@
 %    These macros grab their arguments and return them back to the input
 %    (with outer braces removed).
 %    \begin{macrocode}
-\cs_set:Npn \use:n    #1       {#1}
-\cs_set:Npn \use:nn   #1#2     {#1#2}
-\cs_set:Npn \use:nnn  #1#2#3   {#1#2#3}
-\cs_set:Npn \use:nnnn #1#2#3#4 {#1#2#3#4}
+\cs_gset:Npn \use:n    #1       {#1}
+\cs_gset:Npn \use:nn   #1#2     {#1#2}
+\cs_gset:Npn \use:nnn  #1#2#3   {#1#2#3}
+\cs_gset:Npn \use:nnnn #1#2#3#4 {#1#2#3#4}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\use_i:nn, \use_ii:nn}
 %    The equivalent to \LaTeXe{}'s \tn{@firstoftwo} and \tn{@secondoftwo}.
 %    \begin{macrocode}
-\cs_set:Npn \use_i:nn  #1#2 {#1}
-\cs_set:Npn \use_ii:nn #1#2 {#2}
+\cs_gset:Npn \use_i:nn  #1#2 {#1}
+\cs_gset:Npn \use_ii:nn #1#2 {#2}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1705,60 +1705,60 @@
 %   }
 %   We also need something for picking up arguments from a longer list.
 %    \begin{macrocode}
-\cs_set:Npn \use_i:nnn    #1#2#3 {#1}
-\cs_set:Npn \use_ii:nnn   #1#2#3 {#2}
-\cs_set:Npn \use_iii:nnn  #1#2#3 {#3}
-\cs_set:Npn \use_i:nnnn   #1#2#3#4 {#1}
-\cs_set:Npn \use_ii:nnnn  #1#2#3#4 {#2}
-\cs_set:Npn \use_iii:nnnn #1#2#3#4 {#3}
-\cs_set:Npn \use_iv:nnnn  #1#2#3#4 {#4}
-\cs_set:Npn \use_i:nnnnn   #1#2#3#4#5 {#1}
-\cs_set:Npn \use_ii:nnnnn  #1#2#3#4#5 {#2}
-\cs_set:Npn \use_iii:nnnnn #1#2#3#4#5 {#3}
-\cs_set:Npn \use_iv:nnnnn  #1#2#3#4#5 {#4}
-\cs_set:Npn \use_v:nnnnn   #1#2#3#4#5 {#5}
-\cs_set:Npn \use_i:nnnnnn   #1#2#3#4#5#6 {#1}
-\cs_set:Npn \use_ii:nnnnnn  #1#2#3#4#5#6 {#2}
-\cs_set:Npn \use_iii:nnnnnn #1#2#3#4#5#6 {#3}
-\cs_set:Npn \use_iv:nnnnnn  #1#2#3#4#5#6 {#4}
-\cs_set:Npn \use_v:nnnnnn   #1#2#3#4#5#6 {#5}
-\cs_set:Npn \use_vi:nnnnnn  #1#2#3#4#5#6 {#6}
-\cs_set:Npn \use_i:nnnnnnn   #1#2#3#4#5#6#7 {#1}
-\cs_set:Npn \use_ii:nnnnnnn  #1#2#3#4#5#6#7 {#2}
-\cs_set:Npn \use_iii:nnnnnnn #1#2#3#4#5#6#7 {#3}
-\cs_set:Npn \use_iv:nnnnnnn  #1#2#3#4#5#6#7 {#4}
-\cs_set:Npn \use_v:nnnnnnn   #1#2#3#4#5#6#7 {#5}
-\cs_set:Npn \use_vi:nnnnnnn  #1#2#3#4#5#6#7 {#6}
-\cs_set:Npn \use_vii:nnnnnnn #1#2#3#4#5#6#7 {#7}
-\cs_set:Npn \use_i:nnnnnnnn    #1#2#3#4#5#6#7#8 {#1}
-\cs_set:Npn \use_ii:nnnnnnnn   #1#2#3#4#5#6#7#8 {#2}
-\cs_set:Npn \use_iii:nnnnnnnn  #1#2#3#4#5#6#7#8 {#3}
-\cs_set:Npn \use_iv:nnnnnnnn   #1#2#3#4#5#6#7#8 {#4}
-\cs_set:Npn \use_v:nnnnnnnn    #1#2#3#4#5#6#7#8 {#5}
-\cs_set:Npn \use_vi:nnnnnnnn   #1#2#3#4#5#6#7#8 {#6}
-\cs_set:Npn \use_vii:nnnnnnnn  #1#2#3#4#5#6#7#8 {#7}
-\cs_set:Npn \use_viii:nnnnnnnn #1#2#3#4#5#6#7#8 {#8}
-\cs_set:Npn \use_i:nnnnnnnnn    #1#2#3#4#5#6#7#8#9 {#1}
-\cs_set:Npn \use_ii:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#2}
-\cs_set:Npn \use_iii:nnnnnnnnn  #1#2#3#4#5#6#7#8#9 {#3}
-\cs_set:Npn \use_iv:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#4}
-\cs_set:Npn \use_v:nnnnnnnnn    #1#2#3#4#5#6#7#8#9 {#5}
-\cs_set:Npn \use_vi:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#6}
-\cs_set:Npn \use_vii:nnnnnnnnn  #1#2#3#4#5#6#7#8#9 {#7}
-\cs_set:Npn \use_viii:nnnnnnnnn #1#2#3#4#5#6#7#8#9 {#8}
-\cs_set:Npn \use_ix:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#9} 
+\cs_gset:Npn \use_i:nnn    #1#2#3 {#1}
+\cs_gset:Npn \use_ii:nnn   #1#2#3 {#2}
+\cs_gset:Npn \use_iii:nnn  #1#2#3 {#3}
+\cs_gset:Npn \use_i:nnnn   #1#2#3#4 {#1}
+\cs_gset:Npn \use_ii:nnnn  #1#2#3#4 {#2}
+\cs_gset:Npn \use_iii:nnnn #1#2#3#4 {#3}
+\cs_gset:Npn \use_iv:nnnn  #1#2#3#4 {#4}
+\cs_gset:Npn \use_i:nnnnn   #1#2#3#4#5 {#1}
+\cs_gset:Npn \use_ii:nnnnn  #1#2#3#4#5 {#2}
+\cs_gset:Npn \use_iii:nnnnn #1#2#3#4#5 {#3}
+\cs_gset:Npn \use_iv:nnnnn  #1#2#3#4#5 {#4}
+\cs_gset:Npn \use_v:nnnnn   #1#2#3#4#5 {#5}
+\cs_gset:Npn \use_i:nnnnnn   #1#2#3#4#5#6 {#1}
+\cs_gset:Npn \use_ii:nnnnnn  #1#2#3#4#5#6 {#2}
+\cs_gset:Npn \use_iii:nnnnnn #1#2#3#4#5#6 {#3}
+\cs_gset:Npn \use_iv:nnnnnn  #1#2#3#4#5#6 {#4}
+\cs_gset:Npn \use_v:nnnnnn   #1#2#3#4#5#6 {#5}
+\cs_gset:Npn \use_vi:nnnnnn  #1#2#3#4#5#6 {#6}
+\cs_gset:Npn \use_i:nnnnnnn   #1#2#3#4#5#6#7 {#1}
+\cs_gset:Npn \use_ii:nnnnnnn  #1#2#3#4#5#6#7 {#2}
+\cs_gset:Npn \use_iii:nnnnnnn #1#2#3#4#5#6#7 {#3}
+\cs_gset:Npn \use_iv:nnnnnnn  #1#2#3#4#5#6#7 {#4}
+\cs_gset:Npn \use_v:nnnnnnn   #1#2#3#4#5#6#7 {#5}
+\cs_gset:Npn \use_vi:nnnnnnn  #1#2#3#4#5#6#7 {#6}
+\cs_gset:Npn \use_vii:nnnnnnn #1#2#3#4#5#6#7 {#7}
+\cs_gset:Npn \use_i:nnnnnnnn    #1#2#3#4#5#6#7#8 {#1}
+\cs_gset:Npn \use_ii:nnnnnnnn   #1#2#3#4#5#6#7#8 {#2}
+\cs_gset:Npn \use_iii:nnnnnnnn  #1#2#3#4#5#6#7#8 {#3}
+\cs_gset:Npn \use_iv:nnnnnnnn   #1#2#3#4#5#6#7#8 {#4}
+\cs_gset:Npn \use_v:nnnnnnnn    #1#2#3#4#5#6#7#8 {#5}
+\cs_gset:Npn \use_vi:nnnnnnnn   #1#2#3#4#5#6#7#8 {#6}
+\cs_gset:Npn \use_vii:nnnnnnnn  #1#2#3#4#5#6#7#8 {#7}
+\cs_gset:Npn \use_viii:nnnnnnnn #1#2#3#4#5#6#7#8 {#8}
+\cs_gset:Npn \use_i:nnnnnnnnn    #1#2#3#4#5#6#7#8#9 {#1}
+\cs_gset:Npn \use_ii:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#2}
+\cs_gset:Npn \use_iii:nnnnnnnnn  #1#2#3#4#5#6#7#8#9 {#3}
+\cs_gset:Npn \use_iv:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#4}
+\cs_gset:Npn \use_v:nnnnnnnnn    #1#2#3#4#5#6#7#8#9 {#5}
+\cs_gset:Npn \use_vi:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#6}
+\cs_gset:Npn \use_vii:nnnnnnnnn  #1#2#3#4#5#6#7#8#9 {#7}
+\cs_gset:Npn \use_viii:nnnnnnnnn #1#2#3#4#5#6#7#8#9 {#8}
+\cs_gset:Npn \use_ix:nnnnnnnnn   #1#2#3#4#5#6#7#8#9 {#9}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\use_i_ii:nnn}
 %    \begin{macrocode}
-\cs_set:Npn \use_i_ii:nnn #1#2#3 {#1#2}
+\cs_gset:Npn \use_i_ii:nnn #1#2#3 {#1#2}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}[EXP]{\use_ii_i:nn}
 %    \begin{macrocode}
-\cs_set:Npn \use_ii_i:nn #1#2 { #2 #1 }
+\cs_gset:Npn \use_ii_i:nn #1#2 { #2 #1 }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1772,9 +1772,9 @@
 %   Functions that gobble everything until they see either \cs{q_nil},
 %   \cs{q_stop}, or \cs{q_recursion_stop}, respectively.
 %    \begin{macrocode}
-\cs_set:Npn \use_none_delimit_by_q_nil:w  #1 \q_nil  { }
-\cs_set:Npn \use_none_delimit_by_q_stop:w #1 \q_stop { }
-\cs_set:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop { }
+\cs_gset:Npn \use_none_delimit_by_q_nil:w  #1 \q_nil  { }
+\cs_gset:Npn \use_none_delimit_by_q_stop:w #1 \q_stop { }
+\cs_gset:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop { }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1788,9 +1788,9 @@
 %   when you need to skip the rest of a mapping sequence but want an
 %   easy way to control what should be expanded next.
 %    \begin{macrocode}
-\cs_set:Npn \use_i_delimit_by_q_nil:nw  #1#2 \q_nil  {#1}
-\cs_set:Npn \use_i_delimit_by_q_stop:nw #1#2 \q_stop {#1}
-\cs_set:Npn \use_i_delimit_by_q_recursion_stop:nw
+\cs_gset:Npn \use_i_delimit_by_q_nil:nw  #1#2 \q_nil  {#1}
+\cs_gset:Npn \use_i_delimit_by_q_stop:nw #1#2 \q_stop {#1}
+\cs_gset:Npn \use_i_delimit_by_q_recursion_stop:nw
   #1#2 \q_recursion_stop {#1}
 %    \end{macrocode}
 % \end{macro}
@@ -1817,15 +1817,15 @@
 %   who will assume that expanding such a function once takes care
 %   of gobbling all the tokens in one go.
 %    \begin{macrocode}
-\cs_set:Npn \use_none:n         #1                 { }
-\cs_set:Npn \use_none:nn        #1#2               { }
-\cs_set:Npn \use_none:nnn       #1#2#3             { }
-\cs_set:Npn \use_none:nnnn      #1#2#3#4           { }
-\cs_set:Npn \use_none:nnnnn     #1#2#3#4#5         { }
-\cs_set:Npn \use_none:nnnnnn    #1#2#3#4#5#6       { }
-\cs_set:Npn \use_none:nnnnnnn   #1#2#3#4#5#6#7     { }
-\cs_set:Npn \use_none:nnnnnnnn  #1#2#3#4#5#6#7#8   { }
-\cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { }
+\cs_gset:Npn \use_none:n         #1                 { }
+\cs_gset:Npn \use_none:nn        #1#2               { }
+\cs_gset:Npn \use_none:nnn       #1#2#3             { }
+\cs_gset:Npn \use_none:nnnn      #1#2#3#4           { }
+\cs_gset:Npn \use_none:nnnnn     #1#2#3#4#5         { }
+\cs_gset:Npn \use_none:nnnnnn    #1#2#3#4#5#6       { }
+\cs_gset:Npn \use_none:nnnnnnn   #1#2#3#4#5#6#7     { }
+\cs_gset:Npn \use_none:nnnnnnnn  #1#2#3#4#5#6#7#8   { }
+\cs_gset:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1840,20 +1840,20 @@
 %   up with guards.  We can also more easily change the logic in one
 %   place then. This is needed primarily for deprecations.
 %    \begin{macrocode}
-\cs_set_protected:Npn \__kernel_if_debug:TF #1#2 {#2}
+\cs_gset_protected:Npn \__kernel_if_debug:TF #1#2 {#2}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\debug_on:n, \debug_off:n}
 %   Stubs.
 %    \begin{macrocode}
-\cs_set_protected:Npn \debug_on:n #1
+\cs_gset_protected:Npn \debug_on:n #1
   {
     \sys_load_debug:
     \cs_if_exist:NT \@@_all_on:
       { \debug_on:n {#1} }
   }
-\cs_set_protected:Npn \debug_off:n #1
+\cs_gset_protected:Npn \debug_off:n #1
   {
     \sys_load_debug:
     \cs_if_exist:NT \@@_all_on:
@@ -1864,8 +1864,8 @@
 %
 % \begin{macro}{\debug_suspend:, \debug_resume:}
 %    \begin{macrocode}
-\cs_set_protected:Npn \debug_suspend: { }
-\cs_set_protected:Npn \debug_resume: { }
+\cs_gset_protected:Npn \debug_suspend: { }
+\cs_gset_protected:Npn \debug_resume: { }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1875,9 +1875,9 @@
 %   only make these into errors if the user requests it.  This relies on
 %   two token lists, filled up in \pkg{l3deprecation}.
 %    \begin{macrocode}
-\cs_set_nopar:Npn \g_@@_deprecation_on_tl { }
-\cs_set_nopar:Npn \g_@@_deprecation_off_tl { }
-\cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2
+\cs_gset_nopar:Npn \g_@@_deprecation_on_tl { }
+\cs_gset_nopar:Npn \g_@@_deprecation_off_tl { }
+\cs_gset_protected:Npn \__kernel_deprecation_code:nn #1#2
   {
     \tl_gput_right:Nn \g_@@_deprecation_on_tl {#1}
     \tl_gput_right:Nn \g_@@_deprecation_off_tl {#2}
@@ -1923,9 +1923,9 @@
 %   at least two tokens: see how the logical tests are actually implemented
 %   to see this.
 %    \begin{macrocode}
-\cs_set:Npn \prg_return_true:
+\cs_gset:Npn \prg_return_true:
   { \exp_after:wN \use_i:nn  \exp:w }
-\cs_set:Npn \prg_return_false:
+\cs_gset:Npn \prg_return_false:
   { \exp_after:wN \use_ii:nn \exp:w}
 %    \end{macrocode}
 %   An extended state space could be implemented by including a more
@@ -1936,7 +1936,7 @@
 % \begin{macro}[EXP]{\@@_use_none_delimit_by_q_recursion_stop:w}
 %   Private version of \cs{use_none_delimit_by_q_recursion_stop:w}.
 %    \begin{macrocode}
-\cs_set:Npn \@@_use_none_delimit_by_q_recursion_stop:w
+\cs_gset:Npn \@@_use_none_delimit_by_q_recursion_stop:w
   #1 \q_@@_recursion_stop { }
 %    \end{macrocode}
 % \end{macro}
@@ -1962,19 +1962,19 @@
 %   conditionals.
 %   Note that |e| stands for expandable and |p| for protected.
 %    \begin{macrocode}
-\cs_set_protected:Npn \prg_set_conditional:Npnn
+\cs_gset_protected:Npn \prg_set_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_set:Npn e }
-\cs_set_protected:Npn \prg_gset_conditional:Npnn
+\cs_gset_protected:Npn \prg_gset_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_gset:Npn e }
-\cs_set_protected:Npn \prg_new_conditional:Npnn
+\cs_gset_protected:Npn \prg_new_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_new:Npn e }
-\cs_set_protected:Npn \prg_set_protected_conditional:Npnn
+\cs_gset_protected:Npn \prg_set_protected_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_set_protected:Npn p }
-\cs_set_protected:Npn \prg_gset_protected_conditional:Npnn
+\cs_gset_protected:Npn \prg_gset_protected_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_gset_protected:Npn p }
-\cs_set_protected:Npn \prg_new_protected_conditional:Npnn
+\cs_gset_protected:Npn \prg_new_protected_conditional:Npnn
   { \@@_generate_conditional_parm:NNNpnn \cs_new_protected:Npn p }
-\cs_set_protected:Npn \@@_generate_conditional_parm:NNNpnn #1#2#3#4#
+\cs_gset_protected:Npn \@@_generate_conditional_parm:NNNpnn #1#2#3#4#
   {
     \use:e
       {
@@ -2014,19 +2014,19 @@
 %   erroneous case where the function name contains no colon is captured
 %   later.
 %    \begin{macrocode}
-\cs_set_protected:Npn \prg_set_conditional:Nnn
+\cs_gset_protected:Npn \prg_set_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_set:Npn e }
-\cs_set_protected:Npn \prg_gset_conditional:Nnn
+\cs_gset_protected:Npn \prg_gset_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_set:Npn e }
-\cs_set_protected:Npn \prg_new_conditional:Nnn
+\cs_gset_protected:Npn \prg_new_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_new:Npn e }
-\cs_set_protected:Npn \prg_set_protected_conditional:Nnn
+\cs_gset_protected:Npn \prg_set_protected_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_set_protected:Npn p }
-\cs_set_protected:Npn \prg_gset_protected_conditional:Nnn
+\cs_gset_protected:Npn \prg_gset_protected_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_gset_protected:Npn p }
-\cs_set_protected:Npn \prg_new_protected_conditional:Nnn
+\cs_gset_protected:Npn \prg_new_protected_conditional:Nnn
   { \@@_generate_conditional_count:NNNnn \cs_new_protected:Npn p }
-\cs_set_protected:Npn \@@_generate_conditional_count:NNNnn #1#2#3
+\cs_gset_protected:Npn \@@_generate_conditional_count:NNNnn #1#2#3
   {
     \use:e
       {
@@ -2035,7 +2035,7 @@
       }
       #1 #2
   }
-\cs_set_protected:Npn \@@_generate_conditional_count:nnNNNnn #1#2#3#4#5
+\cs_gset_protected:Npn \@@_generate_conditional_count:nnNNNnn #1#2#3#4#5
   {
     \__kernel_cs_parm_from_arg_count:nnF
       { \@@_generate_conditional:nnNNNnnn {#1} {#2} #3 #4 #5 }
@@ -2076,7 +2076,7 @@
 %   \cs{use_i:nn} instead of \cs{use_i_ii:nnn} to functions such as
 %   \cs{@@_generate_p_form:wNNnnnnN}.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_generate_conditional:nnNNNnnn #1#2#3#4#5#6#7#8
+\cs_gset_protected:Npn \@@_generate_conditional:nnNNNnnn #1#2#3#4#5#6#7#8
   {
     \if_meaning:w \c_false_bool #3
       \msg_error:nne { kernel } { missing-colon }
@@ -2097,10 +2097,10 @@
         \exp_not:n { , \q_@@_recursion_tail , \q_@@_recursion_stop }
       }
   }
-\cs_set:Npn \@@_generate_conditional_test:w
+\cs_gset:Npn \@@_generate_conditional_test:w
     #1 \prg_return_true: \else: \prg_return_false: \fi: \s_@@_mark #2
   { #2 {#1} }
-\cs_set:Npn \@@_generate_conditional_fast:nw #1#2 \exp_not:n #3
+\cs_gset:Npn \@@_generate_conditional_fast:nw #1#2 \exp_not:n #3
   { \exp_not:n { {#1} \use_i:nn } }
 %    \end{macrocode}
 %   Looping through the list of desired forms.  First are six arguments
@@ -2111,7 +2111,7 @@
 %   then \cs{use_none:nnnnnnnn} cleans up.  Otherwise, the
 %   error message is removed by the variant form.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_generate_conditional:NNnnnnNw #1#2#3#4#5#6#7#8 ,
+\cs_gset_protected:Npn \@@_generate_conditional:NNnnnnNw #1#2#3#4#5#6#7#8 ,
   {
     \if_meaning:w \q_@@_recursion_tail #8
       \exp_after:wN \@@_use_none_delimit_by_q_recursion_stop:w
@@ -2158,7 +2158,7 @@
 %   but if those are actually missing, the recovery from the runaway argument
 %   would not insert \cs{fi:} back, messing up nesting of conditionals.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_generate_p_form:wNNnnnnN
+\cs_gset_protected:Npn \@@_generate_p_form:wNNnnnnN
     #1 \s_@@_stop #2#3#4#5#6#7#8
   {
     \if_meaning:w e #3
@@ -2177,7 +2177,7 @@
           { \token_to_str:c { #4 _p: #5 } }
       }
   }
-\cs_set_protected:Npn \@@_generate_T_form:wNNnnnnN
+\cs_gset_protected:Npn \@@_generate_T_form:wNNnnnnN
     #1 \s_@@_stop #2#3#4#5#6#7#8
   {
     #8
@@ -2185,7 +2185,7 @@
       { { #7 \exp_end: \use:n \use_none:n } }
       { #7 \@@_T_true:w \fi: \use_none:n }
   }
-\cs_set_protected:Npn \@@_generate_F_form:wNNnnnnN
+\cs_gset_protected:Npn \@@_generate_F_form:wNNnnnnN
     #1 \s_@@_stop #2#3#4#5#6#7#8
   {
     #8
@@ -2193,7 +2193,7 @@
       { { #7 \exp_end: { } } }
       { #7 \@@_F_true:w \fi: \use:n }
   }
-\cs_set_protected:Npn \@@_generate_TF_form:wNNnnnnN
+\cs_gset_protected:Npn \@@_generate_TF_form:wNNnnnnN
     #1 \s_@@_stop #2#3#4#5#6#7#8
   {
     #8
@@ -2201,10 +2201,10 @@
       { { #7 \exp_end: } }
       { #7 \@@_TF_true:w \fi: \use_ii:nn }
   }
-\cs_set:Npn \@@_p_true:w  \fi: \c_false_bool { \fi: \c_true_bool }
-\cs_set:Npn \@@_T_true:w  \fi: \use_none:n   { \fi: \use:n }
-\cs_set:Npn \@@_F_true:w  \fi: \use:n        { \fi: \use_none:n }
-\cs_set:Npn \@@_TF_true:w \fi: \use_ii:nn    { \fi: \use_i:nn }
+\cs_gset:Npn \@@_p_true:w  \fi: \c_false_bool { \fi: \c_true_bool }
+\cs_gset:Npn \@@_T_true:w  \fi: \use_none:n   { \fi: \use:n }
+\cs_gset:Npn \@@_F_true:w  \fi: \use:n        { \fi: \use_none:n }
+\cs_gset:Npn \@@_TF_true:w \fi: \use_ii:nn    { \fi: \use_i:nn }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -2223,13 +2223,13 @@
 %   |,| \cs{q_@@_recursion_stop}
 %   to a first auxiliary.
 %    \begin{macrocode}
-\cs_set_protected:Npn \prg_set_eq_conditional:NNn
+\cs_gset_protected:Npn \prg_set_eq_conditional:NNn
   { \@@_set_eq_conditional:NNNn \cs_set_eq:cc }
-\cs_set_protected:Npn \prg_gset_eq_conditional:NNn
+\cs_gset_protected:Npn \prg_gset_eq_conditional:NNn
   { \@@_set_eq_conditional:NNNn \cs_gset_eq:cc }
-\cs_set_protected:Npn \prg_new_eq_conditional:NNn
+\cs_gset_protected:Npn \prg_new_eq_conditional:NNn
   { \@@_set_eq_conditional:NNNn \cs_new_eq:cc }
-\cs_set_protected:Npn \@@_set_eq_conditional:NNNn #1#2#3#4
+\cs_gset_protected:Npn \@@_set_eq_conditional:NNNn #1#2#3#4
   {
     \use:e
       {
@@ -2268,7 +2268,7 @@
 %   step in the loop, make sure that the conditional form we copy is
 %   defined, and copy it, otherwise abort.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6
+\cs_gset_protected:Npn \@@_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6
   {
     \if_meaning:w \c_false_bool #3
       \msg_error:nne { kernel } { missing-colon }
@@ -2282,7 +2282,7 @@
     \fi:
     \@@_set_eq_conditional_loop:nnnnNw {#1} {#2} {#4} {#5}
   }
-\cs_set_protected:Npn \@@_set_eq_conditional_loop:nnnnNw #1#2#3#4#5#6 ,
+\cs_gset_protected:Npn \@@_set_eq_conditional_loop:nnnnNw #1#2#3#4#5#6 ,
   {
     \if_meaning:w \q_@@_recursion_tail #6
       \exp_after:wN \@@_use_none_delimit_by_q_recursion_stop:w
@@ -2299,13 +2299,13 @@
       #5 {#1} {#2} {#3} {#4}
     \@@_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5
   }
-\cs_set:Npn \@@_set_eq_conditional_p_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
+\cs_gset:Npn \@@_set_eq_conditional_p_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
   { #2 { #3 _p : #4    }    { #5 _p : #6    } }
-\cs_set:Npn \@@_set_eq_conditional_TF_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
+\cs_gset:Npn \@@_set_eq_conditional_TF_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
   { #2 { #3    : #4 TF }    { #5    : #6 TF } }
-\cs_set:Npn \@@_set_eq_conditional_T_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
+\cs_gset:Npn \@@_set_eq_conditional_T_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
   { #2 { #3    : #4 T  }    { #5    : #6 T  } }
-\cs_set:Npn \@@_set_eq_conditional_F_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
+\cs_gset:Npn \@@_set_eq_conditional_F_form:wNnnnn #1 \s_@@_stop #2#3#4#5#6
   { #2 { #3    : #4  F }    { #5    : #6  F } }
 %    \end{macrocode}
 % \end{macro}
@@ -2323,8 +2323,8 @@
 % \begin{variable}{\c_true_bool, \c_false_bool}
 %    Here are the canonical boolean values.
 %    \begin{macrocode}
-\tex_chardef:D \c_true_bool  = 1 ~
-\tex_chardef:D \c_false_bool = 0 ~
+\tex_global:D \tex_chardef:D \c_true_bool  = 1 ~
+\tex_global:D \tex_chardef:D \c_false_bool = 0 ~
 %    \end{macrocode}
 % \end{variable}
 %
@@ -2392,7 +2392,7 @@
 %   In all three cases, \cs{cs_to_str:N} takes two expansion steps
 %   to be fully expanded.
 %    \begin{macrocode}
-\cs_set:Npn \cs_to_str:N
+\cs_gset:Npn \cs_to_str:N
   {
 %    \end{macrocode}
 %    We implement the expansion scheme using \cs{tex_romannumeral:D}
@@ -2405,8 +2405,8 @@
       \if:w \token_to_str:N \ \@@_to_str:w \fi:
       \exp_after:wN \@@_to_str:N \token_to_str:N
   }
-\cs_set:Npn \@@_to_str:N #1 { \c_zero_int }
-\cs_set:Npn \@@_to_str:w #1 \@@_to_str:N
+\cs_gset:Npn \@@_to_str:N #1 { \c_zero_int }
+\cs_gset:Npn \@@_to_str:w #1 \@@_to_str:N
   { - \int_value:w \fi: \exp_after:wN \c_zero_int }
 %    \end{macrocode}
 %   If speed is a concern we could use \tn{csstring} in \LuaTeX{}.  For
@@ -2436,19 +2436,19 @@
 %   auxiliary trims the trailing \cs{s_@@_mark} from the function name if
 %   present (that is, if the original function had no colon).
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_tmp:w #1
+\cs_gset_protected:Npn \@@_tmp:w #1
   {
-    \cs_set:Npn \cs_split_function:N ##1
+    \cs_gset:Npn \cs_split_function:N ##1
       {
         \exp_after:wN \exp_after:wN \exp_after:wN
         \@@_split_function_auxi:w
           \cs_to_str:N ##1 \s_@@_mark \c_true_bool
           #1 \s_@@_mark \c_false_bool \s_@@_stop
       }
-    \cs_set:Npn \@@_split_function_auxi:w
+    \cs_gset:Npn \@@_split_function_auxi:w
         ##1 #1 ##2 \s_@@_mark ##3##4 \s_@@_stop
       { \@@_split_function_auxii:w ##1 \s_@@_mark \s_@@_stop {##2} ##3 }
-    \cs_set:Npn \@@_split_function_auxii:w ##1 \s_@@_mark ##2 \s_@@_stop
+    \cs_gset:Npn \@@_split_function_auxii:w ##1 \s_@@_mark ##2 \s_@@_stop
       { {##1} }
   }
 \exp_after:wN \@@_tmp:w \token_to_str:N :
@@ -2476,7 +2476,7 @@
 %   \cs{else:} in the top level functions will be removed by the optimization,
 %   and this usage of \cs{else:} will be fine).
 %    \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_exist:N #1 { p , T , F , TF }
+\prg_gset_conditional:Npnn \cs_if_exist:N #1 { p , T , F , TF }
   {
     \if_meaning:w #1 \scan_stop:
       \use_i:nnnn
@@ -2498,7 +2498,7 @@
 %    \begin{macrocode}
 \cs_if_exist:NTF \tex_lastnamedcs:D
   {
-    \prg_set_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF }
+    \prg_gset_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF }
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_exist_c_aux:
@@ -2507,11 +2507,11 @@
           \prg_return_false:
         \fi:
       }
-    \cs_set:Npn \@@_if_exist_c_aux:
+    \cs_gset:Npn \@@_if_exist_c_aux:
       { \fi: \exp_after:wN \if_meaning:w \tex_lastnamedcs:D \scan_stop: \else: }
   }
   {
-    \prg_set_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF }
+    \prg_gset_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF }
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_exist_c_aux:w
@@ -2523,7 +2523,7 @@
           \prg_return_false:
         \fi:
       }
-    \cs_set:Npn \@@_if_exist_c_aux:w \fi: \use_none:n #1 \if_false:
+    \cs_gset:Npn \@@_if_exist_c_aux:w \fi: \use_none:n #1 \if_false:
       { \fi: \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: \else: }
   }
 %    \end{macrocode}
@@ -2533,7 +2533,7 @@
 % \begin{macro}[pTF, EXP]{\cs_if_free:N, \cs_if_free:c}
 %   The logical reversal of the above.
 %    \begin{macrocode}
-\prg_set_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF }
+\prg_gset_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF }
   {
     \if_cs_exist:N #1
     \else:
@@ -2547,7 +2547,7 @@
   }
 \cs_if_exist:NTF \tex_lastnamedcs:D
   {
-    \prg_set_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF }
+    \prg_gset_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF }
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_free_c_aux:w
@@ -2558,11 +2558,11 @@
           \prg_return_false:
         \fi:
       }
-    \cs_set:Npn \@@_if_free_c_aux:w \fi: \if_true:
+    \cs_gset:Npn \@@_if_free_c_aux:w \fi: \if_true:
       { \fi: \exp_after:wN \if_meaning:w \tex_lastnamedcs:D \scan_stop: }
   }
   {
-    \prg_set_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF }
+    \prg_gset_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF }
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_free_c_aux:w
@@ -2574,7 +2574,7 @@
           \prg_return_false:
         \fi:
       }
-    \cs_set:Npn \@@_if_free_c_aux:w \fi: \use_none:n #1 \if_true:
+    \cs_gset:Npn \@@_if_free_c_aux:w \fi: \use_none:n #1 \if_true:
       { \fi: \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop: }
   }
 %    \end{macrocode}
@@ -2591,49 +2591,49 @@
 %   sequence in the hash table if it does not exist.
 %   If available we use the \tn{lastnamedcs} primitive.
 %    \begin{macrocode}
-\cs_set:Npn \cs_if_exist_use:NTF #1#2
+\cs_gset:Npn \cs_if_exist_use:NTF #1#2
   { \cs_if_exist:NTF #1 { #1 #2 } }
-\cs_set:Npn \cs_if_exist_use:NF #1
+\cs_gset:Npn \cs_if_exist_use:NF #1
   { \cs_if_exist:NTF #1 #1 }
-\cs_set:Npn \cs_if_exist_use:NT #1 #2
+\cs_gset:Npn \cs_if_exist_use:NT #1 #2
   { \cs_if_exist:NT #1 { #1 #2 } }
-\cs_set:Npn \cs_if_exist_use:N #1
+\cs_gset:Npn \cs_if_exist_use:N #1
   { \cs_if_exist:NT #1 #1 }
 \cs_if_exist:NTF \tex_lastnamedcs:D
   {
-    \cs_set:Npn \cs_if_exist_use:cTF #1
+    \cs_gset:Npn \cs_if_exist_use:cTF #1
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_exist_use_aux:w
         \fi:
         \use_ii:nn
       }
-    \cs_set:Npn \@@_if_exist_use_aux:w \fi: \use_ii:nn
+    \cs_gset:Npn \@@_if_exist_use_aux:w \fi: \use_ii:nn
       { \fi: \exp_after:wN \@@_if_exist_use_aux:Nnn \tex_lastnamedcs:D }
   }
   {
-    \cs_set:Npn \cs_if_exist_use:cTF #1
+    \cs_gset:Npn \cs_if_exist_use:cTF #1
       {
         \if_cs_exist:w #1 \cs_end:
           \@@_if_exist_use_aux:w
         \fi:
         \use_iii:nnn {#1}
       }
-    \cs_set:Npn \@@_if_exist_use_aux:w \fi: \use_iii:nnn #1
+    \cs_gset:Npn \@@_if_exist_use_aux:w \fi: \use_iii:nnn #1
       { \fi: \exp_after:wN \@@_if_exist_use_aux:Nnn \cs:w #1 \cs_end: }
   }
-\cs_set:Npn \@@_if_exist_use_aux:Nnn #1#2
+\cs_gset:Npn \@@_if_exist_use_aux:Nnn #1#2
   {
     \if_meaning:w #1 \scan_stop:
       \exp_after:wN \use_iii:nnn
     \fi:
     \use_i:nn { #1 #2 }
   }
-\cs_set:Npn \cs_if_exist_use:cF #1
+\cs_gset:Npn \cs_if_exist_use:cF #1
   { \cs_if_exist_use:cTF {#1} {} }
-\cs_set:Npn \cs_if_exist_use:cT #1#2
+\cs_gset:Npn \cs_if_exist_use:cT #1#2
   { \cs_if_exist_use:cTF {#1} {#2} {} }
-\cs_set:Npn \cs_if_exist_use:c #1
+\cs_gset:Npn \cs_if_exist_use:c #1
   { \cs_if_exist_use:cTF {#1} {} {} }
 %    \end{macrocode}
 % \end{macro}
@@ -2659,7 +2659,7 @@
 %   a reasonable response.  Setting the \tn{newlinechar} is needed, to
 %   turn |^^J| into a proper line break in plain \TeX{}.
 %    \begin{macrocode}
-\cs_set_protected:Npn \msg_error:nnee #1#2#3#4
+\cs_gset_protected:Npn \msg_error:nnee #1#2#3#4
   {
     \tex_newlinechar:D = `\^^J \scan_stop:
     \tex_errmessage:D
@@ -2672,9 +2672,9 @@
       }
     \tex_end:D
   }
-\cs_set_protected:Npn \msg_error:nne #1#2#3
+\cs_gset_protected:Npn \msg_error:nne #1#2#3
   { \msg_error:nnee {#1} {#2} {#3} { } }
-\cs_set_protected:Npn \msg_error:nn #1#2
+\cs_gset_protected:Npn \msg_error:nn #1#2
   { \msg_error:nnee {#1} {#2} { } { } }
 %    \end{macrocode}
 % \end{macro}
@@ -2682,7 +2682,7 @@
 % \begin{macro}[rEXP]{\msg_line_context:}
 %   Another one from \pkg{l3msg} which will be altered later.
 %    \begin{macrocode}
-\cs_set:Npn \msg_line_context:
+\cs_gset:Npn \msg_line_context:
   { on~line~ \tex_the:D \tex_inputlineno:D }
 %    \end{macrocode}
 % \end{macro}
@@ -2692,9 +2692,9 @@
 %    similar one for writing to both the log file and the terminal.
 %    These will be redefined later by \pkg{l3file}.
 %    \begin{macrocode}
-\cs_set_protected:Npn \iow_log:e
+\cs_gset_protected:Npn \iow_log:e
   { \tex_immediate:D \tex_write:D -1 }
-\cs_set_protected:Npn \iow_term:e
+\cs_gset_protected:Npn \iow_term:e
   { \tex_immediate:D \tex_write:D 16 }
 %    \end{macrocode}
 % \end{macro}
@@ -2708,7 +2708,7 @@
 %   issued. We have to make sure we don't put the argument into the
 %   conditional processing since it may be an |\if...| type function!
 %    \begin{macrocode}
-\cs_set_protected:Npn \__kernel_chk_if_free_cs:N #1
+\cs_gset_protected:Npn \__kernel_chk_if_free_cs:N #1
   {
     \cs_if_free:NF #1
       {
@@ -2716,7 +2716,7 @@
           { \token_to_str:N #1 } { \token_to_meaning:N #1 }
       }
   }
-\cs_set_protected:Npn \__kernel_chk_if_free_cs:c
+\cs_gset_protected:Npn \__kernel_chk_if_free_cs:c
   { \exp_args:Nc \__kernel_chk_if_free_cs:N }
 %    \end{macrocode}
 % \end{macro}
@@ -2740,7 +2740,7 @@
 %     \begin{macrocode}
 \cs_set:Npn \@@_tmp:w #1#2
   {
-    \cs_set_protected:Npn #1 ##1
+    \cs_gset_protected:Npn #1 ##1
       {
         \__kernel_chk_if_free_cs:N ##1
         #2 ##1
@@ -2940,7 +2940,7 @@
 %   the functions use here are not defined yet, but will be defined
 %   before this function is called.
 %    \begin{macrocode}
-\cs_set_protected:Npn \__kernel_cs_parm_from_arg_count:nnF #1#2
+\cs_new_protected:Npn \__kernel_cs_parm_from_arg_count:nnF #1#2
   {
     \exp_args:Ne \@@_parm_from_arg_count_test:nnF
       {
@@ -2961,7 +2961,7 @@
       }
       {#1}
   }
-\cs_set_protected:Npn \@@_parm_from_arg_count_test:nnF #1#2
+\cs_new_protected:Npn \@@_parm_from_arg_count_test:nnF #1#2
   {
     \if_meaning:w \c_false_bool #1
       \exp_after:wN \use_ii:nn
diff --git a/l3kernel/l3bootstrap.dtx b/l3kernel/l3bootstrap.dtx
index 9583f2548..16aab167a 100644
--- a/l3kernel/l3bootstrap.dtx
+++ b/l3kernel/l3bootstrap.dtx
@@ -302,7 +302,7 @@ Type  H <return>  for immediate help}\def~{\errmessage{%
 % \begin{variable}{\l_@@_expl_bool}
 %   The status for code syntax: this is on at present.
 %    \begin{macrocode}
-\chardef\l_@@_expl_bool = 1\relax
+\global\chardef\l_@@_expl_bool = 1\relax
 %    \end{macrocode}
 %\end{variable}
 %
diff --git a/l3kernel/l3coffins.dtx b/l3kernel/l3coffins.dtx
index 8ba7b27aa..14a91e991 100644
--- a/l3kernel/l3coffins.dtx
+++ b/l3kernel/l3coffins.dtx
@@ -1302,7 +1302,7 @@
 %     y = s ( x - a ) + b
 %   \]
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_calculate_intersection:nnnnnn #1#2#3#4#5#6
+\cs_new_protected:Npn \@@_calculate_intersection:nnnnnn #1#2#3#4#5#6
   {
     \fp_compare:nNnTF {#1} = {#2}
       { \bool_set_true:N \l_@@_error_bool }
diff --git a/l3kernel/l3deprecation.dtx b/l3kernel/l3deprecation.dtx
index 25dd05fb0..5f7eadd93 100644
--- a/l3kernel/l3deprecation.dtx
+++ b/l3kernel/l3deprecation.dtx
@@ -300,13 +300,13 @@
 %   too long.
 %    \begin{macrocode}
 %\__kernel_patch_deprecation:nnNNpn { 2024-01-10 } { \keys_set_exclude_groups:nnn }
-\cs_set_protected:Npn \keys_set_filter:nnn { \keys_set_exclude_groups:nnn }
+\cs_new_protected:Npn \keys_set_filter:nnn { \keys_set_exclude_groups:nnn }
 \cs_generate_variant:Nn \keys_set_filter:nnn { nnV , nnv , nno }
 %\__kernel_patch_deprecation:nnNNpn { 2024-01-10 } { \keys_set_exclude_groups:nnnN }
-\cs_set_protected:Npn  \keys_set_filter:nnnN { \keys_set_exclude_groups:nnnN }
+\cs_new_protected:Npn  \keys_set_filter:nnnN { \keys_set_exclude_groups:nnnN }
 \cs_generate_variant:Nn \keys_set_filter:nnnN { nnV , nnv , nno }
 %\__kernel_patch_deprecation:nnNNpn { 2024-01-10 } { \keys_set_exclude_groups:nnnnN }
-\cs_set_protected:Npn  \keys_set_filter:nnnnN { \keys_set_exclude_groups:nnnnN }
+\cs_new_protected:Npn  \keys_set_filter:nnnnN { \keys_set_exclude_groups:nnnnN }
 \cs_generate_variant:Nn \keys_set_filter:nnnnN { nnV , nnv , nno }
 %    \end{macrocode}
 % \end{macro}
diff --git a/l3kernel/l3int.dtx b/l3kernel/l3int.dtx
index 0eacdb25e..7a5ebbe56 100644
--- a/l3kernel/l3int.dtx
+++ b/l3kernel/l3int.dtx
@@ -1215,7 +1215,7 @@
   }
 \cs_new:Npn \@@_abs:N #1
   { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
-\cs_set:Npn \int_max:nn #1#2
+\cs_new:Npn \int_max:nn #1#2
   {
     \int_value:w \exp_after:wN \@@_maxmin:wwN
       \int_value:w \@@_eval:w #1 \exp_after:wN ;
@@ -1223,7 +1223,7 @@
       >
     \exp_stop_f:
   }
-\cs_set:Npn \int_min:nn #1#2
+\cs_new:Npn \int_min:nn #1#2
   {
     \int_value:w \exp_after:wN \@@_maxmin:wwN
       \int_value:w \@@_eval:w #1 \exp_after:wN ;
@@ -1395,10 +1395,10 @@
     \cs_if_exist:NTF \tex_omathchardef:D
       { \cs_new_eq:NN \@@_constdef:Nw \tex_omathchardef:D }
       { \cs_new_eq:NN \@@_constdef:Nw \tex_chardef:D }
-    \@@_constdef:Nw \c_@@_max_constdef_int 1114111 ~
+    \tex_global:D \@@_constdef:Nw \c_@@_max_constdef_int 1114111 ~
 \else:
   \cs_new_eq:NN \@@_constdef:Nw \tex_mathchardef:D
-  \tex_mathchardef:D \c_@@_max_constdef_int 32767 ~
+  \tex_global:D \@@_constdef:Nw \c_@@_max_constdef_int 32767 ~
 \fi:
 %    \end{macrocode}
 % \end{variable}
diff --git a/l3kernel/l3luatex.dtx b/l3kernel/l3luatex.dtx
index f112b9921..49d6d6624 100644
--- a/l3kernel/l3luatex.dtx
+++ b/l3kernel/l3luatex.dtx
@@ -267,7 +267,7 @@
         \lua_now:n , \lua_now:e
       }
       {
-        \cs_set:Npn #1 ##1
+        \cs_gset:Npn #1 ##1
           {
             \msg_expandable_error:nnn
               { luatex } { luatex-required } { #1 }
@@ -276,7 +276,7 @@
     \clist_map_inline:nn
       { \lua_shipout_e:n , \lua_shipout:n, \lua_load_module:n }
       {
-        \cs_set_protected:Npn #1 ##1
+        \cs_gset_protected:Npn #1 ##1
           {
             \msg_error:nnn
               { luatex } { luatex-required } { #1 }
diff --git a/l3kernel/l3regex.dtx b/l3kernel/l3regex.dtx
index 428870c45..ffa7bd6e6 100644
--- a/l3kernel/l3regex.dtx
+++ b/l3kernel/l3regex.dtx
@@ -4155,7 +4155,7 @@
 %   incorrect). That's clunky, but not too expensive, since it's only
 %   one test.
 %    \begin{macrocode}
-\cs_set:Npn \@@_show_class:NnnnN #1#2#3#4#5
+\cs_new:Npn \@@_show_class:NnnnN #1#2#3#4#5
   {
     \group_begin:
       \tl_build_begin:N \l_@@_build_tl
diff --git a/l3kernel/l3text.dtx b/l3kernel/l3text.dtx
index bdbd7c8d2..f6fb2d9c1 100644
--- a/l3kernel/l3text.dtx
+++ b/l3kernel/l3text.dtx
@@ -889,12 +889,12 @@
 %   {\c_@@_chardef_group_end_token, \c_@@_mathchardef_group_end_token}
 %   Markers for implict char handling.
 %    \begin{macrocode}
-\tex_chardef:D \c_@@_chardef_space_token = `\  %
-\tex_mathchardef:D \c_@@_mathchardef_space_token = `\  %
-\tex_chardef:D \c_@@_chardef_group_begin_token = `\{ % `\}
-\tex_mathchardef:D \c_@@_mathchardef_group_begin_token = `\{ % `\} `\{
-\tex_chardef:D \c_@@_chardef_group_end_token = `\} % `\{
-\tex_mathchardef:D \c_@@_mathchardef_group_end_token = `\} %
+\tex_global:D \tex_chardef:D \c_@@_chardef_space_token = `\  %
+\tex_global:D \tex_mathchardef:D \c_@@_mathchardef_space_token = `\  %
+\tex_global:D \tex_chardef:D \c_@@_chardef_group_begin_token = `\{ % `\}
+\tex_global:D \tex_mathchardef:D \c_@@_mathchardef_group_begin_token = `\{ % `\} `\{
+\tex_global:D \tex_chardef:D \c_@@_chardef_group_end_token = `\} % `\{
+\tex_global:D \tex_mathchardef:D \c_@@_mathchardef_group_end_token = `\} %
 %    \end{macrocode}
 % \end{variable}
 % \end{variable}
diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index b11e4859d..84d7036e7 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -2376,7 +2376,7 @@ end
       }
   }
   {
-    \tex_chardef:D \c_@@_A_int = `A ~ %
+    \tex_global:D \tex_chardef:D \c_@@_A_int = `A ~ %
     \use:e
       {
         \prg_new_conditional:Npnn \exp_not:N \token_if_primitive:N #1





More information about the latex3-commits mailing list.