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.dtx96
1 files changed, 59 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx
index 9eb4b79cc34..c2e913ef444 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 6441 2016-03-24 10:11:59Z joseph $
+\GetIdInfo$Id: l3int.dtx 6700 2016-09-07 22:16:49Z bruno $
{L3 Integers}
%</driver|package>
%<*driver>
@@ -205,7 +205,8 @@
% \cs{int_zero_new:N} \meta{integer}
% \end{syntax}
% Ensures that the \meta{integer} exists globally by applying
-% \cs{int_new:N} if necessary, then applies \cs{int_(g)zero:N} to leave
+% \cs{int_new:N} if necessary, then applies
+% \cs[index=int_zero:N]{int_(g)zero:N} to leave
% the \meta{integer} set to zero.
% \end{function}
%
@@ -355,7 +356,7 @@
% \end{center}
% \end{function}
%
-% \begin{function}[added = 2013-07-24, EXP, TF]{\int_case:nn}
+% \begin{function}[added = 2013-07-24, EXP, noTF]{\int_case:nn}
% \begin{syntax}
% \cs{int_case:nnTF} \Arg{test integer expression} \\
% ~~|{| \\
@@ -831,6 +832,10 @@
% Maximum number of registers.
% \end{variable}
%
+% \begin{variable}{\c_max_char_int}
+% Maximum character code completely supported by the engine.
+% \end{variable}
+%
% \section{Scratch integers}
%
% \begin{variable}{\l_tmpa_int, \l_tmpb_int}
@@ -949,7 +954,7 @@
% \cs{__prg_compare_error:}
% \cs{__prg_compare_error:Nw} \meta{token}
% \end{syntax}
-% These are used within \cs{int_compare:n(TF)}, \cs{dim_compare:n(TF)}
+% These are used within \cs{int_compare:nTF}, \cs{dim_compare:nTF}
% and so on to recover correctly if the \texttt{n}-type argument does not
% contain a properly-formed relation.
% \end{function}
@@ -1172,7 +1177,11 @@
% \begin{macrocode}
\cs_new_protected:Npn \int_const:Nn #1#2
{
- \int_compare:nNnTF {#2} > \c_minus_one
+ \int_compare:nNnTF {#2} < \c_zero
+ {
+ \int_new:N #1
+ \int_gset:Nn #1 {#2}
+ }
{
\int_compare:nNnTF {#2} > \c__max_constdef_int
{
@@ -1185,10 +1194,6 @@
\@@_eval:w #2 \@@_eval_end:
}
}
- {
- \int_new:N #1
- \int_gset:Nn #1 {#2}
- }
}
\cs_generate_variant:Nn \int_const:Nn { c }
\if_int_odd:w 0
@@ -1280,9 +1285,9 @@
{ \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: }
\cs_new_protected:Npn \int_sub:Nn #1#2
{ \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: }
-\cs_new_protected_nopar:Npn \int_gadd:Nn
+\cs_new_protected:Npn \int_gadd:Nn
{ \tex_global:D \int_add:Nn }
-\cs_new_protected_nopar:Npn \int_gsub:Nn
+\cs_new_protected:Npn \int_gsub:Nn
{ \tex_global:D \int_sub:Nn }
\cs_generate_variant:Nn \int_add:Nn { c }
\cs_generate_variant:Nn \int_gadd:Nn { c }
@@ -1309,9 +1314,9 @@
{ \tex_advance:D #1 \c_one }
\cs_new_protected:Npn \int_decr:N #1
{ \tex_advance:D #1 \c_minus_one }
-\cs_new_protected_nopar:Npn \int_gincr:N
+\cs_new_protected:Npn \int_gincr:N
{ \tex_global:D \int_incr:N }
-\cs_new_protected_nopar:Npn \int_gdecr:N
+\cs_new_protected:Npn \int_gdecr:N
{ \tex_global:D \int_decr:N }
\cs_generate_variant:Nn \int_incr:N { c }
\cs_generate_variant:Nn \int_decr:N { c }
@@ -1333,7 +1338,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \int_set:Nn #1#2
{ #1 ~ \@@_eval:w #2\@@_eval_end: }
-\cs_new_protected_nopar:Npn \int_gset:Nn { \tex_global:D \int_set:Nn }
+\cs_new_protected:Npn \int_gset:Nn { \tex_global:D \int_set:Nn }
\cs_generate_variant:Nn \int_set:Nn { c }
\cs_generate_variant:Nn \int_gset:Nn { c }
% \end{macrocode}
@@ -1371,7 +1376,7 @@
% cleaning up the end of the test and telling the user what the
% problem was.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \__prg_compare_error:
+\cs_new_protected:Npn \__prg_compare_error:
{
\if_int_compare:w \c_zero \c_zero \fi:
=
@@ -1546,8 +1551,7 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[EXP]{\int_case:nn}
-% \begin{macro}[EXP, TF]{\int_case:nn}
+% \begin{macro}[EXP, noTF]{\int_case:nn}
% \begin{macro}[aux]{\@@_case:nnTF}
% \begin{macro}[aux]{\@@_case:nw, \@@_case_end:nw}
% For integer cases, the first task to fully expand the check
@@ -1587,7 +1591,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[pTF]{\int_if_odd:n}
% \UnitTested
@@ -1765,18 +1768,18 @@
% \cs{scan_stop:}, so no breaking function will recognize this break
% point as its own.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_step_inline:nnnn
+\cs_new_protected:Npn \int_step_inline:nnnn
{
\int_gincr:N \g__prg_map_int
\exp_args:NNc \@@_step:NNnnnn
- \cs_gset_nopar:Npn
+ \cs_gset:Npn
{ __prg_map_ \int_use:N \g__prg_map_int :w }
}
\cs_new_protected:Npn \int_step_variable:nnnNn #1#2#3#4#5
{
\int_gincr:N \g__prg_map_int
\exp_args:NNc \@@_step:NNnnnn
- \cs_gset_nopar:Npx
+ \cs_gset:Npx
{ __prg_map_ \int_use:N \g__prg_map_int :w }
{#1}{#2}{#3}
{
@@ -2128,21 +2131,21 @@
\use:c { @@_to_Roman_ #1 :w }
\@@_to_Roman_aux:N
}
-\cs_new_nopar:Npn \@@_to_roman_i:w { i }
-\cs_new_nopar:Npn \@@_to_roman_v:w { v }
-\cs_new_nopar:Npn \@@_to_roman_x:w { x }
-\cs_new_nopar:Npn \@@_to_roman_l:w { l }
-\cs_new_nopar:Npn \@@_to_roman_c:w { c }
-\cs_new_nopar:Npn \@@_to_roman_d:w { d }
-\cs_new_nopar:Npn \@@_to_roman_m:w { m }
-\cs_new_nopar:Npn \@@_to_roman_Q:w #1 { }
-\cs_new_nopar:Npn \@@_to_Roman_i:w { I }
-\cs_new_nopar:Npn \@@_to_Roman_v:w { V }
-\cs_new_nopar:Npn \@@_to_Roman_x:w { X }
-\cs_new_nopar:Npn \@@_to_Roman_l:w { L }
-\cs_new_nopar:Npn \@@_to_Roman_c:w { C }
-\cs_new_nopar:Npn \@@_to_Roman_d:w { D }
-\cs_new_nopar:Npn \@@_to_Roman_m:w { M }
+\cs_new:Npn \@@_to_roman_i:w { i }
+\cs_new:Npn \@@_to_roman_v:w { v }
+\cs_new:Npn \@@_to_roman_x:w { x }
+\cs_new:Npn \@@_to_roman_l:w { l }
+\cs_new:Npn \@@_to_roman_c:w { c }
+\cs_new:Npn \@@_to_roman_d:w { d }
+\cs_new:Npn \@@_to_roman_m:w { m }
+\cs_new:Npn \@@_to_roman_Q:w #1 { }
+\cs_new:Npn \@@_to_Roman_i:w { I }
+\cs_new:Npn \@@_to_Roman_v:w { V }
+\cs_new:Npn \@@_to_Roman_x:w { X }
+\cs_new:Npn \@@_to_Roman_l:w { L }
+\cs_new:Npn \@@_to_Roman_c:w { C }
+\cs_new:Npn \@@_to_Roman_d:w { D }
+\cs_new:Npn \@@_to_Roman_m:w { M }
\cs_new:Npn \@@_to_Roman_Q:w #1 { }
% \end{macrocode}
% \end{macro}
@@ -2362,7 +2365,7 @@
% We don't use the \TeX{} primitive \tn{showthe} to show integer
% expressions: this gives a more unified output.
% \begin{macrocode}
-\cs_new_protected_nopar:Npn \int_show:n
+\cs_new_protected:Npn \int_show:n
{ \__msg_show_wrap:Nn \int_eval:n }
% \end{macrocode}
% \end{macro}
@@ -2435,6 +2438,25 @@
% \end{macrocode}
% \end{variable}
%
+% \begin{variable}{\c_max_char_int}
+% The largest character code is $1114111$ (hexadecimal |10FFFF|) in
+% \XeTeX{} and \LuaTeX{} and $255$ in other engines. In many places
+% \pTeX{} and \upTeX{} support larger character codes but for instance
+% the values of \tn{lccode} are restricted to $[0,255]$.
+% \begin{macrocode}
+\int_const:Nn \c_max_char_int
+ {
+ \if_int_odd:w 0
+ \cs_if_exist:NT \luatex_luatexversion:D { 1 }
+ \cs_if_exist:NT \xetex_XeTeXversion:D { 1 } ~
+ "10FFFF
+ \else:
+ "FF
+ \fi:
+ }
+% \end{macrocode}
+% \end{variable}
+%
% \subsection{Scratch integers}
%
% \begin{variable}{\l_tmpa_int, \l_tmpb_int}