diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3prg.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/expl3/l3prg.sty | 86 |
1 files changed, 85 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3prg.sty b/Master/texmf-dist/tex/latex/expl3/l3prg.sty index 5476a648597..38112ebffa8 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prg.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prg.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 1853 2010-03-21 09:11:08Z joseph $ +\GetIdInfo$Id: l3prg.dtx 1992 2010-08-04 20:41:40Z joseph $ {L3 Experimental control structures} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -478,6 +478,90 @@ } } } +\cs_new_protected:Npn \prg_new_map_functions:Nn #1#2 { + \cs_if_free:cTF { #2 _map_function:NN } + { \prg_set_map_functions:Nn #1 {#2} } + { + \msg_kernel_error:nnx { code } { csname-already-defined } + { \token_to_str:c { #2 _map_function:NN } } + } +} +\cs_new_protected:Npn \prg_set_map_functions:Nn #1#2 { + \cs_gset_nopar:cpx { #2 _map_function:NN } ##1##2 + { + \exp_not:N \tl_if_empty:NF ##1 + { + \exp_not:N \exp_after:wN + \exp_not:c { #2 _map_function_aux:Nw } + \exp_not:N \exp_after:wN ##2 ##1 + \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop } + } + } + \cs_gset:cpx { #2 _map_function:nN } ##1##2 + { + \exp_not:N \tl_if_blank:nF {##1} + { + \exp_not:c { #2 _map_function_aux:Nw } ##2 ##1 + \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop } + } + } + \cs_gset:cpx { #2 _map_function_aux:Nw } ##1##2 #1 + { + \exp_not:N \quark_if_recursion_tail_stop:n {##2} + ##1 {##2} + \exp_not:c { #2 _map_function_aux:Nw } ##1 + } + \cs_if_free:cT { g_ #2 _map_inline_int } + { \int_new:c { g_ #2 _map_inline_int } } + \cs_gset_protected_nopar:cpx { #2 _map_inline:Nn } ##1##2 + { + \exp_not:N \tl_if_empty:NF ##1 + { + \exp_not:N \int_gincr:N \exp_not:c { g_ #2 _map_inline_int } + \cs_gset:cpn + { + #2 _map_inline_ + \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int } + :n + } + ####1 {##2} + \exp_not:N \exp_last_unbraced:NcV + \exp_not:c { #2 _map_function_aux:Nw } + { + #2 _map_inline_ + \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int } + :n + } + ##1 \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop } + \exp_not:N \int_gdecr:N \exp_not:c { g_ #2 _map_inline_int } + } + } + \cs_gset_protected:cpx { #2 _map_inline:nn } ##1##2 + { + \exp_not:N \tl_if_empty:nF {##1} + { + \exp_not:N \int_gincr:N \exp_not:c { g_ #2 _map_inline_int } + \cs_gset:cpn + { + #2 _map_inline_ + \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int } + :n + } + ####1 {##2} + \exp_not:N \exp_args:Nc + \exp_not:c { #2 _map_function_aux:Nw } + { + #2 _map_inline_ + \exp_not:N \int_use:N \exp_not:c { g_ #2 _map_inline_int } + :n + } + ##1 \exp_not:n { #1 \q_recursion_tail #1 \q_recursion_stop } + \exp_not:N \int_gdecr:N \exp_not:c { g_ #2 _map_inline_int } + } + } + \cs_gset_eq:cN { #2 _map_break: } + \use_none_delimit_by_q_recursion_stop:w +} %% %% %% End of file `l3prg.sty'. |