[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Use local copy of \keys_precompile:nnN at present (c73ac5a7)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Mar 10 15:32:12 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/c73ac5a77026e65bb7526efda7c2c287df532216
>---------------------------------------------------------------
commit c73ac5a77026e65bb7526efda7c2c287df532216
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Mar 8 22:16:09 2022 +0000
Use local copy of \keys_precompile:nnN at present
This commit
- Adds the necessary patching for l3keys
- Updates the interface to \keys_precompile:nnN
- Removes the texmf version of the precompile code
The debiug code is not covered, but that should make
minimal difference in practice.
>---------------------------------------------------------------
c73ac5a77026e65bb7526efda7c2c287df532216
required/latex-lab/latex-lab-prototype.dtx | 155 +++++++++++++++++++++++++++--
texmf/tex/latex/l3kernel/expl3-code.tex | 78 ++-------------
texmf/tex/latex/l3kernel/l3debug.def | 2 +-
3 files changed, 158 insertions(+), 77 deletions(-)
diff --git a/required/latex-lab/latex-lab-prototype.dtx b/required/latex-lab/latex-lab-prototype.dtx
index eebd4666..1269ad77 100644
--- a/required/latex-lab/latex-lab-prototype.dtx
+++ b/required/latex-lab/latex-lab-prototype.dtx
@@ -45,7 +45,7 @@
% }^^A
% }
%
-% \date{Released 2022-01-12}
+% \date{Released 2022-03-09}
%
% \maketitle
%
@@ -325,7 +325,7 @@
% \begin{macrocode}
%<*package>
\ProvidesFile{latex-lab-prototype.sty}
- [2022-03-08 v0.1a Experimental prototype document functions]
+ [2022-03-09 v0.1b Experimental prototype document functions]
%</package>
% \end{macrocode}
%
@@ -334,15 +334,147 @@
% \end{macrocode}
%
% \begin{macrocode}
-%<@@=prototype>
+\ExplSyntaxOn
% \end{macrocode}
%
+% \subsection{\cs{keys_precompile:nnN}}
+%
% \begin{macrocode}
-\ExplSyntaxOn
+%<@@=keys>
+% \end{macrocode}
+%
+% This may not yet be available in \pkg{expl3} so we ensure it is set up
+% here: all temporary. We just redefine those internals that need it.
+% \begin{macrocode}
+\tl_if_exist:NF \l_@@_precompile_tl
+ {
+ \bool_new:N \l_@@_precompile_bool
+ \tl_new:N \l_@@_precompile_tl
+ }
+\cs_gset_protected:Npn \@@_precompile:n #1
+ {
+ \bool_if:NTF \l_@@_precompile_bool
+ { \tl_put_right:Nn \l_@@_precompile_tl }
+ { \use:n }
+ {#1}
+ }
+\cs_gset_protected:Npn \@@_bool_set:Nnnn #1#2#3#4
+ {
+ \bool_if_exist:NF #1 { \bool_new:N #1 }
+ \@@_choice_make:
+ \@@_cmd_set:nx { \l_keys_path_str / true }
+ { \exp_not:c { bool_ #2 set_ #3 :N } \exp_not:N #1 }
+ \@@_cmd_set:nx { \l_keys_path_str / false }
+ { \exp_not:c { bool_ #2 set_ #4 :N } \exp_not:N #1 }
+ \@@_cmd_set_direct:nn { \l_keys_path_str / unknown }
+ {
+ \msg_error:nnx { keys } { boolean-values-only }
+ \l_keys_key_str
+ }
+ \@@_default_set:n { true }
+ }
+\cs_gset_protected:Npn \@@_choice_make_aux:N #1
+ {
+ \cs_set_nopar:cpn { \c_@@_type_root_str \l_keys_path_str }
+ { choice }
+ \@@_cmd_set_direct:nn \l_keys_path_str { #1 {##1} }
+ \@@_cmd_set_direct:nn { \l_keys_path_str / unknown }
+ {
+ \msg_error:nnxx { keys } { choice-unknown }
+ \l_keys_path_str {##1}
+ }
+ }
+\cs_gset_protected:Npn \@@_cmd_set:nn #1#2
+ { \@@_cmd_set_direct:nn {#1} { \@@_precompile:n {#2} } }
+\cs_gset_protected:Npn \@@_cmd_set_direct:nn #1#2
+ { \cs_set_protected:cpn { \c_@@_code_root_str #1 } ##1 {#2} }
+\cs_gset_protected:Npn \@@_cs_set:NNpn #1#2#3#
+ {
+ \cs_set_protected:cpx { \c_@@_code_root_str \l_keys_path_str } ##1
+ {
+ \@@_precompile:n
+ { #1 \exp_not:N #2 \exp_not:n {#3} {##1} }
+ }
+ \use_none:n
+ }
+\cs_gset_protected:Npn \@@_meta_make:n #1
+ {
+ \exp_args:NVo \@@_cmd_set_direct:nn \l_keys_path_str
+ {
+ \exp_after:wN \keys_set:nn \exp_after:wN
+ { \l_@@_module_str } {#1}
+ }
+ }
+\cs_gset_protected:Npn \@@_meta_make:nn #1#2
+ {
+ \exp_args:NV \@@_cmd_set_direct:nn
+ \l_keys_path_str { \keys_set:nn {#1} {#2} }
+ }
+\cs_gset_protected:Npn \keys_precompile:nnN #1#2#3
+ {
+ \bool_set_true:N \l_@@_precompile_bool
+ \tl_clear:N \l_@@_precompile_tl
+ \keys_set:nn {#1} {#2}
+ \bool_set_false:N \l_@@_precompile_bool
+ \tl_set_eq:NN #3 \l_@@_precompile_tl
+ }
+\cs_gset_protected:Npn \@@_show:Nnn #1#2#3
+ {
+ #1 { keys } { show-key }
+ { \@@_trim_spaces:n { #2 / #3 } }
+ {
+ \keys_if_exist:nnT {#2} {#3}
+ {
+ \exp_args:Nnf \msg_show_item_unbraced:nn { code }
+ {
+ \exp_args:Ne \@@_show:n
+ {
+ \exp_args:Nc \cs_replacement_spec:N
+ {
+ \c_@@_code_root_str
+ \@@_trim_spaces:n { #2 / #3 }
+ }
+ }
+ }
+ }
+ }
+ { } { }
+ }
+\cs_gset:Npx \@@_show:n #1
+ {
+ \exp_not:N \@@_show:w
+ #1
+ \tl_to_str:n { \@@_precompile:n }
+ #1
+ \tl_to_str:n { \@@_precompile:n }
+ \exp_not:N \s_@@_stop
+ }
+\use:x
+ {
+ \cs_gset:Npn \exp_not:N \@@_show:w
+ ##1 \tl_to_str:n { \@@_precompile:n }
+ ##2 \tl_to_str:n { \@@_precompile:n }
+ ##3 \exp_not:N \s_@@_stop
+ }
+ {
+ \tl_if_blank:nTF {#2}
+ {#1}
+ { \@@_show:Nw #2 \s_@@_stop }
+ }
+\use:x
+ {
+ \cs_gset:Npn \exp_not:N \@@_show:Nw ##1##2
+ \c_right_brace_str \exp_not:N \s_@@_stop
+ }
+ {#2}
% \end{macrocode}
%
% \subsection{Setup}
%
+% \begin{macrocode}
+%<@@=prototype>
+% \end{macrocode}
+%
% \begin{variable}{\l_@@_tmp_tl}
% \begin{macrocode}
\tl_new:N \l_@@_tmp_tl
@@ -425,7 +557,7 @@
% \end{macro}
%
% \begin{macrocode}
-\cs_generate_variant:Nn \keys_precompile:Nnn { Nnv }
+\cs_generate_variant:Nn \keys_precompile:nnN { v , nv }
% \end{macrocode}
%
% \begin{macro}{\prototype_use_template:nnn}
@@ -457,10 +589,11 @@
{
\cs_if_exist:cTF { @@_template_ #1 _ #2 :w }
{
- \keys_precompile:Nnv \l_@@_assignments_tl
+ \keys_precompile:nvN
{ prototype / #1 / #2 }
{ l_@@_defaults_ #1 _ #2 _tl }
- \keys_precompile:Nnn \l_@@_tmp_tl { prototype / #1 / #2 } {#3}
+ \l_@@_assignments_tl
+ \keys_precompile:nnN { prototype / #1 / #2 } {#3} \l_@@_tmp_tl
\tl_put_right:NV \l_@@_assignments_tl \l_@@_tmp_tl
#4
}
@@ -486,12 +619,16 @@
\tl_if_blank:nF {#3}
{
\tl_set:Nx \l_@@_tmp_tl
+ {
+
+ }
+ \keys_precompile:vnN
{
prototype / #1 /
\tl_use:c { l_@@_instance_ #1 _ #2 _template_tl }
}
- \exp_args:NNV \keys_precompile:Nnn
- \l_@@_tmp_tl \l_@@_tmp_tl {#3}
+ {#3}
+ \l_@@_tmp_tl
\tl_put_right:NV \l_@@_assignments_tl
\l_@@_tmp_tl
}
diff --git a/texmf/tex/latex/l3kernel/expl3-code.tex b/texmf/tex/latex/l3kernel/expl3-code.tex
index 62f18c42..3904ec54 100644
--- a/texmf/tex/latex/l3kernel/expl3-code.tex
+++ b/texmf/tex/latex/l3kernel/expl3-code.tex
@@ -13036,8 +13036,6 @@ Type H <return> for immediate help}\def~{\errmessage{%
\bool_new:N \l__keys_tmp_bool
\tl_new:N \l__keys_tmpa_tl
\tl_new:N \l__keys_tmpb_tl
-\bool_new:N \l__keys_precompile_bool
-\tl_new:N \l__keys_precompile_tl
\prop_new:N \l_keys_usage_load_prop
\prop_new:N \l_keys_usage_preamble_prop
\scan_new:N \s__keys_nil
@@ -13045,13 +13043,6 @@ Type H <return> for immediate help}\def~{\errmessage{%
\scan_new:N \s__keys_stop
\quark_new:N \q__keys_no_value
\__kernel_quark_new_conditional:Nn \__keys_quark_if_no_value:N { TF }
-\cs_new_protected:Npn \__keys_precompile:n #1
- {
- \bool_if:NTF \l__keys_precompile_bool
- { \tl_put_right:Nn \l__keys_precompile_tl }
- { \use:n }
- {#1}
- }
\cs_new_protected:Npn \keys_define:nn
{ \__keys_define:onn \l__keys_module_str }
\cs_new_protected:Npn \__keys_define:nnn #1#2#3
@@ -13155,7 +13146,7 @@ Type H <return> for immediate help}\def~{\errmessage{%
{ \exp_not:c { bool_ #2 set_ #3 :N } \exp_not:N #1 }
\__keys_cmd_set:nx { \l_keys_path_str / false }
{ \exp_not:c { bool_ #2 set_ #4 :N } \exp_not:N #1 }
- \__keys_cmd_set_direct:nn { \l_keys_path_str / unknown }
+ \__keys_cmd_set:nn { \l_keys_path_str / unknown }
{
\msg_error:nnx { keys } { boolean-values-only }
\l_keys_key_str
@@ -13187,8 +13178,8 @@ Type H <return> for immediate help}\def~{\errmessage{%
{
\cs_set_nopar:cpn { \c__keys_type_root_str \l_keys_path_str }
{ choice }
- \__keys_cmd_set_direct:nn \l_keys_path_str { #1 {##1} }
- \__keys_cmd_set_direct:nn { \l_keys_path_str / unknown }
+ \__keys_cmd_set:nn \l_keys_path_str { #1 {##1} }
+ \__keys_cmd_set:nn { \l_keys_path_str / unknown }
{
\msg_error:nnxx { keys } { choice-unknown }
\l_keys_path_str {##1}
@@ -13216,17 +13207,12 @@ Type H <return> for immediate help}\def~{\errmessage{%
}
}
\cs_new_protected:Npn \__keys_cmd_set:nn #1#2
- { \__keys_cmd_set_direct:nn {#1} { \__keys_precompile:n {#2} } }
-\cs_generate_variant:Nn \__keys_cmd_set:nn { nx , Vn , Vo }
-\cs_new_protected:Npn \__keys_cmd_set_direct:nn #1#2
{ \cs_set_protected:cpn { \c__keys_code_root_str #1 } ##1 {#2} }
+\cs_generate_variant:Nn \__keys_cmd_set:nn { nx , Vn , Vo }
\cs_new_protected:Npn \__keys_cs_set:NNpn #1#2#3#
{
\cs_set_protected:cpx { \c__keys_code_root_str \l_keys_path_str } ##1
- {
- \__keys_precompile:n
- { #1 \exp_not:N #2 \exp_not:n {#3} {##1} }
- }
+ { #1 \exp_not:N #2 \exp_not:n {#3} {##1} }
\use_none:n
}
\cs_generate_variant:Nn \__keys_cs_set:NNpn { Nc }
@@ -13299,17 +13285,13 @@ Type H <return> for immediate help}\def~{\errmessage{%
}
\cs_new_protected:Npn \__keys_meta_make:n #1
{
- \exp_args:NVo \__keys_cmd_set_direct:nn \l_keys_path_str
+ \__keys_cmd_set:Vo \l_keys_path_str
{
- \exp_after:wN \keys_set:nn \exp_after:wN
- { \l__keys_module_str } {#1}
+ \exp_after:wN \keys_set:nn \exp_after:wN { \l__keys_module_str } {#1}
}
}
\cs_new_protected:Npn \__keys_meta_make:nn #1#2
- {
- \exp_args:NV \__keys_cmd_set_direct:nn
- \l_keys_path_str { \keys_set:nn {#1} {#2} }
- }
+ { \__keys_cmd_set:Vn \l_keys_path_str { \keys_set:nn {#1} {#2} } }
\cs_new_protected:Npn \__keys_prop_put:Nn #1#2
{
\prop_if_exist:NF #1 { \prop_new:N #1 }
@@ -13766,14 +13748,6 @@ Type H <return> for immediate help}\def~{\errmessage{%
\__keys_set:nn {#2} {#4}
\tl_set:Nn \l__keys_selective_seq {#1}
}
-\cs_new_protected:Npn \keys_precompile:Nnn #1#2#3
- {
- \bool_set_true:N \l__keys_precompile_bool
- \tl_clear:N \l__keys_precompile_tl
- \keys_set:nn {#2} {#3}
- \bool_set_false:N \l__keys_precompile_bool
- \tl_set_eq:NN #1 \l__keys_precompile_tl
- }
\cs_new_protected:Npn \__keys_set_keyval:n #1
{
\bool_set_true:N \l__keys_no_value_bool
@@ -14114,46 +14088,16 @@ Type H <return> for immediate help}\def~{\errmessage{%
{
\exp_args:Nnf \msg_show_item_unbraced:nn { code }
{
- \exp_args:Ne \__keys_show:n
+ \exp_args:Nc \cs_replacement_spec:N
{
- \exp_args:Nc \cs_replacement_spec:N
- {
- \c__keys_code_root_str
- \__keys_trim_spaces:n { #2 / #3 }
- }
+ \c__keys_code_root_str
+ \__keys_trim_spaces:n { #2 / #3 }
}
}
}
}
{ } { }
}
-\cs_new:Npx \__keys_show:n #1
- {
- \exp_not:N \__keys_show:w
- #1
- \tl_to_str:n { \__keys_precompile:n }
- #1
- \tl_to_str:n { \__keys_precompile:n }
- \exp_not:N \s__keys_stop
- }
-\use:x
- {
- \cs_new:Npn \exp_not:N \__keys_show:w
- ##1 \tl_to_str:n { \__keys_precompile:n }
- ##2 \tl_to_str:n { \__keys_precompile:n }
- ##3 \exp_not:N \s__keys_stop
- }
- {
- \tl_if_blank:nTF {#2}
- {#1}
- { \__keys_show:Nw #2 \s__keys_stop }
- }
-\use:x
- {
- \cs_new:Npn \exp_not:N \__keys_show:Nw ##1##2
- \c_right_brace_str \exp_not:N \s__keys_stop
- }
- {#2}
\msg_new:nnnn { keys } { bad-relative-key-path }
{ The~key~'#1'~is~not~inside~the~'#2'~path. }
{ The~key~'#1'~cannot~be~expressed~relative~to~path~'#2'. }
diff --git a/texmf/tex/latex/l3kernel/l3debug.def b/texmf/tex/latex/l3kernel/l3debug.def
index 864ce5a0..7f90a7f9 100644
--- a/texmf/tex/latex/l3kernel/l3debug.def
+++ b/texmf/tex/latex/l3kernel/l3debug.def
@@ -624,7 +624,7 @@
{ \__kernel_debug_log:x { Defining~key~#1~\msg_line_context: } }
}
{ }
- { \__keys_cmd_set_direct:nn }
+ { \__keys_cmd_set:nn }
\__kernel_patch:nnn
{ }
{
More information about the latex3-commits
mailing list.