diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3keys.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 1008 |
1 files changed, 473 insertions, 535 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index e0becb45696..7e3cc783af2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3keys.dtx Copyright (C) 2006-2011 The LaTeX3 Project +%% File: l3keys.dtx Copyright (C) 2006-2012 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 @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 3487 2012-03-03 19:36:51Z bruno $ +\GetIdInfo$Id: l3keys.dtx 3986 2012-07-15 19:23:51Z joseph $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> @@ -170,27 +170,18 @@ % arbitrary \meta{key}, which when used may be supplied with a % \meta{value}. All key \emph{definitions} are local. % -% \begin{function}{.bool_set:N} +% \begin{function}{.bool_set:N, .bool_gset:N} % \begin{syntax} % \meta{key} .bool_set:N = \meta{boolean} % \end{syntax} % Defines \meta{key} to set \meta{boolean} to \meta{value} (which % must be either \texttt{true} or \texttt{false}). If the variable % does not exist, it will be created at the point that the key is -% set up. The \meta{boolean} will be assigned locally. +% set up. % \end{function} % -% \begin{function}{.bool_gset:N} -% \begin{syntax} -% \meta{key} .bool_gset:N = \meta{boolean} -% \end{syntax} -% Defines \meta{key} to set \meta{boolean} to \meta{value} (which -% must be either \texttt{true} or \texttt{false}). If the variable -% does not exist, it will be created at the point that the key is -% set up. The \meta{boolean} will be assigned globally. -% \end{function} -% -% \begin{function}[added = 2011-08-28]{.bool_set_inverse:N} +% \begin{function}[added = 2011-08-28] +% {.bool_set_inverse:N, .bool_gset_inverse:N} % \begin{syntax} % \meta{key} .bool_set_inverse:N = \meta{boolean} % \end{syntax} @@ -198,22 +189,7 @@ % inverse of \meta{value} (which must be either \texttt{true} or % \texttt{false}). % If the \meta{boolean} does not exist, it will be created at the point -% that the key is set up. The \meta{boolean} will be assigned locally. -% -% \textbf{This property is experimental.} -% \end{function} -% -% \begin{function}{.bool_gset_inverse:N} -% \begin{syntax} -% \meta{key} .bool_gset_inverse:N = \meta{boolean} -% \end{syntax} -% Defines \meta{key} to set \meta{boolean} to the logical -% inverse of \meta{value} (which must be either \texttt{true} or -% \texttt{false}). -% If the \meta{boolean} does not exist, it will be created at the point -% that the key is set up. The \meta{boolean} will be assigned globally. -% -% \textbf{This property is experimental.} +% that the key is set up. % \end{function} % % \begin{function}{.choice:} @@ -233,10 +209,8 @@ % which are implemented using the \meta{code}. Inside \meta{code}, % \cs{l_keys_choice_tl} will be the name of the choice made, and % \cs{l_keys_choice_int} will be the position of the choice in the list -% of \meta{choices} (indexed from $0$). +% of \meta{choices} (indexed from~$1$). % Choices are discussed in detail in section~\ref{sec:choice}. -% -% \textbf{This property is experimental.} % \end{function} % % \begin{function}{.choice_code:n, .choice_code:x} @@ -251,21 +225,12 @@ % detail in section~\ref{sec:choice}. % \end{function} % -% \begin{function}[added=2011/09/11]{.clist_set:N, .clist_set:c} +% \begin{function}[added=2011/09/11] +% {.clist_set:N, .clist_set:c, .clist_gset:N, .clist_gset:c} % \begin{syntax} % \meta{key} .clist_set:N = \meta{comma list variable} % \end{syntax} -% Defines \meta{key} to locally set \meta{comma list variable} to \meta{value}. -% Spaces around commas and empty items will be stripped. -% If the variable does not exist, it -% will be created at the point that the key is set up. -% \end{function} -% -% \begin{function}[added=2011/09/11]{.clist_gset:N, .clist_gset:c} -% \begin{syntax} -% \meta{key} .clist_gset:N = \meta{comma list variable} -% \end{syntax} -% Defines \meta{key} to globally set \meta{comma list variable} to \meta{value}. +% Defines \meta{key} to set \meta{comma list variable} to \meta{value}. % Spaces around commas and empty items will be stripped. % If the variable does not exist, it % will be created at the point that the key is set up. @@ -304,44 +269,22 @@ % \end{verbatim} % \end{function} % -% \begin{function}{.dim_set:N, .dim_set:c} +% \begin{function}{.dim_set:N, .dim_set:c, .dim_gset:N, .dim_gset:c} % \begin{syntax} % \meta{key} .dim_set:N = \meta{dimension} % \end{syntax} % Defines \meta{key} to set \meta{dimension} to \meta{value} (which % must a dimension expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{dimension} will be assigned locally. -% \end{function} -% -% \begin{function}{.dim_gset:N, .dim_gset:c} -% \begin{syntax} -% \meta{key} .dim_gset:N = \meta{dimension} -% \end{syntax} -% Defines \meta{key} to set \meta{dimension} to \meta{value} (which -% must a dimension expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{dimension} will be assigned globally. +% will be created at the point that the key is set up. % \end{function} % -% \begin{function}{.fp_set:N, .fp_set:c} +% \begin{function}{.fp_set:N, .fp_set:c, .fp_gset:N, .fp_gset:c} % \begin{syntax} % \meta{key} .fp_set:N = \meta{floating point} % \end{syntax} % Defines \meta{key} to set \meta{floating point} to \meta{value} % (which must a floating point number). If the variable does not exist, -% it will be created at the point that the key is set up. The -% \meta{integer} will be assigned locally. -% \end{function} -% -% \begin{function}{.fp_gset:N, .fp_gset:c} -% \begin{syntax} -% \meta{key} .fp_gset:N = \meta{floating point} -% \end{syntax} -% Defines \meta{key} to set \meta{floating-point} to \meta{value} -% (which must a floating point number). If the variable does not exist, -% it will be created at the point that the key is set up. The -% \meta{integer} will be assigned globally. +% it will be created at the point that the key is set up. % \end{function} % % \begin{function}{.generate_choices:n} @@ -355,25 +298,24 @@ % \texttt{.choice_code:n} (or \texttt{.choice_code:x}). Choices are % discussed in detail in section~\ref{sec:choice}. % \end{function} -% -% \begin{function}{.int_set:N, .int_set:c} +% +% \begin{function}[added = 2012-06-02]{.initial:n, .initial:V} % \begin{syntax} -% \meta{key} .int_set:N = \meta{integer} +% \meta{key} .initial:n = \meta{value} % \end{syntax} -% Defines \meta{key} to set \meta{integer} to \meta{value} (which -% must be an integer expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{integer} will be assigned locally. +% Initialises the \meta{key} with the \meta{value}, equivalent to +% \begin{quote} +% \cs{keys_set:nn} \marg{module} \{ \meta{key} = \meta{value} \} +% \end{quote} % \end{function} % -% \begin{function}{.int_gset:N, .int_gset:c} +% \begin{function}{.int_set:N, .int_set:c, .int_gset:N, .int_gset:c} % \begin{syntax} -% \meta{key} .int_gset:N = \meta{integer} +% \meta{key} .int_set:N = \meta{integer} % \end{syntax} % Defines \meta{key} to set \meta{integer} to \meta{value} (which % must be an integer expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{integer} will be assigned globally. +% will be created at the point that the key is set up. % \end{function} % % \begin{function}{.meta:n, .meta:x} @@ -397,81 +339,47 @@ % \textbf{This property is experimental.} % \end{function} % -% \begin{function}[added = 2011-08-21]{.multichoice:nn} +% \begin{function}[added = 2011-08-21]{.multichoices:nn} % \begin{syntax} -% \meta{key} .multichoice:nn \meta{choices} \meta{code} +% \meta{key} .multichoices:nn \meta{choices} \meta{code} % \end{syntax} % Sets \meta{key} to act as a multiple choice key, and defines a series % \meta{choices} % which are implemented using the \meta{code}. Inside \meta{code}, % \cs{l_keys_choice_tl} will be the name of the choice made, and % \cs{l_keys_choice_int} will be the position of the choice in the list -% of \meta{choices} (indexed from $0$). +% of \meta{choices} (indexed from~$1$). % Choices are discussed in detail in section~\ref{sec:choice}. % % \textbf{This property is experimental.} % \end{function} % -% \begin{function}{.skip_set:N, .skip_set:c} +% \begin{function}{.skip_set:N, .skip_set:c, .skip_gset:N, .skip_gset:c} % \begin{syntax} % \meta{key} .skip_set:N = \meta{skip} % \end{syntax} % Defines \meta{key} to set \meta{skip} to \meta{value} (which % must be a skip expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{skip} will be assigned locally. -% \end{function} -% -% \begin{function}{.skip_gset:N, .skip_gset:c} -% \begin{syntax} -% \meta{key} .skip_gset:N = \meta{skip} -% \end{syntax} -% Defines \meta{key} to set \meta{skip} to \meta{value} (which -% must be a skip expression). If the variable does not exist, it -% will be created at the point that the key is set up. The -% \meta{skip} will be assigned globally. +% will be created at the point that the key is set up. % \end{function} % -% \begin{function}{.tl_set:N, .tl_set:c} +% \begin{function}{.tl_set:N, .tl_set:c, .tl_gset:N, .tl_gset:c} % \begin{syntax} % \meta{key} .tl_set:N = \meta{token list variable} % \end{syntax} % Defines \meta{key} to set \meta{token list variable} to \meta{value}. % If the variable does not exist, it will be created at the point that -% the key is set up. The \meta{token list variable} will be assigned -% locally. -% \end{function} -% -% \begin{function}{.tl_gset:N, .tl_gset:c} -% \begin{syntax} -% \meta{key} .tl_gset:N = \meta{token list variable} -% \end{syntax} -% Defines \meta{key} to set \meta{token list variable} to \meta{value}. -% If the variable does not exist, it will be created at the point that -% the key is set up. The \meta{token list variable} will be assigned -% globally. +% the key is set up. % \end{function} % -% \begin{function}{.tl_set_x:N, .tl_set_x:c} +% \begin{function}{.tl_set_x:N, .tl_set_x:c, .tl_gset_x:N, .tl_gset_x:c} % \begin{syntax} % \meta{key} .tl_set_x:N = \meta{token list variable} % \end{syntax} % Defines \meta{key} to set \meta{token list variable} to \meta{value}, % which will be subjected to an \texttt{x}-type expansion % (\emph{i.e.}~using \cs{tl_set:Nx}). If the variable does not exist, -% it will be created at the point that the key is set up. The -% \meta{token list variable} will be assigned locally. -% \end{function} -% -% \begin{function}{.tl_gset_x:N, .tl_gset_x:c} -% \begin{syntax} -% \meta{key} .tl_gset_x:N = \meta{token list variable} -% \end{syntax} -% Defines \meta{key} to set \meta{token list variable} to \meta{value}, -% which will be subjected to an \texttt{x}-type expansion -% (\emph{i.e.}~using \cs{tl_set:Nx}). If the variable does not exist, -% it will be created at the point that the key is set up. The -% \meta{token list variable} will be assigned globally. +% it will be created at the point that the key is set up. % \end{function} % % \begin{function}{.value_forbidden:} @@ -552,9 +460,7 @@ % } % \end{verbatim} % Following common computing practice, \cs{l_keys_choice_int} is -% indexed from $0$ (as an offset), so that the value of -% \cs{l_keys_choice_int} for the first choice in a list will be -% zero. +% indexed from~$1$. % % The same approach is also implemented by the \emph{experimental} % property \texttt{.choices:nn}. This combines the functionality of @@ -691,9 +597,6 @@ % % \section{Setting known keys only} % -% The functionality described in this section is experimental and may be -% altered or removed, depending on feedback. -% % \begin{function}[added = 2011-08-23] % { % \keys_set_known:nnN, \keys_set_known:nVN, @@ -720,7 +623,7 @@ % has been defined for \meta{key}. % \end{function} % -% \begin{function}[added = 2011-08-21,EXP,pTF]{\keys_if_choice_exist:nn} +% \begin{function}[added = 2011-08-21,EXP,pTF]{\keys_if_choice_exist:nnn} % \begin{syntax} % \cs{keys_if_choice_exist_p:nnn} \meta{module} \meta{key} \meta{choice} \\ % \cs{keys_if_choice_exist:nnnTF} \meta{module} \meta{key} \meta{choice} \Arg{true code} \Arg{false code} @@ -782,15 +685,15 @@ % % \begin{function}[updated = 2011-09-08]{\keyval_parse:NNn} % \begin{syntax} -% \cs{keyval_parse:NNn} \meta{function1} \meta{function2} \Arg{key--value list} +% \cs{keyval_parse:NNn} \meta{function_1} \meta{function_2} \Arg{key--value list} % \end{syntax} % Parses the \meta{key--value list} into a series of \meta{keys} and % associated \meta{values}, or keys alone (if no \meta{value} was -% given). \meta{function1} should take one argument, while -% \meta{function2} should absorb two arguments. After +% given). \meta{function_1} should take one argument, while +% \meta{function_2} should absorb two arguments. After % \cs{keyval_parse:NNn} has parsed the \meta{key--value list}, -% \meta{function1} will be used to process keys given with no value -% and \meta{function2} will be used to process keys given with a +% \meta{function_1} will be used to process keys given with no value +% and \meta{function_2} will be used to process keys given with a % value. The order of the \meta{keys} in the \meta{key--value list} % will be preserved. Thus % \begin{verbatim} @@ -825,41 +728,43 @@ %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\package_check_loaded_expl: +\__expl_package_check: %</package> % \end{macrocode} % % \subsection{Low-level interface} +% +%<@@=keyval> % % For historical reasons this code uses the `keyval' module prefix. % -% \begin{variable}{\g_keyval_level_int} +% \begin{variable}{\g_@@_level_int} % For nesting purposes an integer is needed for the current level. % \begin{macrocode} -\int_new:N \g_keyval_level_int +\int_new:N \g_@@_level_int % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keyval_key_tl, \l_keyval_value_tl} +% \begin{variable}{\l_@@_key_tl, \l_@@_value_tl} % The current key name and value. % \begin{macrocode} -\tl_new:N \l_keyval_key_tl -\tl_new:N \l_keyval_value_tl +\tl_new:N \l_@@_key_tl +\tl_new:N \l_@@_value_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keyval_sanitise_tl} -% \begin{variable}{\l_keyval_parse_tl} +% \begin{variable}{\l_@@_sanitise_tl} +% \begin{variable}{\l_@@_parse_tl} % Token list variables for dealing with awkward category codes in the % input. % \begin{macrocode} -\tl_new:N \l_keyval_sanitise_tl -\tl_new:N \l_keyval_parse_tl +\tl_new:N \l_@@_sanitise_tl +\tl_new:N \l_@@_parse_tl % \end{macrocode} %\end{variable} %\end{variable} % -% \begin{macro}{\keyval_parse:n} +% \begin{macro}{\@@_parse:n} % The parsing function first deals with the category codes for % |=| and |,|, so that there are no odd events. The input is then % handed off to the element by element system. @@ -872,49 +777,49 @@ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \keyval_parse:n #1 + \cs_new_protected:Npn \@@_parse:n #1 { \group_begin: - \tl_clear:N \l_keyval_sanitise_tl - \tl_set:Nn \l_keyval_sanitise_tl {#1} - \tl_replace_all:Nnn \l_keyval_sanitise_tl { = } { 8 } - \tl_replace_all:Nnn \l_keyval_sanitise_tl { , } { 9 } - \tl_clear:N \l_keyval_parse_tl - \exp_after:wN \keyval_parse_elt:w \exp_after:wN - \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9 + \tl_clear:N \l_@@_sanitise_tl + \tl_set:Nn \l_@@_sanitise_tl {#1} + \tl_replace_all:Nnn \l_@@_sanitise_tl { = } { 8 } + \tl_replace_all:Nnn \l_@@_sanitise_tl { , } { 9 } + \tl_clear:N \l_@@_parse_tl + \exp_after:wN \@@_parse_elt:w \exp_after:wN + \q_no_value \l_@@_sanitise_tl 9 \q_nil 9 \exp_after:wN \group_end: - \l_keyval_parse_tl + \l_@@_parse_tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\keyval_parse_elt:w} +% \begin{macro}{\@@_parse_elt:w} % Each item to be parsed will have \cs{q_no_value} added to the front. % Hence the blank test here can always be used to find a totally % empty argument. If this is the case, the system loops round. If there % is something to parse, there is a check for the \cs{q_nil} marker % and if not a hand-off. % \begin{macrocode} -\cs_new_protected:Npn \keyval_parse_elt:w #1 , +\cs_new_protected:Npn \@@_parse_elt:w #1 , { \tl_if_blank:oTF { \use_none:n #1 } - { \keyval_parse_elt:w \q_no_value } + { \@@_parse_elt:w \q_no_value } { \quark_if_nil:oF { \use_ii:nn #1 } { - \keyval_split_key_value:w #1 = = \q_stop - \keyval_parse_elt:w \q_no_value + \@@_split_key_value:w #1 = = \q_stop + \@@_parse_elt:w \q_no_value } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\keyval_split_key_value:w} -% \begin{macro}[aux]{\keyval_split_key_value_aux:wTF} +% \begin{macro}{\@@_split_key_value:w} +% \begin{macro}[aux]{\@@_split_key_value:wTF} % The key and value are handled separately. First the key is grabbed and -% saved as \cs{l_keyval_key_tl}. Then a check is need to see if there is +% saved as \cs{l_@@_key_tl}. Then a check is need to see if there is % a value at all: if not then the key name is simply added to the output. % If there is a value then there is a check to ensure that there was % only one |=| in the input (remembering some extra ones are around at @@ -922,84 +827,84 @@ % hand-off to find the value: the \cs{q_nil} is there to prevent loss % of braces. % \begin{macrocode} -\cs_new_protected:Npn \keyval_split_key_value:w #1 = #2 \q_stop +\cs_new_protected:Npn \@@_split_key_value:w #1 = #2 \q_stop { - \keyval_split_key:w #1 \q_stop + \@@_split_key:w #1 \q_stop \str_if_eq:nnTF {#2} { = } { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l_@@_parse_tl { \exp_not:c - { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } - { \exp_not:o \l_keyval_key_tl } + { @@_key_no_value_elt_ \int_use:N \g_@@_level_int :n } + { \exp_not:o \l_@@_key_tl } } } { - \keyval_split_key_value_aux:wTF #2 \q_no_value \q_stop - { \keyval_split_value:w \q_nil #2 } - { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } } + \@@_split_key_value:wTF #2 \q_no_value \q_stop + { \@@_split_value:w \q_nil #2 } + { \__msg_kernel_error:nn { kernel } { misplaced-equals-sign } } } } -\cs_new:Npn \keyval_split_key_value_aux:wTF #1 = #2#3 \q_stop +\cs_new:Npn \@@_split_key_value:wTF #1 = #2#3 \q_stop { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\keyval_split_key:w} +% \begin{macro}{\@@_split_key:w} % The aim here is to remove spaces and also exactly one set of braces. % There is also a quark to remove, hence the \cs{use_none:n} appearing before % application of \cs{tl_trim_spaces:n}. % \begin{macrocode} -\cs_new_protected:Npn \keyval_split_key:w #1 \q_stop +\cs_new_protected:Npn \@@_split_key:w #1 \q_stop { - \tl_set:Nx \l_keyval_key_tl + \tl_set:Nx \l_@@_key_tl { \exp_after:wN \tl_trim_spaces:n \exp_after:wN { \use_none:n #1 } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\keyval_split_value:w} +% \begin{macro}{\@@_split_value:w} % Here the value has to be separated from the equals signs and the % leading \cs{q_nil} added in to keep the brace levels. Fist the % processing function can be added to the output list. If there is no -% value, setting \cs{l_keyval_value_tl} with three groups removed will +% value, setting \cs{l_@@_value_tl} with three groups removed will % leave nothing at all, and so an empty group can be added to the % parsed list. On the other hand, if the value is entirely contained -% within a set of braces then \cs{l_keyval_value_tl} will contain +% within a set of braces then \cs{l_@@_value_tl} will contain % \cs{q_nil} only. In that case, strip off the leading quark using % \cs{use_ii:nnn}, which also deals with any spaces. % \begin{macrocode} -\cs_new_protected:Npn \keyval_split_value:w #1 = = +\cs_new_protected:Npn \@@_split_value:w #1 = = { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l_@@_parse_tl { \exp_not:c - { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } - { \exp_not:o \l_keyval_key_tl } + { @@_key_value_elt_ \int_use:N \g_@@_level_int :nn } + { \exp_not:o \l_@@_key_tl } } - \tl_set:Nx \l_keyval_value_tl + \tl_set:Nx \l_@@_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } - \tl_if_empty:NTF \l_keyval_value_tl - { \tl_put_right:Nn \l_keyval_parse_tl { { } } } + \tl_if_empty:NTF \l_@@_value_tl + { \tl_put_right:Nn \l_@@_parse_tl { { } } } { - \quark_if_nil:NTF \l_keyval_value_tl + \quark_if_nil:NTF \l_@@_value_tl { - \tl_put_right:Nx \l_keyval_parse_tl + \tl_put_right:Nx \l_@@_parse_tl { { \exp_not:o { \use_ii:nnn #1 \q_nil } } } } - { \keyval_split_value_aux:w #1 \q_stop } + { \@@_split_value_aux:w #1 \q_stop } } } % \end{macrocode} % A similar idea to the key code: remove the spaces from each end and % deal with one set of braces. % \begin{macrocode} -\cs_new_protected:Npn \keyval_split_value_aux:w \q_nil #1 \q_stop +\cs_new_protected:Npn \@@_split_value_aux:w \q_nil #1 \q_stop { - \tl_set:Nx \l_keyval_value_tl { \tl_trim_spaces:n {#1} } - \tl_put_right:Nx \l_keyval_parse_tl - { { \exp_not:o \l_keyval_value_tl } } + \tl_set:Nx \l_@@_value_tl { \tl_trim_spaces:n {#1} } + \tl_put_right:Nx \l_@@_parse_tl + { { \exp_not:o \l_@@_value_tl } } } % \end{macrocode} % \end{macro} @@ -1010,20 +915,20 @@ % \begin{macrocode} \cs_new_protected:Npn \keyval_parse:NNn #1#2#3 { - \int_gincr:N \g_keyval_level_int + \int_gincr:N \g_@@_level_int \cs_gset_eq:cN - { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } #1 + { @@_key_no_value_elt_ \int_use:N \g_@@_level_int :n } #1 \cs_gset_eq:cN - { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } #2 - \keyval_parse:n {#3} - \int_gdecr:N \g_keyval_level_int + { @@_key_value_elt_ \int_use:N \g_@@_level_int :nn } #2 + \@@_parse:n {#3} + \int_gdecr:N \g_@@_level_int } % \end{macrocode} % \end{macro} % % One message for the low level parsing system. % \begin{macrocode} -\msg_kernel_new:nnnn { keyval } { misplaced-equals-sign } +\__msg_kernel_new:nnnn { kernel } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_number: } { LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ @@ -1032,36 +937,40 @@ % \end{macrocode} % % \subsection{Constants and variables} +% +% \begin{macrocode} +%<@@=keys> +% \end{macrocode} % -% \begin{variable}{\c_keys_code_root_tl, \c_keys_vars_root_tl} +% \begin{variable}{\c_@@_code_root_tl, \c_@@_vars_root_tl} % The prefixes for the code and variables of the keys themselves. % \begin{macrocode} -\tl_const:Nn \c_keys_code_root_tl { key~code~>~ } -\tl_const:Nn \c_keys_vars_root_tl { key~var~>~ } +\tl_const:Nn \c_@@_code_root_tl { key~code~>~ } +\tl_const:Nn \c_@@_vars_root_tl { key~var~>~ } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_keys_props_root_tl} +% \begin{variable}{\c_@@_props_root_tl} % The prefix for storing properties. % \begin{macrocode} -\tl_const:Nn \c_keys_props_root_tl { key~prop~>~ } +\tl_const:Nn \c_@@_props_root_tl { key~prop~>~ } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_keys_value_forbidden_tl, \c_keys_value_required_tl} +% \begin{variable}{\c_@@_value_forbidden_tl, \c_@@_value_required_tl} % Two marker token lists. % \begin{macrocode} -\tl_const:Nn \c_keys_value_forbidden_tl { forbidden } -\tl_const:Nn \c_keys_value_required_tl { required } +\tl_const:Nn \c_@@_value_forbidden_tl { forbidden } +\tl_const:Nn \c_@@_value_required_tl { required } % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keys_choice_int, \l_keys_choices_tl} +% \begin{variable}{\l_keys_choice_int, \l_keys_choice_tl} % Publicly accessible data on which choice is being used when several % are generated as a set. % \begin{macrocode} \int_new:N \l_keys_choice_int -\tl_new:N \l_keys_choices_tl +\tl_new:N \l_keys_choice_tl % \end{macrocode} % \end{variable} % @@ -1072,18 +981,18 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keys_module_tl} +% \begin{variable}{\l_@@_module_tl} % The module for an entire set of keys. % \begin{macrocode} -\tl_new:N \l_keys_module_tl +\tl_new:N \l_@@_module_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keys_no_value_bool} +% \begin{variable}{\l_@@_no_value_bool} % A marker is needed internally to show if only a key or a key plus a % value was seen: this is recorded here. % \begin{macrocode} -\bool_new:N \l_keys_no_value_bool +\bool_new:N \l_@@_no_value_bool % \end{macrocode} % \end{variable} % @@ -1095,18 +1004,18 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keys_property_tl} +% \begin{variable}{\l_@@_property_tl} % The \enquote{property} begin set for a key at definition time is % stored here. % \begin{macrocode} -\tl_new:N \l_keys_property_tl +\tl_new:N \l_@@_property_tl % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_keys_unknown_clist} +% \begin{variable}{\l_@@_unknown_clist} % Used when setting only known keys to store those left over. % \begin{macrocode} -\tl_new:N \l_keys_unknown_clist +\tl_new:N \l_@@_unknown_clist % \end{macrocode} % \end{variable} % @@ -1120,51 +1029,51 @@ % \subsection{The key defining mechanism} % % \begin{macro}{\keys_define:nn} -% \begin{macro}[aux]{\keys_define_aux:nnn, \keys_define_aux:onn} +% \begin{macro}[aux]{\@@_define:nnn, \@@_define:onn} % The public function for definitions is just a wrapper for the lower % level mechanism, more or less. The outer function is designed to % keep a track of the current module, to allow safe nesting. The module is set % removing any leading |/| (which is not needed here). % \begin{macrocode} \cs_new_protected:Npn \keys_define:nn - { \keys_define_aux:onn \l_keys_module_tl } -\cs_new_protected:Npn \keys_define_aux:nnn #1#2#3 + { \@@_define:onn \l_@@_module_tl } +\cs_new_protected:Npn \@@_define:nnn #1#2#3 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \keyval_parse:NNn \keys_define_elt:n \keys_define_elt:nn {#3} - \tl_set:Nn \l_keys_module_tl {#1} + \tl_set:Nx \l_@@_module_tl { \tl_to_str:n {#2} } + \keyval_parse:NNn \@@_define_elt:n \@@_define_elt:nn {#3} + \tl_set:Nn \l_@@_module_tl {#1} } -\cs_generate_variant:Nn \keys_define_aux:nnn { o } +\cs_generate_variant:Nn \@@_define:nnn { o } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_define_elt:n} -% \begin{macro}[int]{\keys_define_elt:nn} -% \begin{macro}[aux]{\keys_define_elt_aux:nn} +% \begin{macro}[int]{\@@_define_elt:n} +% \begin{macro}[int]{\@@_define_elt:nn} +% \begin{macro}[aux]{\@@_define_elt_aux:nn} % The outer functions here record whether a value was given and then % converge on a common internal mechanism. There is first a search for % a property in the current key name, then a check to make sure it is % known before the code hands off to the next step. % \begin{macrocode} -\cs_new_protected:Npn \keys_define_elt:n #1 +\cs_new_protected:Npn \@@_define_elt:n #1 { - \bool_set_true:N \l_keys_no_value_bool - \keys_define_elt_aux:nn {#1} { } + \bool_set_true:N \l_@@_no_value_bool + \@@_define_elt_aux:nn {#1} { } } -\cs_new_protected:Npn \keys_define_elt:nn #1#2 +\cs_new_protected:Npn \@@_define_elt:nn #1#2 { - \bool_set_false:N \l_keys_no_value_bool - \keys_define_elt_aux:nn {#1} {#2} + \bool_set_false:N \l_@@_no_value_bool + \@@_define_elt_aux:nn {#1} {#2} } -\cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 +\cs_new_protected:Npn \@@_define_elt_aux:nn #1#2 { - \keys_property_find:n {#1} - \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } - { \keys_define_key:n {#2} } + \@@_property_find:n {#1} + \cs_if_exist:cTF { \c_@@_props_root_tl \l_@@_property_tl } + { \@@_define_key:n {#2} } { - \msg_kernel_error:nnxx { keys } { property-unknown } - { \l_keys_property_tl } { \l_keys_path_tl } + \__msg_kernel_error:nnxx { kernel } { property-unknown } + { \l_@@_property_tl } { \l_keys_path_tl } } } % \end{macrocode} @@ -1172,57 +1081,57 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_property_find:n} -% \begin{macro}[aux]{\keys_property_find_aux:w} +% \begin{macro}[int]{\@@_property_find:n} +% \begin{macro}[aux]{\@@_property_find:w} % Searching for a property means finding the last |.| in the input, % and storing the text before and after it. Everything is turned into % strings, so there is no problem using an \texttt{x}-type expansion. % \begin{macrocode} -\cs_new_protected:Npn \keys_property_find:n #1 +\cs_new_protected:Npn \@@_property_find:n #1 { - \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / } + \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / } \tl_if_in:nnTF {#1} { . } - { \keys_property_find_aux:w #1 \q_stop } - { \msg_kernel_error:nnx { keys } { key-no-property } {#1} } + { \@@_property_find:w #1 \q_stop } + { \__msg_kernel_error:nnx { kernel } { key-no-property } {#1} } } -\cs_new_protected:Npn \keys_property_find_aux:w #1 . #2 \q_stop +\cs_new_protected:Npn \@@_property_find:w #1 . #2 \q_stop { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { . } { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . } - \keys_property_find_aux:w #2 \q_stop + \@@_property_find:w #2 \q_stop } - { \tl_set:Nn \l_keys_property_tl { . #2 } } + { \tl_set:Nn \l_@@_property_tl { . #2 } } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_define_key:n} -% \begin{macro}[aux]{\keys_define_key_aux:w} +% \begin{macro}[int]{\@@_define_key:n} +% \begin{macro}[aux]{\@@_define_key:w} % Two possible cases. If there is a value for the key, then just use % the function. If not, then a check to make sure there is no need for % a value with the property. If there should be one then complain, % otherwise execute it. There is no need to check for a |:| as if it % is missing the earlier tests will have failed. % \begin{macrocode} -\cs_new_protected:Npn \keys_define_key:n #1 +\cs_new_protected:Npn \@@_define_key:n #1 { - \bool_if:NTF \l_keys_no_value_bool + \bool_if:NTF \l_@@_no_value_bool { - \exp_after:wN \keys_define_key_aux:w - \l_keys_property_tl \q_stop - { \use:c { \c_keys_props_root_tl \l_keys_property_tl } } + \exp_after:wN \@@_define_key:w + \l_@@_property_tl \q_stop + { \use:c { \c_@@_props_root_tl \l_@@_property_tl } } { - \msg_kernel_error:nnxx { keys } - { property-requires-value } { \l_keys_property_tl } + \__msg_kernel_error:nnxx { kernel } + { property-requires-value } { \l_@@_property_tl } { \l_keys_path_tl } } } - { \use:c { \c_keys_props_root_tl \l_keys_property_tl } {#1} } + { \use:c { \c_@@_props_root_tl \l_@@_property_tl } {#1} } } -\cs_new_protected:Npn \keys_define_key_aux:w #1 : #2 \q_stop +\cs_new_protected:Npn \@@_define_key:w #1 : #2 \q_stop { \tl_if_empty:nTF {#2} } % \end{macrocode} % \end{macro} @@ -1230,226 +1139,246 @@ % % \subsection{Turning properties into actions} % -% \begin{macro}[int]{\keys_bool_set:NN} +% \begin{macro}[int]{\@@_bool_set:NN} % Boolean keys are really just choices, but all done by hand. The % second argument here is the scope: either empty or \texttt{g} for % global. % \begin{macrocode} -\cs_new:Npn \keys_bool_set:NN #1#2 +\cs_new:Npn \@@_bool_set:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } - \keys_choice_make: - \keys_cmd_set:nx { \l_keys_path_tl / true } + \@@_choice_make: + \@@_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } - \keys_cmd_set:nx { \l_keys_path_tl / false } + \@@_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \@@_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnx { keys } { boolean-values-only } + \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } - \keys_default_set:n { true } + \@@_default_set:n { true } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_bool_set_inverse:NN} +% \begin{macro}[int]{\@@_bool_set_inverse:NN} % Inverse boolean setting is much the same. % \begin{macrocode} -\cs_new:Npn \keys_bool_set_inverse:NN #1#2 +\cs_new:Npn \@@_bool_set_inverse:NN #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } - \keys_choice_make: - \keys_cmd_set:nx { \l_keys_path_tl / true } + \@@_choice_make: + \@@_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } - \keys_cmd_set:nx { \l_keys_path_tl / false } + \@@_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \@@_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnx { keys } { boolean-values-only } + \__msg_kernel_error:nnx { kernel } { boolean-values-only } { \l_keys_key_tl } } - \keys_default_set:n { true } + \@@_default_set:n { true } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_choice_make:} +% \begin{macro}[int]{\@@_choice_make:} % To make a choice from a key, two steps: set the code, and set the % unknown key. % \begin{macrocode} -\cs_new_protected_nopar:Npn \keys_choice_make: +\cs_new_protected_nopar:Npn \@@_choice_make: { - \keys_cmd_set:nn { \l_keys_path_tl } - { \keys_choice_find:n {##1} } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \@@_cmd_set:nn { \l_keys_path_tl } + { \@@_choice_find:n {##1} } + \@@_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnxx { keys } { choice-unknown } + \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_choices_make:nn} +% \begin{macro}[int]{\@@_choices_make:nn} % Auto-generating choices means setting up the root key as a choice, then % defining each choice in turn. % \begin{macrocode} -\cs_new_protected:Npn \keys_choices_make:nn #1#2 +\cs_new_protected:Npn \@@_choices_make:nn #1#2 { - \keys_choice_make: + \@@_choice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { - \keys_cmd_set:nx { \l_keys_path_tl / ##1 } + \int_incr:N \l_keys_choice_int + \@@_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } - \int_incr:N \l_keys_choice_int } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_choices_generate:n} -% \begin{macro}[aux]{\keys_choices_generate_aux:n} +% \begin{macro}[int]{\@@_choices_generate:n} +% \begin{macro}[aux]{\@@_choices_generate_aux:n} % Creating multiple-choices means setting up the \enquote{indicator} % code, then applying whatever the user wanted. % \begin{macrocode} -\cs_new_protected:Npn \keys_choices_generate:n #1 +\cs_new_protected:Npn \@@_choices_generate:n #1 { \cs_if_exist:cTF - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } { - \keys_choice_make: + \@@_choice_make: \int_zero:N \l_keys_choice_int - \clist_map_function:nN {#1} \keys_choices_generate_aux:n + \clist_map_function:nN {#1} \@@_choices_generate_aux:n } { - \msg_kernel_error:nnx { keys } + \__msg_kernel_error:nnx { kernel } { generate-choices-before-code } { \l_keys_path_tl } } } -\cs_new_protected:Npn \keys_choices_generate_aux:n #1 +\cs_new_protected:Npn \@@_choices_generate_aux:n #1 { - \keys_cmd_set:nx { \l_keys_path_tl / #1 } + \int_incr:N \l_keys_choice_int + \@@_cmd_set:nx { \l_keys_path_tl / #1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:v - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } } - \int_incr:N \l_keys_choice_int } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_choice_code_store:x} +% \begin{macro}[int]{\@@_choice_code_store:n, \@@_choice_code_store:x} % The code for making multiple choices is stored in a token list. % \begin{macrocode} -\cs_new_protected:Npn \keys_choice_code_store:x #1 +\cs_new_protected:Npn \@@_choice_code_store:n #1 { \cs_if_exist:cF - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } { \tl_new:c - { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } } - \tl_set:cx { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } + \tl_set:cn { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } {#1} } +\cs_generate_variant:Nn \@@_choice_code_store:n { x } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_cmd_set:nn, \keys_cmd_set:nx} -% \begin{macro}[aux]{\keys_cmd_set_aux:n} +% \begin{macro}[int]{\@@_cmd_set:nn, \@@_cmd_set:nx, \@@_cmd_set:Vo} +% \begin{macro}[aux]{\@@_cmd_set:n} % Creating a new command means tidying up the properties and then making % the internal function which actually does the work. % \begin{macrocode} -\cs_new_protected:Npn \keys_cmd_set:nn #1#2 +\cs_new_protected:Npn \@@_cmd_set:nn #1#2 { - \keys_cmd_set_aux:n {#1} - \cs_set:cpn { \c_keys_code_root_tl #1 } ##1 {#2} + \@@_cmd_set:n {#1} + \cs_set:cpn { \c_@@_code_root_tl #1 } ##1 {#2} } -\cs_new_protected:Npn \keys_cmd_set:nx #1#2 +\cs_new_protected:Npn \@@_cmd_set:nx #1#2 { - \keys_cmd_set_aux:n {#1} - \cs_set:cpx { \c_keys_code_root_tl #1 } ##1 {#2} + \@@_cmd_set:n {#1} + \cs_set:cpx { \c_@@_code_root_tl #1 } ##1 {#2} } -\cs_new_protected:Npn \keys_cmd_set_aux:n #1 +\cs_generate_variant:Nn \@@_cmd_set:nn { Vo } +\cs_new_protected:Npn \@@_cmd_set:n #1 { - \tl_clear_new:c { \c_keys_vars_root_tl #1 .default } - \tl_set:cn { \c_keys_vars_root_tl #1 .default } { \q_no_value } - \tl_clear_new:c { \c_keys_vars_root_tl #1 .req } + \tl_clear_new:c { \c_@@_vars_root_tl #1 .default } + \tl_set:cn { \c_@@_vars_root_tl #1 .default } { \q_no_value } + \tl_clear_new:c { \c_@@_vars_root_tl #1 .req } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_default_set:n, \keys_default_set:V} +% \begin{macro}[int]{\@@_default_set:n, \@@_default_set:V} % Setting a default value is easy. % \begin{macrocode} -\cs_new_protected:Npn \keys_default_set:n #1 - { \tl_set:cn { \c_keys_vars_root_tl \l_keys_path_tl .default } {#1} } -\cs_generate_variant:Nn \keys_default_set:n { V } +\cs_new_protected:Npn \@@_default_set:n #1 + { \tl_set:cn { \c_@@_vars_root_tl \l_keys_path_tl .default } {#1} } +\cs_generate_variant:Nn \@@_default_set:n { V } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_initialise:n, \@@_initialise:V} +% \begin{macro}[aux, EXP]{\@@_initialise:wn} +% A set up for initialisation from which the key system requires that +% the path is split up into a module and a key name. At this stage, +% \cs{l_keys_path_tl} will contain \texttt{/} so a split is easy to do. +% \begin{macrocode} +\cs_new_protected:Npn \@@_initialise:n #1 + { + \use:x + { \exp_after:wN \@@_initialise:wn \l_keys_path_tl \q_stop {#1} } + } +\cs_generate_variant:Nn \@@_initialise:n { V } +\cs_new:Npn \@@_initialise:wn #1 / #2 \q_stop #3 + { \keys_set:nn {#1} { #2 = \exp_not:n { {#3} } } } % \end{macrocode} % \end{macro} +% \end{macro} % -% \begin{macro}{\keys_meta_make:n, \keys_meta_make:x} +% \begin{macro}{\@@_meta_make:n, \@@_meta_make:x} % To create a meta-key, simply set up to pass data through. % \begin{macrocode} -\cs_new_protected:Npn \keys_meta_make:n #1 +\cs_new_protected:Npn \@@_meta_make:n #1 { - \exp_args:NNo \keys_cmd_set:nn \l_keys_path_tl - { \exp_after:wN \keys_set:nn \exp_after:wN { \l_keys_module_tl } {#1} } + \@@_cmd_set:Vo \l_keys_path_tl + { \exp_after:wN \keys_set:nn \exp_after:wN { \l_@@_module_tl } {#1} } } -\cs_new_protected:Npn \keys_meta_make:x #1 +\cs_new_protected:Npn \@@_meta_make:x #1 { - \keys_cmd_set:nx { \l_keys_path_tl } - { \exp_not:N \keys_set:nn { \l_keys_module_tl } {#1} } + \@@_cmd_set:nx { \l_keys_path_tl } + { \exp_not:N \keys_set:nn { \l_@@_module_tl } {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_multichoice_find:n} -% \begin{macro}[int]{\keys_multichoice_make:} -% \begin{macro}[int]{\keys_multichoices_make:nn} +% \begin{macro}[int]{\@@_multichoice_find:n} +% \begin{macro}[int]{\@@_multichoice_make:} +% \begin{macro}[int]{\@@_multichoices_make:nn} % Choices where several values can be selected are very similar to normal % exclusive choices. There is just a slight change in implementation to % map across a comma-separated list. This then requires that the appropriate % set up takes place elsewhere. % \begin{macrocode} -\cs_new:Npn \keys_multichoice_find:n #1 - { \clist_map_function:nN {#1} \keys_choice_find:n } -\cs_new_protected_nopar:Npn \keys_multichoice_make: +\cs_new:Npn \@@_multichoice_find:n #1 + { \clist_map_function:nN {#1} \@@_choice_find:n } +\cs_new_protected_nopar:Npn \@@_multichoice_make: { - \keys_cmd_set:nn { \l_keys_path_tl } - { \keys_multichoice_find:n {##1} } - \keys_cmd_set:nn { \l_keys_path_tl / unknown } + \@@_cmd_set:nn { \l_keys_path_tl } + { \@@_multichoice_find:n {##1} } + \@@_cmd_set:nn { \l_keys_path_tl / unknown } { - \msg_kernel_error:nnxx { keys } { choice-unknown } + \__msg_kernel_error:nnxx { kernel } { key-choice-unknown } { \l_keys_path_tl } {##1} } } -\cs_new_protected:Npn \keys_multichoices_make:nn #1#2 +\cs_new_protected:Npn \@@_multichoices_make:nn #1#2 { - \keys_multichoice_make: + \@@_multichoice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { - \keys_cmd_set:nx { \l_keys_path_tl / ##1 } + \int_incr:N \l_keys_choice_int + \@@_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } - \int_incr:N \l_keys_choice_int } } % \end{macrocode} @@ -1457,36 +1386,36 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_value_requirement:n} +% \begin{macro}[int]{\@@_value_requirement:n} % Values can be required or forbidden by having the appropriate marker % set. % \begin{macrocode} -\cs_new_protected:Npn \keys_value_requirement:n #1 +\cs_new_protected:Npn \@@_value_requirement:n #1 { \tl_set_eq:cc - { \c_keys_vars_root_tl \l_keys_path_tl .req } - { c_keys_value_ #1 _tl } + { \c_@@_vars_root_tl \l_keys_path_tl .req } + { c_@@_value_ #1 _tl } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_variable_set:NnNN, \keys_variable_set:cnNN} -% \begin{macro}[int]{\keys_variable_set:NnN, \keys_variable_set:cnN} +% \begin{macro}[int]{\@@_variable_set:NnNN, \@@_variable_set:cnNN} +% \begin{macro}[int]{\@@_variable_set:NnN, \@@_variable_set:cnN} % Setting a variable takes the type and scope separately so that % it is easy to make a new variable if needed. The three-argument % version is set up so that the use of |{ }| as an \texttt{N}-type % variable is only done once! % \begin{macrocode} -\cs_new_protected:Npn \keys_variable_set:NnNN #1#2#3#4 +\cs_new_protected:Npn \@@_variable_set:NnNN #1#2#3#4 { \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 } - \keys_cmd_set:nx { \l_keys_path_tl } + \@@_cmd_set:nx { \l_keys_path_tl } { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } } -\cs_new_protected:Npn \keys_variable_set:NnN #1#2#3 - { \keys_variable_set:NnNN #1 {#2} { } #3 } -\cs_generate_variant:Nn \keys_variable_set:NnNN { c } -\cs_generate_variant:Nn \keys_variable_set:NnN { c } +\cs_new_protected:Npn \@@_variable_set:NnN #1#2#3 + { \@@_variable_set:NnNN #1 {#2} { } #3 } +\cs_generate_variant:Nn \@@_variable_set:NnNN { c } +\cs_generate_variant:Nn \@@_variable_set:NnN { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -1500,10 +1429,10 @@ % \begin{macro}{.bool_gset:N} % One function for this. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_set:N } #1 - { \keys_bool_set:NN #1 { } } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset:N } #1 - { \keys_bool_set:NN #1 g } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_set:N } #1 + { \@@_bool_set:NN #1 { } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset:N } #1 + { \@@_bool_set:NN #1 g } % \end{macrocode} % \end{macro} % \end{macro} @@ -1512,10 +1441,10 @@ % \begin{macro}{.bool_gset_inverse:N} % One function for this. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_set_inverse:N } #1 - { \keys_bool_set_inverse:NN #1 { } } -\cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset_inverse:N } #1 - { \keys_bool_set_inverse:NN #1 g } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_set_inverse:N } #1 + { \@@_bool_set_inverse:NN #1 { } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset_inverse:N } #1 + { \@@_bool_set_inverse:NN #1 g } % \end{macrocode} % \end{macro} % \end{macro} @@ -1524,8 +1453,8 @@ % Making a choice is handled internally, as it is also needed by % \texttt{.generate_choices:n}. % \begin{macrocode} -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .choice: } - { \keys_choice_make: } +\cs_new_protected_nopar:cpn { \c_@@_props_root_tl .choice: } + { \@@_choice_make: } % \end{macrocode} % \end{macro} % @@ -1534,8 +1463,8 @@ % Here, |#1| will consist of two separate % arguments, hence the slightly odd-looking implementation. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .choices:nn } #1 - { \keys_choices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .choices:nn } #1 + { \@@_choices_make:nn #1 } % \end{macrocode} % \end{macro} % @@ -1543,35 +1472,34 @@ % Creating code is simply a case of passing through to the underlying % \texttt{set} function. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .code:n } #1 - { \keys_cmd_set:nn { \l_keys_path_tl } {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .code:x } #1 - { \keys_cmd_set:nx { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .code:n } #1 + { \@@_cmd_set:nn { \l_keys_path_tl } {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .code:x } #1 + { \@@_cmd_set:nx { \l_keys_path_tl } {#1} } % \end{macrocode} % \end{macro} % % \begin{macro}{.choice_code:n, .choice_code:x} -% Storing the code for choices, using \cs{exp_not:n} to avoid needing -% two internal functions. +% Storing the code for choices % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:n } #1 - { \keys_choice_code_store:x { \exp_not:n {#1} } } -\cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:x } #1 - { \keys_choice_code_store:x {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:n } #1 + { \@@_choice_code_store:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:x } #1 + { \@@_choice_code_store:x {#1} } % \end{macrocode} % \end{macro} % % \begin{macro}{.clist_set:N, .clist_set:c} % \begin{macro}{.clist_gset:N, .clist_gset:c} % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:N } #1 - { \keys_variable_set:NnN #1 { clist } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:c } #1 - { \keys_variable_set:cnN {#1} { clist } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:N } #1 - { \keys_variable_set:NnNN #1 { clist } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:c } #1 - { \keys_variable_set:cnNN {#1} { clist } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .clist_set:N } #1 + { \@@_variable_set:NnN #1 { clist } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .clist_set:c } #1 + { \@@_variable_set:cnN {#1} { clist } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .clist_gset:N } #1 + { \@@_variable_set:NnNN #1 { clist } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .clist_gset:c } #1 + { \@@_variable_set:cnNN {#1} { clist } g n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1579,10 +1507,10 @@ % \begin{macro}{.default:n, .default:V} % Expansion is left to the internal functions. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .default:n } #1 - { \keys_default_set:n {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .default:V } #1 - { \keys_default_set:V #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .default:n } #1 + { \@@_default_set:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .default:V } #1 + { \@@_default_set:V #1 } % \end{macrocode} % \end{macro} % @@ -1590,14 +1518,14 @@ % \begin{macro}{.dim_gset:N, .dim_gset:c} % Setting a variable is very easy: just pass the data along. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:N } #1 - { \keys_variable_set:NnN #1 { dim } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:c } #1 - { \keys_variable_set:cnN {#1} { dim } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:N } #1 - { \keys_variable_set:NnNN #1 { dim } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:c } #1 - { \keys_variable_set:cnNN {#1} { dim } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .dim_set:N } #1 + { \@@_variable_set:NnN #1 { dim } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .dim_set:c } #1 + { \@@_variable_set:cnN {#1} { dim } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .dim_gset:N } #1 + { \@@_variable_set:NnNN #1 { dim } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .dim_gset:c } #1 + { \@@_variable_set:cnNN {#1} { dim } g n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1606,14 +1534,14 @@ % \begin{macro}{.fp_gset:N, .fp_gset:c} % Setting a variable is very easy: just pass the data along. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:N } #1 - { \keys_variable_set:NnN #1 { fp } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:c } #1 - { \keys_variable_set:cnN {#1} { fp } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:N } #1 - { \keys_variable_set:NnNN #1 { fp } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:c } #1 - { \keys_variable_set:cnNN {#1} { fp } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .fp_set:N } #1 + { \@@_variable_set:NnN #1 { fp } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .fp_set:c } #1 + { \@@_variable_set:cnN {#1} { fp } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .fp_gset:N } #1 + { \@@_variable_set:NnNN #1 { fp } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .fp_gset:c } #1 + { \@@_variable_set:cnNN {#1} { fp } g n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1621,8 +1549,18 @@ % \begin{macro}{.generate_choices:n} % Making choices is easy. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .generate_choices:n } #1 - { \keys_choices_generate:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .generate_choices:n } #1 + { \@@_choices_generate:n {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{.initial:n, .initial:V} +% The standard hand-off approach. +% \begin{macrocode} +\cs_new_protected:cpn { \c_@@_props_root_tl .initial:n } #1 + { \@@_initialise:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .initial:V } #1 + { \@@_initialise:V #1 } % \end{macrocode} % \end{macro} % @@ -1630,14 +1568,14 @@ % \begin{macro}{.int_gset:N, .int_gset:c} % Setting a variable is very easy: just pass the data along. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .int_set:N } #1 - { \keys_variable_set:NnN #1 { int } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_set:c } #1 - { \keys_variable_set:cnN {#1} { int } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:N } #1 - { \keys_variable_set:NnNN #1 { int } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:c } #1 - { \keys_variable_set:cnNN {#1} { int } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .int_set:N } #1 + { \@@_variable_set:NnN #1 { int } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .int_set:c } #1 + { \@@_variable_set:cnN {#1} { int } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .int_gset:N } #1 + { \@@_variable_set:NnNN #1 { int } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .int_gset:c } #1 + { \@@_variable_set:cnNN {#1} { int } g n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1645,10 +1583,10 @@ %\begin{macro}{.meta:n, .meta:x} % Making a meta is handled internally. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .meta:n } #1 - { \keys_meta_make:n {#1} } -\cs_new_protected:cpn { \c_keys_props_root_tl .meta:x } #1 - { \keys_meta_make:x {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .meta:n } #1 + { \@@_meta_make:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .meta:x } #1 + { \@@_meta_make:x {#1} } % \end{macrocode} % \end{macro} % @@ -1657,10 +1595,10 @@ % The same idea as \texttt{.choice:} and \texttt{.choices:nn}, but % where more than one choice is allowed. % \begin{macrocode} -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .multichoice: } - { \keys_multichoice_make: } -\cs_new_protected:cpn { \c_keys_props_root_tl .multichoices:nn } #1 - { \keys_multichoices_make:nn #1 } +\cs_new_protected_nopar:cpn { \c_@@_props_root_tl .multichoice: } + { \@@_multichoice_make: } +\cs_new_protected:cpn { \c_@@_props_root_tl .multichoices:nn } #1 + { \@@_multichoices_make:nn #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1669,14 +1607,14 @@ % \begin{macro}{.skip_gset:N, .skip_gset:c} % Setting a variable is very easy: just pass the data along. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:N } #1 - { \keys_variable_set:NnN #1 { skip } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:c } #1 - { \keys_variable_set:cnN {#1} { skip } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:N } #1 - { \keys_variable_set:NnNN #1 { skip } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:c } #1 - { \keys_variable_set:cnNN {#1} { skip } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .skip_set:N } #1 + { \@@_variable_set:NnN #1 { skip } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .skip_set:c } #1 + { \@@_variable_set:cnN {#1} { skip } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .skip_gset:N } #1 + { \@@_variable_set:NnNN #1 { skip } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .skip_gset:c } #1 + { \@@_variable_set:cnNN {#1} { skip } g n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1688,22 +1626,22 @@ % \begin{macro}{.tl_gset_x:N, .tl_gset_x:c} % Setting a variable is very easy: just pass the data along. % \begin{macrocode} -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:N } #1 - { \keys_variable_set:NnN #1 { tl } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:c } #1 - { \keys_variable_set:cnN {#1} { tl } n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:N } #1 - { \keys_variable_set:NnN #1 { tl } x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:c } #1 - { \keys_variable_set:cnN {#1} { tl } x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:N } #1 - { \keys_variable_set:NnNN #1 { tl } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:c } #1 - { \keys_variable_set:cnNN {#1} { tl } g n } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:N } #1 - { \keys_variable_set:NnNN #1 { tl } g x } -\cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:c } #1 - { \keys_variable_set:cnNN {#1} { tl } g x } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_set:N } #1 + { \@@_variable_set:NnN #1 { tl } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_set:c } #1 + { \@@_variable_set:cnN {#1} { tl } n } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_set_x:N } #1 + { \@@_variable_set:NnN #1 { tl } x } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_set_x:c } #1 + { \@@_variable_set:cnN {#1} { tl } x } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset:N } #1 + { \@@_variable_set:NnNN #1 { tl } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset:c } #1 + { \@@_variable_set:cnNN {#1} { tl } g n } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset_x:N } #1 + { \@@_variable_set:NnNN #1 { tl } g x } +\cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset_x:c } #1 + { \@@_variable_set:cnNN {#1} { tl } g x } % \end{macrocode} % \end{macro} % \end{macro} @@ -1714,10 +1652,10 @@ % \begin{macro}{.value_required:} % These are very similar, so both call the same function. % \begin{macrocode} -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_forbidden: } - { \keys_value_requirement:n { forbidden } } -\cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_required: } - { \keys_value_requirement:n { required } } +\cs_new_protected_nopar:cpn { \c_@@_props_root_tl .value_forbidden: } + { \@@_value_requirement:n { forbidden } } +\cs_new_protected_nopar:cpn { \c_@@_props_root_tl .value_required: } + { \@@_value_requirement:n { required } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1725,19 +1663,19 @@ % \subsection{Setting keys} % % \begin{macro}{\keys_set:nn, \keys_set:nV, \keys_set:nv, \keys_set:no} -% \begin{macro}[aux]{\keys_set_aux:nnn, \keys_set_aux:onn} +% \begin{macro}[aux]{\@@_set:nnn, \@@_set:onn} % A simple wrapper again. % \begin{macrocode} \cs_new_protected:Npn \keys_set:nn - { \keys_set_aux:onn { \l_keys_module_tl } } -\cs_new_protected:Npn \keys_set_aux:nnn #1#2#3 + { \@@_set:onn { \l_@@_module_tl } } +\cs_new_protected:Npn \@@_set:nnn #1#2#3 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} - \tl_set:Nn \l_keys_module_tl {#1} + \tl_set:Nx \l_@@_module_tl { \tl_to_str:n {#2} } + \keyval_parse:NNn \@@_set_elt:n \@@_set_elt:nn {#3} + \tl_set:Nn \l_@@_module_tl {#1} } \cs_generate_variant:Nn \keys_set:nn { nV , nv , no } -\cs_generate_variant:Nn \keys_set_aux:nnn { o } +\cs_generate_variant:Nn \@@_set:nnn { o } % \end{macrocode} % \end{macro} % \end{macro} @@ -1747,89 +1685,89 @@ % \keys_set_known:nnN, \keys_set_known:nVN, % \keys_set_known:nvN, \keys_set_known:noN % } -% \begin{macro}[aux]{\keys_set_known_aux:nnnN, \keys_set_known_aux:onnN} +% \begin{macro}[aux]{\@@_set_known:nnnN, \@@_set_known:onnN} % \begin{macrocode} \cs_new_protected:Npn \keys_set_known:nnN - { \keys_set_known_aux:onnN { \l_keys_module_tl } } -\cs_new_protected:Npn \keys_set_known_aux:nnnN #1#2#3#4 + { \@@_set_known:onnN { \l_@@_module_tl } } +\cs_new_protected:Npn \@@_set_known:nnnN #1#2#3#4 { - \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } - \clist_clear:N \l_keys_unknown_clist - \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_alt: - \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} - \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_std: - \tl_set:Nn \l_keys_module_tl {#1} - \clist_set_eq:NN #4 \l_keys_unknown_clist + \tl_set:Nx \l_@@_module_tl { \tl_to_str:n {#2} } + \clist_clear:N \l_@@_unknown_clist + \cs_set_eq:NN \@@_execute_unknown: \@@_execute_unknown_alt: + \keyval_parse:NNn \@@_set_elt:n \@@_set_elt:nn {#3} + \cs_set_eq:NN \@@_execute_unknown: \@@_execute_unknown_std: + \tl_set:Nn \l_@@_module_tl {#1} + \clist_set_eq:NN #4 \l_@@_unknown_clist } \cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no } -\cs_generate_variant:Nn \keys_set_known_aux:nnnN { o } +\cs_generate_variant:Nn \@@_set_known:nnnN { o } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_set_elt:n, \keys_set_elt:nn} -% \begin{macro}[aux]{\keys_set_elt_aux:nn} +% \begin{macro}[int]{\@@_set_elt:n, \@@_set_elt:nn} +% \begin{macro}[aux]{\@@_set_elt_aux:nn} % 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 % required or forbidden. If everything passes, move on to execute the % code. % \begin{macrocode} -\cs_new_protected:Npn \keys_set_elt:n #1 +\cs_new_protected:Npn \@@_set_elt:n #1 { - \bool_set_true:N \l_keys_no_value_bool - \keys_set_elt_aux:nn {#1} { } + \bool_set_true:N \l_@@_no_value_bool + \@@_set_elt_aux:nn {#1} { } } -\cs_new_protected:Npn \keys_set_elt:nn #1#2 +\cs_new_protected:Npn \@@_set_elt:nn #1#2 { - \bool_set_false:N \l_keys_no_value_bool - \keys_set_elt_aux:nn {#1} {#2} + \bool_set_false:N \l_@@_no_value_bool + \@@_set_elt_aux:nn {#1} {#2} } -\cs_new_protected:Npn \keys_set_elt_aux:nn #1#2 +\cs_new_protected:Npn \@@_set_elt_aux:nn #1#2 { \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} } - \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / \l_keys_key_tl } - \keys_value_or_default:n {#2} + \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / \l_keys_key_tl } + \@@_value_or_default:n {#2} \bool_if:nTF { - \keys_if_value_p:n { required } && - \l_keys_no_value_bool + \@@_if_value_p:n { required } && + \l_@@_no_value_bool } { - \msg_kernel_error:nnx { keys } { value-required } + \__msg_kernel_error:nnx { kernel } { value-required } { \l_keys_path_tl } } { \bool_if:nTF { - \keys_if_value_p:n { forbidden } && - ! \l_keys_no_value_bool + \@@_if_value_p:n { forbidden } && + ! \l_@@_no_value_bool } { - \msg_kernel_error:nnxx { keys } { value-forbidden } + \__msg_kernel_error:nnxx { kernel } { value-forbidden } { \l_keys_path_tl } { \l_keys_value_tl } } - { \keys_execute: } + { \@@_execute: } } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_value_or_default:n} +% \begin{macro}[int]{\@@_value_or_default:n} % If a value is given, return it as |#1|, otherwise send a default if % available. % \begin{macrocode} -\cs_new_protected:Npn \keys_value_or_default:n #1 +\cs_new_protected:Npn \@@_value_or_default:n #1 { \tl_set:Nn \l_keys_value_tl {#1} - \bool_if:NT \l_keys_no_value_bool + \bool_if:NT \l_@@_no_value_bool { - \quark_if_no_value:cF { \c_keys_vars_root_tl \l_keys_path_tl .default } + \quark_if_no_value:cF { \c_@@_vars_root_tl \l_keys_path_tl .default } { - \cs_if_exist:cT { \c_keys_vars_root_tl \l_keys_path_tl .default } + \cs_if_exist:cT { \c_@@_vars_root_tl \l_keys_path_tl .default } { \tl_set_eq:Nc \l_keys_value_tl - { \c_keys_vars_root_tl \l_keys_path_tl .default } + { \c_@@_vars_root_tl \l_keys_path_tl .default } } } } @@ -1837,57 +1775,57 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_if_value_p:n} +% \begin{macro}[int]{\@@_if_value_p:n} % To test if a value is required or forbidden. A simple check for % the existence of the appropriate marker. % \begin{macrocode} -\prg_new_conditional:Npnn \keys_if_value:n #1 { p } +\prg_new_conditional:Npnn \@@_if_value:n #1 { p } { - \tl_if_eq:ccTF { c_keys_value_ #1 _tl } - { \c_keys_vars_root_tl \l_keys_path_tl .req } + \tl_if_eq:ccTF { c_@@_value_ #1 _tl } + { \c_@@_vars_root_tl \l_keys_path_tl .req } { \prg_return_true: } { \prg_return_false: } } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\keys_execute:} +% \begin{macro}[int]{\@@_execute:} % \begin{macro}[aux] % { -% \keys_execute_unknown:, -% \keys_execute_unknown_std:, -% \keys_execute_unknown_alt: +% \@@_execute_unknown:, +% \@@_execute_unknown_std:, +% \@@_execute_unknown_alt: % } -% \begin{macro}[aux]{\keys_execute:nn} +% \begin{macro}[aux]{\@@_execute:nn} % Actually executing a key is done in two parts. First, look for the % key itself, then look for the \texttt{unknown} key with the same % path. If both of these fail, complain. % \begin{macrocode} -\cs_new_nopar:Npn \keys_execute: - { \keys_execute:nn { \l_keys_path_tl } { \keys_execute_unknown: } } -\cs_new_nopar:Npn \keys_execute_unknown: +\cs_new_nopar:Npn \@@_execute: + { \@@_execute:nn { \l_keys_path_tl } { \@@_execute_unknown: } } +\cs_new_nopar:Npn \@@_execute_unknown: { - \keys_execute:nn { \l_keys_module_tl / unknown } + \@@_execute:nn { \l_@@_module_tl / unknown } { - \msg_kernel_error:nnxx { keys } { key-unknown } - { \l_keys_path_tl } { \l_keys_module_tl } + \__msg_kernel_error:nnxx { kernel } { key-unknown } + { \l_keys_path_tl } { \l_@@_module_tl } } } -\cs_new_eq:NN \keys_execute_unknown_std: \keys_execute_unknown: -\cs_new_nopar:Npn \keys_execute_unknown_alt: +\cs_new_eq:NN \@@_execute_unknown_std: \@@_execute_unknown: +\cs_new_nopar:Npn \@@_execute_unknown_alt: { - \clist_put_right:Nx \l_keys_unknown_clist + \clist_put_right:Nx \l_@@_unknown_clist { \exp_not:o \l_keys_key_tl - \bool_if:NF \l_keys_no_value_bool + \bool_if:NF \l_@@_no_value_bool { = { \exp_not:o \l_keys_value_tl } } } } -\cs_new:Npn \keys_execute:nn #1#2 +\cs_new:Npn \@@_execute:nn #1#2 { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 } + \cs_if_exist:cTF { \c_@@_code_root_tl #1 } { - \exp_args:Nc \exp_args:No { \c_keys_code_root_tl #1 } + \exp_args:Nc \exp_args:No { \c_@@_code_root_tl #1 } \l_keys_value_tl } {#2} @@ -1897,15 +1835,15 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\keys_choice_find:n} +% \begin{macro}[int]{\@@_choice_find:n} % Executing a choice has two parts. First, try the choice given, then % if that fails call the unknown key. That will exist, as it is created % when a choice is first made. So there is no need for any escape code. % \begin{macrocode} -\cs_new:Npn \keys_choice_find:n #1 +\cs_new:Npn \@@_choice_find:n #1 { - \keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } - { \keys_execute:nn { \l_keys_path_tl / unknown } { } } + \@@_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } + { \@@_execute:nn { \l_keys_path_tl / unknown } { } } } % \end{macrocode} % \end{macro} @@ -1917,7 +1855,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF } { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 } + \cs_if_exist:cTF { \c_@@_code_root_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } @@ -1929,7 +1867,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3 { p , T , F , TF } { - \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 / #3 } + \cs_if_exist:cTF { \c_@@_code_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } @@ -1940,7 +1878,7 @@ % Showing a key is just a question of using the correct name. % \begin{macrocode} \cs_new:Npn \keys_show:nn #1#2 - { \cs_show:c { \c_keys_code_root_tl #1 / \tl_to_str:n {#2} } } + { \cs_show:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } } % \end{macrocode} % \end{macro} % @@ -1948,23 +1886,23 @@ % % For when there is a need to complain. % \begin{macrocode} -\msg_kernel_new:nnnn { keys } { boolean-values-only } +\__msg_kernel_new:nnnn { kernel } { boolean-values-only } { Key~'#1'~accepts~boolean~values~only. } { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } -\msg_kernel_new:nnnn { keys } { choice-unknown } +\__msg_kernel_new:nnnn { kernel } { choice-unknown } { Choice~'#2'~unknown~for~key~'#1'. } { The~key~'#1'~takes~a~limited~number~of~values.\\ The~input~given,~'#2',~is~not~on~the~list~accepted. } -\msg_kernel_new:nnnn { keys } { generate-choices-before-code } +\__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } { No~code~available~to~generate~choices~for~key~'#1'. } { \c_msg_coding_error_text_tl Before~using~.generate_choices:n~the~code~should~be~defined~ with~'.choice_code:n'~or~'.choice_code:x'. } -\msg_kernel_new:nnnn { keys } { key-no-property } +\__msg_kernel_new:nnnn { kernel } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_msg_coding_error_text_tl @@ -1973,39 +1911,33 @@ ~ ~ #1 .<property> \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } -\msg_kernel_new:nnnn { keys } { key-unknown } +\__msg_kernel_new:nnnn { kernel } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { The~module~'#2'~does~not~have~a~key~called~#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } -\msg_kernel_new:nnnn { keys } { option-unknown } - { Unknown~option~'#1'~for~package~#2. } - { - LaTeX~has~been~asked~to~set~an~option~called~'#1'~ - but~the~#2~package~has~not~created~an~option~with~this~name. - } -\msg_kernel_new:nnnn { keys } { property-requires-value } +\__msg_kernel_new:nnnn { kernel } { property-requires-value } { The~property~'#1'~requires~a~value. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ No~value~was~given~for~the~property,~and~one~is~required. } -\msg_kernel_new:nnnn { keys } { property-unknown } +\__msg_kernel_new:nnnn { kernel } { property-unknown } { The~key~property~'#1'~is~unknown. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } -\msg_kernel_new:nnnn { keys } { value-forbidden } +\__msg_kernel_new:nnnn { kernel } { value-forbidden } { The~key~'#1'~does~not~taken~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ LaTeX~will~ignore~the~given~value~'#2'. } -\msg_kernel_new:nnnn { keys } { value-required } +\__msg_kernel_new:nnnn { kernel } { value-required } { The~key~'#1'~requires~a~value. } { The~key~'#1'~must~have~a~value.\\ @@ -2031,6 +1963,12 @@ % \end{macro} % \end{macro} % \end{macro} +% +% Internal material for removal by 2012-12-31. +% +% \begin{macrocode} +\cs_new_eq:NN \c_keys_code_root_tl \c__keys_code_root_tl +% \end{macrocode} % % \begin{macrocode} %</initex|package> |