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.dtx101
1 files changed, 69 insertions, 32 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
index 78d244e3845..42036030d8d 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3int.dtx 5372 2014-08-25 02:01:41Z bruno $
+\GetIdInfo$Id: l3int.dtx 5421 2014-09-14 07:52:58Z joseph $
{L3 Integers}
%</driver|package>
%<*driver>
@@ -100,10 +100,17 @@
% both evaluate to \( -6 \). The \Arg{integer expression} may
% contain the operators \texttt{+}, \texttt{-}, \texttt{*} and
% \texttt{/}, along with parenthesis \texttt{(} and \texttt{)}.
-% After two expansions, \cs{int_eval:n} yields an
-% \meta{integer denotation} which is left in the input stream. This is
-% \emph{not} an \meta{internal integer}, and therefore requires
-% suitable termination if used in a \TeX{}-style integer assignment.
+% Any functions within the expressions should expand to an
+% \meta{integer denotation}: a sequence of a sign and digits matching
+% the regex |\-?[0-9]+|).
+% After expansion \cs{int_eval:n} yields an \meta{integer denotation}
+% which is left in the input stream.
+% \begin{texnote}
+% Exactly two expansions are needed to evaluate \cs{int_eval:n}.
+% The result is \emph{not} an \meta{internal integer}, and therefore
+% requires suitable termination if used in a \TeX{}-style integer
+% assignment.
+% \end{texnote}
% \end{function}
%
% \begin{function}[EXP, updated = 2012-09-26]{\int_abs:n}
@@ -587,6 +594,8 @@
% \cs{int_to_symbols:nnn} to define an alphabet-specific
% function. The basic \cs{int_to_alph:n} and \cs{int_to_Alph:n}
% functions should not be modified.
+% The resulting tokens are digits with category code $12$ (other) and
+% letters with category code $11$ (letter).
% \end{function}
%
% \begin{function}[updated = 2011-09-17, EXP]{\int_to_symbols:nnn}
@@ -634,6 +643,8 @@
% input stream. Letters are used for digits beyond~$9$: lower
% case letters for \cs{int_to_hex:n} and upper case ones for
% \cs{int_to_Hex:n}.
+% The resulting tokens are digits with category code $12$ (other) and
+% letters with category code $11$ (letter).
% \end{function}
%
% \begin{function}[added = 2014-02-11, EXP]{\int_to_oct:n}
@@ -643,6 +654,8 @@
% Calculates the value of the \meta{integer expression} and places
% the octal (base~$8$) representation of the result in the input
% stream.
+% The resulting tokens are digits with category code $12$ (other) and
+% letters with category code $11$ (letter).
% \end{function}
%
% \begin{function}[updated = 2014-02-11, EXP]
@@ -658,6 +671,8 @@
% case letters for \cs{int_to_base:n} and upper case ones for
% \cs{int_to_Base:n}.
% The maximum \meta{base} value is $36$.
+% The resulting tokens are digits with category code $12$ (other) and
+% letters with category code $11$ (letter).
% \begin{texnote}
% This is a generic version of \cs{int_to_bin:n}, \emph{etc.}
% \end{texnote}
@@ -675,63 +690,85 @@
%
% \section{Converting from other formats to integers}
%
-% \begin{function}[EXP]{\int_from_alph:n}
+% \begin{function}[updated = 2014-08-25, EXP]{\int_from_alph:n}
% \begin{syntax}
% \cs{int_from_alph:n} \Arg{letters}
% \end{syntax}
% Converts the \meta{letters} into the integer (base~$10$)
-% representation and leaves this in the input stream. The
-% \meta{letters} are treated using the English alphabet only, with
-% \enquote{a} equal to $1$ through to \enquote{z} equal to $26$. Either lower
-% or upper case letters may be used. This is the inverse function of
-% \cs{int_to_alph:n}.
+% representation and leaves this in the input stream. The
+% \meta{letters} are first converted to a string, with no expansion.
+% Lower and upper case letters from the English alphabet may be used,
+% with \enquote{a} equal to $1$ through to \enquote{z} equal to $26$.
+% The function also accepts a leading sign, made of |+| and~|-|. This
+% is the inverse function of \cs{int_to_alph:n} and
+% \cs{int_to_Alph:n}.
% \end{function}
%
-% \begin{function}[added = 2014-02-11, EXP]{\int_from_bin:n}
+% \begin{function}[added = 2014-02-11, updated = 2014-08-25, EXP]
+% {\int_from_bin:n}
% \begin{syntax}
% \cs{int_from_bin:n} \Arg{binary number}
% \end{syntax}
% Converts the \meta{binary number} into the integer (base~$10$)
% representation and leaves this in the input stream.
+% The \meta{binary number} is first converted to a string, with no
+% expansion. The function accepts a leading sign, made of |+|
+% and~|-|, followed by binary digits. This is the inverse function
+% of \cs{int_to_bin:n}.
% \end{function}
%
-% \begin{function}[added = 2014-02-11, EXP]{\int_from_hex:n}
+% \begin{function}[added = 2014-02-11, updated = 2014-08-25, EXP]
+% {\int_from_hex:n}
% \begin{syntax}
% \cs{int_from_hex:n} \Arg{hexadecimal number}
% \end{syntax}
-% Converts the \meta{hexadecimal number} into the integer
-% (base~$10$) representation and leaves this in the input stream.
-% Digits greater than $9$ may be represented in the
-% \meta{hexadecimal number} by upper or lower case letters.
+% Converts the \meta{hexadecimal number} into the integer (base~$10$)
+% representation and leaves this in the input stream. Digits greater
+% than $9$ may be represented in the \meta{hexadecimal number} by
+% upper or lower case letters. The \meta{hexadecimal number} is first
+% converted to a string, with no expansion. The function also accepts
+% a leading sign, made of |+| and~|-|. This is the inverse function
+% of \cs{int_to_hex:n} and \cs{int_to_Hex:n}.
% \end{function}
%
-% \begin{function}[added = 2014-02-11, EXP]{\int_from_oct:n}
+% \begin{function}[added = 2014-02-11, updated = 2014-08-25, EXP]
+% {\int_from_oct:n}
% \begin{syntax}
% \cs{int_from_oct:n} \Arg{octal number}
% \end{syntax}
% Converts the \meta{octal number} into the integer (base~$10$)
% representation and leaves this in the input stream.
+% The \meta{octal number} is first converted to a string, with no
+% expansion. The function accepts a leading sign, made of |+|
+% and~|-|, followed by octal digits. This is the inverse function
+% of \cs{int_to_oct:n}.
% \end{function}
%
-% \begin{function}[updated = 2014-08-25, EXP]{\int_from_roman:n}
+% \begin{function}[updated = 2014-08-25, updated = 2014-08-25, EXP]
+% {\int_from_roman:n}
% \begin{syntax}
% \cs{int_from_roman:n} \Arg{roman numeral}
% \end{syntax}
% Converts the \meta{roman numeral} into the integer (base~$10$)
-% representation and leaves this in the input stream. The
+% representation and leaves this in the input stream. The \meta{roman
+% numeral} is first converted to a string, with no expansion. The
% \meta{roman numeral} may be in upper or lower case; if the numeral
-% contains letters besides |mdclxvi| or |MDCLXVI| then the resulting
-% value will be $-1$.
+% contains characters besides |mdclxvi| or |MDCLXVI| then the
+% resulting value will be $-1$. This is the inverse function of
+% \cs{int_to_roman:n} and \cs{int_to_Roman:n}.
% \end{function}
%
-% \begin{function}[EXP]{\int_from_base:nn}
+% \begin{function}[updated = 2014-08-25, EXP]{\int_from_base:nn}
% \begin{syntax}
% \cs{int_from_base:nn} \Arg{number} \Arg{base}
% \end{syntax}
-% Converts the \meta{number} in \meta{base} into the appropriate
-% value in base $10$. The \meta{number} should consist of
-% digits and letters (either lower or upper case), plus optionally
-% a leading sign. The maximum \meta{base} value is $36$.
+% Converts the \meta{number} expressed in \meta{base} into the
+% appropriate value in base $10$. The \meta{number} is first
+% converted to a string, with no expansion. The \meta{number} should
+% consist of digits and letters (either lower or upper case), plus
+% optionally a leading sign. The maximum \meta{base} value is $36$.
+% This is the inverse function of \cs{int_to_base:nn} and
+% \cs{int_to_Base:nn}.
% \end{function}
%
% \section{Viewing integers}
@@ -941,7 +978,7 @@
% Done in \pkg{l3basics}.
% \end{macro}
% \end{macro}
-%
+%
% \begin{macro}{\or:}
% Done in \pkg{l3basics}.
% \end{macro}
@@ -1754,7 +1791,7 @@
% \UnitTested
% Nothing exciting here.
% \begin{macrocode}
-\cs_new:Npn \int_to_arabic:n #1 { \int_eval:n {#1} }
+\cs_new_eq:NN \int_to_arabic:n \int_eval:n
% \end{macrocode}
% \end{macro}
%
@@ -1795,7 +1832,7 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\int_to_alph:n,\int_to_Alph:n}
+% \begin{macro}{\int_to_alph:n, \int_to_Alph:n}
% \UnitTested
% These both use the above function with input functions that make sense
% for the alphabet in English.
@@ -2138,7 +2175,7 @@
{
\int_eval:n
{
- \@@_pass_signs:wn #1
+ \exp_after:wN \@@_pass_signs:wn \tl_to_str:n {#1}
\q_stop { \@@_from_alph:nN { 0 } }
\q_recursion_tail \q_recursion_stop
}
@@ -2170,7 +2207,7 @@
{
\int_eval:n
{
- \@@_pass_signs:wn #1
+ \exp_after:wN \@@_pass_signs:wn \tl_to_str:n {#1}
\q_stop { \@@_from_base:nnN { 0 } {#2} }
\q_recursion_tail \q_recursion_stop
}