diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
commit | 6fca20c09474a7f6a3559af1c984243a83669f61 (patch) | |
tree | cbfda048c91853241ef903a84a088c1e3a66fd50 /Master/texmf-dist/source/latex/l3kernel/l3str.dtx | |
parent | ddbc1f2a5f193876d6f1df544e286029c6d671f8 (diff) |
l3 (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3str.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3str.dtx | 95 |
1 files changed, 68 insertions, 27 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index ea75d3e69d1..ef628bab6a3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str.dtx Copyright (C) 2011-2016 The LaTeX3 Project +%% File: l3str.dtx Copyright (C) 2011-2017 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3str.dtx 6809 2017-01-01 06:33:13Z bruno $ +\GetIdInfo$Id: l3str.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Strings} %</driver|package> %<*driver> @@ -612,6 +612,15 @@ % time quadratic in the character count of the string. % \end{function} % +% \begin{function}[rEXP]{\__str_to_other_fast:n} +% \begin{syntax} +% \cs{__str_to_other_fast:n} \Arg{token list} +% \end{syntax} +% Same behaviour \cs{__str_to_other:n} but only restricted-expandable. +% It takes a time linear in the character count of the string. +% It is used for \cs{iow_wrap:nnnN}. +% \end{function} +% % \begin{function}[EXP]{\__str_count:n} % \begin{syntax} % \cs{__str_count:n} \Arg{other string} @@ -802,7 +811,7 @@ % \begin{macrocode} \cs_new:Npn \@@_if_eq_x_return:nn #1 #2 { - \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -826,7 +835,7 @@ { \if_int_compare:w \@@_if_eq_x:nn { \exp_not:n {#1} } { \exp_not:n {#2} } - = \c_zero + = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \str_if_eq_p:nn { V , o } @@ -839,7 +848,7 @@ \cs_generate_variant:Nn \str_if_eq:nnTF { nV , no , VV } \prg_new_conditional:Npnn \str_if_eq_x:nn #1#2 { p , T , F , TF } { - \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -853,7 +862,7 @@ \prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F } { \if_int_compare:w \@@_if_eq_x:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 } - = \c_zero \prg_return_true: \else: \prg_return_false: \fi: + = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \str_if_eq:NNT { c , Nc , cc } \cs_generate_variant:Nn \str_if_eq:NNF { c , Nc , cc } @@ -976,6 +985,38 @@ % \end{macro} % \end{macro} % +% \begin{macro}[rEXP, int]{\@@_to_other_fast:n} +% \begin{macro}[rEXP, aux]{\@@_to_other_fast_loop:w, \@@_to_other_fast_end:w} +% The difference with \cs{@@_to_other:n} is that the converted part is +% left in the input stream, making these commands only +% restricted-expandable. +% \begin{macrocode} +\cs_new:Npn \@@_to_other_fast:n #1 + { + \exp_after:wN \@@_to_other_fast_loop:w \tl_to_str:n {#1} ~ + A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_stop + } +\group_begin: +\tex_lccode:D `\* = `\ % +\tex_lccode:D `\A = `\A +\tex_lowercase:D + { + \group_end: + \cs_new:Npn \@@_to_other_fast_loop:w + #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~ + { + \if_meaning:w A #9 + \@@_to_other_fast_end:w + \fi: + #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9 + \@@_to_other_fast_loop:w * + } + \cs_new:Npn \@@_to_other_fast_end:w #1 * A #2 \q_stop {#1} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}[EXP] % {\str_item:Nn, \str_item:cn, \str_item:nn, \str_item_ignore_spaces:nn} % \begin{macro}[EXP, aux]{\@@_item:nn, \@@_item:w} @@ -1017,7 +1058,7 @@ } \cs_new:Npn \@@_item:w #1; #2; { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \int_compare:nNnTF {#1} < {-#2} { \use_none_delimit_by_q_stop:w } @@ -1059,7 +1100,7 @@ % \begin{macrocode} \cs_new:Npn \@@_skip_exp_end:w #1; { - \if_int_compare:w #1 > \c_eight + \if_int_compare:w #1 > 8 \exp_stop_f: \exp_after:wN \@@_skip_loop:wNNNNNNNN \else: \exp_after:wN \@@_skip_end:w @@ -1068,7 +1109,7 @@ #1 ; } \cs_new:Npn \@@_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9 - { \exp_after:wN \@@_skip_exp_end:w \__int_value:w \__int_eval:w #1 - \c_eight ; } + { \exp_after:wN \@@_skip_exp_end:w \__int_value:w \__int_eval:w #1 - 8 ; } \cs_new:Npn \@@_skip_end:w #1 ; { \exp_after:wN \@@_skip_end:NNNNNNNN @@ -1108,7 +1149,7 @@ { \exp_after:wN \@@_range:w \__int_value:w \@@_count:n {#1} \exp_after:wN ; - \__int_value:w \__int_eval:w #2 - \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #2 - 1 \exp_after:wN ; \__int_value:w \__int_eval:w #3 ; #1 \q_stop } @@ -1140,11 +1181,11 @@ { \int_eval:n { - \if_int_compare:w #1 < \c_zero + \if_int_compare:w #1 < 0 \exp_stop_f: \if_int_compare:w #1 < -#2 \exp_stop_f: - \c_zero + 0 \else: - #1 + #2 + \c_one + #1 + #2 + 1 \fi: \else: \if_int_compare:w #1 < #2 \exp_stop_f: @@ -1177,7 +1218,7 @@ { \@@_collect_loop:wn #1 ; { } } \cs_new:Npn \@@_collect_loop:wn #1 ; { - \if_int_compare:w #1 > \c_seven + \if_int_compare:w #1 > 7 \exp_stop_f: \exp_after:wN \@@_collect_loop:wnNNNNNNN \else: \exp_after:wN \@@_collect_end:wn @@ -1187,13 +1228,13 @@ \cs_new:Npn \@@_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \@@_collect_loop:wn - \__int_value:w \__int_eval:w #1 - \c_seven ; + \__int_value:w \__int_eval:w #1 - 7 ; { #2 #3#4#5#6#7#8#9 } } \cs_new:Npn \@@_collect_end:wn #1 ; { \exp_after:wN \@@_collect_end:nnnnnnnnw - \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: + \if_case:w \if_int_compare:w #1 > 0 \exp_stop_f: #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \fi: } \cs_new:Npn \@@_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop @@ -1231,7 +1272,7 @@ \if_meaning:w X #9 \use_i_delimit_by_q_stop:nw \fi: - \c_nine + \@@_count_spaces_loop:w + 9 + \@@_count_spaces_loop:w } % \end{macrocode} % \end{macro} @@ -1280,9 +1321,9 @@ \int_eval:n { #1 - { X \c_eight } { X \c_seven } { X \c_six } - { X \c_five } { X \c_four } { X \c_three } - { X \c_two } { X \c_one } { X \c_zero } + { X 8 } { X 7 } { X 6 } + { X 5 } { X 4 } { X 3 } + { X 2 } { X 1 } { X 0 } \q_stop } } @@ -1291,7 +1332,7 @@ \if_meaning:w X #9 \exp_after:wN \use_none_delimit_by_q_stop:w \fi: - \c_nine + \@@_count_loop:NNNNNNNNN + 9 + \@@_count_loop:NNNNNNNNN } % \end{macrocode} % \end{macro} @@ -1561,7 +1602,7 @@ % \LaTeXe{} and Con\TeX{}t MkII and MkIV). % \begin{macrocode} %<*initex> - \tex_chardef:D \g_@@_data_ior \c_zero + \tex_chardef:D \g_@@_data_ior = 0 \scan_stop: %</initex> %<*package> \tex_chardef:D \g_@@_data_ior @@ -1624,7 +1665,7 @@ \@@_parse_auxi:w #1#2 \q_stop \else: \if_int_compare:w \__str_if_eq_x:nn - { \exp_not:n {#2} } { ~Conditional~Mappings~ } = \c_zero + { \exp_not:n {#2} } { ~Conditional~Mappings~ } = 0 \exp_stop_f: \cs_set_protected:Npn \@@_parse:w ##1 \q_stop { } \fi: \fi: @@ -1658,7 +1699,7 @@ { \tl_if_blank:nF {#7} { - \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = 0 \exp_stop_f: \else: \tl_const:cx { c_@@_title_ \utex_char:D "#1 _tl } @@ -1675,7 +1716,7 @@ % \begin{macrocode} \cs_set_protected:Npn \@@_parse_auxi:w #1 ;~ #2 ;~ #3 ; #4 \q_stop { - \if_int_compare:w \__str_if_eq_x:nn {#2} { C } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#2} { C } = 0 \exp_stop_f: \if_int_compare:w \tex_lccode:D "#1 = "#3 \scan_stop: \else: \tl_const:cx @@ -1683,7 +1724,7 @@ { \utex_char:D "#3 ~ } \fi: \else: - \if_int_compare:w \__str_if_eq_x:nn {#2} { F } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#2} { F } = 0 \exp_stop_f: \@@_parse_auxii:w #1 ~ #3 ~ \q_stop \fi: \fi: @@ -1699,7 +1740,7 @@ { \use:n { \@@_parse_auxii:w #1 ~ lower ~ #2 ~ } ~ \q_stop \use:n { \@@_parse_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop - \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = 0 \exp_stop_f: \else: \use:n { \@@_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop \fi: |