diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/expl3/l3prop.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/expl3/l3prop.sty | 265 |
1 files changed, 103 insertions, 162 deletions
diff --git a/Master/texmf-dist/tex/latex/expl3/l3prop.sty b/Master/texmf-dist/tex/latex/expl3/l3prop.sty index 21ff956c0fd..e18fb8e2b7f 100644 --- a/Master/texmf-dist/tex/latex/expl3/l3prop.sty +++ b/Master/texmf-dist/tex/latex/expl3/l3prop.sty @@ -15,7 +15,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File: l3prop.dtx Copyright (C) 1990-2008 LaTeX3 project +%% File: l3prop.dtx Copyright (C) 1990-2009 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 @@ -33,7 +33,7 @@ %% %% The development version of the bundle can be found at %% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% @@ -48,202 +48,143 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 745 2008-08-03 18:50:46Z morten $ +\GetIdInfo$Id: l3prop.dtx 1365 2009-05-31 17:26:17Z mittelba $ {L3 Experimental Property Lists} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} -\RequirePackage{l3toks}\par -\RequirePackage{l3quark}\par +\package_check_loaded_expl: \quark_new:N\q_prop - -\def_new:Npn \prop_new:N #1{\toks_new:N #1} -\def_new:Npn \prop_new:c {\exp_args:Nc \prop_new:N} -\let_new:NN \prop_clear:N \toks_clear:N -\def_new:Npn \prop_clear:c {\exp_args:Nc\prop_clear:N} -\let_new:NN \prop_gclear:N \toks_gclear:N -\def_new:Npn \prop_gclear:c {\exp_args:Nc\prop_gclear:N} -\def_long_new:Npn \prop_split_aux:Nnn #1#2#3{ - \def:Npn \tmp:w ##1\q_prop#2\q_prop##2##3\q_stop {#3{##1}{##2}{##3}} - \exp_after:NN\tmp:w \toks_use:N#1\q_prop#2\q_prop\q_no_value \q_stop +\cs_new_eq:NN \prop_new:N \toks_new:N +\cs_new_eq:NN \prop_new:c \toks_new:c +\cs_new_eq:NN \prop_clear:N \toks_clear:N +\cs_new_eq:NN \prop_clear:c \toks_clear:c +\cs_new_eq:NN \prop_gclear:N \toks_gclear:N +\cs_new_eq:NN \prop_gclear:c \toks_gclear:c +\cs_new_eq:NN \prop_set_eq:NN \toks_set_eq:NN +\cs_new_eq:NN \prop_set_eq:Nc \toks_set_eq:Nc +\cs_new_eq:NN \prop_set_eq:cN \toks_set_eq:cN +\cs_new_eq:NN \prop_set_eq:cc \toks_set_eq:cc +\cs_new_eq:NN \prop_gset_eq:NN \toks_gset_eq:NN +\cs_new_eq:NN \prop_gset_eq:Nc \toks_gset_eq:Nc +\cs_new_eq:NN \prop_gset_eq:cN \toks_gset_eq:cN +\cs_new_eq:NN \prop_gset_eq:cc \toks_gset_eq:cc +\cs_new_eq:NN \prop_show:N \toks_show:N +\cs_new_eq:NN \prop_show:c \toks_show:c +\cs_new_nopar:Npn \prop_display:N #1 { + \iow_term:x { Property-list~\token_to_str:N #1~contains~ + the~pairs~(without~outer~braces): } + \toks_clear:N \l_tmpa_toks + \prop_map_inline:Nn #1 { + \toks_if_empty:NF \l_tmpa_toks { + \toks_put_right:Nx \l_tmpa_toks {^^J>~} + } + \toks_put_right:Nx \l_tmpa_toks { + \iow_space: \iow_char:N \{ \exp_not:n {##1} \iow_char:N \} \iow_space: + \iow_space: => \iow_space: + \iow_space: \iow_char:N \{ \exp_not:n {##2} \iow_char:N \} + } + } + \toks_show:N \l_tmpa_toks +} +\cs_generate_variant:Nn \prop_display:N {c} +\cs_new:Npn \prop_split_aux:Nnn #1#2#3{ + \cs_set:Npn \prop_tmp:w ##1 \q_prop #2 \q_prop ##2##3 \q_stop { + #3 {##1}{##2}{##3} + } + \exp_after:wN \prop_tmp:w \toks_use:N #1 \q_prop #2 \q_prop \q_no_value \q_stop } -\def_long_new:NNn \prop_get:NnN 2{ - \prop_split_aux:Nnn #1{#2}\prop_get_aux:w} -\def_long_new:NNn \prop_get_aux:w 4{\tlp_set:Nx#4{\exp_not:n{#2}}} -\def_new:Npn \prop_get:cnN { \exp_args:Nc \prop_get:NnN } -\def_long_new:NNn \prop_gget:NnN 2{ +\cs_new:Npn \prop_get:NnN #1#2 { + \prop_split_aux:Nnn #1{#2}\prop_get_aux:w +} +\cs_new:Npn \prop_get_aux:w #1#2#3#4 { \tl_set:Nx #4 {\exp_not:n{#2}} } +\cs_generate_variant:Nn \prop_get:NnN {cnN} +\cs_new:Npn \prop_gget:NnN #1#2{ \prop_split_aux:Nnn #1{#2}\prop_gget_aux:w} -\def_new:Npn \prop_gget:NcN {\exp_args:NNc \prop_gget:NnN} -\def_new:Npn \prop_gget:cnN {\exp_args:Nc \prop_gget:NnN} -\def_long_new:NNn \prop_gget_aux:w 4{\tlp_gset:Nx#4{\exp_not:n{#2}}} -\def_long_new:NNn \prop_get_gdel:NnN 3{ +\cs_new:Npn \prop_gget_aux:w #1#2#3#4{\tl_gset:Nx#4{\exp_not:n{#2}}} +\cs_generate_variant:Nn \prop_gget:NnN {cnN} +\cs_new:Npn \prop_get_gdel:NnN #1#2#3{ \prop_split_aux:Nnn #1{#2}{\prop_get_del_aux:w #3{\toks_gset:Nn #1}{#2}}} -\def_long_new:NNn \prop_get_del_aux:w 6{ - \tlp_set:Nx #1{\exp_not:n{#5}} +\cs_new:Npn \prop_get_del_aux:w #1#2#3#4#5#6{ + \tl_set:Nx #1{\exp_not:n{#5}} \quark_if_no_value:NF #1 { - \def:Npn \tmp:w ##1\q_prop#3\q_prop\q_no_value {#2{#4##1}} - \tmp:w #6} + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#3\q_prop\q_no_value {#2{#4##1}} + \prop_tmp:w #6} } -\def_long_new:NNn \prop_put:Nnn 2{ +\cs_new:Npn \prop_put:Nnn #1#2{ \prop_split_aux:Nnn #1{#2}{ \prop_clear:N #1 - \prop_put_aux:w {\toks_put_right:Nn #1}{#2}} + \prop_put_aux:w {\toks_put_right:Nn #1}{#2} + } } -\def_new:Npn \prop_put:ccn {\exp_args:Ncc \prop_put:Nnn } - -\def_long_new:NNn \prop_gput:Nnn 2{ +\cs_new:Npn \prop_gput:Nnn #1#2{ \prop_split_aux:Nnn #1{#2}{ \prop_gclear:N #1 - \prop_put_aux:w {\toks_gput_right:Nn #1}{#2}} + \prop_put_aux:w {\toks_gput_right:Nn #1}{#2} + } } - -\def_long_new:NNn \prop_put_aux:w 6{ +\cs_new:Npn \prop_put_aux:w #1#2#3#4#5#6{ #1{\q_prop#2\q_prop{#6}#3} - \tlist_if_empty:nF{#5} + \tl_if_empty:nF{#5} { - \def:Npn \tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}} - \tmp:w #5 + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}} + \prop_tmp:w #5 } } -\def_new:Npn \prop_gput:Nno {\exp_args:NNno \prop_gput:Nnn} -\def_new:Npn \prop_gput:Nnx {\exp_args:NNnx \prop_gput:Nnn} -\def_new:Npn \prop_gput:Nox {\exp_args:NNox \prop_gput:Nnn} -\def_new:Npn \prop_gput:Noo {\exp_args:NNoo \prop_gput:Nnn} -\def_new:Npn \prop_gput:Ncn {\exp_args:NNc \prop_gput:Nnn} -\def_new:Npn \prop_gput:Ooo {\exp_args:NOoo \prop_gput:Nnn} -\def_new:Npn \prop_gput:cnn {\exp_args:Nc \prop_gput:Nnn} -\def_new:Npn \prop_gput:ccn {\exp_args:Ncc \prop_gput:Nnn} -\def_new:Npn \prop_gput:cco {\exp_args:Ncco \prop_gput:Nnn} -\def_new:Npn \prop_gput:ccx {\exp_args:Nccx \prop_gput:Nnn} -\def_long_new:NNn \prop_del:Nn 2{ +\cs_generate_variant:Nn \prop_put:Nnn {cnn} +\cs_generate_variant:Nn \prop_gput:Nnn {NnV,Nno,Nnx,Nox,cnn,ccx} +\cs_new:Npn \prop_del:Nn #1#2{ \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_set:Nn #1}{#2}}} -\def_long_new:NNn \prop_gdel:Nn 2{ +\cs_new:Npn \prop_gdel:Nn #1#2{ \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_gset:Nn #1}{#2}}} -\def_long_new:NNn \prop_del_aux:w 5{ - \def:Npn \tmp:w {#4} - \quark_if_no_value:NF \tmp:w - {\def:Npn \tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{#3##1}} - \tmp:w #5}} -\def_new:NNn \prop_if_in:NnTF 2{ - \prop_split_aux:Nnn #1{#2}\prop_if_in_aux:w} -\def_new:NNn \prop_if_in_aux:w 3{\quark_if_no_value:nFT {#2}} - -\def_new:Npn \prop_if_in:NoTF {\exp_args:NNo \prop_if_in:NnTF} -\def_new:Npn \prop_if_in:ccTF {\exp_args:Ncc \prop_if_in:NnTF} -\def_long_new:NNn \prop_gput_if_new:Nnn 2{ - \prop_split_aux:Nnn #1{#2}{\prop_put_if_new_aux:w #1{#2}}} -\def_long_new:NNn \prop_put_if_new_aux:w 6{ - \tlist_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}} -\let_new:NN \prop_set_eq:NN \toks_set_eq:NN -\let_new:NN \prop_set_eq:Nc \toks_set_eq:Nc -\let_new:NN \prop_set_eq:cN \toks_set_eq:cN -\let_new:NN \prop_set_eq:cc \toks_set_eq:cc -\let_new:NN \prop_gset_eq:NN \toks_gset_eq:NN -\let_new:NN \prop_gset_eq:Nc \toks_gset_eq:Nc -\let_new:NN \prop_gset_eq:cN \toks_gset_eq:cN -\let_new:NN \prop_gset_eq:cc \toks_gset_eq:cc -\let_new:NN \prop_if_empty_p:N \toks_if_empty_p:N -\let_new:NN \prop_if_empty_p:c \toks_if_empty_p:c -\let_new:NN \prop_if_empty:NTF \toks_if_empty:NTF -\let_new:NN \prop_if_empty:NT \toks_if_empty:NT -\let_new:NN \prop_if_empty:NF \toks_if_empty:NF -\let_new:NN \prop_if_empty:cTF \toks_if_empty:cTF -\let_new:NN \prop_if_empty:cT \toks_if_empty:cTF -\let_new:NN \prop_if_empty:cF \toks_if_empty:cF -\def_new:NNn \prop_if_eq:NNTF 2 { - \tlist_if_eq:xxTF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \prop_if_eq:NNT 2 { - \tlist_if_eq:xxT{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:NNn \prop_if_eq:NNF 2 { - \tlist_if_eq:xxF{\toks_use:N #1}{\toks_use:N #2} -} -\def_new:Npn \prop_if_eq:NcTF {\exp_args:NNc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:NcT {\exp_args:NNc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:NcF {\exp_args:NNc \prop_if_eq:NNF} -\def_new:Npn \prop_if_eq:cNTF {\exp_args:Nc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:cNT {\exp_args:Nc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:cNF {\exp_args:Nc \prop_if_eq:NNF} -\def_new:Npn \prop_if_eq:ccTF {\exp_args:Ncc \prop_if_eq:NNTF} -\def_new:Npn \prop_if_eq:ccT {\exp_args:Ncc \prop_if_eq:NNT} -\def_new:Npn \prop_if_eq:ccF {\exp_args:Ncc \prop_if_eq:NNF} -\def_new:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop{}\q_prop \q_no_value \q_stop -} -\def_new:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \if:w \tlist_if_empty_p:n{#2} - \exp_after:NN \prop_map_break:w - \fi: - #1{#2}{#3} - \prop_map_function_aux:w #1 +\cs_new:Npn \prop_del_aux:w #1#2#3#4#5{ + \cs_set_nopar:Npn \prop_tmp:w {#4} + \quark_if_no_value:NF \prop_tmp:w { + \cs_set_nopar:Npn \prop_tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{#3##1}} + \prop_tmp:w #5 + } } - -\def:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop \q_no_value \q_prop \q_no_value +\cs_new:Npn \prop_gput_if_new:Nnn #1#2{ + \prop_split_aux:Nnn #1{#2}{\prop_put_if_new_aux:w #1{#2}}} +\cs_new:Npn \prop_put_if_new_aux:w #1#2#3#4#5#6{ + \tl_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}} +\prg_new_eq_conditional:NNn \prop_if_empty:N \toks_if_empty:N {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_empty:c \toks_if_empty:c {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:NN \toks_if_eq:NN {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:cN \toks_if_eq:cN {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:Nc \toks_if_eq:Nc {p,TF,T,F} +\prg_new_eq_conditional:NNn \prop_if_eq:cc \toks_if_eq:cc {p,TF,T,F} +\prg_new_conditional:Nnn \prop_if_in:Nn {TF,T,F} { + \prop_split_aux:Nnn #1 {#2} {\prop_if_in_aux:w} } -\def:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \quark_if_no_value:nF{#2} - { - #1{#2}{#3} - \prop_map_function_aux:w #1 - } +\cs_new_nopar:Npn \prop_if_in_aux:w #1#2#3 { + \quark_if_no_value:nTF {#2} {\prg_return_false:} {\prg_return_true:} } - -\def:Npn \prop_map_function:NN #1#2{ - \exp_after:NN \prop_map_function_aux:w - \exp_after:NN #2 \toks_use:N #1 \q_prop \q_nil \q_prop \q_no_value \q_stop +\cs_generate_variant:Nn \prop_if_in:NnTF {NV,No,cn,cc} +\cs_generate_variant:Nn \prop_if_in:NnT {NV,No,cn,cc} +\cs_generate_variant:Nn \prop_if_in:NnF {NV,No,cn,cc} +\cs_set_nopar:Npn \prop_map_function:NN #1#2 { + \exp_after:wN \prop_map_function_aux:w + \exp_after:wN #2 \toks_use:N #1 \q_prop \q_nil \q_prop \q_no_value \q_stop } -\def:Npn \prop_map_function_aux:w #1\q_prop#2\q_prop#3{ - \if_meaning:NN \q_nil #2 - \exp_after:NN \prop_map_break:w +\cs_set:Npn \prop_map_function_aux:w #1 \q_prop #2 \q_prop #3 { + \if_meaning:w \q_nil #2 + \exp_after:wN \prop_map_break: \fi: #1{#2}{#3} \prop_map_function_aux:w #1 } - - -\def_new:Npn \prop_map_function:cN {\exp_args:Nc \prop_map_function:NN } -\def_new:Npn \prop_map_function:Nc {\exp_args:NNc \prop_map_function:NN } -\def_new:Npn \prop_map_function:cc {\exp_args:Ncc \prop_map_function:NN} +\cs_generate_variant:Nn \prop_map_function:NN {c,Nc,cc} \num_new:N \g_prop_inline_level_num -\def_new:Npn \prop_map_inline:Nn #1#2 { +\cs_new_nopar:Npn \prop_map_inline:Nn #1#2 { \num_gincr:N \g_prop_inline_level_num - \gdef_long:cpn {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} + \cs_gset:cpn {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} ##1##2{#2} \prop_map_function:Nc #1 {prop_map_inline_ \num_use:N \g_prop_inline_level_num :n} \num_gdecr:N \g_prop_inline_level_num } -\def_new:Npn \prop_map_inline:cN { \exp_args:Nc \prop_map_inline:NN } -\let_new:NN \prop_map_break:w \use_none_delimit_by_q_stop:w -\def:Npn \prop_put:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_put:Nnn}\prop_put:Nnn} -\def:Npn \prop_gput:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:Nnn }\prop_gput:Nnn } -\def:Npn \prop_gput:NNo {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:Nno }\prop_gput:Nno } -\def:Npn \prop_gput:cNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput:cnn }\prop_gput:cnn } -\def:Npn \prop_gput_if_new:NNn {\typeout{Warning:~name~ - changed~ to~ \string\prop_gput_if_new:Nnn }\prop_gput_if_new:Nnn } -\def:Npn \prop_get:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get:NnN }\prop_get:NnN } -\def:Npn \prop_get:cNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get:cnN }\prop_get:cnN } -\def:Npn \prop_gget:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gget:NnN }\prop_gget:NnN } -\def:Npn \prop_gget:cNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gget:cnN }\prop_gget:cnN } -\def:Npn \prop_get_gdel:NNN {\typeout{Warning:~name~ - changed~ to~ \string\prop_get_gdel:NnN }\prop_get_gdel:NnN } -\def:Npn \prop_del:NN {\typeout{Warning:~name~ - changed~ to~ \string\prop_del:Nn }\prop_del:Nn } -\def:Npn \prop_gdel:NN {\typeout{Warning:~name~ - changed~ to~ \string\prop_gdel:Nn }\prop_gdel:Nn } -\def:Npn \prop_if_in:NNTF {\typeout{Warning:~name~ - changed~ to~ \string\prop_if_in:NnTF }\prop_if_in:NnTF } +\cs_generate_variant:Nn\prop_map_inline:Nn {cn} +\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_stop:w %% %% %% End of file `l3prop.sty'. |