summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/expl3/l3keys.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3keys.dtx')
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3keys.dtx87
1 files changed, 62 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3keys.dtx b/Master/texmf-dist/source/latex/expl3/l3keys.dtx
index e606f91f0a1..2940e7a7842 100644
--- a/Master/texmf-dist/source/latex/expl3/l3keys.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3keys.dtx
@@ -35,7 +35,7 @@
\RequirePackage{l3names}
%</driver|package>
%\fi
-\GetIdInfo$Id: l3keys.dtx 1441 2009-08-05 19:23:23Z joseph $
+\GetIdInfo$Id: l3keys.dtx 1504 2009-09-03 20:29:00Z joseph $
{L3 Experimental key-value support}
%\iffalse
%<*driver>
@@ -152,7 +152,7 @@
%
%\begin{function}{\keys_define:nn}
% \begin{syntax}
-% "\keys_define:nn" <module> <keyval list>
+% "\keys_define:nn" \Arg{module} \Arg{keyval list}
% \end{syntax}
% Parses the <keyval list> and defines the keys listed there for
% <module>. This function is designed for use in code, and therefore
@@ -271,10 +271,13 @@
% <key> .initial:n = <initial>
% \end{syntax}
% Sets <key> using the <initial> value given. This can only be given
-% after the<key> is created.
+% after the <key> is created.
%\end{function}
%
-%\begin{function}{.meta:n}
+%\begin{function}{
+% .meta:n|
+% .meta:x
+%}
% \begin{syntax}
% <key> .meta:n = <keys>
% \end{syntax}
@@ -414,7 +417,7 @@
% \keys_set:nv
%}
% \begin{syntax}
-% "\keys_set:nn" <module> <keyval list>
+% "\keys_set:nn" \Arg{module} \Arg{keyval list}
% \end{syntax}
% Parses the <keyval list>, and sets those keys which are defined
% for <module>. The behaviour on finding an unknown key can be
@@ -443,9 +446,18 @@
%
%\subsection{Examining keys: internal representation}
%
+%\begin{function}{\keys_if_exist:nn / (TF)}
+% \begin{syntax}
+% "\keys_if_exist:nnTF" \Arg{module} \Arg{key} \Arg{true code}
+% ~~~~\Arg{false code}
+% \end{syntax}
+% Tests if <key> exists for <module>, by checking for the existence
+% of the internal function \cs{keys > <module>/<key>.cmd:w}.
+%\end{function}
+%
%\begin{function}{\keys_show:nn}
% \begin{syntax}
-% "\keys_show:nn" <module> <key>
+% "\keys_show:nn" \Arg{module} \Arg{key}
% \end{syntax}
% Shows the internal representation of a <key>. The function which
% executes a <key> is called \cs{keys > <module>/<key>.cmd:w}.
@@ -480,14 +492,14 @@
%
%\begin{function}{\keys_choices_generate:nx}
% \begin{syntax}
-% "\keys_choices_generate:nx" <comma list> <code>
+% "\keys_choices_generate:nx" \Arg{comma list} \Arg{code}
% \end{syntax}
% Makes <comma list> choices for <key>, each using <code>.
%\end{function}
%
%\begin{function}{\keys_choice_find:n}
% \begin{syntax}
-% "\keys_choice_find:n" <choice>
+% "\keys_choice_find:n" \Arg{choice}
% \end{syntax}
% Searches for <choice> as a sub-key of <key>.
%\end{function}
@@ -497,7 +509,7 @@
% \keys_cmd_set:nNx
%}
% \begin{syntax}
-% "\keys_cmd_set:nNn" <path> <num args> <code>
+% "\keys_cmd_set:nNn" \Arg{path} <num args> \Arg{code}
% \end{syntax}
% Creates a function for <path>, taking <num args> and using <code>.
%\end{function}
@@ -507,7 +519,7 @@
% \keys_default_set:V
%}
% \begin{syntax}
-% "\keys_default_set:n" <default>
+% "\keys_default_set:n" \Arg{default}
% \end{syntax}
% Sets <default> for <key>.
%\end{function}
@@ -517,14 +529,14 @@
% \keys_define_elt:nn
%}
% \begin{syntax}
-% "\keys_define_elt:n" <key> <value>
+% "\keys_define_elt:nn" \Arg{key} \Arg{value}
% \end{syntax}
% Processing functions for key--value pairs when defining keys.
%\end{function}
%
%\begin{function}{\keys_define_key:n}
% \begin{syntax}
-% "\keys_define_key:n" <key>
+% "\keys_define_key:n" \Arg{key}
% \end{syntax}
% Defines <key>.
%\end{function}
@@ -545,8 +557,8 @@
%
%\begin{function}{\keys_if_value_requirement:nTF}
% \begin{syntax}
-% "\keys_if_value_requirement:nTF" <requirement>
-% ~~~~<true code> <false code>
+% "\keys_if_value_requirement:nTF" \Arg{requirement}
+% ~~~~\Arg{true code} \Arg{false code}
% \end{syntax}
% Check if <requirement> applies to <key>.
%\end{function}
@@ -556,35 +568,38 @@
% \keys_initial_value:V
%}
% \begin{syntax}
-% "\keys_initial_value:n" <value>
+% "\keys_initial_value:n" \Arg{value}
% \end{syntax}
% Sets <value> as initial contents for <key>.
%\end{function}
%
-%\begin{function}{\keys_meta_make:n}
+%\begin{function}{
+% \keys_meta_make:n|
+% \keys_meta_make:x
+%}
% \begin{syntax}
-% "\keys_meta_make:n" <keys>
+% "\keys_meta_make:n" \Arg{keys}
% \end{syntax}
% Makes <key> a meta-key to set <keys>.
%\end{function}
%
%\begin{function}{\keys_property_find:n}
% \begin{syntax}
-% "\keys_property_find:n" <key>
+% "\keys_property_find:n" \Arg{key}
% \end{syntax}
% Separates <key> from <property>.
%\end{function}
%
%\begin{function}{\keys_property_new:nn}
% \begin{syntax}
-% "\keys_property_new:nn" <property> <code>
+% "\keys_property_new:nn" \Arg{property} \Arg{code}
% \end{syntax}
% Makes a new <property> expanding to <code>
%\end{function}
%
%\begin{function}{\keys_property_undefine:n}
% \begin{syntax}
-% "\keys_property_undefine:n" <property>
+% "\keys_property_undefine:n" \Arg{property}
% \end{syntax}
% Deletes <property> of <key>.
%\end{function}
@@ -594,7 +609,7 @@
% \keys_set_elt:nn
%}
% \begin{syntax}
-% "\keys_set_elt:n" <key> <value>
+% "\keys_set_elt:nn" \Arg{key} \Arg{value}
% \end{syntax}
% Processing functions for key--value pairs when setting keys.
%\end{function}
@@ -608,7 +623,7 @@
%
%\begin{function}{\keys_value_or_default:n}
% \begin{syntax}
-% "\keys_value_or_default:n" <value>
+% "\keys_value_or_default:n" \Arg{value}
% \end{syntax}
% Sets \cs{l_keys_value_toks} to <value>, or <default> if
% <value> was not given and if <default> is available.
@@ -616,7 +631,7 @@
%
%\begin{function}{\keys_value_requirement:n}
% \begin{syntax}
-% "\keys_value_requirement:nn" <requirement>
+% "\keys_value_requirement:n" \Arg{requirement}
% \end{syntax}
% Sets <key> to have <requirement> concerning <value>.
%\end{function}
@@ -1047,6 +1062,20 @@
%\end{macro}
%\end{macro}
%
+%\begin{macro}[TF]{\keys_if_exist:nn}
+% A check for the existance of a key. This works by looking for the
+% command function for the key (which ends \texttt{.cmd:w}).
+% \begin{macrocode}
+\prg_set_conditional:Nnn \keys_if_exist:nn {TF,T,F} {
+ \cs_if_exist:cTF { \c_keys_root_tl #1 / #2 .cmd:w } {
+ \prg_return_true:
+ }{
+ \prg_return_false:
+ }
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\keys_if_value_requirement:nTF}
% To test if a value is required or forbidden. Only one version is
% needed, so done by hand.
@@ -1076,6 +1105,7 @@
%\end{macro}
%
%\begin{macro}{\keys_meta_make:n}
+%\begin{macro}{\keys_meta_make:x}
% To create a met-key, simply set up to pass data through.
% \begin{macrocode}
\cs_new_nopar:Nn \keys_meta_make:n {
@@ -1083,8 +1113,10 @@
\exp_not:N \keys_set:nn { \l_keys_module_tl } {#1}
}
}
+\cs_generate_variant:Nn \keys_meta_make:n { x }
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
%\begin{macro}{\keys_property_find:n}
%\begin{macro}[aux]{\keys_property_find_aux:n}
@@ -1192,7 +1224,7 @@
\keys_value_or_default:n {#2}
\keys_if_value_requirement:nTF { required } {
\bool_if:NTF \l_keys_no_value_bool {
- \msg_kernel_error:nx { key~value~required } { \l_keys_path_tl }
+ \msg_kernel_error:nx { key-value-required } { \l_keys_path_tl }
}{
\keys_set_elt_aux:
}
@@ -1441,13 +1473,18 @@
%\end{macro}
%
%\begin{macro}{.meta:n}
+%\begin{macro}{.meta:x}
% Making a meta is handled internally.
% \begin{macrocode}
\keys_property_new:nn { .meta:n } {
\keys_meta_make:n {#1}
}
+\keys_property_new:nn { .meta:x } {
+ \keys_meta_make:x {#1}
+}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
%\begin{macro}{.set:N}
%\begin{macro}{.set_x:N}
@@ -1496,7 +1533,7 @@
The key `#1' cannot taken a value:\\%
the given input `#2' is being ignored.%
}
-\msg_kernel_new:nn { key~value~required } {%
+\msg_kernel_new:nn { key-value-required } {%
The key `#1' requires a value\\%
and is being ignored.%
}