diff options
34 files changed, 2978 insertions, 2176 deletions
diff --git a/Master/texmf-dist/doc/latex/expl3/expl3.pdf b/Master/texmf-dist/doc/latex/expl3/expl3.pdf Binary files differindex c95bcedc00a..d94d087fcc1 100644 --- a/Master/texmf-dist/doc/latex/expl3/expl3.pdf +++ b/Master/texmf-dist/doc/latex/expl3/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/expl3/l3calc.pdf b/Master/texmf-dist/doc/latex/expl3/l3calc.pdf Binary files differindex 3d7fc3d7410..e745c4a6166 100644 --- a/Master/texmf-dist/doc/latex/expl3/l3calc.pdf +++ b/Master/texmf-dist/doc/latex/expl3/l3calc.pdf diff --git a/Master/texmf-dist/doc/latex/expl3/source3.pdf b/Master/texmf-dist/doc/latex/expl3/source3.pdf Binary files differindex 479264dc199..e83edeec966 100644 --- a/Master/texmf-dist/doc/latex/expl3/source3.pdf +++ b/Master/texmf-dist/doc/latex/expl3/source3.pdf diff --git a/Master/texmf-dist/source/latex/expl3/expl3.dtx b/Master/texmf-dist/source/latex/expl3/expl3.dtx index 72764aa2dff..8ca42a428ab 100644 --- a/Master/texmf-dist/source/latex/expl3/expl3.dtx +++ b/Master/texmf-dist/source/latex/expl3/expl3.dtx @@ -37,7 +37,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: expl3.dtx 2022 2010-09-16 13:00:35Z joseph $ +\GetIdInfo$Id: expl3.dtx 2056 2010-10-02 17:31:05Z will $ {L3 Experimental code bundle wrapper}% %\iffalse %<*driver> @@ -898,11 +898,10 @@ l3basics, l3expan, l3tl, - l3intexpr, + l3int, l3quark, l3seq, l3toks, - l3int, l3prg, l3clist, l3token, diff --git a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx b/Master/texmf-dist/source/latex/expl3/l3alloc.dtx index 5c5d82b13ad..9b3509c95e3 100644 --- a/Master/texmf-dist/source/latex/expl3/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3alloc.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver> %\fi -\GetIdInfo$Id: l3alloc.dtx 1867 2010-03-23 13:03:12Z will $ +\GetIdInfo$Id: l3alloc.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental register allocation}% %\iffalse %<*driver> @@ -179,7 +179,7 @@ \cs_new_nopar:Npn \alloc_next:Nn #1#2 { \tl_set:cx {#1_#2_allocation_tl} { - \intexpr_eval:n + \int_eval:n { \tl_use:c {#1_#2_allocation_tl} \if:w #1 g + \else: - \fi: 1 @@ -188,7 +188,7 @@ % \end{macrocode} % Then we need to check whether we have run out of registers. % \begin{macrocode} - \intexpr_compare:nNnTF + \int_compare:nNnTF { \tl_use:c{g_#2_allocation_tl} } = { \tl_use:c{l_#2_allocation_tl} } { \iow_term:x { diff --git a/Master/texmf-dist/source/latex/expl3/l3basics.dtx b/Master/texmf-dist/source/latex/expl3/l3basics.dtx index 61d3170170e..5d1b4a677c0 100644 --- a/Master/texmf-dist/source/latex/expl3/l3basics.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3basics.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3basics.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental basic definitions} %\iffalse %<*driver> @@ -156,7 +156,7 @@ % expand whatever comes after them and others don't. Hence the names % for these underlying functions will often contain a |:w| part but % higher level functions are often available. See for instance -% |\intexpr_compare_p:nNn| which is a wrapper for |\if_num:w|. +% |\int_compare_p:nNn| which is a wrapper for |\if_num:w|. % % Certain conditionals deal with specific data types like boxes and % fonts and are described there. The ones described below are either @@ -2340,9 +2340,8 @@ \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1{ \cs_if_free:NF #1 { - \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~ - already~defined!~ - Current~meaning:~\token_to_meaning:N #1 + \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~already~defined!~ + Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1 } } %<*trace> @@ -2362,9 +2361,8 @@ { \msg_kernel_bug:x { - Command~name~`\token_to_str:N #1'~ - already~defined!~ - Current~meaning:~\token_to_meaning:N #1 + Command~name~`\token_to_str:N #1'~already~defined!~ + Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1 } } } diff --git a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx index ba857b1a91e..98b6fdd6aff 100644 --- a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx @@ -37,7 +37,7 @@ %</driver|package> %\fi \errorcontextlines=999 -\GetIdInfo$Id: l3candidates.dtx 2029 2010-09-19 13:59:02Z joseph $ +\GetIdInfo$Id: l3candidates.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental 'extras' module} %\iffalse %<*driver> @@ -350,7 +350,7 @@ \cs_new:Nn \seq_mapthread_function:NNN { \seq_get_length:NN \l_tmpa_int #1 \seq_get_length:NN \l_tmpb_int #2 - \intexpr_compare:nTF { \l_tmpa_int == \l_tmpb_int }{ + \int_compare:nTF { \l_tmpa_int == \l_tmpb_int }{ \seq_set_eq:NN \l_tmpa_seq #1 \seq_set_eq:NN \l_tmpb_seq #2 \prg_stepwise_inline:nnnn{1}{1}{\l_tmpa_int}{ @@ -423,16 +423,16 @@ } \cs_set:Npn \_clist_numrange_parse:nw #1 #2 - #3 - #4 \q_stop { \tl_if_empty:nTF {#4}{ - \intexpr_compare:nT {#1=#2} {\_clist_numrange_success:} + \int_compare:nT {#1=#2} {\_clist_numrange_success:} }{ \tl_if_empty:nTF {#3}{ - \intexpr_compare:nT {#1>=#2} {\_clist_numrange_success:} + \int_compare:nT {#1>=#2} {\_clist_numrange_success:} }{ \tl_if_empty:nTF {#2}{ - \intexpr_compare:nT {#1<=#3} {\_clist_numrange_success:} + \int_compare:nT {#1<=#3} {\_clist_numrange_success:} }{ - \intexpr_compare:nT {#1>=#2} { - \intexpr_compare:nT {#1<=#3} + \int_compare:nT {#1>=#2} { + \int_compare:nT {#1<=#3} {\_clist_numrange_success:} } } diff --git a/Master/texmf-dist/source/latex/expl3/l3clist.dtx b/Master/texmf-dist/source/latex/expl3/l3clist.dtx index a7337d63b32..a4acbe592cd 100644 --- a/Master/texmf-dist/source/latex/expl3/l3clist.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3clist.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3clist.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3clist.dtx 2071 2010-10-09 09:48:48Z joseph $ {L3 Experimental comma separated lists} %\iffalse %<*driver> @@ -63,53 +63,79 @@ % % \begin{documentation} % -% \LaTeX3 implements a data type called `clist (comma-lists)'. These -% are special -% token lists that can be accessed via special function on the `left'. -% Appending tokens is possible at both ends. Appended token lists can be -% accessed only as a union. The token lists that form the individual -% items of a comma-list might contain any tokens except for commas that -% are used to structure comma-lists (braces are need if commas are -% part of the value). It is also possible to map functions on such -% comma-lists so that they are executed for every item of the comma-list. -% -% All functions that return items from a comma-list in some \m{tl var.}~assume -% that the \m{tl var.}~is local. See remarks below if you need a global -% returned value. -% -% The defined functions are not orthogonal in the sense that every -% possible variation possible is actually available. If you need a new -% variant use the expansion functions described in the package -% \texttt{l3expan} to build it. -% -% Adding items to the left of a comma-list can currently be done with -% either something like "\clist_put_left:Nn" or with a ``stack'' function -% like "\clist_push:Nn" which has the same effect. Maybe one should -% therefore remove the ``left'' functions totally. +% Comma lists contain ordered data where items can be added to the left +% or right end of the sequence. This gives an ordered list which can +% then be utilised with the \cs{clist_map_function:NN} function. Comma +% Comma lists cannot contain empty items, thus +% \begin{verbatim} +% \clist_new:N \l_my_clist +% \clist_put_right:Nn \l_my_clist { } +% \clist_if_empty:NTF \l_my_clist { true } { false } +% \end{verbatim} +% will leave \texttt{true} in the input stream. % % \section{Functions for creating/initialising comma-lists} % -% \begin{function}{% -% \clist_new:N | -% \clist_new:c | -% } -% \begin{syntax} -% "\clist_new:N" <comma-list> -% \end{syntax} -% Defines <comma-list> to be a variable of type clist. -% \end{function} +%\begin{function}{ +% \clist_new:N | +% \clist_new:c | +%} +% \begin{syntax} +% \cs{clist_new:N} \meta{comma list} +% \end{syntax} +% Creates a new \meta{comma list} or raises an error if the name is +% already taken. The declaration is global. The \meta{comma list} will +% initially contain no entries. +%\end{function} +% +%\begin{function}{ +% \clist_set_eq:NN | +% \clist_set_eq:cN | +% \clist_set_eq:Nc | +% \clist_set_eq:cc | +%} +% \begin{syntax} +% \cs{clist_set_eq:NN} \meta{comma list1} \meta{comma list2} +% \end{syntax} +% Sets the content of \meta{comma list1} equal to that of +% \meta{comma list2}. This assignment is restricted to the current +% \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \clist_gset_eq:NN | +% \clist_gset_eq:cN | +% \clist_gset_eq:Nc | +% \clist_gset_eq:cc | +%} +% \begin{syntax} +% \cs{clist_gset_eq:NN} \meta{comma list1} \meta{comma list2} +% \end{syntax} +% Sets the content of \meta{comma list1} equal to that of +% \meta{comma list2}. This assignment is global and so is not +% limited by the current \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \clist_clear:N | +% \clist_clear:c | +%} +% \begin{syntax} +% \cs{clist_clear:N} \meta{comma list} +% \end{syntax} +% Clears all entries from the \meta{comma list} within the scope of +% the current \TeX\ group. +%\end{function} % -% \begin{function}{% -% \clist_clear:N | -% \clist_clear:c | -% \clist_gclear:N | -% \clist_gclear:c | -% } -% \begin{syntax} -% "\clist_clear:N" <comma-list> -% \end{syntax} -% These functions locally or globally clear <comma-list>. -% \end{function} +%\begin{function}{ +% \clist_gclear:N | +% \clist_gclear:c | +%} +% \begin{syntax} +% \cs{clist_gclear:N} \meta{comma list} +% \end{syntax} +% Clears all entries from the \meta{comma list} globally. +%\end{function} % % \begin{function}{ \clist_clear_new:N | % \clist_clear_new:c | @@ -122,109 +148,86 @@ % otherwise allocates it. % \end{function} % -% \begin{function}{ \clist_set_eq:NN | -% \clist_set_eq:cN | -% \clist_set_eq:Nc | -% \clist_set_eq:cc } -% \begin{syntax} -% "\clist_set_eq:NN" <clist1> <clist2> -% \end{syntax} -% Function that locally makes <clist1> identical to <clist2>. -% \end{function} -% -% -% \begin{function}{ \clist_gset_eq:NN | -% \clist_gset_eq:cN | -% \clist_gset_eq:Nc | -% \clist_gset_eq:cc } -% \begin{syntax} -% "\clist_gset_eq:NN" <clist1> <clist2> -% \end{syntax} -% Function that globally makes <clist1> identical to <clist2>. -% \end{function} -% -% -% -% % \section{Putting data in} -% -% \begin{function}{% -% \clist_put_left:Nn | -% \clist_put_left:NV | -% \clist_put_left:No | -% \clist_put_left:Nx | -% \clist_put_left:cn | -% \clist_put_left:co | -% \clist_put_left:cV | -% } -% \begin{syntax} -% "\clist_put_left:Nn" <comma-list> <token list> -% \end{syntax} -% Locally appends <token list> as a single item to the left -% of <comma-list>. <token list> might get expanded before -% appending according to the variant used. -% \end{function} -% -% \begin{function}{% -% \clist_put_right:Nn | -% \clist_put_right:No | -% \clist_put_right:NV | -% \clist_put_right:Nx | -% \clist_put_right:cn | -% \clist_put_right:co | -% \clist_put_right:cV | -% } -% \begin{syntax} -% "\clist_put_right:Nn" <comma-list> <token list> -% \end{syntax} -% Locally appends <token list> as a single item to the right -% of <comma-list>. <token list> might get expanded before -% appending according to the variant used. -% \end{function} -% -% \begin{function}{% -% \clist_gput_left:Nn | -% \clist_gput_left:NV | -% \clist_gput_left:No | -% \clist_gput_left:Nx | -% \clist_gput_left:cn | -% \clist_gput_left:cV | -% \clist_gput_left:co | -% } -% \begin{syntax} -% "\clist_gput_left:Nn" <comma-list> <token list> -% \end{syntax} -% Globally appends <token list> as a single item to the -% right of <comma-list>. -% \end{function} -% -% \begin{function}{% -% \clist_gput_right:Nn | -% \clist_gput_right:NV | -% \clist_gput_right:No | -% \clist_gput_right:Nx | -% \clist_gput_right:cn | -% \clist_gput_right:cV | -% \clist_gput_right:co | -% } -% \begin{syntax} -% "\clist_gput_right:Nn" <comma-list> <token list> -% \end{syntax} -% Globally appends <token list> as a single item to the -% right of <comma-list>. -% \end{function} +% +%\begin{function}{ +% \clist_put_left:Nn | +% \clist_put_left:NV | +% \clist_put_left:No | +% \clist_put_left:Nx | +% \clist_put_left:cn | +% \clist_put_left:cV | +% \clist_put_left:co | +%} +% \begin{syntax} +% \cs{clist_put_left:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Adds \meta{entry} onto the left of the \meta{comma list}. The +% assignment is restricted to the current \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \clist_gput_left:Nn | +% \clist_gput_left:NV | +% \clist_gput_left:No | +% \clist_gput_left:Nx | +% \clist_gput_left:cn | +% \clist_gput_left:cV | +% \clist_gput_left:co | +%} +% \begin{syntax} +% \cs{clist_gput_left:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Adds \meta{entry} onto the left of the \meta{comma list}. The +% assignment is global. +%\end{function} +% +%\begin{function}{ +% \clist_put_right:Nn | +% \clist_put_right:NV | +% \clist_put_right:No | +% \clist_put_right:Nx | +% \clist_put_right:cn | +% \clist_put_right:cV | +% \clist_put_right:co | +%} +% \begin{syntax} +% \cs{clist_put_right:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Adds \meta{entry} onto the right of the \meta{comma list}. The +% assignment is restricted to the current \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \clist_gput_right:Nn | +% \clist_gput_right:NV | +% \clist_gput_right:No | +% \clist_gput_right:Nx | +% \clist_gput_right:cn | +% \clist_gput_right:cV | +% \clist_gput_right:co | +%} +% \begin{syntax} +% \cs{clist_gput_right:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Adds \meta{entry} onto the right of the \meta{comma list}. The +% assignment is global. +%\end{function} % % \section{Getting data out} % -% \begin{function}{ \clist_use:N | -% \clist_use:c } -% \begin{syntax} -% "\clist_use:N" <clist> -% \end{syntax} -% Function that inserts the <clist> into the processing stream. Mainly -% useful if one knows what the <clist> contains, e.g., for displaying -% the content of template parameters. -% \end{function} +%\begin{function}{ +% \clist_use:N / (EXP) | +% \clist_use:c / (EXP) | +%} +% \begin{syntax} +% \cs{clist_use:N} \meta{comma list} +% \end{syntax} +% Recovers the content of a \meta{comma list} and places it +% directly in the input stream. An error will be raised if the variable +% does not exist or if it is invalid. This function is intended mainly +% for use when a \meta{comma list} is being saved to an auxiliary file. +%\end{function} % % \begin{function}{ \clist_show:N | % \clist_show:c } @@ -235,13 +238,15 @@ % output and in the log file. (Usually used for diagnostic purposes.) % \end{function} % -% \begin{function}{ \clist_display:N | -% \clist_display:c } -% \begin{syntax} -% "\clist_display:N" <clist> -% \end{syntax} -% As with "\clist_show:N" but pretty prints the output one line per element. -% \end{function} +%\begin{function}{ +% \clist_display:N | +% \clist_display:c | +%} +% \begin{syntax} +% \cs{clist_display:N} \meta{comma list} +% \end{syntax} +% Displays the value of the \meta{comma list} on the terminal. +%\end{function} % % \begin{function}{ \clist_get:NN | % \clist_get:cN } @@ -270,36 +275,39 @@ % "\clist_map_variable:NNn" type which uses a user-defined variable as % placeholder. Both the |_inline| and |_variable| versions are nestable. % -% -% \begin{function}{\clist_map_function:NN| -% \clist_map_function:cN| -% \clist_map_function:nN -% } -% \begin{syntax} -% "\clist_map_function:NN" <comma-list> <function> -% \end{syntax} -% This function applies <function> (which must be a function with one -% argument) to every item of <comma-list>. <function> is not executed -% within a sub-group so that side effects can be achieved locally. The -% operation is expandable which means that it can be used within write -% operations etc. -% \end{function} -% -% \begin{function}{\clist_map_inline:Nn | -% \clist_map_inline:cn | -% \clist_map_inline:nn | -% } -% \begin{syntax} -% "\clist_map_inline:Nn" <comma-list> \Arg{inline function} -% \end{syntax} -% Applies <inline function> (which should be the direct coding for a -% function with one argument (i.e.\ use "##1" as the placeholder for -% this argument)) to every item of <comma-list>. <inline function> is not -% executed within a sub-group so that side effects can be achieved locally. -% The operation is not expandable which means that it can't be used -% within write operations etc. These functions can be nested. -% \end{function} -% +%\begin{function}{ +% \clist_map_function:NN / (EXP) | +% \clist_map_function:Nc / (EXP) | +% \clist_map_function:cN / (EXP) | +% \clist_map_function:cc / (EXP) | +% \clist_map_function:nN / (EXP) | +% \clist_map_function:nc / (EXP) | +%} +% \begin{syntax} +% \cs{clist_map_function:NN} \meta{comma list} \meta{function} +% \end{syntax} +% Applies \meta{function} to every \meta{entry} stored in the +% \meta{comma list}. The \meta{function} will receive one argument for +% each iteration. The \meta{entries} in the \meta{comma list} are +% supplied to the \meta{function} reading from the left to the right. +% These function may be nested. +%\end{function} +% +%\begin{function}{ +% \clist_map_inline:Nn | +% \clist_map_inline:cn | +% \clist_map_inline:nn | +%} +% \begin{syntax} +% \cs{clist_map_inline:Nn} \meta{comma list} \Arg{inline function} +% \end{syntax} +% Applies \meta{inline function} to every \meta{entry} stored +% within the \meta{comma list}. The \meta{inline function} should +% consist of code which will receive the \meta{entry} as "#1". +% One inline mapping can be nested inside another. The \meta{entries} +% in the \meta{comma list} are supplied to the \meta{function} reading +% from the left to the right. +%\end{function} % % \begin{function}{\clist_map_variable:NNn | % \clist_map_variable:cNn | @@ -317,114 +325,157 @@ % \end{texnote} % \end{function} % -% \begin{function}{% -% \clist_map_break: | -% } +%\begin{function}{ \clist_map_break: / (EXP) } % \begin{syntax} -% "\clist_map_break:" +% \cs{clist_map_break:} % \end{syntax} -% For breaking out of a loop. To be used inside "TF" type functions as -% in the example below. +% Used to terminate a \cs{clist_map_\ldots} function before all +% entries in the \meta{comma list} have been processed. This will +% normally take place within a conditional statement, for example % \begin{verbatim} -% \cs_new_nopar:Npn \test_function:n #1 { -% \intexpr_compare:nTF {#1 > 3} {\clist_map_break:}{``#1''} -% } -% \clist_map_function:nN {1,2,3,4,5,6,7,8}\test_function:n +% \clist_map_inline:Nn \l_my_clist +% { +% \str_if_eq:nnTF { #1 } { bingo } +% { \clist_map_break: } +% { +% % Do something useful +% } +% } % \end{verbatim} -% This would return "``1''``2''``3''". -% \end{function} -% +% Use outside of a \cs{clist_map_\ldots} scenario will lead low +% level \TeX\ errors. +%\end{function} % % \section{Predicates and conditionals} -% -% \begin{function}{ \clist_if_empty_p:N | -% \clist_if_empty_p:c } -% \begin{syntax} -% "\clist_if_empty_p:N" <comma-list> -% \end{syntax} -% This predicate returns `true' if <comma-list> is `empty' i.e., doesn't -% contain any tokens. -% \end{function} -% -% \begin{function}{ \clist_if_empty:N / (TF)(EXP) | -% \clist_if_empty:c / (TF)(EXP)} -% \begin{syntax} -% "\clist_if_empty:NTF" <comma-list> \Arg{true code} \Arg{false code} -% \end{syntax} -% Set of conditionals that test whether or not a particular <comma-list> -% is empty and if so executes either <true code> or <false code>. -% \end{function} -% -% \begin{function}{ \clist_if_eq_p:NN / (EXP) | -% \clist_if_eq_p:cN / (EXP) | -% \clist_if_eq_p:Nc / (EXP) | -% \clist_if_eq_p:cc / (EXP) } -% \begin{syntax} -% "\clist_if_eq_p:N" <comma-list1> <comma-list2> -% \end{syntax} -% This predicate returns `true' if the two comma lists are identical. -% \end{function} -% -% \begin{function}{ \clist_if_eq:NN / (TF)(EXP) | -% \clist_if_eq:cN / (TF)(EXP) | -% \clist_if_eq:Nc / (TF)(EXP) | -% \clist_if_eq:cc / (TF)(EXP) } -% \begin{syntax} -% "\clist_if_eq:NNTF" <comma-list1> <comma-list2> \Arg{true code} \Arg{false code} -% \end{syntax} -% Check if <comma-list1> and <comma-list2> are equal and execute -% either <true code> or <false code> accordingly. -% \end{function} -% -% \begin{function}{ \clist_if_in:Nn / (TF) | -% \clist_if_in:NV / (TF) | -% \clist_if_in:No / (TF) | -% \clist_if_in:cn / (TF) | -% \clist_if_in:cV / (TF) | -% \clist_if_in:co / (TF) } -% \begin{syntax} -% "\clist_if_in:NnTF" <comma-list> \Arg{item} \Arg{true code} \Arg{false code} -% \end{syntax} -% Function that tests if <item> is in <comma-list>. Depending on the result -% either <true code> or <false code> is executed. -% \end{function} +% +%\begin{function}{ +% \clist_if_empty_p:N / (EXP) | +% \clist_if_empty_p:c / (EXP) | +% \clist_if_empty:N / (EXP) (TF) | +% \clist_if_empty:c / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{clist_if_empty_p:N} \meta{clist} +% \cs{clist_if_empty:NTF} \meta{clist} \Arg{true code} \Arg{false code} +% \end{syntax} +% Tests if the \meta{comma list} is empty (containing no items). The +% branching versions then leave either \meta{true code} or +% \meta{false code} in the input stream, as appropriate to the truth of +% the test and the variant of the function chosen. The logical truth of +% the test is left in the input stream by the predicate version. +%\end{function} +% +%\begin{function}{ +% \clist_if_eq_p:NN / (EXP) | +% \clist_if_eq_p:Nc / (EXP) | +% \clist_if_eq_p:cN / (EXP) | +% \clist_if_eq_p:cc / (EXP) | +% \clist_if_eq:NN / (EXP) (TF) | +% \clist_if_eq:Nc / (EXP) (TF) | +% \clist_if_eq:cN / (EXP) (TF) | +% \clist_if_eq:cc / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{clist_if_eq_p:NN} \Arg{clist1} \Arg{clist2} +% \cs{clist_if_eq:NNTF} \Arg{clist1} \Arg{clist2} \Arg{true code} +% ~~\Arg{false code} +% \end{syntax} +% Compares the content of two \meta{comma lists} and +% is logically \texttt{true} if the two contain the same list of +% entries in the same order. The branching versions then leave either +% \meta{true code} or \meta{false code} in the input stream, as +% appropriate to the truth of the test and the variant of the function +% chosen. The logical truth of the test is left in the input stream by +% the predicate version. +%\end{function} +% +%\begin{function}{ +% \clist_if_in:Nn / (TF) | +% \clist_if_in:NV / (TF) | +% \clist_if_in:No / (TF) | +% \clist_if_in:cn / (TF) | +% \clist_if_in:cV / (TF) | +% \clist_if_in:co / (TF) | +%} +% \begin{syntax} +% \cs{clist_if_in:NnTF} \meta{clist} \Arg{entry} \Arg{true code} +% ~~\Arg{false code} +% \end{syntax} +% Tests if the \meta{entry} is present in the \meta{comma list} as +% a discrete entry. The \meta{entry} cannot contain the tokens "{", "}" +% or "#" (assuming the usual \TeX\ category codes apply). Either the +% \meta{true code} or \meta{false code} in the input stream, as +% appropriate to the truth of the test and the variant of the function +% chosen. +%\end{function} % % \section{Higher level functions} % -% \begin{function}{ \clist_concat:NNN | -% \clist_concat:ccc | -% \clist_gconcat:NNN | -% \clist_gconcat:ccc } -% \begin{syntax} -% "\clist_gconcat:NNN" <clist1> <clist2> <clist3> -% \end{syntax} -% Function that concatenates <clist2> and <clist3> and locally or globally -% assigns the result to <clist1>. -% \end{function} +%\begin{function}{ +% \clist_concat:NNN | +% \clist_concat:ccc | +%} +% \begin{syntax} +% \cs{clist_concat:NNN} \meta{clist1} \meta{clist2} \meta{clist3} +% \end{syntax} +% Concatenates the content of \meta{comma list2} and \meta{comma list3} +% together and saves the result in \meta{comma list1}. +% \meta{comma list2} will be placed at the left side of the new +% comma list. This operation is local to the current \TeX\ group and +% will remove any existing content in \meta{comma list1}. +%\end{function} +% +%\begin{function}{ +% \clist_gconcat:NNN | +% \clist_gconcat:ccc | +%} +% \begin{syntax} +% \cs{clist_gconcat:NNN} \meta{clist1} \meta{clist2} \meta{clist3} +% \end{syntax} +% Concatenates the content of \meta{comma list2} and \meta{comma list3} +% together and saves the result in \meta{comma list1}. +% \meta{comma list2} will be placed at the left side of the new +% comma list. This operation is global and will remove any existing +% content in \meta{comma list1}. +%\end{function} +% +%\begin{function}{ \clist_remove_duplicates:N } +% \begin{syntax} +% \cs{clist_remove_duplicates:N} \meta{comma list} +% \end{syntax} +% Removes duplicate entries from the \meta{comma list}, leaving +% left most entry in the \meta{comma list}. The removal is local +% to the current \TeX\ group. +%\end{function} % +%\begin{function}{ \clist_gremove_duplicates:N } +% \begin{syntax} +% \cs{clist_gremove_duplicates:N} \meta{comma list} +% \end{syntax} +% Removes duplicate entries from the \meta{comma list}, leaving +% left most entry in the \meta{comma list}. The removal is applied +% globally. +%\end{function} % -% \begin{function}{ \clist_remove_duplicates:N | -% \clist_gremove_duplicates:N } -% \begin{syntax} -% "\clist_gremove_duplicates:N" <clist> -% \end{syntax} -% Function that removes any duplicate entries in <clist>. -% \end{function} -% -% \begin{function}{ -% \clist_remove_element:Nn | -% \clist_gremove_element:Nn -%} -% \begin{syntax} -% "\clist_gremove_element:Nn" <clist> <element> -% \end{syntax} -% Function that removes <element> from <clist>, if present. -% \begin{texnote} -% This is similar in concept to \cs{@removeelement}, except that the -% syntax is clearer and the initial and final lists have the same -% name automatically. -% \end{texnote} -% \end{function} +%\begin{function}{ \clist_remove_element:Nn } +% \begin{syntax} +% \cs{clist_remove_element:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Removes each occurrence of \meta{entry} from the \meta{comma list}, +% where \meta{entry} cannot contain the tokens "{", "}" or "#" +% (assuming normal \TeX\ category codes). The removal is local +% to the current \TeX\ group. +%\end{function} +% +%\begin{function}{ \clist_gremove_element:Nn } +% \begin{syntax} +% \cs{clist_gremove_element:Nn} \meta{comma list} \Arg{entry} +% \end{syntax} +% Removes each occurrence of \meta{entry} from the \meta{comma list}, +% where \meta{entry} cannot contain the tokens "{", "}" or "#" +% (assuming normal \TeX\ category codes). The removal applied +% globally. +%\end{function} % % \section{Functions for `comma-list stacks'} % diff --git a/Master/texmf-dist/source/latex/expl3/l3final.dtx b/Master/texmf-dist/source/latex/expl3/l3final.dtx index d5ceed0477a..7ada8b18da6 100644 --- a/Master/texmf-dist/source/latex/expl3/l3final.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3final.dtx @@ -37,7 +37,7 @@ %</driver|package> %<*-ini> %\fi -\GetIdInfo$Id: l3final.dtx 1857 2010-03-21 21:32:09Z joseph $ +\GetIdInfo$Id: l3final.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental final module} %\iffalse %</-ini> @@ -240,7 +240,7 @@ % category codes to fix. % \begin{macrocode} \cs_set_protected_nopar:Npn \ExplSyntaxOff { - \intexpr_if_odd:nT { \ExplSyntaxStatus } + \int_if_odd:nT { \ExplSyntaxStatus } { \tl_set:Nn \ExplSyntaxStatus { 0 } \char_set_catcode:nn { 126 } { 13 } diff --git a/Master/texmf-dist/source/latex/expl3/l3int.dtx b/Master/texmf-dist/source/latex/expl3/l3int.dtx index 10305ee5fe1..f29c018f1e1 100644 --- a/Master/texmf-dist/source/latex/expl3/l3int.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3int.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3int.dtx 2029 2010-09-19 13:59:02Z joseph $ +\GetIdInfo$Id: l3int.dtx 2070 2010-10-09 06:55:11Z joseph $ {L3 Experimental Integer module} %\iffalse %<*driver> @@ -61,183 +61,774 @@ % \maketitle % % \begin{documentation} -% -% \LaTeX3 maintains two type of integer registers for internal use. -% One (associated with the name "num") for low level uses in the -% allocation mechanism using macros only and "int": the one described -% here. -% -% The "int" type uses the built-in counter registers of \TeX{} and is -% therefore relatively fast compared to the "num" type and should be -% preferred in all cases as there is little chance we should ever run -% out of registers when being based on at least \eTeX. -% -% \section{Functions} -% -% \begin{function}{ \int_new:N | -% \int_new:c } -% \begin{syntax} -% "\int_new:N" <int> -% \end{syntax} -% Defines <int> to be a new variable of type "int". -% \begin{texnote} -% "\int_new:N" is the equivalent to plain \TeX{}'s \tn{newcount}. -% \end{texnote} +% +%\section{Integer values} +% +% +% Calculation and comparison of integer values can be carried out +% using literal numbers, \texttt{int} registers, constants and +% integers stored in token list variables. The standard operators +% \texttt{+}, \texttt{-}, \texttt{/} and \texttt{*} and +% parentheses can be used within such expressions to carry +% arithmetic operations. This module carries out these functions +% on \emph{integer expressions} (`\texttt{int expr}'). +% +%\subsection{Integer expressions} +% +%\begin{function}{ \int_eval:n / (EXP) } +% \begin{syntax} +% \cs{int_eval:n} \Arg{integer expression} +% \end{syntax} +% Evaluates the \meta{integer expression}, expanding any +% integer and token list variables within the \meta{expression} +% to their content (without requiring \cs{int_use:N}/\cs{tl_use:N}) +% and applying the standard mathematical rules. The result of the +% calculation is left in the input stream as a number. For example +% both +% \begin{verbatim} +% \int_eval:n { 5 + 4 * 3 - ( 3 + 4 * 5 ) } +% \end{verbatim} +% and +% \begin{verbatim} +% \tl_new:N \l_my_tl +% \tl_set:Nn \l_my_tl { 5 } +% \int_new:N \l_my_int +% \int\set:Nn \l_my_int { 4 } +% \int_eval:n { \l_my_tl + \l_my_int * 3 - ( 3 + 4 * 5 ) } +% \end{verbatim} +% both evaluate to \( -6 \). The \Arg{integer expression} may +% contain the operators \texttt{+}, \texttt{-}, \texttt{*} and +% \texttt{/}, along with parenthesis \texttt{(} and \texttt{)}. +%\end{function} +% +%\begin{function}{ \int_abs:n / (EXP) } +% \begin{syntax} +% \cs{int_abs:n} \Arg{integer expression} +% \end{syntax} +% Evaluates the \meta{integer expression} as described for +% \cs{int_eval:n} and leaves the absolute value of the result in +% the input stream. +%\end{function} +% +%\begin{function}{ \int_div_round:nn / (EXP) } +% \begin{syntax} +% \cs{int_div_round:nn} \Arg{intexpr1} \Arg{intexpr2} +% \end{syntax} +% Evaluates the two \meta{integer expressions} as described earlier, +% then calculates the result of dividing the first value by the +% second, rounding any remainder. Note that division using "/" +% is identical to this function. +%\end{function} +% +%\begin{function}{ \int_div_truncate:nn / (EXP) } +% \begin{syntax} +% \cs{int_div_truncate:nn} \Arg{intexpr1} \Arg{intexpr2} +% \end{syntax} +% Evaluates the two \meta{integer expressions} as described earlier, +% then calculates the result of dividing the first value by the +% second, truncating any remainder. Note that division using "/" +% rounds the result. +%\end{function} +% +%\begin{function}{ +% \int_max:nn / (EXP) | +% \int_min:nn / (EXP) | +%} +% \begin{syntax} +% \cs{int_max:nn} \Arg{intexpr1} \Arg{intexpr2} +% \cs{int_min:nn} \Arg{intexpr1} \Arg{intexpr2} +% \end{syntax} +% Evaluates the \meta{integer expressions} as described for +% \cs{int_eval:n} and leaves either the larger or smaller value +% in the input stream, depending on the function name. +%\end{function} +% +%\begin{function}{ \int_mod:nn / (EXP) } +% \begin{syntax} +% \cs{int_mod:nn} \Arg{intexpr1} \Arg{intexpr2} +% \end{syntax} +% Evaluates the two \meta{integer expressions} as described earlier, +% then calculates the integer remainder of dividing the first +% expression by the second. This is left in the input stream. +%\end{function} +% +%\subsection{Integer variables} +% +%\begin{function}{ +% \int_new:N | +% \int_new:c | +%} +% \begin{syntax} +% \cs{int_new:N} \meta{integer} +% \end{syntax} +% Creates a new \meta{inter} or raises an error if the name is +% already taken. The declaration is global. The \meta{integer} will +% initially be equal to \( 0 \). +%\end{function} +% +%\begin{function}{ +% \int_set_eq:NN | +% \int_set_eq:cN | +% \int_set_eq:Nc | +% \int_set_eq:cc | +%} +% \begin{syntax} +% \cs{int_set_eq:NN} \meta{integer1} \meta{integer 2} +% \end{syntax} +% Sets the content of \meta{integer1} equal to that of +% \meta{integer 2}. This assignment is restricted to the current +% \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \int_gset_eq:NN | +% \int_gset_eq:cN | +% \int_gset_eq:Nc | +% \int_gset_eq:cc | +%} +% \begin{syntax} +% \cs{int_gset_eq:NN} \meta{integer1} \meta{integer2} +% \end{syntax} +% Sets the content of \meta{integer1} equal to that of \meta{integer2}. +% This assignment is global and so is not limited by the current +% \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \int_add:Nn | +% \int_add:cn | +%} +% \begin{syntax} +% \cs{int_add:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Adds the result of the \meta{integer expression} to the current +% content of the \meta{integer}. This assignment is local. +%\end{function} +% +%\begin{function}{ +% \int_gadd:Nn | +% \int_gadd:cn | +%} +% \begin{syntax} +% \cs{int_gadd:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Adds the result of the \meta{integer expression} to the current +% content of the \meta{integer}. This assignment is global. +%\end{function} +% +%\begin{function}{ +% \int_decr:N | +% \int_decr:c | +%} +% \begin{syntax} +% \cs{int_decr:N} \meta{integer} +% \end{syntax} +% Decreases the value stored in \meta{integer} by \( 1 \) within +% the scope of the current \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \int_gdecr:N | +% \int_gdecr:c | +%} +% \begin{syntax} +% \cs{int_incr:N} \meta{integer} +% \end{syntax} +% Decreases the value stored in \meta{integer} by \( 1 \) globally +% (\emph{i.e}.~not limited by the current group level). +%\end{function} +% +%\begin{function}{ +% \int_incr:N | +% \int_incr:c | +%} +% \begin{syntax} +% \cs{int_incr:N} \meta{integer} +% \end{syntax} +% Increases the value stored in \meta{integer} by \( 1 \) within +% the scope of the current \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \int_gincr:N | +% \int_gincr:c | +%} +% \begin{syntax} +% \cs{int_incr:N} \meta{integer} +% \end{syntax} +% Increases the value stored in \meta{integer} by \( 1 \) globally +% (\emph{i.e}.~not limited by the current group level). +%\end{function} +% +%\begin{function}{ +% \int_set:Nn | +% \int_set:cn | +%} +% \begin{syntax} +% \cs{int_set:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Sets \meta{integer} to the value of \meta{integer expression}, +% which must evaluate to an integer (as described for +% \cs{int_eval:n}). This assignment is restricted to the +% current \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \int_gset:Nn | +% \int_gset:cn | +%} +% \begin{syntax} +% \cs{int_gset:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Sets \meta{integer} to the value of \meta{integer expression}, +% which must evaluate to an integer (as described for +% \cs{int_eval:n}). This assignment is global and is not limited +% to the current \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \int_sub:Nn | +% \int_sub:cn | +%} +% \begin{syntax} +% \cs{int_sub:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Subtracts the result of the \meta{integer expression} to the +% current content of the \meta{integer}. This assignment is local. +%\end{function} +% +%\begin{function}{ +% \int_gsub:Nn | +% \int_gsub:cn | +%} +% \begin{syntax} +% \cs{int_gsub:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Subtracts the result of the \meta{integer expression} to the +% current content of the \meta{integer}. This assignment is global. +%\end{function} +% +%\begin{function}{ +% \int_zero:N | +% \int_zero:c | +%} +% \begin{syntax} +% \cs{int_zero:N} \meta{integer} +% \end{syntax} +% Sets \meta{integer} to \( 0 \) within the scope of the current +% \TeX\ group. +%\end{function} +% +%\begin{function}{ +% \int_gzero:N | +% \int_gzero:c | +%} +% \begin{syntax} +% \cs{int_gzero:N} \meta{integer} +% \end{syntax} +% Sets \meta{integer} to \( 0 \) globally, \emph{i.e}.~not +% restricted by the current \TeX\ group level. +%\end{function} +% +%\begin{function}{ +% \int_show:N | +% \int_show:c | +%} +% \begin{syntax} +% \cs{int_show:N} \meta{integer} +% \end{syntax} +% Displays the value of the \meta{integer} on the terminal. +%\end{function} +% +%\begin{function}{ +% \int_use:N / (EXP) | +% \int_use:c / (EXP) | +%} +% \begin{syntax} +% \cs{int_use:N} \meta{integer} +% \end{syntax} +% Recovers the content of a \meta{integer} and places it directly +% in the input stream. An error will be raised if the variable does +% not exist or if it is invalid. Can be omitted in places where a +% \meta{integer} is required (such as in the first and third arguments +% of \cs{int_compare:nNnTF}). +%\end{function} +% +%\subsection{Comparing integer expressions} +% +%\begin{function}{ +% \int_compare_p:nNn / (EXP) | +% \int_compare:nNn / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{int_compare_p:nNn} +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} +% \cs{int_compare:nNnTF} +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} +% ~~\Arg{true code} \Arg{false code} +% \end{syntax} +% This function first evaluates each of the \meta{integer expressions} +% as described for \cs{int_eval:n}. The two results are then +% compared using the \meta{relation}: +% \begin{center} +% \begin{tabular}{ll} +% Equal & "=" \\ +% Greater than & ">" \\ +% Less than & "<" \\ +% \end{tabular} +% \end{center} +% The branching versions then leave either \meta{true code} or +% \meta{false code} in the input stream, as appropriate to the truth +% of the test and the variant of the function chosen. The logical +% truth of the test is left in the input stream by the predicate +% version. +%\end{function} +% +%\begin{function}{ +% \int_compare_p:n / (EXP) | +% \int_compare:n / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{int_compare_p:n} +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} +% \cs{int_compare:nTF} +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} +% ~~\Arg{true code} \Arg{false code} +% \end{syntax} +% This function first evaluates each of the \meta{integer expressions} +% as described for \cs{int_eval:n}. The two results are then +% compared using the \meta{relation}: +% \begin{center} +% \begin{tabular}{ll} +% Equal & "=" or "==" \\ +% Greater than or equal to & "=>" \\ +% Greater than & ">" \\ +% Less than or equal to & "=<" \\ +% Less than & "<" \\ +% Not equal & "!=" \\ +% \end{tabular} +% \end{center} +% The branching versions then leave either \meta{true code} or +% \meta{false code} in the input stream, as appropriate to the truth +% of the test and the variant of the function chosen. The logical +% truth of the test is left in the input stream by the predicate +% version. +%\end{function} +% +%\begin{function}{ +% \int_if_even_p:n / (EXP) | +% \int_if_even:n / (EXP) (TF) | +% \int_if_odd_p:n / (EXP) | +% \int_if_odd:n / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{int_if_odd_p:n} \Arg{integer expression} +% \cs{int_if_odd:nTF} \Arg{integer expression} +% ~~\Arg{true code} \Arg{false code} +% \end{syntax} +% This function first evaluates the \meta{integer expression} +% as described for \cs{int_eval:n}. It then evaluates if this +% is odd or even, as appropriate. The branching versions then leave +% either \meta{true code} or \meta{false code} in the input stream, +% as appropriate to the truth of the test and the variant of the +% function chosen. The logical truth of the test is left in the input +% stream by the predicate version. +%\end{function} +% +%\begin{function}{ \int_do_while:nNnn / (EXP) } +% \begin{syntax} +% \cs{int_do_while:nNnn} +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code} +% \end{syntax} +% Evaluates the relationship between the two \meta{integer expressions} +% as described for \cs{int_compare:nNnTF}, and then places the +% \meta{code} in the input stream if the \meta{relation} is +% \texttt{true}. After the \meta{code} has been processed by \TeX\ the +% test will be repeated, and a loop will occur until the test is +% \texttt{false}. % \end{function} -% -% \begin{function}{% -% \int_incr:N | -% \int_incr:c | -% \int_gincr:N | -% \int_gincr:c | -% } -% \begin{syntax} -% "\int_incr:N" <int> -% \end{syntax} -% Increments <int> by one. For global variables the global versions -% should be used. +% +%\begin{function}{ \int_do_until:nNnn / (EXP) } +% \begin{syntax} +% \cs{int_do_until:nNnn} +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code} +% \end{syntax} +% Evaluates the relationship between the two \meta{integer expressions} +% as described for \cs{int_compare:nNnTF}, and then places the +% \meta{code} in the input stream if the \meta{relation} is +% \texttt{false}. After the \meta{code} has been processed by \TeX\ the +% test will be repeated, and a loop will occur until the test is +% \texttt{true}. % \end{function} -% -% \begin{function}{% -% \int_decr:N | -% \int_decr:c | -% \int_gdecr:N | -% \int_gdecr:c | -% } -% \begin{syntax} -% "\int_decr:N" <int> -% \end{syntax} -% Decrements <int> by one. For global variables the global versions -% should be used. +% +%\begin{function}{ \int_until_do:nNnn / (EXP) } +% \begin{syntax} +% \cs{int_until_do:nNnn} +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code} +% \end{syntax} +% Places the \meta{code} in the input stream for \TeX\ to process, and +% then evaluates the relationship between the two +% \meta{integer expressions} as described for \cs{int_compare:nNnTF}. +% If the test is \texttt{false} then the \meta{code} will be inserted +% into the input stream again and a loop will occur until the +% \meta{relation} is \texttt{true}. % \end{function} -% -% \begin{function}{% -% \int_set:Nn | -% \int_set:cn | -% \int_gset:Nn | -% \int_gset:cn | -% } -% \begin{syntax} -% "\int_set:Nn" <int> \Arg{integer expr} -% \end{syntax} -% These functions will set the <int> register to the <integer expr> -% value. This value can contain simple calc-like expressions as -% provided by \eTeX. +% +%\begin{function}{ \int_while_do:nNnn / (EXP) } +% \begin{syntax} +% \cs{int_while_do:nNnn} \ +% ~~\Arg{intexpr1} \meta{relation} \Arg{intexpr2} \Arg{code} +% \end{syntax} +% Places the \meta{code} in the input stream for \TeX\ to process, and +% then evaluates the relationship between the two +% \meta{integer expressions} as described for \cs{int_compare:nNnTF}. +% If the test is \texttt{true} then the \meta{code} will be inserted +% into the input stream again and a loop will occur until the +% \meta{relation} is \texttt{false}. % \end{function} % -% -% \begin{function}{% -% \int_zero:N | -% \int_zero:c | -% \int_gzero:N | -% \int_gzero:c | -% } -% \begin{syntax} -% "\int_zero:N" <int> -% \end{syntax} -% These functions sets the <int> register to zero either locally -% or globally. +%\begin{function}{ \int_do_while:nn / (EXP) } +% \begin{syntax} +% \cs{int_do_while:nNnn} +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code} +% \end{syntax} +% Evaluates the relationship between the two \meta{integer expressions} +% as described for \cs{int_compare:nTF}, and then places the +% \meta{code} in the input stream if the \meta{relation} is +% \texttt{true}. After the \meta{code} has been processed by \TeX\ the +% test will be repeated, and a loop will occur until the test is +% \texttt{false}. % \end{function} -% -% -% \begin{function}{% -% \int_add:Nn | -% \int_add:cn | -% \int_gadd:Nn | -% \int_gadd:cn | -% } -% \begin{syntax} -% "\int_add:Nn" <int> \Arg{integer expr} -% \end{syntax} -% These functions will add to the <int> register the value <integer -% expr>. If the second argument is a <int> register too, the -% surrounding braces can be left out. -% \end{function} -% -% \begin{function}{% -% \int_sub:Nn | -% \int_sub:cn | -% \int_gsub:Nn | -% \int_gsub:cn | -% } -% \begin{syntax} -% "\int_gsub:Nn" <int> \Arg{integer expr} -% \end{syntax} -% These functions will subtract from the <int> register the value -% <integer expr>. If the second argument is a <int> register too, the -% surrounding braces can be left out. +% +%\begin{function}{ \int_do_until:nn / (EXP) } +% \begin{syntax} +% \cs{int_do_until:nn} +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code} +% \end{syntax} +% Evaluates the relationship between the two \meta{integer expressions} +% as described for \cs{int_compare:nTF}, and then places the +% \meta{code} in the input stream if the \meta{relation} is +% \texttt{false}. After the \meta{code} has been processed by \TeX\ the +% test will be repeated, and a loop will occur until the test is +% \texttt{true}. % \end{function} -% -% \begin{function}{% -% \int_use:N | -% \int_use:c | -% } -% \begin{syntax} -% "\int_use:N" <int> -% \end{syntax} -% This function returns the integer value kept in <int> in a way -% suitable for further processing. -% \begin{texnote} -% The function "\int_use:N" could be implemented directly as the \TeX{} -% primitive "\tex_the:D" which is also responsible to produce the values for -% other internal quantities. We have chosen to use individual functions -% for counters, dimensions etc.\ to allow checks and to make the code -% more self-explaining. -% \end{texnote} +% +%\begin{function}{ \int_until_do:nn / (EXP) } +% \begin{syntax} +% \cs{int_until_do:nn} +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code} +% \end{syntax} +% Places the \meta{code} in the input stream for \TeX\ to process, and +% then evaluates the relationship between the two +% \meta{integer expressions} as described for \cs{int_compare:nTF}. +% If the test is \texttt{false} then the \meta{code} will be inserted +% into the input stream again and a loop will occur until the +% \meta{relation} is \texttt{true}. % \end{function} -% -% \begin{function}{ \int_show:N | -% \int_show:c } -% \begin{syntax} -% "\int_show:N" <int> -% \end{syntax} -% This function pauses the compilation and displays the integer value kept -% in <int> in the console output and log file. -% \begin{texnote} -% The function "\int_show:N" could be implemented directly as the \TeX{} -% primitive "\tex_showthe:D" which is also responsible to produce the values for -% other internal quantities. We have chosen to use individual functions -% for counters, dimensions etc.\ to allow checks and to make the code -% more self-explanatory. -% \end{texnote} +% +%\begin{function}{ \int_while_do:nn / (EXP) } +% \begin{syntax} +% \cs{int_while_do:nn} \ +% ~~\{ \meta{intexpr1} \meta{relation} \meta{intexpr2} \} \Arg{code} +% \end{syntax} +% Places the \meta{code} in the input stream for \TeX\ to process, and +% then evaluates the relationship between the two +% \meta{integer expressions} as described for \cs{int_compare:nTF}. +% If the test is \texttt{true} then the \meta{code} will be inserted +% into the input stream again and a loop will occur until the +% \meta{relation} is \texttt{false}. % \end{function} % -% \section{Formatting a counter value} +%\subsection{Formatting integers} +% +% Integers can be placed into the output stream with formatting. These +% conversions apply to any integer expressions. +% +%\begin{function}{ \int_to_arabic:n / (EXP) } +% \begin{syntax} +% \cs{int_to_arabic:n} \Arg{integer expression} +% \end{syntax} +% Places the value of the \meta{integer expression} in the input +% stream as digits, with category code \( 12 \) (other). +%\end{function} +% +%\begin{function}{ +% \int_to_alph:n / (EXP) | +% \int_to_Alph:n / (EXP) | +%} +% \begin{syntax} +% \cs{int_to_alph:n} \Arg{integer expression} +% \end{syntax} +% Evaluates the \meta{integer expression} and converts the result +% into a series of letters, which are then left in the input stream. +% The conversion rule uses the \( 26 \) letters of the English +% alphabet, in order. Thus +% \begin{verbatim} +% \int_to_alph:n { 1 } +% \end{verbatim} +% places "a" in the input stream, +% \begin{verbatim} +% \int_to_alph:n { 26 } +% \end{verbatim} +% is represented as "z" and +% \begin{verbatim} +% \int_to_alph:n { 27 } +% \end{verbatim} +% is converted to `aa'. For conversions using other alphabets, use +% \cs{int_convert_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. +%\end{function} +% +%\begin{function}{ \int_to_binary:n / (EXP) } +% \begin{syntax} +% \cs{int_to_binary:n} \Arg{integer expression} +% \end{syntax} +% Calculates the value of the \meta{integer expression} and places +% the binary representation of the result in the input stream. +%\end{function} +% +%\begin{function}{ \int_to_hexadecimal:n / (EXP) } +% \begin{syntax} +% \cs{int_to_binary:n} \Arg{integer expression} +% \end{syntax} +% Calculates the value of the \meta{integer expression} and places +% the hexadecimal (base~\( 16 \)) representation of the result in the +% input stream. Upper case letters are used for digits beyond \( 9 \). +%\end{function} +% +%\begin{function}{ \int_to_octal:n / (EXP) } +% \begin{syntax} +% \cs{int_to_octal:n} \Arg{integer expression} +% \end{syntax} +% Calculates the value of the \meta{integer expression} and places +% the octal (base~\( 8 \)) representation of the result in the input +% stream. +%\end{function} +% +%\begin{function}{ +% \int_to_roman:n / (EXP) | +% \int_to_Roman:n / (EXP) | +%} +% \begin{syntax} +% \cs{int_to_roman:n} \Arg{integer expression} +% \end{syntax} +% Places the value of the \meta{integer expression} in the input +% stream as Roman numerals, either lower case (\cs{int_to_roman:n}) +% or upper case (\cs{int_to_Roman:n}). The numerals are letters +% with category code \( 11 \) (letter). +%\end{function} +% +%\begin{function}{ \int_to_symbol:n / (EXP) } +% \begin{syntax} +% \cs{int_to_symbol:n} \Arg{integer expression} +% \end{syntax} +% Calculates the value of the \meta{integer expression} and places +% the symbol representation of the result in the input stream. The +% list of symbols used is equivalent to \LaTeXe's \cs{@fnsymbol} +% set. +%\end{function} +% +%\subsection{Converting from other formats} +% +%\begin{function}{ \int_from_alph:n / (EXP) } +% \begin{syntax} +% \cs{int_from_alpa: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 +% `a' equal to \( 1 \) through to `z' equal to \( 26 \). Either lower +% or upper case letters may be used. This is the inverse function of +% \cs{int_to_alph:n}. +%\end{function} +% +%\begin{function}{ \int_from_binary:n / (EXP) } +% \begin{syntax} +% \cs{int_from_binary:n} \Arg{binary number} +% \end{syntax} +% Converts the \meta{binary number} into the integer (base~\( 10 \)) +% representation and leaves this in the input stream. +%\end{function} +% +%\begin{function}{ \int_from_hexadecimal:n / (EXP) } +% \begin{syntax} +% \cs{int_from_binary: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. +%\end{function} +% +%\begin{function}{ \int_from_octal:n / (EXP) } +% \begin{syntax} +% \cs{int_from_octal:n} \Arg{octal number} +% \end{syntax} +% Converts the \meta{octal number} into the integer (base~\( 10 \)) +% representation and leaves this in the input stream. +%\end{function} +% +%\begin{function}{ \int_from_roman:n / (EXP) } +% \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 +% \meta{roman numeral} may be in upper or lower case; if the numeral +% is not valid then the resulting value will be \( -1 \). +%\end{function} +% +%\subsection{Low-level conversion functions} +% +% As well as the higher-level functions already documented, there +% are a series of lower-level functions which can be used to carry out +% generic conversions. These are used to create the higher-level +% versions documented above. +% +%\begin{function}{ \int_convert_from_base_ten:nn / (EXP) } +% \begin{syntax} +% \cs{int_convert_from_base_ten:nn} \Arg{integer expression} +% ~~\Arg{base} +% \end{syntax} +% Calculates the value of the \meta{integer expression} and +% converts it into the appropriate representation in the \meta{base}; +% the later may be given as an integer expression. For bases greater +% than \( 10 \) the higher `digits' are represented by the upper case +% letters from the English alphabet (with normal category codes). The +% maximum \meta{base} value is \( 36 \). +%\end{function} +% +%\begin{function}{ \int_convert_to_base_ten:nn / (EXP) } +% \begin{syntax} +% \cs{int_convert_to_base_ten: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 \). +%\end{function} +% +%\begin{function}{ \int_convert_to_symbols:nnn / (EXP) } +% \begin{syntax} +% \cs{int_convert_to_symbols:nnn} +% ~~\Arg{integer expression} \Arg{total symbols} +% ~~\meta{value to symbol mapping} +% \end{syntax} +% This is the low-level function for conversion of an +% \meta{integer expression} into a symbolic form (which will often +% be letters). The \meta{total symbols} available should be given +% as an integer expression. Values are actually converted to symbols +% according to the \meta{value to symbol mapping}. This should be given +% as \meta{total symbols} pairs of entries, a number and the +% appropriate symbol. Thus the \cs{int_to_alph:n} function is defined +% as +% \begin{verbatim} +% \cs_new:Npn \int_to_alph:n #1 { +% \int_convert_to_sybols:nnn {#1} { 26 } +% { +% { 1 } { a } +% { 2 } { b } +% { 3 } { c } +% { 4 } { d } +% { 5 } { e } +% { 6 } { f } +% { 7 } { g } +% { 8 } { h } +% { 9 } { i } +% { 10 } { j } +% { 11 } { k } +% { 12 } { l } +% { 13 } { m } +% { 14 } { n } +% { 15 } { o } +% { 16 } { p } +% { 17 } { q } +% { 18 } { r } +% { 19 } { s } +% { 20 } { t } +% { 21 } { u } +% { 22 } { v } +% { 23 } { w } +% { 24 } { x } +% { 25 } { y } +% { 26 } { z } +% } +% } +% \end{verbatim} +%\end{function} +% +%\section{Variables and constants} % -% \begin{function}{ -% \int_to_arabic:n / (EXP) | -% \int_to_alph:n / (EXP) | -% \int_to_Alph:n / (EXP) | -% \int_to_roman:n / (EXP) | -% \int_to_Roman:n / (EXP) | -% \int_to_symbol:n / (EXP) | +% \begin{variable}{% +% \l_tmpa_int | +% \l_tmpb_int | +% \l_tmpc_int | +% \g_tmpa_int | +% \g_tmpb_int | % } -% \begin{syntax} -% "\int_to_alph:n" \Arg{integer} -% "\int_to_alph:n" <int> -% \end{syntax} -% If some <integer> or the the current value of a <int> should be -% displayed or typeset in a special ways (e.g., as uppercase roman -% numerals) these function can be used. We need braces if the -% argument is a simple <integer>, they can be omitted in case of a -% <int>. By default the letters produced by "\int_to_roman:n" and -% "\int_to_Roman:n" have catcode~11. -% -% All functions are fully expandable and will therefore produce the -% correct output when used inside of deferred writes, etc. In case the -% number in an |alph| or |Alph| function is greater than the default -% base number (26) it follows a simple conversion rule so that 27 is -% turned into |aa|, 50 into |ax| and so on and so forth. These two -% functions can be modified quite easily to take a different base -% number and conversion rule so that other languages can be supported. -% \begin{texnote} -% These are more or less the internal \LaTeX2 functions \tn{@arabic}, -% \tn{@alph}, \tn{Alph}, \tn{@roman}, \tn{@Roman}, and \tn{@fnsymbol} -% except that "\int_to_symbol:n" is also allowed outside math mode. -% \end{texnote} -% \end{function} +% Scratch register for immediate use. They are not used by conditionals +% or predicate functions. +% \end{variable} % -% \subsection{Internal functions} +%\begin{function}{ +% \int_const:Nn | +% \int_const:cn | +%} +% \begin{syntax} +% \cs{int_const:Nn} \meta{integer} \Arg{integer expression} +% \end{syntax} +% Creates a new constant \meta{integer} or raises an error if the name +% is already taken. The value of the \meta{integer} will be set +% globally to the \meta{integer expression}. +%\end{function} +% +%\begin{variable}{ \c_max_int } +% The maximum value that can be stored as an integer. +%\end{variable} +% +%\begin{variable}{ +% \c_minus_one | +% \c_zero | +% \c_one | +% \c_two | +% \c_three | +% \c_four | +% \c_five | +% \c_six | +% \c_seven | +% \c_eight | +% \c_nine | +% \c_ten | +% \c_eleven | +% \c_twelve | +% \c_thirteen | +% \c_fourteen | +% \c_fifteen | +% \c_sixteen | +% \c_thirty_two | +% \c_hundred_one | +% \c_twohundred_fifty_five | +% \c_twohundred_fifty_six | +% \c_thousand | +% \c_ten_thousand | +% \c_ten_thousand_one | +% \c_ten_thousand_two | +% \c_ten_thousand_three | +% \c_ten_thousand_four | +% \c_twenty_thousand | +%} +% Integer values used with primitive tests and assignments: +% self-terminating nature makes these more convenient and faster than +% literal numbers. +%\end{variable} +% +% \begin{variable}{\c_max_register_int} +% Maximum number of registers. +% \end{variable} +% +%\subsection{Internal functions} % % \begin{function}{\int_to_roman:w / (EXP)} % \begin{syntax} @@ -250,17 +841,6 @@ % \end{texnote} % \end{function} % -% \begin{function}{\int_to_number:w / (EXP)} -% \begin{syntax} -% "\int_to_number:w" <integer> <space> -% \end{syntax} -% Converts <integer> to its numerical string. Note that -% it produces a string of letters with catcode 12. -% \begin{texnote} -% This is the \TeX{} primitive \tn{number} renamed. -% \end{texnote} -% \end{function} -% % \begin{function}{ % \int_roman_lcuc_mapping:Nnn | % \int_to_roman_lcuc:NN | @@ -279,104 +859,92 @@ % % \begin{function}{ % \int_convert_number_with_rule:nnN | -% \int_alph_default_conversion_rule:n | -% \int_Alph_default_conversion_rule:n | % \int_symbol_math_conversion_rule:n | % \int_symbol_text_conversion_rule:n | % } % \begin{syntax} % "\int_convert_number_with_rule:nnN" \Arg{int1} \Arg{int2} <function> -% "\int_alph_default_conversion_rule:n" \Arg{int} % \end{syntax} % "\int_convert_number_with_rule:nnN" converts <int1> into letters, % symbols, whatever as defined by <function>. <int2> denotes the base % number for the conversion. % \end{function} -% -% -% -% -% -% -% \section{Variable and constants} -% -% \begin{function}{% -% \int_const:Nn | -% } -% \begin{syntax} -% "\int_const:Nn" "\c_"<value> \Arg{value} -% \end{syntax} -% Defines an integer constant of a certain <value>. If the constant is negative -% or very large it internally uses an <int> register. -% \end{function} -% -% \begin{variable}{ \c_minus_one | \c_zero | \c_one | \c_two | \c_three | -% \c_four | \c_five | \c_six | \c_seven | \c_eight | -% \c_nine | \c_ten | \c_eleven | \c_twelve | \c_thirteen | -% \c_fourteen | \c_fifteen | \c_sixteen | \c_thirty_two | -% \c_hundred_one | -% \c_twohundred_fifty_five | \c_twohundred_fifty_six | -% \c_thousand | -% \c_ten_thousand | \c_ten_thousand_one | -% \c_ten_thousand_two | \c_ten_thousand_three | -% \c_ten_thousand_four | \c_twenty_thousand } -% Set of constants denoting useful values. -% \begin{texnote} -% Some of these constants have been available under \LaTeX2 under names -% like \tn{m@ne}, \tn{z@}, \tn{@ne},\tn{tw@}, \tn{thr@@}, etc. -% \end{texnote} -% \end{variable} -% -% \begin{variable}{% -% \c_max_int | -% } -% Constant that denote the maximum value which can be stored in an -% <int> register. -% \end{variable} -% -% \begin{variable}{\c_max_register_int} -% Maximum number of registers. -% \end{variable} -% -% -% \begin{variable}{% -% \l_tmpa_int | -% \l_tmpb_int | -% \l_tmpc_int | -% \g_tmpa_int | -% \g_tmpb_int | -% } -% Scratch register for immediate use. They are not used by conditionals -% or predicate functions. -% \end{variable} -% -% -% -% -% \section{Conversion} -% -% \begin{function}{% -% \int_convert_from_base_ten:nn | -% } -% \begin{syntax} -% "\int_convert_from_base_ten:nn" \Arg{number} \Arg{base} -% \end{syntax} -% Converts the base~10 number <number> into its equivalent -% representation written in base~<base>. Expandable. -% \end{function} -% -% -% \begin{function}{% -% \int_convert_to_base_ten:nn | -% } -% \begin{syntax} -% "\int_convert_to_base_ten:nn" \Arg{number} \Arg{base} -% \end{syntax} -% Converts the base~<base> number <number> into its equivalent -% representation written in base~10. <number> can consist of digits -% and ascii letters. Expandable. -% \end{function} -% +% +%\begin{function}{ +% \if_num:w / (EXP) | +% \if_int_compare:w / (EXP) +%} +% \begin{syntax} +% "\if_num:w" <number1> <rel> <number2> <true> "\else:" <false> "\fi:" +% \end{syntax} +% Compare two integers using <rel>, which must be one of +% \texttt{=}, "<" or ">" with category code \(12\). +% The \cs{else:} branch is optional. +% \begin{texnote} +% These are both names for the \TeX\ primitive \cs{ifnum}. +% \end{texnote} +%\end{function} +% +%\begin{function}{ +% \if_case:w / (EXP) | +% \or: / (EXP) +%} +% \begin{syntax} +% "\if_case:w" <number> <case0> "\or:" <case1> "\or:" "..." "\else:" +% <default> "\fi:" +% \end{syntax} +% Selects a case to execute based on the value of <number>. The first +% case (<case0>) is executed if <number> is \(0\), the second +% (<case1>) if the <number> is \(1\), \emph{etc}. The +% <number> may be a literal, a constant or an integer +% expression (\emph{e.g}.~using \cs{int_eval:n}). +% \begin{texnote} +% These are the \TeX\ primitives \cs{ifcase} and \cs{or}. +% \end{texnote} +%\end{function} +% +%\begin{function}{\int_value:w / (EXP)} +% \begin{syntax} +% "\int_value:w" <integer> +% "\int_value:w" <tokens> <optional space> +% \end{syntax} +% Expands <tokens> until an <integer> is formed. One space may be +% gobbled in the process. +% \begin{texnote} +% This is the \TeX\ primitive \tn{number}. +% \end{texnote} +%\end{function} +% +%\begin{function}{ +% \int_eval:w / (EXP) | +% \int_eval_end: +%} +% \begin{syntax} +% "\int_eval:w" <int expr> "\int_eval_end:" +% \end{syntax} +% Evaluates <integer expression> as described for \cs{int_eval:n}. +% The evalution stops when an unexpandable token with category code +% other than \(12\) is read or when \cs{int_eval_end:} is +% reached. The latter is gobbled by the scanner mechanism: +% \cs{int_eval_end:} itself is unexpandable but used correctly +% the entire construct is expandable. +% \begin{texnote} +% This is the \eTeX\ primitive \cs{numexpr}. +% \end{texnote} +%\end{function} +% +%\begin{function}{\if_int_odd:w / (EXP)} +% \begin{syntax} +% "\if_int_odd:w" <tokens> <true> "\else:" <false> "\fi:" +% "\if_int_odd:w" <number> <true> "\else:" <false> "\fi:" +% \end{syntax} +% Expands <tokens> until a non-numeric tokens is found, and +% tests whether the resulting <number> is odd. If so, <true code> +% is executed. The \cs{else:} branch is optional. +% \begin{texnote} +% This is the \TeX\ primitive \cs{ifodd}. +% \end{texnote} +%\end{function} % % \end{documentation} % @@ -435,20 +1003,48 @@ %<*initex|package> % \end{macrocode} % +% \begin{macro}{\int_value:w} +% \begin{macro}{\int_eval:n,\int_eval:w,\int_eval_end:} +% \begin{macro}{\if_int_compare:w} +% \begin{macro}{\if_int_odd:w} +% \begin{macro}{\if_num:w} +% \begin{macro}{\if_case:w} % \begin{macro}{\int_to_roman:w} -% \begin{macro}{\int_to_number:w} % \begin{macro}{\int_advance:w} -% A new name for the primitives. +% Here are the remaining primitives for number comparisons and +% expressions. % \begin{macrocode} +\cs_set_eq:NN \int_value:w \tex_number:D +\cs_set_eq:NN \int_eval:w \etex_numexpr:D +\cs_set_protected:Npn \int_eval_end: {\tex_relax:D} +\cs_set_eq:NN \if_int_compare:w \tex_ifnum:D +\cs_new_eq:NN \if_num:w \tex_ifnum:D +\cs_set_eq:NN \if_int_odd:w \tex_ifodd:D +\cs_new_eq:NN \if_case:w \tex_ifcase:D \cs_new_eq:NN \int_to_roman:w \tex_romannumeral:D -\cs_new_eq:NN \int_to_number:w \tex_number:D \cs_new_eq:NN \int_advance:w \tex_advance:D % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} -% Functions that support \LaTeX's user accessible counters should be -% added here, too. But first the internal counters. +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\int_eval:n} +% Wrapper for \cs{int_eval:w}. Can be used in an integer expression +% or directly in the input stream. +% \begin{macrocode} +\cs_set:Npn \int_eval:n #1{ + \int_value:w \int_eval:w #1\int_eval_end: +} +% \end{macrocode} +% \end{macro} +% +% % % \subsection{Allocation and setting} % @@ -481,7 +1077,7 @@ % Setting counters is again something that I would like to make % uniform at the moment to get a better overview. % \begin{macrocode} -\cs_new_protected_nopar:Npn \int_set:Nn #1#2{#1 \intexpr_eval:w #2\intexpr_eval_end: +\cs_new_protected_nopar:Npn \int_set:Nn #1#2{#1 \int_eval:w #2\int_eval_end: %<*check> \chk_local_or_pref_global:N #1 %</check> @@ -499,6 +1095,39 @@ % \end{macro} % \end{macro} % \end{macro} +% +%\begin{macro}{\int_set_eq:NN} +%\begin{macro}{\int_set_eq:cN} +%\begin{macro}{\int_set_eq:Nc} +%\begin{macro}{\int_set_eq:cc} +%\begin{macro}{\int_gset_eq:NN} +%\begin{macro}{\int_gset_eq:cN} +%\begin{macro}{\int_gset_eq:Nc} +%\begin{macro}{\int_gset_eq:cc} +% Setting equal means using one integer inside the set function of +% another. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \int_set_eq:NN #1#2 { + \int_set:Nn #1 {#2} +} +\cs_generate_variant:Nn \int_set_eq:NN { c } +\cs_generate_variant:Nn \int_set_eq:NN { Nc } +\cs_generate_variant:Nn \int_set_eq:NN { cc } +\cs_new_protected_nopar:Npn \int_gset_eq:NN #1#2 { + \int_gset:Nn #1 {#2} +} +\cs_generate_variant:Nn \int_gset_eq:NN { c } +\cs_generate_variant:Nn \int_gset_eq:NN { Nc } +\cs_generate_variant:Nn \int_gset_eq:NN { cc } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} % % \begin{macro}{\int_incr:N} % \begin{macro}{\int_decr:N} @@ -604,13 +1233,13 @@ % accessed by its number, e.g., |\count23|. Not that it should % ever happen but\dots % \begin{macrocode} - \int_advance:w #1 by \intexpr_eval:w #2\intexpr_eval_end: + \int_advance:w #1 by \int_eval:w #2\int_eval_end: %<*check> \chk_local_or_pref_global:N #1 %</check> } \cs_new_nopar:Npn \int_sub:Nn #1#2{ - \int_advance:w #1-\intexpr_eval:w #2\intexpr_eval_end: + \int_advance:w #1-\int_eval:w #2\int_eval_end: %<*check> \chk_local_or_pref_global:N #1 %</check> @@ -667,7 +1296,7 @@ % \begin{macro}{\int_to_arabic:n} % Nothing exciting here. % \begin{macrocode} -\cs_new_nopar:Npn \int_to_arabic:n #1{ \intexpr_eval:n{#1}} +\cs_new_nopar:Npn \int_to_arabic:n #1{ \int_eval:n{#1}} % \end{macrocode} % \end{macro} % @@ -711,15 +1340,15 @@ % The commands for producing the lower and upper case roman numerals % run a loop on one character at a time and also carries some % information for upper or lower case with it. We put it through -% |\intexpr_eval:n| first which is safer and more flexible. +% |\int_eval:n| first which is safer and more flexible. % \begin{macrocode} \cs_new_nopar:Npn \int_to_roman:n #1 { \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN l - \int_to_roman:w \intexpr_eval:n {#1} Q + \int_to_roman:w \int_eval:n {#1} Q } \cs_new_nopar:Npn \int_to_Roman:n #1 { \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN u - \int_to_roman:w \intexpr_eval:n {#1} Q + \int_to_roman:w \int_eval:n {#1} Q } \cs_new_nopar:Npn \int_to_roman_lcuc:NN #1#2{ \use:c {int_to_#1c_roman_#2:} @@ -729,6 +1358,33 @@ % \end{macro} % \end{macro} % \end{macro} +% +%\begin{macro}{\int_convert_to_symbols:nnn} +% For conversion of integers to arbitrary symbols the method is in +% general as follows. The input number ("#1") is compared to the total +% number of symbols available at each place ("#2"). If the input is +% larger than the total number of symbols available then the modulus +% is needed, with one added so that the positions don't have to number +% from 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 +% `pre-packaged'. +% \begin{macrocode} +\cs_new_nopar:Npn \int_convert_to_symbols:nnn #1#2#3 { + \int_compare:nNnTF {#1} > {#2} + { + \exp_args:Nf \int_convert_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:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } } +} +% \end{macrocode} +%\end{macro} % % % @@ -754,72 +1410,97 @@ % otherwise have a tendency to grow quite large. % \begin{macrocode} \cs_set_nopar:Npn \int_convert_number_with_rule:nnN #1#2#3{ - \intexpr_compare:nNnTF {#1}>{#2} + \int_compare:nNnTF {#1}>{#2} { \exp_args:Nf \int_convert_number_with_rule:nnN - { \intexpr_div_truncate:nn {#1-1}{#2} }{#2} + { \int_div_truncate:nn {#1-1}{#2} }{#2} #3 % \end{macrocode} % Note that we have to nudge our modulus function so it won't % return~$0$ as that wouldn't work with |\if_case:w| when that % expects a positive number to produce a letter. % \begin{macrocode} - \exp_args:Nf #3 { \intexpr_eval:n{1+\intexpr_mod:nn {#1-1}{#2}} } + \exp_args:Nf #3 { \int_eval:n{1+\int_mod:nn {#1-1}{#2}} } } - { \exp_args:Nf #3{ \intexpr_eval:n{#1} } } + { \exp_args:Nf #3{ \int_eval:n{#1} } } } % \end{macrocode} % As can be seen it is even simpler to convert to number systems % that contain 0, since then we don't have to add or subtract 1 % here and there. % \end{macro} -% -% \begin{macro}{\int_alph_default_conversion_rule:n} -% \begin{macro}{\int_Alph_default_conversion_rule:n} -% Now we just set up a default conversion rule. Ideally every language -% should have one such rule, as say in Danish there are 29 letters in -% the alphabet. -% \begin{macrocode} -\cs_new_nopar:Npn \int_alph_default_conversion_rule:n #1{ - \if_case:w #1 - \or: a\or: b\or: c\or: d\or: e\or: f - \or: g\or: h\or: i\or: j\or: k\or: l - \or: m\or: n\or: o\or: p\or: q\or: r - \or: s\or: t\or: u\or: v\or: w\or: x - \or: y\or: z - \fi: -} -\cs_new_nopar:Npn \int_Alph_default_conversion_rule:n #1{ - \if_case:w #1 - \or: A\or: B\or: C\or: D\or: E\or: F - \or: G\or: H\or: I\or: J\or: K\or: L - \or: M\or: N\or: O\or: P\or: Q\or: R - \or: S\or: T\or: U\or: V\or: W\or: X - \or: Y\or: Z - \fi: -} -% \end{macrocode} -% \end{macro} -% \end{macro} % % -% \begin{macro}{\int_to_alph:n} -% \begin{macro}{\int_to_Alph:n} -% The actual functions are just instances of the generic function. The -% second argument of |\int_convert_number_with_rule:nnN| should of -% course match the number of |\or:|s in the conversion rule. +%\begin{macro}{\int_to_alph:n} +%\begin{macro}{\int_to_Alph:n} +% These both use the above function with input functions that make sense +% for the alphabet in English. % \begin{macrocode} -\cs_new_nopar:Npn \int_to_alph:n #1{ - \int_convert_number_with_rule:nnN {#1}{26} - \int_alph_default_conversion_rule:n +\cs_new_nopar:Npn \int_to_alph:n #1 { + \int_convert_to_symbols:nnn {#1} { 26 } + { + { 1 } { a } + { 2 } { b } + { 3 } { c } + { 4 } { d } + { 5 } { e } + { 6 } { f } + { 7 } { g } + { 8 } { h } + { 9 } { i } + { 10 } { j } + { 11 } { k } + { 12 } { l } + { 13 } { m } + { 14 } { n } + { 15 } { o } + { 16 } { p } + { 17 } { q } + { 18 } { r } + { 19 } { s } + { 20 } { t } + { 21 } { u } + { 22 } { v } + { 23 } { w } + { 24 } { x } + { 25 } { y } + { 26 } { z } + } } -\cs_new_nopar:Npn \int_to_Alph:n #1{ - \int_convert_number_with_rule:nnN {#1}{26} - \int_Alph_default_conversion_rule:n +\cs_new_nopar:Npn \int_to_Alph:n #1 { + \int_convert_to_symbols:nnn {#1} { 26 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } } % \end{macrocode} -% \end{macro} -% \end{macro} +%\end{macro} +%\end{macro} % % \begin{macro}{\int_to_symbol:n} % Turning a number into a symbol is also easy enough. @@ -900,9 +1581,9 @@ % functions. All they do is evaluate the number in advance. % \begin{macrocode} \cs_set_nopar:Npn \int_pre_eval_one_arg:Nn #1#2{ - \exp_args:Nf#1{\intexpr_eval:n{#2}}} + \exp_args:Nf#1{\int_eval:n{#2}}} \cs_set_nopar:Npn \int_pre_eval_two_args:Nnn #1#2#3{ - \exp_args:Nff#1{\intexpr_eval:n{#2}}{\intexpr_eval:n{#3}} + \exp_args:Nff#1{\int_eval:n{#2}}{\int_eval:n{#3}} } % \end{macrocode} % \end{macro} @@ -911,22 +1592,649 @@ % % % +% +% +% \subsection{Scanning and conversion} +% +% +%\begin{macro}{\int_from_roman:n} +%\begin{macro}[aux]{\int_from_roman_aux:NN} +%\begin{macro}[aux]{\int_from_roman_end:w} +%\begin{macro}[aux]{\int_from_roman_clean_up:w} +% The method here is to iterate through the input, finding the +% appropriate value for each letter and building up a sum. This is +% then evaluated by \TeX. +% \begin{macrocode} +\cs_new_nopar:Npn \int_from_roman:n #1 { + \tl_if_blank:nF {#1} + { + \tex_expandafter:D \int_from_roman_end:w + \tex_number:D \etex_numexpr:D + \int_from_roman_aux:NN #1 Q \q_stop + } +} +\cs_new_nopar:Npn \int_from_roman_aux:NN #1#2 { + \str_if_eq:nnTF {#1} { Q } + {#1#2} + { + \str_if_eq:nnTF {#2} { Q } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + + + \use:c { c_int_from_roman_ #1 _int } + #2 + } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + \cs_if_exist:cF { c_int_from_roman_ #2 _int } + { \int_from_roman_clean_up:w } + \int_compare:nNnTF + { \use:c { c_int_from_roman_ #1 _int } } + < + { \use:c { c_int_from_roman_ #2 _int } } + { + + \use:c { c_int_from_roman_ #2 _int } + - \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN + } + { + + \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN #2 + } + } + } +} +\cs_new_nopar:Npn \int_from_roman_end:w #1 Q #2 \q_stop { + \tl_if_empty:nTF {#2} {#1} {#2} +} +\cs_new_nopar:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\int_convert_from_base_ten:nn} +%\begin{macro}[aux]{\int_convert_from_base_ten_aux:nnn} +%\begin{macro}{\int_convert_number_to_letter:n} +% Converting from base ten ("#1") to a second base ("#2") starts with +% a simple sign check. As the input is base \( 10 \) \TeX\ can then +% do the actual work with the sign itself. +% \begin{macrocode} +\cs_new:Npn \int_convert_from_base_ten:nn #1#2 { + \int_compare:nNnTF {#1} < { 0 } + { + - + \exp_args:Nnf \int_convert_from_base_ten_aux:nnn + { } { \int_eval:n { 0 - ( #1 ) } } {#2} + } + { + \exp_args:Nnf \int_convert_from_base_ten_aux:nnn + { } { \int_eval:n {#1} } {#2} + } +} +% \end{macrocode} +% Here, the idea is to provide a recursive system to deal with the +% input. The output is build up as argument "#1", which is why it +% starts off empty in the above. At each pass, the value in "#2" is +% checked to see if it is less than the new base ("#3"). If it is +% the it is converted directly and the rest of the output is added in. +% On the other hand, if the value to convert is greater than or equal +% to the new base then the modulus and remainder values are found. The +% modulus is converted to a symbol and the remainder is carried forward +% to the next round.S +% \begin{macrocode} +\cs_new:Npn \int_convert_from_base_ten_aux:nnn #1#2#3 { + \int_compare:nNnTF {#2} < {#3} + { + \int_convert_number_to_letter:n {#2} + #1 + } + { + \exp_args:Nff \int_convert_from_base_ten_aux:nnn + { + \int_convert_number_to_letter:n + { \int_mod:nn {#2} {#3} } + #1 + } + { \int_div_truncate:nn {#2} {#3} } + {#3} + } +} +% \end{macrocode} +% Convert to a letter only if necessary, otherwise simply return the +% value unchanged. +% \begin{macrocode} +\cs_new:Npn \int_convert_number_to_letter:n #1 { + \prg_case_int:nnn { #1 - 9 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } + {#1} +} +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\int_convert_to_base_ten:nn} +%\begin{macro}[aux]{\int_convert_to_base_ten_aux:nn} +%\begin{macro}[aux]{\int_convert_to_base_ten_aux:nnN} +%\begin{macro}[aux]{\int_convert_to_base_ten_aux:N} +%\begin{macro}{\int_get_sign_and_digits:n} +%\begin{macro}{\int_get_sign:n} +%\begin{macro}{\int_get_digits:n} +%\begin{macro}[aux]{\int_get_sign_and_digits_aux:nNNN} +%\begin{macro}[aux]{\int_get_sign_and_digits_aux:oNNN} +% Conversion to base ten means stripping off the sign then iterating +% through the input one token at a time. The total number is then added +% up as the code loops. +% \begin{macrocode} +\cs_new:Npn \int_convert_to_base_ten:nn #1#2 { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_convert_to_base_ten_aux:nn + { \int_get_digits:n {#1} } {#2} + } +} +\cs_new:Npn \int_convert_to_base_ten_aux:nn #1#2 { + \int_convert_to_base_ten_aux:nnN { 0 } { #2 } #1 \q_nil +} +\cs_new:Npn \int_convert_to_base_ten_aux:nnN #1#2#3 { + \quark_if_nil:NTF #3 + {#1} + { + \exp_args:Nf \int_convert_to_base_ten_aux:nnN + { \int_eval:n { #1 * #2 + \int_convert_to_base_ten_aux:N #3 } } + {#2} + } +} +% \end{macrocode} +% The conversion here will take lower or upper case letters and turn +% them into the appropriate number, hence the two-part nature of the +% function. +% \begin{macrocode} +\cs_new:Npn \int_convert_to_base_ten_aux:N #1 { + \int_compare:nNnTF { `#1 } < { 58 } + {#1} + { + \int_eval:n + { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } } + } +} +% \end{macrocode} +% Finding a number and its sign requires dealing with an arbitrary +% list of "+" and "-" symbols. This is done by working through token +% by token until there is something else at the start of the input. +% The sign of the input is tracked by the first Boolean used by the +% auxiliary function. +% \begin{macrocode} +\cs_new:Npn \int_get_sign_and_digits:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_true_bool \c_true_bool +} +\cs_new:Npn \int_get_sign:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_true_bool \c_false_bool +} +\cs_new:Npn \int_get_digits:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_false_bool \c_true_bool +} +% \end{macrocode} +% The auxiliary loops through, finding sign tokens and removing them. +% The sign itself is carried through as a flag. +% \begin{macrocode} +\cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 { + \tl_if_head_eq_charcode:fNTF {#1} - + { + \bool_if:NTF #2 + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_false_bool #3#4 + } + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_true_bool #3#4 + } + } + { + \tl_if_head_eq_charcode:fNTF {#1} + + { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 } + { + \bool_if:NT #3 { \bool_if:NF #2 - } + \bool_if:NT #4 {#1} + } + } +} +\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN { o } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\int_from_binary:n} +%\begin{macro}{\int_from_hexadecimal:n} +%\begin{macro}{\int_from_octal:n} +%\begin{macro}{\int_to_binary:n} +%\begin{macro}{\int_to_hexadecimal:n} +%\begin{macro}{\int_to_octal:n} +% Wrappers around the generic function. +% \begin{macrocode} +\cs_new:Npn \int_from_binary:n #1 { + \int_convert_to_base_ten:nn {#1} { 2 } +} +\cs_new:Npn \int_from_hexadecimal:n #1 { + \int_convert_to_base_ten:nn {#1} { 16 } +} +\cs_new:Npn \int_from_octal:n #1 { + \int_convert_to_base_ten:nn {#1} { 8 } +} +\cs_new:Npn \int_to_binary:n #1 { + \int_convert_from_base_ten:nn {#1} { 2 } +} +\cs_new:Npn \int_to_hexadecimal:n #1 { + \int_convert_from_base_ten:nn {#1} { 16 } +} +\cs_new:Npn \int_to_octal:n #1 { + \int_convert_from_base_ten:nn {#1} { 8 } +} +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\int_from_alph:n} +%\begin{macro}[aux]{\int_from_alph_aux:n} +%\begin{macro}[aux]{\int_from_alph_aux:nN} +%\begin{macro}[aux]{\int_from_alph_aux:N} +% The aim here is to iterate through the input, converting one letter at +% a time to a number. The same approach is also used for base +% conversion, but this needs a different final auxiliary. +% \begin{macrocode} +\cs_new:Npn \int_from_alph:n #1 { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_from_alph_aux:n + { \int_get_digits:n {#1} } + } +} +\cs_new:Npn \int_from_alph_aux:n #1 { + \int_from_alph_aux:nN { 0 } #1 \q_nil +} +\cs_new:Npn \int_from_alph_aux:nN #1#2 { + \quark_if_nil:NTF #2 + {#1} + { + \exp_args:Nf \int_from_alph_aux:nN + { \int_eval:n { #1 * 26 + \int_from_alph_aux:N #2 } } + } +} +\cs_new:Npn \int_from_alph_aux:N #1 { + \int_eval:n + { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } } +} +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +% +% \begin{macro}{\int_compare_p:n} +% \begin{macro}[TF]{\int_compare:n} +% Comparison tests using a simple syntax where only one set of braces +% is required and additional operators such as "!=" and ">=" are +% supported. First some notes on the idea behind this. We wish to +% support writing code like +% \begin{verbatim} +% \int_compare_p:n { 5 + \l_tmpa_int != 4 - \l_tmpb_int } +% \end{verbatim} +% In other words, we want to somehow add the missing "\int_eval:w" +% where required. We can start evaluating from the left using +% "\int_eval:w", and we know that since the relation symbols "<", ">", +% "=" and "!" are not allowed in such expressions, they will terminate +% the expression. Therefore, we first let \TeX\ evaluate this left +% hand side of the (in)equality. +% \begin{macrocode} +\prg_set_conditional:Npnn \int_compare:n #1{p,TF,T,F}{ + \exp_after:wN \int_compare_auxi:w \int_value:w + \int_eval:w #1\q_stop +} +% \end{macrocode} +% Then the next step is to figure out which relation we should use, so +% we have to somehow get rid of the first evaluation so that we can +% see what stopped it. "\tex_romannumeral:D" is handy here since its +% expansion given a non-positive number is \m{null}. We therefore +% simply check if the first token of the left hand side evaluation is +% a minus. If not, we insert it and issue "\tex_romannumeral:D", +% thereby ridding us of the left hand side evaluation. We do however +% save it for later. +% \begin{macrocode} +\cs_set:Npn \int_compare_auxi:w #1#2\q_stop{ + \exp_after:wN \int_compare_auxii:w \tex_romannumeral:D + \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop +} +% \end{macrocode} +% This leaves the first relation symbol in front and assuming the +% right hand side has been input, at least one other token as well. We +% support the following forms: |=|, |<|, |>| and the extended |!=|, +% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we +% check if that is present as well. Then use specific function to +% perform the test. +% \begin{macrocode} +\cs_set:Npn \int_compare_auxii:w #1#2#3\q_mark{ + \use:c{ + int_compare_ + #1 \if_meaning:w =#2 = \fi: + :w} +} +% \end{macrocode} +% The actual comparisons are then simple function calls, using the +% relation as delimiter for a delimited argument. +% Equality is easy: +% \begin{macrocode} +\cs_set:cpn {int_compare_=:w} #1=#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +% \end{macrocode} +% So is the one using |==| -- we just have to use |==| in the +% parameter text. +% \begin{macrocode} +\cs_set:cpn {int_compare_==:w} #1==#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +% \end{macrocode} +% Not equal is just about reversing the truth value. +% \begin{macrocode} +\cs_set:cpn {int_compare_!=:w} #1!=#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +% \end{macrocode} +% Less than and greater than are also straight forward. +% \begin{macrocode} +\cs_set:cpn {int_compare_<:w} #1<#2\q_stop{ + \if_int_compare:w #1<\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {int_compare_>:w} #1>#2\q_stop{ + \if_int_compare:w #1>\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +% \end{macrocode} +% The less than or equal operation is just the opposite of the greater +% than operation. Vice versa for less than or equal. +% \begin{macrocode} +\cs_set:cpn {int_compare_<=:w} #1<=#2\q_stop{ + \if_int_compare:w #1>\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:cpn {int_compare_>=:w} #1>=#2\q_stop{ + \if_int_compare:w #1<\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int_compare_p:nNn} +% \begin{macro}[TF]{\int_compare:nNn} +% More efficient but less natural in typing. +% \begin{macrocode} +\prg_set_conditional:Npnn \int_compare:nNn #1#2#3{p}{ + \if_int_compare:w \int_eval:w #1 #2 \int_eval:w #3 + \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set_nopar:Npn \int_compare:nNnT #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use:n + \tex_else:D + \tex_expandafter:D \use_none:n + \tex_fi:D +} +\cs_set_nopar:Npn \int_compare:nNnF #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use_none:n + \tex_else:D + \tex_expandafter:D \use:n + \tex_fi:D +} +\cs_set_nopar:Npn \int_compare:nNnTF #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use_i:nn + \tex_else:D + \tex_expandafter:D \use_ii:nn + \tex_fi:D +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int_max:nn} +% \begin{macro}{\int_min:nn} +% \begin{macro}{\int_abs:n} +% Functions for $\min$, $\max$, and absolute value. +% \begin{macrocode} +\cs_set:Npn \int_abs:n #1{ + \int_value:w + \if_int_compare:w \int_eval:w #1<\c_zero + - + \fi: + \int_eval:w #1\int_eval_end: +} +\cs_set:Npn \int_max:nn #1#2{ + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1>\int_eval:w #2\int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: +} +\cs_set:Npn \int_min:nn #1#2{ + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1<\int_eval:w #2\int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\int_div_truncate:nn} +% \begin{macro}{\int_div_round:nn} +% \begin{macro}{\int_mod:nn} +% As "\int_eval:w" rounds the result of a division we also +% provide a version that truncates the result. +% \begin{macrocode} +% \end{macrocode} +% Initial version didn't work correctly with e\TeX's implementation. +% \begin{macrocode} +%\cs_set:Npn \int_div_truncate_raw:nn #1#2 { +% \int_eval:n{ (2*#1 - #2) / (2* #2) } +%} +% \end{macrocode} +% New version by Heiko: +% \begin{macrocode} +\cs_set:Npn \int_div_truncate:nn #1#2 { + \int_value:w \int_eval:w + \if_int_compare:w \int_eval:w #1 = \c_zero + 0 + \else: + (#1 + \if_int_compare:w \int_eval:w #1 < \c_zero + \if_int_compare:w \int_eval:w #2 < \c_zero + -( #2 + + \else: + +( #2 - + \fi: + \else: + \if_int_compare:w \int_eval:w #2 < \c_zero + +( #2 + + \else: + -( #2 - + \fi: + \fi: + 1)/2) + \fi: + /(#2) + \int_eval_end: +} +% \end{macrocode} +% For the sake of completeness: +% \begin{macrocode} +\cs_set:Npn \int_div_round:nn #1#2 {\int_eval:n{(#1)/(#2)}} +% \end{macrocode} +% Finally there's the modulus operation. +% \begin{macrocode} +\cs_set:Npn \int_mod:nn #1#2 { + \int_value:w + \int_eval:w + #1 - \int_div_truncate:nn {#1}{#2} * (#2) + \int_eval_end: +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int_if_odd_p:n} +% \begin{macro}[TF]{\int_if_odd:n} +% \begin{macro}{\int_if_even_p:n} +% \begin{macro}[TF]{\int_if_even:n} +% A predicate function. +% \begin{macrocode} +\prg_set_conditional:Npnn \int_if_odd:n #1 {p,TF,T,F} { + \if_int_odd:w \int_eval:w #1\int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \int_if_even:n #1 {p,TF,T,F} { + \if_int_odd:w \int_eval:w #1\int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int_while_do:nn} +% \begin{macro}{\int_until_do:nn} +% \begin{macro}{\int_do_while:nn} +% \begin{macro}{\int_do_until:nn} +% These are quite easy given the above functions. The "while" versions +% test first and then execute the body. The "do_while" does it the +% other way round. +% \begin{macrocode} +\cs_set:Npn \int_while_do:nn #1#2{ + \int_compare:nT {#1}{#2 \int_while_do:nn {#1}{#2}} +} +\cs_set:Npn \int_until_do:nn #1#2{ + \int_compare:nF {#1}{#2 \int_until_do:nn {#1}{#2}} +} +\cs_set:Npn \int_do_while:nn #1#2{ + #2 \int_compare:nT {#1}{\int_do_while:nNnn {#1}{#2}} +} +\cs_set:Npn \int_do_until:nn #1#2{ + #2 \int_compare:nF {#1}{\int_do_until:nn {#1}{#2}} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\int_while_do:nNnn} +% \begin{macro}{\int_until_do:nNnn} +% \begin{macro}{\int_do_while:nNnn} +% \begin{macro}{\int_do_until:nNnn} +% As above but not using the more natural syntax. +% \begin{macrocode} +\cs_set:Npn \int_while_do:nNnn #1#2#3#4{ + \int_compare:nNnT {#1}#2{#3}{#4 \int_while_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_until_do:nNnn #1#2#3#4{ + \int_compare:nNnF {#1}#2{#3}{#4 \int_until_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_do_while:nNnn #1#2#3#4{ + #4 \int_compare:nNnT {#1}#2{#3}{\int_do_while:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_do_until:nNnn #1#2#3#4{ + #4 \int_compare:nNnF {#1}#2{#3}{\int_do_until:nNnn {#1}#2{#3}{#4}} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% + % \subsection{Defining constants} % \begin{macro}{\int_const:Nn} +% \begin{macro}{\int_const:cn} % As stated, most constants can be defined as |\tex_chardef:D| or % |\tex_mathchardef:D| but that's engine dependent. % \begin{macrocode} \cs_new_protected_nopar:Npn \int_const:Nn #1#2 { - \intexpr_compare:nTF { #2 > \c_minus_one } + \int_compare:nTF { #2 > \c_minus_one } { - \intexpr_compare:nTF { #2 > \c_max_register_int } + \int_compare:nTF { #2 > \c_max_register_int } { \int_new:N #1 \int_gset:Nn #1 {#2} } { \chk_if_free_cs:N #1 - \tex_global:D \tex_mathchardef:D #1 = \intexpr_eval:n {#2} + \tex_global:D \tex_mathchardef:D #1 = \int_eval:n {#2} } } { @@ -934,6 +2242,16 @@ \int_gset:Nn #1 {#2} } } +\cs_generate_variant:Nn \int_const:Nn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +%\begin{macro}{\c_max_register_int} +% This is here as this particular integer is needed both in package +% mode and to bootstrap \pkg{l3alloc} +% \begin{macrocode} +\tex_mathchardef:D \c_max_register_int = 32767 \scan_stop: % \end{macrocode} % \end{macro} % @@ -997,196 +2315,100 @@ \int_const:Nn \c_max_int {2147483647} % \end{macrocode} % \end{macro} -% -% -% -% \subsection{Scanning and conversion} -% -% -% Conversion between different numbering schemes requires meticulous -% work. A number can be preceeded by any number of |+| and/or |-|. We -% define a generic function which will return the sign and/or the -% remainder. -% -% \begin{macro}{\int_get_sign_and_digits:n} -% \begin{macro}{\int_get_sign:n} -% \begin{macro}{\int_get_digits:n} -% \begin{macro}[aux]{\int_get_sign_and_digits_aux:nNNN} -% \begin{macro}[aux]{\int_get_sign_and_digits_aux:oNNN} -% A number may be preceeded by any number of |+|s and |-|s. Start out -% by assuming we have a positive number. +% +%\begin{macro}[aux]{\c_int_from_roman_i_int} +%\begin{macro}[aux]{\c_int_from_roman_v_int} +%\begin{macro}[aux]{\c_int_from_roman_x_int} +%\begin{macro}[aux]{\l_int_from_roman_l_int} +%\begin{macro}[aux]{\c_int_from_roman_c_int} +%\begin{macro}[aux]{\c_int_from_roman_d_int} +%\begin{macro}[aux]{\c_int_from_roman_m_int} +%\begin{macro}[aux]{\c_int_from_roman_I_int} +%\begin{macro}[aux]{\c_int_from_roman_V_int} +%\begin{macro}[aux]{\c_int_from_roman_X_int} +%\begin{macro}[aux]{\c_int_from_roman_L_int} +%\begin{macro}[aux]{\c_int_from_roman_C_int} +%\begin{macro}[aux]{\c_int_from_roman_D_int} +%\begin{macro}[aux]{\c_int_from_roman_M_int} +% Delayed from earlier. % \begin{macrocode} -\cs_new_nopar:Npn \int_get_sign_and_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_true_bool \c_true_bool -} -\cs_new_nopar:Npn \int_get_sign:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_true_bool \c_false_bool -} -\cs_new_nopar:Npn \int_get_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_false_bool \c_true_bool -} +\int_const:cn { c_int_from_roman_i_int } { 1 } +\int_const:cn { c_int_from_roman_v_int } { 5 } +\int_const:cn { c_int_from_roman_x_int } { 10 } +\int_const:cn { c_int_from_roman_l_int } { 50 } +\int_const:cn { c_int_from_roman_c_int } { 100 } +\int_const:cn { c_int_from_roman_d_int } { 500 } +\int_const:cn { c_int_from_roman_m_int } { 1000 } +\int_const:cn { c_int_from_roman_I_int } { 1 } +\int_const:cn { c_int_from_roman_V_int } { 5 } +\int_const:cn { c_int_from_roman_X_int } { 10 } +\int_const:cn { c_int_from_roman_L_int } { 50 } +\int_const:cn { c_int_from_roman_C_int } { 100 } +\int_const:cn { c_int_from_roman_D_int } { 500 } +\int_const:cn { c_int_from_roman_M_int } { 1000 } % \end{macrocode} -% Now check the first character in the string. Only a |-| can change -% if a number is positive or negative, hence we reverse the boolean -% governing this. Then gobble the |-| and start over. -% \begin{macrocode} -\cs_new_nopar:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4{ - \tl_if_head_eq_charcode:fNTF {#1} - - { - \bool_if:NTF #2 - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} \c_false_bool #3#4 } - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} \c_true_bool #3#4 } - } -% \end{macrocode} -% The other cases are much simpler since we either just have to gobble -% the |+| or exit immediately and insert the correct sign. -% \begin{macrocode} - { - \tl_if_head_eq_charcode:fNTF {#1} + - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} #2#3#4} - { -% \end{macrocode} -% The boolean |#3| is for printing the sign while |#4| is for printing -% the digits. -% \begin{macrocode} - \bool_if:NT #3 { \bool_if:NF #2 - } - \bool_if:NT #4 {#1} - } - } -} -\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN {oNNN} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\int_convert_from_base_ten:nn} -% \begin{macro}[aux]{\int_convert_from_base_ten_aux:nnn} -% \begin{macro}[aux]{\int_convert_from_base_ten_aux:non} -% \begin{macro}[aux]{\int_convert_from_base_ten_aux:fon} -% |#1| is the base 10 number to be converted to base |#2|. We split -% off the sign first, print if if there and then convert only the -% number. Since this is supposedly a base~10 number we can let \TeX\ -% do the reading of |+| and |-|. -% \begin{macrocode} -\cs_set_nopar:Npn \int_convert_from_base_ten:nn#1#2{ - \intexpr_compare:nNnTF {#1}<\c_zero - { - - \int_convert_from_base_ten_aux:nfn {} - { \intexpr_eval:n {-#1} } - } - { - \int_convert_from_base_ten_aux:nfn {} - { \intexpr_eval:n {#1} } - } - {#2} -} -% \end{macrocode} -% The algorithm runs like this: -% \begin{enumerate} -% \item If the number \meta{num} is greater than \meta{base}, -% calculate modulus of \meta{num} and \meta{base} and carry that -% over for next round. The remainder is calculated as a truncated -% division of \meta{num} and \meta{base}. Start over with these new -% values. -% \item If \meta{num} is less than or equal to \meta{base} convert it -% to the correct symbol, print the previously calculated digits and -% exit. -% \end{enumerate} -% |#1| is the carried over result, |#2| the remainder and |#3| the -% base number. -% \begin{macrocode} -\cs_new_nopar:Npn \int_convert_from_base_ten_aux:nnn#1#2#3{ - \intexpr_compare:nNnTF {#2}<{#3} - { \int_convert_number_to_letter:n{#2} #1 } - { - \int_convert_from_base_ten_aux:ffn - { - \int_convert_number_to_letter:n {\intexpr_mod:nn {#2}{#3}} - #1 - } - { \intexpr_div_truncate:nn{#2}{#3}} - {#3} - } -} -\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {nfn} -\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {ffn} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} % -% \begin{macro}{\int_convert_number_to_letter:n} -% Turning a number for a different base into a letter or digit. -% \begin{macrocode} -\cs_set_nopar:Npn \int_convert_number_to_letter:n #1{ - \if_case:w \intexpr_eval:w #1-10\intexpr_eval_end: - \exp_after:wN A \or: \exp_after:wN B \or: - \exp_after:wN C \or: \exp_after:wN D \or: \exp_after:wN E \or: - \exp_after:wN F \or: \exp_after:wN G \or: \exp_after:wN H \or: - \exp_after:wN I \or: \exp_after:wN J \or: \exp_after:wN K \or: - \exp_after:wN L \or: \exp_after:wN M \or: \exp_after:wN N \or: - \exp_after:wN O \or: \exp_after:wN P \or: \exp_after:wN Q \or: - \exp_after:wN R \or: \exp_after:wN S \or: \exp_after:wN T \or: - \exp_after:wN U \or: \exp_after:wN V \or: \exp_after:wN W \or: - \exp_after:wN X \or: \exp_after:wN Y \or: \exp_after:wN Z \else: - \use_i_after_fi:nw{ #1 }\fi: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\int_convert_to_base_ten:nn} -% |#1| is the number, |#2| is its base. First we get the sign, then -% use only the digits/letters from it and pass that onto a new -% function. -% \begin{macrocode} -\cs_set_nopar:Npn \int_convert_to_base_ten:nn #1#2 { - \intexpr_eval:n{ - \int_get_sign:n{#1} - \exp_args:Nf\int_convert_to_base_ten_aux:nn {\int_get_digits:n{#1}}{#2} - } -} -% \end{macrocode} -% This is an intermediate function to get things started. -% \begin{macrocode} -\cs_new_nopar:Npn \int_convert_to_base_ten_aux:nn #1#2{ - \int_convert_to_base_ten_auxi:nnN {0}{#2} #1 \q_no_value -} -% \end{macrocode} -% Here we check each letter/digit and calculate the next number. |#1| -% is the previously calculated result (to be multiplied by the base), -% |#2| is the base and |#3| is the next letter/digit to be added. -% \begin{macrocode} -\cs_new_nopar:Npn \int_convert_to_base_ten_auxi:nnN#1#2#3{ - \quark_if_no_value:NTF #3 - {#1} - {\exp_args:Nf\int_convert_to_base_ten_auxi:nnN - {\intexpr_eval:n{ #1*#2+\int_convert_letter_to_number:N #3} } - {#2} - } -} -% \end{macrocode} -% This is for turning a letter or digit into a number. This function -% also takes care of handling lowercase and uppercase letters. Hence -% |a| is turned into |11| and so is |A|. +% Needed from the tl module: % \begin{macrocode} -\cs_set_nopar:Npn \int_convert_letter_to_number:N #1{ - \intexpr_compare:nNnTF{`#1}<{58}{#1} - { - \intexpr_eval:n{ `#1 - - \intexpr_compare:nNnTF{`#1}<{91}{ 55 }{ 87 } - } - } -} +\int_new:N \g_tl_inline_level_int % \end{macrocode} -% \end{macro} % -% Needed from the tl module: +% \subsection{Backwards compatibility} % \begin{macrocode} -\int_new:N \g_tl_inline_level_int +\cs_set_eq:NN \intexpr_value:w \int_value:w +\cs_set_eq:NN \intexpr_eval:w \int_eval:w +\cs_set_eq:NN \intexpr_eval_end: \int_eval_end: +\cs_set_eq:NN \if_intexpr_compare:w \if_int_compare:w +\cs_set_eq:NN \if_intexpr_odd:w \if_int_odd:w +\cs_set_eq:NN \if_intexpr_case:w \if_case:w +\cs_set_eq:NN \intexpr_eval:n \int_eval:n + +\cs_set_eq:NN \intexpr_compare_p:n \int_compare_p:n +\cs_set_eq:NN \intexpr_compare:nTF \int_compare:nTF +\cs_set_eq:NN \intexpr_compare:nT \int_compare:nT +\cs_set_eq:NN \intexpr_compare:nF \int_compare:nF + +\cs_set_eq:NN \intexpr_compare_p:nNn \int_compare_p:nNn +\cs_set_eq:NN \intexpr_compare:nNnTF \int_compare:nNnTF +\cs_set_eq:NN \intexpr_compare:nNnT \int_compare:nNnT +\cs_set_eq:NN \intexpr_compare:nNnF \int_compare:nNnF + +\cs_set_eq:NN \intexpr_abs:n \int_abs:n +\cs_set_eq:NN \intexpr_max:nn \int_max:nn +\cs_set_eq:NN \intexpr_min:nn \int_min:nn + +\cs_set_eq:NN \intexpr_div_truncate:nn \int_div_truncate:nn +\cs_set_eq:NN \intexpr_div_round:nn \int_div_round:nn +\cs_set_eq:NN \intexpr_mod:nn \int_mod:nn + +\cs_set_eq:NN \intexpr_if_odd_p:n \int_if_odd_p:n +\cs_set_eq:NN \intexpr_if_odd:nTF \int_if_odd:nTF +\cs_set_eq:NN \intexpr_if_odd:nT \int_if_odd:nT +\cs_set_eq:NN \intexpr_if_odd:nF \int_if_odd:nF + +\cs_set_eq:NN \intexpr_while_do:nn \int_while_do:nn +\cs_set_eq:NN \intexpr_until_do:nn \int_until_do:nn +\cs_set_eq:NN \intexpr_do_while:nn \int_do_while:nn +\cs_set_eq:NN \intexpr_do_until:nn \int_do_until:nn + +\cs_set_eq:NN \intexpr_while_do:nNnn \int_while_do:nNnn +\cs_set_eq:NN \intexpr_until_do:nNnn \int_until_do:nNnn +\cs_set_eq:NN \intexpr_do_while:nNnn \int_do_while:nNnn +\cs_set_eq:NN \intexpr_do_until:nNnn \int_do_until:nNnn % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx b/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx deleted file mode 100644 index d791e7ca02b..00000000000 --- a/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx +++ /dev/null @@ -1,677 +0,0 @@ -% \iffalse -%% File: l3intexpr.dtx Copyright (C) 2009-2010 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 -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -% -%<*driver|package> -\RequirePackage{l3names} -%</driver|package> -%\fi -\GetIdInfo$Id: l3intexpr.dtx 2045 2010-09-22 03:59:34Z will $ - {L3 Integer Expressions} -%\iffalse -%<*driver> -%\fi -\ProvidesFile{\filename.\filenameext} - [\filedate\space v\fileversion\space\filedescription] -%\iffalse -\documentclass[full]{l3doc} -\begin{document} -\DocInput{\filename.\filenameext} -\end{document} -%</driver> -% \fi -% -% -% \title{The \textsf{l3intexpr} package\thanks{This file -% has version number \fileversion, last -% revised \filedate.}\\ -% Integer expressions} -% \author{\Team} -% \date{\filedate} -% \maketitle -% -% \begin{documentation} -% -% Calculation and comparison of integer values can be carried out -% using literal numbers, \texttt{int} registers, constants and -% integers stored in token list variables. The standard operators -% \texttt{+}, \texttt{-}, \texttt{/} and \texttt{*} and -% parentheses can be used within such expressions to carry -% arithmetic operations. This module carries out these functions -% on \emph{integer expressions} (`\texttt{int expr}'). -% -%\section{Calculating and comparing integers} -% -% \begin{function}{\intexpr_eval:n / (EXP)} -% \begin{syntax} -% "\intexpr_eval:n" \Arg{int~expr} -% \end{syntax} -% Evaluates an <integer expression>, expanding to a properly -% terminated <number> that can be used in any situation that -% demands one, or which can be typeset. For example, -%\begin{verbatim} -% \intexpr_eval:n{ 5 + 4*3 - (3+4*5) } -%\end{verbatim} -% evaluates to \(-6\). Two expansions are necessary to convert the -% <expression> into the <number> it represents. Full expansion to -% the <number> can be carried out using an \texttt{f} expansion -% in an expandable context or a \texttt{x} expansion in other -% cases. -% \end{function} -% -%\begin{function}{ -% \intexpr_compare_p:n / (EXP) | -% \intexpr_compare:n / (TF) (EXP) -%} -% \begin{syntax} -% "\intexpr_compare_p:n" \Arg{<int~expr1> <rel> <int~expr2>} -% "\intexpr_compare:nTF" \Arg{<int~expr1> <rel> <int~expr2>} -% ~~~~<true code> <false code> -% \end{syntax} -% Evaluates <integer expression 1> and <integer expression 2> as -% described for \cs{intexpr_eval:n}, and then carries out a -% comparison of the resulting integers using C-like operators: -% \begin{center} -% \begin{tabular}{ll@{\hspace{2cm}}ll} -% Less than & "<" & Less than or equal & "<=" \\ -% Greater than & ">" & Greater than or equal & ">=" \\ -% Equal & "==" or "=" & Not equal & "!=" -% \end{tabular} -% \end{center} -% Based on the result of the comparison either the <true code> -% or <false code> is executed. Both integer expressions are evaluated -% fully in the process. Note the syntax, which allows natural input in -% the style of -% \begin{quote} -% |\intexpr_compare_p:n {5+3 != \l_tmpb_int}| -% \end{quote} -% \texttt{=} is available as comparator (in addition to those -% familiar to C users) as standard \TeX\ practice is to compare -% values using a single \texttt{=}. -% \end{function} -% -% -%\begin{function}{ -% \intexpr_compare_p:nNn / (EXP) | -% \intexpr_compare:nNn / (TF)(EXP) -%} -% \begin{syntax} -% "\intexpr_compare_p:nNn" \Arg{int~expr1} <rel> \Arg{int~expr2} -% \end{syntax} -% Evaluates <integer expression 1> and <integer expression 2> as -% described for \cs{intexpr_eval:n}, then compares the two -% results using one of the relations \texttt{=}, "<" or -% ">". These functions are faster than the \texttt{n} -% variants described above but do not support an extended set -% of relational operators. -%\end{function} -% -% -%\begin{function}{ -% \intexpr_max:nn / (EXP)| -% \intexpr_min:nn / (EXP) -%} -% \begin{syntax} -% "\intexpr_max:nn" \Arg{int~expr1} \Arg{int~expr2} -% \end{syntax} -% Evaluates <integer expression 1> and <integer expression 2> as -% described for \cs{intexpr_eval:n}, expanding to the larger or -% smaller of the two resulting <numbers> (for \texttt{max} and -% \texttt{min}, respectively). -% \end{function} -% -%\begin{function}{\intexpr_abs:n / (EXP)} -% \begin{syntax} -% "\intexpr_abs:n" \Arg{int~expr} -% \end{syntax} -% Evaluates <integer expression> as described for \cs{intexpr_eval:n} -% and expands to the absolute value of the resulting <number>. -% \end{function} -% -%\begin{function}{ -% \intexpr_if_odd:n / (EXP)(TF) | -% \intexpr_if_odd_p:n / (EXP) | -% \intexpr_if_even:n / (EXP)(TF) | -% \intexpr_if_even_p:n / (EXP) | -%} -% \begin{syntax} -% "\intexpr_if_odd:nTF" \Arg{int~expr} \Arg{true} \Arg{false} -% \end{syntax} -% Evaluates <integer expression> as described for \cs{intexpr_eval:n} -% and execute <true code> or <false code> depending on whether -% the resulting <number> is odd or even. -% \end{function} -% -%\begin{function}{ -% \intexpr_div_truncate:nn / (EXP) | -% \intexpr_div_round:nn / (EXP) | -% \intexpr_mod:nn / (EXP) | -%} -% \begin{syntax} -% "\intexpr_div_truncate:nn" \Arg{int~expr1} \Arg{int~expr2} -% "\intexpr_mod:nn" \Arg{int~expr1} \Arg{int~expr2} -% \end{syntax} -% Evaluates <integer expression 1> and <integer expression 2> as -% described for \cs{intexpr_eval:n}, expanding to the appropriate -% result of division of the resulting <numbers>. The -% \texttt{truncate} function expands to the integer part of the -% division with the decimal simply discarded, whereas -% \texttt{round} will use the decimal part to round the integer -% up if appropriate. The \texttt{mod} function expands to the integer -% remainder of the division. -%\end{function} -% -% \section{Primitive (internal) functions} -% -%\begin{function}{ -% \if_num:w / (EXP) | -% \if_inexpr_compare:w / (EXP) -%} -% \begin{syntax} -% "\if_num:w" <number1> <rel> <number2> <true> "\else:" <false> "\fi:" -% \end{syntax} -% Compare two integers using <rel>, which must be one of -% \texttt{=}, "<" or ">" with category code \(12\). -% The \cs{else:} branch is optional. -% \begin{texnote} -% These are both names for the \TeX\ primitive \cs{ifnum}. -% \end{texnote} -%\end{function} -% -%\begin{function}{ -% \if_intexpr_case:w / (EXP) | -% \if_case:w / (EXP) | -% \or: / (EXP) -%} -% \begin{syntax} -% "\if_case:w" <number> <case0> "\or:" <case1> "\or:" "..." "\else:" -% <default> "\fi:" -% \end{syntax} -% Selects a case to execute based on the value of <number>. The first -% case (<case0>) is executed if <number> is \(0\), the second -% (<case1>) if the <number> is \(1\), \emph{etc}. The -% <number> may be a literal, a constant or an integer -% expression (\emph{e.g}.~using \cs{intexpr_eval:n}). -% \begin{texnote} -% These are the \TeX\ primitives \cs{ifcase} (with two -% different names depending on context) and \cs{or}. -% \end{texnote} -%\end{function} -% -%\begin{function}{\intexpr_value:w / (EXP)} -% \begin{syntax} -% "\intexpr_value:w" <integer> -% "\intexpr_value:w" <tokens> <optional space> -% \end{syntax} -% Expands <tokens> until an <integer> is formed. One space may be -% gobbled in the process. -% \begin{texnote} -% This is the \TeX\ primitive \tn{number}. -% \end{texnote} -%\end{function} -% -%\begin{function}{ -% \intexpr_eval:w / (EXP) | -% \intexpr_eval_end: -%} -% \begin{syntax} -% "\intexpr_eval:w" <int expr> "\intexpr_eval_end:" -% \end{syntax} -% Evaluates <integer expression> as described for \cs{intexpr_eval:n}. -% The evalution stops when an unexpandable token with category code -% other than \(12\) is read or when \cs{intexpr_eval_end:} is -% reached. The latter is gobbled by the scanner mechanism: -% \cs{intexpr_eval_end:} itself is unexpandable but used correctly -% the entire construct is expandable. -% \begin{texnote} -% This is the \eTeX\ primitive \cs{numexpr}. -% \end{texnote} -%\end{function} -% -%\begin{function}{\if_intexpr_odd:w / (EXP)} -% \begin{syntax} -% "\if_intexpr_odd:w" <tokens> <true> "\else:" <false> "\fi:" -% "\if_intexpr_odd:w" <number> <true> "\else:" <false> "\fi:" -% \end{syntax} -% Expands <tokens> until a non-numeric tokens is found, and -% tests whether the resulting <number> is odd. If so, <true code> -% is executed. The \cs{else:} branch is optional. -% \begin{texnote} -% This is the \TeX\ primitive \cs{ifodd}. -% \end{texnote} -%\end{function} -% -%\begin{function}{ -% \intexpr_while_do:nn / (EXP) | -% \intexpr_until_do:nn / (EXP) | -% \intexpr_do_while:nn / (EXP) | -% \intexpr_do_until:nn / (EXP) -%} -% \begin{syntax} -% "\intexpr_while_do:nn" \Arg{<int~expr1> <rel> <int~expr2>} \Arg{code} -% \end{syntax} -% In the case of the \texttt{while_do} version, the integer -% comparison is evaluated as described for \cs{intexpr_compare_p:n}, -% and if \texttt{true} execute the <code>. The test and code then -% alternate until the result is <false>. The \texttt{do_while} -% alternative first executes the <code> and then evaluates the integer -% comparison. In the \texttt{until} cases, the <code> is executed -% if the test is \texttt{false}: the loop is ended when the relation -% is \texttt{true}. -% \end{function} -% -%\begin{function}{ -% \intexpr_while_do:nNnn / (EXP) | -% \intexpr_until_do:nNnn / (EXP) | -% \intexpr_do_while:nNnn / (EXP) | -% \intexpr_do_until:nNnn / (EXP) -%} -% \begin{syntax} -% "\intexpr_while_do:nNnn" <int expr> <rel> <int~expr> \Arg{code} -% \end{syntax} -% These behave in the same manner as the preceding loops but use the -% relation logic described for \cs{intexpr_compare_p:nNn}. -%\end{function} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3intexpr} implementation} -% -% -% We start by ensuring that the required packages are loaded. -% \begin{macrocode} -%<*package> -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\package_check_loaded_expl: -%</package> -%<*initex|package> -% \end{macrocode} -% -% \begin{macro}{\if_num:w} -% \begin{macro}{\if_case:w} -% Here are the remaining primitives for number comparisons and -% expressions. -% \begin{macrocode} -\cs_new_eq:NN \if_num:w \tex_ifnum:D -\cs_new_eq:NN \if_case:w \tex_ifcase:D -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\intexpr_value:w} -% \begin{macro}{\intexpr_eval:n,\intexpr_eval:w,\intexpr_eval_end:} -% \begin{macro}{\if_intexpr_compare:w} -% \begin{macro}{\if_intexpr_odd:w} -% \begin{macro}{\if_intexpr_case:w} -% Here are the remaining primitives for number comparisons and -% expressions. -% \begin{macrocode} -\cs_set_eq:NN \intexpr_value:w \tex_number:D -\cs_set_eq:NN \intexpr_eval:w \etex_numexpr:D -\cs_set_protected:Npn \intexpr_eval_end: {\tex_relax:D} -\cs_set_eq:NN \if_intexpr_compare:w \tex_ifnum:D -\cs_set_eq:NN \if_intexpr_odd:w \tex_ifodd:D -\cs_set_eq:NN \if_intexpr_case:w \tex_ifcase:D -\cs_set:Npn \intexpr_eval:n #1{ - \intexpr_value:w \intexpr_eval:w #1\intexpr_eval_end: -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% -% -% -% -% \begin{macro}{\intexpr_compare_p:n} -% \begin{macro}[TF]{\intexpr_compare:n} -% Comparison tests using a simple syntax where only one set of braces -% is required and additional operators such as "!=" and ">=" are -% supported. First some notes on the idea behind this. We wish to -% support writing code like -% \begin{verbatim} -% \intexpr_compare_p:n { 5 + \l_tmpa_int != 4 - \l_tmpb_int } -% \end{verbatim} -% In other words, we want to somehow add the missing "\intexpr_eval:w" -% where required. We can start evaluating from the left using -% "\intexpr:w", and we know that since the relation symbols "<", ">", -% "=" and "!" are not allowed in such expressions, they will terminate -% the expression. Therefore, we first let \TeX\ evaluate this left -% hand side of the (in)equality. -% \begin{macrocode} -\prg_set_conditional:Npnn \intexpr_compare:n #1{p,TF,T,F}{ - \exp_after:wN \intexpr_compare_auxi:w \intexpr_value:w - \intexpr_eval:w #1\q_stop -} -% \end{macrocode} -% Then the next step is to figure out which relation we should use, so -% we have to somehow get rid of the first evaluation so that we can -% see what stopped it. "\tex_romannumeral:D" is handy here since its -% expansion given a non-positive number is \m{null}. We therefore -% simply check if the first token of the left hand side evaluation is -% a minus. If not, we insert it and issue "\tex_romannumeral:D", -% thereby ridding us of the left hand side evaluation. We do however -% save it for later. -% \begin{macrocode} -\cs_set:Npn \intexpr_compare_auxi:w #1#2\q_stop{ - \exp_after:wN \intexpr_compare_auxii:w \tex_romannumeral:D - \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop -} -% \end{macrocode} -% This leaves the first relation symbol in front and assuming the -% right hand side has been input, at least one other token as well. We -% support the following forms: |=|, |<|, |>| and the extended |!=|, -% |==|, |<=| and |>=|. All the extended forms have an extra |=| so we -% check if that is present as well. Then use specific function to -% perform the test. -% \begin{macrocode} -\cs_set:Npn \intexpr_compare_auxii:w #1#2#3\q_mark{ - \use:c{ - intexpr_compare_ - #1 \if_meaning:w =#2 = \fi: - :w} -} -% \end{macrocode} -% The actual comparisons are then simple function calls, using the -% relation as delimiter for a delimited argument. -% Equality is easy: -% \begin{macrocode} -\cs_set:cpn {intexpr_compare_=:w} #1=#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -% \end{macrocode} -% So is the one using |==| -- we just have to use |==| in the -% parameter text. -% \begin{macrocode} -\cs_set:cpn {intexpr_compare_==:w} #1==#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -% \end{macrocode} -% Not equal is just about reversing the truth value. -% \begin{macrocode} -\cs_set:cpn {intexpr_compare_!=:w} #1!=#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -% \end{macrocode} -% Less than and greater than are also straight forward. -% \begin{macrocode} -\cs_set:cpn {intexpr_compare_<:w} #1<#2\q_stop{ - \if_intexpr_compare:w #1<\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set:cpn {intexpr_compare_>:w} #1>#2\q_stop{ - \if_intexpr_compare:w #1>\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -% \end{macrocode} -% The less than or equal operation is just the opposite of the greater -% than operation. Vice versa for less than or equal. -% \begin{macrocode} -\cs_set:cpn {intexpr_compare_<=:w} #1<=#2\q_stop{ - \if_intexpr_compare:w #1>\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -\cs_set:cpn {intexpr_compare_>=:w} #1>=#2\q_stop{ - \if_intexpr_compare:w #1<\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\intexpr_compare_p:nNn} -% \begin{macro}[TF]{\intexpr_compare:nNn} -% More efficient but less natural in typing. -% \begin{macrocode} -\prg_set_conditional:Npnn \intexpr_compare:nNn #1#2#3{p}{ - \if_intexpr_compare:w \intexpr_eval:w #1 #2 \intexpr_eval:w #3 - \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set_nopar:Npn \intexpr_compare:nNnT #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use:n - \tex_else:D - \tex_expandafter:D \use_none:n - \tex_fi:D -} -\cs_set_nopar:Npn \intexpr_compare:nNnF #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use_none:n - \tex_else:D - \tex_expandafter:D \use:n - \tex_fi:D -} -\cs_set_nopar:Npn \intexpr_compare:nNnTF #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use_i:nn - \tex_else:D - \tex_expandafter:D \use_ii:nn - \tex_fi:D -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\intexpr_max:nn} -% \begin{macro}{\intexpr_min:nn} -% \begin{macro}{\intexpr_abs:n} -% Functions for $\min$, $\max$, and absolute value. -% \begin{macrocode} -\cs_set:Npn \intexpr_abs:n #1{ - \intexpr_value:w - \if_intexpr_compare:w \intexpr_eval:w #1<\c_zero - - - \fi: - \intexpr_eval:w #1\intexpr_eval_end: -} -\cs_set:Npn \intexpr_max:nn #1#2{ - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w - \intexpr_eval:w #1>\intexpr_eval:w #2\intexpr_eval_end: - #1 - \else: - #2 - \fi: - \intexpr_eval_end: -} -\cs_set:Npn \intexpr_min:nn #1#2{ - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w - \intexpr_eval:w #1<\intexpr_eval:w #2\intexpr_eval_end: - #1 - \else: - #2 - \fi: - \intexpr_eval_end: -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% -% \begin{macro}{\intexpr_div_truncate:nn} -% \begin{macro}{\intexpr_div_round:nn} -% \begin{macro}{\intexpr_mod:nn} -% As "\intexpr_eval:w" rounds the result of a division we also -% provide a version that truncates the result. -% \begin{macrocode} -% \end{macrocode} -% Initial version didn't work correctly with e\TeX's implementation. -% \begin{macrocode} -%\cs_set:Npn \intexpr_div_truncate_raw:nn #1#2 { -% \intexpr_eval:n{ (2*#1 - #2) / (2* #2) } -%} -% \end{macrocode} -% New version by Heiko: -% \begin{macrocode} -\cs_set:Npn \intexpr_div_truncate:nn #1#2 { - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w \intexpr_eval:w #1 = \c_zero - 0 - \else: - (#1 - \if_intexpr_compare:w \intexpr_eval:w #1 < \c_zero - \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero - -( #2 + - \else: - +( #2 - - \fi: - \else: - \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero - +( #2 + - \else: - -( #2 - - \fi: - \fi: - 1)/2) - \fi: - /(#2) - \intexpr_eval_end: -} -% \end{macrocode} -% For the sake of completeness: -% \begin{macrocode} -\cs_set:Npn \intexpr_div_round:nn #1#2 {\intexpr_eval:n{(#1)/(#2)}} -% \end{macrocode} -% Finally there's the modulus operation. -% \begin{macrocode} -\cs_set:Npn \intexpr_mod:nn #1#2 { - \intexpr_value:w - \intexpr_eval:w - #1 - \intexpr_div_truncate:nn {#1}{#2} * (#2) - \intexpr_eval_end: -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\intexpr_if_odd_p:n} -% \begin{macro}[TF]{\intexpr_if_odd:n} -% \begin{macro}{\intexpr_if_even_p:n} -% \begin{macro}[TF]{\intexpr_if_even:n} -% A predicate function. -% \begin{macrocode} -\prg_set_conditional:Npnn \intexpr_if_odd:n #1 {p,TF,T,F} { - \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\prg_set_conditional:Npnn \intexpr_if_even:n #1 {p,TF,T,F} { - \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\intexpr_while_do:nn} -% \begin{macro}{\intexpr_until_do:nn} -% \begin{macro}{\intexpr_do_while:nn} -% \begin{macro}{\intexpr_do_until:nn} -% These are quite easy given the above functions. The "while" versions -% test first and then execute the body. The "do_while" does it the -% other way round. -% \begin{macrocode} -\cs_set:Npn \intexpr_while_do:nn #1#2{ - \intexpr_compare:nT {#1}{#2 \intexpr_while_do:nn {#1}{#2}} -} -\cs_set:Npn \intexpr_until_do:nn #1#2{ - \intexpr_compare:nF {#1}{#2 \intexpr_until_do:nn {#1}{#2}} -} -\cs_set:Npn \intexpr_do_while:nn #1#2{ - #2 \intexpr_compare:nT {#1}{\intexpr_do_while:nNnn {#1}{#2}} -} -\cs_set:Npn \intexpr_do_until:nn #1#2{ - #2 \intexpr_compare:nF {#1}{\intexpr_do_until:nn {#1}{#2}} -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\intexpr_while_do:nNnn} -% \begin{macro}{\intexpr_until_do:nNnn} -% \begin{macro}{\intexpr_do_while:nNnn} -% \begin{macro}{\intexpr_do_until:nNnn} -% As above but not using the more natural syntax. -% \begin{macrocode} -\cs_set:Npn \intexpr_while_do:nNnn #1#2#3#4{ - \intexpr_compare:nNnT {#1}#2{#3}{#4 \intexpr_while_do:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_until_do:nNnn #1#2#3#4{ - \intexpr_compare:nNnF {#1}#2{#3}{#4 \intexpr_until_do:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_do_while:nNnn #1#2#3#4{ - #4 \intexpr_compare:nNnT {#1}#2{#3}{\intexpr_do_while:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_do_until:nNnn #1#2#3#4{ - #4 \intexpr_compare:nNnF {#1}#2{#3}{\intexpr_do_until:nNnn {#1}#2{#3}{#4}} -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -%\begin{macro}{\c_max_register_int} -% This is here as this particular integer is needed both in package -% mode and to bootstrap \pkg{l3alloc} -% \begin{macrocode} -\tex_mathchardef:D \c_max_register_int = 32767 \scan_stop: -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -%</initex|package> -% \end{macrocode} -% -% \end{implementation} -% \PrintIndex -% -% \endinput diff --git a/Master/texmf-dist/source/latex/expl3/l3io.dtx b/Master/texmf-dist/source/latex/expl3/l3io.dtx index f27175de874..4f31a349b71 100644 --- a/Master/texmf-dist/source/latex/expl3/l3io.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3io.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3io.dtx 1923 2010-05-22 12:45:49Z joseph $ +\GetIdInfo$Id: l3io.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental i/o module} %\iffalse %<*driver> @@ -530,7 +530,7 @@ \iow_close:N #1 \int_set:Nn \l_iow_stream_int { \c_sixteen } \tl_map_function:NN \c_iow_streams_tl \iow_alloc_write:n - \intexpr_compare:nTF { \l_iow_stream_int = \c_sixteen } + \int_compare:nTF { \l_iow_stream_int = \c_sixteen } { \msg_kernel_error:nn { iow } { streams-exhausted } } { \iow_stream_alloc:N #1 @@ -543,7 +543,7 @@ \ior_close:N #1 \int_set:Nn \l_ior_stream_int { \c_sixteen } \tl_map_function:NN \c_ior_streams_tl \ior_alloc_read:n - \intexpr_compare:nTF { \l_ior_stream_int = \c_sixteen } + \int_compare:nTF { \l_ior_stream_int = \c_sixteen } { \msg_kernel_error:nn { ior } { streams-exhausted } } { \ior_stream_alloc:N #1 @@ -605,7 +605,7 @@ %</initex|package> %<*package> \iow_stream_alloc_aux: - \intexpr_compare:nT { \l_iow_stream_int = \c_sixteen } + \int_compare:nT { \l_iow_stream_int = \c_sixteen } { \iow_raw_new:N \g_iow_tmp_stream \int_set:Nn \l_iow_stream_int { \g_iow_tmp_stream } @@ -625,7 +625,7 @@ %<*package> \cs_new_protected_nopar:Npn \iow_stream_alloc_aux: { \int_incr:N \l_iow_stream_int - \intexpr_compare:nT + \int_compare:nT { \l_iow_stream_int < \c_sixteen } { \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream } @@ -645,7 +645,7 @@ %</initex|package> %<*package> \ior_stream_alloc_aux: - \intexpr_compare:nT { \l_ior_stream_int = \c_sixteen } + \int_compare:nT { \l_ior_stream_int = \c_sixteen } { \ior_raw_new:N \g_ior_tmp_stream \int_set:Nn \l_ior_stream_int { \g_ior_tmp_stream } @@ -665,7 +665,7 @@ %<*package> \cs_new_protected_nopar:Npn \ior_stream_alloc_aux: { \int_incr:N \l_ior_stream_int - \intexpr_compare:nT + \int_compare:nT { \l_ior_stream_int < \c_sixteen } { \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream } @@ -698,7 +698,7 @@ \cs_new_protected_nopar:Npn \iow_close:N #1 { \cs_if_exist:NT #1 { - \intexpr_compare:nF { #1 = \c_minus_one } + \int_compare:nF { #1 = \c_minus_one } { \tex_immediate:D \tex_closeout:D #1 \prop_gdel:NV \g_iow_streams_prop #1 @@ -710,7 +710,7 @@ \cs_new_protected_nopar:Npn \ior_close:N #1 { \cs_if_exist:NT #1 { - \intexpr_compare:nF { #1 = \c_minus_one } + \int_compare:nF { #1 = \c_minus_one } { \tex_closein:D #1 \prop_gdel:NV \g_ior_streams_prop #1 @@ -924,4 +924,4 @@ %\end{macro} %\end{macro} % -% \end{implementation}
\ No newline at end of file +% \end{implementation} diff --git a/Master/texmf-dist/source/latex/expl3/l3keys.dtx b/Master/texmf-dist/source/latex/expl3/l3keys.dtx index 188a2ac8547..0a61c516311 100644 --- a/Master/texmf-dist/source/latex/expl3/l3keys.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3keys.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3keys.dtx 1931 2010-05-24 21:06:50Z joseph $ +\GetIdInfo$Id: l3keys.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental key-value support} %\iffalse %<*driver> @@ -1021,7 +1021,7 @@ % \begin{macrocode} \cs_new_protected:Npn \keys_define_key:n #1 { \bool_if:NTF \l_keys_no_value_bool { - \intexpr_compare:nTF { + \int_compare:nTF { \exp_args:Nc \cs_get_arg_count_from_signature:N { \l_keys_property_tl } = \c_zero } { diff --git a/Master/texmf-dist/source/latex/expl3/l3msg.dtx b/Master/texmf-dist/source/latex/expl3/l3msg.dtx index 65e092384b9..26c631177ee 100644 --- a/Master/texmf-dist/source/latex/expl3/l3msg.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3msg.dtx @@ -37,7 +37,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3msg.dtx 1866 2010-03-23 08:29:27Z joseph $ +\GetIdInfo$Id: l3msg.dtx 2052 2010-10-02 16:04:38Z will $ {L3 Experimental LaTeX Messages module} %\iffalse %<*driver> @@ -356,16 +356,17 @@ % message system. Inside <text> and <more text> spaces are not ignored. %\end{function} % -%\begin{function}{\msg_direct_interrupt:xxxx} +%\begin{function}{\msg_direct_interrupt:xxxxx} % \begin{syntax} -% "\msg_direct_interrupt:xxxxn" \marg{first line} \marg{text} -% ~~~~\marg{continuation} \marg{more text} +% "\msg_direct_interrupt:xxxxx" \marg{first line} \marg{text} +% ~~~~\marg{continuation} \marg{last line} \marg{more text} % \end{syntax} % Executes a \TeX\ error, interrupting compilation. The <first line> % is displayed followed by <text> and the input prompt. <more text> is % displays if requested by the user. If <more text> is blank a default % is supplied. Each line of <text> (broken with "\\") begins with -% <continuation>. +% <continuation> and finishes off with <last line>. +% <last line> has a period appended to it; do not add one yourself. %\end{function} % %\begin{function}{ @@ -465,11 +466,18 @@ % \end{syntax} % Short-cut for `This is a LaTeX bug: check coding' errors. %\end{function} +% +% \begin{function}{\msg_fatal_text:n} +% \begin{syntax} +% "\msg_fatal_text:n" \marg{package} +% \end{syntax} +% Prints `Fatal <package> error' for use in error messages. +% \end{function} +% % % \section{Variables and constants} % %\begin{variable}{ -% \c_msg_fatal_tl | % \c_msg_error_tl | % \c_msg_warning_tl | % \c_msg_info_tl @@ -554,21 +562,29 @@ % % \subsection{Variables and constants} % -%\begin{macro}{\c_msg_fatal_tl} %\begin{macro}{\c_msg_error_tl} %\begin{macro}{\c_msg_warning_tl} %\begin{macro}{\c_msg_info_tl} % Header information. % \begin{macrocode} -\tl_const:Nn \c_msg_fatal_tl { Fatal~Error } -\tl_const:Nn \c_msg_error_tl { Error } -\tl_const:Nn \c_msg_warning_tl { Warning } -\tl_const:Nn \c_msg_info_tl { Info } +\tl_const:Nn \c_msg_error_tl { error } +\tl_const:Nn \c_msg_warning_tl { warning } +\tl_const:Nn \c_msg_info_tl { info } % \end{macrocode} %\end{macro} %\end{macro} -%\end{macro} -%\end{macro} +%\end{macro} +% +% +% \begin{macro}{\msg_fatal_text:n,\msg_see_documentation_text:n} +% Contextual header/footer information. +% \begin{macrocode} +\cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } +\cs_new:Npn \msg_see_documentation_text:n #1 + { See~the~#1~documentation~for~further~information } +% \end{macrocode} +% \end{macro} +% % %\begin{macro}{\c_msg_coding_error_text_tl} %\begin{macro}{\c_msg_fatal_text_tl} @@ -593,8 +609,7 @@ This~is~a~LaTeX~bug:~check~coding! } \tl_const:Nn \c_msg_kernel_bug_more_text_tl { - There~is~a~coding~bug~somewhere~around~here. - \msg_newline: + There~is~a~coding~bug~somewhere~around~here. \\ This~probably~needs~examining~by~an~expert. \c_msg_return_text_tl } @@ -603,9 +618,9 @@ \c_msg_return_text_tl } \tl_const:Nn \c_msg_return_text_tl { - \msg_two_newlines: + \\ \\ Try~typing~<return>~to~proceed. - \msg_newline: + \\ If~that~doesn't~work,~type~X~<return>~to~quit } % \end{macrocode} @@ -618,20 +633,17 @@ %\end{macro} % %\begin{macro}[aux]{\c_msg_hide_tl<spaces>} -% An empty variable with a number of (category code 11) spaces at the +% An empty variable with a number of (category code 11) periods at the % end of its name. This is used to push the \TeX\ part of an error % message ``off the screen''. -% -% No indentation here as \verb*" " is a letter! % \begin{macrocode} \group_begin: -\char_make_letter:N\ % -\tl_to_lowercase:n{% -\group_end:% -\tl_const:Nn% -\c_msg_hide_tl % -{}% -}% +\char_make_letter:N \. +\tl_to_lowercase:n { + \group_end: + \tl_const:Nn \c_msg_hide_tl................................................ + {} +} % \end{macrocode} %\end{macro} % @@ -772,48 +784,61 @@ %\end{macro} %\end{macro} % -%\begin{macro}{\msg_direct_interrupt:xxxx} +%\begin{macro}{\msg_direct_interrupt:xxxxx} %\begin{macro}[aux]{\msg_direct_interrupt:n} % The low-level interruption macro is rather opaque, unfortunately. The % idea here is to create a a message which hides all of \TeX's own -% information by filling the output up with spaces. To achieve this, -% spaces have to be letters: hence no indentation. The odd -% \cs{c_msg_hide_tl<spaces>} actually does the hiding: it is the -% large run of spaces in the name that is important here. The meaning +% information by filling the output up with dots. To achieve this, +% dots have to be letters. The odd +% \cs{c_msg_hide_tl<dots>} actually does the hiding: it is the +% large run of dots in the name that is important here. The meaning % of "\\" is altered so that the explanation text is a simple run % whilst the initial error has line-continuation shown. % \begin{macrocode} \group_begin: \char_set_lccode:nn {`\&} {`\ } % { \char_set_lccode:w `\} = `\ \scan_stop: + \char_set_lccode:w `\& = `\!\scan_stop: \char_make_active:N \& - \char_make_letter:N\ % -\tl_to_lowercase:n{% -\group_end:% -\cs_new_protected:Npn\msg_direct_interrupt:xxxx#1#2#3#4{% -\group_begin:% -\cs_set_eq:NN\\\msg_newline:% -\cs_set_eq:NN\ \c_space_tl% -\msg_direct_interrupt_aux:n{#4}% -\cs_set_nopar:Npn\\{\msg_newline:#3}% -\tex_errhelp:D\l_msg_tmp_tl% -\cs_set:Npn&{% -\tex_errmessage:D{% -#1\msg_newline:% -#2\msg_two_newlines:% -\c_msg_help_text_tl% -\c_msg_hide_tl % -}% -}% -&% -\group_end:% -}% -}% + \char_make_letter:N \. +\tl_to_lowercase:n{ + \group_end: + \cs_new_protected:Npn \msg_direct_interrupt:xxxxx #1#2#3#4#5 { + \group_begin: + \cs_set_nopar:Npn \\ {\msg_newline:} + \cs_set_eq:NN \ \c_space_tl + \tl_set:Nx \l_tmpa_tl {#5} + \tl_set:Nx \l_tmpb_tl {\c_msg_no_info_text_tl} + \msg_direct_interrupt_aux:n {#5} + \tex_errhelp:D \l_msg_tmp_tl + \cs_set_nopar:Npn \\ {\msg_newline: !~#3} + \iow_term:x + {\msg_newline: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} + \cs_set:Npn & { + \tex_errmessage:D{ + \\ #1 \\ \\ #2 \\ \\ #4 + \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl + { . \\ \c_msg_help_text_tl } + \c_msg_hide_tl................................................ + } + } + & + \group_end: + } +} +% \end{macrocode} +% +% \begin{macrocode} \cs_new_protected:Npn \msg_direct_interrupt_aux:n #1 { + \cs_set_nopar:Npn \\ {\msg_newline: |~} \tl_if_empty:nTF {#1} { \tl_set:Nx \l_msg_tmp_tl { { \c_msg_no_info_text_tl } } }{ - \tl_set:Nx \l_msg_tmp_tl { {#1} } + \tl_set:Nx \l_msg_tmp_tl { { + |'''''''''''''''''''''''''''''''''''''''''''''''\\ + #1^^J + |...............................................^^J + } } } } % \end{macrocode} @@ -1002,13 +1027,13 @@ % For fatal errors, after the error message \TeX\ bails out. % \begin{macrocode} \msg_class_new:nn { fatal } { - \msg_direct_interrupt:xxxx - { \c_msg_fatal_tl \msg_two_newlines: } + \msg_direct_interrupt:xxxxx + { \msg_fatal_text:n {#1} : ~ "#2" } { - ( \c_msg_fatal_tl ) \c_space_tl \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( \c_msg_fatal_tl ) \c_space_tl } + {} + { \msg_see_documentation_text:n {#1} } { \c_msg_fatal_text_tl } \tex_end:D } @@ -1028,13 +1053,13 @@ % is tried. % \begin{macrocode} \msg_class_new:nn { error } { - \msg_direct_interrupt:xxxx - { #1~\c_msg_error_tl \msg_newline: } + \msg_direct_interrupt:xxxxx + { #1~ \c_msg_error_tl : ~ "#2" } { - ( #1 ) \c_space_tl \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( #1 ) \c_space_tl } + {} + { \msg_see_documentation_text:n {#1} } { \cs_if_exist:cTF { \c_msg_more_text_prefix_tl #1 / #2 :xxxx } { @@ -1240,14 +1265,14 @@ % Fatal kernel errors cannot be re-defined. % \begin{macrocode} \cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 { - \msg_direct_interrupt:xxxx - { \c_msg_fatal_tl \msg_two_newlines: } + \msg_direct_interrupt:xxxxx + { \msg_fatal_text:n {LaTeX} } { - ( LaTeX ) \c_space_tl \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( LaTeX ) \c_space_tl} + {} + { \msg_see_documentation_text:n {LaTeX3} } { \c_msg_fatal_text_tl } \tex_end:D } @@ -1267,14 +1292,14 @@ % Neither can kernel errors. % \begin{macrocode} \cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 { - \msg_direct_interrupt:xxxx - { LaTeX~\c_msg_error_tl \msg_newline: } + \msg_direct_interrupt:xxxxx + { LaTeX~\c_msg_error_tl \c_space_tl "#2" } { - ( LaTeX ) \c_space_tl \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( LaTeX ) \c_space_tl } + {} + { \msg_see_documentation_text:n {LaTeX3} } { \cs_if_exist:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 :xxxx } @@ -1358,10 +1383,11 @@ % The \LaTeX\ coding bug error gets re-visited here. % \begin{macrocode} \cs_set_protected:Npn \msg_kernel_bug:x #1 { - \msg_direct_interrupt:xxxx - { \c_msg_kernel_bug_text_tl } - { !~#1 } - { ! } + \msg_direct_interrupt:xxxxx + { \c_msg_kernel_bug_text_tl } + { #1 } + {} + { \msg_see_documentation_text:n {LaTeX3} } { \c_msg_kernel_bug_more_text_tl } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3names.dtx b/Master/texmf-dist/source/latex/expl3/l3names.dtx index 6c0ceea0129..6a36bf148cc 100644 --- a/Master/texmf-dist/source/latex/expl3/l3names.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3names.dtx @@ -103,7 +103,7 @@ \RequirePackage{l3names} %</driver> %\fi -\GetIdInfo$Id: l3names.dtx 2048 2010-09-26 19:13:59Z joseph $ +\GetIdInfo$Id: l3names.dtx 2064 2010-10-03 23:27:33Z will $ {L3 Experimental Naming Scheme for TeX Primitives} %\iffalse %<package>\endgroup @@ -333,7 +333,7 @@ % check for that too. % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup - \ifx\csname pdfstrcmp\endcsname\relax + \expandafter\ifx\csname pdfstrcmp\endcsname\relax \let\pdfstrcmp\strcmp \fi % \end{macrocode} @@ -346,9 +346,9 @@ % \cs{pdfstrcmp}. % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup -\ifx\csname pdfstrcmp\endcsname\relax +\expandafter\ifx\csname pdfstrcmp\endcsname\relax %<*package> - \PackageError{l3names}{Required primitives not found} + \PackageError{l3names}{Required primitive not found: \protect\pdfstrcmp} {% LaTeX3 requires the e-TeX primitives and \string\pdfstrcmp.\MessageBreak @@ -1024,13 +1024,17 @@ % \end{macrocode} % % XeTeX adds \cs{strcmp} to the set of primitives, with the same -% implementation as \cs{pdfstrcmp} but a different name. To avoid +% implementation as \cs{pdfstrcmp} but a different name. To avoid % having to worry about this later, the same internal name is used. +% Note that we want to use the original primitive name here so that +% |\name_undefine:N| (if used) will remove it. % \begin{macrocode} -\etex_ifdefined:D \strcmp - \etex_ifdefined:D \xetex_version:D - \name_primitive:NN \strcmp \pdf_strcmp:D - \tex_fi:D +\tex_begingroup:D + \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D +\tex_endgroup:D +\tex_expandafter:D \tex_ifx:D \tex_csname:D xetex_version:D\tex_endcsname:D + \tex_relax:D \tex_else:D + \name_primitive:NN \strcmp \pdf_strcmp:D \tex_fi:D % \end{macrocode} % @@ -1238,7 +1242,7 @@ % as the packages in this distribution do like this: % \begin{verbatim} % \RequirePackage{l3names} -% \GetIdInfo$Id: l3names.dtx 2048 2010-09-26 19:13:59Z joseph $ +% \GetIdInfo$Id: l3names.dtx 2064 2010-10-03 23:27:33Z will $ % {L3 Experimental Box module} % \ProvidesExplPackage % {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/source/latex/expl3/l3num.dtx b/Master/texmf-dist/source/latex/expl3/l3num.dtx index 866216ca57a..45759166b46 100644 --- a/Master/texmf-dist/source/latex/expl3/l3num.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3num.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3num.dtx 1914 2010-05-21 16:18:46Z schoepf $ +\GetIdInfo$Id: l3num.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental token numbers} %\iffalse %<*driver> @@ -249,7 +249,7 @@ % \begin{syntax} % "\if_num:w" <number1> <rel> <number2> <true> "\else:" <false> "\fi:" % \end{syntax} -% Compare two numbers. It is recommended to use "\intexpr_eval:n" to +% Compare two numbers. It is recommended to use "\int_eval:n" to % correctly evaluate and terminate these numbers. <rel> is one of % "<", "=" or ">" with catcode 12. % \begin{texnote} @@ -266,7 +266,7 @@ % <default> "\fi:" % \end{syntax} % Chooses case <number>. If you wish to use negative numbers as well, -% you can offset them with "\intexpr_eval:n". +% you can offset them with "\int_eval:n". % \begin{texnote} % These are the \TeX{} primitives \tn{ifcase} and \tn{or}. % \end{texnote} @@ -374,7 +374,7 @@ % Assigning values to \m{num} registers. % \begin{macrocode} \cs_new_protected_nopar:Npn \num_set:Nn #1#2{ - \tl_set:No #1{ \tex_number:D \intexpr_eval:n {#2} } + \tl_set:No #1{ \tex_number:D \int_eval:n {#2} } } \cs_generate_variant:Nn\num_set:Nn {c} % \end{macrocode} @@ -421,7 +421,7 @@ % \begin{macro}{\num_gadd:Nn} % \begin{macro}{\num_gadd:cn} % Adding is easily done as the second argument goes through -% |\intexpr_eval:n|. +% |\int_eval:n|. % \begin{macrocode} \cs_new_protected_nopar:Npn \num_add:Nn #1#2 {\num_set:Nn #1{#1+#2}} \cs_generate_variant:Nn\num_add:Nn {c} diff --git a/Master/texmf-dist/source/latex/expl3/l3prg.dtx b/Master/texmf-dist/source/latex/expl3/l3prg.dtx index 09e841f9543..e61fc3eeb8f 100644 --- a/Master/texmf-dist/source/latex/expl3/l3prg.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3prg.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3prg.dtx 2043 2010-09-22 02:10:43Z will $ +\GetIdInfo$Id: l3prg.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental control structures} %\iffalse %<*driver> @@ -276,13 +276,13 @@ % addition to this, parentheses can be used to isolate % sub-expressions. For example, % \begin{verbatim} -% \intexpr_compare_p:n {1=1} && +% \int_compare_p:n {1=1} && % ( -% \intexpr_compare_p:n {2=3} || -% \intexpr_compare_p:n {4=4} || -% \intexpr_compare_p:n {1=\error} % is skipped +% \int_compare_p:n {2=3} || +% \int_compare_p:n {4=4} || +% \int_compare_p:n {1=\error} % is skipped % ) && -% !(\intexpr_compare_p:n {2=4}) +% !(\int_compare_p:n {2=4}) % \end{verbatim} % is a valid boolean expression. Note that minimal evaluation is % carried out whenever possible so that whenever a truth value cannot @@ -304,13 +304,13 @@ % either negate a single expression or a group. Hence % \begin{verbatim} % \bool_if_p:n{ -% \intexpr_compare_p:n {1=1} && +% \int_compare_p:n {1=1} && % ( -% \intexpr_compare_p:n {2=3} || -% \intexpr_compare_p:n {4=4} || -% \intexpr_compare_p:n {1=\error} % is skipped +% \int_compare_p:n {2=3} || +% \int_compare_p:n {4=4} || +% \int_compare_p:n {1=\error} % is skipped % ) && -% !(\intexpr_compare_p:n {2=4}) +% !(\int_compare_p:n {2=4}) % } % \end{verbatim} % from above returns \meta{true}. @@ -586,7 +586,7 @@ % |\prg_quicksort:n|. As an example we could define % \begin{quote} % |\cs_set_nopar:Npn\prg_quicksort_function:n #1{{#1}}|\\ -% |\cs_set_nopar:Npn\prg_quicksort_compare:nnTF #1#2#3#4 {\intexpr_compare:nNnTF{#1}>{#2}}| +% |\cs_set_nopar:Npn\prg_quicksort_compare:nnTF #1#2#3#4 {\int_compare:nNnTF{#1}>{#2}}| % \end{quote} % Then the function call % \begin{quote} @@ -597,7 +597,7 @@ % be defined as % \begin{quote} % |\cs_set_nopar:Npn\prg_quicksort_compare:nnTF #1#2 {|\\ -% | \intexpr_compare:nNnTF{\tl_compare:nn{#1}{#2}}>\c_zero }| +% | \int_compare:nNnTF{\tl_compare:nn{#1}{#2}}>\c_zero }| % \end{quote} % % \end{function} @@ -824,11 +824,11 @@ % char node or a ligature node. % \begin{macrocode} \cs_new_nopar:Npn \scan_align_safe_stop: { - \intexpr_compare:nNnT \etex_currentgrouptype:D = \c_six + \int_compare:nNnT \etex_currentgrouptype:D = \c_six { - \intexpr_compare:nNnF \etex_lastnodetype:D = \c_zero + \int_compare:nNnF \etex_lastnodetype:D = \c_zero { - \intexpr_compare:nNnF \etex_lastnodetype:D = \c_seven + \int_compare:nNnF \etex_lastnodetype:D = \c_seven \scan_stop: } } @@ -872,7 +872,7 @@ \cs_new_nopar:Npn \prg_replicate:nn #1{ \cs:w prg_do_nothing: \exp_after:wN\prg_replicate_first_aux:N - \tex_romannumeral:D -`\q \intexpr_eval:n{#1} \cs_end: + \tex_romannumeral:D -`\q \int_eval:n{#1} \cs_end: \cs_end: } \cs_new_nopar:Npn \prg_replicate_aux:N#1{ @@ -935,26 +935,26 @@ % add the step to |#1| and try again with this new value of |#1|. % \begin{macrocode} \cs_new:Npn \prg_stepwise_function:nnnN #1#2{ - \intexpr_compare:nNnTF{#2}<\c_zero + \int_compare:nNnTF{#2}<\c_zero {\exp_args:Nf\prg_stepwise_function_decr:nnnN } {\exp_args:Nf\prg_stepwise_function_incr:nnnN } - {\intexpr_eval:n{#1}}{#2} + {\int_eval:n{#1}}{#2} } \cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4{ - \intexpr_compare:nNnF {#1}>{#3} + \int_compare:nNnF {#1}>{#3} { #4{#1} \exp_args:Nf \prg_stepwise_function_incr:nnnN - {\intexpr_eval:n{#1 + #2}} + {\int_eval:n{#1 + #2}} {#2}{#3}{#4} } } \cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4{ - \intexpr_compare:nNnF {#1}<{#3} + \int_compare:nNnF {#1}<{#3} { #4{#1} \exp_args:Nf \prg_stepwise_function_decr:nnnN - {\intexpr_eval:n{#1 + #2}} + {\int_eval:n{#1 + #2}} {#2}{#3}{#4} } } @@ -976,27 +976,27 @@ \cs_new_protected:Npn\prg_stepwise_inline:nnnn #1#2#3#4{ \int_gincr:N \g_prg_inline_level_int \cs_gset_nopar:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4} - \intexpr_compare:nNnTF {#2}<\c_zero + \int_compare:nNnTF {#2}<\c_zero {\exp_args:Ncf \prg_stepwise_inline_decr:Nnnn } {\exp_args:Ncf \prg_stepwise_inline_incr:Nnnn } {prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n} - {\intexpr_eval:n{#1}} {#2} {#3} + {\int_eval:n{#1}} {#2} {#3} \int_gdecr:N \g_prg_inline_level_int } \cs_new:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4{ - \intexpr_compare:nNnF {#2}>{#4} + \int_compare:nNnF {#2}>{#4} { #1{#2} \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1 - {\intexpr_eval:n{#2 + #3}} {#3}{#4} + {\int_eval:n{#2 + #3}} {#3}{#4} } } \cs_new:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4{ - \intexpr_compare:nNnF {#2}<{#4} + \int_compare:nNnF {#2}<{#4} { #1{#2} \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1 - {\intexpr_eval:n{#2 + #3}} {#3}{#4} + {\int_eval:n{#2 + #3}} {#3}{#4} } } % \end{macrocode} @@ -1011,25 +1011,25 @@ % |#5|. % \begin{macrocode} \cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2 { - \intexpr_compare:nNnTF {#2}<\c_zero + \int_compare:nNnTF {#2}<\c_zero {\exp_args:Nf\prg_stepwise_variable_decr:nnnNn} {\exp_args:Nf\prg_stepwise_variable_incr:nnnNn} - {\intexpr_eval:n{#1}}{#2} + {\int_eval:n{#1}}{#2} } \cs_new_protected:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 { - \intexpr_compare:nNnF {#1}>{#3} + \int_compare:nNnF {#1}>{#3} { \cs_set_nopar:Npn #4{#1} #5 \exp_args:Nf \prg_stepwise_variable_incr:nnnNn - {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} + {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } \cs_new_protected:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 { - \intexpr_compare:nNnF {#1}<{#3} + \int_compare:nNnF {#1}<{#3} { \cs_set_nopar:Npn #4{#1} #5 \exp_args:Nf \prg_stepwise_variable_decr:nnnNn - {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} + {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } % \end{macrocode} @@ -1565,7 +1565,7 @@ % return false, otherwise return true. % \begin{macrocode} \cs_new:Npn \bool_xor_p:nn #1#2 { - \intexpr_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }} + \int_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }} {\c_false_bool}{\c_true_bool} } % \end{macrocode} @@ -1621,7 +1621,7 @@ % We will be parsing on |#1| for each step so we might as well % evaluate it first in case it is complicated. % \begin{macrocode} - \exp_args:Nf \prg_case_int_aux:nnn { \intexpr_eval:n{#1}} #2 + \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n{#1}} #2 % \end{macrocode} % The \texttt{?} below is just so there are enough arguments when we % reach the end. And it made you look.~\texttt{;-)} @@ -1636,7 +1636,7 @@ % \end{macrocode} % Otherwise we compare (which evaluates |#2| for us) % \begin{macrocode} - \intexpr_compare:nNnTF{#1}={#2} + \int_compare:nNnTF{#1}={#2} % \end{macrocode} % If true, we want to remove the remainder of the list, the else case % and then execute the code specified. |\prg_end_case:nw {#3}| does diff --git a/Master/texmf-dist/source/latex/expl3/l3skip.dtx b/Master/texmf-dist/source/latex/expl3/l3skip.dtx index af3a37564be..87174998097 100644 --- a/Master/texmf-dist/source/latex/expl3/l3skip.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3skip.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3skip.dtx 2047 2010-09-23 09:27:30Z will $ +\GetIdInfo$Id: l3skip.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental skip registers} %\iffalse %<*driver> @@ -835,8 +835,8 @@ % \begin{macrocode} \prg_new_conditional:Nnn \skip_if_infinite_glue:n {p,TF,T,F} { \bool_if:nTF { - \intexpr_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || - \intexpr_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero + \int_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || + \int_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero } {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1034,10 +1034,13 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\if_dim:w} -% The comparison primitive. +% \begin{macro}{\if_dim:w,\dim_value:w,\dim_eval:w,\dim_eval_end:} +% Primitives. % \begin{macrocode} \cs_new_eq:NN \if_dim:w \tex_ifdim:D +\cs_set_eq:NN \dim_value:w \tex_number:D +\cs_set_eq:NN \dim_eval:w \etex_dimexpr:D +\cs_set_protected:Npn \dim_eval_end: {\tex_relax:D} % \end{macrocode} % \end{macro} % @@ -1055,15 +1058,7 @@ % % \begin{macro}{\dim_compare_p:n} % \begin{macro}[TF]{\dim_compare:n} -% [This code plus comments lifted directly from the |\intexpr_compare:nTF| function.] -% Some things we need for the code below. -% TODO: normalise names and things. -% \begin{macrocode} -\cs_set_eq:NN \dim_value:w \tex_number:D -\cs_set_eq:NN \dim_eval:w \etex_dimexpr:D -\cs_set_eq:NN \if_dim_compare:w \if_dim:w -\cs_set_eq:NN \dim_eval_end: \scan_stop: -% \end{macrocode} +% [This code plus comments lifted directly from the |\int_compare:nTF| function.] % Comparison tests using a simple syntax where only one set of braces % is required and additional operators such as "!=" and ">=" are % supported. First some notes on the idea behind this. We wish to @@ -1115,7 +1110,7 @@ % Equality is easy: % \begin{macrocode} \cs_new:cpn {dim_compare_=:w} #1 = #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -1123,25 +1118,25 @@ % parameter text. % \begin{macrocode} \cs_new:cpn {dim_compare_==:w} #1 == #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} % Not equal is just about reversing the truth value. % \begin{macrocode} \cs_new:cpn {dim_compare_!=:w} #1 != #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } % \end{macrocode} % Less than and greater than are also straight forward. % \begin{macrocode} \cs_new:cpn {dim_compare_<:w} #1 < #2 \q_stop { - \if_dim_compare:w #1 sp < \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:cpn {dim_compare_>:w} #1 > #2 \q_stop { - \if_dim_compare:w #1 sp > \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -1149,11 +1144,11 @@ % than operation. Vice versa for less than or equal. % \begin{macrocode} \cs_new:cpn {dim_compare_<=:w} #1 <= #2 \q_stop { - \if_dim_compare:w #1 sp > \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } \cs_new:cpn {dim_compare_>=:w} #1 >= #2 \q_stop { - \if_dim_compare:w #1 sp < \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3tl.dtx b/Master/texmf-dist/source/latex/expl3/l3tl.dtx index c7c84a531ae..585d50eb9bc 100644 --- a/Master/texmf-dist/source/latex/expl3/l3tl.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3tl.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3tl.dtx 2040 2010-09-21 18:11:09Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental Token Lists} %\iffalse %<*driver> @@ -1673,13 +1673,13 @@ % The "0" to ensure it works on an empty list. % \begin{macrocode} \cs_new:Npn \tl_elt_count:n #1{ - \intexpr_eval:n { + \int_eval:n { 0 \tl_map_function:nN {#1} \tl_elt_count_aux:n } } \cs_generate_variant:Nn \tl_elt_count:n {V,o} \cs_new_nopar:Npn \tl_elt_count:N #1{ - \intexpr_eval:n { + \int_eval:n { 0 \tl_map_function:NN #1 \tl_elt_count_aux:n } } diff --git a/Master/texmf-dist/source/latex/expl3/l3token.dtx b/Master/texmf-dist/source/latex/expl3/l3token.dtx index fa1767465d4..81e70af0bcf 100644 --- a/Master/texmf-dist/source/latex/expl3/l3token.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3token.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3token.dtx 2029 2010-09-19 13:59:02Z joseph $ +\GetIdInfo$Id: l3token.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental token investigation and manipulation} %\iffalse %<*driver> @@ -774,17 +774,17 @@ % \begin{macrocode} \cs_new_eq:NN \char_set_catcode:w \tex_catcode:D \cs_new_protected_nopar:Npn \char_set_catcode:nn #1#2 { - \char_set_catcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_catcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_catcode:w { \int_use:N \tex_catcode:D } \cs_new_nopar:Npn \char_value_catcode:n #1 { - \char_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_catcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_catcode:w { \tex_showthe:D \tex_catcode:D } \cs_new_nopar:Npn \char_show_value_catcode:n #1 { - \char_show_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_catcode:w \int_eval:w #1\int_eval_end: } % \end{macrocode} % \end{macro} @@ -857,19 +857,19 @@ % \begin{macrocode} \cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D \cs_new_protected_nopar:Npn \char_set_mathcode:nn #1#2 { - \char_set_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_mathcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_protected_nopar:Npn \char_gset_mathcode:w { \pref_global:D \tex_mathcode:D } \cs_new_protected_nopar:Npn \char_gset_mathcode:nn #1#2 { - \char_gset_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_gset_mathcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_mathcode:w { \int_use:N \tex_mathcode:D } \cs_new_nopar:Npn \char_value_mathcode:n #1 { - \char_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_mathcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_mathcode:w { \tex_showthe:D \tex_mathcode:D } \cs_new_nopar:Npn \char_show_value_mathcode:n #1 { - \char_show_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_mathcode:w \int_eval:w #1\int_eval_end: } % \end{macrocode} % \end{macro} @@ -880,14 +880,14 @@ % \begin{macrocode} \cs_new_eq:NN \char_set_lccode:w \tex_lccode:D \cs_new_protected_nopar:Npn \char_set_lccode:nn #1#2{ - \char_set_lccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_lccode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_lccode:w {\int_use:N\tex_lccode:D} \cs_new_nopar:Npn \char_value_lccode:n #1{\char_value_lccode:w - \intexpr_eval:w #1\intexpr_eval_end:} + \int_eval:w #1\int_eval_end:} \cs_new_nopar:Npn \char_show_value_lccode:w {\tex_showthe:D\tex_lccode:D} \cs_new_nopar:Npn \char_show_value_lccode:n #1{ - \char_show_value_lccode:w \intexpr_eval:w #1\intexpr_eval_end:} + \char_show_value_lccode:w \int_eval:w #1\int_eval_end:} % \end{macrocode} % \end{macro} % @@ -897,14 +897,14 @@ % \begin{macrocode} \cs_new_eq:NN \char_set_uccode:w \tex_uccode:D \cs_new_protected_nopar:Npn \char_set_uccode:nn #1#2{ - \char_set_uccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_uccode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_uccode:w {\int_use:N\tex_uccode:D} \cs_new_nopar:Npn \char_value_uccode:n #1{\char_value_uccode:w - \intexpr_eval:w #1\intexpr_eval_end:} + \int_eval:w #1\int_eval_end:} \cs_new_nopar:Npn \char_show_value_uccode:w {\tex_showthe:D\tex_uccode:D} \cs_new_nopar:Npn \char_show_value_uccode:n #1{ - \char_show_value_uccode:w \intexpr_eval:w #1\intexpr_eval_end:} + \char_show_value_uccode:w \int_eval:w #1\int_eval_end:} % \end{macrocode} % \end{macro} % @@ -914,15 +914,15 @@ % \begin{macrocode} \cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D \cs_new_protected_nopar:Npn \char_set_sfcode:nn #1#2 { - \char_set_sfcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_sfcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_sfcode:w { \int_use:N \tex_sfcode:D } \cs_new_nopar:Npn \char_value_sfcode:n #1 { - \char_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_sfcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_sfcode:w { \tex_showthe:D \tex_sfcode:D } \cs_new_nopar:Npn \char_show_value_sfcode:n #1 { - \char_show_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_sfcode:w \int_eval:w #1\int_eval_end: } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/tex/latex/expl3/expl3.sty b/Master/texmf-dist/tex/latex/expl3/expl3.sty index 1c4c346d8a7..3a14c072444 100644 --- a/Master/texmf-dist/tex/latex/expl3/expl3.sty +++ b/Master/texmf-dist/tex/latex/expl3/expl3.sty @@ -49,7 +49,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: expl3.dtx 2022 2010-09-16 13:00:35Z joseph $ +\GetIdInfo$Id: expl3.dtx 2056 2010-10-02 17:31:05Z will $ {L3 Experimental code bundle wrapper}% \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -68,11 +68,10 @@ l3basics, l3expan, l3tl, - l3intexpr, + l3int, l3quark, l3seq, l3toks, - l3int, l3prg, l3clist, l3token, diff --git a/Master/texmf-dist/tex/latex/expl3/l3basics.sty b/Master/texmf-dist/tex/latex/expl3/l3basics.sty index d128e2fa1f3..1c0e8c5243b 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3basics.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3basics.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental basic definitions} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -410,9 +410,8 @@ \cs_set_protected_nopar:Npn \chk_if_free_cs:N #1{ \cs_if_free:NF #1 { - \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~ - already~defined!~ - Current~meaning:~\token_to_meaning:N #1 + \msg_kernel_bug:x {Command~name~`\token_to_str:N #1'~already~defined!~ + Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1 } } \cs_record_meaning:N#1 @@ -428,9 +427,8 @@ { \msg_kernel_bug:x { - Command~name~`\token_to_str:N #1'~ - already~defined!~ - Current~meaning:~\token_to_meaning:N #1 + Command~name~`\token_to_str:N #1'~already~defined!~ + Current~meaning: \\ \c_space_tl \c_space_tl \token_to_meaning:N #1 } } } diff --git a/Master/texmf-dist/tex/latex/expl3/l3clist.sty b/Master/texmf-dist/tex/latex/expl3/l3clist.sty index 257c7209ba8..2e40898a0dc 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3clist.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3clist.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2037 2010-09-20 21:22:45Z joseph $ +\GetIdInfo$Id: l3clist.dtx 2071 2010-10-09 09:48:48Z joseph $ {L3 Experimental comma separated lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} diff --git a/Master/texmf-dist/tex/latex/expl3/l3int.sty b/Master/texmf-dist/tex/latex/expl3/l3int.sty index 44c910a145c..230ff5aed01 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3int.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3int.sty @@ -48,26 +48,47 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2029 2010-09-19 13:59:02Z joseph $ +\GetIdInfo$Id: l3int.dtx 2070 2010-10-09 06:55:11Z joseph $ {L3 Experimental Integer module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: +\cs_set_eq:NN \int_value:w \tex_number:D +\cs_set_eq:NN \int_eval:w \etex_numexpr:D +\cs_set_protected:Npn \int_eval_end: {\tex_relax:D} +\cs_set_eq:NN \if_int_compare:w \tex_ifnum:D +\cs_new_eq:NN \if_num:w \tex_ifnum:D +\cs_set_eq:NN \if_int_odd:w \tex_ifodd:D +\cs_new_eq:NN \if_case:w \tex_ifcase:D \cs_new_eq:NN \int_to_roman:w \tex_romannumeral:D -\cs_new_eq:NN \int_to_number:w \tex_number:D \cs_new_eq:NN \int_advance:w \tex_advance:D +\cs_set:Npn \int_eval:n #1{ + \int_value:w \int_eval:w #1\int_eval_end: +} \cs_new_protected_nopar:Npn \int_new:N #1 { \chk_if_free_cs:N #1 \newcount #1 } \cs_generate_variant:Nn \int_new:N {c} -\cs_new_protected_nopar:Npn \int_set:Nn #1#2{#1 \intexpr_eval:w #2\intexpr_eval_end: +\cs_new_protected_nopar:Npn \int_set:Nn #1#2{#1 \int_eval:w #2\int_eval_end: } \cs_new_protected_nopar:Npn \int_gset:Nn { \pref_global:D \int_set:Nn } \cs_generate_variant:Nn\int_set:Nn {cn} \cs_generate_variant:Nn\int_gset:Nn {cn} +\cs_new_protected_nopar:Npn \int_set_eq:NN #1#2 { + \int_set:Nn #1 {#2} +} +\cs_generate_variant:Nn \int_set_eq:NN { c } +\cs_generate_variant:Nn \int_set_eq:NN { Nc } +\cs_generate_variant:Nn \int_set_eq:NN { cc } +\cs_new_protected_nopar:Npn \int_gset_eq:NN #1#2 { + \int_gset:Nn #1 {#2} +} +\cs_generate_variant:Nn \int_gset_eq:NN { c } +\cs_generate_variant:Nn \int_gset_eq:NN { Nc } +\cs_generate_variant:Nn \int_gset_eq:NN { cc } \cs_new_protected_nopar:Npn \int_incr:N #1{\int_advance:w#1\c_one } \cs_new_protected_nopar:Npn \int_decr:N #1{\int_advance:w#1\c_minus_one @@ -91,10 +112,10 @@ \cs_new_protected_nopar:Npn \int_gzero:N #1 {\pref_global:D #1=\c_zero} \cs_generate_variant:Nn \int_gzero:N {c} \cs_new_protected_nopar:Npn \int_add:Nn #1#2{ - \int_advance:w #1 by \intexpr_eval:w #2\intexpr_eval_end: + \int_advance:w #1 by \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \int_sub:Nn #1#2{ - \int_advance:w #1-\intexpr_eval:w #2\intexpr_eval_end: + \int_advance:w #1-\int_eval:w #2\int_eval_end: } \cs_new_protected_nopar:Npn \int_gadd:Nn { \pref_global:D @@ -110,7 +131,7 @@ \cs_new_nopar:Npn \int_use:c #1{\int_use:N \cs:w#1\cs_end:} \cs_new_eq:NN \int_show:N \kernel_register_show:N \cs_new_eq:NN \int_show:c \kernel_register_show:c -\cs_new_nopar:Npn \int_to_arabic:n #1{ \intexpr_eval:n{#1}} +\cs_new_nopar:Npn \int_to_arabic:n #1{ \int_eval:n{#1}} \cs_new_protected_nopar:Npn \int_roman_lcuc_mapping:Nnn #1#2#3{ \cs_set_nopar:cpn {int_to_lc_roman_#1:}{#2} \cs_set_nopar:cpn {int_to_uc_roman_#1:}{#3} @@ -125,51 +146,98 @@ \int_roman_lcuc_mapping:Nnn Q \use_none:nn \use_none:nn \cs_new_nopar:Npn \int_to_roman:n #1 { \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN l - \int_to_roman:w \intexpr_eval:n {#1} Q + \int_to_roman:w \int_eval:n {#1} Q } \cs_new_nopar:Npn \int_to_Roman:n #1 { \exp_after:wN \int_to_roman_lcuc:NN \exp_after:wN u - \int_to_roman:w \intexpr_eval:n {#1} Q + \int_to_roman:w \int_eval:n {#1} Q } \cs_new_nopar:Npn \int_to_roman_lcuc:NN #1#2{ \use:c {int_to_#1c_roman_#2:} \int_to_roman_lcuc:NN #1 } +\cs_new_nopar:Npn \int_convert_to_symbols:nnn #1#2#3 { + \int_compare:nNnTF {#1} > {#2} + { + \exp_args:Nf \int_convert_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:Nf \prg_case_int:nnn { \int_eval:n {#1} } {#3} { } } +} \cs_set_nopar:Npn \int_convert_number_with_rule:nnN #1#2#3{ - \intexpr_compare:nNnTF {#1}>{#2} + \int_compare:nNnTF {#1}>{#2} { \exp_args:Nf \int_convert_number_with_rule:nnN - { \intexpr_div_truncate:nn {#1-1}{#2} }{#2} + { \int_div_truncate:nn {#1-1}{#2} }{#2} #3 - \exp_args:Nf #3 { \intexpr_eval:n{1+\intexpr_mod:nn {#1-1}{#2}} } + \exp_args:Nf #3 { \int_eval:n{1+\int_mod:nn {#1-1}{#2}} } } - { \exp_args:Nf #3{ \intexpr_eval:n{#1} } } + { \exp_args:Nf #3{ \int_eval:n{#1} } } } -\cs_new_nopar:Npn \int_alph_default_conversion_rule:n #1{ - \if_case:w #1 - \or: a\or: b\or: c\or: d\or: e\or: f - \or: g\or: h\or: i\or: j\or: k\or: l - \or: m\or: n\or: o\or: p\or: q\or: r - \or: s\or: t\or: u\or: v\or: w\or: x - \or: y\or: z - \fi: -} -\cs_new_nopar:Npn \int_Alph_default_conversion_rule:n #1{ - \if_case:w #1 - \or: A\or: B\or: C\or: D\or: E\or: F - \or: G\or: H\or: I\or: J\or: K\or: L - \or: M\or: N\or: O\or: P\or: Q\or: R - \or: S\or: T\or: U\or: V\or: W\or: X - \or: Y\or: Z - \fi: -} -\cs_new_nopar:Npn \int_to_alph:n #1{ - \int_convert_number_with_rule:nnN {#1}{26} - \int_alph_default_conversion_rule:n +\cs_new_nopar:Npn \int_to_alph:n #1 { + \int_convert_to_symbols:nnn {#1} { 26 } + { + { 1 } { a } + { 2 } { b } + { 3 } { c } + { 4 } { d } + { 5 } { e } + { 6 } { f } + { 7 } { g } + { 8 } { h } + { 9 } { i } + { 10 } { j } + { 11 } { k } + { 12 } { l } + { 13 } { m } + { 14 } { n } + { 15 } { o } + { 16 } { p } + { 17 } { q } + { 18 } { r } + { 19 } { s } + { 20 } { t } + { 21 } { u } + { 22 } { v } + { 23 } { w } + { 24 } { x } + { 25 } { y } + { 26 } { z } + } } -\cs_new_nopar:Npn \int_to_Alph:n #1{ - \int_convert_number_with_rule:nnN {#1}{26} - \int_Alph_default_conversion_rule:n +\cs_new_nopar:Npn \int_to_Alph:n #1 { + \int_convert_to_symbols:nnn {#1} { 26 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } } \cs_new_nopar:Npn \int_to_symbol:n #1{ \mode_if_math:TF @@ -214,21 +282,390 @@ \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int \cs_set_nopar:Npn \int_pre_eval_one_arg:Nn #1#2{ - \exp_args:Nf#1{\intexpr_eval:n{#2}}} + \exp_args:Nf#1{\int_eval:n{#2}}} \cs_set_nopar:Npn \int_pre_eval_two_args:Nnn #1#2#3{ - \exp_args:Nff#1{\intexpr_eval:n{#2}}{\intexpr_eval:n{#3}} + \exp_args:Nff#1{\int_eval:n{#2}}{\int_eval:n{#3}} +} +\cs_new_nopar:Npn \int_from_roman:n #1 { + \tl_if_blank:nF {#1} + { + \tex_expandafter:D \int_from_roman_end:w + \tex_number:D \etex_numexpr:D + \int_from_roman_aux:NN #1 Q \q_stop + } +} +\cs_new_nopar:Npn \int_from_roman_aux:NN #1#2 { + \str_if_eq:nnTF {#1} { Q } + {#1#2} + { + \str_if_eq:nnTF {#2} { Q } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + + + \use:c { c_int_from_roman_ #1 _int } + #2 + } + { + \cs_if_exist:cF { c_int_from_roman_ #1 _int } + { \int_from_roman_clean_up:w } + \cs_if_exist:cF { c_int_from_roman_ #2 _int } + { \int_from_roman_clean_up:w } + \int_compare:nNnTF + { \use:c { c_int_from_roman_ #1 _int } } + < + { \use:c { c_int_from_roman_ #2 _int } } + { + + \use:c { c_int_from_roman_ #2 _int } + - \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN + } + { + + \use:c { c_int_from_roman_ #1 _int } + \int_from_roman_aux:NN #2 + } + } + } +} +\cs_new_nopar:Npn \int_from_roman_end:w #1 Q #2 \q_stop { + \tl_if_empty:nTF {#2} {#1} {#2} +} +\cs_new_nopar:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 } +\cs_new:Npn \int_convert_from_base_ten:nn #1#2 { + \int_compare:nNnTF {#1} < { 0 } + { + - + \exp_args:Nnf \int_convert_from_base_ten_aux:nnn + { } { \int_eval:n { 0 - ( #1 ) } } {#2} + } + { + \exp_args:Nnf \int_convert_from_base_ten_aux:nnn + { } { \int_eval:n {#1} } {#2} + } +} +\cs_new:Npn \int_convert_from_base_ten_aux:nnn #1#2#3 { + \int_compare:nNnTF {#2} < {#3} + { + \int_convert_number_to_letter:n {#2} + #1 + } + { + \exp_args:Nff \int_convert_from_base_ten_aux:nnn + { + \int_convert_number_to_letter:n + { \int_mod:nn {#2} {#3} } + #1 + } + { \int_div_truncate:nn {#2} {#3} } + {#3} + } +} +\cs_new:Npn \int_convert_number_to_letter:n #1 { + \prg_case_int:nnn { #1 - 9 } + { + { 1 } { A } + { 2 } { B } + { 3 } { C } + { 4 } { D } + { 5 } { E } + { 6 } { F } + { 7 } { G } + { 8 } { H } + { 9 } { I } + { 10 } { J } + { 11 } { K } + { 12 } { L } + { 13 } { M } + { 14 } { N } + { 15 } { O } + { 16 } { P } + { 17 } { Q } + { 18 } { R } + { 19 } { S } + { 20 } { T } + { 21 } { U } + { 22 } { V } + { 23 } { W } + { 24 } { X } + { 25 } { Y } + { 26 } { Z } + } + {#1} +} +\cs_new:Npn \int_convert_to_base_ten:nn #1#2 { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_convert_to_base_ten_aux:nn + { \int_get_digits:n {#1} } {#2} + } +} +\cs_new:Npn \int_convert_to_base_ten_aux:nn #1#2 { + \int_convert_to_base_ten_aux:nnN { 0 } { #2 } #1 \q_nil +} +\cs_new:Npn \int_convert_to_base_ten_aux:nnN #1#2#3 { + \quark_if_nil:NTF #3 + {#1} + { + \exp_args:Nf \int_convert_to_base_ten_aux:nnN + { \int_eval:n { #1 * #2 + \int_convert_to_base_ten_aux:N #3 } } + {#2} + } +} +\cs_new:Npn \int_convert_to_base_ten_aux:N #1 { + \int_compare:nNnTF { `#1 } < { 58 } + {#1} + { + \int_eval:n + { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } } + } +} +\cs_new:Npn \int_get_sign_and_digits:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_true_bool \c_true_bool +} +\cs_new:Npn \int_get_sign:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_true_bool \c_false_bool +} +\cs_new:Npn \int_get_digits:n #1 { + \int_get_sign_and_digits_aux:nNNN {#1} + \c_true_bool \c_false_bool \c_true_bool +} +\cs_new:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4 { + \tl_if_head_eq_charcode:fNTF {#1} - + { + \bool_if:NTF #2 + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_false_bool #3#4 + } + { + \int_get_sign_and_digits_aux:oNNN + { \use_none:n #1 } \c_true_bool #3#4 + } + } + { + \tl_if_head_eq_charcode:fNTF {#1} + + { \int_get_sign_and_digits_aux:oNNN { \use_none:n #1 } #2#3#4 } + { + \bool_if:NT #3 { \bool_if:NF #2 - } + \bool_if:NT #4 {#1} + } + } +} +\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN { o } +\cs_new:Npn \int_from_binary:n #1 { + \int_convert_to_base_ten:nn {#1} { 2 } +} +\cs_new:Npn \int_from_hexadecimal:n #1 { + \int_convert_to_base_ten:nn {#1} { 16 } +} +\cs_new:Npn \int_from_octal:n #1 { + \int_convert_to_base_ten:nn {#1} { 8 } +} +\cs_new:Npn \int_to_binary:n #1 { + \int_convert_from_base_ten:nn {#1} { 2 } +} +\cs_new:Npn \int_to_hexadecimal:n #1 { + \int_convert_from_base_ten:nn {#1} { 16 } } +\cs_new:Npn \int_to_octal:n #1 { + \int_convert_from_base_ten:nn {#1} { 8 } +} +\cs_new:Npn \int_from_alph:n #1 { + \int_eval:n + { + \int_get_sign:n {#1} + \exp_args:Nf \int_from_alph_aux:n + { \int_get_digits:n {#1} } + } +} +\cs_new:Npn \int_from_alph_aux:n #1 { + \int_from_alph_aux:nN { 0 } #1 \q_nil +} +\cs_new:Npn \int_from_alph_aux:nN #1#2 { + \quark_if_nil:NTF #2 + {#1} + { + \exp_args:Nf \int_from_alph_aux:nN + { \int_eval:n { #1 * 26 + \int_from_alph_aux:N #2 } } + } +} +\cs_new:Npn \int_from_alph_aux:N #1 { + \int_eval:n + { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } } +} +\prg_set_conditional:Npnn \int_compare:n #1{p,TF,T,F}{ + \exp_after:wN \int_compare_auxi:w \int_value:w + \int_eval:w #1\q_stop +} +\cs_set:Npn \int_compare_auxi:w #1#2\q_stop{ + \exp_after:wN \int_compare_auxii:w \tex_romannumeral:D + \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop +} +\cs_set:Npn \int_compare_auxii:w #1#2#3\q_mark{ + \use:c{ + int_compare_ + #1 \if_meaning:w =#2 = \fi: + :w} +} +\cs_set:cpn {int_compare_=:w} #1=#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {int_compare_==:w} #1==#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {int_compare_!=:w} #1!=#2\q_stop{ + \if_int_compare:w #1=\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:cpn {int_compare_<:w} #1<#2\q_stop{ + \if_int_compare:w #1<\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {int_compare_>:w} #1>#2\q_stop{ + \if_int_compare:w #1>\int_eval:w #2 \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set:cpn {int_compare_<=:w} #1<=#2\q_stop{ + \if_int_compare:w #1>\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:cpn {int_compare_>=:w} #1>=#2\q_stop{ + \if_int_compare:w #1<\int_eval:w #2 \int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\prg_set_conditional:Npnn \int_compare:nNn #1#2#3{p}{ + \if_int_compare:w \int_eval:w #1 #2 \int_eval:w #3 + \int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\cs_set_nopar:Npn \int_compare:nNnT #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use:n + \tex_else:D + \tex_expandafter:D \use_none:n + \tex_fi:D +} +\cs_set_nopar:Npn \int_compare:nNnF #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use_none:n + \tex_else:D + \tex_expandafter:D \use:n + \tex_fi:D +} +\cs_set_nopar:Npn \int_compare:nNnTF #1#2#3 { + \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: + \tex_expandafter:D \use_i:nn + \tex_else:D + \tex_expandafter:D \use_ii:nn + \tex_fi:D +} +\cs_set:Npn \int_abs:n #1{ + \int_value:w + \if_int_compare:w \int_eval:w #1<\c_zero + - + \fi: + \int_eval:w #1\int_eval_end: +} +\cs_set:Npn \int_max:nn #1#2{ + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1>\int_eval:w #2\int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: +} +\cs_set:Npn \int_min:nn #1#2{ + \int_value:w \int_eval:w + \if_int_compare:w + \int_eval:w #1<\int_eval:w #2\int_eval_end: + #1 + \else: + #2 + \fi: + \int_eval_end: +} +\cs_set:Npn \int_div_truncate:nn #1#2 { + \int_value:w \int_eval:w + \if_int_compare:w \int_eval:w #1 = \c_zero + 0 + \else: + (#1 + \if_int_compare:w \int_eval:w #1 < \c_zero + \if_int_compare:w \int_eval:w #2 < \c_zero + -( #2 + + \else: + +( #2 - + \fi: + \else: + \if_int_compare:w \int_eval:w #2 < \c_zero + +( #2 + + \else: + -( #2 - + \fi: + \fi: + 1)/2) + \fi: + /(#2) + \int_eval_end: +} +\cs_set:Npn \int_div_round:nn #1#2 {\int_eval:n{(#1)/(#2)}} +\cs_set:Npn \int_mod:nn #1#2 { + \int_value:w + \int_eval:w + #1 - \int_div_truncate:nn {#1}{#2} * (#2) + \int_eval_end: +} +\prg_set_conditional:Npnn \int_if_odd:n #1 {p,TF,T,F} { + \if_int_odd:w \int_eval:w #1\int_eval_end: + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \int_if_even:n #1 {p,TF,T,F} { + \if_int_odd:w \int_eval:w #1\int_eval_end: + \prg_return_false: \else: \prg_return_true: \fi: +} +\cs_set:Npn \int_while_do:nn #1#2{ + \int_compare:nT {#1}{#2 \int_while_do:nn {#1}{#2}} +} +\cs_set:Npn \int_until_do:nn #1#2{ + \int_compare:nF {#1}{#2 \int_until_do:nn {#1}{#2}} +} +\cs_set:Npn \int_do_while:nn #1#2{ + #2 \int_compare:nT {#1}{\int_do_while:nNnn {#1}{#2}} +} +\cs_set:Npn \int_do_until:nn #1#2{ + #2 \int_compare:nF {#1}{\int_do_until:nn {#1}{#2}} +} +\cs_set:Npn \int_while_do:nNnn #1#2#3#4{ + \int_compare:nNnT {#1}#2{#3}{#4 \int_while_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_until_do:nNnn #1#2#3#4{ + \int_compare:nNnF {#1}#2{#3}{#4 \int_until_do:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_do_while:nNnn #1#2#3#4{ + #4 \int_compare:nNnT {#1}#2{#3}{\int_do_while:nNnn {#1}#2{#3}{#4}} +} +\cs_set:Npn \int_do_until:nNnn #1#2#3#4{ + #4 \int_compare:nNnF {#1}#2{#3}{\int_do_until:nNnn {#1}#2{#3}{#4}} +} + \cs_new_protected_nopar:Npn \int_const:Nn #1#2 { - \intexpr_compare:nTF { #2 > \c_minus_one } + \int_compare:nTF { #2 > \c_minus_one } { - \intexpr_compare:nTF { #2 > \c_max_register_int } + \int_compare:nTF { #2 > \c_max_register_int } { \int_new:N #1 \int_gset:Nn #1 {#2} } { \chk_if_free_cs:N #1 - \tex_global:D \tex_mathchardef:D #1 = \intexpr_eval:n {#2} + \tex_global:D \tex_mathchardef:D #1 = \int_eval:n {#2} } } { @@ -236,6 +673,8 @@ \int_gset:Nn #1 {#2} } } +\cs_generate_variant:Nn \int_const:Nn { c } +\tex_mathchardef:D \c_max_register_int = 32767 \scan_stop: %% \tex_countdef:D \c_minus_one = 10 \scan_stop: %% \c_minus_one = -1 \scan_stop: %% in l3basics \int_const:Nn \c_one {1} @@ -266,97 +705,61 @@ \int_const:Nn \c_ten_thousand_four {10004} \int_const:Nn \c_twenty_thousand {20000} \int_const:Nn \c_max_int {2147483647} -\cs_new_nopar:Npn \int_get_sign_and_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_true_bool \c_true_bool -} -\cs_new_nopar:Npn \int_get_sign:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_true_bool \c_false_bool -} -\cs_new_nopar:Npn \int_get_digits:n #1{ - \int_get_sign_and_digits_aux:nNNN {#1} \c_true_bool \c_false_bool \c_true_bool -} -\cs_new_nopar:Npn \int_get_sign_and_digits_aux:nNNN #1#2#3#4{ - \tl_if_head_eq_charcode:fNTF {#1} - - { - \bool_if:NTF #2 - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} \c_false_bool #3#4 } - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} \c_true_bool #3#4 } - } - { - \tl_if_head_eq_charcode:fNTF {#1} + - { \int_get_sign_and_digits_aux:oNNN {\use_none:n #1} #2#3#4} - { - \bool_if:NT #3 { \bool_if:NF #2 - } - \bool_if:NT #4 {#1} - } - } -} -\cs_generate_variant:Nn \int_get_sign_and_digits_aux:nNNN {oNNN} -\cs_set_nopar:Npn \int_convert_from_base_ten:nn#1#2{ - \intexpr_compare:nNnTF {#1}<\c_zero - { - - \int_convert_from_base_ten_aux:nfn {} - { \intexpr_eval:n {-#1} } - } - { - \int_convert_from_base_ten_aux:nfn {} - { \intexpr_eval:n {#1} } - } - {#2} -} -\cs_new_nopar:Npn \int_convert_from_base_ten_aux:nnn#1#2#3{ - \intexpr_compare:nNnTF {#2}<{#3} - { \int_convert_number_to_letter:n{#2} #1 } - { - \int_convert_from_base_ten_aux:ffn - { - \int_convert_number_to_letter:n {\intexpr_mod:nn {#2}{#3}} - #1 - } - { \intexpr_div_truncate:nn{#2}{#3}} - {#3} - } -} -\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {nfn} -\cs_generate_variant:Nn \int_convert_from_base_ten_aux:nnn {ffn} -\cs_set_nopar:Npn \int_convert_number_to_letter:n #1{ - \if_case:w \intexpr_eval:w #1-10\intexpr_eval_end: - \exp_after:wN A \or: \exp_after:wN B \or: - \exp_after:wN C \or: \exp_after:wN D \or: \exp_after:wN E \or: - \exp_after:wN F \or: \exp_after:wN G \or: \exp_after:wN H \or: - \exp_after:wN I \or: \exp_after:wN J \or: \exp_after:wN K \or: - \exp_after:wN L \or: \exp_after:wN M \or: \exp_after:wN N \or: - \exp_after:wN O \or: \exp_after:wN P \or: \exp_after:wN Q \or: - \exp_after:wN R \or: \exp_after:wN S \or: \exp_after:wN T \or: - \exp_after:wN U \or: \exp_after:wN V \or: \exp_after:wN W \or: - \exp_after:wN X \or: \exp_after:wN Y \or: \exp_after:wN Z \else: - \use_i_after_fi:nw{ #1 }\fi: } -\cs_set_nopar:Npn \int_convert_to_base_ten:nn #1#2 { - \intexpr_eval:n{ - \int_get_sign:n{#1} - \exp_args:Nf\int_convert_to_base_ten_aux:nn {\int_get_digits:n{#1}}{#2} - } -} -\cs_new_nopar:Npn \int_convert_to_base_ten_aux:nn #1#2{ - \int_convert_to_base_ten_auxi:nnN {0}{#2} #1 \q_no_value -} -\cs_new_nopar:Npn \int_convert_to_base_ten_auxi:nnN#1#2#3{ - \quark_if_no_value:NTF #3 - {#1} - {\exp_args:Nf\int_convert_to_base_ten_auxi:nnN - {\intexpr_eval:n{ #1*#2+\int_convert_letter_to_number:N #3} } - {#2} - } -} -\cs_set_nopar:Npn \int_convert_letter_to_number:N #1{ - \intexpr_compare:nNnTF{`#1}<{58}{#1} - { - \intexpr_eval:n{ `#1 - - \intexpr_compare:nNnTF{`#1}<{91}{ 55 }{ 87 } - } - } -} +\int_const:cn { c_int_from_roman_i_int } { 1 } +\int_const:cn { c_int_from_roman_v_int } { 5 } +\int_const:cn { c_int_from_roman_x_int } { 10 } +\int_const:cn { c_int_from_roman_l_int } { 50 } +\int_const:cn { c_int_from_roman_c_int } { 100 } +\int_const:cn { c_int_from_roman_d_int } { 500 } +\int_const:cn { c_int_from_roman_m_int } { 1000 } +\int_const:cn { c_int_from_roman_I_int } { 1 } +\int_const:cn { c_int_from_roman_V_int } { 5 } +\int_const:cn { c_int_from_roman_X_int } { 10 } +\int_const:cn { c_int_from_roman_L_int } { 50 } +\int_const:cn { c_int_from_roman_C_int } { 100 } +\int_const:cn { c_int_from_roman_D_int } { 500 } +\int_const:cn { c_int_from_roman_M_int } { 1000 } \int_new:N \g_tl_inline_level_int +\cs_set_eq:NN \intexpr_value:w \int_value:w +\cs_set_eq:NN \intexpr_eval:w \int_eval:w +\cs_set_eq:NN \intexpr_eval_end: \int_eval_end: +\cs_set_eq:NN \if_intexpr_compare:w \if_int_compare:w +\cs_set_eq:NN \if_intexpr_odd:w \if_int_odd:w +\cs_set_eq:NN \if_intexpr_case:w \if_case:w +\cs_set_eq:NN \intexpr_eval:n \int_eval:n + +\cs_set_eq:NN \intexpr_compare_p:n \int_compare_p:n +\cs_set_eq:NN \intexpr_compare:nTF \int_compare:nTF +\cs_set_eq:NN \intexpr_compare:nT \int_compare:nT +\cs_set_eq:NN \intexpr_compare:nF \int_compare:nF + +\cs_set_eq:NN \intexpr_compare_p:nNn \int_compare_p:nNn +\cs_set_eq:NN \intexpr_compare:nNnTF \int_compare:nNnTF +\cs_set_eq:NN \intexpr_compare:nNnT \int_compare:nNnT +\cs_set_eq:NN \intexpr_compare:nNnF \int_compare:nNnF + +\cs_set_eq:NN \intexpr_abs:n \int_abs:n +\cs_set_eq:NN \intexpr_max:nn \int_max:nn +\cs_set_eq:NN \intexpr_min:nn \int_min:nn + +\cs_set_eq:NN \intexpr_div_truncate:nn \int_div_truncate:nn +\cs_set_eq:NN \intexpr_div_round:nn \int_div_round:nn +\cs_set_eq:NN \intexpr_mod:nn \int_mod:nn + +\cs_set_eq:NN \intexpr_if_odd_p:n \int_if_odd_p:n +\cs_set_eq:NN \intexpr_if_odd:nTF \int_if_odd:nTF +\cs_set_eq:NN \intexpr_if_odd:nT \int_if_odd:nT +\cs_set_eq:NN \intexpr_if_odd:nF \int_if_odd:nF + +\cs_set_eq:NN \intexpr_while_do:nn \int_while_do:nn +\cs_set_eq:NN \intexpr_until_do:nn \int_until_do:nn +\cs_set_eq:NN \intexpr_do_while:nn \int_do_while:nn +\cs_set_eq:NN \intexpr_do_until:nn \int_do_until:nn + +\cs_set_eq:NN \intexpr_while_do:nNnn \int_while_do:nNnn +\cs_set_eq:NN \intexpr_until_do:nNnn \int_until_do:nNnn +\cs_set_eq:NN \intexpr_do_while:nNnn \int_do_while:nNnn +\cs_set_eq:NN \intexpr_do_until:nNnn \int_do_until:nNnn %% %% %% End of file `l3int.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty b/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty deleted file mode 100644 index d751152223b..00000000000 --- a/Master/texmf-dist/tex/latex/expl3/l3intexpr.sty +++ /dev/null @@ -1,228 +0,0 @@ -%% -%% This is file `l3intexpr.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3intexpr.dtx (with options: `package,trace') -%% -%% -%% EXPERIMENTAL CODE -%% -%% Do not distribute this file without also distributing the -%% source files specified above. -%% -%% Do not distribute a modified version of this file. -%% -%% -%% File: l3intexpr.dtx Copyright (C) 2009-2010 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 -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``expl3 bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -\RequirePackage{l3names} -\GetIdInfo$Id: l3intexpr.dtx 2045 2010-09-22 03:59:34Z will $ - {L3 Integer Expressions} -\ProvidesExplPackage - {\filename}{\filedate}{\fileversion}{\filedescription} -\package_check_loaded_expl: -\cs_new_eq:NN \if_num:w \tex_ifnum:D -\cs_new_eq:NN \if_case:w \tex_ifcase:D -\cs_set_eq:NN \intexpr_value:w \tex_number:D -\cs_set_eq:NN \intexpr_eval:w \etex_numexpr:D -\cs_set_protected:Npn \intexpr_eval_end: {\tex_relax:D} -\cs_set_eq:NN \if_intexpr_compare:w \tex_ifnum:D -\cs_set_eq:NN \if_intexpr_odd:w \tex_ifodd:D -\cs_set_eq:NN \if_intexpr_case:w \tex_ifcase:D -\cs_set:Npn \intexpr_eval:n #1{ - \intexpr_value:w \intexpr_eval:w #1\intexpr_eval_end: -} -\prg_set_conditional:Npnn \intexpr_compare:n #1{p,TF,T,F}{ - \exp_after:wN \intexpr_compare_auxi:w \intexpr_value:w - \intexpr_eval:w #1\q_stop -} -\cs_set:Npn \intexpr_compare_auxi:w #1#2\q_stop{ - \exp_after:wN \intexpr_compare_auxii:w \tex_romannumeral:D - \if:w #1- \else: -\fi: #1#2 \q_mark #1#2 \q_stop -} -\cs_set:Npn \intexpr_compare_auxii:w #1#2#3\q_mark{ - \use:c{ - intexpr_compare_ - #1 \if_meaning:w =#2 = \fi: - :w} -} -\cs_set:cpn {intexpr_compare_=:w} #1=#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set:cpn {intexpr_compare_==:w} #1==#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set:cpn {intexpr_compare_!=:w} #1!=#2\q_stop{ - \if_intexpr_compare:w #1=\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -\cs_set:cpn {intexpr_compare_<:w} #1<#2\q_stop{ - \if_intexpr_compare:w #1<\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set:cpn {intexpr_compare_>:w} #1>#2\q_stop{ - \if_intexpr_compare:w #1>\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set:cpn {intexpr_compare_<=:w} #1<=#2\q_stop{ - \if_intexpr_compare:w #1>\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -\cs_set:cpn {intexpr_compare_>=:w} #1>=#2\q_stop{ - \if_intexpr_compare:w #1<\intexpr_eval:w #2 \intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -\prg_set_conditional:Npnn \intexpr_compare:nNn #1#2#3{p}{ - \if_intexpr_compare:w \intexpr_eval:w #1 #2 \intexpr_eval:w #3 - \intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\cs_set_nopar:Npn \intexpr_compare:nNnT #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use:n - \tex_else:D - \tex_expandafter:D \use_none:n - \tex_fi:D -} -\cs_set_nopar:Npn \intexpr_compare:nNnF #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use_none:n - \tex_else:D - \tex_expandafter:D \use:n - \tex_fi:D -} -\cs_set_nopar:Npn \intexpr_compare:nNnTF #1#2#3 { - \tex_ifnum:D \etex_numexpr:D #1 #2 \etex_numexpr:D #3 \scan_stop: - \tex_expandafter:D \use_i:nn - \tex_else:D - \tex_expandafter:D \use_ii:nn - \tex_fi:D -} -\cs_set:Npn \intexpr_abs:n #1{ - \intexpr_value:w - \if_intexpr_compare:w \intexpr_eval:w #1<\c_zero - - - \fi: - \intexpr_eval:w #1\intexpr_eval_end: -} -\cs_set:Npn \intexpr_max:nn #1#2{ - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w - \intexpr_eval:w #1>\intexpr_eval:w #2\intexpr_eval_end: - #1 - \else: - #2 - \fi: - \intexpr_eval_end: -} -\cs_set:Npn \intexpr_min:nn #1#2{ - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w - \intexpr_eval:w #1<\intexpr_eval:w #2\intexpr_eval_end: - #1 - \else: - #2 - \fi: - \intexpr_eval_end: -} -\cs_set:Npn \intexpr_div_truncate:nn #1#2 { - \intexpr_value:w \intexpr_eval:w - \if_intexpr_compare:w \intexpr_eval:w #1 = \c_zero - 0 - \else: - (#1 - \if_intexpr_compare:w \intexpr_eval:w #1 < \c_zero - \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero - -( #2 + - \else: - +( #2 - - \fi: - \else: - \if_intexpr_compare:w \intexpr_eval:w #2 < \c_zero - +( #2 + - \else: - -( #2 - - \fi: - \fi: - 1)/2) - \fi: - /(#2) - \intexpr_eval_end: -} -\cs_set:Npn \intexpr_div_round:nn #1#2 {\intexpr_eval:n{(#1)/(#2)}} -\cs_set:Npn \intexpr_mod:nn #1#2 { - \intexpr_value:w - \intexpr_eval:w - #1 - \intexpr_div_truncate:nn {#1}{#2} * (#2) - \intexpr_eval_end: -} -\prg_set_conditional:Npnn \intexpr_if_odd:n #1 {p,TF,T,F} { - \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: - \prg_return_true: \else: \prg_return_false: \fi: -} -\prg_set_conditional:Npnn \intexpr_if_even:n #1 {p,TF,T,F} { - \if_intexpr_odd:w \intexpr_eval:w #1\intexpr_eval_end: - \prg_return_false: \else: \prg_return_true: \fi: -} -\cs_set:Npn \intexpr_while_do:nn #1#2{ - \intexpr_compare:nT {#1}{#2 \intexpr_while_do:nn {#1}{#2}} -} -\cs_set:Npn \intexpr_until_do:nn #1#2{ - \intexpr_compare:nF {#1}{#2 \intexpr_until_do:nn {#1}{#2}} -} -\cs_set:Npn \intexpr_do_while:nn #1#2{ - #2 \intexpr_compare:nT {#1}{\intexpr_do_while:nNnn {#1}{#2}} -} -\cs_set:Npn \intexpr_do_until:nn #1#2{ - #2 \intexpr_compare:nF {#1}{\intexpr_do_until:nn {#1}{#2}} -} -\cs_set:Npn \intexpr_while_do:nNnn #1#2#3#4{ - \intexpr_compare:nNnT {#1}#2{#3}{#4 \intexpr_while_do:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_until_do:nNnn #1#2#3#4{ - \intexpr_compare:nNnF {#1}#2{#3}{#4 \intexpr_until_do:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_do_while:nNnn #1#2#3#4{ - #4 \intexpr_compare:nNnT {#1}#2{#3}{\intexpr_do_while:nNnn {#1}#2{#3}{#4}} -} -\cs_set:Npn \intexpr_do_until:nNnn #1#2#3#4{ - #4 \intexpr_compare:nNnF {#1}#2{#3}{\intexpr_do_until:nNnn {#1}#2{#3}{#4}} -} -\tex_mathchardef:D \c_max_register_int = 32767 \scan_stop: -%% -%% -%% End of file `l3intexpr.sty'. diff --git a/Master/texmf-dist/tex/latex/expl3/l3io.sty b/Master/texmf-dist/tex/latex/expl3/l3io.sty index 5999b5a476d..10502e844ca 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3io.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3io.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 1923 2010-05-22 12:45:49Z joseph $ +\GetIdInfo$Id: l3io.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental i/o module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -101,7 +101,7 @@ \iow_close:N #1 \int_set:Nn \l_iow_stream_int { \c_sixteen } \tl_map_function:NN \c_iow_streams_tl \iow_alloc_write:n - \intexpr_compare:nTF { \l_iow_stream_int = \c_sixteen } + \int_compare:nTF { \l_iow_stream_int = \c_sixteen } { \msg_kernel_error:nn { iow } { streams-exhausted } } { \iow_stream_alloc:N #1 @@ -114,7 +114,7 @@ \ior_close:N #1 \int_set:Nn \l_ior_stream_int { \c_sixteen } \tl_map_function:NN \c_ior_streams_tl \ior_alloc_read:n - \intexpr_compare:nTF { \l_ior_stream_int = \c_sixteen } + \int_compare:nTF { \l_ior_stream_int = \c_sixteen } { \msg_kernel_error:nn { ior } { streams-exhausted } } { \ior_stream_alloc:N #1 @@ -142,7 +142,7 @@ { \cs_gset_eq:Nc #1 { g_iow_ \int_use:N \l_iow_stream_int _stream } } { \iow_stream_alloc_aux: - \intexpr_compare:nT { \l_iow_stream_int = \c_sixteen } + \int_compare:nT { \l_iow_stream_int = \c_sixteen } { \iow_raw_new:N \g_iow_tmp_stream \int_set:Nn \l_iow_stream_int { \g_iow_tmp_stream } @@ -155,7 +155,7 @@ } \cs_new_protected_nopar:Npn \iow_stream_alloc_aux: { \int_incr:N \l_iow_stream_int - \intexpr_compare:nT + \int_compare:nT { \l_iow_stream_int < \c_sixteen } { \cs_if_exist:cTF { g_iow_ \int_use:N \l_iow_stream_int _stream } @@ -171,7 +171,7 @@ { \cs_gset_eq:Nc #1 { g_ior_ \int_use:N \l_ior_stream_int _stream } } { \ior_stream_alloc_aux: - \intexpr_compare:nT { \l_ior_stream_int = \c_sixteen } + \int_compare:nT { \l_ior_stream_int = \c_sixteen } { \ior_raw_new:N \g_ior_tmp_stream \int_set:Nn \l_ior_stream_int { \g_ior_tmp_stream } @@ -184,7 +184,7 @@ } \cs_new_protected_nopar:Npn \ior_stream_alloc_aux: { \int_incr:N \l_ior_stream_int - \intexpr_compare:nT + \int_compare:nT { \l_ior_stream_int < \c_sixteen } { \cs_if_exist:cTF { g_ior_ \int_use:N \l_ior_stream_int _stream } @@ -198,7 +198,7 @@ \cs_new_protected_nopar:Npn \iow_close:N #1 { \cs_if_exist:NT #1 { - \intexpr_compare:nF { #1 = \c_minus_one } + \int_compare:nF { #1 = \c_minus_one } { \tex_immediate:D \tex_closeout:D #1 \prop_gdel:NV \g_iow_streams_prop #1 @@ -210,7 +210,7 @@ \cs_new_protected_nopar:Npn \ior_close:N #1 { \cs_if_exist:NT #1 { - \intexpr_compare:nF { #1 = \c_minus_one } + \int_compare:nF { #1 = \c_minus_one } { \tex_closein:D #1 \prop_gdel:NV \g_ior_streams_prop #1 diff --git a/Master/texmf-dist/tex/latex/expl3/l3keys.sty b/Master/texmf-dist/tex/latex/expl3/l3keys.sty index c2ef0cf8954..45e799aa6a4 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3keys.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3keys.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3keys.dtx 1931 2010-05-24 21:06:50Z joseph $ +\GetIdInfo$Id: l3keys.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental key-value support} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -171,7 +171,7 @@ } \cs_new_protected:Npn \keys_define_key:n #1 { \bool_if:NTF \l_keys_no_value_bool { - \intexpr_compare:nTF { + \int_compare:nTF { \exp_args:Nc \cs_get_arg_count_from_signature:N { \l_keys_property_tl } = \c_zero } { diff --git a/Master/texmf-dist/tex/latex/expl3/l3msg.sty b/Master/texmf-dist/tex/latex/expl3/l3msg.sty index 6ed3dad14c1..4b1de84bee5 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3msg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3msg.sty @@ -49,16 +49,18 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 1866 2010-03-23 08:29:27Z joseph $ +\GetIdInfo$Id: l3msg.dtx 2052 2010-10-02 16:04:38Z will $ {L3 Experimental LaTeX Messages module} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: \int_set:Nn \tex_errorcontextlines:D { \c_minus_one } -\tl_const:Nn \c_msg_fatal_tl { Fatal~Error } -\tl_const:Nn \c_msg_error_tl { Error } -\tl_const:Nn \c_msg_warning_tl { Warning } -\tl_const:Nn \c_msg_info_tl { Info } +\tl_const:Nn \c_msg_error_tl { error } +\tl_const:Nn \c_msg_warning_tl { warning } +\tl_const:Nn \c_msg_info_tl { info } +\cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } +\cs_new:Npn \msg_see_documentation_text:n #1 + { See~the~#1~documentation~for~further~information } \tl_const:Nn \c_msg_coding_error_text_tl { This~is~a~coding~error. \msg_two_newlines: @@ -73,8 +75,7 @@ This~is~a~LaTeX~bug:~check~coding! } \tl_const:Nn \c_msg_kernel_bug_more_text_tl { - There~is~a~coding~bug~somewhere~around~here. - \msg_newline: + There~is~a~coding~bug~somewhere~around~here. \\ This~probably~needs~examining~by~an~expert. \c_msg_return_text_tl } @@ -83,19 +84,18 @@ \c_msg_return_text_tl } \tl_const:Nn \c_msg_return_text_tl { - \msg_two_newlines: + \\ \\ Try~typing~<return>~to~proceed. - \msg_newline: + \\ If~that~doesn't~work,~type~X~<return>~to~quit } \group_begin: -\char_make_letter:N\ % -\tl_to_lowercase:n{% -\group_end:% -\tl_const:Nn% -\c_msg_hide_tl % -{}% -}% +\char_make_letter:N \. +\tl_to_lowercase:n { + \group_end: + \tl_const:Nn \c_msg_hide_tl................................................ + {} +} \tl_const:Nn \c_msg_on_line_tl { on~line } \tl_const:Nn \c_msg_text_prefix_tl { msg_text ~>~ } \tl_const:Nn \c_msg_more_text_prefix_tl { msg_text_more ~>~ } @@ -143,34 +143,44 @@ \group_begin: \char_set_lccode:nn {`\&} {`\ } % { \char_set_lccode:w `\} = `\ \scan_stop: + \char_set_lccode:w `\& = `\!\scan_stop: \char_make_active:N \& - \char_make_letter:N\ % -\tl_to_lowercase:n{% -\group_end:% -\cs_new_protected:Npn\msg_direct_interrupt:xxxx#1#2#3#4{% -\group_begin:% -\cs_set_eq:NN\\\msg_newline:% -\cs_set_eq:NN\ \c_space_tl% -\msg_direct_interrupt_aux:n{#4}% -\cs_set_nopar:Npn\\{\msg_newline:#3}% -\tex_errhelp:D\l_msg_tmp_tl% -\cs_set:Npn&{% -\tex_errmessage:D{% -#1\msg_newline:% -#2\msg_two_newlines:% -\c_msg_help_text_tl% -\c_msg_hide_tl % -}% -}% -&% -\group_end:% -}% -}% + \char_make_letter:N \. +\tl_to_lowercase:n{ + \group_end: + \cs_new_protected:Npn \msg_direct_interrupt:xxxxx #1#2#3#4#5 { + \group_begin: + \cs_set_nopar:Npn \\ {\msg_newline:} + \cs_set_eq:NN \ \c_space_tl + \tl_set:Nx \l_tmpa_tl {#5} + \tl_set:Nx \l_tmpb_tl {\c_msg_no_info_text_tl} + \msg_direct_interrupt_aux:n {#5} + \tex_errhelp:D \l_msg_tmp_tl + \cs_set_nopar:Npn \\ {\msg_newline: !~#3} + \iow_term:x + {\msg_newline: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} + \cs_set:Npn & { + \tex_errmessage:D{ + \\ #1 \\ \\ #2 \\ \\ #4 + \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl + { . \\ \c_msg_help_text_tl } + \c_msg_hide_tl................................................ + } + } + & + \group_end: + } +} \cs_new_protected:Npn \msg_direct_interrupt_aux:n #1 { + \cs_set_nopar:Npn \\ {\msg_newline: |~} \tl_if_empty:nTF {#1} { \tl_set:Nx \l_msg_tmp_tl { { \c_msg_no_info_text_tl } } }{ - \tl_set:Nx \l_msg_tmp_tl { {#1} } + \tl_set:Nx \l_msg_tmp_tl { { + |'''''''''''''''''''''''''''''''''''''''''''''''\\ + #1^^J + |...............................................^^J + } } } } \cs_new_protected:Npn \msg_direct_log:xx #1#2 { @@ -276,24 +286,24 @@ } } \msg_class_new:nn { fatal } { - \msg_direct_interrupt:xxxx - { \c_msg_fatal_tl \msg_two_newlines: } + \msg_direct_interrupt:xxxxx + { \msg_fatal_text:n {#1} : ~ "#2" } { - ( \c_msg_fatal_tl ) \c_space_tl \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( \c_msg_fatal_tl ) \c_space_tl } + {} + { \msg_see_documentation_text:n {#1} } { \c_msg_fatal_text_tl } \tex_end:D } \msg_class_new:nn { error } { - \msg_direct_interrupt:xxxx - { #1~\c_msg_error_tl \msg_newline: } + \msg_direct_interrupt:xxxxx + { #1~ \c_msg_error_tl : ~ "#2" } { - ( #1 ) \c_space_tl \use:c { \c_msg_text_prefix_tl #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( #1 ) \c_space_tl } + {} + { \msg_see_documentation_text:n {#1} } { \cs_if_exist:cTF { \c_msg_more_text_prefix_tl #1 / #2 :xxxx } { @@ -372,27 +382,27 @@ } } \cs_new_protected:Npn \msg_kernel_fatal:nnxxxx #1#2#3#4#5#6 { - \msg_direct_interrupt:xxxx - { \c_msg_fatal_tl \msg_two_newlines: } + \msg_direct_interrupt:xxxxx + { \msg_fatal_text:n {LaTeX} } { - ( LaTeX ) \c_space_tl \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( LaTeX ) \c_space_tl} + {} + { \msg_see_documentation_text:n {LaTeX3} } { \c_msg_fatal_text_tl } \tex_end:D } \msg_kernel_classes_new:n { fatal } \cs_new_protected:Npn \msg_kernel_error:nnxxxx #1#2#3#4#5#6 { - \msg_direct_interrupt:xxxx - { LaTeX~\c_msg_error_tl \msg_newline: } + \msg_direct_interrupt:xxxxx + { LaTeX~\c_msg_error_tl \c_space_tl "#2" } { - ( LaTeX ) \c_space_tl \use:c { \c_msg_text_prefix_tl LaTeX / #1 / #2 :xxxx } {#3} {#4} {#5} {#6} } - { ( LaTeX ) \c_space_tl } + {} + { \msg_see_documentation_text:n {LaTeX3} } { \cs_if_exist:cTF { \c_msg_more_text_prefix_tl LaTeX / #1 / #2 :xxxx } @@ -436,10 +446,11 @@ \c_msg_return_text_tl } \cs_set_protected:Npn \msg_kernel_bug:x #1 { - \msg_direct_interrupt:xxxx + \msg_direct_interrupt:xxxxx { \c_msg_kernel_bug_text_tl } - { !~#1 } - { ! } + { #1 } + {} + { \msg_see_documentation_text:n {LaTeX3} } { \c_msg_kernel_bug_more_text_tl } } %% diff --git a/Master/texmf-dist/tex/latex/expl3/l3names.sty b/Master/texmf-dist/tex/latex/expl3/l3names.sty index d86ea68c3f3..13a2bf23621 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3names.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3names.sty @@ -87,7 +87,7 @@ \gdef\filedescription{#1}% \ProvidesPackage{[unknown package]}[0000/00/00 v0.0 #1] } -\GetIdInfo$Id: l3names.dtx 2048 2010-09-26 19:13:59Z joseph $ +\GetIdInfo$Id: l3names.dtx 2064 2010-10-03 23:27:33Z will $ {L3 Experimental Naming Scheme for TeX Primitives} \endgroup \def\@tempa{% @@ -102,12 +102,12 @@ \expandafter\@tempa \fi \begingroup\expandafter\expandafter\expandafter\endgroup - \ifx\csname pdfstrcmp\endcsname\relax + \expandafter\ifx\csname pdfstrcmp\endcsname\relax \let\pdfstrcmp\strcmp \fi \begingroup\expandafter\expandafter\expandafter\endgroup -\ifx\csname pdfstrcmp\endcsname\relax - \PackageError{l3names}{Required primitives not found} +\expandafter\ifx\csname pdfstrcmp\endcsname\relax + \PackageError{l3names}{Required primitive not found: \protect\pdfstrcmp} {% LaTeX3 requires the e-TeX primitives and \string\pdfstrcmp.\MessageBreak @@ -657,10 +657,12 @@ \name_primitive:NN \initcatcodetable \luatex_initcatcodetable:D \name_primitive:NN \latelua \luatex_latelua:D \name_primitive:NN \savecatcodetable \luatex_savecatcodetable:D -\etex_ifdefined:D \strcmp - \etex_ifdefined:D \xetex_version:D - \name_primitive:NN \strcmp \pdf_strcmp:D - \tex_fi:D +\tex_begingroup:D + \tex_expandafter:D \tex_expandafter:D \tex_expandafter:D +\tex_endgroup:D +\tex_expandafter:D \tex_ifx:D \tex_csname:D xetex_version:D\tex_endcsname:D + \tex_relax:D \tex_else:D + \name_primitive:NN \strcmp \pdf_strcmp:D \tex_fi:D \etex_protected:D \tex_def:D \ExplSyntaxOn { \tex_ifodd:D \ExplSyntaxStatus \tex_relax:D diff --git a/Master/texmf-dist/tex/latex/expl3/l3num.sty b/Master/texmf-dist/tex/latex/expl3/l3num.sty index 138dfef767f..5658ff30e35 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3num.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3num.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3num.dtx 1914 2010-05-21 16:18:46Z schoepf $ +\GetIdInfo$Id: l3num.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental token numbers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -70,7 +70,7 @@ \cs_new_protected_nopar:Npn \num_new:N #1{\tl_new:Nn #1{0}} \cs_generate_variant:Nn \num_new:N {c} \cs_new_protected_nopar:Npn \num_set:Nn #1#2{ - \tl_set:No #1{ \tex_number:D \intexpr_eval:n {#2} } + \tl_set:No #1{ \tex_number:D \int_eval:n {#2} } } \cs_generate_variant:Nn\num_set:Nn {c} \cs_new_protected_nopar:Npn \num_gset:Nn {\pref_global:D \num_set:Nn} diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index b4f8ec44ed6..13d62b490a9 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2043 2010-09-22 02:10:43Z will $ +\GetIdInfo$Id: l3prg.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental control structures} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -73,11 +73,11 @@ \if_false:{\fi:\if_num:w`}=\c_zero\fi:} \cs_new_nopar:Npn \group_align_safe_end: {\if_num:w`{=\c_zero}\fi:} \cs_new_nopar:Npn \scan_align_safe_stop: { - \intexpr_compare:nNnT \etex_currentgrouptype:D = \c_six + \int_compare:nNnT \etex_currentgrouptype:D = \c_six { - \intexpr_compare:nNnF \etex_lastnodetype:D = \c_zero + \int_compare:nNnF \etex_lastnodetype:D = \c_zero { - \intexpr_compare:nNnF \etex_lastnodetype:D = \c_seven + \int_compare:nNnF \etex_lastnodetype:D = \c_seven \scan_stop: } } @@ -85,7 +85,7 @@ \cs_new_nopar:Npn \prg_replicate:nn #1{ \cs:w prg_do_nothing: \exp_after:wN\prg_replicate_first_aux:N - \tex_romannumeral:D -`\q \intexpr_eval:n{#1} \cs_end: + \tex_romannumeral:D -`\q \int_eval:n{#1} \cs_end: \cs_end: } \cs_new_nopar:Npn \prg_replicate_aux:N#1{ @@ -124,26 +124,26 @@ \cs_new:cpn {prg_replicate_first_8:n}#1{\cs_end: #1#1#1#1#1#1#1#1} \cs_new:cpn {prg_replicate_first_9:n}#1{\cs_end: #1#1#1#1#1#1#1#1#1} \cs_new:Npn \prg_stepwise_function:nnnN #1#2{ - \intexpr_compare:nNnTF{#2}<\c_zero + \int_compare:nNnTF{#2}<\c_zero {\exp_args:Nf\prg_stepwise_function_decr:nnnN } {\exp_args:Nf\prg_stepwise_function_incr:nnnN } - {\intexpr_eval:n{#1}}{#2} + {\int_eval:n{#1}}{#2} } \cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4{ - \intexpr_compare:nNnF {#1}>{#3} + \int_compare:nNnF {#1}>{#3} { #4{#1} \exp_args:Nf \prg_stepwise_function_incr:nnnN - {\intexpr_eval:n{#1 + #2}} + {\int_eval:n{#1 + #2}} {#2}{#3}{#4} } } \cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4{ - \intexpr_compare:nNnF {#1}<{#3} + \int_compare:nNnF {#1}<{#3} { #4{#1} \exp_args:Nf \prg_stepwise_function_decr:nnnN - {\intexpr_eval:n{#1 + #2}} + {\int_eval:n{#1 + #2}} {#2}{#3}{#4} } } @@ -151,49 +151,49 @@ \cs_new_protected:Npn\prg_stepwise_inline:nnnn #1#2#3#4{ \int_gincr:N \g_prg_inline_level_int \cs_gset_nopar:cpn{prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n}##1{#4} - \intexpr_compare:nNnTF {#2}<\c_zero + \int_compare:nNnTF {#2}<\c_zero {\exp_args:Ncf \prg_stepwise_inline_decr:Nnnn } {\exp_args:Ncf \prg_stepwise_inline_incr:Nnnn } {prg_stepwise_inline_\int_use:N\g_prg_inline_level_int :n} - {\intexpr_eval:n{#1}} {#2} {#3} + {\int_eval:n{#1}} {#2} {#3} \int_gdecr:N \g_prg_inline_level_int } \cs_new:Npn \prg_stepwise_inline_incr:Nnnn #1#2#3#4{ - \intexpr_compare:nNnF {#2}>{#4} + \int_compare:nNnF {#2}>{#4} { #1{#2} \exp_args:NNf \prg_stepwise_inline_incr:Nnnn #1 - {\intexpr_eval:n{#2 + #3}} {#3}{#4} + {\int_eval:n{#2 + #3}} {#3}{#4} } } \cs_new:Npn \prg_stepwise_inline_decr:Nnnn #1#2#3#4{ - \intexpr_compare:nNnF {#2}<{#4} + \int_compare:nNnF {#2}<{#4} { #1{#2} \exp_args:NNf \prg_stepwise_inline_decr:Nnnn #1 - {\intexpr_eval:n{#2 + #3}} {#3}{#4} + {\int_eval:n{#2 + #3}} {#3}{#4} } } \cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2 { - \intexpr_compare:nNnTF {#2}<\c_zero + \int_compare:nNnTF {#2}<\c_zero {\exp_args:Nf\prg_stepwise_variable_decr:nnnNn} {\exp_args:Nf\prg_stepwise_variable_incr:nnnNn} - {\intexpr_eval:n{#1}}{#2} + {\int_eval:n{#1}}{#2} } \cs_new_protected:Npn \prg_stepwise_variable_incr:nnnNn #1#2#3#4#5 { - \intexpr_compare:nNnF {#1}>{#3} + \int_compare:nNnF {#1}>{#3} { \cs_set_nopar:Npn #4{#1} #5 \exp_args:Nf \prg_stepwise_variable_incr:nnnNn - {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} + {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } \cs_new_protected:Npn \prg_stepwise_variable_decr:nnnNn #1#2#3#4#5 { - \intexpr_compare:nNnF {#1}<{#3} + \int_compare:nNnF {#1}<{#3} { \cs_set_nopar:Npn #4{#1} #5 \exp_args:Nf \prg_stepwise_variable_decr:nnnNn - {\intexpr_eval:n{#1 + #2}}{#2}{#3}#4{#5} + {\int_eval:n{#1 + #2}}{#2}{#3}#4{#5} } } \cs_new_protected_nopar:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool } @@ -360,7 +360,7 @@ \cs_generate_variant:Nn \bool_gset:Nn {c} \cs_new:Npn \bool_not_p:n #1{ \bool_if_p:n{!(#1)} } \cs_new:Npn \bool_xor_p:nn #1#2 { - \intexpr_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }} + \int_compare:nNnTF {\bool_if_p:n { #1 }} = {\bool_if_p:n { #2 }} {\c_false_bool}{\c_true_bool} } \prg_set_conditional:Npnn \bool_if:n #1 {TF,T,F}{ @@ -380,12 +380,12 @@ #2 \bool_if:nF {#1} { \bool_do_until:nn {#1}{#2} } } \cs_new:Npn \prg_case_int:nnn #1 #2 { - \exp_args:Nf \prg_case_int_aux:nnn { \intexpr_eval:n{#1}} #2 + \exp_args:Nf \prg_case_int_aux:nnn { \int_eval:n{#1}} #2 \q_recursion_tail ? \q_recursion_stop } \cs_new:Npn \prg_case_int_aux:nnn #1#2#3{ \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} - \intexpr_compare:nNnTF{#1}={#2} + \int_compare:nNnTF{#1}={#2} { \prg_end_case:nw {#3} } { \prg_case_int_aux:nnn {#1}} } diff --git a/Master/texmf-dist/tex/latex/expl3/l3skip.sty b/Master/texmf-dist/tex/latex/expl3/l3skip.sty index b6f10c5127d..813b1ad11e3 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3skip.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3skip.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 2047 2010-09-23 09:27:30Z will $ +\GetIdInfo$Id: l3skip.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental skip registers} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -114,8 +114,8 @@ \cs_set_eq:NN \c_max_skip \maxdimen \prg_new_conditional:Nnn \skip_if_infinite_glue:n {p,TF,T,F} { \bool_if:nTF { - \intexpr_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || - \intexpr_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero + \int_compare_p:nNn {\etex_gluestretchorder:D #1 } > \c_zero || + \int_compare_p:nNn {\etex_glueshrinkorder:D #1 } > \c_zero } {\prg_return_true:} {\prg_return_false:} } \cs_new_nopar:Npn \skip_split_finite_else_action:nnNN #1#2#3#4{ @@ -167,14 +167,13 @@ \cs_new_eq:NN \c_max_dim \c_max_skip \cs_new_protected_nopar:Npn \dim_eval:n #1 { \etex_dimexpr:D #1 \scan_stop: } \cs_new_eq:NN \if_dim:w \tex_ifdim:D +\cs_set_eq:NN \dim_value:w \tex_number:D +\cs_set_eq:NN \dim_eval:w \etex_dimexpr:D +\cs_set_protected:Npn \dim_eval_end: {\tex_relax:D} \prg_new_conditional:Nnn \dim_compare:nNn {p,TF,T,F} { \if_dim:w \dim_eval:n {#1} #2 \dim_eval:n {#3} \prg_return_true: \else: \prg_return_false: \fi: } -\cs_set_eq:NN \dim_value:w \tex_number:D -\cs_set_eq:NN \dim_eval:w \etex_dimexpr:D -\cs_set_eq:NN \if_dim_compare:w \if_dim:w -\cs_set_eq:NN \dim_eval_end: \scan_stop: \prg_new_conditional:Npnn \dim_compare:n #1 {p,TF,T,F} { \exp_after:wN \dim_compare_auxi:w \dim_value:w \dim_eval:w #1 \q_stop @@ -189,31 +188,31 @@ :w} } \cs_new:cpn {dim_compare_=:w} #1 = #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:cpn {dim_compare_==:w} #1 == #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:cpn {dim_compare_!=:w} #1 != #2 \q_stop { - \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp = \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } \cs_new:cpn {dim_compare_<:w} #1 < #2 \q_stop { - \if_dim_compare:w #1 sp < \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:cpn {dim_compare_>:w} #1 > #2 \q_stop { - \if_dim_compare:w #1 sp > \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:cpn {dim_compare_<=:w} #1 <= #2 \q_stop { - \if_dim_compare:w #1 sp > \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp > \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } \cs_new:cpn {dim_compare_>=:w} #1 >= #2 \q_stop { - \if_dim_compare:w #1 sp < \dim_eval:w #2 \dim_eval_end: + \if_dim:w #1 sp < \dim_eval:w #2 \dim_eval_end: \prg_return_false: \else: \prg_return_true: \fi: } \cs_new_nopar:Npn \dim_while_do:nNnn #1#2#3#4{ diff --git a/Master/texmf-dist/tex/latex/expl3/l3tl.sty b/Master/texmf-dist/tex/latex/expl3/l3tl.sty index 19df9805a95..2fd347e0184 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3tl.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3tl.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2040 2010-09-21 18:11:09Z joseph $ +\GetIdInfo$Id: l3tl.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental Token Lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -355,13 +355,13 @@ \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } \cs_new:Npn \tl_elt_count:n #1{ - \intexpr_eval:n { + \int_eval:n { 0 \tl_map_function:nN {#1} \tl_elt_count_aux:n } } \cs_generate_variant:Nn \tl_elt_count:n {V,o} \cs_new_nopar:Npn \tl_elt_count:N #1{ - \intexpr_eval:n { + \int_eval:n { 0 \tl_map_function:NN #1 \tl_elt_count_aux:n } } diff --git a/Master/texmf-dist/tex/latex/expl3/l3token.sty b/Master/texmf-dist/tex/latex/expl3/l3token.sty index 873775f95d0..826763a5693 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3token.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3token.sty @@ -48,24 +48,24 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3token.dtx 2029 2010-09-19 13:59:02Z joseph $ +\GetIdInfo$Id: l3token.dtx 2063 2010-10-03 08:26:49Z mittelba $ {L3 Experimental token investigation and manipulation} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} \package_check_loaded_expl: \cs_new_eq:NN \char_set_catcode:w \tex_catcode:D \cs_new_protected_nopar:Npn \char_set_catcode:nn #1#2 { - \char_set_catcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_catcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_catcode:w { \int_use:N \tex_catcode:D } \cs_new_nopar:Npn \char_value_catcode:n #1 { - \char_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_catcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_catcode:w { \tex_showthe:D \tex_catcode:D } \cs_new_nopar:Npn \char_show_value_catcode:n #1 { - \char_show_value_catcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_catcode:w \int_eval:w #1\int_eval_end: } \cs_new_protected_nopar:Npn \char_make_escape:N #1 { \char_set_catcode:nn {`#1} {\c_zero} } \cs_new_protected_nopar:Npn \char_make_begin_group:N #1 { \char_set_catcode:nn {`#1} {\c_one} } @@ -101,51 +101,51 @@ \cs_new_protected_nopar:Npn \char_make_invalid:n #1 { \char_set_catcode:nn {#1} {\c_fifteen} } \cs_new_eq:NN \char_set_mathcode:w \tex_mathcode:D \cs_new_protected_nopar:Npn \char_set_mathcode:nn #1#2 { - \char_set_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_mathcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_protected_nopar:Npn \char_gset_mathcode:w { \pref_global:D \tex_mathcode:D } \cs_new_protected_nopar:Npn \char_gset_mathcode:nn #1#2 { - \char_gset_mathcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_gset_mathcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_mathcode:w { \int_use:N \tex_mathcode:D } \cs_new_nopar:Npn \char_value_mathcode:n #1 { - \char_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_mathcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_mathcode:w { \tex_showthe:D \tex_mathcode:D } \cs_new_nopar:Npn \char_show_value_mathcode:n #1 { - \char_show_value_mathcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_mathcode:w \int_eval:w #1\int_eval_end: } \cs_new_eq:NN \char_set_lccode:w \tex_lccode:D \cs_new_protected_nopar:Npn \char_set_lccode:nn #1#2{ - \char_set_lccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_lccode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_lccode:w {\int_use:N\tex_lccode:D} \cs_new_nopar:Npn \char_value_lccode:n #1{\char_value_lccode:w - \intexpr_eval:w #1\intexpr_eval_end:} + \int_eval:w #1\int_eval_end:} \cs_new_nopar:Npn \char_show_value_lccode:w {\tex_showthe:D\tex_lccode:D} \cs_new_nopar:Npn \char_show_value_lccode:n #1{ - \char_show_value_lccode:w \intexpr_eval:w #1\intexpr_eval_end:} + \char_show_value_lccode:w \int_eval:w #1\int_eval_end:} \cs_new_eq:NN \char_set_uccode:w \tex_uccode:D \cs_new_protected_nopar:Npn \char_set_uccode:nn #1#2{ - \char_set_uccode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_uccode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_uccode:w {\int_use:N\tex_uccode:D} \cs_new_nopar:Npn \char_value_uccode:n #1{\char_value_uccode:w - \intexpr_eval:w #1\intexpr_eval_end:} + \int_eval:w #1\int_eval_end:} \cs_new_nopar:Npn \char_show_value_uccode:w {\tex_showthe:D\tex_uccode:D} \cs_new_nopar:Npn \char_show_value_uccode:n #1{ - \char_show_value_uccode:w \intexpr_eval:w #1\intexpr_eval_end:} + \char_show_value_uccode:w \int_eval:w #1\int_eval_end:} \cs_new_eq:NN \char_set_sfcode:w \tex_sfcode:D \cs_new_protected_nopar:Npn \char_set_sfcode:nn #1#2 { - \char_set_sfcode:w #1 = \intexpr_eval:w #2\intexpr_eval_end: + \char_set_sfcode:w #1 = \int_eval:w #2\int_eval_end: } \cs_new_nopar:Npn \char_value_sfcode:w { \int_use:N \tex_sfcode:D } \cs_new_nopar:Npn \char_value_sfcode:n #1 { - \char_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_value_sfcode:w \int_eval:w #1\int_eval_end: } \cs_new_nopar:Npn \char_show_value_sfcode:w { \tex_showthe:D \tex_sfcode:D } \cs_new_nopar:Npn \char_show_value_sfcode:n #1 { - \char_show_value_sfcode:w \intexpr_eval:w #1\intexpr_eval_end: + \char_show_value_sfcode:w \int_eval:w #1\int_eval_end: } \cs_new_protected_nopar:Npn \token_new:Nn #1#2 {\cs_new_eq:NN #1#2} \cs_new_eq:NN \c_group_begin_token { |