diff options
author | Karl Berry <karl@freefriends.org> | 2012-12-21 23:31:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-12-21 23:31:35 +0000 |
commit | 8bcf0c7ef3cd19666c206271cea9280846b5c7e6 (patch) | |
tree | ee538c7e2a14ad105a169fdd2e745356147577cc /Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx | |
parent | ef0453041a9700a2d974c3c76e3398e40c4e4aeb (diff) |
l3 (21dec12)
git-svn-id: svn://tug.org/texlive/trunk@28608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx index 7e8f00ef923..301682c64be 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str.dtx 4119 2012-08-16 22:35:59Z bruno $ +\GetIdInfo$Id: l3str.dtx 4339 2012-11-24 19:16:43Z joseph $ {L3 Experimental strings} %</driver|package> %<*driver> @@ -1031,8 +1031,8 @@ % \begin{macro}[EXP]{\str_tail:N} % \begin{macro}[EXP]{\str_tail:n} % \begin{macro}[EXP]{\str_tail_ignore_spaces:n} -% \begin{macro}[EXP,aux]{\@@_tail:w} -% \begin{macro}[EXP,aux]{\@@_tail_ii:w} +% \begin{macro}[EXP,aux]{\@@_tail_auxi:w} +% \begin{macro}[EXP,aux]{\@@_tail_auxii:w} % As when fetching the head of a string, the \texttt{_ignore_spaces} % variant is similar to \cs{tl_tail:n}. The more commonly used % \cs{str_tail:n} function is a little bit more convoluted: hitting @@ -1046,17 +1046,17 @@ \cs_new_nopar:Npn \str_tail:N { \exp_args:No \str_tail:n } \cs_set:Npn \str_tail:n #1 { - \exp_after:wN \@@_tail:w + \exp_after:wN \@@_tail_auxi:w \reverse_if:N \if_charcode:w \scan_stop: \tl_to_str:n {#1} X X \q_stop } -\cs_set:Npn \@@_tail:w #1 X #2 \q_stop { \fi: #1 } +\cs_set:Npn \@@_tail_auxi:w #1 X #2 \q_stop { \fi: #1 } \cs_new:Npn \str_tail_ignore_spaces:n #1 { - \exp_after:wN \@@_tail_ii:w + \exp_after:wN \@@_tail_auxii:w \tl_to_str:n {#1} X X \q_stop } -\cs_new:Npn \@@_tail_ii:w #1 #2 X #3 \q_stop { #2 } +\cs_new:Npn \@@_tail_auxii:w #1 #2 X #3 \q_stop { #2 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1066,16 +1066,16 @@ % % \begin{macro}[EXP, int]{\@@_skip_c_zero:w} % \begin{macro}[EXP, aux]{\@@_skip_loop:wNNNNNNNN} -% \begin{macro}[EXP, aux]{\@@_skip_end:w, \@@_skip_end_ii:NNNNNNNN} +% \begin{macro}[EXP, aux]{\@@_skip_end:w, \@@_skip_end:NNNNNNNN} % Removes |max(#1,0)| characters from the input stream, and then % leaves \cs{c_zero}. This should be expanded using % \cs{tex_romannumeral:D}. We remove characters $8$ at a time until % there are at most $8$ to remove. Then we do a dirty trick: the % \cs{if_case:w} construction leaves between $0$ and $8$ times the % \cs{or:} control sequence, and those \cs{or:} become arguments of -% \cs{@@_skip_end_ii:NNNNNNNN}. If the number of characters to remove +% \cs{@@_skip_end:NNNNNNNN}. If the number of characters to remove % is $6$, say, then there are two \cs{or:} left, and the $8$ arguments -% of \cs{@@_skip_end_ii:NNNNNNNN} are the two \cs{or:}, and $6$ +% of \cs{@@_skip_end:NNNNNNNN} are the two \cs{or:}, and $6$ % characters from the input stream, exactly what we wanted to % remove. Then close the \cs{if_case:w} conditional with \cs{fi:}, and % stop the initial expansion with \cs{c_zero} (see places where @@ -1095,25 +1095,25 @@ { \exp_after:wN \@@_skip_c_zero:w \int_use:N \__int_eval:w #1 - \c_eight ; } \cs_new:Npn \@@_skip_end:w #1 ; { - \exp_after:wN \@@_skip_end_ii:NNNNNNNN + \exp_after:wN \@@_skip_end:NNNNNNNN \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \or: \or: } -\cs_new:Npn \@@_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero } +\cs_new:Npn \@@_skip_end:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}[EXP,int]{\@@_collect_delimit_by_q_stop:w} -% \begin{macro}[EXP,aux]{\@@_collect_loop:wn, \@@_collect_loop_ii:wnNNNNNNN} +% \begin{macro}[EXP,aux]{\@@_collect_loop:wn, \@@_collect_loop:wnNNNNNNN} % \begin{macro}[EXP,aux] -% {\@@_collect_end:wn, \@@_collect_end_ii:nnnnnnnnw} Collects +% {\@@_collect_end:wn, \@@_collect_end:nnnnnnnnw} Collects % |max(#1,0)| characters, and removes everything else until % \cs{q_stop}. This is somewhat similar to \cs{@@_skip_c_zero:w}, but % this time we can only grab $7$ characters at a time. At the end, we % use an \cs{if_case:w} trick again, so that the $8$ first arguments -% of \cs{@@_collect_end_ii:nnnnnnnnw} are some \cs{or:}, followed by +% of \cs{@@_collect_end:nnnnnnnnw} are some \cs{or:}, followed by % an \cs{fi:}, followed by |#1| characters from the input % stream. Simply leaving this in the input stream will close the % conditional properly and the \cs{or:} disappear. @@ -1127,13 +1127,13 @@ \cs_new:Npn \@@_collect_loop:wn #1 ; { \if_int_compare:w #1 > \c_seven - \exp_after:wN \@@_collect_loop_ii:wnNNNNNNN + \exp_after:wN \@@_collect_loop:wnNNNNNNN \else: \exp_after:wN \@@_collect_end:wn \fi: #1 ; } -\cs_new:Npn \@@_collect_loop_ii:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 +\cs_new:Npn \@@_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \@@_collect_loop:wn \int_use:N \__int_eval:w #1 - \c_seven ; @@ -1141,11 +1141,11 @@ } \cs_new:Npn \@@_collect_end:wn #1 ; { - \exp_after:wN \@@_collect_end_ii:nnnnnnnnw + \exp_after:wN \@@_collect_end:nnnnnnnnw \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \fi: } -\cs_new:Npn \@@_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop +\cs_new:Npn \@@_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop { #1#2#3#4#5#6#7#8 } % \end{macrocode} % \end{macro} @@ -1217,9 +1217,9 @@ % \begin{macro}[EXP,aux] % { % \@@_substr_unsafe:nnn, -% \@@_substr_i:nN, -% \@@_substr_ii:www, -% \@@_substr_iii:nnw, +% \@@_substr:nN, +% \@@_substr:www, +% \@@_substr:nnw, % \@@_substr_normalize_range:nn % } % Sanitize the string. Then evaluate the arguments, replacing them by @@ -1242,23 +1242,23 @@ { \exp_args:No \@@_substr_unsafe:nnn { \tl_to_str:n {#1} } } \cs_new:Npn \@@_substr_unsafe:nnn #1#2#3 { - \exp_after:wN \@@_substr_ii:www + \exp_after:wN \@@_substr:www \__int_value:w \@@_count_unsafe:n {#1} \exp_after:wN ; \int_use:N \__int_eval:w #2 + \c_zero \exp_after:wN ; \int_use:N \__int_eval:w - \exp_args:Nf \@@_substr_i:nN {#3} \c_max_int ; + \exp_args:Nf \@@_substr:nN {#3} \c_max_int ; { } #1 \q_stop } -\cs_new:Npn \@@_substr_i:nN #1 #2 +\cs_new:Npn \@@_substr:nN #1 #2 { \tl_if_empty:nTF {#1} {#2} {#1} } -\cs_new:Npn \@@_substr_ii:www #1; #2; #3; +\cs_new:Npn \@@_substr:www #1; #2; #3; { - \exp_args:Nf \@@_substr_iii:nnw + \exp_args:Nf \@@_substr:nnw { \@@_substr_normalize_range:nn {#2} {#1} } { \@@_substr_normalize_range:nn {#3} {#1} } } -\cs_new:Npn \@@_substr_iii:nnw #1#2 +\cs_new:Npn \@@_substr:nnw #1#2 { \exp_after:wN \@@_collect_delimit_by_q_stop:w \int_use:N \__int_eval:w #2 + \c_one - #1 \exp_after:wN ; @@ -1647,7 +1647,7 @@ % % \begin{macro}{\str_set_convert:Nnnn, \str_gset_convert:Nnnn} % \begin{macro}[TF]{\str_set_convert:Nnnn, \str_gset_convert:Nnnn} -% \begin{macro}[aux]{\@@_convert_i:nNNnnn} +% \begin{macro}[aux]{\@@_convert:nNNnnn} % The input string is stored in \cs{g_@@_result_tl}, then we: % unescape and decode; encode and escape; exit the group and store the % result in the user's variable. The various conversion functions all @@ -1655,14 +1655,14 @@ % functions by redefining \cs{@@_if_flag_error:nnx} locally. % \begin{macrocode} \cs_new_protected_nopar:Npn \str_set_convert:Nnnn - { \@@_convert_i:nNNnnn { } \tl_set_eq:NN } + { \@@_convert:nNNnnn { } \tl_set_eq:NN } \cs_new_protected_nopar:Npn \str_gset_convert:Nnnn - { \@@_convert_i:nNNnnn { } \tl_gset_eq:NN } + { \@@_convert:nNNnnn { } \tl_gset_eq:NN } \prg_new_protected_conditional:Npnn \str_set_convert:Nnnn #1#2#3#4 { T , F , TF } { \bool_gset_false:N \g_@@_error_bool - \@@_convert_i:nNNnnn + \@@_convert:nNNnnn { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx } \tl_set_eq:NN #1 {#2} {#3} {#4} \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true: @@ -1671,22 +1671,22 @@ \str_gset_convert:Nnnn #1#2#3#4 { T , F , TF } { \bool_gset_false:N \g_@@_error_bool - \@@_convert_i:nNNnnn + \@@_convert:nNNnnn { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx } \tl_gset_eq:NN #1 {#2} {#3} {#4} \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true: } -\cs_new_protected:Npn \@@_convert_i:nNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_convert:nNNnnn #1#2#3#4#5#6 { \group_begin: #1 \@@_gset_other:Nn \g_@@_result_tl {#4} - \exp_after:wN \@@_convert_ii:wwwnn + \exp_after:wN \@@_convert:wwwnn \tl_to_str:n {#5} /// \q_stop { decode } { unescape } \prg_do_nothing: \@@_convert_decode_: - \exp_after:wN \@@_convert_ii:wwwnn + \exp_after:wN \@@_convert:wwwnn \tl_to_str:n {#6} /// \q_stop { encode } { escape } \use_ii_i:nn @@ -1699,11 +1699,11 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_convert_ii:wwwnn} -% \begin{macro}[aux]{\@@_convert_iii:NNnNN} -% The task of \cs{@@_convert_ii:wwwnn} is to split +% \begin{macro}[aux]{\@@_convert:wwwnn} +% \begin{macro}[aux]{\@@_convert:NNnNN} +% The task of \cs{@@_convert:wwwnn} is to split % \meta{encoding}/\meta{escaping} pairs into their components, |#1| -% and |#2|. Calls to \cs{@@_convert_iv:nnn} ensure that the +% and |#2|. Calls to \cs{@@_convert:nnn} ensure that the % corresponding conversion functions are defined. The third auxiliary % does the main work. % \begin{itemize} @@ -1723,15 +1723,15 @@ % (native), then the escaping should be ignored, with an error if any % was given, and only the encoding, |#1|, should be performed. % \begin{macrocode} -\cs_new_protected:Npn \@@_convert_ii:wwwnn +\cs_new_protected:Npn \@@_convert:wwwnn #1 / #2 // #3 \q_stop #4#5 { - \@@_convert_iv:nnn {enc} {#4} {#1} - \@@_convert_iv:nnn {esc} {#5} {#2} - \exp_args:Ncc \@@_convert_iii:NNnNN + \@@_convert:nnn {enc} {#4} {#1} + \@@_convert:nnn {esc} {#5} {#2} + \exp_args:Ncc \@@_convert:NNnNN { @@_convert_#4_#1: } { @@_convert_#5_#2: } {#2} } -\cs_new_protected:Npn \@@_convert_iii:NNnNN #1#2#3#4#5 +\cs_new_protected:Npn \@@_convert:NNnNN #1#2#3#4#5 { \if_meaning:w #1 #5 \tl_if_empty:nF {#3} @@ -1745,15 +1745,15 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_convert_iv:nnn} -% \begin{macro}[aux]{\@@_convert_v:nnnn} -% The arguments of \cs{@@_convert_iv:nnn} are: \texttt{enc} or +% \begin{macro}[aux]{\@@_convert:nnn} +% \begin{macro}[aux]{\@@_convert:nnnn} +% The arguments of \cs{@@_convert:nnn} are: \texttt{enc} or % \texttt{esc}, used to build filenames, the type of the conversion % (unescape, decode, encode, escape), and the encoding or escaping % name. If the function is already defined, no need to do anything. % Otherwise, filter out all non-alphanumerics in the name, and % lowercase it. Feed that, and the same three arguments, to -% \cs{@@_convert_v:nnnn}. The task is then to make sure that the +% \cs{@@_convert:nnnn}. The task is then to make sure that the % conversion function |#3_#1| corresponding to the type |#3| and % filtered name |#1| is defined, then set our initial conversion % function |#3_#4| equal to that. @@ -1781,16 +1781,16 @@ % from the \cs{l_@@_internal_tl}-based function: we mustn't clobber % that different definition. % \begin{macrocode} -\cs_new_protected:Npn \@@_convert_iv:nnn #1#2#3 +\cs_new_protected:Npn \@@_convert:nnn #1#2#3 { \cs_if_exist:cF { @@_convert_#2_#3: } { - \exp_args:Nx \@@_convert_v:nnnn + \exp_args:Nx \@@_convert:nnnn { \@@_convert_lowercase_alphanum:n {#3} } {#1} {#2} {#3} } } -\cs_new_protected:Npn \@@_convert_v:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_convert:nnnn #1#2#3#4 { \cs_if_exist:cF { @@_convert_#3_#1: } { @@ -2317,8 +2317,8 @@ % \subsubsection{Unescape methods} % % \begin{macro}[int]{\@@_convert_unescape_hex:} -% \begin{macro}[aux, rEXP]{\@@_unescape_hex_i:N} -% \begin{macro}[aux, rEXP]{\@@_unescape_hex_ii:N} +% \begin{macro}[aux, rEXP]{\@@_unescape_hex_auxi:N} +% \begin{macro}[aux, rEXP]{\@@_unescape_hex_auxii:N} % Take chars two by two, and interpret each pair as the hexadecimal % code for a byte. Anything else than hexadecimal digits is ignored, % raising the flag. A string which contains an odd number of @@ -2334,7 +2334,7 @@ \tl_gset:Nx \g_@@_result_tl { \@@_output_byte:w " - \exp_last_unbraced:Nf \@@_unescape_hex_i:N + \exp_last_unbraced:Nf \@@_unescape_hex_auxi:N { \tl_to_str:N \g_@@_result_tl } 0 { ? 0 - \c_one \__prg_break: } \__prg_break_point: @@ -2343,27 +2343,27 @@ \@@_if_flag_error:nnx { str_error } { unescape-hex } { } \group_end: } -\cs_new:Npn \@@_unescape_hex_i:N #1 +\cs_new:Npn \@@_unescape_hex_auxi:N #1 { \use_none:n #1 \@@_hexadecimal_use:NTF #1 - { \@@_unescape_hex_ii:N } + { \@@_unescape_hex_auxii:N } { \flag_raise:n { str_error } - \@@_unescape_hex_i:N + \@@_unescape_hex_auxi:N } } -\cs_new:Npn \@@_unescape_hex_ii:N #1 +\cs_new:Npn \@@_unescape_hex_auxii:N #1 { \use_none:n #1 \@@_hexadecimal_use:NTF #1 { \@@_output_end: - \@@_output_byte:w " \@@_unescape_hex_i:N + \@@_output_byte:w " \@@_unescape_hex_auxi:N } { \flag_raise:n { str_error } - \@@_unescape_hex_ii:N + \@@_unescape_hex_auxii:N } } \__msg_kernel_new:nnnn { str } { unescape-hex } |