Skip to content
This repository
Browse code

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
authored June 14, 2012
14  l3kernel/l3keys.dtx
@@ -209,7 +209,7 @@
209 209
 %   which are implemented using the \meta{code}. Inside \meta{code},
210 210
 %   \cs{l_keys_choice_tl} will be the name of the choice made, and
211 211
 %   \cs{l_keys_choice_int} will be the position of the choice in the list
212  
-%   of \meta{choices} (indexed from $0$).
  212
+%   of \meta{choices} (indexed from~$1$).
213 213
 %   Choices are discussed in detail in section~\ref{sec:choice}.
214 214
 %
215 215
 %   \textbf{This property is experimental.}
@@ -350,7 +350,7 @@
350 350
 %   which are implemented using the \meta{code}. Inside \meta{code},
351 351
 %   \cs{l_keys_choice_tl} will be the name of the choice made, and
352 352
 %   \cs{l_keys_choice_int} will be the position of the choice in the list
353  
-%   of \meta{choices} (indexed from $0$).
  353
+%   of \meta{choices} (indexed from~$1$).
354 354
 %   Choices are discussed in detail in section~\ref{sec:choice}.
355 355
 %
356 356
 %   \textbf{This property is experimental.}
@@ -462,9 +462,7 @@
462 462
 %     }
463 463
 % \end{verbatim}
464 464
 % Following common computing practice, \cs{l_keys_choice_int} is
465  
-% indexed from $0$ (as an offset), so that the value of
466  
-% \cs{l_keys_choice_int} for the first choice in a list will be
467  
-% zero.
  465
+% indexed from~$1$.
468 466
 %
469 467
 % The same approach is also implemented by the \emph{experimental}
470 468
 % property \texttt{.choices:nn}. This combines the functionality of
@@ -1208,6 +1206,7 @@
1208 1206
     \int_zero:N \l_keys_choice_int
1209 1207
     \clist_map_inline:nn {#1}
1210 1208
       {
  1209
+        \int_incr:N \l_keys_choice_int
1211 1210
         \keys_cmd_set:nx { \l_keys_path_tl / ##1 }
1212 1211
           {
1213 1212
             \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
@@ -1215,7 +1214,6 @@
1215 1214
               { \int_use:N \l_keys_choice_int }
1216 1215
             \exp_not:n {#2}
1217 1216
           }
1218  
-        \int_incr:N \l_keys_choice_int
1219 1217
       }
1220 1218
   }
1221 1219
 %    \end{macrocode}
@@ -1242,6 +1240,7 @@
1242 1240
   }
1243 1241
 \cs_new_protected:Npn \keys_choices_generate_aux:n #1
1244 1242
   {
  1243
+    \int_incr:N \l_keys_choice_int
1245 1244
     \keys_cmd_set:nx { \l_keys_path_tl / #1 }
1246 1245
       {
1247 1246
         \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1}
@@ -1250,7 +1249,6 @@
1250 1249
         \exp_not:v
1251 1250
           { \c_keys_vars_root_tl \l_keys_path_tl .choice~code }
1252 1251
       }
1253  
-    \int_incr:N \l_keys_choice_int
1254 1252
   }
1255 1253
 %    \end{macrocode}
1256 1254
 % \end{macro}
@@ -1369,6 +1367,7 @@
1369 1367
     \int_zero:N \l_keys_choice_int
1370 1368
     \clist_map_inline:nn {#1}
1371 1369
       {
  1370
+        \int_incr:N \l_keys_choice_int
1372 1371
         \keys_cmd_set:nx { \l_keys_path_tl / ##1 }
1373 1372
           {
1374 1373
             \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
@@ -1376,7 +1375,6 @@
1376 1375
               { \int_use:N \l_keys_choice_int }
1377 1376
             \exp_not:n {#2}
1378 1377
           }
1379  
-        \int_incr:N \l_keys_choice_int
1380 1378
       }
1381 1379
   }
1382 1380
 %    \end{macrocode}
2  l3kernel/testfiles/m3keys001.tlg
@@ -122,7 +122,7 @@ Defining \key var > module/color/white.req on line ...
122 122
 ->white.
123 123
 <argument> \l_keys_choice_tl 
124 124
 l.127 }
125  
-> 1.
  125
+> 2.
126 126
 <argument> \l_keys_choice_int 
127 127
 l.127 }
128 128
 ============================================================

0 notes on commit 2f15ec1

Please sign in to comment.
Something went wrong with that request. Please try again.