summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx222
1 files changed, 152 insertions, 70 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index 7e752aadf43..9a19df41122 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
@@ -38,7 +38,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3candidates.dtx 6216 2015-11-01 23:32:43Z bruno $
+\GetIdInfo$Id: l3candidates.dtx 6325 2015-12-20 18:07:35Z joseph $
{L3 Experimental additions to l3kernel}
%</driver|package>
%<*driver>
@@ -576,15 +576,15 @@
%
% \section{Additions to \pkg{l3prg}}
%
-% Minimal (lazy) evaluation can be obtained using the functions
-% \cs{bool_all_p:n}, \cs{bool_and_p:nn}, \cs{bool_any_p:n}, or
-% \cs{bool_or_p:nn}, which only evaluate their boolean expression
+% Minimal (lazy) evaluation can be obtained using the conditionals
+% \cs{bool_lazy_all:nTF}, \cs{bool_lazy_and:nnTF}, \cs{bool_lazy_any:nTF}, or
+% \cs{bool_lazy_or:nnTF}, which only evaluate their boolean expression
% arguments when they are needed to determine the resulting truth
% value. For example, when evaluating the boolean expression
% \begin{verbatim}
-% \bool_and_p:nn
+% \bool_lazy_and_p:nn
% {
-% \bool_any_p:n
+% \bool_lazy_any_p:n
% {
% { \int_compare_p:n { 2 = 3 } }
% { \int_compare_p:n { 4 <= 4 } }
@@ -594,58 +594,62 @@
% { ! \int_compare_p:n { 2 = 4 } }
% \end{verbatim}
% the line marked with |is skipped| is not expanded because the result
-% of \cs{bool_any_p:n} is known once the second boolean expression is
+% of \cs{bool_lazy_any_p:n} is known once the second boolean expression is
% found to be logically \texttt{true}. On the other hand, the last
% line is expanded because its logical value is needed to determine the
-% result of \cs{bool_and_p:nn}.
+% result of \cs{bool_lazy_and_p:nn}.
%
-% \begin{function}[EXP, added = 2015-09-28]{\bool_all_p:n}
+% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_all:n}
% \begin{syntax}
-% \cs{bool_all_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \}
+% \cs{bool_lazy_all_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \}
+% \cs{bool_lazy_all:nTF} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} \Arg{true code} \Arg{false code}
% \end{syntax}
% Implements the \enquote{And} operation on the \meta{boolean
% expressions}, hence is \texttt{true} if all of them are
% \texttt{true} and \texttt{false} if any of them is \texttt{false}.
% Contrarily to the infix operator |&&|, only the \meta{boolean
% expressions} which are needed to determine the result of
-% \cs{bool_all_p:n} will be evaluated. See also \cs{bool_and_p:nn}
+% \cs{bool_lazy_all:nTF} will be evaluated. See also \cs{bool_lazy_and:nnTF}
% when there are only two \meta{boolean expressions}.
% \end{function}
%
-% \begin{function}[EXP, added = 2015-09-28]{\bool_and_p:nn}
+% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_and:nn}
% \begin{syntax}
-% \cs{bool_and_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+% \cs{bool_lazy_and_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+% \cs{bool_lazy_and:nnTF} \Arg{boolexpr_1} \Arg{boolexpr_2} \Arg{true code} \Arg{false code}
% \end{syntax}
% Implements the \enquote{And} operation between two boolean
% expressions, hence is \texttt{true} if both are \texttt{true}.
% Contrarily to the infix operator |&&|, the \meta{boolexpr_2} will
% only be evaluated if it is needed to determine the result of
-% \cs{bool_and_p:nn}. See also \cs{bool_all_p:n} when there are more
+% \cs{bool_lazy_and:nnTF}. See also \cs{bool_lazy_all:nTF} when there are more
% than two \meta{boolean expressions}.
% \end{function}
%
-% \begin{function}[EXP, added = 2015-09-28]{\bool_any_p:n}
+% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_any:n}
% \begin{syntax}
-% \cs{bool_any_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \}
+% \cs{bool_lazy_any_p:n} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \}
+% \cs{bool_lazy_any:nTF} \{ \Arg{boolexpr_1} \Arg{boolexpr_2} $\cdots$ \Arg{boolexpr_N} \} \Arg{true code} \Arg{false code}
% \end{syntax}
% Implements the \enquote{Or} operation on the \meta{boolean
% expressions}, hence is \texttt{true} if any of them is
% \texttt{true} and \texttt{false} if all of them are \texttt{false}.
% Contrarily to the infix operator \verb"||", only the \meta{boolean
% expressions} which are needed to determine the result of
-% \cs{bool_any_p:n} will be evaluated. See also \cs{bool_or_p:nn}
+% \cs{bool_lazy_any:nTF} will be evaluated. See also \cs{bool_lazy_or:nnTF}
% when there are only two \meta{boolean expressions}.
% \end{function}
%
-% \begin{function}[EXP, added = 2015-09-28]{\bool_or_p:nn}
+% \begin{function}[EXP, pTF, added = 2015-11-15]{\bool_lazy_or:nn}
% \begin{syntax}
-% \cs{bool_or_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+% \cs{bool_lazy_or_p:nn} \Arg{boolexpr_1} \Arg{boolexpr_2}
+% \cs{bool_lazy_or:nnTF} \Arg{boolexpr_1} \Arg{boolexpr_2} \Arg{true code} \Arg{false code}
% \end{syntax}
% Implements the \enquote{Or} operation between two boolean
% expressions, hence is \texttt{true} if either one is \texttt{true}.
% Contrarily to the infix operator \verb"||", the \meta{boolexpr_2}
% will only be evaluated if it is needed to determine the result of
-% \cs{bool_or_p:nn}. See also \cs{bool_any_p:n} when there are more
+% \cs{bool_lazy_or:nnTF}. See also \cs{bool_lazy_any:nTF} when there are more
% than two \meta{boolean expressions}.
% \end{function}
%
@@ -1085,8 +1089,11 @@
%
% \section{Additions to \pkg{l3tokens}}
%
-% \begin{function}[updated = 2015-09-01]
-% {\char_set_active_eq:NN, \char_gset_active_eq:NN}
+% \begin{function}[updated = 2015-11-12]
+% {
+% \char_set_active_eq:NN, \char_set_active_eq:Nc,
+% \char_gset_active_eq:NN, \char_gset_active_eq:Nc
+% }
% \begin{syntax}
% \cs{char_set_active_eq:NN} \meta{char} \meta{function}
% \end{syntax}
@@ -1097,8 +1104,11 @@
% be an active character.
% \end{function}
%
-% \begin{function}[added = 2015-09-02]
-% {\char_set_active_eq:nN, \char_gset_active_eq:nN}
+% \begin{function}[added = 2015-11-12]
+% {
+% \char_set_active_eq:nN, \char_set_active_eq:nc
+% \char_gset_active_eq:nN, \char_gset_active_eq:nc
+% }
% \begin{syntax}
% \cs{char_set_active_eq:nN} \Arg{integer expression} \meta{function}
% \end{syntax}
@@ -2557,57 +2567,65 @@
%<@@=bool>
% \end{macrocode}
%
-% \begin{macro}{\bool_all_p:n}
-% \begin{macro}[aux]{\@@_all_aux:n}
+% \begin{macro}[pTF]{\bool_lazy_all:n}
+% \begin{macro}[aux]{\@@_lazy_all:n}
% Go through the list of expressions, stopping whenever an expression
% is \texttt{false}. If the end is reached without finding any
% \texttt{false} expression, then the result is \texttt{true}.
% \begin{macrocode}
-\cs_new:Npn \bool_all_p:n #1
- { \@@_all_aux:n #1 \q_recursion_tail \q_recursion_stop }
-\cs_new:Npn \@@_all_aux:n #1
+\prg_new_conditional:Npnn \bool_lazy_all:n #1 { p , T , F , TF }
+ { \@@_lazy_all:n #1 \q_recursion_tail \q_recursion_stop }
+\cs_new:Npn \@@_lazy_all:n #1
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \c_true_bool }
+ \quark_if_recursion_tail_stop_do:nn {#1} { \prg_return_true: }
\bool_if:nF {#1}
- { \use_i_delimit_by_q_recursion_stop:nw { \c_false_bool } }
- \@@_all_aux:n
+ { \use_i_delimit_by_q_recursion_stop:nw { \prg_return_false: } }
+ \@@_lazy_all:n
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\bool_and_p:nn}
+% \begin{macro}[pTF]{\bool_lazy_and:nn}
% Only evaluate the second expression if the first is \texttt{true}.
% \begin{macrocode}
-\cs_new:Npn \bool_and_p:nn #1#2
- { \bool_if:nTF {#1} { \bool_if_p:n {#2} } { \c_false_bool } }
+\prg_new_conditional:Npnn \bool_lazy_and:nn #1#2 { p , T , F , TF }
+ {
+ \bool_if:nTF {#1}
+ { \bool_if:nTF {#2} { \prg_return_true: } { \prg_return_false: } }
+ { \prg_return_false: }
+ }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\bool_any_p:n}
-% \begin{macro}[aux]{\@@_any_aux:n}
+% \begin{macro}[pTF]{\bool_lazy_any:n}
+% \begin{macro}[aux]{\@@_lazy_any:n}
% Go through the list of expressions, stopping whenever an expression
% is \texttt{true}. If the end is reached without finding any
% \texttt{true} expression, then the result is \texttt{false}.
% \begin{macrocode}
-\cs_new:Npn \bool_any_p:n #1
- { \@@_any_aux:n #1 \q_recursion_tail \q_recursion_stop }
-\cs_new:Npn \@@_any_aux:n #1
+\prg_new_conditional:Npnn \bool_lazy_any:n #1 { p , T , F , TF }
+ { \@@_lazy_any:n #1 \q_recursion_tail \q_recursion_stop }
+\cs_new:Npn \@@_lazy_any:n #1
{
- \quark_if_recursion_tail_stop_do:nn {#1} { \c_false_bool }
+ \quark_if_recursion_tail_stop_do:nn {#1} { \prg_return_false: }
\bool_if:nT {#1}
- { \use_i_delimit_by_q_recursion_stop:nw { \c_true_bool } }
- \@@_any_aux:n
+ { \use_i_delimit_by_q_recursion_stop:nw { \prg_return_true: } }
+ \@@_lazy_any:n
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\bool_or_p:nn}
+% \begin{macro}[pTF]{\bool_lazy_or:nn}
% Only evaluate the second expression if the first is \texttt{false}.
% \begin{macrocode}
-\cs_new:Npn \bool_or_p:nn #1#2
- { \bool_if:nTF {#1} { \c_true_bool } { \bool_if_p:n {#2} } }
+\prg_new_conditional:Npnn \bool_lazy_or:nn #1#2 { p , T , F , TF }
+ {
+ \bool_if:nTF {#1}
+ { \prg_return_true: }
+ { \bool_if:nTF {#2} { \prg_return_true: } { \prg_return_false: } }
+ }
% \end{macrocode}
% \end{macro}
%
@@ -3013,7 +3031,7 @@
% The mechanisms needed for case changing are somewhat involved, particularly
% to allow for all of the special cases. These functions also require the
% appropriate data extracted from the Unicode documentation (either manually
-% or automatically), which is covered by \pkg{l3unicode-data}.
+% or automatically).
%
% \begin{macro}[EXP]{\tl_if_head_eq_catcode:oNTF}
% Extra variants.
@@ -3061,8 +3079,10 @@
% \begin{macro}[aux, EXP]{\@@_change_case_math_space:wNNnn}
% \begin{macro}[aux, EXP]{\@@_change_case_N_type:Nnnn}
% \begin{macro}[aux, EXP]{\@@_change_case_char:Nnn}
-% \begin{macro}[aux, EXP]{\@@_change_case_char:Nn}
-% \begin{macro}[aux, EXP]{\@@_change_case_char:NNNNNNNNn}
+% \begin{macro}[aux, EXP]{\@@_change_case_char:nN}
+% \begin{macro}[aux, EXP]{\@@_change_case_char_aux:nN}
+% \begin{macro}[aux]
+% {\@@_lookup_lower:N, \@@_lookup_upper:N, \@@_lookup_title:N}
% \begin{macro}[aux, EXP]{\@@_change_case_cs:Nnnn}
% \begin{macro}[aux, EXP]{\@@_change_case_cs:nNnnn}
% \begin{macro}[aux, EXP]{\@@_change_case_cs_three:NNNw}
@@ -3277,26 +3297,34 @@
#1
{
\use:c { @@_change_case_ #2 _ sigma:Nnw } #1
- { \@@_change_case_char:Nn #1 {#2} }
+ { \@@_change_case_char:nN {#2} #1 }
}
}
-\cs_new:Npn \@@_change_case_char:Nn #1#2
+\cs_new:Npn \@@_change_case_char:nN #1#2
{
\@@_change_case_output:fwn
{
- \str_case:nvF #1 { c__unicode_ #2 _exceptions_tl }
+ \cs_if_exist:cTF { c__unicode_ #1 _ #2 _tl }
+ { \tl_use:c { c__unicode_ #1 _ #2 _tl } }
+ { \@@_change_case_char_aux:nN {#1} #2 }
+ }
+ }
+\cs_if_exist:NTF \utex_char:D
+ {
+ \cs_new:Npn \@@_change_case_char_aux:nN #1#2
+ {
+ \int_compare:nNnTF { \use:c { @@_lookup_ #1 :N } #2 } = { 0 }
+ { \exp_stop_f: #2 }
{
- \exp_after:wN \@@_change_case_char:NNNNNNNNn
- \int_use:N \__int_eval:w 1000000 + `#1 \__int_eval_end:
- #1 {#2}
+ \utex_char:D \use:c { @@_lookup_ #1 :N } #2
}
}
+ \cs_new_protected:Npn \@@_lookup_lower:N #1 { \tex_lccode:D `#1 }
+ \cs_new_protected:Npn \@@_lookup_upper:N #1 { \tex_uccode:D `#1 }
+ \cs_new_eq:NN \@@_lookup_title:N \@@_lookup_upper:N
}
-\cs_new:Npn \@@_change_case_char:NNNNNNNNn #1#2#3#4#5#6#7#8#9
{
- \str_case:nvF #8
- { c__unicode_ #9 _ #6 _X_ #7 _tl }
- { \exp_stop_f: #8 }
+ \cs_new:Npn \@@_change_case_char_aux:nN #1#2 { \exp_stop_f: #2 }
}
% \end{macrocode}
% If a control sequence has been given as the argument and it is not on
@@ -3489,6 +3517,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:Nnw}
% \begin{macro}[aux, EXP]{\@@_change_case_lower_sigma:w}
@@ -3775,6 +3804,53 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{variable}
+% {
+% \c__unicode_std_sigma_tl ,
+% \c__unicode_final_sigma_tl ,
+% \c__unicode_accents_lt_tl ,
+% \c__unicode_dot_above_tl ,
+% \c__unicode_dotless_i_tl ,
+% \c__unicode_dotted_I_tl ,
+% \c__unicode_i_ogonek_tl ,
+% \c__unicode_I_ogonek_tl ,
+% \c__unicode_upper_Eszett_tl
+% }
+% \begin{macrocode}
+\cs_if_exist:NTF \utex_char:D
+ {
+ \tl_const:Nx \c__unicode_std_sigma_tl { \utex_char:D "03C3 ~ }
+ \tl_const:Nx \c__unicode_final_sigma_tl { \utex_char:D "03C2 ~ }
+ \tl_const:Nx \c__unicode_accents_lt_tl
+ {
+ \utex_char:D "00CC ~
+ { \utex_char:D "0069 ~ \utex_char:D "0307 ~ \utex_char:D "0300 ~ }
+ \utex_char:D "00CD ~
+ { \utex_char:D "0069 ~ \utex_char:D "0307 ~ \utex_char:D "0301 ~ }
+ \utex_char:D "0128 ~
+ { \utex_char:D "0069 ~ \utex_char:D "0307 ~ \utex_char:D "0303 ~ }
+ }
+ \tl_const:Nx \c__unicode_dot_above_tl { \utex_char:D "0307 ~ }
+ \tl_const:Nx \c__unicode_dotless_i_tl { \utex_char:D "0131 ~ }
+ \tl_const:Nx \c__unicode_dotted_I_tl { \utex_char:D "0130 ~ }
+ \tl_const:Nx \c__unicode_i_ogonek_tl { \utex_char:D "012F ~ }
+ \tl_const:Nx \c__unicode_I_ogonek_tl { \utex_char:D "012E ~ }
+ \tl_const:Nx \c__unicode_upper_Eszett_tl { \utex_char:D "1E9E ~}
+ }
+ {
+ \tl_const:Nn \c__unicode_std_sigma_tl { }
+ \tl_const:Nn \c__unicode_final_sigma_tl { }
+ \tl_const:Nn \c__unicode_accents_lt_tl { }
+ \tl_const:Nn \c__unicode_dot_above_tl { }
+ \tl_const:Nn \c__unicode_dotless_i_tl { I }
+ \tl_const:Nn \c__unicode_dotted_I_tl { i }
+ \tl_const:Nn \c__unicode_i_ogonek_tl { }
+ \tl_const:Nn \c__unicode_I_ogonek_tl { }
+ \tl_const:Nn \c__unicode_upper_Eszett_tl { }
+ }
+% \end{macrocode}
+% \end{variable}
+%
% \begin{macro}[aux, EXP]{\@@_mixed_case:nn}
% \begin{macro}[aux, EXP]{\@@_mixed_case_aux:nn}
% \begin{macro}[aux, EXP]{\@@_mixed_case_loop:wn}
@@ -3783,7 +3859,7 @@
% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:Nwn}
% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:NNNnn}
% \begin{macro}[aux, EXP]{\@@_mixed_case_N_type:Nnn}
-% \begin{macro}[aux, EXP]{\@@_mixed_case_char:Nn}
+% \begin{macro}[aux, EXP]{\@@_mixed_case_char:N}
% \begin{macro}[aux, EXP]{\@@_mixed_case_skip:N}
% \begin{macro}[aux, EXP]{\@@_mixed_case_skip:NN}
% \begin{macro}[aux, EXP]{\@@_mixed_case_skip_tidy:Nwn}
@@ -3926,11 +4002,7 @@
\cs_new:Npn \@@_mixed_case_skip:NN #1#2
{
\quark_if_recursion_tail_stop_do:nn {#2}
- {
- \exp_args:Nf \@@_mixed_case_char:nN
- { \str_case:nVF #1 \c__unicode_mixed_exceptions_tl \exp_stop_f: }
- #1
- }
+ { \@@_mixed_case_char:N #1 }
\int_compare:nNnT { `#1 } = { `#2 }
{
\use_i_delimit_by_q_recursion_stop:nw
@@ -3945,11 +4017,14 @@
{
\@@_mixed_case_loop:wn #2 \q_recursion_stop
}
-\cs_new:Npn \@@_mixed_case_char:nN #1#2
+\cs_new:Npn \@@_mixed_case_char:N #1
{
- \tl_if_blank:nTF {#1}
- { \@@_change_case_char:Nn #2 { upper } }
- { \@@_change_case_output:nwn {#1} }
+ \cs_if_exist:cTF { c__unicode_title_ #1 _tl }
+ {
+ \@@_change_case_output:fwn
+ { \tl_use:c { c__unicode_title_ #1 _tl } }
+ }
+ { \@@_change_case_char:nN { upper } #1 }
}
% \end{macrocode}
% \end{macro}
@@ -4367,7 +4442,9 @@
% \begin{macro}
% {^^A
% \char_set_active_eq:NN, \char_gset_active_eq:NN,
-% \char_set_active_eq:nN, \char_gset_active_eq:nN
+% \char_set_active_eq:Nc, \char_gset_active_eq:Nc,
+% \char_set_active_eq:nN, \char_gset_active_eq:nN,
+% \char_set_active_eq:nc, \char_gset_active_eq:nc
% }
% Four simple functions with very similar definitions, so set up using
% an auxiliary.
@@ -4389,6 +4466,10 @@
\@@_tmp:nN { char_set_active_eq } \cs_set_eq:NN
\@@_tmp:nN { char_gset_active_eq } \cs_gset_eq:NN
\group_end:
+\cs_generate_variant:Nn \char_set_active_eq:NN { Nc }
+\cs_generate_variant:Nn \char_gset_active_eq:NN { Nc }
+\cs_generate_variant:Nn \char_set_active_eq:nN { nc }
+\cs_generate_variant:Nn \char_gset_active_eq:nN { nc }
% \end{macrocode}
% \end{macro}
%
@@ -4464,6 +4545,7 @@
% \begin{macrocode}
\group_begin:
%<*package>
+ \char_set_catcode_active:N \^^L
\cs_set_nopar:Npn ^^L { }
%</package>
\char_set_catcode_other:n { 0 }