diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty | 170 |
1 files changed, 149 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty b/Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty index 5ef5a0edab5..44cc56ca72c 100644 --- a/Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +++ b/Master/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty @@ -9,9 +9,9 @@ %% This is a generated file. %% %% Project: kvsetkeys -%% Version: 2011/04/07 v1.13 +%% Version: 2012/04/25 v1.16 %% -%% Copyright (C) 2006, 2007, 2009-2011 by +%% Copyright (C) 2006, 2007, 2009-2012 by %% Heiko Oberdiek <heiko.oberdiek at googlemail.com> %% %% This work may be distributed and/or modified under the @@ -35,7 +35,8 @@ %% and the derived files %% kvsetkeys.sty, kvsetkeys.pdf, kvsetkeys.ins, kvsetkeys.drv, %% kvsetkeys-example.tex, kvsetkeys-test1.tex, -%% kvsetkeys-test2.tex, kvsetkeys-test3.tex. +%% kvsetkeys-test2.tex, kvsetkeys-test3.tex, +%% kvsetkeys-test4.tex. %% \begingroup\catcode61\catcode48\catcode32=10\relax% \catcode13=5 % ^^M @@ -103,7 +104,7 @@ \fi \expandafter\x\csname ver@kvsetkeys.sty\endcsname \ProvidesPackage{kvsetkeys}% - [2011/04/07 v1.13 Key value parser (HO)]% + [2012/04/25 v1.16 Key value parser (HO)]% \begingroup\catcode61\catcode48\catcode32=10\relax% \catcode13=5 % ^^M \endlinechar=13 % @@ -139,7 +140,9 @@ \TMP@EnsureCode{36}{3}% $ \TMP@EnsureCode{38}{4}% & \TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{43}{12}% + \TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - \TMP@EnsureCode{46}{12}% . \TMP@EnsureCode{47}{12}% / \TMP@EnsureCode{91}{12}% [ @@ -200,11 +203,11 @@ $ \expandafter\endgroup \begingroup \toks@{,#1,}% \KVS@Comma - \KVS@SpaceComma{ }% + \KVS@SpaceComma \KVS@CommaSpace \KVS@CommaComma \KVS@Equals - \KVS@SpaceEquals{ }% + \KVS@SpaceEquals \KVS@EqualsSpace \xdef\KVS@Global{\the\toks@}% \endgroup @@ -214,7 +217,7 @@ $ \expandafter\endgroup \begingroup \toks@{,#1,}% \KVS@Comma - \KVS@SpaceComma{ }% + \KVS@SpaceComma \KVS@CommaSpace \KVS@CommaComma \xdef\KVS@Global{\the\toks@}% @@ -237,15 +240,17 @@ $ \expandafter\endgroup }% }% } -\long\def\KVS@SpaceComma#1{% - \expandafter\KVS@@SpaceComma\the\toks@#1,\KVS@Nil +\def\KVS@SpaceComma#1{% + \def\KVS@SpaceComma{% + \expandafter\KVS@@SpaceComma\the\toks@#1,\KVS@Nil + }% } +\KVS@SpaceComma{ } \long\def\KVS@@SpaceComma#1 ,#2\KVS@Nil{% \KVS@IfEmpty{#2}{% \toks@{#1}% }{% - \toks@{#1,#2}% - \expandafter\KVS@@SpaceComma\the\toks@\KVS@Nil + \KVS@@SpaceComma#1,#2\KVS@Nil }% } \def\KVS@CommaSpace{% @@ -255,18 +260,17 @@ $ \expandafter\endgroup \KVS@IfEmpty{#2}{% \toks@{#1}% }{% - \toks@{#1,#2}% - \expandafter\KVS@@CommaSpace\the\toks@\KVS@Nil + \KVS@@CommaSpace#1,#2\KVS@Nil }% } \def\KVS@CommaComma{% \expandafter\KVS@@CommaComma\the\toks@,\KVS@Nil } \long\def\KVS@@CommaComma#1,,#2\KVS@Nil{% - \toks@{#1,#2}% \KVS@IfEmpty{#2}{% + \toks@{#1,}% (!) }{% - \expandafter\KVS@@CommaComma\the\toks@\KVS@Nil + \KVS@@CommaComma#1,#2\KVS@Nil }% } \begingroup @@ -295,15 +299,17 @@ $ \expandafter\endgroup }% }% } -\long\def\KVS@SpaceEquals#1{% - \expandafter\KVS@@SpaceEquals\the\toks@#1=\KVS@Nil +\def\KVS@SpaceEquals#1{% + \def\KVS@SpaceEquals{% + \expandafter\KVS@@SpaceEquals\the\toks@#1=\KVS@Nil + }% } +\KVS@SpaceEquals{ } \long\def\KVS@@SpaceEquals#1 =#2\KVS@Nil{% \KVS@IfEmpty{#2}{% \toks@{#1}% }{% - \toks@{#1=#2}% - \expandafter\KVS@@SpaceEquals\the\toks@\KVS@Nil + \KVS@@SpaceEquals#1=#2\KVS@Nil }% } \def\KVS@EqualsSpace{% @@ -313,8 +319,7 @@ $ \expandafter\endgroup \KVS@IfEmpty{#2}{% \toks@{#1}% }{% - \toks@{#1=#2}% - \expandafter\KVS@@EqualsSpace\the\toks@\KVS@Nil + \KVS@@EqualsSpace#1=#2\KVS@Nil }% } \long\def\kv@parse#1{% @@ -383,6 +388,13 @@ $ \let\kv@value\KVS@Global \def\comma@break{% \let\KVS@MaybeBreak\KVS@break } +\def\kv@handled@false{% + \let\ifkv@handled@\iffalse +} +\def\kv@handled@true{% + \let\ifkv@handled@\iftrue +} +\kv@handled@true \def\kv@processor@default#1#2{% \begingroup \csname @safe@activestrue\endcsname @@ -393,6 +405,7 @@ $ \let\kv@value\KVS@Global \KVS@temp } \long\def\KVS@ProcessorDefault#1#2#3{% + \def\kv@fam{#1}% & \unless\ifcsname KV@#1@#2\endcsname $ \begingroup\expandafter\expandafter\expandafter\endgroup $ \expandafter\ifx\csname KV@#1@#2\endcsname\relax @@ -401,8 +414,13 @@ $ \begingroup\expandafter\expandafter\expandafter\endgroup $ \expandafter\ifx\csname KVS@#1@handler\endcsname\relax \kv@error@unknownkey{#1}{#2}% \else + \kv@handled@true \csname KVS@#1@handler\endcsname{#2}{#3}% \relax + \ifkv@handled@ + \else + \kv@error@unknownkey{#1}{#2}% + \fi \fi \else \ifx\kv@value\relax @@ -419,6 +437,66 @@ $ \expandafter\ifx\csname KV@#1@#2@default\endcsname\relax \fi \fi } +\def\kv@processor@known#1#2#3{% + \begingroup + \csname @safe@activestrue\endcsname + \let\ifincsname\iftrue + \edef\KVS@temp{\endgroup + \noexpand\KVS@ProcessorKnown{#1}\noexpand#2{#3}% + }% + \KVS@temp +} +\long\def\KVS@ProcessorKnown#1#2#3#4{% + \def\kv@fam{#1}% +& \unless\ifcsname KV@#1@#3\endcsname +$ \begingroup\expandafter\expandafter\expandafter\endgroup +$ \expandafter\ifx\csname KV@#1@#3\endcsname\relax +& \unless\ifcsname KVS@#1@handler\endcsname +$ \begingroup\expandafter\expandafter\expandafter\endgroup +$ \expandafter\ifx\csname KVS@#1@handler\endcsname\relax + \KVS@AddUnhandled#2{#3}{#4}% + \else + \kv@handled@true + \csname KVS@#1@handler\endcsname{#3}{#4}% + \relax + \ifkv@handled@ + \else + \KVS@AddUnhandled#2{#3}{#4}% + \fi + \fi + \else + \ifx\kv@value\relax +& \unless\ifcsname KV@#1@#2@default\endcsname +$ \begingroup\expandafter\expandafter\expandafter\endgroup +$ \expandafter\ifx\csname KV@#1@#3@default\endcsname\relax + \kv@error@novalue{#1}{#3}% + \else + \csname KV@#1@#3@default\endcsname + \relax + \fi + \else + \csname KV@#1@#3\endcsname{#4}% + \fi + \fi +} +\long\def\KVS@AddUnhandled#1#2#3{% +& \edef#1{% +& \ifx#1\KVS@empty +& \else +& \etex@unexpanded{#1},% +& \fi +& \etex@unexpanded{{#2}={#3}}% +& }% +$ \begingroup +$ \ifx#1\KVS@empty +$ \toks@{{#2}={#3}}% +$ \else +$ \toks@\expandafter{#1,{#2}={#3}}% +$ \fi +$ \xdef\KVS@Global{\the\toks@}% +$ \endgroup +$ \let#1\KVS@Global +} \long\def\kv@set@family@handler#1#2{% \begingroup \csname @safe@activestrue\endcsname @@ -426,6 +504,13 @@ $ \expandafter\ifx\csname KV@#1@#2@default\endcsname\relax \expandafter\endgroup \expandafter\def\csname KVS@#1@handler\endcsname##1##2{#2}% } +\long\def\kv@unset@family@handler#1#2{% + \begingroup + \csname @safe@activestrue\endcsname + \let\ifincsname\iftrue + \expandafter\endgroup + \expandafter\let\csname KVS@#1@handler\endcsname\@UnDeFiNeD +} \def\kv@error@novalue{% \kv@error@generic{No value specified for}% } @@ -445,6 +530,49 @@ $ \expandafter\ifx\csname KV@#1@#2@default\endcsname\relax \long\def\kvsetkeys#1#2{% \kv@parse{#2}{\kv@processor@default{#1}}% } +\def\kvsetkeys@expandafter#1#2{% + \expandafter\kv@parse\expandafter{#2}{% + \kv@processor@default{#1}% + }% +} +\def\KVS@cmd{0}% +\def\KVS@cmd@inc{% +& \edef\KVS@cmd{\the\numexpr\KVS@cmd+1}% +$ \begingroup +$ \count255=\KVS@cmd\relax +$ \advance\count255 by 1\relax +$ \edef\x{\endgroup +$ \noexpand\def\noexpand\KVS@cmd{\number\count255}% +$ }% +$ \x +} +\def\KVS@cmd@dec{% +& \edef\KVS@cmd{\the\numexpr\KVS@cmd-1}% +$ \begingroup +$ \count255=\KVS@cmd\relax +$ \advance\count255 by -1\relax +$ \edef\x{\endgroup +$ \noexpand\def\noexpand\KVS@cmd{\number\count255}% +$ }% +$ \x +} +\def\KVS@empty{} +\def\kvsetknownkeys{% + \expandafter + \KVS@setknownkeys\csname KVS@cmd\KVS@cmd\endcsname{}% +} +\long\def\KVS@setknownkeys#1#2#3#4#5{% + \let#1\KVS@empty + \KVS@cmd@inc + #2\kv@parse#2{#5}{\kv@processor@known{#3}#1}% + \KVS@cmd@dec + \let#4=#1% +} +\def\kvsetknownkeys@expandafter{% + \expandafter + \KVS@setknownkeys + \csname KVS@cmd\KVS@cmd\endcsname\expandafter +} \KVS@AtEnd% \endinput %% |