diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty index ba989f071c7..77f2c83eaa9 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty @@ -18,13 +18,13 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-convert.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-convert.dtx 6969 2017-02-20 18:32:23Z bruno $ {L3 Experimental string encoding conversions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-analysis,l3tl-build,l3flag} +\RequirePackage{l3tl-analysis,l3tl-build} \cs_if_exist:NF \use_ii_i:nn { \cs_new:Npn \use_ii_i:nn #1#2 { #2 #1 } } \cs_new_protected:Npn \__str_tmp:w { } @@ -32,13 +32,11 @@ \int_new:N \l__str_internal_int \tl_new:N \g__str_result_tl \int_const:Nn \c__str_replacement_char_int { "FFFD } -\int_const:Nn \c_forty_eight { 48 } -\int_const:Nn \c_fifty_eight { 58 } -\int_const:Nn \c_sixty_five { 65 } -\int_const:Nn \c_ninety_one { 91 } -\int_const:Nn \c_ninety_seven { 97 } -\int_const:Nn \c_one_hundred_twenty_three { 123 } -\int_const:Nn \c_one_hundred_twenty_seven { 127 } +\int_const:Nn \c__str_max_byte_int { 255 } +\int_const:Nn \c__str_ascii_min_int { 0 } +\int_const:Nn \c__str_ascii_max_control_int { 31 } +\int_const:Nn \c__str_ascii_max_int { 127 } +\int_const:Nn \c__str_ascii_lower_int { `a - `A } \prop_new:N \g__str_alias_prop \prop_gput:Nnn \g__str_alias_prop { latin1 } { iso88591 } \prop_gput:Nnn \g__str_alias_prop { latin2 } { iso88592 } @@ -108,7 +106,7 @@ { \__prg_break:n { \prg_return_true: \use_none:n } } \prg_new_conditional:Npnn \__str_octal_use:N #1 { TF } { - \if_int_compare:w \c_one < '1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 1 < '1 \token_to_str:N #1 \exp_stop_f: #1 \prg_return_true: \else: \prg_return_false: @@ -116,7 +114,7 @@ } \prg_new_conditional:Npnn \__str_hexadecimal_use:N #1 { TF } { - \if_int_compare:w \c_two < "1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f: #1 \prg_return_true: \else: \if_case:w \__int_eval:w @@ -327,20 +325,19 @@ \cs_new:Npn \__str_convert_lowercase_alphanum_loop:N #1 { \use_none:n #1 - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_sixty_five - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: \else: + \if_int_compare:w `#1 < `a \exp_stop_f: \else: #1 \fi: - \else: - \__str_output_byte:n { `#1 + \c_thirty_two } \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven - \else: + \if_int_compare:w `#1 < `A \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: #1 \fi: + \else: + \__str_output_byte:n { `#1 + \c__str_ascii_lower_int } \fi: \fi: \__str_convert_lowercase_alphanum_loop:N @@ -363,9 +360,9 @@ \char_set_catcode_comment:N \% \int_set:Nn \tex_endlinechar:D {32} } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -387,9 +384,9 @@ } } { \cs_new_eq:NN \__str_filter_bytes:n \use:n } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -411,9 +408,9 @@ { #1 \s__tl \__int_value:w `#1 \s__tl } \group_begin: \char_set_catcode_other:n { 0 } - \bool_if:nTF + \bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -443,11 +440,11 @@ } \cs_new:Npn \__str_encode_native_char:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } ? + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow } @@ -509,7 +506,7 @@ \tex_dimen:D "#1 = \l__str_internal_int sp \scan_stop: \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \__int_value:w "#2 } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load:nn } \cs_new_protected:Npn \__str_decode_eight_bit_load_missing:n #1 @@ -519,7 +516,7 @@ \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \int_use:N \c__str_replacement_char_int } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load_missing:n } \cs_new:Npn \__str_decode_eight_bit_char:N #1 @@ -552,7 +549,7 @@ \tex_skip:D \l__str_internal_int = "#2 sp \scan_stop: \exp_args:NNf \tex_toks:D \l__str_internal_int { \__str_output_byte:n { "#1 } } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_encode_eight_bit_load:nn } \cs_new:Npn \__str_encode_eight_bit_char:n #1 @@ -571,10 +568,10 @@ } \cs_new:Npn \__str_encode_eight_bit_char_aux:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnn { str } { unknown-esc } @@ -590,9 +587,9 @@ } \__msg_kernel_new:nnn { str } { file-not-found } { File~'l3str-#1.def'~not~found. } -\bool_if:nT +\bool_lazy_any:nT { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { |