summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/expl3/l3prop.dtx
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-29 11:23:34 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-29 11:23:34 +0000
commitef285e6a49a93af098150d0b3125a34d3477ba55 (patch)
tree124a55595390d358e0cda8ae26f78e9a263e9a21 /Master/texmf-dist/source/latex/expl3/l3prop.dtx
parente7477f362711cc9d05dfa1ee71301fb34cce2d94 (diff)
expl3 update (2008/06/20)
git-svn-id: svn://tug.org/texlive/trunk@9869 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3prop.dtx')
-rw-r--r--Master/texmf-dist/source/latex/expl3/l3prop.dtx479
1 files changed, 215 insertions, 264 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3prop.dtx b/Master/texmf-dist/source/latex/expl3/l3prop.dtx
index 2315892f1a6..22d7a7ecaeb 100644
--- a/Master/texmf-dist/source/latex/expl3/l3prop.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3prop.dtx
@@ -32,26 +32,21 @@
%%
%% -----------------------------------------------------------------------
%
-%<package>\RequirePackage{l3names}
-%<*dtx>
+%<*driver|package>
+\RequirePackage{l3names}
+%</driver|package>
%\fi
-\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{%
- \def\fileversion{#2}%
- \def\filedate{#3/#4/#5}%
- \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]%
-}
-%\iffalse
-%</dtx>
-%\fi
-\GetIdInfo$Id: l3prop.dtx 581 2006-12-12 12:28:27Z morten $
+\GetIdInfo$Id: l3prop.dtx 668 2007-09-27 15:54:23Z mittelba $
{L3 Experimental Property Lists}
-%
-% \iffalse
+%\iffalse
%<*driver>
+%\fi
+\ProvidesFile{\filename.\filenameext}
+ [\filedate\space v\fileversion\space\filedescription]
+%\iffalse
\documentclass{l3doc}
-
\begin{document}
-\DocInput{l3prop.dtx}
+\DocInput{\filename.\filenameext}
\end{document}
%</driver>
% \fi
@@ -95,21 +90,21 @@
% \end{function}
%
% \begin{function}{%
-% \prop_put:NNn |
+% \prop_put:Nnn |
% \prop_put:ccn |
-% \prop_gput:NNn |
-% \prop_gput:NNo |
-% \prop_gput:NOo |
+% \prop_gput:Nnn |
+% \prop_gput:Nno |
+% \prop_gput:Noo |
% \prop_gput:Ncn |
-% \prop_gput:OOo |
-% \prop_gput:NOx |
-% \prop_gput:cNn |
+% \prop_gput:Ooo |
+% \prop_gput:Nox |
+% \prop_gput:cnn |
% \prop_gput:ccn |
% \prop_gput:cco |
% \prop_gput:ccx |
% }
% \begin{syntax}
-% "\prop_put:NNn" <plist> <key> "{"<token list>"}"
+% "\prop_put:Nnn" <plist> "{"<key>"}" "{"<token list>"}"
% \end{syntax}
% Locally or globally associates <token list> with <key> in the p-list
% <plist>. If <key> has already a meaning within <plist> this value is
@@ -117,10 +112,10 @@
% \end{function}
%
% \begin{function}{%
-% \prop_gput_if_new:NNn |
+% \prop_gput_if_new:Nnn |
% }
% \begin{syntax}
-% "\prop_gput_if_new:NNn" <plist> <key> "{"<token list>"}"
+% "\prop_gput_if_new:Nnn" <plist> "{"<key>"}" "{"<token list>"}"
% \end{syntax}
% Globally associates <token list> with <key> in the p-list
% <plist> but only if <key> has so far no meaning within <plist>.
@@ -128,14 +123,14 @@
% \end{function}
%
% \begin{function}{%
-% \prop_get:NNN |
-% \prop_get:cNN |
-% \prop_gget:NNN |
+% \prop_get:NnN |
+% \prop_get:cnN |
+% \prop_gget:NnN |
% \prop_gget:NcN |
-% \prop_gget:cNN |
+% \prop_gget:cnN |
% }
% \begin{syntax}
-% "\prop_get:NNN" <plist> <key> <tlp>
+% "\prop_get:NnN" <plist> "{"<key>"}" <tlp>
% \end{syntax}
% If <info> is the information associated with <key> in the p-list
% <plist> then the token list pointer <tlp> gets <info> assigned.
@@ -157,21 +152,21 @@
% \end{function}
%
% \begin{function}{%
-% \prop_get_gdel:NNN |
+% \prop_get_gdel:NnN |
% }
% \begin{syntax}
-% "\prop_get_gdel:NNN" <plist> <key> <tlp>
+% "\prop_get_gdel:NnN" <plist> "{"<key>"}" <tlp>
% \end{syntax}
-% Like "\prop_get:NNN" but additionally removes <key> (and its <info>)
+% Like "\prop_get:NnN" but additionally removes <key> (and its <info>)
% from <plist>.
% \end{function}
%
% \begin{function}{%
-% \prop_del:NN |
-% \prop_gdel:NN |
+% \prop_del:Nn |
+% \prop_gdel:Nn |
% }
% \begin{syntax}
-% "\prop_del:NN" <plist> <key>
+% "\prop_del:Nn" <plist> "{"<key>"}"
% \end{syntax}
% Locally or globally deletes <key> and its <info> from <plist> if
% found. Otherwise does nothing.
@@ -180,6 +175,7 @@
%
% \begin{function}{\prop_map_function:NN |
% \prop_map_function:cN |
+% \prop_map_function:Nc |
% \prop_map_function:cc |
% }
% \begin{syntax}
@@ -197,8 +193,7 @@
% \end{syntax}
% Just like "\prop_map_function:NN" but with the function of two arguments
% supplied as inline code. Within <inline function> refer to the
-% arguments via "##1" (<key>) and "##2" (<info>). Fast but not
-% expandable.
+% arguments via "#1" (<key>) and "#2" (<info>). Nestable.
% \end{function}
%
%
@@ -235,12 +230,12 @@
%
%
% \begin{function}{%
-% \prop_if_in:NNTF |
-% \prop_if_in:NOTF |
+% \prop_if_in:NnTF |
+% \prop_if_in:NoTF |
% \prop_if_in:ccTF |
% }
% \begin{syntax}
-% "\prop_if_in:NNTF" <plist><key>"{"<true code>"}{"<false code>"}"
+% "\prop_if_in:NnTF" <plist>"{"<key>"}{"<true code>"}{"<false code>"}"
% \end{syntax}
% Tests if <key> is used in <plist> and then either executes <true code>
% or <false code>.
@@ -283,9 +278,9 @@
% "\prop_map_inline:NN".
% \end{function}
%
-% \begin{function}{\prop_split_aux:NNn}
+% \begin{function}{\prop_split_aux:Nnn}
% \begin{syntax}
-% "\prop_split_aux:NNn" <plist> <key> <cmd>
+% "\prop_split_aux:Nnn" <plist> <key> <cmd>
% \end{syntax}
% Internal function that invokes <cmd> with 3 arguments: 1st is the
% beginning of <plist> before <key>, 2nd is the value associated with
@@ -303,16 +298,26 @@
%
% We start by ensuring that the required packages are loaded.
% \begin{macrocode}
+%<package>\ProvidesExplPackage
+%<package> {\filename}{\filedate}{\fileversion}{\filedescription}
%<package>\RequirePackage{l3toks}\par
+%<package>\RequirePackage{l3quark}\par
%<*initex|package>
% \end{macrocode}
%
% A property list is a token register whose contents is
-% of the form `\zz{tok$\sb1$}\zv{val$\sb1$} \ldots{}
-% \zz{tok$\sb{}n$}\zv{val$\sb{}n$}'. The properties have to be single
+% of the form `\zz{q_prop}key$\sb1$\zz{q_prop}\zv{val$\sb1$} \ldots{}
+% \zz{q_prop}key$\sb n$\zz{q_prop}\zv{val$\sb{}n$}'.
+% The properties have to be single
% token, the values might be arbitrary token lists they get surrounded
% by braces.
%
+% \begin{macro}{\q_prop}
+% \begin{macrocode}
+\quark_new:N\q_prop
+% \end{macrocode}
+% \end{macro}
+
% To get values from property-lists, token lists should be passed to
% the appropriate functions.
%
@@ -343,56 +348,51 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\prop_use:N}
-% The same goes for clearing a property list, either
-% locally or globally.
-% \begin{macrocode}
-\let_new:NN \prop_use:N \toks_use:N
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macro}{\prop_split_aux:NNn}
+%
+% \begin{macro}{\prop_split_aux:Nnn}
% |\prop_split_aux:NNn|\zz{plist}\zz{prop}\zz{cmd} invokes \zz{cmd}
% with 3 arguments: 1st is the beginning of \zz{plist} before
% \zz{prop}, 2nd is the value associated with \zz{prop}, 3rd is the
% rest of \zz{plist} after \zz{prop}. If there is no property
% \zz{prop} in \zz{plist}, then the 2nd argument will be |\q_no_value|
-% and the 3rd argument is empty; otherwise the 3rd argument has the two
-% extra tokens \zz{prop} |\q_no_value| at the end.
+% and the 3rd argument is empty; otherwise the 3rd argument has the
+% extra tokens |\q_prop| \zz{prop} |\q_prop| |\q_no_value| at the end.
% \begin{macrocode}
-\def_long_new:Npn \prop_split_aux:NNn #1#2#3{
- \def:Npn \tmp:w ##1#2##2##3\q_stop {#3{##1}{##2}{##3}}
- \exp_after:NN\tmp:w \prop_use:N#1#2\q_no_value \q_stop}
+\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
+}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\prop_get:NNN}
-% \begin{macro}{\prop_get:cNN}
+% \begin{macro}{\prop_get:NnN}
+% \begin{macro}{\prop_get:cnN}
% \begin{macro}{\prop_get_aux:w}
% |\prop_get:NNN |\zz{plist}\zz{prop}\zz{tlp} defines
% \zz{tlp} to be the value associated with \zz{prop} in \zz{plist},
% |\q_no_value| if not found.
% \begin{macrocode}
-\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{\toks_set:Nn#4{#2}}
-\def_new:Npn \prop_get:cNN { \exp_args:Nc \prop_get:NNN }
+\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 }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\prop_gget:NNN}
+% \begin{macro}{\prop_gget:NnN}
% \begin{macro}{\prop_gget:NcN}
-% \begin{macro}{\prop_gget:cNN}
+% \begin{macro}{\prop_gget:cnN}
% \begin{macro}{\prop_gget_aux:w}
% The global version of the previous function.
% \begin{macrocode}
-\def_long_new:NNn \prop_gget:NNN 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{\toks_gset:Nn#4{#2}}
+\def_long_new:NNn \prop_gget:NnN 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}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -406,63 +406,66 @@
% from \m{property_list}. One probably also needs the local
% variants or only the local one, or\ldots\ We decide this later.
% \begin{macrocode}
-\def_long_new:NNn \prop_get_gdel:NNN 3{
- \prop_split_aux:NNn #1#2{\prop_get_del_aux:w #3{\toks_gset:Nn #1}#2}}
+\def_long_new:NNn \prop_get_gdel:NnN 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{
- \quark_if_no_value:nF{#5} {
- \def:Npn \tmp:w ##1#3\q_no_value {#2{#4##1}}
+ \tlp_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}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\prop_put:NNn}
+% \begin{macro}{\prop_put:Nnn}
% \begin{macro}{\prop_put:ccn}
-% \begin{macro}{\prop_gput:NNn}
-% \begin{macro}{\prop_gput:NNo}
-% \begin{macro}{\prop_gput:NNx}
-% \begin{macro}{\prop_gput:NOx}
-% \begin{macro}{\prop_gput:NOo}
+% \begin{macro}{\prop_gput:Nnn}
+% \begin{macro}{\prop_gput:Nno}
+% \begin{macro}{\prop_gput:Nnx}
+% \begin{macro}{\prop_gput:Nox}
+% \begin{macro}{\prop_gput:Noo}
% \begin{macro}{\prop_gput:Ncn}
-% \begin{macro}{\prop_gput:OOo}
+% \begin{macro}{\prop_gput:Ooo}
% \begin{macro}{\prop_gput:cNn}
% \begin{macro}{\prop_gput:ccn}
% \begin{macro}{\prop_gput:cco}
% \begin{macro}{\prop_gput:ccx}
% \begin{macro}{\prop_put_aux:w}
-% |\prop_put:NNn |\zz{plist}\zz{prop}\zv{val} adds/changes the
+% |\prop_put:Nnn |\zz{plist}\zz{prop}\zv{val} adds/changes the
% value associated with \zz{prop} in \zz{plist} to \zv{val}.
% \begin{macrocode}
-\def_long_new:NNn \prop_put:NNn 2{
- \prop_split_aux:NNn #1#2{
- \toks_clear:N #1
- \prop_put_aux:w {\toks_put_right:Nn #1}#2}
+\def_long_new:NNn \prop_put:Nnn 2{
+ \prop_split_aux:Nnn #1{#2}{
+ \prop_clear:N #1
+ \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{
- \prop_split_aux:NNn #1#2{
- \toks_gclear:N #1
- \prop_put_aux:w {\toks_gput_right:Nn #1}#2}
+\def_new:Npn \prop_put:ccn {\exp_args:Ncc \prop_put:Nnn }
+
+\def_long_new:NNn \prop_gput:Nnn 2{
+ \prop_split_aux:Nnn #1{#2}{
+ \prop_gclear:N #1
+ \prop_put_aux:w {\toks_gput_right:Nn #1}{#2}}
}
-\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_put_aux:w 6{
- #1{#2{#6}#3}
- \quark_if_no_value:nF {#4}
+ #1{\q_prop#2\q_prop{#6}#3}
+ \tlist_if_empty:nF{#5}
{
- \def:Npn \tmp:w ##1#2\q_no_value {#1{##1}}
+ \def:Npn \tmp:w ##1\q_prop#2\q_prop\q_no_value {#1{##1}}
\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}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -479,23 +482,21 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\prop_del:NN}
-% \begin{macro}{\prop_gdel:NN}
+% \begin{macro}{\prop_del:Nn}
+% \begin{macro}{\prop_gdel:Nn}
% \begin{macro}{\prop_del_aux:w}
% |\prop_del:NN |\zz{plist}\zz{prop} deletes the entry for
% \zz{prop} in \zz{plist}, if any.
% \begin{macrocode}
-\def_long_new:NNn \prop_del:NN 2{
- \prop_split_aux:NNn #1#2{\prop_del_aux:w {\toks_set:Nn #1}#2}}
-\def_long_new:NNn \prop_gdel:NN 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{\quark_if_no_value:nF {#4}
-% \end{macrocode}
-% I see no reason for updating the property list if we don't find
-% any entry.
-% \begin{macrocode}
-% {#1{#3}}
- {\def:Npn \tmp:w ##1#2\q_no_value {#1{#3##1}}\tmp:w #5}}
+\def_long_new:NNn \prop_del:Nn 2{
+ \prop_split_aux:Nnn #1{#2}{\prop_del_aux:w {\toks_set:Nn #1}{#2}}}
+\def_long_new:NNn \prop_gdel:Nn 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}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -503,8 +504,8 @@
%
%
%
-% \begin{macro}{\prop_if_in:NNTF}
-% \begin{macro}{\prop_if_in:NOTF}
+% \begin{macro}{\prop_if_in:NnTF}
+% \begin{macro}{\prop_if_in:NoTF}
% \begin{macro}{\prop_if_in:ccTF}
% \begin{macro}{\prop_if_in_aux:w}
% |\prop_if_in:NNTF| \m{property_list} \m{property_key}
@@ -512,25 +513,26 @@
% \m{property_key} is on the \m{property_list} and then select
% either the true or false case.
% \begin{macrocode}
-\def_new:NNn \prop_if_in:NNTF 2{
- \prop_split_aux:NNn #1#2\prop_if_in_aux:w}
-\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_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}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\prop_gput_if_new:NNn}
+% \begin{macro}{\prop_gput_if_new:Nnn}
% |\prop_gput_if_new:NNn| \m{property_list} \m{property_key}
% \m{property_value} is equivalent to
% \begin{tabbing}
% xxxxx\=xxxxx\= \kill
% |\prop_if_in:NNTF |\m{property}\m{property_key} \\
% \> |{}%| \\
-% \> |{\prop_gput:NNn| \\
+% \> |{\prop_gput:Nnn| \\
% \>\> \m{property_list} \\
% \>\> \m{property_key} \\
% \>\> \m{property_value}|}|
@@ -539,10 +541,10 @@
% F. and Louis A. which makes writing macros sometimes difficult; I
% find myself humming instead of working):
% \begin{macrocode}
-\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_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{
- \quark_if_no_value:nT {#4}{#1{#2{#6}#3}}}
+ \tlist_if_empty:nT {#5}{#1{\q_prop#2\q_prop{#6}#3}}}
% \end{macrocode}
% \end{macro}
%
@@ -558,12 +560,12 @@
% This makes two \m{plist}s have the same contents.
% \begin{macrocode}
\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: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_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:cN \toks_gset_eq:cN
\let_new:NN \prop_gset_eq:cc \toks_gset_eq:cc
% \end{macrocode}
% \end{macro}
@@ -622,13 +624,13 @@
% two arguments are equal; if they are not |#3| is executed.
% \begin{macrocode}
\def_new:NNn \prop_if_eq:NNTF 2 {
- \tlist_if_eq:xxTF{\prop_use:N #1}{\prop_use:N #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{\prop_use:N #1}{\prop_use:N #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{\prop_use:N #1}{\prop_use:N #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}
@@ -655,33 +657,69 @@
%
% \begin{macro}{\prop_map_function:NN}
% \begin{macro}{\prop_map_function:cN}
+% \begin{macro}{\prop_map_function:Nc}
% \begin{macro}{\prop_map_function:cc}
-% \begin{macro}{\prop_map_function_aux:NNn}
+% \begin{macro}{\prop_map_function_aux:w}
% Maps a function on every entry in the property list. The
% function must take 2 arguments: a key and a value.
% \begin{macrocode}
\def_new:Npn \prop_map_function:NN #1#2{
- \exp_after:NN \prop_map_function_aux:NNn
- \exp_after:NN #2 \prop_use:N #1 \q_nil \q_no_value \q_stop
+ \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
+}
+% problem with the above impl, is that an empty key stops the mapping but all
+% other functions in the module allow the use of empty keys (as one value)
+
+\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
+}
+\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
+ }
+}
+% problem with the above impl is that \quark_if_no_value:nF is fairly slow and
+% if \quark_if_no_value:NF is used instead we have to do an assignment thus
+% making the mapping not expandable (is that important?)
+
+\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
}
-\def_new:Npn \prop_map_function_aux:NNn #1#2#3{
- \if_meaning:NN \q_nil #1
+\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
\fi:
- #1#2{#3}
- \prop_map_function_aux:NNn #1
+ #1{#2}{#3}
+ \prop_map_function_aux:w #1
}
+
+% (potential) problem with the above impl is that it will returns true is #2
+% contains more than just \q_nil thus executing whatever follows. Claim: this
+% can't happen :-) so we should be ok
+
\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}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\prop_map_inline:Nn}
% \begin{macro}{\prop_map_inline:cn}
-% \begin{macro}{\prop_map_inline_aux:Nn}
% \begin{macro}{\l_prop_inline_level_num}
% The inline functions are straight forward. It takes longer
% to test if the list is empty than to run it on an empty list so
@@ -692,19 +730,15 @@
\num_incr:N \l_prop_inline_level_num
\def_long:cpn {prop_map_inline_ \num_use:N \l_prop_inline_level_num :n}
##1##2{#2}
- \exp_args:NcE \prop_map_function:N
- {prop_map_inline_ \num_use:N \l_prop_inline_level_num :n}
- \prop_use:N #1
- \q_nil \q_no_value \q_stop
+ \prop_map_function:Nc #1
+ {prop_map_inline_ \num_use:N \l_prop_inline_level_num :n}
\num_decr:N \l_prop_inline_level_num
}
\def_new:Npn \prop_map_inline:cN { \exp_args:Nc \prop_map_inline:NN }
-
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\prop_map_break:w}
% The break statement.
@@ -713,6 +747,37 @@
% \end{macrocode}
% \end{macro}
%
+% Finally a bunch of compatibility commands with the old syntax: they will
+% vanish soon!
+% \begin{macrocode}
+\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 }
+% \end{macrocode}
+%
% Show token usage:
% \begin{macrocode}
%</initex|package>
@@ -728,123 +793,9 @@
\file_input_stop:
% \end{macrocode}
%
-%
-% \section {Properties}
-%
-%
-% This is the version that uses individual pointers to hold the values.
-% maybe we need both?
-% It is currently disabled because it does not work with the
-% implementation of the mark mechanism.
-%
-% A property list is a control sequence whose top_level expansion is
-% of the form `\zz{tok$\sb1$}\zv{val$\sb1$} \ldots{}
-% \zz{tok$\sb{}n$}\zv{val$\sb{}n$}'. The properties have to be single token,
-% the values might be arbitrary token lists they get surrounded by
-% braces.
-%
-% To get values from property_lists token_lists should be passed to
-% the appropriate functions.
-%
-%
-% \begin{macro}{\prop_split_aux:NNn}
-% |\prop_split_aux:NNn|\zz{plist}\zz{prop}\zz{cmd} invokes \zz{cmd}
-% with 3 arguments: 1st is the beginning of \zz{plist} before
-% \zz{prop}, 2nd is the value associated with \zz{prop}, 3rd is the
-% rest of \zz{plist} after \zz{prop}. If there is no property
-% \zz{prop} in \zz{plist}, then the 2 arg is |\q_no_value | and
-% the 3rd arg is empty; otherwise the 3rd argument has the two
-% extra tokens \zz{prop} |\q_no_value| at the end.
-% \begin{macrocode}
-\def_long:Npn \prop_split_aux:NNn #1#2#3{
- \def:Npn \tmp:w ##1#2##2##3\q_stop {#3{##1}##2{##3}}
- \exp_after:NN\tmp:w #1#2\q_no_value \q_stop}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\prop_get:NNN}
-% \begin{macro}{\prop_get_aux:w}
-% |\prop_get:NNN |\zz{plist}\zz{prop}\zz{tlp} defines
-% command to be the value associated with \zz{prop} in \zz{plist},
-% |\q_no_value| if not found.
-% \begin{macrocode}
-\def_long:Npn \prop_get:NNN #1#2{\prop_split_aux:NNn
- #1#2\prop_get_aux:w}
-\def_long:Npn \prop_get_aux:w #1#2#3#4{\tlp_set_eq:NN#4#2}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\prop_put:NNn}
-% \begin{macro}{\prop_put_aux:w}
-% \begin{macro}{\prop_gput:NNn}
-% \begin{macro}{\prop_gput:NNx}
-% \begin{macro}{\prop_gput:NNo}
-% \begin{macro}{\prop_gput:NOx}
-% \begin{macro}{\prop_gput:NOo}
-% \begin{macro}{\prop_gput:OOo}
-% \begin{macro}{\prop_gput:ccx}
-% |\prop_put:NNn |\zz{plist}\zz{prop}\zv{val} adds/changes the
-% value associated with \zz{prop} in \zz{plist} to \zv{val}.
-% \begin{macrocode}
-\def_long:Npn \prop_put:NNn #1#2{\prop_split_aux:NNn
- #1#2{\prop_put_aux:w \tlp_set:Nn #1#2}}
-\def_long:Npn \prop_gput:NNn #1#2{\prop_split_aux:NNn
- #1#2{\prop_put_aux:w \tlp_gset:Nn #1#2}}
-\def:Npn \prop_gput:NNo {\exp_args:Nnno \prop_gput:NNn}
-\def:Npn \prop_gput:NOx {\exp_args:Nnox \prop_gput:NNn}
-\def:Npn \prop_gput:NNx {\exp_args:Nnnx \prop_gput:NNn}
-\def:Npn \prop_gput:NOo {\exp_args:NNOo \prop_gput:NNn}
-\def:Npn \prop_gput:OOo {\exp_args:NOOo \prop_gput:NNn}
-\def:Npn \prop_gput:ccn {\exp_args:Ncc \prop_gput:NNn}
-\def:Npn \prop_gput:ccx {\exp_args:Nccx \prop_gput:NNn}
-\def_long:Npn \prop_put_aux:w #1#2#3#4#5#6#7{
- \quark_if_no_value:nTF#5
- {
- \cs_ggen_sym:N\l_testa_tlp
- \exp_after:NN#1\exp_after:NN#2\exp_after:NN{\exp_after:NN#3\l_testa_tlp#4}
- \exp_after:NN\tlp_gset:Nn\l_testa_tlp
- }
- {#1#5}
- {#7}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-%
-% Show token usage:
% \begin{macrocode}
-%<*showmemory>
-%\showMemUsage
-%</showmemory>
%</unused>
% \end{macrocode}
%
% \endinput
%
-% $Log$
-% Revision 1.15 2006/03/20 18:26:38 braams
-% Updated the copyright notice (2006) and demoted all implementation
-% sections to subsections and so on to clean up the toc for source3.tex
-%
-% Revision 1.14 2005/12/27 16:00:44 morten
-% Update map functions and changed RCS information retrieval
-%
-% Revision 1.13 2005/03/22 23:26:14 morten
-% Added more functions, removed dependency of l3seq
-%
-% Revision 1.12 2005/03/16 22:36:04 braams
-% Added the tweaks necessary to be able to load with initex
-%
-% Revision 1.11 2005/03/11 21:40:35 braams
-% Fixed the use of RCS information; added \StopEventually
-%