summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3int.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3int.dtx49
1 files changed, 29 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
index 525fb40cfe8..8e1eb820959 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
@@ -35,7 +35,7 @@
%
%<*driver|package>
\RequirePackage{l3names}
-\GetIdInfo$Id: l3int.dtx 2812 2011-09-12 09:19:26Z bruno $
+\GetIdInfo$Id: l3int.dtx 2896 2011-10-09 20:36:50Z joseph $
{L3 Experimental integers}
%</driver|package>
%<*driver>
@@ -489,7 +489,7 @@
% stream as digits, with category code $12$ (other).
% \end{function}
%
-% \begin{function}[rEXP]{\int_to_alph:n, \int_to_Alph:n}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_alph:n, \int_to_Alph:n}
% \begin{syntax}
% \cs{int_to_alph:n} \Arg{integer expression}
% \end{syntax}
@@ -515,7 +515,7 @@
% functions should not be modified.
% \end{function}
%
-% \begin{function}[rEXP]{\int_to_symbols:nnn}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_symbols:nnn}
% \begin{syntax}
% \cs{int_to_symbols:nnn}
% ~~\Arg{integer expression} \Arg{total symbols}
@@ -532,7 +532,7 @@
% \begin{verbatim}
% \cs_new:Npn \int_to_alph:n #1
% {
-% \int_convert_to_sybols:nnn {#1} { 26 }
+% \int_convert_to_symbols:nnn {#1} { 26 }
% {
% { 1 } { a }
% { 2 } { b }
@@ -543,7 +543,7 @@
% \end{verbatim}
% \end{function}
%
-% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_binary:n}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_binary:n}
% \begin{syntax}
% \cs{int_to_binary:n} \Arg{integer expression}
% \end{syntax}
@@ -551,7 +551,7 @@
% the binary representation of the result in the input stream.
% \end{function}
%
-% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_hexadecimal:n}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_hexadecimal:n}
% \begin{syntax}
% \cs{int_to_binary:n} \Arg{integer expression}
% \end{syntax}
@@ -560,7 +560,7 @@
% input stream. Upper case letters are used for digits beyond $9$.
% \end{function}
%
-% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_octal:n}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_octal:n}
% \begin{syntax}
% \cs{int_to_octal:n} \Arg{integer expression}
% \end{syntax}
@@ -569,7 +569,7 @@
% stream.
% \end{function}
%
-% \begin{function}[updated = 2011-08-16, rEXP]{\int_to_base:nn}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_base:nn}
% \begin{syntax}
% \cs{int_to_base:nn} \Arg{integer expression} \Arg{base}
% \end{syntax}
@@ -742,7 +742,7 @@
% to sanitise sign tokens from the \meta{value} (which may be symbolic).
% \end{function}
%
-% \begin{function}[EXP]{\int_to_letter:n}
+% \begin{function}[updated = 2011-09-17, EXP]{\int_to_letter:n}
% \begin{syntax}
% \cs{int_to_letter:n} \meta{integer value}
% \end{syntax}
@@ -1472,20 +1472,27 @@
% zero. Using an \texttt{f}-type expansion, this is done so that the system
% is recursive. The actual conversion function therefore gets a `nice'
% number at each stage. Of course, if the initial input was small enough
-% then there is no problem and everything is easy. This is more or less the
-% same as \cs{int_convert_number_with_rule:nnN} but \enquote{pre-packaged}.
+% then there is no problem and everything is easy.
% \begin{macrocode}
-\cs_new_nopar:Npn \int_to_symbols:nnn #1#2#3
+\cs_new:Npn \int_to_symbols:nnn #1#2#3
{
\int_compare:nNnTF {#1} > {#2}
{
- \exp_args:Nf \int_to_symbols:nnn
- { \int_div_truncate:nn { #1 - 1 } {#2} } {#2} {#3}
- \exp_args:Nf \prg_case_int:nnn
- { \int_eval:n { 1 + \int_mod:nn { #1 - 1 } {#2} } }
- {#3} { }
+ \exp_args:NNo \exp_args:No \int_to_symbols_aux:nnnn
+ {
+ \prg_case_int:nnn
+ { 1 + \int_mod:nn { #1 - 1 } {#2} }
+ {#3} { }
+ }
+ {#1} {#2} {#3}
}
- { \exp_args:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } }
+ { \prg_case_int:nnn {#1} {#3} { } }
+ }
+\cs_new:Npn \int_to_symbols_aux:nnnn #1#2#3#4
+ {
+ \exp_args:Nf \int_to_symbols:nnn
+ { \int_div_truncate:nn { #2 - 1 } {#3} } {#3} {#4}
+ #1
}
% \end{macrocode}
% \end{macro}
@@ -1620,6 +1627,8 @@
% to use the \cs{if_case:w} primitive. The first \cs{exp_after:wN}
% expands the conditional, jumping to the correct case, the second one
% expands after the resulting character to close the conditional.
+% Since |#1| might be an expression, and not directly a single digit,
+% we need to evaluate it properly, and expand the trailing \cs{fi:}.
% \begin{macrocode}
\cs_new:Npn \int_to_letter:n #1
{
@@ -1651,7 +1660,7 @@
\or: X
\or: Y
\or: Z
- \else: #1
+ \else: \int_value:w \int_eval:w #1 \exp_after:wN \int_eval_end:
\fi:
}
% \end{macrocode}
@@ -1886,7 +1895,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{variable}[aux]
+% \begin{variable}
% {
% \c_int_from_roman_i_int, \c_int_from_roman_v_int,
% \c_int_from_roman_x_int, \c_int_from_roman_l_int,