diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-string.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-string.def | 153 |
1 files changed, 153 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-string.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-string.def new file mode 100644 index 00000000000..7718a0d1b25 --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-string.def @@ -0,0 +1,153 @@ +%% +%% This is file `l3str-string.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3str.dtx (with options: `string') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: l3str.dtx Copyright (C) 2011 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3experimental bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX3 Project. +%% +%% ----------------------------------------------------------------------- +\group_begin: + \char_set_lccode:nn {`\*} {`\\} + \char_set_catcode_other:N \^^J + \char_set_catcode_other:N \^^M + \tl_to_lowercase:n + { + \cs_new_protected_nopar:Npn \str_convert_input_string: + { + \tl_gset:Nx \g_str_result_tl + { + \exp_after:wN \str_convert_input_string_aux:wN + \g_str_result_tl \prg_map_break: ^^M ? + \prg_break_point:n { } + } + \tl_gset:Nx \g_str_result_tl + { + \exp_after:wN \str_convert_input_string_aux:wNNN + \g_str_result_tl * ?? { ? \prg_map_break: } + \prg_break_point:n { } + } + } + \cs_new_nopar:Npn \str_convert_input_string_aux:wNNN #1 *#2#3#4 + } + { + \str_filter_bytes:n {#1} + \use_none:n #4 + \str_output_byte:w ' + \str_aux_octal_use:NTF #2 + { + \str_aux_octal_use:NTF #3 + { + \str_aux_octal_use:NTF #4 + { + \if_int_compare:w #2 > \c_three + - 256 + \fi: + \str_convert_input_string_aux:NNNNNN + } + { \str_convert_input_string_aux:NNNNNN ? } + } + { \str_convert_input_string_aux:NNNNNN ?? } + } + { + \prg_case_str:xxn {#2} + { + { \c_backslash_str } { 134 } + { ( } { 50 } + { ) } { 51 } + { r } { 15 } + { f } { 14 } + { n } { 12 } + { t } { 11 } + { b } { 10 } + { ^^J } { 0 - \c_one } + } + { 0 - \c_one \use_i:nn } + } + \str_output_end: + \use_i:nn \str_convert_input_string_aux:wNNN #2#3#4 + } + \cs_new_nopar:Npn \str_convert_input_string_aux:NNNNNN #1#2#3#4#5#6 + { \str_output_end: \str_convert_input_string_aux:wNNN } + \cs_new_nopar:Npn \str_convert_input_string_aux:wN #1 ^^M #2 + { + #1 ^^J + \if_charcode:w ^^J #2 + \exp_after:wN \use_i:nn + \fi: + \str_convert_input_string_aux:wN #2 + } +\group_end: +\str_const:Nx \c_str_convert_output_string_str + { \c_backslash_str ( ) } +\cs_new_protected_nopar:Npn \str_convert_output_string: + { \str_aux_gmap_result:N \str_convert_output_string_aux:N } +\cs_new_nopar:Npn \str_convert_output_string_aux:N #1 + { + \str_convert_output_string_aux:NTF #1 + { + \str_if_contains_char:NNT + \c_str_convert_output_string_str #1 + { \c_backslash_str } + #1 + } + { + \c_backslash_str + \int_div_truncate:nn {`#1} {64} + \int_mod:nn { \int_div_truncate:nn {`#1} \c_eight } \c_eight + \int_mod:nn {`#1} \c_eight + } + } +\prg_new_conditional:Npnn \str_convert_output_string_aux:N #1 { TF } + { + \if_num:w `#1 < "21 \exp_stop_f: + \prg_return_false: + \else: + \if_num:w `#1 > "7E \exp_stop_f: + \prg_return_false: + \else: + \prg_return_true: + \fi: + \fi: + } +%% +%% +%% End of file `l3str-string.def'. |