diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx index df7047f93ed..cda42b33ccc 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str-convert.dtx Copyright (C) 2013-2015 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2016 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 @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str-convert.dtx 6106 2015-09-26 08:54:30Z joseph $ +\GetIdInfo$Id: l3str-convert.dtx 6443 2016-03-24 10:59:09Z joseph $ {L3 Experimental string encoding conversions} %</driver|package> %<*driver> @@ -438,7 +438,7 @@ \group_begin: \char_set_lccode:nn { `\* } { `\ } \char_set_lccode:nn { `\A } { `\A } -\tl_to_lowercase:n +\tex_lowercase:D { \group_end: \cs_new_protected:Npn \@@_gset_other:Nn #1#2 @@ -581,23 +581,15 @@ % an empty result for the input $-1$. % \begin{macrocode} \group_begin: - \char_set_catcode_other:n { \c_zero } - \tl_set:Nx \l_@@_internal_tl { \tl_to_str:n { 0123456789ABCDEF } } - \exp_args:No \tl_map_inline:nn { \l_@@_internal_tl " } - { \char_set_lccode:nn {`#1} { \c_zero } } - \tl_map_inline:Nn \l_@@_internal_tl - { - \tl_map_inline:Nn \l_@@_internal_tl - { - \char_set_lccode:nn { \c_zero } {"#1##1} - \tl_to_lowercase:n - { - \tl_const:cx - { c_@@_byte_ \int_eval:n {"#1##1} _tl } - { ^^@ #1 ##1 } - } - } - } + \tl_set:Nx \l__str_internal_tl { \tl_to_str:n { 0123456789ABCDEF } } + \tl_map_inline:Nn \l__str_internal_tl + { + \tl_map_inline:Nn \l__str_internal_tl + { + \tl_const:cx { c__str_byte_ \int_eval:n {"#1##1} _tl } + { \char_generate:nn { "#1##1 } { 12 } #1 ##1 } + } + } \group_end: \tl_const:cn { c_@@_byte_-1_tl } { { } \use_none:n { } } % \end{macrocode} @@ -623,7 +615,7 @@ { \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nnn - \cs:w c_@@_byte_ \int_use:N \__int_eval:w + \cs:w c_@@_byte_ \__int_value:w \__int_eval:w } \cs_new:Npn \@@_output_hexadecimal:n #1 { \@@_output_hexadecimal:w #1 \@@_output_end: } @@ -631,7 +623,7 @@ { \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n - \cs:w c_@@_byte_ \int_use:N \__int_eval:w + \cs:w c_@@_byte_ \__int_value:w \__int_eval:w } \cs_new_nopar:Npn \@@_output_end: { \__int_eval_end: _tl \cs_end: } @@ -1145,8 +1137,8 @@ % cannot be done expandably in \TeX{}, we cannot hope to get a % linear-time function. However, we get quite close using the % \pkg{l3tl-build} module, which abuses \tn{toks} to reach an almost -% linear time. Use the standard lowercase trick to produce an -% arbitrary character from the null character, and add that character +% linear time. We produce an arbitrary character of category code 12 +% and add that character % to the end of the token list being built. At the end of the loop, % put the token list together with \cs{__tl_build_end:}. Note that we % use an \texttt{x}-expanding assignment because it is slightly @@ -1166,8 +1158,8 @@ \cs_new_protected:Npn \@@_encode_native_loop:w #1 \s__tl #2 \s__tl { \use_none_delimit_by_q_stop:w #2 \q_stop - \tex_lccode:D \l_@@_internal_int \__int_eval:w #2 \__int_eval_end: - \tl_to_lowercase:n { \__tl_build_one:n { ^^@ } } + \exp_args:Nx \__tl_build_one:n + { \char_generate:nn {#2} {12} } \@@_encode_native_loop:w } } @@ -1683,14 +1675,14 @@ % If followed by an end-of-line character, the backslash and the % end-of-line are ignored. If followed by anything else, the backslash % is ignored, raising the error flag. -%^^A Be paranoid: \tl_to_lowercase:n is unsafe. +%^^A Be paranoid: \tex_lowercase:D is unsafe. % \begin{macrocode} %<*string> \group_begin: \char_set_lccode:nn {`\*} {`\\} \char_set_catcode_other:N \^^J \char_set_catcode_other:N \^^M - \tl_to_lowercase:n + \tex_lowercase:D { \cs_new_protected_nopar:Npn \@@_convert_unescape_string: { @@ -2185,7 +2177,7 @@ \fi: \else: \exp_after:wN \@@_decode_utf_viii_continuation:wwN - \int_use:N \__int_eval:w `#1 - "C0 \exp_after:wN \__int_eval_end: + \__int_value:w \__int_eval:w `#1 - "C0 \exp_after:wN \__int_eval_end: \fi: \s__tl \use_none_delimit_by_q_stop:w {"80} {"800} {"10000} {"110000} \q_stop @@ -2200,7 +2192,7 @@ "C0 \exp_stop_f: #3 \exp_after:wN \@@_decode_utf_viii_aux:wNnnwN - \int_use:N \__int_eval:w + \__int_value:w \__int_eval:w #1 * "40 + `#3 - "80 \exp_after:wN \__int_eval_end: \else: @@ -2230,7 +2222,7 @@ \@@_decode_utf_viii_overflow:w #1 \fi: \exp_after:wN \@@_decode_utf_viii_continuation:wwN - \int_use:N \__int_eval:w #1 - #4 \exp_after:wN \__int_eval_end: + \__int_value:w \__int_eval:w #1 - #4 \exp_after:wN \__int_eval_end: \fi: \s__tl #2 {#4} #5 |