Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move to indexing from 1, not 0: alter code in l3keys for choices

git-svn-id: svn+ssh://comedy.dante.de/serv/latex-project/svn/experimental/trunk@3771 de43f980-851b-0410-b2f7-c40aca1f87e0
  • Loading branch information...
commit 2f15ec1c94fbd73e6d4f1b596b625adc25ba8052 1 parent 13bd9dc
@josephwright josephwright authored
Showing with 7 additions and 9 deletions.
  1. +6 −8 l3kernel/l3keys.dtx
  2. +1 −1  l3kernel/testfiles/m3keys001.tlg
View
14 l3kernel/l3keys.dtx
@@ -209,7 +209,7 @@
% 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.}
@@ -350,7 +350,7 @@
% 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.}
@@ -462,9 +462,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
@@ -1208,6 +1206,7 @@
\int_zero:N \l_keys_choice_int
\clist_map_inline:nn {#1}
{
+ \int_incr:N \l_keys_choice_int
\keys_cmd_set:nx { \l_keys_path_tl / ##1 }
{
\tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
@@ -1215,7 +1214,6 @@
{ \int_use:N \l_keys_choice_int }
\exp_not:n {#2}
}
- \int_incr:N \l_keys_choice_int
}
}
% \end{macrocode}
@@ -1242,6 +1240,7 @@
}
\cs_new_protected:Npn \keys_choices_generate_aux:n #1
{
+ \int_incr:N \l_keys_choice_int
\keys_cmd_set:nx { \l_keys_path_tl / #1 }
{
\tl_set:Nn \exp_not:N \l_keys_choice_tl {#1}
@@ -1250,7 +1249,6 @@
\exp_not:v
{ \c_keys_vars_root_tl \l_keys_path_tl .choice~code }
}
- \int_incr:N \l_keys_choice_int
}
% \end{macrocode}
% \end{macro}
@@ -1369,6 +1367,7 @@
\int_zero:N \l_keys_choice_int
\clist_map_inline:nn {#1}
{
+ \int_incr:N \l_keys_choice_int
\keys_cmd_set:nx { \l_keys_path_tl / ##1 }
{
\tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
@@ -1376,7 +1375,6 @@
{ \int_use:N \l_keys_choice_int }
\exp_not:n {#2}
}
- \int_incr:N \l_keys_choice_int
}
}
% \end{macrocode}
View
2  l3kernel/testfiles/m3keys001.tlg
@@ -122,7 +122,7 @@ Defining \key var > module/color/white.req on line ...
->white.
<argument> \l_keys_choice_tl
l.127 }
-> 1.
+> 2.
<argument> \l_keys_choice_int
l.127 }
============================================================
Please sign in to comment.
Something went wrong with that request. Please try again.