diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-27 00:38:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-27 00:38:35 +0000 |
commit | 6f75f25fe8d374ef4209118bd8849d742410ccd1 (patch) | |
tree | c485a2517a4fba54346c4492d4b34f0c8d815962 /Master/texmf-dist/source | |
parent | 36e4bf755052bf5d5cef33cc2ffbad8f00b22163 (diff) |
expl3 2047 (26sep10)
git-svn-id: svn://tug.org/texlive/trunk@19904 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
18 files changed, 741 insertions, 610 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/expl3.dtx b/Master/texmf-dist/source/latex/expl3/expl3.dtx index 9657e07811e..72764aa2dff 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 2020 2010-09-14 10:37:46Z joseph $ +\GetIdInfo$Id: expl3.dtx 2022 2010-09-16 13:00:35Z joseph $ {L3 Experimental code bundle wrapper}% %\iffalse %<*driver> @@ -861,9 +861,11 @@ % \end{macrocode} % % Load \pkg{etex} as otherwise we are likely to get into trouble -% with registers. +% with registers. Some inserts are reserved also as these have to +% be from the standard pool. % \begin{macrocode} \RequirePackage{etex} +\reserveinserts{32} % \end{macrocode} % %\begin{macro}{\@l@expl@check@declarations@bool} diff --git a/Master/texmf-dist/source/latex/expl3/l3basics.dtx b/Master/texmf-dist/source/latex/expl3/l3basics.dtx index 4bfc83ec33b..61d3170170e 100644 --- a/Master/texmf-dist/source/latex/expl3/l3basics.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3basics.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3basics.dtx Copyright (C) 1990-2008 LaTeX3 project +%% File: l3basics.dtx Copyright (C) 1990-2008,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 @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3basics.dtx 1992 2010-08-04 20:41:40Z joseph $ +\GetIdInfo$Id: l3basics.dtx 2037 2010-09-20 21:22:45Z joseph $ {L3 Experimental basic definitions} %\iffalse %<*driver> @@ -344,6 +344,41 @@ % This function checks that <cs> is defined. If it is not an error % is generated. % \end{function} +% +%\begin{function}{ +% \str_if_eq_p:nn / (EXP) | +% \str_if_eq_p:Vn / (EXP) | +% \str_if_eq_p:on / (EXP) | +% \str_if_eq_p:no / (EXP) | +% \str_if_eq_p:nV / (EXP) | +% \str_if_eq_p:VV / (EXP) | +% \str_if_eq_p:xx / (EXP) | +% \str_if_eq:nn / (EXP) (TF) | +% \str_if_eq:Vn / (EXP) (TF) | +% \str_if_eq:on / (EXP) (TF) | +% \str_if_eq:no / (EXP) (TF) | +% \str_if_eq:nV / (EXP) (TF) | +% \str_if_eq:VV / (EXP) (TF) | +% \str_if_eq:xx / (EXP) (TF) | +%} +% \begin{syntax} +% \cs{str_if_eq_p:nn} \Arg{tl1} \Arg{tl2} +% \cs{str_if_eq:nnTF} \Arg{tl1} \Arg{tl2} \Arg{true code} \Arg{false code} +% \end{syntax} +% Compares the two \meta{token lists} on a character by character +% basis, and is \texttt{true} if the two lists contain the same +% characters in the same order. Thus for example +% \begin{verbatim} +% \str_if_eq_p:xx { abc } { \tl_to_str:n { abc } } +% \end{verbatim} +% is logically \texttt{true}. 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. All versions of these functions are fully +% expandable (including those involving an \texttt{x}-type +% expansion). +%\end{function} % % \begin{variable}{ \c_true_bool | \c_false_bool } % \begin{syntax} @@ -352,25 +387,6 @@ % implement predicates. % \end{variable} % -% \subsection{Applications} -% -% \begin{function}{ \str_if_eq_p:nn / (EXP) } -% \begin{syntax} -% "\str_if_eq_p:nn" \Arg{string1} \Arg{string2} -% \end{syntax} -% Expands to `true' if <string1> is the same as <string2>, -% otherwise `false'. Ignores spaces within the strings. -% \end{function} -% -% \begin{function}{ \str_if_eq_var_p:nf / (EXP) } -% \begin{syntax} -% "\str_if_eq_var_p:nf" \Arg{string1} \Arg{string2} -% \end{syntax} -% A variant of "\str_if_eq_p:nn" which has the advantage of -% obeying spaces in at least the second argument. -% \end{function} -% -% % \section{Control sequences} % % \begin{function}{ \cs:w / (EXP) | \cs_end: / (EXP) } @@ -2036,13 +2052,13 @@ % like this (again getting TeX to remove the leading space for us): % \begin{macrocode} \cs_set_nopar:Npn \cs_to_str:N { - \if:w \exp_after:wN \cs_str_aux:w\token_to_str:N \a ax\q_nil + \if:w \exp_after:wN \cs_str_aux:w\token_to_str:N \a ax\q_stop \else: \exp_after:wN \exp_after:wN\exp_after:wN \use_ii:nn \fi: \exp_after:wN \use_none:n \token_to_str:N } -\cs_set:Npn \cs_str_aux:w #1#2#3#4\q_nil{#2#3} +\cs_set:Npn \cs_str_aux:w #1#2#3#4\q_stop{#2#3} % \end{macrocode} % \end{macro} % \end{macro} @@ -2077,7 +2093,7 @@ % \begin{macrocode} \cs_set:Npn \cs_split_function:NN #1#2{ \exp_after:wN \cs_split_function_aux:w - \tex_romannumeral:D -`\q \cs_to_str:N #1 @a \q_nil #2 + \tex_romannumeral:D -`\q \cs_to_str:N #1 @a \q_stop #2 } % \end{macrocode} % If no colon in the name, |#2| is |a| with catcode 11 and |#3| is @@ -2088,16 +2104,16 @@ % We can't use |\quark_if_no_value:NTF| yet but this is very safe % anyway as all tokens have catcode~12. % \begin{macrocode} -\cs_set:Npn \cs_split_function_aux:w #1@#2#3\q_nil#4{ +\cs_set:Npn \cs_split_function_aux:w #1@#2#3\q_stop#4{ \if_meaning:w a#2 \exp_after:wN \use_i:nn \else: \exp_after:wN\use_ii:nn \fi: {#4{#1}{}\c_false_bool} - {\cs_split_function_auxii:w#2#3\q_nil #4{#1}} + {\cs_split_function_auxii:w#2#3\q_stop #4{#1}} } -\cs_set:Npn \cs_split_function_auxii:w #1@a\q_nil#2#3{ +\cs_set:Npn \cs_split_function_auxii:w #1@a\q_stop#2#3{ #2{#3}{#1}\c_true_bool } % \end{macrocode} @@ -2187,7 +2203,7 @@ \cs_split_function:NN #1 \cs_if_do_not_use_aux:nnN } \cs_set:Npn \cs_if_do_not_use_aux:nnN #1#2#3{ - \exp_after:wN\str_if_eq_p:nn \token_to_str:N D {#2} + \str_if_eq_p:nn { D } {#2} } % \end{macrocode} % \end{macro} @@ -2377,95 +2393,43 @@ % \end{macro} % \end{macro} % -% -% \begin{macro}{\str_if_eq_p:nn} -% \begin{macro}[aux]{\str_if_eq_p_aux:w} -% Takes 2 lists of characters as arguments and expands into -% |\c_true_bool| if they are equal, and |\c_false_bool| otherwise. Note that -% in the current implementation spaces in these strings are -% ignored.\footnote{This is a function which could use -% \cs{tlist_compare:xx}.} +%\begin{macro}{\str_if_eq_p:nn} +%\begin{macro}[TF]{\str_if_eq:nn} +%\begin{macro}{\str_if_eq_p:xx} +%\begin{macro}[TF]{\str_if_eq:xx} +% Modern engines provide a direct way of comparing two token lists, +% but returning a number. This set of conditionals therefore make life +% a bit clearer. The \texttt{nn} and \texttt{xx} versions are created +% directly as this is most efficient. % \begin{macrocode} -\prg_set_conditional:Npnn \str_if_eq:nn #1#2{p}{ - \str_if_eq_p_aux:w #1\scan_stop:\\#2\scan_stop:\\ +\prg_set_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF } { + \tex_ifnum:D \pdf_strcmp:D + { \etex_unexpanded:D {#1} } { \etex_unexpanded:D {#2} } + = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: +} +\prg_set_conditional:Npnn \str_if_eq:xx #1#2 { p , T , F , TF } { + \tex_ifnum:D \pdf_strcmp:D {#1} {#2} = \c_zero + \prg_return_true: \else: \prg_return_false: \fi: } -\cs_set_nopar:Npn \str_if_eq_p_aux:w #1#2\\#3#4\\{ - \if_meaning:w#1#3 - \if_meaning:w#1\scan_stop:\prg_return_true: \else: - \if_meaning:w#3\scan_stop:\prg_return_false: \else: - \str_if_eq_p_aux:w #2\\#4\\\fi:\fi: - \else:\prg_return_false: \fi:} % \end{macrocode} -% \end{macro} -% \end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} % % \begin{macro}{\cs_if_eq_name_p:NN} % An application of the above function, already streamlined for -% speed, so I put it in here. It takes two control sequences as -% arguments and expands into true iff they have the same name. -% We make it long in case one of them is |\par|! +% speed, so I put it in here. % \begin{macrocode} \prg_set_conditional:Npnn \cs_if_eq_name:NN #1#2{p}{ - \exp_after:wN\exp_after:wN - \exp_after:wN\str_if_eq_p_aux:w - \exp_after:wN\token_to_str:N - \exp_after:wN#1 - \exp_after:wN\scan_stop: - \exp_after:wN\\ - \token_to_str:N#2\scan_stop:\\} -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\str_if_eq_var_p:nf} -% \begin{macro}[aux]{\str_if_eq_var_start:nnN} -% \begin{macro}[aux]{\str_if_eq_var_stop:w} -% A variant of |\str_if_eq_p:nn| which has the advantage of obeying -% spaces in at least the second argument. See \textsf{l3quark} for -% an application. From the hand of David Kastrup with slight -% modifications to make it fit with the remainder of the expl3 -% language. -% -% The macro builds a string of |\if:w \fi:| pairs from the first -% argument. The idea is to turn the comparison of |ab| and |cde| -% into -% \begin{verbatim} -% \tex_number:D -% \if:w \scan_stop: \if:w b\if:w a cde\scan_stop: '\fi: \fi: \fi: -% 13 -% \end{verbatim} -% The |'| is important here. If all tests are true, the |'| is read -% as part of the number in which case the returned number is |13| in -% octal notation so |\tex_number:D| returns |11|. If one test -% returns false the |'| is never seen and then we get just |13|. We -% wrap the whole process in an external |\if:w| in order to make it -% return either |\c_true_bool| or |\c_false_bool| since some parts of -% \textsf{l3prg} expect a predicate to return one of these two -% tokens. -% \begin{macrocode} -\prg_set_conditional:Npnn \str_if_eq_var:nf #1#2 {p} { - \if:w \tex_number:D\str_if_eq_var_start:nnN{}{}#1\scan_stop:{#2} -} -\cs_set_nopar:Npn\str_if_eq_var_start:nnN#1#2#3{ - \if:w#3\scan_stop:\exp_after:wN\str_if_eq_var_stop:w\fi: - \str_if_eq_var_start:nnN{\if:w#3#1}{#2\fi:} -} -\cs_set:Npn\str_if_eq_var_stop:w\str_if_eq_var_start:nnN#1#2#3{ - #1#3\scan_stop:'#213~\prg_return_true:\else:\prg_return_false:\fi: + \str_if_eq_p:nn {#1} {#2} } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% -% -% % % \subsection{More new definitions} % -% -% -% % \begin{macro}{\cs_new_nopar:Npn} % \begin{macro}{\cs_new_nopar:Npx} % \begin{macro}{\cs_new:Npn} @@ -2857,11 +2821,11 @@ \fi: { \exp_after:wN \cs_get_arg_count_from_signature_auxii:w - \use_none:nnnnnnnnn #2 9876543210\q_nil + \use_none:nnnnnnnnn #2 9876543210\q_stop } {-1} } -\cs_set:Npn \cs_get_arg_count_from_signature_auxii:w #1#2\q_nil{#1} +\cs_set:Npn \cs_get_arg_count_from_signature_auxii:w #1#2\q_stop{#1} % \end{macrocode} % A variant form we need right away. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3box.dtx b/Master/texmf-dist/source/latex/expl3/l3box.dtx index 8da3021541b..0a3538bf73e 100644 --- a/Master/texmf-dist/source/latex/expl3/l3box.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3box.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3box.dtx 2015 2010-09-03 17:45:09Z mittelba $ +\GetIdInfo$Id: l3box.dtx 2044 2010-09-22 03:34:46Z will $ {L3 Experimental Box module} %\iffalse %<*driver> @@ -250,6 +250,39 @@ % These are the \TeX{} primitives \tn{ht}, \tn{dp} and \tn{wd}. % \end{texnote} % \end{function} +% +%\begin{function}{ +% \box_set_dp:Nn | +% \box_set_dp:cn | +%} +% \begin{syntax} +% \cs{box_set_dp:Nn} \meta{box} \Arg{dimension expression} +% \end{syntax} +% Set the depth(below the baseline) of the \meta{box} to the value of +% the \Arg{dimension expression}. This is a local assignment. +%\end{function} +% +%\begin{function}{ +% \box_set_ht:Nn | +% \box_set_ht:cn | +%} +% \begin{syntax} +% \cs{box_set_ht:Nn} \meta{box} \Arg{dimension expression} +% \end{syntax} +% Set the height(above the baseline) of the \meta{box} to the value of +% the \Arg{dimension expression}. This is a local assignment. +%\end{function} +% +%\begin{function}{ +% \box_set_wd:Nn | +% \box_set_wd:cn | +%} +% \begin{syntax} +% \cs{box_set_wd:Nn} \meta{box} \Arg{dimension expression} +% \end{syntax} +% Set the width of the \meta{box} to the value of the +% \Arg{dimension expression}. This is a local assignment. +%\end{function} % % \begin{function}{% % \box_show:N | @@ -723,6 +756,33 @@ % \end{macro} % \end{macro} % \end{macro} +% +%\begin{macro}{\box_set_ht:Nn} +%\begin{macro}{\box_set_ht:cn} +%\begin{macro}{\box_set_wd:Nn} +%\begin{macro}{\box_set_wd:cn} +% Measuring is easy: all primitive work. These primitives are not +% expandable, so the derived functions are not either. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \box_set_dp:Nn #1#2 { + \box_dp:N #1 \etex_dimexpr:D #2 \scan_stop: +} +\cs_new_protected_nopar:Npn \box_set_ht:Nn #1#2 { + \box_ht:N #1 \etex_dimexpr:D #2 \scan_stop: +} +\cs_new_protected_nopar:Npn \box_set_wd:Nn #1#2 { + \box_wd:N #1 \etex_dimexpr:D #2 \scan_stop: +} +\cs_generate_variant:Nn \box_set_ht:Nn { c } +\cs_generate_variant:Nn \box_set_dp:Nn { c } +\cs_generate_variant:Nn \box_set_wd:Nn { c } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} % % \begin{macro}{\box_use_clear:N,\box_use_clear:c} % \begin{macro}{\box_use:N,\box_use:c} diff --git a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx index 8051fb7f340..ba857b1a91e 100644 --- a/Master/texmf-dist/source/latex/expl3/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3candidates.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3candidates.dtx Copyright (C) 2005-2009 LaTeX3 project +%% File: l3candidates.dtx Copyright (C) 2005-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 @@ -37,7 +37,7 @@ %</driver|package> %\fi \errorcontextlines=999 -\GetIdInfo$Id: l3candidates.dtx 1957 2010-06-15 06:33:43Z mittelba $ +\GetIdInfo$Id: l3candidates.dtx 2029 2010-09-19 13:59:02Z joseph $ {L3 Experimental 'extras' module} %\iffalse %<*driver> @@ -75,7 +75,24 @@ % Beware, then, that loading this package and using its contents may cause your % code to break down the track. % -% \section{Functions for functions} +% \section{Functions for characters} +% +% +% \begin{function}{\char_active_set:Npn|\char_active_gset:Npn} +% \begin{syntax} +% |\char_active_set:Npn|~<char>~<param>~<definition> +% \end{syntax} +% Makes <char> active and gives it the definition specified as if it were +% a function. +% \end{function} +% +% \begin{function}{\char_active_set_eq:NN|\char_active_gset_eq:NN} +% \begin{syntax} +% |\char_active_set:Npn|~<char>~<function> +% \end{syntax} +% Makes <char> active and makes it equal to <function>. +% (Or another active char, etc.) +% \end{function} % % % @@ -221,6 +238,32 @@ % \end{macrocode} % % +% \begin{macro}{\char_active_set:Npn,\char_active_set:Npx,\char_active_gset:Npn,\char_active_gset:Npx} +% \begin{macro}{\char_active_set_eq:NN,\char_active_gset_eq:NN} +% \begin{macrocode} +\group_begin: +\char_make_active:N \^^@ +\cs_set:Npn \char_tmp:NN { + \cs_gnew:Npn #1 ##1 { + \char_make_active:n {`##1} + \group_begin: + \tex_lccode:D `\^^@ `##1 + \tex_lowercase:D{\group_end: #2 ^^@} + } +} +\char_tmp:NN \char_active_set:Npn \cs_set:Npn +\char_tmp:NN \char_active_set:Npx \cs_set:Npx +\char_tmp:NN \char_active_gset:Npn \cs_gset:Npn +\char_tmp:NN \char_active_gset:Npx \cs_gset:Npx +\char_tmp:NN \char_active_set_eq:NN \cs_set_eq:NN +\char_tmp:NN \char_active_gset_eq:NN \cs_gset_eq:NN +\group_end: +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% % \begin{macro}{\tl_trim_spaces:n,\tl_trim_spaces:N} % \begin{macrocode} \cs_new:Npn \tl_trim_spaces:n #1 { @@ -370,7 +413,7 @@ \prg_new_conditional:Nnn \clist_if_in_numrange:nn {TF,T,F} { \bool_set_false:N \l_clist_numrange_bool \clist_map_inline:nn {#2} { - \_clist_numrange_parse:nw {#1} ##1 - \q_marker - \q_nil + \_clist_numrange_parse:nw {#1} ##1 - \q_nil - \q_stop } \bool_if:NTF \l_clist_numrange_bool \prg_return_true: \prg_return_false: } @@ -378,7 +421,7 @@ \bool_set_true:N \l_clist_numrange_bool \clist_map_break: } -\cs_set:Npn \_clist_numrange_parse:nw #1 #2 - #3 - #4 \q_nil { +\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:} }{ diff --git a/Master/texmf-dist/source/latex/expl3/l3clist.dtx b/Master/texmf-dist/source/latex/expl3/l3clist.dtx index c3167477819..a7337d63b32 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 1992 2010-08-04 20:41:40Z joseph $ +\GetIdInfo$Id: l3clist.dtx 2037 2010-09-20 21:22:45Z joseph $ {L3 Experimental comma separated lists} %\iffalse %<*driver> @@ -1029,7 +1029,7 @@ \cs_new_protected:Npn \clist_remove_element_aux:NNn #1#2#3 { \clist_clear:N \l_clist_remove_clist \cs_set:Npn \clist_remove_element_aux:n ##1 { - \tl_if_eq:nnF {#3} {##1} { + \str_if_eq:nnF {#3} {##1} { \clist_put_right:Nn \l_clist_remove_clist {##1} } } diff --git a/Master/texmf-dist/source/latex/expl3/l3doc.dtx b/Master/texmf-dist/source/latex/expl3/l3doc.dtx index 87bc748fb72..ae52fcdcc3d 100644 --- a/Master/texmf-dist/source/latex/expl3/l3doc.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3doc.dtx @@ -77,7 +77,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2004 2010-08-18 19:39:24Z joseph $ +\GetIdInfo$Id: l3doc.dtx 2037 2010-09-20 21:22:45Z joseph $ {L3 Experimental documentation class} %</driver|class> % @@ -807,7 +807,7 @@ Do not distribute a modified version of this file. \cs_set_nopar:Npn \doc_showmacro_aux_ii:w #1:#2:#3 \q_stop { \nextnewline - \tl_if_eq:xxTF {#1} {\g_doc_macro_tl} { + \str_if_eq:xxTF {#1} {\g_doc_macro_tl} { \doc_typeset_aux:n }{ \tl_gset:Nn \g_doc_macro_tl {#1} diff --git a/Master/texmf-dist/source/latex/expl3/l3expan.dtx b/Master/texmf-dist/source/latex/expl3/l3expan.dtx index 270c9758238..ca4c7d5acb9 100644 --- a/Master/texmf-dist/source/latex/expl3/l3expan.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3expan.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3expan.dtx Copyright (C) 1990-2009 LaTeX3 project +%% File: l3expan.dtx Copyright (C) 1990-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 @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3expan.dtx 1991 2010-08-04 19:49:35Z joseph $ +\GetIdInfo$Id: l3expan.dtx 2037 2010-09-20 21:22:45Z joseph $ {L3 Experimental Argument Expansion module} %\iffalse %<*driver> @@ -1077,15 +1077,15 @@ \cs_new_nopar:Npn \_cs_generate_variant_aux:Ncpx #1 { \exp_after:wN \_cs_generate_variant_aux:w - \tex_meaning:D #1 ? PROTECTEZ \q_nil + \tex_meaning:D #1 ? PROTECTEZ \q_stop } \cs_new_nopar:Npn \_cs_generate_variant_aux:ccpx { \exp_args:Nc \_cs_generate_variant_aux:Ncpx} \cs_new:Npn \_cs_generate_variant_aux:w - #1 ? PROTECTEZ #2 \q_nil + #1 ? PROTECTEZ #2 \q_stop { \exp_after:wN \tex_ifx:D \exp_after:wN - \q_nil \etex_detokenize:D {#1} \q_nil + \q_no_value \etex_detokenize:D {#1} \q_no_value \exp_after:wN \cs_new_protected_nopar:cpx \tex_else:D \exp_after:wN \cs_new_nopar:cpx @@ -1207,6 +1207,52 @@ %\end{macro} %\end{macro} % +%\subsection{Items held from earlier} +% +%\begin{macro}{\str_if_eq_p:Vn} +%\begin{macro}[TF]{\str_if_eq:Vn} +%\begin{macro}{\str_if_eq_p:on} +%\begin{macro}[TF]{\str_if_eq:on} +%\begin{macro}{\str_if_eq_p:nV} +%\begin{macro}[TF]{\str_if_eq:nV} +%\begin{macro}{\str_if_eq_p:no} +%\begin{macro}[TF]{\str_if_eq:no} +%\begin{macro}{\str_if_eq_p:VV} +%\begin{macro}[TF]{\str_if_eq:VV} +% These cannot come earlier as they need \cs{cs_generate_variant:Nn}. +% \begin{macrocode} +\cs_generate_variant:Nn \str_if_eq_p:nn { V } +\cs_generate_variant:Nn \str_if_eq_p:nn { o } +\cs_generate_variant:Nn \str_if_eq_p:nn { nV } +\cs_generate_variant:Nn \str_if_eq_p:nn { no } +\cs_generate_variant:Nn \str_if_eq_p:nn { VV } +\cs_generate_variant:Nn \str_if_eq:nnT { V } +\cs_generate_variant:Nn \str_if_eq:nnT { o } +\cs_generate_variant:Nn \str_if_eq:nnT { nV } +\cs_generate_variant:Nn \str_if_eq:nnT { no } +\cs_generate_variant:Nn \str_if_eq:nnT { VV } +\cs_generate_variant:Nn \str_if_eq:nnF { V } +\cs_generate_variant:Nn \str_if_eq:nnF { o } +\cs_generate_variant:Nn \str_if_eq:nnF { nV } +\cs_generate_variant:Nn \str_if_eq:nnF { no } +\cs_generate_variant:Nn \str_if_eq:nnF { VV } +\cs_generate_variant:Nn \str_if_eq:nnTF { V } +\cs_generate_variant:Nn \str_if_eq:nnTF { o } +\cs_generate_variant:Nn \str_if_eq:nnTF { nV } +\cs_generate_variant:Nn \str_if_eq:nnTF { no } +\cs_generate_variant:Nn \str_if_eq:nnTF { VV } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3fp.dtx b/Master/texmf-dist/source/latex/expl3/l3fp.dtx index 54013130760..9d9a06d7272 100644 --- a/Master/texmf-dist/source/latex/expl3/l3fp.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3fp.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3fp.dtx 2021 2010-09-14 15:59:54Z joseph $ +\GetIdInfo$Id: l3fp.dtx 2029 2010-09-19 13:59:02Z joseph $ {L3 Experimental floating-point operations} %\iffalse %<*driver> @@ -1058,23 +1058,23 @@ } \cs_new_protected_nopar:Npn \fp_split_sign: { \tex_ifnum:D \pdf_strcmp:D - { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_nil } { - } + { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_stop } { - } = \c_zero \tl_set:Nx \l_fp_tmp_tl { \exp_after:wN - \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_nil + \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop } \l_fp_split_sign_int -\l_fp_split_sign_int \exp_after:wN \fp_split_sign: \tex_else:D \tex_ifnum:D \pdf_strcmp:D - { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_nil } { + } + { \exp_after:wN \tl_head:w \l_fp_tmp_tl ? \q_stop } { + } = \c_zero \tl_set:Nx \l_fp_tmp_tl { \exp_after:wN - \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_nil + \tl_tail:w \l_fp_tmp_tl \prg_do_nothing: \q_stop } \exp_after:wN \exp_after:wN \exp_after:wN \fp_split_sign: diff --git a/Master/texmf-dist/source/latex/expl3/l3int.dtx b/Master/texmf-dist/source/latex/expl3/l3int.dtx index ae9c1cae3bc..10305ee5fe1 100644 --- a/Master/texmf-dist/source/latex/expl3/l3int.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3int.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3int.dtx Copyright (C) 1990-2009 LaTeX3 project +%% File: l3int.dtx Copyright (C) 1990-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 @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3int.dtx 1933 2010-05-25 00:26:38Z will $ +\GetIdInfo$Id: l3int.dtx 2029 2010-09-19 13:59:02Z joseph $ {L3 Experimental Integer module} %\iffalse %<*driver> @@ -1153,7 +1153,7 @@ % 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_nil + \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| @@ -1161,7 +1161,7 @@ % |#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_nil:NTF #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} } diff --git a/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx b/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx index 71801f8780d..d791e7ca02b 100644 --- a/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3intexpr.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3intexpr.dtx Copyright (C) 2009 LaTeX3 project +%% 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 @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3intexpr.dtx 1957 2010-06-15 06:33:43Z mittelba $ +\GetIdInfo$Id: l3intexpr.dtx 2045 2010-09-22 03:59:34Z will $ {L3 Integer Expressions} %\iffalse %<*driver> @@ -104,7 +104,7 @@ % \begin{center} % \begin{tabular}{ll@{\hspace{2cm}}ll} % Less than & "<" & Less than or equal & "<=" \\ -% Greater than & "<" & Greater than or equal & ">=" \\ +% Greater than & ">" & Greater than or equal & ">=" \\ % Equal & "==" or "=" & Not equal & "!=" % \end{tabular} % \end{center} @@ -392,7 +392,7 @@ % \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_stop #1#2 \q_nil + \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 @@ -402,7 +402,7 @@ % 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_stop{ +\cs_set:Npn \intexpr_compare_auxii:w #1#2#3\q_mark{ \use:c{ intexpr_compare_ #1 \if_meaning:w =#2 = \fi: @@ -413,7 +413,7 @@ % relation as delimiter for a delimited argument. % Equality is easy: % \begin{macrocode} -\cs_set:cpn {intexpr_compare_=:w} #1=#2\q_nil{ +\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: } @@ -421,25 +421,25 @@ % 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_nil{ +\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_nil{ +\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_nil{ +\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_nil{ +\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: } @@ -447,11 +447,11 @@ % 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_nil{ +\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_nil{ +\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: } diff --git a/Master/texmf-dist/source/latex/expl3/l3luatex.dtx b/Master/texmf-dist/source/latex/expl3/l3luatex.dtx index 471c573efd3..96ab4c8bab7 100644 --- a/Master/texmf-dist/source/latex/expl3/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3luatex.dtx @@ -394,32 +394,6 @@ %\end{macro} %\end{macro} %\end{macro} -% -%\begin{macro}{\ExplSyntaxOn} -% When using \LuaTeX, \cs{ExplSyntaxOn} can be redefined to used category -% code tables. -% \begin{macrocode} -\luatex_if_engine:T { - \cs_set_protected_nopar:Npn \ExplSyntaxOn - { - \tex_ifodd:D \ExplSyntaxStatus \scan_stop: - \tex_else:D - \cs_set_protected_nopar:Npx \ExplSyntaxOff - { - \cctab_end: - \tex_endlinechar:D = - \tex_the:D \tex_endlinechar:D \scan_stop: - \cs_set_protected:Npn \ExplSyntaxOff { } - \tl_set:Nn \exp_not:N \ExplSyntaxStatus { 0 } - } - \tl_set:Nn \ExplSyntaxStatus { 1 } - \cctab_begin:N \c_code_cctab - \tex_endlinechar:D = 32 \scan_stop: - \tex_fi:D - } -} -% \end{macrocode} -%\end{macro} % % \begin{macrocode} %</initex|package> diff --git a/Master/texmf-dist/source/latex/expl3/l3names.dtx b/Master/texmf-dist/source/latex/expl3/l3names.dtx index 659cf399330..22df0db9821 100644 --- a/Master/texmf-dist/source/latex/expl3/l3names.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3names.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3names.dtx Copyright (C) 1990-2006,2009 LaTeX3 project +%% File: l3names.dtx Copyright (C) 1990-2006,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 @@ -31,44 +31,19 @@ %% prior consultation with the LaTeX Project Team. %% %% ----------------------------------------------------------------------- -%^^A We need some basic initial character codes to be set up -%^^A immediately. +% +%^^A At least at the moment this code is needed as the code proper +%^^A starts with \GetInfoId %<*initex> \catcode`\{=1 % left brace is begin-group character \catcode`\}=2 % right brace is end-group character \catcode`\#=6 % hash mark is macro parameter character \catcode`\^=7 % circumflex is superscript character \catcode`\^^I=10 % ascii tab is a blank space -% Make \pdfstrcmp available in luatex -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname directlua\endcsname\relax -\else - \directlua - { - tex.enableprimitives('',tex.extraprimitives ()) - lua.bytecode[1]=function () - function pdfstrcmp (A, B) - if A == B then - tex.write("0") - elseif A < B then - tex.write("-1") - else - tex.write("1") - end - end - end - lua.bytecode[1]() - } - \everyjob{\directlua{lua.bytecode[1]()}} - \long\def\pdfstrcmp#1#2{% - \directlua - {pdfstrcmp("\luaescapestring{#1}","\luaescapestring{#2}")}% - } -\fi %</initex> %<package>\begingroup %<*initex|package> -\protected\def\GetIdInfo$#1${% +\def\GetIdInfo$#1${% \begingroup \def\GetIdInfoString{#1}% \def\IdInfoStringUnexp{Id}% @@ -79,10 +54,10 @@ \fi \next } -\protected\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${% +\def\GetIdInfoFull$#1 #2.#3 #4 #5 #6 #7${% \GetIdInfoAux #5\relax{#2}#5\relax{#4}% } -\protected\def\GetIdInfoAux #1#2#3#4#5#6\relax{% +\def\GetIdInfoAux #1#2#3#4#5#6\relax{% \ifx#5/% \expandafter\GetIdInfoAuxCVS \else @@ -91,13 +66,13 @@ } %</initex|package> %<*initex> -\protected\def\GetIdInfoAuxCVS #1#2\relax#3#4{% +\def\GetIdInfoAuxCVS #1#2\relax#3#4{% \immediate\write-1{#1; v#2, #3; #4}% } -\protected\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% +\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% \immediate\write-1{#1; #2/#3/#4 v#5 #6}% } -\protected\def\GetIdInfoMissing#1{% +\def\GetIdInfoMissing#1{% \gdef\fileversion{000}% \gdef\filedate{0000/00/00}% \gdef\filedescription{#1}% @@ -105,19 +80,19 @@ } %</initex> %<*package> -\protected\def\GetIdInfoAuxCVS #1#2\relax#3#4{% +\def\GetIdInfoAuxCVS #1#2\relax#3#4{% \gdef\fileversion{#3}% \gdef\filedate{#2}% \gdef\filedescription{#4}% \ProvidesPackage{#1}[#2 v#3 #4]% } -\protected\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% +\def\GetIdInfoAuxSVN #1#2-#3-#4\relax#5#6{% \gdef\fileversion{#5}% \gdef\filedate{#2/#3/#4}% \gdef\filedescription{#6}% \ProvidesPackage{#1}[#2/#3/#4 v#5 #6] } -\protected\def\GetIdInfoMissing#1{% +\def\GetIdInfoMissing#1{% \gdef\fileversion{000}% \gdef\filedate{0000/00/00}% \gdef\filedescription{#1}% @@ -128,20 +103,17 @@ \RequirePackage{l3names} %</driver> %\fi -\GetIdInfo$Id: l3names.dtx 1987 2010-07-25 14:55:46Z joseph $ +\GetIdInfo$Id: l3names.dtx 2034 2010-09-20 20:17:43Z joseph $ {L3 Experimental Naming Scheme for TeX Primitives} -% -% -% \iffalse %<package>\endgroup %<*driver> %\fi -\ProvidesFile{l3names.dtx} +\ProvidesFile{\filename.\filenameext} [\filedate\space v\fileversion\space\filedescription] %\iffalse \documentclass[full]{l3doc} \begin{document} -\DocInput{l3names.dtx} + \DocInput{\filename.\filenameext} \end{document} %</driver> % \fi @@ -272,40 +244,76 @@ % \begin{function}{\@pushfilename | \@popfilename} % Re-definitions of \LaTeX's file-loading functions to support "\ExplSyntax". % \end{function} +% +%\subsection{Bootstrap code} % -% \subsection{Package loading} +% The very first thing to do is to bootstrap the \IniTeX\ system so +% that everything else will actually work. \TeX\ does not start with +% some pretty basic character codes set up. +% \begin{macrocode} +%<*!package> +\catcode `\{ = 1 \relax +\catcode `\} = 2 \relax +\catcode `\# = 6 \relax +\catcode `\^ = 7 \relax +%</!package> +% \end{macrocode} % -% Before anything else, check that we're using \eTeX; -% no point continuing otherwise. +% Tab characters should not show up in the code, but to be on the +% safe side. % \begin{macrocode} -%<*initex|package> -\begingroup -\def\firstoftwo#1#2{#1} -\def\secondoftwo#1#2{#2} -\def\etexmissingerror{Not running under e-TeX} -\def\etexmissinghelp{% - This package requires e-TeX.^^J% - Try compiling the document with `elatex' instead of `latex'.^^J% - When using pdfTeX, try `pdfelatex' instead of `pdflatex'% -}% -\expandafter\ifx\csname eTeXversion\endcsname\relax - \expandafter\secondoftwo\else\expandafter\firstoftwo\fi - {\endgroup}{% -%<initex> \expandafter\errhelp\expandafter{\etexmissinghelp}% -%<initex> \expandafter\errmessage\expandafter{\etexmissingerror}% -%<package> \PackageError{l3names}{\etexmissingerror}{\etexmissinghelp}% - \endgroup - \endinput +%<*!package> +\catcode `\^^I = 10 \relax +%</!package> +% \end{macrocode} +% +% For \LuaTeX\ the extra primitives need to be enabled before +% they can be use. No \cs{ifdefined} yet, so do it the old-fashioned +% way. The primitive \cs{strcmp} is simulated using some \Lua\ +% code, which currently has to be applied to every job as the \Lua\ +% code is not part of the format. Thanks to Taco Hoekwater for this +% code. The odd \cs{csname} business is needed so that the later +% deletion code will work. +% \begin{macrocode} +%<*!package> +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax +\else + \directlua + { + tex.enableprimitives('',tex.extraprimitives ()) + lua.bytecode[1] = function () + function strcmp (A, B) + if A == B then + tex.write("0") + elseif A < B then + tex.write("-1") + else + tex.write("1") + end + end + end + lua.bytecode[1]() } -%</initex|package> + \everyjob\expandafter + {\csname tex_directlua:D\endcsname{lua.bytecode[1]()}} + \long\edef\pdfstrcmp#1#2% + {% + \expandafter\noexpand\csname tex_directlua:D\endcsname + {% + strcmp(% + "\noexpand\luaescapestring{#1}",% + "\noexpand\luaescapestring{#2}"% + )% + }% + } +\fi +%</!package> % \end{macrocode} -% -%\subsection{Lua\TeX\ work} -% -% When being used as a package, managing some Lua\TeX\ primitives has to -% work correctly with other packages. This is done by loading the -% \pkg{luatex} package and making the appropriate adjustments. +% When loaded as a package this can all be handed off to other +% \LaTeXe\ code. % \begin{macrocode} +%<*package> \def\@tempa{% \def\@tempa{}% \RequirePackage{luatex}% @@ -317,8 +325,61 @@ \else \expandafter\@tempa \fi +%</package> +% \end{macrocode} +% +% \XeTeX\ calls the primitive \cs{strcmp}, so there needs to be a +% check for that too. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup + \ifx\csname pdfstrcmp\endcsname\relax + \let\pdfstrcmp\strcmp +\fi % \end{macrocode} % +%\subsection{Requirements} +% +% Currently, the code requires the \eTeX\ primitives and functionality +% equivalent to \cs{pdfstrcmp}. Any package which provides the later +% will provide the former, so the test can be done only for +% \cs{pdfstrcmp}. +% \begin{macrocode} +\begingroup\expandafter\expandafter\expandafter\endgroup +\ifx\csname pdfstrcmp\endcsname\relax +%<*package> + \PackageError{l3names}{Required primitives not found} + {% + LaTeX3 requires the e-TeX primitives and + \string\pdfstrcmp.\MessageBreak + These are available in engine versions: \MessageBreak + - pdfTeX 1.30 \MessageBreak + - XeTeX 0.9994 \MessageBreak + - LuaTeX 0.60 \MessageBreak + or later. \MessageBreak + \MessageBreak + Loading of l3names will abort! + } +%</package> +%<*!package> + \newlinechar`\^^J\relax + \errhelp{% + LaTeX3 requires the e-TeX primitives and + \string\pdfstrcmp. ^^J + These are available in engine versions: ^^J + - pdfTeX 1.30 ^^J + - XeTeX 0.9994 ^^J + - LuaTeX 0.60 ^^J + or later. ^^J + For pdfTeX and XeTeX the '-etex' command-line switch is also + needed.^^J + ^^J + Format building will abort! + } +%</!package> + \expandafter\endinput +\fi +% \end{macrocode} +% % \subsection{Catcode assignments} % % Catcodes for begingroup, endgroup, macro parameter, superscript, and tab, @@ -1024,7 +1085,7 @@ \tex_endlinechar:D =32 \tex_relax:D % endline is space \tex_catcode:D 95=11 \tex_relax:D % underscore letter \tex_catcode:D 58=11 \tex_relax:D % colon letter - \tex_catcode:D 124=11 \tex_relax:D % vertical bar, other + \tex_catcode:D 124=12 \tex_relax:D % vertical bar, other \tex_catcode:D 38=4 \tex_relax:D % ampersand, alignment token \tex_catcode:D 94=7 \tex_relax:D % caret, math superscript \tex_catcode:D 34=12 \tex_relax:D % doublequote, other @@ -1176,7 +1237,7 @@ % as the packages in this distribution do like this: % \begin{verbatim} % \RequirePackage{l3names} -% \GetIdInfo$Id: l3names.dtx 1987 2010-07-25 14:55:46Z joseph $ +% \GetIdInfo$Id: l3names.dtx 2034 2010-09-20 20:17:43Z joseph $ % {L3 Experimental Box module} % \ProvidesExplPackage % {\filename}{\filedate}{\fileversion}{\filedescription} @@ -1279,7 +1340,7 @@ \tex_if:D 2\ExplSyntaxStack 2 \ExplSyntaxOff \tex_else:D - \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_nil + \tex_expandafter:D\ExplSyntaxPopStack\ExplSyntaxStack\q_stop \tex_fi:D } } @@ -1294,7 +1355,7 @@ % stack is initially empty set to 0 signalling that before % \pkg{l3names} was loaded, the ExplSyntax was off. % \begin{macrocode} -\etex_protected:D\tex_def:D\ExplSyntaxPopStack#1#2\q_nil{ +\etex_protected:D\tex_def:D\ExplSyntaxPopStack#1#2\q_stop{ \tex_def:D\ExplSyntaxStack{#2} \tex_ifodd:D#1\tex_relax:D \ExplSyntaxOn diff --git a/Master/texmf-dist/source/latex/expl3/l3prg.dtx b/Master/texmf-dist/source/latex/expl3/l3prg.dtx index 29dcded112d..09e841f9543 100644 --- a/Master/texmf-dist/source/latex/expl3/l3prg.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3prg.dtx @@ -1,5 +1,5 @@ % \iffalse -%% File: l3prg.dtx Copyright (C) 2005-2009 LaTeX3 project +%% File: l3prg.dtx Copyright (C) 2005-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 @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3prg.dtx 1992 2010-08-04 20:41:40Z joseph $ +\GetIdInfo$Id: l3prg.dtx 2043 2010-09-22 02:10:43Z will $ {L3 Experimental control structures} %\iffalse %<*driver> @@ -1269,7 +1269,7 @@ % this we call the Stop operation, denoted simply by a "S" % following the last Close operation. % \begin{macrocode} -\cs_set:Npn \bool_if_p:n #1{ +\cs_new:Npn \bool_if_p:n #1{ \group_align_safe_begin: \bool_get_next:N ( #1 )S } @@ -1277,7 +1277,7 @@ % The GetNext operation. We make it a switch: If not a "!" or "(", we % assume it is a predicate. % \begin{macrocode} -\cs_set:Npn \bool_get_next:N #1{ +\cs_new:Npn \bool_get_next:N #1{ \use:c { bool_ \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: @@ -1285,25 +1285,77 @@ } #1 } % \end{macrocode} +% This variant gets called when a \textsc{not} has just been entered. +% It (eventually) results in a reveral of the logic of the directly following +% material. +% \begin{macrocode} +\cs_new:Npn \bool_get_not_next:N #1{ + \use:c { + bool_not_ + \if_meaning:w !#1 ! \else: \if_meaning:w (#1 ( \else: p \fi: \fi: + :w + } #1 +} +% \end{macrocode} +% We need these later on to nullify the unity operation |!!|. +% \begin{macrocode} +\cs_new:Npn \bool_get_next:NN #1#2{ + \bool_get_next:N #2 +} +\cs_new:Npn \bool_get_not_next:NN #1#2{ + \bool_get_not_next:N #2 +} +% \end{macrocode} % The Not operation. Discard the token read and reverse the truth -% value of the next expression using "\intexpr_if_even_p:n" if there -% are brackets, otherwise reverse the logic here and now. +% value of the next expression if there +% are brackets; otherwise +% if we're coming up to a |!| then we don't need to reverse anything +% (but we then want to continue scanning ahead in case some fool has written +% |!!(...)|); +% otherwise we have a boolean that we can reverse here and now. % \begin{macrocode} -\cs_set:cpn { bool_!:w } #1#2 { +\cs_new:cpn { bool_!:w } #1#2 { \if_meaning:w ( #2 \exp_after:wN \bool_Not:w \else: \if_meaning:w ! #2 - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n + \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_next:NN \else: \exp_after:wN \exp_after:wN \exp_after:wN \bool_Not:N \fi: \fi: #2 } +% \end{macrocode} +% Variant called when already inside a \textsc{not}. +% Essentially the opposite of the above. +% \begin{macrocode} +\cs_new:cpn { bool_not_!:w } #1#2 { + \if_meaning:w ( #2 + \exp_after:wN \bool_not_Not:w + \else: + \if_meaning:w ! #2 + \exp_after:wN \exp_after:wN \exp_after:wN \bool_get_not_next:NN + \else: + \exp_after:wN \exp_after:wN \exp_after:wN \bool_not_Not:N + \fi: + \fi: + #2 +} +% \end{macrocode} +% These occur when processing |!(...)|. The idea is to use a variant +% of |\bool_get_next:N| that finishes its parsing with a logic reveral. +% Of course, the double logic reversal gets us back to where we started. +% \begin{macrocode} \cs_new:Npn \bool_Not:w { - \exp_after:wN \intexpr_if_even_p:n \tex_number:D \bool_get_next:N + \exp_after:wN \tex_number:D \bool_get_not_next:N +} +\cs_new:Npn \bool_not_Not:w { + \exp_after:wN \tex_number:D \bool_get_next:N } +% \end{macrocode} +% These occur when processing |!<bool>| and can be evaluated directly. +% \begin{macrocode} \cs_new:Npn \bool_Not:N #1 { \exp_after:wN \bool_p:w \if_meaning:w #1 \c_true_bool @@ -1311,19 +1363,33 @@ \else: \c_true_bool \fi: -} +} +\cs_new:Npn \bool_not_Not:N #1 { + \exp_after:wN \bool_p:w + \if_meaning:w #1 \c_true_bool + \c_true_bool + \else: + \c_false_bool + \fi: +} % \end{macrocode} % The Open operation. Discard the token read and start a % sub-expression. +% |\bool_get_next:N| continues building up the logical expressions as usual; +% |\bool_not_cleanup:N| is what reverses the logic if we're inside |!(...)|. % \begin{macrocode} -\cs_set:cpn {bool_(:w}#1{ +\cs_new:cpn {bool_(:w}#1{ \exp_after:wN \bool_cleanup:N \tex_number:D \bool_get_next:N } +\cs_new:cpn {bool_not_(:w}#1{ + \exp_after:wN \bool_not_cleanup:N \tex_number:D \bool_get_next:N +} % \end{macrocode} % Otherwise just evaluate the predicate and look for And, Or or Close % afterward. % \begin{macrocode} -\cs_set:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D } +\cs_new:cpn {bool_p:w}{\exp_after:wN \bool_cleanup:N \tex_number:D } +\cs_new:cpn {bool_not_p:w}{\exp_after:wN \bool_not_cleanup:N \tex_number:D } % \end{macrocode} % This cleanup function can be omitted once predicates return their % true/false booleans outside the conditionals. @@ -1332,15 +1398,25 @@ \exp_after:wN \bool_choose:NN \exp_after:wN #1 \int_to_roman:w-`\q } +\cs_new_nopar:Npn \bool_not_cleanup:N #1{ + \exp_after:wN \bool_not_choose:NN \exp_after:wN #1 + \int_to_roman:w-`\q +} % \end{macrocode} % Branching the six way switch. +% Reversals should be reasonably straightforward. +% When programming this, however, I got things around the wrong way a few times. +% (Will's hacks onto Morten's code, that is.) % \begin{macrocode} \cs_new_nopar:Npn \bool_choose:NN #1#2{ \use:c{bool_#2_#1:w} } +\cs_new_nopar:Npn \bool_not_choose:NN #1#2{ \use:c{bool_not_#2_#1:w} } % \end{macrocode} % Continues scanning. Must remove the second "&" or "|". % \begin{macrocode} \cs_new_nopar:cpn{bool_&_1:w}&{\bool_get_next:N} \cs_new_nopar:cpn{bool_|_0:w}|{\bool_get_next:N} +\cs_new_nopar:cpn{bool_not_&_0:w}&{\bool_get_next:N} +\cs_new_nopar:cpn{bool_not_|_1:w}|{\bool_get_next:N} % \end{macrocode} % Closing a group is just about returning the result. The Stop % operation is similar except it closes the special alignment group @@ -1348,6 +1424,8 @@ % \begin{macrocode} \cs_new_nopar:cpn{bool_)_0:w}{ \c_false_bool } \cs_new_nopar:cpn{bool_)_1:w}{ \c_true_bool } +\cs_new_nopar:cpn{bool_not_)_0:w}{ \c_true_bool } +\cs_new_nopar:cpn{bool_not_)_1:w}{ \c_false_bool } \cs_new_nopar:cpn{bool_S_0:w}{\group_align_safe_end: \c_false_bool } \cs_new_nopar:cpn{bool_S_1:w}{\group_align_safe_end: \c_true_bool } % \end{macrocode} @@ -1356,8 +1434,10 @@ % evaluation. This is slightly tricky as there are no braces so we % have to play match the "()" manually. % \begin{macrocode} -\cs_set:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} -\cs_set:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} +\cs_new:cpn{bool_&_0:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} +\cs_new:cpn{bool_|_1:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} +\cs_new:cpn{bool_not_&_1:w}&{\bool_eval_skip_to_end:Nw \c_false_bool} +\cs_new:cpn{bool_not_|_0:w}|{\bool_eval_skip_to_end:Nw \c_true_bool} % \end{macrocode} % \end{macro} % \end{macro} @@ -1433,15 +1513,15 @@ % to do simple pattern matching. With a new enough pdf\TeX\ one can do % that sort of thing to test for existence of particular tokens. % \begin{macrocode} -\cs_set:Npn \bool_eval_skip_to_end:Nw #1#2){ - \bool_eval_skip_to_end_aux:Nw #1 #2(\q_no_value\q_nil{#2} +\cs_new:Npn \bool_eval_skip_to_end:Nw #1#2){ + \bool_eval_skip_to_end_aux:Nw #1 #2(\q_no_value\q_stop{#2} } % \end{macrocode} % If no right parenthesis, then |#3| is no_value and we are done, return % the boolean |#1|. If there is, we need to grab a () pair and then % recurse % \begin{macrocode} -\cs_set:Npn \bool_eval_skip_to_end_aux:Nw #1#2(#3#4\q_nil#5{ +\cs_new:Npn \bool_eval_skip_to_end_aux:Nw #1#2(#3#4\q_stop#5{ \quark_if_no_value:NTF #3 { #1 } { \bool_eval_skip_to_end_auxii:Nw #1 #5 } @@ -1451,7 +1531,7 @@ % irrelevant, remove a () pair but remember to reinsert |#3| as it may % contain ( tokens! % \begin{macrocode} -\cs_set:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){ +\cs_new:Npn \bool_eval_skip_to_end_auxii:Nw #1#2(#3){ \bool_eval_skip_to_end:Nw #1#3 ) } % \end{macrocode} @@ -1598,7 +1678,7 @@ } \cs_new:Npn \prg_case_str_aux:nnn #1#2#3{ \quark_if_recursion_tail_stop_do:nn{#2}{\use:n} - \tl_if_eq:xxTF{#1}{#2} + \str_if_eq:xxTF{#1}{#2} { \prg_end_case:nw {#3} } { \prg_case_str_aux:nnn {#1}} } @@ -1792,9 +1872,9 @@ \group_end: \cs_new_nopar:Npn \prg_variable_get_scope:N #1 { \exp_last_unbraced:Nf \prg_variable_get_scope_aux:w - { \cs_to_str:N #1 \exp_stop_f: \q_nil } + { \cs_to_str:N #1 \exp_stop_f: \q_stop } } - \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_nil { + \cs_new_nopar:Npn \prg_variable_get_scope_aux:w #1#2 \q_stop { \token_if_eq_meaning:NNT & #1 {g} } } @@ -1805,13 +1885,13 @@ \group_end: \cs_new_nopar:Npn \prg_variable_get_type:N #1 { \exp_after:wN \p;rg_variable_get_type_aux:w - \token_to_str:N #1 & a \q_nil + \token_to_str:N #1 & a \q_stop } - \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_nil { + \cs_new_nopar:Npn \prg_variable_get_type_aux:w #1 & #2#3 \q_stop { \token_if_eq_meaning:NNTF a #2 { #1 }{ - \prg_variable_get_type_aux:w #2#3 \q_nil + \prg_variable_get_type_aux:w #2#3 \q_stop } } } diff --git a/Master/texmf-dist/source/latex/expl3/l3quark.dtx b/Master/texmf-dist/source/latex/expl3/l3quark.dtx index 954f903ca06..d5db2374451 100644 --- a/Master/texmf-dist/source/latex/expl3/l3quark.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3quark.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3quark.dtx 1853 2010-03-21 09:11:08Z joseph $ +\GetIdInfo$Id: l3quark.dtx 2036 2010-09-20 20:33:54Z joseph $ {L3 Experimental Quark Commands} %\iffalse %<*driver> @@ -303,7 +303,7 @@ % \begin{macrocode} \cs_new:Npn \quark_if_recursion_tail_stop:n #1 { \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail\q_recursion_tail + \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: } @@ -324,7 +324,7 @@ % \begin{macrocode} \cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1#2 { \exp_after:wN\if_meaning:w - \quark_if_recursion_tail_aux:w #1?\q_nil\q_recursion_tail\q_recursion_tail + \quark_if_recursion_tail_aux:w #1?\q_stop\q_recursion_tail\q_recursion_tail \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw \else: \exp_after:wN\use_none:n @@ -347,7 +347,7 @@ % % \begin{macro}[aux]{\quark_if_recursion_tail_aux:w} % \begin{macrocode} -\cs_new:Npn \quark_if_recursion_tail_aux:w #1#2 \q_nil \q_recursion_tail {#1} +\cs_new:Npn \quark_if_recursion_tail_aux:w #1#2 \q_stop \q_recursion_tail {#1} % \end{macrocode} % \end{macro} % @@ -364,38 +364,14 @@ \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} -% We also provide an |n| type. If run under a sufficiently new -% pdf\eTeX, it uses a built-in primitive for string comparisons, -% otherwise it uses the slower |\str_if_eq_var_p:nf| function. In the -% latter case it would be faster to use a temporary token list variable -% but it would render the function non-expandable. Using the pdf\eTeX\ -% primitive is the preferred approach. Note that we have to add a -% manual space token in the first part of the comparison, otherwise it -% is gobbled by |\str_if_eq_var_p:nf|. The reason for using this -% function instead of |\str_if_eq_p:nn| is that a sequence like -% \verb*+ \q_no_value+ will test equal to |\q_no_value| using the -% latter test function and unfortunately this example turned up in one -% application. +% These tests are easy with \cs{pdf_strcmp:D} available. % \begin{macrocode} -\cs_if_exist:cTF {pdf_strcmp:D} -{ - \prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} { - \if_num:w \pdf_strcmp:D - {\exp_not:N \q_no_value} - {\exp_not:n{#1}} = \c_zero - \prg_return_true: \else: \prg_return_false: - \fi: - } -} -{ - \prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} { - \exp_args:NNo - \if_predicate:w \str_if_eq_var_p:nf - {\token_to_str:N\q_no_value\c_space_tl} - {\tl_to_str:n{#1}} - \prg_return_true: \else: \prg_return_false: - \fi: - } +\prg_new_conditional:Nnn \quark_if_no_value:n {p,TF,T,F} { + \if_num:w \pdf_strcmp:D + {\exp_not:N \q_no_value} + {\exp_not:n{#1}} = \c_zero + \prg_return_true: \else: \prg_return_false: + \fi: } % \end{macrocode} % \end{macro} @@ -416,24 +392,12 @@ % \begin{macro}[TF]{\quark_if_nil:n,\quark_if_nil:V,\quark_if_nil:o} % A function to check for the presence of |\q_nil|. % \begin{macrocode} -\cs_if_exist:cTF {pdf_strcmp:D} { - \prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} { - \if_num:w \pdf_strcmp:D - {\exp_not:N \q_nil} - {\exp_not:n{#1}} = \c_zero - \prg_return_true: \else: \prg_return_false: - \fi: - } -} -{ - \prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} { - \exp_args:NNo - \if_predicate:w \str_if_eq_var_p:nf - {\token_to_str:N\q_nil\c_space_tl} - {\tl_to_str:n{#1}} - \prg_return_true: \else: \prg_return_false: - \fi: - } +\prg_new_conditional:Nnn \quark_if_nil:n {p,TF,T,F} { + \if_num:w \pdf_strcmp:D + {\exp_not:N \q_nil} + {\exp_not:n{#1}} = \c_zero + \prg_return_true: \else: \prg_return_false: + \fi: } \cs_generate_variant:Nn \quark_if_nil_p:n {V} \cs_generate_variant:Nn \quark_if_nil:nTF {V} diff --git a/Master/texmf-dist/source/latex/expl3/l3skip.dtx b/Master/texmf-dist/source/latex/expl3/l3skip.dtx index 572c4e919a1..af3a37564be 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 1933 2010-05-25 00:26:38Z will $ +\GetIdInfo$Id: l3skip.dtx 2047 2010-09-23 09:27:30Z will $ {L3 Experimental skip registers} %\iffalse %<*driver> @@ -408,6 +408,36 @@ % \end{texnote} % \end{function} % +%\begin{function}{ +% \dim_compare_p:n / (EXP) | +% \dim_compare:n / (TF) (EXP) +%} +% \begin{syntax} +% "\dim_compare_p:n" \Arg{<dim expr.\ 1> <rel> <dim expr.\ 2>} +% "\dim_compare:nTF" \Arg{<dim expr.\ 1> <rel> <dim expr.\ 2>} +% ~~~~<true code> <false code> +% \end{syntax} +% Evaluates <dim expr.\ 1> and <dim expr.\ 2> and then carries out a +% comparison of the resulting lengths 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 dimension expressions are evaluated +% fully in the process. Note the syntax, which allows natural input in +% the style of +% \begin{quote} +% |\dim_compare_p:n {2.54cm != \l_tmpb_int}| +% \end{quote} +% A single equals sign is available as comparator (in addition to those +% familiar to C users) as standard \TeX\ practice is to compare +% values using \texttt{=}. +% \end{function} +% % \begin{function}{ \dim_compare:nNn / (TF)(EXP) | \dim_compare_p:nNn / (EXP)} % \begin{syntax} % "\dim_compare:nNnTF" \Arg{dim~expr} <rel> \Arg{dim~expr} @@ -420,6 +450,10 @@ % \dim_compare:nNnTF \l_temp_dim < \c_zero_skip {negative}{non-negative} % \end{verbatim} % you can safely omit the braces. +% +% These functions are faster than the \texttt{n} +% variants described above but do not support an extended set +% of relational operators. % \begin{texnote} % This is the \TeX{} primitive \tn{ifdim} turned into a function. % \end{texnote} @@ -1019,6 +1053,114 @@ % \end{macro} % \end{macro} % +% \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} +% 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} +% \dim_compare_p:n { 5 + \l_tmpa_dim != 4 - \l_tmpb_dim } +% \end{verbatim} +% In other words, we want to somehow add the missing "\dim_eval:w" +% where required. We can start evaluating from the left using +% "\dim: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_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 +} +% \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_new:Npn \dim_compare_auxi:w #1#2 \q_stop { + \exp_after:wN \dim_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_new:Npn \dim_compare_auxii:w #1#2#3\q_mark{ + \use:c{ + dim_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_new:cpn {dim_compare_=:w} #1 = #2 \q_stop { + \if_dim_compare:w #1 sp = \dim_eval:w #2 \dim_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_new:cpn {dim_compare_==:w} #1 == #2 \q_stop { + \if_dim_compare: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: + \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: + \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: + \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_new:cpn {dim_compare_<=:w} #1 <= #2 \q_stop { + \if_dim_compare: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: + \prg_return_false: \else: \prg_return_true: \fi: +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% % \begin{macro}{\dim_while_do:nNnn} % \begin{macro}{\dim_until_do:nNnn} % \begin{macro}{\dim_do_while:nNnn} diff --git a/Master/texmf-dist/source/latex/expl3/l3tl.dtx b/Master/texmf-dist/source/latex/expl3/l3tl.dtx index 24b80f731bb..c7c84a531ae 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 1919 2010-05-22 05:56:38Z will $ +\GetIdInfo$Id: l3tl.dtx 2040 2010-09-21 18:11:09Z joseph $ {L3 Experimental Token Lists} %\iffalse %<*driver> @@ -380,51 +380,6 @@ % \end{function} % % -% \begin{function}{\tl_if_eq:nn / (TF)(EXP) | -% \tl_if_eq:nV / (TF)(EXP) | -% \tl_if_eq:no / (TF)(EXP) | -% \tl_if_eq:Vn / (TF)(EXP) | -% \tl_if_eq:on / (TF)(EXP) | -% \tl_if_eq:VV / (TF)(EXP) | -% \tl_if_eq:oo / (TF)(EXP) | -% \tl_if_eq:xx / (TF)(EXP) | -% \tl_if_eq:xn / (TF)(EXP) | -% \tl_if_eq:nx / (TF)(EXP) | -% \tl_if_eq:xV / (TF)(EXP) | -% \tl_if_eq:xo / (TF)(EXP) | -% \tl_if_eq:Vx / (TF)(EXP) | -% \tl_if_eq:ox / (TF)(EXP) } -% \begin{syntax} -% "\tl_if_eq:nnTF" \Arg{tlist1} \Arg{tlist2} \Arg{true code} \Arg{false code} -% \end{syntax} -% Execute <true code> if the two token lists <tlist1> and <tlist2> are -% identical. These functions are expandable if a new enough version of -% pdf\TeX\ is being used. -% \end{function}% -% -% \begin{function}{\tl_if_eq_p:nn / (EXP) | -% \tl_if_eq_p:nV / (EXP) | -% \tl_if_eq_p:no / (EXP) | -% \tl_if_eq_p:Vn / (EXP) | -% \tl_if_eq_p:on / (EXP) | -% \tl_if_eq_p:VV / (EXP) | -% \tl_if_eq_p:oo / (EXP) | -% \tl_if_eq_p:xx / (EXP) | -% \tl_if_eq_p:xn / (EXP) | -% \tl_if_eq_p:nx / (EXP) | -% \tl_if_eq_p:xV / (EXP) | -% \tl_if_eq_p:xo / (EXP) | -% \tl_if_eq_p:Vx / (EXP) | -% \tl_if_eq_p:ox / (EXP) } -% \begin{syntax} -% "\tl_if_eq_p:nn" \Arg{tlist1} \Arg{tlist2} -% \end{syntax} -% Predicates function which returns `true' if the two token list -% are identical and `false' otherwise. These are only defined if a new enough version -% of pdf\TeX\ is in use. -% \end{function} -% -% % \begin{function}{\tl_if_empty_p:n / (EXP) | % \tl_if_empty_p:V / (EXP) | % \tl_if_empty_p:o / (EXP) | @@ -438,6 +393,18 @@ % Execute <true code> if <\tlist> doesn't contain any tokens and <false % code> otherwise. % \end{function} +% +%\begin{function}{ \tl_if_eq:nn / (TF) } +% \begin{syntax} +% \cs{tl_if_eq:nnTF} \meta{token list1} \Arg{token list2} \Arg{true code} +% ~~\Arg{false code} +% \end{syntax} +% Tests if \meta{token list1} and \meta{token list2} both in +% respect of character codes and category codes. 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} % % \begin{function}{\tl_if_blank_p:n / (EXP)| % \tl_if_blank:n / (TF)(EXP)| @@ -752,13 +719,13 @@ % \begin{syntax} % "\tl_head:n" "{" <token1><token2>...<token\,$\sb k$> "}" \\ % "\tl_tail:n" "{" <token1><token2>...<token\,$\sb k$> "}" \\ -% "\tl_head:w" <token1><token2>...<token\,$\sb k$> "\q_nil" +% "\tl_head:w" <token1><token2>...<token\,$\sb k$> "\q_stop" % \end{syntax} % These functions return either the head or the tail from a list of tokens, thus in % the above example "\tl_head:n" would return <token1> and "\tl_tail:n" % would return <token2>\dots<token\,$\sb k$>. "\tl_head_iii:n" returns the first % three tokens. The ":w" versions require some care as they expect the token -% list to be delimited by "\q_nil". +% list to be delimited by "\q_stop". % \begin{texnote} % These are the Lisp functions "car" and "cdr" but with \LaTeX3 names. % \end{texnote} @@ -1395,6 +1362,30 @@ % \end{macrocode} % \end{macro} % \end{macro} +% +%\begin{macro}[TF]{\tl_if_eq:nn} +%\begin{macro}[aux]{\l_tl_tmpa_tl} +%\begin{macro}[aux]{\l_tl_tmpb_tl} +% A simple store and compare routine. +% \begin{macrocode} +\prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F , TF } { + \group_begin: + \tl_set:Nn \l_tl_tmpa_tl {#1} + \tl_set:Nn \l_tl_tmpb_tl {#2} + \tex_ifx:D \l_tl_tmpa_tl \l_tl_tmpb_tl + \group_end: + \prg_return_false: + \tex_else:D + \group_end: + \prg_return_false: + \tex_fi:D +} +\tl_new:N \l_tl_tmpa_tl +\tl_new:N \l_tl_tmpb_tl +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} % % % \begin{macro}{\tl_if_empty_p:n,\tl_if_empty_p:V,\tl_if_empty_p:o} @@ -1441,9 +1432,9 @@ % problem as the solutions in ``Around the Bend No~2''. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_blank:n #1 {p,TF,T,F} { - \exp_after:wN \tl_if_blank_p_aux:w \tl_to_str:n {#1} aa..\q_nil + \exp_after:wN \tl_if_blank_p_aux:w \tl_to_str:n {#1} aa..\q_stop } -\cs_new:Npn \tl_if_blank_p_aux:w #1#2 a #3#4 \q_nil { +\cs_new:Npn \tl_if_blank_p_aux:w #1#2 a #3#4 \q_stop { \if_meaning:w #3 #4 \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \tl_if_blank_p:n {V} @@ -1471,7 +1462,7 @@ \tl_if_blank:nTF {#1} {\prg_return_true:} { - \_tl_if_single_aux:w #1 \q_nil + \_tl_if_single_aux:w #1 \q_stop } } } @@ -1487,14 +1478,14 @@ \exp_after:wN \tl_if_blank:nTF #1 {\prg_return_true:} { - \exp_after:wN \_tl_if_single_aux:w #1 \q_nil + \exp_after:wN \_tl_if_single_aux:w #1 \q_stop } } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Npn \_tl_if_single_aux:w #1#2 \q_nil { +\cs_new:Npn \_tl_if_single_aux:w #1#2 \q_stop { \tl_if_empty:nTF {#2} \prg_return_true: \prg_return_false: } % \end{macrocode} @@ -1502,202 +1493,6 @@ % \end{macro} % % -% \begin{macro}[TF]{\tl_if_eq:xx,\tl_if_eq:nn,\tl_if_eq:VV,\tl_if_eq:oo, -% \tl_if_eq:xn,\tl_if_eq:nx,\tl_if_eq:on,\tl_if_eq:no, -% \tl_if_eq:Vn,\tl_if_eq:nV, -% \tl_if_eq:xV,\tl_if_eq:xo,\tl_if_eq:Vx,\tl_if_eq:ox} -% \begin{macro}{\tl_if_eq_p:xx,\tl_if_eq_p:nn,\tl_if_eq_p:VV,\tl_if_eq_p:oo, -% \tl_if_eq_p:xn,\tl_if_eq_p:nx,\tl_if_eq_p:Vn,\tl_if_eq_p:on, -% \tl_if_eq_p:nV,\tl_if_eq_p:no,\tl_if_eq_p:xV,\tl_if_eq_p:Vx, -% \tl_if_eq_p:xo,\tl_if_eq_p:ox} -% Test if two token lists are identical. pdf\TeX\ contains a most -% interesting primitive for expandable string comparison so we make -% use of it if available. Presumable it will be in the final -% version. -% -% Firstly we give it an appropriate name. Note that this primitive -% actually performs an \texttt{x} type expansion but it is still -% expandable! Hence we must program these functions backwards to add -% \verb|\exp_not:n|. We provide the combinations for the types -% \texttt{n}, \texttt{o} and \texttt{x}. -% \begin{macrocode} -\cs_new_eq:NN \tl_compare:xx \pdf_strcmp:D -\cs_new:Npn \tl_compare:nn #1#2{ - \tl_compare:xx{\exp_not:n{#1}}{\exp_not:n{#2}} -} -\cs_new:Npn \tl_compare:nx #1{ - \tl_compare:xx{\exp_not:n{#1}} -} -\cs_new:Npn \tl_compare:xn #1#2{ - \tl_compare:xx{#1}{\exp_not:n{#2}} -} -\cs_new:Npn \tl_compare:nV #1#2 { - \tl_compare:xx { \exp_not:n {#1} } { \exp_not:V #2 } -} -\cs_new:Npn \tl_compare:no #1#2{ - \tl_compare:xx{\exp_not:n{#1}}{\exp_not:n\exp_after:wN{#2}} -} -\cs_new:Npn \tl_compare:Vn #1#2 { - \tl_compare:xx { \exp_not:V #1 } { \exp_not:n {#2} } -} -\cs_new:Npn \tl_compare:on #1#2{ - \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{\exp_not:n{#2}} -} -\cs_new:Npn \tl_compare:VV #1#2 { - \tl_compare:xx { \exp_not:V #1 } { \exp_not:V #2 } -} -\cs_new:Npn \tl_compare:oo #1#2{ - \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{\exp_not:n\exp_after:wN{#2}} -} -\cs_new:Npn \tl_compare:xV #1#2 { - \tl_compare:xx {#1} { \exp_not:V #2 } -} -\cs_new:Npn \tl_compare:xo #1#2{ - \tl_compare:xx{#1}{\exp_not:n\exp_after:wN{#2}} -} -\cs_new:Npn \tl_compare:Vx #1#2 { - \tl_compare:xx { \exp_not:V #1 } {#2} -} -\cs_new:Npn \tl_compare:ox #1#2{ - \tl_compare:xx{\exp_not:n\exp_after:wN{#1}}{#2} -} -% \end{macrocode} -% Since we have a lot of basically identical functions to define we -% define one to define the rest. Unfortunately we aren't quite set up -% to use the new \verb|\tl_map_inline:nn| function yet. -% \begin{macrocode} -\cs_set_nopar:Npn \tl_tmp:w #1 { - \tl_set:Nx \l_kernel_tmpa_tl { - \exp_not:N \prg_new_conditional:Npnn \exp_not:c {tl_if_eq:#1} - ####1 ####2 {p,TF,T,F} { - \exp_not:N \tex_ifnum:D - \exp_not:c {tl_compare:#1} {####1}{####2} - \exp_not:n{ =\c_zero \prg_return_true: \else: \prg_return_false: \fi: } - } - } - \l_kernel_tmpa_tl -} -\tl_tmp:w{xx} \tl_tmp:w{nx} \tl_tmp:w{ox} \tl_tmp:w{Vx} -\tl_tmp:w{xn} \tl_tmp:w{nn} \tl_tmp:w{on} \tl_tmp:w{Vn} -\tl_tmp:w{xo} \tl_tmp:w{no} \tl_tmp:w{oo} -\tl_tmp:w{xV} \tl_tmp:w{nV} \tl_tmp:w{VV} -% \end{macrocode} -% However all of this only makes sense if we actually have that -% primitive. Therefore we disable it again if it is not there and -% define \verb|\tl_if_eq:nn| the old fashioned (and unexpandable) -% way. -% -% In some cases below, since arbitrary token lists could be being used in -% this function, you can't assume (as token list variables usually do) that there won't be -% any |#| tokens. Therefore, "\tl_set:Nx" and "\exp_not:n" is used instead -% of plain "\tl_set:Nn". -% -% \begin{macrocode} -\cs_if_exist:cF{pdf_strcmp:D}{ - \prg_set_protected_conditional:Npnn \tl_if_eq:nn #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:nV #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl { \exp_not:n {#1} } - \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 } - \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:no #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:nx #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:n{#1}} - \tl_set:Nx \l_kernel_testb_tl {#2} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:Vn #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 } - \tl_set:Nx \l_kernel_testb_tl { \exp_not:n{#2} } - \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:on #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:VV #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 } - \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 } - \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:oo #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:Vx #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl { \exp_not:V #1 } - \tl_set:Nx \l_kernel_testb_tl {#2} - \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:ox #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {\exp_not:o{#1}} - \tl_set:Nx \l_kernel_testb_tl {#2} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:xn #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {#1} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:n{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:xV #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {#1} - \tl_set:Nx \l_kernel_testb_tl { \exp_not:V #2 } - \if_meaning:w \l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:xo #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {#1} - \tl_set:Nx \l_kernel_testb_tl {\exp_not:o{#2}} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } - \prg_set_protected_conditional:Npnn \tl_if_eq:xx #1#2 {TF,T,F} { - \tl_set:Nx \l_kernel_testa_tl {#1} - \tl_set:Nx \l_kernel_testb_tl {#2} - \if_meaning:w\l_kernel_testa_tl \l_kernel_testb_tl - \prg_return_true: \else: \prg_return_false: - \fi: - } -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% % \subsection{Working with the contents of token lists} % % @@ -2232,16 +2027,16 @@ % These functions pick up either the head or the tail of a list. % "\tl_head_iii:n" returns the first three items on a list. % \begin{macrocode} -\cs_new:Npn \tl_head:n #1{\tl_head:w #1\q_nil} +\cs_new:Npn \tl_head:n #1{\tl_head:w #1\q_stop} \cs_new_eq:NN \tl_head_i:n \tl_head:n -\cs_new:Npn \tl_tail:n #1{\tl_tail:w #1\q_nil} +\cs_new:Npn \tl_tail:n #1{\tl_tail:w #1\q_stop} \cs_generate_variant:Nn \tl_tail:n {f} -\cs_new:Npn \tl_head_iii:n #1{\tl_head_iii:w #1\q_nil} +\cs_new:Npn \tl_head_iii:n #1{\tl_head_iii:w #1\q_stop} \cs_generate_variant:Nn \tl_head_iii:n {f} -\cs_new_eq:NN \tl_head:w \use_i_delimit_by_q_nil:nw +\cs_new:Npn \tl_head:w #1#2\q_stop{#1} \cs_new_eq:NN \tl_head_i:w \tl_head:w -\cs_new:Npn \tl_tail:w #1#2\q_nil{#2} -\cs_new:Npn \tl_head_iii:w #1#2#3#4\q_nil{#1#2#3} +\cs_new:Npn \tl_tail:w #1#2\q_stop{#2} +\cs_new:Npn \tl_head_iii:w #1#2#3#4\q_stop{#1#2#3} \cs_generate_variant:Nn \tl_head:n { V } \cs_generate_variant:Nn \tl_tail:n { V } % \end{macrocode} @@ -2277,7 +2072,7 @@ % equal but would also regard two primitives as equal. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 {p,TF,T,F} { - \exp_after:wN \if_meaning:w \tl_head:w #1 \q_nil #2 + \exp_after:wN \if_meaning:w \tl_head:w #1 \q_stop #2 \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -2287,14 +2082,14 @@ % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 {p,TF,T,F} { \exp_after:wN \if:w \exp_after:wN \exp_not:N - \tl_head:w #1 \q_nil \exp_not:N #2 + \tl_head:w #1 \q_stop \exp_not:N #2 \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} % Actually the default is already an |f| type expansion. % \begin{macrocode} %% \cs_new:Npn \tl_if_head_eq_charcode_p:fN #1#2{ -%% \exp_after:wN\if_charcode:w \tl_head:w #1\q_nil\exp_not:N#2 +%% \exp_after:wN\if_charcode:w \tl_head:w #1\q_stop\exp_not:N#2 %% \c_true_bool %% \else: %% \c_false_bool @@ -2314,7 +2109,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_eq_catcode:nN #1#2 {p,TF,T,F} { \exp_after:wN \if_catcode:w \exp_after:wN \exp_not:N - \tl_head:w #1 \q_nil \exp_not:N #2 + \tl_head:w #1 \q_stop \exp_not:N #2 \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/expl3/l3token.dtx b/Master/texmf-dist/source/latex/expl3/l3token.dtx index 14d84cb0122..fa1767465d4 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 1890 2010-04-11 03:37:15Z will $ +\GetIdInfo$Id: l3token.dtx 2029 2010-09-19 13:59:02Z joseph $ {L3 Experimental token investigation and manipulation} %\iffalse %<*driver> @@ -1165,9 +1165,9 @@ % be a problem! % \begin{macrocode} \prg_new_conditional:Nnn \token_if_macro:N {p,TF,T,F} { - \exp_after:wN \token_if_macro_p_aux:w \token_to_meaning:N #1 -> \q_nil + \exp_after:wN \token_if_macro_p_aux:w \token_to_meaning:N #1 -> \q_stop } -\cs_new_nopar:Npn \token_if_macro_p_aux:w #1 -> #2 \q_nil{ +\cs_new_nopar:Npn \token_if_macro_p_aux:w #1 -> #2 \q_stop{ \if_predicate:w \tl_if_empty_p:n{#2} \prg_return_false: \else: \prg_return_true: \fi: } @@ -1260,9 +1260,9 @@ % \begin{macrocode} \prg_new_conditional:Nnn \token_if_chardef:N {p,TF,T,F} { \exp_after:wN \token_if_chardef_aux:w - \token_to_meaning:N #1?CHAR"\q_nil + \token_to_meaning:N #1?CHAR"\q_stop } -\cs_new_nopar:Npn \token_if_chardef_aux:w #1?CHAR"#2\q_nil{ +\cs_new_nopar:Npn \token_if_chardef_aux:w #1?CHAR"#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1270,9 +1270,9 @@ % \begin{macrocode} \prg_new_conditional:Nnn \token_if_mathchardef:N {p,TF,T,F} { \exp_after:wN \token_if_mathchardef_aux:w - \token_to_meaning:N #1?MAYHCHAR"\q_nil + \token_to_meaning:N #1?MAYHCHAR"\q_stop } -\cs_new_nopar:Npn \token_if_mathchardef_aux:w #1?MAYHCHAR"#2\q_nil{ +\cs_new_nopar:Npn \token_if_mathchardef_aux:w #1?MAYHCHAR"#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1285,10 +1285,10 @@ \prg_return_false: \else: \exp_after:wN \token_if_int_register_aux:w - \token_to_meaning:N #1?COUXY\q_nil + \token_to_meaning:N #1?COUXY\q_stop \fi: } -\cs_new_nopar:Npn \token_if_int_register_aux:w #1?COUXY#2\q_nil{ +\cs_new_nopar:Npn \token_if_int_register_aux:w #1?COUXY#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1299,10 +1299,10 @@ \prg_return_false: \else: \exp_after:wN \token_if_skip_register_aux:w - \token_to_meaning:N #1?SKIP\q_nil + \token_to_meaning:N #1?SKIP\q_stop \fi: } -\cs_new_nopar:Npn \token_if_skip_register_aux:w #1?SKIP#2\q_nil{ +\cs_new_nopar:Npn \token_if_skip_register_aux:w #1?SKIP#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1313,10 +1313,10 @@ \c_false_bool \else: \exp_after:wN \token_if_dim_register_aux:w - \token_to_meaning:N #1?ZIMEX\q_nil + \token_to_meaning:N #1?ZIMEX\q_stop \fi: } -\cs_new_nopar:Npn \token_if_dim_register_aux:w #1?ZIMEX#2\q_nil{ +\cs_new_nopar:Npn \token_if_dim_register_aux:w #1?ZIMEX#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1327,10 +1327,10 @@ \prg_return_false: \else: \exp_after:wN \token_if_toks_register_aux:w - \token_to_meaning:N #1?YOKS\q_nil + \token_to_meaning:N #1?YOKS\q_stop \fi: } -\cs_new_nopar:Npn \token_if_toks_register_aux:w #1?YOKS#2\q_nil{ +\cs_new_nopar:Npn \token_if_toks_register_aux:w #1?YOKS#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1338,9 +1338,9 @@ % \begin{macrocode} \prg_new_conditional:Nnn \token_if_protected_macro:N {p,TF,T,F} { \exp_after:wN \token_if_protected_macro_aux:w - \token_to_meaning:N #1?PROYECYEZ~MACRO\q_nil + \token_to_meaning:N #1?PROYECYEZ~MACRO\q_stop } -\cs_new_nopar:Npn \token_if_protected_macro_aux:w #1?PROYECYEZ~MACRO#2\q_nil{ +\cs_new_nopar:Npn \token_if_protected_macro_aux:w #1?PROYECYEZ~MACRO#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1348,9 +1348,9 @@ % \begin{macrocode} \prg_new_conditional:Nnn \token_if_long_macro:N {p,TF,T,F} { \exp_after:wN \token_if_long_macro_aux:w - \token_to_meaning:N #1?LOXG~MACRO\q_nil + \token_to_meaning:N #1?LOXG~MACRO\q_stop } -\cs_new_nopar:Npn \token_if_long_macro_aux:w #1?LOXG~MACRO#2\q_nil{ +\cs_new_nopar:Npn \token_if_long_macro_aux:w #1?LOXG~MACRO#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1359,10 +1359,10 @@ % \begin{macrocode} \prg_new_conditional:Nnn \token_if_protected_long_macro:N {p,TF,T,F} { \exp_after:wN \token_if_protected_long_macro_aux:w - \token_to_meaning:N #1?PROYECYEZ?LOXG~MACRO\q_nil + \token_to_meaning:N #1?PROYECYEZ?LOXG~MACRO\q_stop } \cs_new_nopar:Npn \token_if_protected_long_macro_aux:w #1 - ?PROYECYEZ?LOXG~MACRO#2\q_nil{ + ?PROYECYEZ?LOXG~MACRO#2\q_stop{ \tl_if_empty:nTF {#1} {\prg_return_true:} {\prg_return_false:} } % \end{macrocode} @@ -1400,25 +1400,25 @@ \char_set_catcode:nn{`\O}{12} \tl_to_lowercase:n{ \group_end: - \cs_new_nopar:Npn \token_get_prefix_arg_replacement_aux:w #1MACRO?#2->#3\q_nil#4{ + \cs_new_nopar:Npn \token_get_prefix_arg_replacement_aux:w #1MACRO?#2->#3\q_stop#4{ #4{#1}{#2}{#3} } \cs_new_nopar:Npn\token_get_prefix_spec:N #1{ \token_if_macro:NTF #1{ \exp_after:wN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_i:nnn + \token_to_meaning:N #1\q_stop\use_i:nnn }{\scan_stop:} } \cs_new_nopar:Npn\token_get_arg_spec:N #1{ \token_if_macro:NTF #1{ \exp_after:wN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_ii:nnn + \token_to_meaning:N #1\q_stop\use_ii:nnn }{\scan_stop:} } \cs_new_nopar:Npn\token_get_replacement_spec:N #1{ \token_if_macro:NTF #1{ \exp_after:wN \token_get_prefix_arg_replacement_aux:w - \token_to_meaning:N #1\q_nil\use_iii:nnn + \token_to_meaning:N #1\q_stop\use_iii:nnn }{\scan_stop:} } } diff --git a/Master/texmf-dist/source/latex/expl3/l3toks.dtx b/Master/texmf-dist/source/latex/expl3/l3toks.dtx index 8faade60b58..6b8e47df71c 100644 --- a/Master/texmf-dist/source/latex/expl3/l3toks.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3toks.dtx @@ -36,7 +36,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3toks.dtx 1933 2010-05-25 00:26:38Z will $ +\GetIdInfo$Id: l3toks.dtx 2037 2010-09-20 21:22:45Z joseph $ {L3 Experimental Token Registers} %\iffalse %<*driver> @@ -591,7 +591,7 @@ % token, which is then later removed. % \begin{macrocode} \cs_new_protected_nopar:Npn \toks_put_left:Nn #1 { - \exp_after:wN \toks_put_left_aux:w \exp_after:wN \q_mark + \exp_after:wN \toks_put_left_aux:w \exp_after:wN \q_nil \toks_use:N #1 \q_stop #1 } % \end{macrocode} @@ -744,7 +744,7 @@ % This function test whether two token registers have the same contents. % \begin{macrocode} \prg_new_conditional:Nnn \toks_if_eq:NN {p,TF,T,F} { - \tl_if_eq:xxTF {\toks_use:N #1} {\toks_use:N #2} + \str_if_eq:xxTF {\toks_use:N #1} {\toks_use:N #2} {\prg_return_true:} {\prg_return_false:} } \cs_generate_variant:Nn \toks_if_eq_p:NN {Nc,c,cc} |