summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3keys.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3keys.dtx53
1 files changed, 36 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
index e5770e48c2b..d8745a856f5 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3keys.dtx 5665 2015-07-15 06:13:22Z joseph $
+\GetIdInfo$Id: l3keys.dtx 5684 2015-07-26 07:23:48Z joseph $
{L3 Key-value interfaces}
%</driver|package>
%<*driver>
@@ -158,7 +158,7 @@
% \keys_define:nn { mymodule }
% {
% keyname .code:n = Some~code~using~#1,
-% keyname .value_required:
+% keyname .value_required:n = true
% }
% \end{verbatim}
% where the properties of the key begin from the |.| after the key
@@ -1314,7 +1314,9 @@
% |\cs_set_protected:cpn| not |\cs_new_protected:cpn| here. For the
% same reason, to avoid issues if the key has been undefined in the
% current scope but exists at a higher level, we do not use \cs{prop_new:c}
-% but rather \cs{prop_set_eq:cN}.
+% but rather \cs{prop_set_eq:cN}. The use of \cs{__chk_if_free_cs:c}
+% ensures that when logging of all new functions is active, keys
+% still show up (as we are not using \cs{..._new}).
% \begin{macrocode}
\cs_new_protected:Npn \@@_ensure_exist:n #1
{
@@ -1324,6 +1326,7 @@
}
\cs_if_exist:cF { \c_@@_code_root_tl #1 }
{
+ \__chk_if_free_cs:c { \c_@@_code_root_tl #1 }
\cs_set_protected:cpn { \c_@@_code_root_tl #1 } ##1 { }
}
}
@@ -1485,7 +1488,7 @@
\cs_new_protected:Npn \@@_default_set:n #1
{
\@@_ensure_exist:V \l_keys_path_tl
- \tl_if_blank:nTF {#1}
+ \tl_if_empty:nTF {#1}
{
\prop_remove:cn { \c_@@_info_root_tl \l_keys_path_tl }
{ default }
@@ -1875,7 +1878,7 @@
% \end{macro}
%
% \begin{macro}{.undefine:}
-% TAnother simple wrapper.
+% Another simple wrapper.
% \begin{macrocode}
\cs_new_protected_nopar:cpn { \c_@@_props_root_tl .undefine: }
{ \@@_undefine: }
@@ -2010,8 +2013,8 @@
% \end{macro}
%
% \begin{macro}[int]{\@@_set_elt:n, \@@_set_elt:nn}
-% \begin{macro}[aux]{\@@_set_elt_aux:nn}
-% \begin{macro}[aux, EXP]{\@@_key_find:w}
+% \begin{macro}[aux]{\@@_set_elt_aux:nnn, \@@_set_elt_aux:onn}
+% \begin{macro}[aux]{\@@_find_key_module:w}
% \begin{macro}[aux]{\@@_set_elt_aux:, \@@_set_elt_selective:}
% A shared system once again. First, set the current path and add a
% default if needed. There are then checks to see if the a value is
@@ -2021,28 +2024,44 @@
\cs_new_protected:Npn \@@_set_elt:n #1
{
\bool_set_true:N \l_@@_no_value_bool
- \@@_set_elt_aux:nn {#1} { }
+ \@@_set_elt_aux:onn \l_@@_module_tl {#1} { }
}
\cs_new_protected:Npn \@@_set_elt:nn #1#2
{
\bool_set_false:N \l_@@_no_value_bool
- \@@_set_elt_aux:nn {#1} {#2}
+ \@@_set_elt_aux:onn \l_@@_module_tl {#1} {#2}
}
-\cs_new_protected:Npn \@@_set_elt_aux:nn #1#2
+% \end{macrocode}
+% The key path here can be fully defined, after which there is a search
+% for the key and module names: the user may have passed them with part
+% of what is actually the module (for our purposes) in the key name. As
+% that happens on a per-key basis, we use the stack approach to restore
+% the module name without a group.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_elt_aux:nnn #1#2#3
{
- \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / \tl_to_str:n {#1} }
- \tl_set:Nx \l_keys_key_tl
- { \exp_after:wN \@@_key_find:w \l_keys_path_tl / \q_stop }
- \@@_value_or_default:n {#2}
+ \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / \tl_to_str:n {#2} }
+ \tl_clear:N \l_@@_module_tl
+ \exp_after:wN \@@_find_key_module:w \l_keys_path_tl / \q_stop
+ \@@_value_or_default:n {#3}
\bool_if:NTF \l_@@_selective_bool
{ \@@_set_elt_selective: }
{ \@@_set_elt_aux: }
+ \tl_set:Nn \l_@@_module_tl {#1}
}
-\cs_new:Npn \@@_key_find:w #1 / #2 \q_stop
+\cs_generate_variant:Nn \@@_set_elt_aux:nnn { o }
+\cs_new_protected:Npn \@@_find_key_module:w #1 / #2 \q_stop
{
\tl_if_blank:nTF {#2}
- { #1 }
- { \@@_key_find:w #2 \q_stop }
+ { \tl_set:Nn \l_keys_key_tl {#1} }
+ {
+ \tl_put_right:Nx \l_@@_module_tl
+ {
+ \tl_if_empty:NF \l_@@_module_tl { / }
+ #1
+ }
+ \@@_find_key_module:w #2 \q_stop
+ }
}
\cs_new_protected_nopar:Npn \@@_set_elt_aux:
{