summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keyval2e
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-15 23:03:35 +0000
committerKarl Berry <karl@freefriends.org>2011-08-15 23:03:35 +0000
commitc94e2deaaa21a46bcd63069cb63f3f6a807139a9 (patch)
treeaa4780c69b79091b8e7dde5806fde7dbea26e216 /Master/texmf-dist/tex/latex/keyval2e
parent73c5698f2b0b279e6ecb2a486f71dc70ba1d2340 (diff)
keyval2e (15aug11)
git-svn-id: svn://tug.org/texlive/trunk@23565 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keyval2e')
-rw-r--r--Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty72
1 files changed, 48 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty b/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty
index 36dbbe3786c..81e60c3e0c4 100644
--- a/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty
+++ b/Master/texmf-dist/tex/latex/keyval2e/keyval2e.sty
@@ -28,10 +28,13 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{keyval2e}[\StyleFileInfo]
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\SetStyleFileMessages[kve@]{info}{warn}{err}
-\robust@def*\kve@parse{\cpt@testopt\kve@parse@a,}
+\robust@def*\kve@parse{\cpt@teststopt\kve@parse@a,}
\robust@def*\kve@parse@a[#1]#2#3{%
- \pushfunctions\kve@parse{\ifloopbreak,\kve@do,\kve@act}\cpt@csvdepth
- \cpt@stfalse\cpt@csvnormalize[#1]{#2}%
+ \cpt@stchoose{cpt@st}{#2}\reserved@e\kve@parse
+ \ifx\@empty\reserved@e\begingroup\cpt@defrelax\fi
+ \pushfunctions\kve@parse
+ {\ifloopbreak,\kve@do,\kve@act}\cpt@csvdepth
+ \cpt@sttrue\cpt@csvnormalize[#1]\reserved@e
\def\kve@act##1{#3}%
\def\kve@do##1#1{%
\edef\reserved@a{\unexpanded\expandafter{\@gobble##1}}%
@@ -42,36 +45,55 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
}%
}%
\loopbreakfalse
- \ifcsemptyTF\normalized@list{}{%
- \expandafter\kve@do\expandafter.\normalized@list#1\cpt@nil#1%
- }%
- \popfunctions\kve@parse\cpt@csvdepth
+ \expandafter\kve@do\expandafter.\reserved@e#1\cpt@nil#1%
+ \popfunctions\kve@parse\cpt@csvdepth\cpt@relax
+}
+% \kve@definekeys[<pref>]{<fam>}[<mp>]{keya/defa/callback,...}
+\robust@def*\kve@definekeys{%
+ \begingroup\endlinechar\m@one
+ \cpt@teststopt\kve@d@finekeys{KV}%
}
-% \kve@definekeys[<KV>]{<fam>}{<keya/defa/callback, ...>}
-\robust@def*\kve@definekeys{\cpt@testopt\kve@d@finekeys{KV}}
\newletcs\kve@definekey\kve@definekeys
-\robust@def*\kve@d@finekeys[#1]#2#3{%
- \def\kve@rsvda##1{\csn@def{#1@#2@\currkey}####1{##1}}%
- \csn@def{#1@#2@initialkeyvals}{}%
+\robust@def*\kve@d@finekeys[#1]#2{%
+ \cpt@testopt{\kve@d@f@nekeys{#1}{#2}}{kvmp@}%
+}
+\robust@def*\kve@d@f@nekeys#1#2[#3]#4{%
+ \gletcs\ifcpt@defkeyst\ifcpt@st
+ \endgroup
+ \ifx\noindent#4\noindent\begingroup\cpt@defrelax\fi
+ \def\kve@d@f@n@keys##1{%
+ \ifcpt@defkeyst
+ \newcsndef*{#1@#2@\currkey}####1{%
+ \newcsndef*{#3\currkey}{####1}##1\relax
+ }%
+ \else
+ \csndef{#1@#2@\currkey}####1{%
+ \csndef{#3\currkey}{####1}##1\relax
+ }%
+ \fi
+ }%
+ \csndef{#1@#2@initialkeyvals}{}%
\def\kve@splita##1/{\def\currkey{##1}\kve@splitb.}%
\def\kve@splitb##1/##2/##3\kve@nil{%
\edef\currval{\unexpanded\expandafter{\@gobble##1}}%
- \csn@edef{#1@#2@\currkey @default}{%
+ \csnedef{#1@#2@\currkey @default}{%
\cptmakecs{#1@#2@\currkey}{\expandcsonce\currval}%
}%
- \kve@rsvda{##2}%
+ \kve@d@f@n@keys{##2}%
\letcstocsn\kve@tempa{#1@#2@initialkeyvals}%
- \csn@edef{#1@#2@initialkeyvals}{%
+ \csnedef{#1@#2@initialkeyvals}{%
\cptliststack,\kve@tempa\currkey=%
\oifstrcmpTF\currval{true}{false}{\expandcsonce\currval}%
}%
}%
- \kve@parse{#3}{\kve@splita##1///\kve@nil}%
+ \kve@parse{#4}{\kve@splita##1///\kve@nil}%
+ \kve@setdefaults[#1]{#2}[]\cpt@relax
}
-% \kve@setkeys[<KV>]{<fam>}[na]{<keyval>}
+% \kve@setkeys[pref]{<fam>}[na]{<keyval>}
\robust@def*\kve@setkeys{\cpt@testopt\kve@setkeys@a{KV}}
\robust@def*\kve@setkeys@a[#1]#2{\cpt@testopt{\kve@setkeys@b{#1}{#2}}{}}
\robust@def*\kve@setkeys@b#1#2[#3]#4{%
+ \ifx\noindent#4\noindent\begingroup\cpt@defrelax\fi
\pushfunctions\kve@setkeys{\currpref,\currfam,\currkey,%
\currval,\currkeyval}\kve@keydepth
\def\currpref{#1}\def\currfam{#2}%
@@ -85,15 +107,15 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
{\kve@setkeys@c{#1}{#2}}%
}%
\cpt@stfalse\cpt@kvnormalize[,]{#4}%
- \expandafter\kve@parse\expandafter
- {\normalized@list}{\kve@splita##1==\kve@nil}%
+ \kve@parse*\normalized@list{\kve@splita##1==\kve@nil}%
\popfunctions\kve@setkeys\kve@keydepth
+ \cpt@relax
}
\robust@def*\kve@setkeys@c#1#2{%
\ifcsndefTF{#1@#2@\currkey}{%
\ifcsemptyTF\currval{%
\begingroup
- \csn@def{#1@#2@\currkey}##1{\toks@{\def\currval{##1}}}%
+ \csndef{#1@#2@\currkey}##1{\toks@{\def\currval{##1}}}%
\csname#1@#2@\currkey @default\endcsname
\expandafter\endgroup\the\toks@
}{}%
@@ -114,13 +136,13 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
\cptliststack,\kve@keynames\cpttrimspaces{##1}%
}%
}%
- \expandafter\kve@parse\expandafter
- {\normalized@list}{\kve@g@tkeynames##1=\kve@nil}%
+ \kve@parse*\normalized@list{\kve@g@tkeynames##1=\kve@nil}%
\postgroupdef\kve@keynames\endgroup
}%
}
-% \kve@setdefaults[<KV>]{<fam>}[<na>]
+% \kve@setdefaults[<pref>]{<fam>}[<na>]
\robust@def*\kve@setdefaults{\cpt@testopt\kve@s@tdefaults{KV}}
+\newletcs\kve@setwithdefaults\kve@setdefaults
\robust@def*\kve@s@tdefaults[#1]#2{%
\cpt@testopt{\kve@s@td@faults{#1}{#2}}{}%
}
@@ -135,7 +157,7 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
{No initial key-value pairs saved for '#1,#2'.}%
}%
}
-% \kve@setafterdefaults[<KV>]{<fam>}[<na>]{<curr-keyval>}
+% \kve@setafterdefaults[<pref>]{<fam>}[<na>]{<curr-keyval>}
\robust@def*\kve@setafterdefaults{%
\cpt@testopt\kve@s@tafterdefaults{KV}%
}
@@ -143,6 +165,7 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
\cpt@testopt{\kve@s@taft@rdefaults{#1}{#2}}{}%
}
\robust@def*\kve@s@taft@rdefaults#1#2[#3]#4{%
+ \ifx\noindent#4\noindent\begingroup\cpt@defrelax\fi
\kve@getkeynames{#4}%
\letcstocsn\kve@tempa{#1@#2@initialkeyvals}%
\ifdefTF\kve@tempa{%
@@ -155,6 +178,7 @@ $Id: keyval2e.sty,v 0.0.1 2011/08/11 09:00:00 Ahmed Musa Exp $
\kve@err{No initial key values for family '#2'}
{No initial key-value pairs saved for '#1,#2'.}%
}%
+ \cpt@relax
}
\robust@def*\kve@keyvalerr{%
\kve@getinnoval*[10]\currval