%% %% This is file `l3prop.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3prop.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: l3prop.dtx Copyright (C) 1990-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 "l3kernel 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{l3names} \GetIdInfo$Id: l3prop.dtx 2839 2011-09-17 20:18:23Z bruno $ {L3 Experimental property lists} %% \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \quark_new:N \q_prop \tl_const:Nn \c_empty_prop { \q_prop } \cs_new_protected:Npn \prop_new:N #1 { \cs_new_eq:NN #1 \c_empty_prop } \cs_new_protected:Npn \prop_new:c #1 { \cs_new_eq:cN {#1} \c_empty_prop } \cs_new_protected:Npn \prop_clear:N #1 { \cs_set_eq:NN #1 \c_empty_prop } \cs_new_protected:Npn \prop_clear:c #1 { \cs_set_eq:cN {#1} \c_empty_prop } \cs_new_protected:Npn \prop_gclear:N #1 { \cs_gset_eq:NN #1 \c_empty_prop } \cs_new_protected:Npn \prop_gclear:c #1 { \cs_gset_eq:cN {#1} \c_empty_prop } \cs_new_protected:Npn \prop_clear_new:N #1 { \cs_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } \cs_generate_variant:Nn \prop_clear_new:N {c} \cs_new_protected:Npn \prop_gclear_new:N #1 { \cs_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } \cs_new_eq:NN \prop_gclear_new:c \prop_gclear:c \cs_new_eq:NN \prop_set_eq:NN \tl_set_eq:NN \cs_new_eq:NN \prop_set_eq:Nc \tl_set_eq:Nc \cs_new_eq:NN \prop_set_eq:cN \tl_set_eq:cN \cs_new_eq:NN \prop_set_eq:cc \tl_set_eq:cc \cs_new_eq:NN \prop_gset_eq:NN \tl_gset_eq:NN \cs_new_eq:NN \prop_gset_eq:Nc \tl_gset_eq:Nc \cs_new_eq:NN \prop_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \prop_gset_eq:cc \tl_gset_eq:cc \cs_set_protected:Npn \prop_split:NnTF #1#2 { \exp_args:NNo \prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } \cs_new_protected:Npn \prop_split_aux:NnTF #1#2 { \cs_set_protected:Npn \prop_split_aux:w ##1 \q_prop #2 \q_prop ##2 ##3 ##4 \q_mark ##5 \q_stop { \prop_split_aux:nnnn ##3 { {##1 \q_prop } {##2} {##4} } } \exp_after:wN \prop_split_aux:w #1 \q_mark \q_prop #2 \q_prop { } { ? \use_ii:nn { } } \q_mark \q_stop } \cs_new:Npn \prop_split_aux:nnnn #1#2#3#4 { #3 #2 } \cs_new_protected:Npn \prop_split_aux:w { } \cs_set_protected:Npn \prop_split:Nnn #1#2#3 { \prop_split:NnTF #1 {#2} {#3} { \exp_args:Nno \use:n {#3} {#1} { \q_no_value } { } } } \cs_new_protected:Npn \prop_del:Nn #1#2 { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_set:Nn #1 } { } } \cs_new_protected:Npn \prop_gdel:Nn #1#2 { \prop_split:NnTF #1 {#2} { \prop_del_aux:NNnnn \tl_gset:Nn #1 } { } } \cs_new_protected:Npn \prop_del_aux:NNnnn #1#2#3#4#5 { #1 #2 { #3 #5 } } \cs_generate_variant:Nn \prop_del:Nn { NV } \cs_generate_variant:Nn \prop_del:Nn { c , cV } \cs_generate_variant:Nn \prop_gdel:Nn { NV } \cs_generate_variant:Nn \prop_gdel:Nn { c , cV } \cs_new_protected:Npn \prop_get:NnN #1#2#3 { \prop_split:NnTF #1 {#2} { \prop_get_aux:Nnnn #3 } { \tl_set:Nn #3 { \q_no_value } } } \cs_new_protected:Npn \prop_get_aux:Nnnn #1#2#3#4 { \tl_set:Nn #1 {#3} } \cs_generate_variant:Nn \prop_get:NnN { NV , No } \cs_generate_variant:Nn \prop_get:NnN { c , cV , co } \cs_new_protected:Npn \prop_pop:NnN #1#2#3 { \prop_split:NnTF #1 {#2} { \prop_pop_aux:NNNnnn \tl_set:Nn #1 #3 } { \tl_set:Nn #3 { \q_no_value } } } \cs_new_protected:Npn \prop_gpop:NnN #1#2#3 { \prop_split:NnTF #1 {#2} { \prop_pop_aux:NNNnnn \tl_gset:Nn #1 #3 } { \tl_set:Nn #3 { \q_no_value } } } \cs_new_protected:Npn \prop_pop_aux:NNNnnn #1#2#3#4#5#6 { \tl_set:Nn #3 {#5} #1 #2 { #4 #6 } } \cs_generate_variant:Nn \prop_pop:NnN { No } \cs_generate_variant:Nn \prop_pop:NnN { c , co } \cs_generate_variant:Nn \prop_gpop:NnN { No } \cs_generate_variant:Nn \prop_gpop:NnN { c , co } \cs_new_protected:Npn \prop_put:Nnn { \prop_put_aux:NNnn \tl_set:Nx } \cs_new_protected:Npn \prop_gput:Nnn { \prop_put_aux:NNnn \tl_gset:Nx } \cs_new_protected:Npn \prop_put_aux:NNnn #1#2#3#4 { \prop_split:Nnn #2 {#3} { \prop_put_aux:NNnnnnn #1 #2 {#3} {#4} } } \cs_new_protected:Npn \prop_put_aux:NNnnnnn #1#2#3#4#5#6#7 { #1 #2 { \exp_not:n { #5 #7 } \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } } } \cs_generate_variant:Nn \prop_put:Nnn { NnV , Nno , Nnx , NV , NVV , No , Noo } \cs_generate_variant:Nn \prop_put:Nnn { c , cnV , cno , cnx , cV , cVV , co , coo } \cs_generate_variant:Nn \prop_gput:Nnn { NnV , Nno , Nnx , NV , NVV , No , Noo } \cs_generate_variant:Nn \prop_gput:Nnn { c , cnV , cno , cnx , cV , cVV , co , coo } \cs_new_protected_nopar:Npn \prop_put_if_new:Nnn { \prop_put_if_new_aux:NNnn \tl_put_right:Nx } \cs_new_protected_nopar:Npn \prop_gput_if_new:Nnn { \prop_put_if_new_aux:NNnn \tl_gput_right:Nx } \cs_new_protected:Npn \prop_put_if_new_aux:NNnn #1#2#3#4 { \prop_split:NnTF #2 {#3} { \use_none:nnn } { #1 #2 { \tl_to_str:n {#3} \exp_not:n { \q_prop {#4} \q_prop } } } } \cs_generate_variant:Nn \prop_put_if_new:Nnn { c } \cs_generate_variant:Nn \prop_gput_if_new:Nnn { c } \prg_new_conditional:Npnn \prop_if_empty:N #1 { p, T , F , TF } { \if_meaning:w #1 \c_empty_prop \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \prop_if_empty_p:N {c} \cs_generate_variant:Nn \prop_if_empty:NTF {c} \cs_generate_variant:Nn \prop_if_empty:NT {c} \cs_generate_variant:Nn \prop_if_empty:NF {c} \prg_new_conditional:Npnn \prop_if_in:Nn #1#2 { p , T , F , TF } { \exp_last_unbraced:Noo \prop_if_in_aux:nwn { \tl_to_str:n {#2} } #1 \tl_to_str:n {#2} \q_prop { } \q_recursion_tail \q_recursion_stop } \cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 { \str_if_eq:xxTF {#1} {#2} { \prop_if_in_aux:Nw } { \prop_if_in_aux:nwn {#1} } } \cs_new:Npn \prop_if_in_aux:Nw #1 #2 \q_recursion_stop { \if_meaning:w \q_prop #1 \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } \cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } \cs_generate_variant:Nn \prop_if_in:NnT { NV , No } \cs_generate_variant:Nn \prop_if_in:NnT { c , cV , co } \cs_generate_variant:Nn \prop_if_in:NnF { NV , No } \cs_generate_variant:Nn \prop_if_in:NnF { c , cV , co } \cs_generate_variant:Nn \prop_if_in:NnTF { NV , No } \cs_generate_variant:Nn \prop_if_in:NnTF { c , cV , co } \prg_new_protected_conditional:Npnn \prop_get:NnN #1#2#3 { T , F , TF } { \prop_split:NnTF #1 {#2} { \prop_get_aux_true:Nnnn #3 } { \prg_return_false: } } \cs_new_protected:Npn \prop_get_aux_true:Nnnn #1#2#3#4 { \tl_set:Nn #1 {#3} \prg_return_true: } \cs_generate_variant:Nn \prop_get:NnNT { NV , No } \cs_generate_variant:Nn \prop_get:NnNF { NV , No } \cs_generate_variant:Nn \prop_get:NnNTF { NV , No } \cs_generate_variant:Nn \prop_get:NnNT { c , cV , co } \cs_generate_variant:Nn \prop_get:NnNF { c , cV , co } \cs_generate_variant:Nn \prop_get:NnNTF { c , cV , co } \cs_new_nopar:Npn \prop_map_function:NN #1#2 { \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 #1 \q_recursion_tail \q_prop { } \q_recursion_stop } \cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 { \if_meaning:w \q_recursion_tail #2 \exp_after:wN \prop_map_break: \fi: #1 {#2} {#3} \prop_map_function_aux:Nwn #1 } \cs_generate_variant:Nn \prop_map_function:NN { Nc } \cs_generate_variant:Nn \prop_map_function:NN { c , cc } \int_new:N \g_prop_map_inline_int \cs_new_protected:Npn \prop_map_inline:Nn #1#2 { \int_gincr:N \g_prop_map_inline_int \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } ##1##2 {#2} \prop_map_function:Nc #1 { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } \int_gdecr:N \g_prop_map_inline_int } \cs_generate_variant:Nn \prop_map_inline:Nn { c } \cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_recursion_stop:w \cs_new_eq:NN \prop_map_break:n \use_i_delimit_by_q_recursion_stop:nw \tl_new:N \l_prop_show_tl \cs_new_protected_nopar:Npn \prop_show:N #1 { \prop_if_empty:NTF #1 { \iow_term:x { Property~list~\token_to_str:N #1~is~empty } \tl_show:n { } } { \iow_term:x { Property~list~\token_to_str:N #1~ contains~the~pairs~(without~outer~braces): } \tl_set:Nx \l_prop_show_tl { \prop_map_function:NN #1 \prop_show_aux:nn } \tl_show:n \exp_after:wN \exp_after:wN \exp_after:wN { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } } } \cs_new:Npn \prop_show_aux:nn #1#2 { \iow_newline: > \c_space_tl \c_space_tl \iow_char:N \{ #1 \iow_char:N \} \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \iow_char:N \{ \exp_not:n {#2} \iow_char:N \} } \cs_new:Npn \prop_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \prop_show:N { c } \prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 { T , F , TF } { \prop_split:NnTF #1 {#2} { \prop_pop_aux_true:NNNnnn \tl_set:Nn #1 #3 } { \prg_return_false: } } \prg_new_protected_conditional:Npnn \prop_gpop:NnN #1#2#3 { T , F , TF } { \prop_split:NnTF #1 {#2} { \prop_pop_aux_true:NNNnnn \tl_gset:Nn #1 #3 } { \prg_return_false: } } \cs_new_protected:Npn \prop_pop_aux_true:NNNnnn #1#2#3#4#5#6 { \tl_set:Nn #3 {#5} #1 #2 { #4 #6 } \prg_return_true: } \cs_generate_variant:Nn \prop_pop:NnNT { c } \cs_generate_variant:Nn \prop_pop:NnNF { c } \cs_generate_variant:Nn \prop_pop:NnNTF { c } \cs_generate_variant:Nn \prop_gpop:NnNT { c } \cs_generate_variant:Nn \prop_gpop:NnNF { c } \cs_generate_variant:Nn \prop_gpop:NnNTF { c } \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 \q_recursion_tail \q_prop { } \q_recursion_stop } \cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 { \if_meaning:w \q_recursion_tail #2 \exp_after:wN \prop_map_break: \fi: \use:n {#1} {#2} {#3} \prop_map_tokens_aux:nwn {#1} } \cs_generate_variant:Nn \prop_map_tokens:Nn { c } \cs_new:Npn \prop_get:Nn #1#2 { \exp_last_unbraced:Noo \prop_get_Nn_aux:nwn { \tl_to_str:n {#2} } #1 \tl_to_str:n {#2} \q_prop { } \q_recursion_stop } \cs_new:Npn \prop_get_Nn_aux:nwn #1 \q_prop #2 \q_prop #3 { \str_if_eq:xxTF {#1} {#2} { \use_i_delimit_by_q_recursion_stop:nw {#3} } { \prop_get_Nn_aux:nwn {#1} } } \cs_generate_variant:Nn \prop_get:Nn { c } %% %% %% End of file `l3prop.sty'.