summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/l3str
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str')
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty453
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty7
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty2
3 files changed, 457 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty
new file mode 100644
index 00000000000..902d147cd3f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty
@@ -0,0 +1,453 @@
+%%
+%% This is file `l3str-format.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% l3str-format.dtx (with options: `package')
+%%
+%% 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-format.dtx Copyright (C) 2012 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.
+%%
+%% -----------------------------------------------------------------------
+\RequirePackage{expl3}
+\GetIdInfo$Id: l3str-format.dtx 3940 2012-07-09 00:41:44Z bruno $
+ {L3 Experimental string formatting}
+\ProvidesExplPackage
+ {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\RequirePackage{l3str}
+\cs_generate_variant:Nn \use:nn { nf }
+\cs_generate_variant:Nn \use:nnn { fnf }
+\cs_generate_variant:Nn \tl_to_str:n { f }
+\prg_new_conditional:Npnn \__str_format_if_digit:N #1 { TF }
+ {
+ \if_int_compare:w \c_nine < 1 #1 \exp_stop_f:
+ \prg_return_true: \else: \prg_return_false: \fi:
+ }
+\cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 }
+\cs_generate_variant:Nn \__str_format_put:nw { o , f }
+\cs_new:Npn \__str_format_parse:n #1
+ {
+ \exp_last_unbraced:Nf \__str_format_parse_i:NN
+ \__str_to_other:n {#1} \s__stop \s__stop {#1}
+ }
+\cs_new:Npx \__str_format_parse_i:NN #1#2
+ {
+ \exp_not:N \__str_if_contains_char:nNTF { < > = ^ } #2
+ { \exp_not:N \__str_format_parse_iii:nN { #1 #2 } }
+ {
+ \exp_not:N \__str_format_parse_ii:nN
+ { \c_catcode_other_space_tl } #1 #2
+ }
+ }
+\cs_new:Npn \__str_format_parse_ii:nN #1#2
+ {
+ \__str_if_contains_char:nNTF { < > = ^ } #2
+ { \__str_format_parse_iii:nN { #1 #2 } }
+ { \__str_format_parse_iii:nN { #1 ? } #2 }
+ }
+\cs_new:Npx \__str_format_parse_iii:nN #1#2
+ {
+ \exp_not:N \__str_if_contains_char:nNTF
+ { + - \c_catcode_other_space_tl }
+ #2
+ { \exp_not:N \__str_format_parse_iv:nwN { #1 #2 } ; }
+ { \exp_not:N \__str_format_parse_iv:nwN { #1 ? } ; #2 }
+ }
+\cs_new:Npn \__str_format_parse_iv:nwN #1#2; #3
+ {
+ \__str_format_if_digit:NTF #3
+ { \__str_format_parse_iv:nwN {#1} #2 #3 ; }
+ { \__str_format_parse_v:nN { #1 {#2} } #3 }
+ }
+\cs_new:Npn \__str_format_parse_v:nN #1#2
+ {
+ \token_if_eq_charcode:NNTF . #2
+ { \__str_format_parse_vi:nwN {#1} 0 ; }
+ { \__str_format_parse_vii:nN { #1 { } } #2 }
+ }
+\cs_new:Npn \__str_format_parse_vi:nwN #1#2; #3
+ {
+ \__str_format_if_digit:NTF #3
+ { \__str_format_parse_vi:nwN {#1} #2 #3 ; }
+ { \__str_format_parse_vii:nN { #1 {#2} } #3 }
+ }
+\cs_new:Npn \__str_format_parse_vii:nN #1#2
+ {
+ \token_if_eq_meaning:NNTF \s__stop #2
+ { \__str_format_parse_end:nwn { #1 ? } #2 }
+ { \__str_format_parse_end:nwn { #1 #2 } }
+ }
+\cs_new:Npn \__str_format_parse_end:nwn #1 #2 \s__stop \s__stop #3
+ {
+ \tl_if_empty:nF {#2}
+ { \__msg_kernel_expandable_error:nnn { str } { invalid-format } {#3} }
+ #1
+ }
+\cs_new:cpn { __str_format_align_<:nnnN } #1#2#3#4
+ {
+ \use:nf { #2 #1 }
+ {
+ \prg_replicate:nn
+ { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } }
+ {#4}
+ }
+ }
+\cs_new:cpn { __str_format_align_>:nnnN } #1#2#3#4
+ {
+ \prg_replicate:nn
+ { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } }
+ {#4}
+ #2 #1
+ }
+\cs_new:cpn { __str_format_align_^:nnnN } #1#2#3#4
+ {
+ \use:fnf
+ {
+ \prg_replicate:nn
+ {
+ \int_max:nn \c_zero
+ { #3 - \__str_count_unsafe:n { #2 #1 } - \c_one }
+ / \c_two
+ }
+ {#4}
+ }
+ { #2 #1 }
+ {
+ \prg_replicate:nn
+ {
+ \int_max:nn \c_zero
+ { #3 - \__str_count_unsafe:n { #2 #1 } }
+ / \c_two
+ }
+ {#4}
+ }
+ }
+\cs_new:cpn { __str_format_align_=:nnnN } #1#2#3#4
+ {
+ \use:nf {#2}
+ {
+ \prg_replicate:nn
+ { \int_max:nn { #3 - \__str_count_unsafe:n { #2 #1 } } { 0 } }
+ {#4}
+ }
+ #1
+ }
+\cs_new_nopar:Npn \tl_format:Nn { \exp_args:No \tl_format:nn }
+\cs_generate_variant:Nn \tl_format:Nn { c }
+\cs_new:Npn \tl_format:nn #1#2
+ {
+ \tl_to_str:f
+ {
+ \exp_last_unbraced:Nf \__str_format_tl:NNNnnNn
+ { \__str_format_parse:n {#2} }
+ {#1}
+ }
+ }
+\cs_new:Npn \__str_format_tl:NNNnnNn #1#2#3#4#5#6
+ {
+ \token_if_eq_charcode:NNTF #2 =
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-align-format } {#2} {tl}
+ \__str_format_put:nw { #1 < }
+ }
+ {
+ \token_if_eq_charcode:NNTF #2 ?
+ { \__str_format_put:nw { #1 < } }
+ { \__str_format_put:nw { #1 #2 } }
+ }
+ \token_if_eq_charcode:NNF #3 ?
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-sign-format } {#3} {tl}
+ }
+ \__str_format_put:nw { {#4} }
+ \tl_if_empty:nTF {#5}
+ { \__str_format_put:nw { \use:n { } } }
+ { \__str_format_put:nw { \__str_substr_unsafe:nnn { {1} {#5} } } }
+ \token_if_eq_charcode:NNF #6 s
+ {
+ \token_if_eq_charcode:NNF #6 ?
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-style-format } {#6} {tl}
+ }
+ }
+ \__str_format_tl_s:NNnnNNn
+ \s__stop
+ }
+\cs_new:Npn \__str_format_tl_s:NNnnNNn #1#2#3#4#5#6#7
+ {
+ \exp_args:Nc \exp_args:Nf
+ { __str_format_align_#6:nnnN }
+ { \exp_args:Nf #2 { \__str_to_other:n {#7} } #3 }
+ { }
+ {#4} #5
+ }
+\cs_new:Npn \seq_format:Nn #1#2
+ {
+ \tl_to_str:f
+ { \__str_format_seq:of {#1} { \__str_format_parse:n {#2} } }
+ }
+\cs_generate_variant:Nn \seq_format:Nn { c }
+\cs_new:Npn \__str_format_seq:nn #1#2
+ {
+ \__str_format_seq_loop:nnNn { } {#2}
+ #1
+ { ? \__str_format_seq_end:w } { }
+ }
+\cs_generate_variant:Nn \__str_format_seq:nn { of }
+\cs_new:Npn \__str_format_seq_loop:nnNn #1#2#3#4
+ {
+ \use_none:n #3
+ \exp_args:Nf \__str_format_seq_loop:nnNn
+ { \use:nf {#1} { \__str_format_tl:NNNnnNn #2 {#4} } }
+ {#2}
+ }
+\cs_new:Npn \__str_format_seq_end:w #1#2#3#4 { \use_ii:nnn #3 }
+\cs_new:Npn \int_format:nn #1
+ { \exp_args:Nf \__str_format_int:nn { \int_eval:n {#1} } }
+\cs_new:Npn \__str_format_int:nn #1#2
+ {
+ \tl_to_str:f
+ {
+ \exp_last_unbraced:Nf \__str_format_int:NNNnnNn
+ { \__str_format_parse:n {#2} }
+ {#1}
+ }
+ }
+\cs_new:Npn \__str_format_int:NNNnnNn #1#2#3#4#5#6#7
+ {
+ \token_if_eq_charcode:NNTF #2 ?
+ { \__str_format_put:nw { #1 > } }
+ { \__str_format_put:nw { #1 #2 } }
+ \int_compare:nNnTF {#7} < \c_zero
+ { \__str_format_put:nw { - } }
+ {
+ \str_case:nnn {#3}
+ {
+ { ~ } { \__str_format_put:ow { \c_catcode_other_space_tl } }
+ { + } { \__str_format_put:nw { + } }
+ }
+ { \__str_format_put:nw { { } } }
+ }
+ \__str_format_put:nw { {#4} }
+ \tl_if_empty:nF {#5}
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-precision-format } {#5} {int}
+ }
+ \str_case:nnn {#6}
+ {
+ { ? } { \__str_format_int:NwnnNNn \use:n }
+ { d } { \__str_format_int:NwnnNNn \use:n }
+ { b } { \__str_format_int:NwnnNNn \int_to_binary:n }
+ { o } { \__str_format_int:NwnnNNn \int_to_octal:n }
+ { X } { \__str_format_int:NwnnNNn \int_to_hexadecimal:n }
+ }
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-style-format } {#6} { int }
+ \__str_format_int:NwnnNNn \use:n
+ }
+ \s__stop {#7}
+ }
+\cs_new:Npn \__str_format_int:NwnnNNn #1#2 \s__stop #3#4#5#6#7
+ {
+ \exp_args:Nc \exp_args:Nf
+ { __str_format_align_#6:nnnN }
+ { #1 { \int_abs:n {#7} } }
+ {#4}
+ {#3} #5
+ }
+\cs_new:Npn \fp_format:nn #1
+ { \exp_args:Nf \__str_format_fp:nn { \__fp_parse:n {#1} } }
+\cs_new:Npn \__str_format_fp:nn #1#2
+ {
+ \tl_to_str:f
+ {
+ \exp_last_unbraced:Nf \__str_format_fp:NNNnnNw
+ { \__str_format_parse:n {#2} }
+ #1
+ }
+ }
+\cs_new:Npn \__str_format_fp:NNNnnNw
+ #1#2#3#4#5#6 \s__fp \__fp_chk:w #7 #8
+ {
+ \token_if_eq_charcode:NNTF #2 ?
+ { \__str_format_put:nw { #1 > } }
+ { \__str_format_put:nw { #1 #2 } }
+ \token_if_eq_meaning:NNTF 2 #8
+ { \__str_format_put:nw { - } }
+ {
+ \str_case:nnn {#3}
+ {
+ { ~ } { \__str_format_put:ow { \c_catcode_other_space_tl } }
+ { + } { \__str_format_put:nw { + } }
+ }
+ { \__str_format_put:nw { { } } }
+ }
+ \__str_format_put:nw { {#4} }
+ \tl_if_empty:nTF {#5}
+ { \__str_format_put:nw { { 6} } }
+ { \__str_format_put:nw { {#5} } }
+ \str_case:nnn {#6}
+ {
+ { e } { \__str_format_fp:wnnnNNw \__str_format_fp_e:wn }
+ { f } { \__str_format_fp:wnnnNNw \__str_format_fp_f:wn }
+ { g } { \__str_format_fp:wnnnNNw \__str_format_fp_g:wn }
+ { ? } { \__str_format_fp:wnnnNNw \__str_format_fp_g:wn }
+ }
+ {
+ \__msg_kernel_expandable_error:nnnn
+ { str } { invalid-style-format } {#6} { fp }
+ \__str_format_fp:wnnnNNw \__str_format_fp_g:wn
+ }
+ \s__stop
+ \s__fp \__fp_chk:w #7 #8
+ }
+\cs_new:Npn \__str_format_fp:wnnnNNw
+ #1 \s__stop #2 #3 #4 #5#6 #7 ;
+ {
+ \exp_args:Nc \exp_args:Nf
+ { __str_format_align_#6:nnnN }
+ { #1 #7 ; {#2} }
+ {#4}
+ {#3} #5
+ }
+\cs_new:Npn \__str_format_fp_round:wn #1 ; #2
+ { \__fp_parse:n { round ( #1; , #2 - \__fp_exponent:w #1; ) } }
+\group_begin:
+\char_set_catcode_other:N E
+\tl_to_lowercase:n
+ {
+ \group_end:
+ \cs_new:Npn \__str_format_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4
+ {
+ \int_case:nnn {#1}
+ {
+ {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } e 0 }
+ {2} { inf }
+ {3} { nan }
+ }
+ {
+ \exp_last_unbraced:Nf \__str_format_fp_e_ii:wn
+ \__str_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 }
+ {#4}
+ }
+ }
+ \cs_new:Npn \__str_format_fp_e_ii:wn
+ \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8
+ {
+ \__str_format_put:fw { \int_eval:n { #3 - 1 } }
+ \__str_format_put:nw { e }
+ \int_compare:nNnTF {#8} > \c_sixteen
+ {
+ \__str_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} }
+ \__str_format_put:fw { \use_none:n #4#5#6#7 }
+ }
+ {
+ \__str_format_put:fw
+ { \str_substr:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } }
+ }
+ \__str_format_put:fw { \use_i:nnnn #4 . }
+ \use_none:n \s__stop
+ }
+ }
+\cs_new:Npn \__str_format_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4
+ {
+ \int_case:nnn {#1}
+ {
+ {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } }
+ {2} { inf }
+ {3} { nan }
+ }
+ {
+ \exp_last_unbraced:Nf \__str_format_fp_f_ii:wwwn
+ \fp_to_decimal:n
+ { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) }
+ . . ;
+ {#4}
+ }
+ }
+\cs_new:Npn \__str_format_fp_f_ii:wwwn #1 . #2 . #3 ; #4
+ {
+ \use:nf
+ { #1 . #2 }
+ { \prg_replicate:nn { #4 - \__str_count_unsafe:n {#2} } {0} }
+ }
+\cs_new:Npn \__str_format_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3
+ {
+ \int_case:nnn {#1}
+ {
+ {0} { 0 }
+ {2} { inf }
+ {3} { nan }
+ }
+ {
+ \exp_last_unbraced:Nf \__str_format_fp_g_ii:wn
+ \__str_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ;
+ { \int_max:nn {1} {#3} }
+ { \int_max:nn {1} {#3} }
+ }
+ }
+\cs_new:Npn \__str_format_fp_g_ii:wn #1; #2
+ {
+ \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 }
+ { \fp_to_scientific:n }
+ {
+ \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2}
+ { \fp_to_scientific:n }
+ { \fp_to_decimal:n }
+ }
+ { \__fp_abs_o:w #1; \prg_do_nothing: }
+ }
+\__msg_kernel_new:nnn { str } { invalid-format }
+ { Invalid~format~'#1'. }
+\__msg_kernel_new:nnn { str } { invalid-align-format }
+ { Invalid~alignment~'#1'~for~type~'#2'. }
+\__msg_kernel_new:nnn { str } { invalid-sign-format }
+ { Invalid~sign~'#1'~for~type~'#2'. }
+\__msg_kernel_new:nnn { str } { invalid-precision-format }
+ { Invalid~precision~'#1'~for~type~'#2'. }
+\__msg_kernel_new:nnn { str } { invalid-style-format }
+ { Invalid~style~'#1'~for~type~'#2'. }
+%%
+%%
+%% End of file `l3str-format.sty'.
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
index 3ad97283e3b..05cd375a84d 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str.sty
@@ -46,7 +46,7 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str.dtx 3940 2012-07-09 00:41:44Z bruno $
+\GetIdInfo$Id: l3str.dtx 4119 2012-08-16 22:35:59Z bruno $
{L3 Experimental strings}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -391,14 +391,13 @@
\prg_new_conditional:Npnn \__str_if_contains_char:NN #1#2 { T , TF }
{
\exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2
- \etex_detokenize:D \exp_after:wN {#1} { \__prg_break:n { ? \fi: } }
+ #1 { \__prg_break:n { ? \fi: } }
\__prg_break_point:
\prg_return_false:
}
\prg_new_conditional:Npnn \__str_if_contains_char:nN #1#2 { TF }
{
- \exp_after:wN \__str_if_contains_char_aux:NN \exp_after:wN #2
- \tl_to_str:n {#1} { \__prg_break:n { ? \fi: } }
+ \__str_if_contains_char_aux:NN #2 #1 { \__prg_break:n { ? \fi: } }
\__prg_break_point:
\prg_return_false:
}
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
index 8b90db9c751..0dfd6401fae 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty
@@ -361,7 +361,7 @@
\cs_new_protected:Npn \tl_show_analysis:N #1
{
\exp_args:No \__tl_analysis:n {#1}
- \__msg_show_variable:Nnn #1
+ \__msg_show_variable:Nnx #1
{ tl-analysis }
{
\exp_after:wN \__tl_analysis_show_loop:wNw \g__tl_analysis_result_tl