diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3int.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 118 |
1 files changed, 66 insertions, 52 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index cef7ea6897b..bc5675b9a9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3int.dtx Copyright (C) 1990-2016 The LaTeX3 Project +%% File: l3int.dtx Copyright (C) 1990-2017 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3int.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3int.dtx 6949 2017-02-18 16:04:10Z joseph $ {L3 Integers} %</driver|package> %<*driver> @@ -777,11 +777,25 @@ % on the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\int_log:N, \int_log:c} +% \begin{syntax} +% \cs{int_log:N} \meta{integer} +% \end{syntax} +% Writes the value of the \meta{integer} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\int_log:n} +% \begin{syntax} +% \cs{int_log:n} \Arg{integer expression} +% \end{syntax} +% Writes the result of evaluating the \meta{integer expression} +% in the log file. +% \end{function} +% % \section{Constant integers} % % \begin{variable} % { -% \c_minus_one , % \c_zero , % \c_one , % \c_two , @@ -805,7 +819,7 @@ % \c_two_hundred_fifty_six , % \c_one_thousand , % \c_ten_thousand -% } +% } % Integer values used with primitive tests and assignments: % self-terminating nature makes these more convenient and faster than % literal numbers. @@ -999,19 +1013,11 @@ % \subsection{Integer expressions} % % \begin{macro}{\int_eval:n} -% Wrapper for \cs{@@_eval:w}. Can be used in an integer expression -% or directly in the input stream. In format mode, there is already -% a definition in \pkg{l3alloc} for bootstrapping, which is therefore -% corrected to the \enquote{real} version here. +% Wrapper for \cs{@@_eval:w}: can be used in an integer expression +% or directly in the input stream. % \begin{macrocode} -%<*initex> -\cs_set:Npn \int_eval:n #1 - { \@@_value:w \@@_eval:w #1 \@@_eval_end: } -%</initex> -%<*package> \cs_new:Npn \int_eval:n #1 { \@@_value:w \@@_eval:w #1 \@@_eval_end: } -%</package> % \end{macrocode} % \end{macro} % @@ -1098,12 +1104,12 @@ \cs_new:Npn \@@_div_truncate:NwNw #1#2; #3#4; { \if_meaning:w 0 #1 - \c_zero + 0 \else: ( #1#2 \if_meaning:w - #1 + \else: - \fi: - ( \if_meaning:w - #3 - \fi: #3#4 - \c_one ) / \c_two + ( \if_meaning:w - #3 - \fi: #3#4 - 1 ) / 2 ) \fi: / #3#4 @@ -1922,13 +1928,13 @@ { \exp_args:Nf \@@_to_Base:nn { \int_eval:n {#1} } } \cs_new:Npn \@@_to_base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \@@_to_base:nnN { \use_none:n #1 } {#2} - } { \@@_to_base:nnN {#1} {#2} \c_empty_tl } } \cs_new:Npn \@@_to_Base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \@@_to_Base:nnN { \use_none:n #1 } {#2} - } { \@@_to_Base:nnN {#1} {#2} \c_empty_tl } } @@ -1996,7 +2002,7 @@ \cs_new:Npn \@@_to_letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \@@_eval:w #1 - \c_ten \@@_eval_end: + \if_case:w \@@_eval:w #1 - 10 \@@_eval_end: a \or: b \or: c @@ -2029,7 +2035,7 @@ \cs_new:Npn \@@_to_Letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \@@_eval:w #1 - \c_ten \@@_eval_end: + \if_case:w \@@_eval:w #1 - 10 \@@_eval_end: A \or: B \or: C @@ -2234,11 +2240,11 @@ % Wrappers around the generic function. % \begin{macrocode} \cs_new:Npn \int_from_bin:n #1 - { \int_from_base:nn {#1} \c_two } + { \int_from_base:nn {#1} { 2 } } \cs_new:Npn \int_from_hex:n #1 - { \int_from_base:nn {#1} \c_sixteen } + { \int_from_base:nn {#1} { 16 } } \cs_new:Npn \int_from_oct:n #1 - { \int_from_base:nn {#1} \c_eight } + { \int_from_base:nn {#1} { 8 } } % \end{macrocode} % \end{macro} % @@ -2288,7 +2294,7 @@ \int_eval:n { ( - \c_zero + 0 \exp_after:wN \@@_from_roman:NN \tl_to_str:n {#1} \q_recursion_tail \q_recursion_tail \q_recursion_stop ) @@ -2318,7 +2324,7 @@ } } \cs_new:Npn \@@_from_roman_error:w #1 \q_recursion_stop #2 - { #2 * \c_zero - \c_one } + { #2 * 0 - 1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -2328,24 +2334,14 @@ % % \begin{macro}{\int_show:N, \int_show:c} % \UnitTested -% This is very similar to other registers done using -% \cs{__kernel_register_show:N}, but differs because the variable -% |#1| may be \tn{currentgrouplevel} or \tn{currentgrouptype}, in -% which case the value must be expanded in the current scope rather -% than when processing \cs{iow_wrap:nnnN}. +% \begin{macro}[aux]{\@@_show:nN} +% Diagnostics. % \begin{macrocode} -\cs_new_protected:Npn \int_show:N #1 - { - \use:x - { - \exp_not:n - { \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } } - { > ~ \token_to_str:N #1 = \tex_the:D #1 } - } - } +\cs_new_eq:NN \int_show:N \__kernel_register_show:N \cs_generate_variant:Nn \int_show:N { c } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\int_show:n} % \UnitTested @@ -2357,6 +2353,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\int_log:N, \int_log:c} +% Diagnostics. +% \begin{macrocode} +\cs_new_eq:NN \int_log:N \__kernel_register_log:N +\cs_generate_variant:Nn \int_log:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\int_log:n} +% Redirect output of \cs{int_show:n} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \int_log:n + { \__msg_log_next: \int_show:n } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant integers} % % \begin{variable}{\c_zero} @@ -2390,19 +2402,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_minus_one} -% The actual allocation mechanism is in \pkg{l3alloc}; it requires -% \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. -% \begin{macrocode} -%<*package> -\cs_new_eq:NN \c_minus_one \m@ne -%</package> -%<*initex> -\int_const:Nn \c_minus_one { -1 } -%</initex> -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\c_thirty_two} % One middling value. % \begin{macrocode} @@ -2469,6 +2468,21 @@ % \end{variable} % \end{variable} % +% \subsection{Deprecated} +% +% \begin{variable}[deprecated = 2018-12-31]{\c_minus_one} +% The actual allocation mechanism is in \pkg{l3alloc}; it requires +% \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. +% \begin{macrocode} +%<*package> +\cs_new_eq:NN \c_minus_one \m@ne +%</package> +%<*initex> +\int_const:Nn \c_minus_one { -1 } +%</initex> +% \end{macrocode} +% \end{variable} +% % \begin{macrocode} %</initex|package> % \end{macrocode} |